Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OFCC triggered after any outage #1078

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public Set<NetworkAction> getActivatedNetworkActions() {
TopoAutomatonSimulationResult simulateTopologicalAutomatons(State automatonState, Network network, PrePerimeterSensitivityAnalysis preAutoPstOptimizationSensitivityAnalysis) {
// -- Apply network actions
// -- First get forced network actions
Set<FlowCnec> flowCnecs = crac.getFlowCnecs();
Set<FlowCnec> flowCnecs = crac.getFlowCnecs(automatonState);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also check the curative cnecs on the same contingency?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(to check with Sebastien)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good question... I would say no, but still have to check

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preparing for a release this afternoon or tomorrow morning, shall we include this fix?

Set<NetworkAction> appliedNetworkActions = crac.getNetworkActions().stream()
.filter(ra -> RaoUtil.isRemedialActionForced(ra, automatonState, prePerimeterSensitivityOutput, flowCnecs, network, raoParameters))
.peek(networkAction -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,29 @@ Feature: User Story #16.5: activate remedial actions only after a constraint in
And the tap of PstRangeAction "pst_be" should be 2 after "co1_fr2_fr3_1" at "curative"
And the worst margin is -37 A
And the margin on cnec "FFR3AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be -37 A
And the margin on cnec "BBE2AA1 FFR3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be -13 A
And the margin on cnec "BBE2AA1 FFR3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be -13 A

@fast @rao @mock @ac @contingency-scenarios
Scenario: US 16.5.14: Trigger ARA only after a given outage
Given network file is "epic16/12Nodes3ParallelLines.uct"
Given crac file is "epic16/crac_16_5_14.json"
Given configuration file is "common/RaoParameters_maxMargin_megawatt_dc.json"
When I launch search_tree_rao
# An overload is created in the Netherlands only after co_nl1_nl_2_1
# Thus, the OnFlowConstraintInCountry ARA must be triggered only after this contingency
Then 1 remedial actions are used after "co_nl1_nl_2_1" at "auto"
And the remedial action "open_nl1_nl2_2" is used after "co_nl1_nl_2_1" at "auto"
And the flow on cnec "nl1_nl2_2_auto - co_nl1_nl_2_1" after ARA should be 0 A
And 0 remedial actions are used after "co_nl1_nl_2_3" at "auto"

@fast @rao @mock @ac @contingency-scenarios
Scenario: US 16.5.15: Trigger CRA only after a given outage
Given network file is "epic16/12Nodes4ParallelLines.uct"
Given crac file is "epic16/crac_16_5_15.json"
Given configuration file is "common/RaoParameters_maxMargin_megawatt_dc.json"
When I launch search_tree_rao
# An overload is created in the Netherlands only after co_nl1_nl_2_1
# Thus, the OnFlowConstraintInCountry CRA must be triggered only after this contingency
Then 1 remedial actions are used after "co_nl1_nl_2_1" at "curative"
And the remedial action "close_nl1_nl2_4" is used after "co_nl1_nl_2_1" at "curative"
And 0 remedial actions are used after "co_nl1_nl_2_3" at "curative"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##C 2007.05.01
##N
##ZBE
BBE1AA1 BE1 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
BBE2AA1 BE2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
BBE3AA1 BE3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZDE
DDE1AA1 DE1 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
DDE2AA1 DE2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
DDE3AA1 DE3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZFR
FFR1AA1 FR1 0 2 400.00 1000.00 0.00000 00000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0
FFR2AA1 FR2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
FFR3AA1 FR3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZNL
NNL1AA1 NL1 0 2 400.00 0.00000 0.00000 -1000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0
NNL2AA1 NL2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
NNL3AA1 NL3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##L
BBE1AA1 BBE2AA1 1 0 0.0000 10.000 0.000000 5000
BBE1AA1 BBE3AA1 1 0 0.0000 10.000 0.000000 5000
FFR1AA1 FFR2AA1 1 0 0.0000 10.000 0.000000 5000
FFR1AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
FFR2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
DDE1AA1 DDE2AA1 1 0 0.0000 10.000 0.000000 5000
DDE1AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
DDE2AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 1 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 2 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 3 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
NNL2AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
FFR2AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
DDE2AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
NNL2AA1 BBE3AA1 1 0 0.0000 10.000 0.000000 410
BBE2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
##T
BBE2AA1 BBE3AA1 1 0 400.0 400.0 1000. 0.0000 10.000 0.000000 0.0 5000 PST
##R
BBE2AA1 BBE3AA1 1 -0.68 90.00 16 0 SYMM
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##C 2007.05.01
##N
##ZBE
BBE1AA1 BE1 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
BBE2AA1 BE2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
BBE3AA1 BE3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZDE
DDE1AA1 DE1 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
DDE2AA1 DE2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
DDE3AA1 DE3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZFR
FFR1AA1 FR1 0 2 400.00 1000.00 0.00000 00000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0
FFR2AA1 FR2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
FFR3AA1 FR3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##ZNL
NNL1AA1 NL1 0 2 400.00 0.00000 0.00000 -1000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0
NNL2AA1 NL2 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
NNL3AA1 NL3 0 2 400.00 0.00000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0
##L
BBE1AA1 BBE2AA1 1 0 0.0000 10.000 0.000000 5000
BBE1AA1 BBE3AA1 1 0 0.0000 10.000 0.000000 5000
FFR1AA1 FFR2AA1 1 0 0.0000 10.000 0.000000 5000
FFR1AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
FFR2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
DDE1AA1 DDE2AA1 1 0 0.0000 10.000 0.000000 5000
DDE1AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
DDE2AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 1 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 2 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 3 0 0.0000 10.000 0.000000 5000
NNL1AA1 NNL2AA1 4 8 0.0000 10.000 0.000000 5000
NNL1AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
NNL2AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
FFR2AA1 DDE3AA1 1 0 0.0000 10.000 0.000000 5000
DDE2AA1 NNL3AA1 1 0 0.0000 10.000 0.000000 5000
NNL2AA1 BBE3AA1 1 0 0.0000 10.000 0.000000 410
BBE2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000
##T
BBE2AA1 BBE3AA1 1 0 400.0 400.0 1000. 0.0000 10.000 0.000000 0.0 5000 PST
##R
BBE2AA1 BBE3AA1 1 -0.68 90.00 16 0 SYMM
100 changes: 100 additions & 0 deletions tests/src/test/resources/files/crac/epic16/crac_16_5_14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"type" : "CRAC",
"version" : "2.4",
"info" : "Generated by FARAO http://farao-community.github.io",
"id" : "CRAC 16.5.14",
"name" : "CRAC 16.5.14",
"instants" : [ {
"id": "preventive",
"kind": "PREVENTIVE"
}, {
"id": "outage",
"kind": "OUTAGE"
}, {
"id": "auto",
"kind": "AUTO"
}, {
"id": "curative",
"kind": "CURATIVE"
} ],
"networkElementsNamePerId" : { },
"contingencies" : [ {
"id" : "co_nl1_nl_2_1",
"networkElementsIds" : [ "NNL1AA1 NNL2AA1 1" ]
}, {
"id" : "co_nl1_nl_2_3",
"networkElementsIds" : [ "NNL1AA1 NNL2AA1 3" ]
} ],
"flowCnecs" : [ {
"id" : "nl1_nl2_2_preventive",
"name" : "nl1_nl2_2_preventive",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "preventive",
"contingencyId" : null,
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 250.0,
"min" : -250.0,
"side" : 1
} ]
}, {
"id" : "nl1_nl2_2_auto - co_nl1_nl_2_1",
"name" : "nl1_nl2_2_auto - co_nl1_nl_2_1",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "auto",
"contingencyId" : "co_nl1_nl_2_1",
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 300.0,
"min" : -300.0,
"side" : 1
} ]
}, {
"id" : "nl1_nl2_2_auto - co_nl1_nl_2_3",
"name" : "nl1_nl2_2_auto - co_nl1_nl_2_3",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "auto",
"contingencyId" : "co_nl1_nl_2_3",
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 400.0,
"min" : -400.0,
"side" : 1
} ]
} ],
"pstRangeActions" : [ ],
"injectionRangeActions" : [ ],
"counterTradeRangeActions" : [ ],
"networkActions" : [ {
"id" : "open_nl1_nl2_2",
"name" : "open_nl1_nl2_2",
"operator" : "NL",
"onFlowConstraintInCountryUsageRules" : [ {
"instant" : "auto",
"country" : "NL",
"usageMethod" : "forced"
} ],
"topologicalActions" : [ {
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"actionType" : "open"
} ]
} ]
}
97 changes: 97 additions & 0 deletions tests/src/test/resources/files/crac/epic16/crac_16_5_15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"type" : "CRAC",
"version" : "2.4",
"info" : "Generated by FARAO http://farao-community.github.io",
"id" : "CRAC 16.5.15",
"name" : "CRAC 16.5.15",
"instants" : [ {
"id": "preventive",
"kind": "PREVENTIVE"
}, {
"id": "outage",
"kind": "OUTAGE"
}, {
"id": "curative",
"kind": "CURATIVE"
} ],
"networkElementsNamePerId" : { },
"contingencies" : [ {
"id" : "co_nl1_nl_2_1",
"networkElementsIds" : [ "NNL1AA1 NNL2AA1 1" ]
}, {
"id" : "co_nl1_nl_2_3",
"networkElementsIds" : [ "NNL1AA1 NNL2AA1 3" ]
} ],
"flowCnecs" : [ {
"id" : "nl1_nl2_2_preventive",
"name" : "nl1_nl2_2_preventive",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "preventive",
"contingencyId" : null,
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 250.0,
"min" : -250.0,
"side" : 1
} ]
}, {
"id" : "nl1_nl2_2_curative - co_nl1_nl_2_1",
"name" : "nl1_nl2_2_curative - co_nl1_nl_2_1",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "curative",
"contingencyId" : "co_nl1_nl_2_1",
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 300.0,
"min" : -300.0,
"side" : 1
} ]
}, {
"id" : "nl1_nl2_2_curative - co_nl1_nl_2_3",
"name" : "nl1_nl2_2_curative - co_nl1_nl_2_3",
"networkElementId" : "NNL1AA1 NNL2AA1 2",
"operator" : "NL",
"instant" : "curative",
"contingencyId" : "co_nl1_nl_2_3",
"optimized" : true,
"monitored" : false,
"reliabilityMargin" : 0.0,
"iMax" : [ NaN ],
"nominalV" : [ 220.0 ],
"thresholds" : [ {
"unit" : "megawatt",
"max" : 400.0,
"min" : -400.0,
"side" : 1
} ]
} ],
"pstRangeActions" : [ ],
"injectionRangeActions" : [ ],
"counterTradeRangeActions" : [ ],
"networkActions" : [ {
"id" : "close_nl1_nl2_4",
"name" : "close_nl1_nl2_4",
"operator" : "NL",
"onFlowConstraintInCountryUsageRules" : [ {
"instant" : "curative",
"country" : "NL",
"usageMethod" : "available"
} ],
"topologicalActions" : [ {
"networkElementId" : "NNL1AA1 NNL2AA1 4",
"actionType" : "close"
} ]
} ]
}
Loading