Skip to content

Commit

Permalink
Fix hvdc ra inverted (#1036)
Browse files Browse the repository at this point in the history
* Fix HVDC RA direction convention in CIM crac creation

Signed-off-by: thiriondan <[email protected]>
  • Loading branch information
danielthirion authored Jun 13, 2024
1 parent 05b370f commit cebab11
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,14 @@ private void checkRegisteredResource(RemedialActionRegisteredResource registered
}
}

// Return type :
// -- the boolean indicates whether the Hvdc line is inverted
/**
* @param networkElement - HVDC line name
* @param minCapacity
* @param maxCapacity
* @param inNode - The area of the related oriented border study where the energy flows INTO.
* @param outNode - The area of the related oriented border study where the energy comes FROM.
* @return - the boolean indicates whether the Hvdc line is inverted
*/
private boolean readHvdcRange(String networkElement, int minCapacity, int maxCapacity, String inNode, String outNode) {
HvdcLine hvdcLine = network.getHvdcLine(networkElement);
boolean isInverted;
Expand All @@ -245,11 +251,11 @@ private boolean readHvdcRange(String networkElement, int minCapacity, int maxCap
if (Objects.isNull(inNode) || Objects.isNull(outNode)) {
throw new OpenRaoImportException(ImportStatus.INCOMPLETE_DATA, "Missing HVDC in or out aggregate nodes");
}
if (inNode.equals(from) && outNode.equals(to)) {
if (inNode.equals(to) && outNode.equals(from)) {
isInverted = false;
min = minCapacity;
max = maxCapacity;
} else if (inNode.equals(to) && outNode.equals(from)) {
} else if (inNode.equals(from) && outNode.equals(to)) {
isInverted = true;
min = -maxCapacity;
max = -minCapacity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ void testImportHvdcRangeActions() {

Set<String> createdIds1 = Set.of("HVDC-direction11 + HVDC-direction12 - BBE2AA12 FFR3AA12 1", "HVDC-direction11 + HVDC-direction12 - BBE2AA11 FFR3AA11 1");
Set<String> createdIds2 = Set.of("HVDC-direction11 + HVDC-direction12 - BBE2AA12 FFR3AA12 1", "HVDC-direction11 + HVDC-direction12 - BBE2AA11 FFR3AA11 1");
assertHvdcRangeActionImported("HVDC-direction11", createdIds1, Set.of("BBE2AA11 FFR3AA11 1", "BBE2AA12 FFR3AA12 1"), Set.of("HVDC"), true);
assertHvdcRangeActionImported("HVDC-direction12", createdIds2, Set.of("BBE2AA11 FFR3AA11 1", "BBE2AA12 FFR3AA12 1"), Set.of("HVDC"), false);
assertHvdcRangeActionImported("HVDC-direction11", createdIds1, Set.of("BBE2AA11 FFR3AA11 1", "BBE2AA12 FFR3AA12 1"), Set.of("HVDC"), false);
assertHvdcRangeActionImported("HVDC-direction12", createdIds2, Set.of("BBE2AA11 FFR3AA11 1", "BBE2AA12 FFR3AA12 1"), Set.of("HVDC"), true);
assertEquals("BBE2AA11 FFR3AA11 1 + BBE2AA12 FFR3AA12 1", importedCrac.getHvdcRangeAction("HVDC-direction11 + HVDC-direction12 - BBE2AA12 FFR3AA12 1").getGroupId().get());
assertEquals("BBE2AA11 FFR3AA11 1 + BBE2AA12 FFR3AA12 1", importedCrac.getHvdcRangeAction("HVDC-direction11 + HVDC-direction12 - BBE2AA11 FFR3AA11 1").getGroupId().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<name>Contingency 1 name</name>
</Contingency_Series>
<RemedialAction_Series>
<mRID>HVDC-direction12@100.0@</mRID>
<name>HVDC-direction12@100.0@</name>
<mRID>HVDC-direction11@100.0@</mRID>
<name>HVDC-direction11@100.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -99,8 +99,8 @@
<name>Contingency 2 name</name>
</Contingency_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -265,8 +265,8 @@
<applicationMode_MarketObjectStatus.status>A18</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
<mRID>HVDC-direction12@100.0@</mRID>
<name>HVDC-direction12@100.0@</name>
<mRID>HVDC-direction11@100.0@</mRID>
<name>HVDC-direction11@100.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -375,8 +375,8 @@
<applicationMode_MarketObjectStatus.status>A18</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<name>Contingency 2 name</name>
</Contingency_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -281,8 +281,8 @@
<applicationMode_MarketObjectStatus.status>A18</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<name>Contingency 1 name</name>
</Contingency_Series>
<RemedialAction_Series>
<mRID>HVDC-direction12@100.0@</mRID>
<name>HVDC-direction12@100.0@</name>
<mRID>HVDC-direction11@100.0@</mRID>
<name>HVDC-direction11@100.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -99,8 +99,8 @@
<name>Contingency 2 name</name>
</Contingency_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -271,8 +271,8 @@
<applicationMode_MarketObjectStatus.status>A18</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
<mRID>HVDC-direction12@100.0@</mRID>
<name>HVDC-direction12@100.0@</name>
<mRID>HVDC-direction11@100.0@</mRID>
<name>HVDC-direction11@100.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down Expand Up @@ -381,8 +381,8 @@
<applicationMode_MarketObjectStatus.status>A18</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
<mRID>HVDC-direction11@400.0@</mRID>
<name>HVDC-direction11@400.0@</name>
<mRID>HVDC-direction12@400.0@</mRID>
<name>HVDC-direction12@400.0@</name>
<applicationMode_MarketObjectStatus.status>A20</applicationMode_MarketObjectStatus.status>
</RemedialAction_Series>
<RemedialAction_Series>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Feature: US 21.6 : Import HVDC Range Actions
| HVDC-direction1 + HVDC-direction2 - BBE2AA12 FFR3AA12 1 | HVDC-direction1 + HVDC-direction2 - BBE2AA12 FFR3AA12 1 | BBE2AA12 FFR3AA12 1 | BBE2AA11 FFR3AA11 1 + BBE2AA12 FFR3AA12 1 | 0.0 |
And the HVDC range actions should have the following ranges:
| HvdcRangeActionId | Ranges | RangeType | Min | Max |
| HVDC-direction1 + HVDC-direction2 - BBE2AA11 FFR3AA11 1 | 1 | ABSOLUTE | -1500.0 | 1000.0 |
| HVDC-direction1 + HVDC-direction2 - BBE2AA12 FFR3AA12 1 | 1 | ABSOLUTE | -1500.0 | 1000.0 |
| HVDC-direction1 + HVDC-direction2 - BBE2AA11 FFR3AA11 1 | 1 | ABSOLUTE | -1000.0 | 1500.0 |
| HVDC-direction1 + HVDC-direction2 - BBE2AA12 FFR3AA12 1 | 1 | ABSOLUTE | -1000.0 | 1500.0 |
And the remedial actions should have the following usage rules:
| RemedialActionId | UsageRules | Rule | Method | Instant | ContingencyId | FlowCnecId |
| HVDC-direction1 + HVDC-direction2 - BBE2AA11 FFR3AA11 1 | 1 | OnContingencyState | Forced | auto | Co-1 | |
Expand Down

0 comments on commit cebab11

Please sign in to comment.