Skip to content

Commit

Permalink
Fix unpaired DanglingLine simulated with split shunt admittance (#1098)
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
  • Loading branch information
jeandemanged authored Oct 8, 2024
1 parent 6d521fc commit 5e3d7b1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public static LfDanglingLineBranch create(DanglingLine danglingLine, LfNetwork n
Objects.requireNonNull(bus2);
Objects.requireNonNull(parameters);
double zb = PerUnit.zb(danglingLine.getTerminal().getVoltageLevel().getNominalV());
// iIDM DanglingLine shunt admittance is network side only which is always side 1 (boundary is side 2).
PiModel piModel = new SimplePiModel()
.setR(danglingLine.getR() / zb)
.setX(danglingLine.getX() / zb)
.setG1(danglingLine.getG() / 2 * zb)
.setG2(danglingLine.getG() / 2 * zb)
.setB1(danglingLine.getB() / 2 * zb)
.setB2(danglingLine.getB() / 2 * zb);
.setG1(danglingLine.getG() * zb)
.setG2(0)
.setB1(danglingLine.getB() * zb)
.setB2(0);
return new LfDanglingLineBranch(network, bus1, bus2, piModel, danglingLine, parameters);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ void test() {
void testWithVoltageRegulationOn() {
g1.setTargetQ(0);
g1.setVoltageRegulatorOn(false);
// FIXME: no targetV here?
dl1.getGeneration().setVoltageRegulationOn(true);
dl1.getGeneration().setMinP(0);
dl1.getGeneration().setMaxP(10);
Expand Down Expand Up @@ -105,7 +104,7 @@ void testWithVoltageRegulationOn() {

@Test
void testWithXnode() {
Network network = BoundaryFactory.createWithXnode();
network = BoundaryFactory.createWithXnode();
parameters.setUseReactiveLimits(true);
parameters.setDistributedSlack(true);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
Expand All @@ -119,7 +118,7 @@ void testWithXnode() {

@Test
void testWithTieLine() {
Network network = BoundaryFactory.createWithTieLine();
network = BoundaryFactory.createWithTieLine();
parameters.setUseReactiveLimits(true);
parameters.setDistributedSlack(true);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
Expand All @@ -140,7 +139,7 @@ void testWithTieLine() {

@Test
void testEquivalentBranch() {
Network network = VoltageControlNetworkFactory.createNetworkWithT2wt();
network = VoltageControlNetworkFactory.createNetworkWithT2wt();
network.newLine()
.setId("LINE_23")
.setBus1("BUS_2")
Expand Down Expand Up @@ -183,4 +182,25 @@ void testWithNonImpedantDanglingLine() {
assertActivePowerEquals(101.0, dl1.getTerminal());
assertReactivePowerEquals(Double.NaN, dl1.getTerminal());
}

@Test
void testDanglingLineShuntAdmittance() {
// verify dangling line shunt admittance is correctly accounted to be completely on network side (and not split with boundary side)

// setup zero flows flow at dangling line boundary side
dl1.setP0(0.0).setQ0(0.0).getGeneration().setTargetP(0.0).setTargetQ(0.0).setVoltageRegulationOn(false);

// set higher B and G shunt values, and also much higher series impedance, so we would get very different results if the shunt admittance were split
dl1.setB(1e-3).setG(1e-4).setR(3.).setX(30.);

// set g1 to regulate dl1 terminal at 400.0 kV
g1.setRegulatingTerminal(dl1.getTerminal()).setTargetV(400.0);

LoadFlowResult result = loadFlowRunner.run(network, parameters);

assertTrue(result.isFullyConverged());
assertVoltageEquals(400.0, bus2);
assertActivePowerEquals(16., dl1.getTerminal()); // v^2 * B_shunt
assertReactivePowerEquals(-160., dl1.getTerminal()); // - v^2 * G_shunt
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void testConvergedUniformCriteria() {
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isFullyConverged());
assertEquals(LoadFlowResult.ComponentResult.Status.CONVERGED, result.getComponentResults().get(0).getStatus());
assertEquals(1, result.getComponentResults().get(0).getIterationCount());
assertEquals(2, result.getComponentResults().get(0).getIterationCount());
}

@Test
Expand Down Expand Up @@ -112,7 +112,7 @@ void testReactivePowerConvergedPerEquationCriteria() {
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isFullyConverged());
assertEquals(LoadFlowResult.ComponentResult.Status.CONVERGED, result.getComponentResults().get(0).getStatus());
assertEquals(5, result.getComponentResults().get(0).getIterationCount());
assertEquals(11, result.getComponentResults().get(0).getIterationCount());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,15 @@ void testSaWithStateMonitorDanglingLine() {
Collections.emptyList(), Collections.emptyList(), ReportNode.NO_OP);
BranchResult preContingencyBranchResult = result.getPreContingencyResult().getNetworkResult().getBranchResult("dl1");
assertEquals(Double.NaN, preContingencyBranchResult.getFlowTransfer(), LoadFlowAssert.DELTA_POWER);
assertEquals(91.293, preContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER);
assertEquals(91.294, preContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER);
assertEquals(-91.000, preContingencyBranchResult.getP2(), LoadFlowAssert.DELTA_POWER);
assertEquals(260.511, preContingencyBranchResult.getI1(), LoadFlowAssert.DELTA_POWER);
assertEquals(260.970, preContingencyBranchResult.getI2(), LoadFlowAssert.DELTA_POWER);
assertEquals(149.751, preContingencyBranchResult.getQ1(), LoadFlowAssert.DELTA_POWER);
assertEquals(-150.000, preContingencyBranchResult.getQ2(), LoadFlowAssert.DELTA_POWER);
BranchResult postContingencyBranchResult = getPostContingencyResult(result, "contingency").getNetworkResult().getBranchResult("dl1");
assertEquals(Double.NaN, postContingencyBranchResult.getFlowTransfer(), LoadFlowAssert.DELTA_POWER);
assertEquals(91.293, postContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER);
assertEquals(91.294, postContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER);
assertEquals(-91.000, postContingencyBranchResult.getP2(), LoadFlowAssert.DELTA_POWER);
assertEquals(260.488, postContingencyBranchResult.getI1(), LoadFlowAssert.DELTA_POWER);
assertEquals(260.947, postContingencyBranchResult.getI2(), LoadFlowAssert.DELTA_POWER);
Expand Down

0 comments on commit 5e3d7b1

Please sign in to comment.