Skip to content

Commit

Permalink
Fix flow decomposition loss compensation when dangling lines have shu…
Browse files Browse the repository at this point in the history
…nt susceptance (#160)

* fix losses compensation when dangling lines have shunt susceptance

Signed-off-by: Caio Luke <caioluke97@gmail.com>
  • Loading branch information
caioluke authored Sep 20, 2024
1 parent da53ae2 commit 4e4c5e8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
3 changes: 2 additions & 1 deletion docs/flow_decomposition/algorithm-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ These losses are then compensated on the sending side of each network element.
![Losses compensation on lines](/_static/img/flow_decomposition/lossesCompensationOnLine.svg)

A special treatment is done on tie lines, where instead of compensating the losses on the sending terminal, losses are
compensated at both sides proportionally to the resistance of each half line.
compensated at both sides. Losses are calculated for each half line individually by adding its terminal and boundary flows.
If the half lines have no shunt susceptance, this corresponds to split tie line losses proportionally to the resistance of each half line.

![Losses compensation on tie lines](/_static/img/flow_decomposition/lossesCompensationOnTieLine.svg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,12 @@ private void compensateLossesOnBranch(Network network, Branch<?> branch) {
}

private void compensateLossesOnTieLine(Network network, TieLine tieLine) {
double r1 = tieLine.getDanglingLine1().getR();
double r2 = tieLine.getDanglingLine2().getR();
double r = r1 + r2;
Terminal terminal1 = tieLine.getDanglingLine1().getTerminal();
Terminal terminal2 = tieLine.getDanglingLine2().getTerminal();
double losses = terminal1.getP() + terminal2.getP();
double lossesSide1 = losses * r1 / r;
double lossesSide2 = losses * r2 / r;

DanglingLine danglingLine1 = tieLine.getDanglingLine1();
DanglingLine danglingLine2 = tieLine.getDanglingLine2();
Terminal terminal1 = danglingLine1.getTerminal();
Terminal terminal2 = danglingLine2.getTerminal();
double lossesSide1 = terminal1.getP() + danglingLine1.getBoundary().getP();
double lossesSide2 = terminal2.getP() + danglingLine2.getBoundary().getP();
updateLoadForLossesOnTerminal(network, terminal1, lossesSide1);
updateLoadForLossesOnTerminal(network, terminal2, lossesSide2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
package com.powsybl.flow_decomposition;

import com.powsybl.flow_decomposition.xnec_provider.XnecProviderByIds;
import com.powsybl.iidm.network.Bus;
import com.powsybl.iidm.network.Country;
import com.powsybl.iidm.network.Load;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.*;
import com.powsybl.loadflow.LoadFlow;
import com.powsybl.loadflow.LoadFlowParameters;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -106,6 +103,10 @@ void checkThatLossesCompensationOnTieLineDoesDispatchLossesProportionallyToEachS
LossesCompensator lossesCompensator = new LossesCompensator(FlowDecompositionParameters.DISABLE_LOSSES_COMPENSATION_EPSILON);
lossesCompensator.run(network);

TieLine tieLine = network.getTieLine("FGEN1 11 X 11 1 + X 11 BLOAD 11 1");
assertEquals(0.0, tieLine.getDanglingLine1().getB(), EPSILON);
assertEquals(0.0, tieLine.getDanglingLine2().getB(), EPSILON);

Load lossesFgenBload = network.getLoad("LOSSES FGEN1 11 X 11 1 + X 11 BLOAD 11 1");
assertNull(lossesFgenBload);

Expand All @@ -119,6 +120,33 @@ void checkThatLossesCompensationOnTieLineDoesDispatchLossesProportionallyToEachS
assertEquals(0.046875, lossesBloadX.getP0(), EPSILON);
}

@Test
void checkThatLossesCompensationOnTieLineDoesDispatchLossesProportionallyToEachSideResistanceWithB() {
String networkFileName = "NETWORK_SINGLE_LOAD_TWO_GENERATORS_WITH_XNODE.uct";

Network network = importNetwork(networkFileName);
TieLine tieLine = network.getTieLine("FGEN1 11 X 11 1 + X 11 BLOAD 11 1");
tieLine.getDanglingLine1().setB(1E-3);
tieLine.getDanglingLine2().setB(1E-3);
LoadFlowParameters loadFlowParameters = new LoadFlowParameters();
loadFlowParameters.setDc(AC_LOAD_FLOW);
LoadFlow.run(network, loadFlowParameters);
LossesCompensator lossesCompensator = new LossesCompensator(FlowDecompositionParameters.DISABLE_LOSSES_COMPENSATION_EPSILON);
lossesCompensator.run(network);

Load lossesFgenBload = network.getLoad("LOSSES FGEN1 11 X 11 1 + X 11 BLOAD 11 1");
assertNull(lossesFgenBload);

Load lossesFgenX = network.getLoad("LOSSES FGEN1 11");
assertNotNull(lossesFgenX);
assertEquals("FGEN1 1", lossesFgenX.getTerminal().getVoltageLevel().getId());
assertEquals(0.044098, lossesFgenX.getP0(), EPSILON);
Load lossesBloadX = network.getLoad("LOSSES BLOAD 11");
assertNotNull(lossesBloadX);
assertEquals("BLOAD 1", lossesBloadX.getTerminal().getVoltageLevel().getId());
assertEquals(0.050000, lossesBloadX.getP0(), EPSILON);
}

@Test
void checkThatDefaultFlowDecompositionDoesNotCompensateLosses() {
String networkFileName = "NETWORK_SINGLE_LOAD_TWO_GENERATORS_WITH_COUNTRIES_EXTRA_SUBSTATION.uct";
Expand Down

0 comments on commit 4e4c5e8

Please sign in to comment.