Skip to content

Commit

Permalink
adapt cucumber
Browse files Browse the repository at this point in the history
Signed-off-by: Godelaine de Montmorillon <[email protected]>
  • Loading branch information
Godelaine committed Feb 10, 2025
1 parent b4e88d6 commit 288123b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,19 +539,12 @@ private static Map<String, Double> computeHvdcAngleDroopActivePowerControlValues
}

/**
* Compute setpoint set by AngleDroopActivePowerControl = p0 + droop * angle difference
* NB: p0 and angle difference are always in 1->2 direction
* Get setpoint set by AngleDroopActivePowerControl
*
* @param hvdcLine: HVDC line object
* @return the setpoint computed by the HvdcAngleDroopActivePowerControl
*/
private static double computeHvdcAngleDroopActivePowerControlValue(HvdcLine hvdcLine) {
double phi1 = hvdcLine.getConverterStation1().getTerminal().getBusView().getBus().getAngle();
double phi2 = hvdcLine.getConverterStation2().getTerminal().getBusView().getBus().getAngle();
double p0 = hvdcLine.getExtension(HvdcAngleDroopActivePowerControl.class).getP0();
double droop = hvdcLine.getExtension(HvdcAngleDroopActivePowerControl.class).getDroop();
// Bug : quand la branche est ouverte, phi1/phi2 sont nuls (nullpointer sur getBusView)
// TODO :add UT
if (hvdcLine.getConvertersMode().equals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER)) {
return hvdcLine.getConverterStation2().getTerminal().getP();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ void testDisableHvdcAngleDroopControl2() {
assertEquals(2451.3764524964786, result.getRight().get(hvdcRa1), DOUBLE_TOLERANCE);
assertEquals(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER, network.getHvdcLine(hvdcRa1.getNetworkElement().getId()).getConvertersMode());
assertEquals(2451.3764524964786, network.getHvdcLine(hvdcRa1.getNetworkElement().getId()).getActivePowerSetpoint(), DOUBLE_TOLERANCE);
assertEquals(-46.65616621806521, result.getRight().get(hvdcRa2), DOUBLE_TOLERANCE);
assertEquals(-45.72718047413281, result.getRight().get(hvdcRa2), DOUBLE_TOLERANCE);
assertEquals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER, network.getHvdcLine(hvdcRa2.getNetworkElement().getId()).getConvertersMode());
assertEquals(46.65616621806521, network.getHvdcLine(hvdcRa2.getNetworkElement().getId()).getActivePowerSetpoint(), DOUBLE_TOLERANCE);
assertEquals(45.72718047413281, network.getHvdcLine(hvdcRa2.getNetworkElement().getId()).getActivePowerSetpoint(), DOUBLE_TOLERANCE);
}

@Test
Expand All @@ -363,31 +363,6 @@ void testDisableHvdcAngleDroopControl4() {
assertEquals(Map.of(), result.getRight());
}

@Test
void testDisableHvdcAngleDroopControl5() {
// Test with phi1 < phi2
PrePerimeterResult prePerimeterResult = mock(PrePerimeterResult.class);
when(mockedPreAutoPerimeterSensitivityAnalysis.runBasedOnInitialResults(any(), any(), any(), any(), any())).thenReturn(mockedPrePerimeterResult);

HvdcLine hvdcLine = network.getHvdcLine("BBE2AA11 FFR3AA11 1");
hvdcLine.getExtension(HvdcAngleDroopActivePowerControl.class).setP0(100f);
network.getGenerator("BBE2AA11_generator").setTargetP(0);
network.getLoad("BBE2AA11_load").setP0(3000);
network.getGenerator("FFR3AA11_generator").setTargetP(6460);
network.getLoad("FFR3AA11_load").setP0(0);
network.getGenerator("FFR5AA11_generator").setTargetP(6460);
network.getLoad("FFR5AA11_load").setP0(0);
hvdcLine.setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER);

Pair<PrePerimeterResult, Map<HvdcRangeAction, Double>> result = automatonSimulator.disableHvdcAngleDroopActivePowerControl(List.of(hvdcRa1), network, mockedPreAutoPerimeterSensitivityAnalysis, prePerimeterResult, autoState);
assertFalse(network.getHvdcLine("BBE2AA11 FFR3AA11 1").getExtension(HvdcAngleDroopActivePowerControl.class).isEnabled());
assertEquals(mockedPrePerimeterResult, result.getLeft());
assertEquals(1, result.getRight().size());
assertEquals(-813.9957894885341, result.getRight().get(hvdcRa1), DOUBLE_TOLERANCE);
assertEquals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER, network.getHvdcLine(hvdcRa1.getNetworkElement().getId()).getConvertersMode());
assertEquals(813.9957894885341, network.getHvdcLine(hvdcRa1.getNetworkElement().getId()).getActivePowerSetpoint(), DOUBLE_TOLERANCE);
}

@Test
void testDisableHvdcAngleDroopControl6() {
// Initial setpoint is out of RA's allowed range. Do not disable HvdcAngleDroopControl
Expand Down Expand Up @@ -701,7 +676,7 @@ void testDisableHvdcAngleDroopControlBeforeShifting() {
assertFalse(network.getHvdcLine("BBE2AA12 FFR3AA12 1").getExtension(HvdcAngleDroopActivePowerControl.class).isEnabled());
assertEquals(2451.3764524964786, network.getHvdcLine("BBE2AA11 FFR3AA11 1").getActivePowerSetpoint(), DOUBLE_TOLERANCE);
assertEquals(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER, network.getHvdcLine("BBE2AA11 FFR3AA11 1").getConvertersMode());
assertEquals(46.65616621806521, network.getHvdcLine("BBE2AA12 FFR3AA12 1").getActivePowerSetpoint(), DOUBLE_TOLERANCE);
assertEquals(45.72718047413281, network.getHvdcLine("BBE2AA12 FFR3AA12 1").getActivePowerSetpoint(), DOUBLE_TOLERANCE);
assertEquals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER, network.getHvdcLine("BBE2AA12 FFR3AA12 1").getConvertersMode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Feature: US 15.11.3: Simulate range action automatons right after topological au
And the margin on cnec "be4_fr5_co1 - BBE4AA11->FFR5AA11 - co1_be1_fr5 - auto" after PRA should be -631.83 MW
And 1 remedial actions are used after "co1_be1_fr5" at "auto"
And the remedial action "ARA_HVDC" is used after "co1_be1_fr5" at "auto"
And the setpoint of RangeAction "ARA_HVDC" should be 1879.68 MW after "co1_be1_fr5" at "auto"
And the margin on cnec "be4_fr5_co1 - BBE4AA11->FFR5AA11 - co1_be1_fr5 - auto" after ARA should be 0.0 MW
And the margin on cnec "be3_be4_co1 - BBE3AA11->BBE4AA11 - co1_be1_fr5 - auto" after ARA should be 12.01 MW
And its security status should be "secured"
And the setpoint of RangeAction "ARA_HVDC" should be 965.75 MW after "co1_be1_fr5" at "auto"
And the margin on cnec "be3_be4_co1 - BBE3AA11->BBE4AA11 - co1_be1_fr5 - auto" after ARA should be -29.5 MW
And the margin on cnec "be4_fr5_co1 - BBE4AA11->FFR5AA11 - co1_be1_fr5 - auto" after ARA should be 1.12 MW
And its security status should be "UNSECURED"

@fast @rao @mock @ac @contingency-scenarios
Scenario: US 15.11.3.2: 1 auto PST
Expand Down Expand Up @@ -110,4 +110,4 @@ Feature: US 15.11.3: Simulate range action automatons right after topological au
And the tap of PstRangeAction "pst_be_ara" should be -16 after "co2_be1_be3" at "curative"
And the margin on cnec "FFR4AA1 DDE1AA1 1 - co2_be1_be3 - curative" after CRA should be -58 A
And the margin on cnec "BBE2AA1 FFR3AA1 1 - co2_be1_be3 - curative" after CRA should be 305 A
And the worst margin is -58 A
And the worst margin is -58 A

0 comments on commit 288123b

Please sign in to comment.