diff --git a/src/main/java/com/powsybl/openloadflow/ac/AcTargetVector.java b/src/main/java/com/powsybl/openloadflow/ac/AcTargetVector.java index 7f5c4d93aa..67cbfffac8 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/AcTargetVector.java +++ b/src/main/java/com/powsybl/openloadflow/ac/AcTargetVector.java @@ -66,7 +66,7 @@ private static double getReactivePowerControlTarget(LfBranch branch) { public static void init(Equation equation, LfNetwork network, double[] targets) { switch (equation.getType()) { - case BUS_TARGET_P: + case BUS_TARGET_P, BUS_DISTR_SLACK_P: targets[equation.getColumn()] = network.getBus(equation.getElementNum()).getTargetP(); break; @@ -118,7 +118,6 @@ public static void init(Equation equation, LfNet DISTR_SHUNT_B, DUMMY_TARGET_P, DUMMY_TARGET_Q, - BUS_DISTR_SLACK_P, BUS_TARGET_IX_ZERO, BUS_TARGET_IY_ZERO, BUS_TARGET_IX_NEGATIVE, diff --git a/src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemCreator.java b/src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemCreator.java index a3b190b729..a29a2d5a45 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemCreator.java +++ b/src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemCreator.java @@ -1037,13 +1037,13 @@ private void createMultipleSlackBusesEquations(EquationSystem slackBusResults = componentResult.getSlackBusResults(); - TwoWindingsTransformer t2wtLoad = network.getTwoWindingsTransformer("NHV2_NLOAD"); Load load = network.getLoad("LOAD"); - // Load is ignored by LF equations only slack goes to this bus - assertEquals(-301.159, t2wtLoad.getTerminal2().getP(), LoadFlowAssert.DELTA_POWER); + assertEquals(-600.71, t2wtLoad.getTerminal2().getP(), LoadFlowAssert.DELTA_POWER); assertEquals(600.0, load.getTerminal().getP(), LoadFlowAssert.DELTA_POWER); - // Slack bus mismatch is false + // still a small difference, needs a bit more investigation assertEquals(2, slackBusResults.size()); - assertEquals(-1.15940, slackBusResults.get(0).getActivePowerMismatch(), LoadFlowAssert.DELTA_POWER); - assertEquals(-1.15940, slackBusResults.get(1).getActivePowerMismatch(), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.711, slackBusResults.get(0).getActivePowerMismatch(), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.711, slackBusResults.get(1).getActivePowerMismatch(), LoadFlowAssert.DELTA_POWER); } }