diff --git a/data/rao/12_node_network.uct b/data/rao/12_node_network.uct new file mode 100644 index 0000000..8d3c457 --- /dev/null +++ b/data/rao/12_node_network.uct @@ -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 0000.00 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 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 +NNL2AA1 BBE3AA1 2 8 0.0000 10.000 0.000000 410 +NNL2AA1 BBE3AA1 3 8 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 \ No newline at end of file diff --git a/data/rao/12_node_network_redispatching.uct b/data/rao/12_node_network_redispatching.uct new file mode 100644 index 0000000..4e49e20 --- /dev/null +++ b/data/rao/12_node_network_redispatching.uct @@ -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 500.000 0.00000 0.00000 0.00000 9000.00 -9000.0 9000.00 -9000.0 +FFR3AA1 FR3 0 2 400.00 1000.00 0.00000 -500.00 0.00000 9000.00 -9000.0 9000.00 -9000.0 +##ZNL +NNL1AA1 NL1 0 2 400.00 0000.00 0.00000 -1000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 +NNL2AA1 NL2 0 2 400.00 0.00000 0.00000 -500.00 0.00000 9000.00 -9000.0 9000.00 -9000.0 +NNL3AA1 NL3 0 2 400.00 500.000 0.00000 -1000.0 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 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 +NNL2AA1 BBE3AA1 2 8 0.0000 10.000 0.000000 410 +NNL2AA1 BBE3AA1 3 8 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 \ No newline at end of file diff --git a/data/rao/N-1_case_crac_curative.json b/data/rao/N-1_case_crac_curative.json new file mode 100644 index 0000000..cd2d66f --- /dev/null +++ b/data/rao/N-1_case_crac_curative.json @@ -0,0 +1,112 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "crac", + "name" : "crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "Contingency DE2 DE3", + "networkElementsIds" : [ "DDE2AA1 DDE3AA1 1" ] + } ], + "flowCnecs" : [ { + "id" : "NNL2AA1 BBE3AA1 1 - preventive", + "name" : "NL2 BE3 1 - preventive", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "iMax" : [ NaN ], + "nominalV" : [ 400 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -410.0, + "max" : 410.0, + "side" : 1 + } ] + }, { + "id" : "NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage", + "name" : "NL2 BE3 1 - Contingency DE2 DE3 - outage", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "instant" : "outage", + "contingencyId" : "Contingency DE2 DE3", + "optimized" : true, + "monitored" : false, + "iMax" : [ NaN ], + "nominalV" : [ 400.0 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -450.0, + "max" : 450.0, + "side" : 1 + } ] + }, { + "id" : "BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative", + "name" : "BE1 BE2 1 - Contingency DE2 DE3 - curative", + "networkElementId" : "BBE1AA1 BBE2AA1 1", + "operator" : null, + "instant" : "curative", + "contingencyId" : "Contingency DE2 DE3", + "optimized" : true, + "monitored" : false, + "iMax" : [ NaN ], + "nominalV" : [ 400.0 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -300.0, + "max" : 300.0, + "side" : 1 + } ] + } ], + "angleCnecs" : [ ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ { + "id" : "pst-range-action", + "name" : "pst-range-action", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + }, { + "instant" : "curative", + "usageMethod" : "available" + } ], + "networkElementId" : "BBE2AA1 BBE3AA1 1", + "ranges" : [ { + "min" : -10, + "max" : 10, + "rangeType" : "absolute" + } ] + } ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "close NL2 BE3 2", + "name" : "close NL2 BE3 2", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + } ], + "terminalsConnectionActions" : [ { + "networkElementId" : "NNL2AA1 BBE3AA1 2", + "actionType" : "close" + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/N-1_case_crac_curative_redispatching.json b/data/rao/N-1_case_crac_curative_redispatching.json new file mode 100644 index 0000000..9a01f6e --- /dev/null +++ b/data/rao/N-1_case_crac_curative_redispatching.json @@ -0,0 +1,163 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "crac", + "name" : "crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "Contingency DE2 DE3", + "networkElementsIds" : [ "DDE2AA1 DDE3AA1 1" ] + } ], + "flowCnecs" : [ { + "id" : "NNL2AA1 BBE3AA1 1 - preventive", + "name" : "NL2 BE3 1 - preventive", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "iMax" : [ NaN ], + "nominalV" : [ 400 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -410.0, + "max" : 410.0, + "side" : 1 + } ] + }, { + "id" : "NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage", + "name" : "NL2 BE3 1 - Contingency DE2 DE3 - outage", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "instant" : "outage", + "contingencyId" : "Contingency DE2 DE3", + "optimized" : true, + "monitored" : false, + "iMax" : [ NaN ], + "nominalV" : [ 400.0 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -450.0, + "max" : 450.0, + "side" : 1 + } ] + }, { + "id" : "BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative", + "name" : "BE1 BE2 1 - Contingency DE2 DE3 - curative", + "networkElementId" : "BBE1AA1 BBE2AA1 1", + "operator" : null, + "instant" : "curative", + "contingencyId" : "Contingency DE2 DE3", + "optimized" : true, + "monitored" : false, + "iMax" : [ NaN ], + "nominalV" : [ 400.0 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -300.0, + "max" : 300.0, + "side" : 1 + } ] + } ], + "angleCnecs" : [ ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ { + "id" : "pst-range-action", + "name" : "pst-range-action", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + }, { + "instant" : "curative", + "usageMethod" : "available" + } ], + "networkElementId" : "BBE2AA1 BBE3AA1 1", + "ranges" : [ { + "min" : -10, + "max" : 10, + "rangeType" : "absolute" + } ] + } ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ + { + "id": "redispatchingActionFR", + "name": "redispatchingActionFR", + "operator": "FR", + "activationCost": 10.0, + "variationCosts": { + "up": 50.0, + "down": 50.0 + }, + "onInstantUsageRules": [ + { + "instant": "preventive", + "usageMethod": "available" + } + ], + "networkElementIdsAndKeys": { + "FFR3AA1 _generator": 1.0 + }, + "initialSetpoint": 500, + "ranges": [ + { + "min": 0.0, + "max": 1000.0 + } + ] + }, { + "id": "redispatchingActionNL", + "name": "redispatchingActionNL", + "operator": "NL", + "activationCost": 10.0, + "variationCosts": { + "up": 50.0, + "down": 50.0 + }, + "onInstantUsageRules": [ + { + "instant": "preventive", + "usageMethod": "available" + } + ], + "networkElementIdsAndKeys": { + "NNL3AA1 _generator": 1.0 + }, + "initialSetpoint": 1000, + "ranges": [ + { + "min": 500.0, + "max": 1500.0 + } + ] + } ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "close NL2 BE3 2", + "name" : "close NL2 BE3 2", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + } ], + "terminalsConnectionActions" : [ { + "networkElementId" : "NNL2AA1 BBE3AA1 2", + "actionType" : "close" + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/N-1_case_crac_outage.json b/data/rao/N-1_case_crac_outage.json new file mode 100644 index 0000000..328440a --- /dev/null +++ b/data/rao/N-1_case_crac_outage.json @@ -0,0 +1,92 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "crac", + "name" : "crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "Contingency DE2 DE3", + "networkElementsIds" : [ "DDE2AA1 DDE3AA1 1" ] + } ], + "flowCnecs" : [ { + "id" : "NNL2AA1 BBE3AA1 1 - preventive", + "name" : "NL2 BE3 1 - preventive", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "iMax" : [ NaN ], + "nominalV" : [ 400 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -410.0, + "max" : 410.0, + "side" : 1 + } ] + }, { + "id" : "NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage", + "name" : "NL2 BE3 1 - Contingency DE2 DE3 - outage", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "instant" : "outage", + "contingencyId" : "Contingency DE2 DE3", + "optimized" : true, + "monitored" : false, + "iMax" : [ NaN ], + "nominalV" : [ 400.0 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -450.0, + "max" : 450.0, + "side" : 1 + } ] + } ], + "angleCnecs" : [ ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ { + "id" : "pst-range-action", + "name" : "pst-range-action", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + } ], + "networkElementId" : "BBE2AA1 BBE3AA1 1", + "ranges" : [ { + "min" : -10, + "max" : 10, + "rangeType" : "absolute" + } ] + } ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "close NL2 BE3 2", + "name" : "close NL2 BE3 2", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + } ], + "terminalsConnectionActions" : [ { + "networkElementId" : "NNL2AA1 BBE3AA1 2", + "actionType" : "close" + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/N_case_crac.json b/data/rao/N_case_crac.json new file mode 100644 index 0000000..11e97e7 --- /dev/null +++ b/data/rao/N_case_crac.json @@ -0,0 +1,58 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "crac", + "name" : "crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ ], + "flowCnecs" : [ { + "id" : "NNL2AA1 BBE3AA1 1 - preventive", + "name" : "NNL2AA1 BBE3AA1 1 - preventive", + "networkElementId" : "NNL2AA1 BBE3AA1 1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "iMax" : [ NaN ], + "nominalV" : [ 400 ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -410.0, + "max" : 410.0, + "side" : 1 + } ] + } ], + "angleCnecs" : [ ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "close NL2 BE3 2", + "name" : "close NL2 BE3 2", + "operator" : null, + "onInstantUsageRules" : [ { + "instant" : "preventive", + "usageMethod" : "available" + } ], + "terminalsConnectionActions" : [ { + "networkElementId" : "NNL2AA1 BBE3AA1 2", + "actionType" : "close" + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/monitoring/angle_monitoring/GlskB45test.xml b/data/rao/monitoring/angle_monitoring/GlskB45test.xml new file mode 100644 index 0000000..81c70e7 --- /dev/null +++ b/data/rao/monitoring/angle_monitoring/GlskB45test.xml @@ -0,0 +1,71 @@ + + + 10XES-REE------E-20170412-SWECCD2 + 1 + B22 + A48 + 10XES-REE------E + A04 + 22XCORESO------S + A36 + 2017-07-18T06:31:36Z + + 2017-04-12T02:00Z + 2017-04-12T03:00Z + + 10YCB-FR-ES-PT-S + + B45TestFR + 10YFR-RTE------C + A01 + + + 2017-04-12T02:00Z + 2017-04-12T03:00Z + + PT60M + + 1 + + B45 + A01 + A01 + MAW + 1 + + FFR1AA1 _generator + FFR1AA1 _generator + 2001 + -401 + + + + B45 + A01 + A01 + MAW + 2 + + FFR2AA1 _generator + FFR2AA1 _generator + 2002 + -402 + + + + B45 + A01 + A01 + MAW + 3 + + FFR3AA1 _generator + FFR3AA1 _generator + 3003 + -403.0 + + + + + + diff --git a/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_RA_on_load.json b/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_RA_on_load.json new file mode 100644 index 0000000..93f085e --- /dev/null +++ b/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_RA_on_load.json @@ -0,0 +1,101 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "test-crac", + "name" : "test-crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "auto", + "kind" : "AUTO" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "coL1", + "name" : "coL1", + "networkElementsIds" : [ "L1" ] + }], + "flowCnecs" : [ { + "id" : "cnec1 - preventive", + "name" : "cnec1 - preventive", + "networkElementId" : "L1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 100.0, + "side" : 2 + } ] + }, + { + "id" : "cnec1 - curative", + "name" : "cnec1 - curative", + "networkElementId" : "L1", + "contingencyId" : "coL1", + "operator" : null, + "border" : "", + "instant" : "curative", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 5.0, + "side" : 2 + } ] + } + ], + "angleCnecs" : [ { + "id" : "acCur1", + "name" : "acCur1", + "exportingNetworkElementId" : "VL2", + "importingNetworkElementId" : "VL1", + "operator" : null, + "border" : "", + "instant" : "curative", + "contingencyId" : "coL1", + "optimized" : false, + "monitored" : true, + "reliabilityMargin" : 0.0, + "thresholds" : [ { + "unit" : "degree", + "min" : -6.0 + } ] + } ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "Injection L1 - 2", + "name" : "Injection L1 - 2", + "operator" : null, + "onConstraintUsageRules" : [ { + "instant" : "curative", + "cnecId" : "acCur1", + "usageMethod" : "available" + } ], + "loadActions" : [ { + "networkElementId" : "LD2", + "activePowerValue" : 50.0 + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_topo.json b/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_topo.json new file mode 100644 index 0000000..3c30392 --- /dev/null +++ b/data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_topo.json @@ -0,0 +1,100 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "simple_case_with_topo", + "name" : "simple_case_with_topo", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "auto", + "kind" : "AUTO" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "coL1", + "name" : "coL1", + "networkElementsIds" : [ "L1" ] + }], + "flowCnecs" : [ { + "id" : "cnec1 - preventive", + "name" : "cnec1 - preventive", + "networkElementId" : "L1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 100.0, + "side" : 2 + } ] + }, + { + "id" : "cnec1 - curative", + "name" : "cnec1 - curative", + "networkElementId" : "L1", + "contingencyId" : "coL1", + "operator" : null, + "border" : "", + "instant" : "curative", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 5.0, + "side" : 2 + } ] + } ], + "angleCnecs" : [ { + "id" : "acCur1", + "name" : "acCur1", + "exportingNetworkElementId" : "VL2", + "importingNetworkElementId" : "VL1", + "operator" : null, + "border" : "", + "instant" : "curative", + "contingencyId" : "coL1", + "optimized" : false, + "monitored" : true, + "reliabilityMargin" : 0.0, + "thresholds" : [ { + "unit" : "degree", + "min" : -3.0 + } ] + } ], + "voltageCnecs" : [ ], + "pstRangeActions" : [ ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "Open L1 - 2", + "name" : "Open L1 - 2", + "operator" : null, + "onConstraintUsageRules" : [ { + "instant" : "curative", + "cnecId" : "acCur1", + "usageMethod" : "available" + } ], + "terminalsConnectionActions" : [ { + "networkElementId" : "L1", + "actionType" : "open" + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/monitoring/network.xiidm b/data/rao/monitoring/network.xiidm new file mode 100644 index 0000000..cde6542 --- /dev/null +++ b/data/rao/monitoring/network.xiidm @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/rao/monitoring/rao_parameters.json b/data/rao/monitoring/rao_parameters.json new file mode 100644 index 0000000..7379763 --- /dev/null +++ b/data/rao/monitoring/rao_parameters.json @@ -0,0 +1,138 @@ +{ + "version" : "3.1", + "objective-function" : { + "type" : "SECURE_FLOW", + "unit" : "MW" + }, + "range-actions-optimization" : { + "pst-ra-min-impact-threshold" : 0.01, + "hvdc-ra-min-impact-threshold" : 0.001, + "injection-ra-min-impact-threshold" : 0.001 + }, + "topological-actions-optimization" : { + "relative-minimum-impact-threshold" : 0.0, + "absolute-minimum-impact-threshold" : 0.0 + }, + "not-optimized-cnecs" : { + "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false + }, + "extensions" : { + "open-rao-search-tree-parameters" : { + "objective-function" : { + "curative-min-obj-improvement" : 0.0 + }, + "range-actions-optimization" : { + "max-mip-iterations" : 5, + "pst-sensitivity-threshold" : 1.0E-6, + "pst-model" : "CONTINUOUS", + "hvdc-sensitivity-threshold" : 1.0E-6, + "injection-ra-sensitivity-threshold" : 1.0E-6, + "ra-range-shrinking" : "DISABLED", + "linear-optimization-solver" : { + "solver" : "CBC", + "relative-mip-gap" : 0.001, + "solver-specific-parameters" : null + } + }, + "topological-actions-optimization" : { + "max-preventive-search-tree-depth" : 5, + "max-curative-search-tree-depth" : 5, + "predefined-combinations" : [ ], + "skip-actions-far-from-most-limiting-element" : false, + "max-number-of-boundaries-for-skipping-actions" : 0 + }, + "second-preventive-rao" : { + "execution-condition" : "DISABLED", + "hint-from-first-preventive-rao" : false + }, + "load-flow-and-sensitivity-computation" : { + "load-flow-provider" : "OpenLoadFlow", + "sensitivity-provider" : "OpenLoadFlow", + "sensitivity-failure-overcost" : 10000.0, + "sensitivity-parameters" : { + "version" : "1.0", + "load-flow-parameters" : { + "version" : "1.9", + "voltageInitMode" : "UNIFORM_VALUES", + "transformerVoltageControlOn" : false, + "phaseShifterRegulationOn" : false, + "useReactiveLimits" : true, + "twtSplitShuntAdmittance" : true, + "shuntCompensatorVoltageControlOn" : false, + "readSlackBus" : false, + "writeSlackBus" : false, + "dc" : false, + "distributedSlack" : true, + "balanceType" : "PROPORTIONAL_TO_GENERATION_P", + "dcUseTransformerRatio" : false, + "countriesToBalance" : [ "GR", "BE", "SK", "TR", "CH", "RS", "PL", "UA", "BG", "ES", "ME", "CZ", "HR", "AL", "RO", "HU", "AT", "FR", "PT", "DE", "MK", "BA", "SI", "IT", "NL" ], + "connectedComponentMode" : "MAIN", + "hvdcAcEmulation" : true, + "dcPowerFactor" : 1.0, + "extensions" : { + "open-load-flow-parameters" : { + "slackBusSelectionMode" : "MOST_MESHED", + "slackBusesIds" : [ ], + "slackDistributionFailureBehavior" : "LEAVE_ON_SLACK_BUS", + "lowImpedanceBranchMode" : "REPLACE_BY_ZERO_IMPEDANCE_LINE", + "loadPowerFactorConstant" : false, + "plausibleActivePowerLimit" : 10000.0, + "newtonRaphsonStoppingCriteriaType" : "UNIFORM_CRITERIA", + "maxActivePowerMismatch" : 0.01, + "maxReactivePowerMismatch" : 0.01, + "maxVoltageMismatch" : 1.0E-4, + "maxAngleMismatch" : 1.0E-5, + "maxRatioMismatch" : 1.0E-5, + "maxSusceptanceMismatch" : 1.0E-4, + "slackBusPMaxMismatch" : 1.0, + "voltagePerReactivePowerControl" : false, + "maxNewtonRaphsonIterations" : 30, + "maxOuterLoopIterations" : 20, + "newtonRaphsonConvEpsPerEq" : 1.0E-4, + "voltageInitModeOverride" : "NONE", + "transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "shuntVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "minPlausibleTargetVoltage" : 0.8, + "maxPlausibleTargetVoltage" : 1.2, + "minNominalVoltageTargetVoltageCheck" : 20.0, + "minRealisticVoltage" : 0.5, + "maxRealisticVoltage" : 1.5, + "lowImpedanceThreshold" : 1.0E-8, + "reactiveRangeCheckMode" : "MAX", + "networkCacheEnabled" : false, + "svcVoltageMonitoring" : true, + "stateVectorScalingMode" : "NONE", + "maxSlackBusCount" : 1, + "debugDir" : null, + "incrementalTransformerRatioTapControlOuterLoopMaxTapShift" : 3, + "secondaryVoltageControl" : false, + "reactiveLimitsMaxPqPvSwitch" : 3, + "phaseShifterControlMode" : "CONTINUOUS_WITH_DISCRETISATION", + "alwaysUpdateNetwork" : false, + "mostMeshedSlackBusSelectorMaxNominalVoltagePercentile" : 95.0, + "reportedFeatures" : [ ], + "slackBusCountryFilter" : [ ], + "actionableSwitchesIds" : [ ], + "asymmetrical" : false, + "reactivePowerDispatchMode" : "Q_EQUAL_PROPORTION", + "outerLoopNames" : null, + "useActiveLimits" : true, + "lineSearchStateVectorScalingMaxIteration" : 10, + "lineSearchStateVectorScalingStepFold" : 1.3333333333333333, + "maxVoltageChangeStateVectorScalingMaxDv" : 0.1, + "maxVoltageChangeStateVectorScalingMaxDphi" : 0.17453292519943295, + "linePerUnitMode" : "IMPEDANCE", + "useLoadModel" : false, + "dcApproximationType" : "IGNORE_R", + "simulateAutomationSystems" : false + } + } + } + } + }, + "multi-threading" : { + "available-cpus" : 4 + } + } + } +} \ No newline at end of file diff --git a/data/rao/monitoring/voltage_monitoring/voltage_monitoring_simple_case_with_RA_on_load.json b/data/rao/monitoring/voltage_monitoring/voltage_monitoring_simple_case_with_RA_on_load.json new file mode 100644 index 0000000..dad8829 --- /dev/null +++ b/data/rao/monitoring/voltage_monitoring/voltage_monitoring_simple_case_with_RA_on_load.json @@ -0,0 +1,101 @@ +{ + "type" : "CRAC", + "version" : "2.7", + "info" : "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao", + "id" : "test-crac", + "name" : "test-crac", + "instants" : [ { + "id" : "preventive", + "kind" : "PREVENTIVE" + }, { + "id" : "outage", + "kind" : "OUTAGE" + }, { + "id" : "auto", + "kind" : "AUTO" + }, { + "id" : "curative", + "kind" : "CURATIVE" + } ], + "ra-usage-limits-per-instant" : [ ], + "networkElementsNamePerId" : { }, + "contingencies" : [ { + "id" : "coL1", + "name" : "coL1", + "networkElementsIds" : [ "PS1" ] + }], + "flowCnecs" : [ { + "id" : "cnec1 - preventive", + "name" : "cnec1 - preventive", + "networkElementId" : "L1", + "operator" : null, + "border" : "", + "instant" : "preventive", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 100.0, + "side" : 2 + } ] + }, + { + "id" : "cnec1 - curative", + "name" : "cnec1 - curative", + "networkElementId" : "L1", + "contingencyId" : "coL1", + "operator" : null, + "border" : "", + "instant" : "curative", + "optimized" : true, + "monitored" : false, + "reliabilityMargin" : 0.0, + "nominalV" : [ NaN ], + "thresholds" : [ { + "unit" : "megawatt", + "min" : -5.0, + "max" : 5.0, + "side" : 2 + } ] + } + ], + "angleCnecs" : [ ], + "voltageCnecs" : [ { + "id" : "vc", + "name" : "vc", + "networkElementId" : "VL2", + "operator" : null, + "border" : "", + "instant" : "curative", + "contingencyId" : "coL1", + "optimized" : false, + "monitored" : true, + "reliabilityMargin" : 0.0, + "thresholds" : [ { + "unit" : "kilovolt", + "min" : 340.0, + "max" : 350.0 + } ] + } ], + "pstRangeActions" : [ ], + "hvdcRangeActions" : [ ], + "injectionRangeActions" : [ ], + "counterTradeRangeActions" : [ ], + "networkActions" : [ { + "id" : "Injection L1 - 2", + "name" : "Injection L1 - 2", + "operator" : null, + "onConstraintUsageRules" : [ { + "instant" : "curative", + "cnecId" : "vc", + "usageMethod" : "available" + } ], + "loadActions" : [ { + "networkElementId" : "LD2", + "activePowerValue" : 140.0 + } ] + } ] +} \ No newline at end of file diff --git a/data/rao/rao_parameters.json b/data/rao/rao_parameters.json new file mode 100644 index 0000000..c2686a6 --- /dev/null +++ b/data/rao/rao_parameters.json @@ -0,0 +1,139 @@ +{ + "version" : "3.1", + "objective-function" : { + "type" : "SECURE_FLOW", + "unit" : "MW" + }, + "range-actions-optimization" : { + "pst-ra-min-impact-threshold" : 0.01, + "hvdc-ra-min-impact-threshold" : 0.001, + "injection-ra-min-impact-threshold" : 0.001 + }, + "topological-actions-optimization" : { + "relative-minimum-impact-threshold" : 0.0, + "absolute-minimum-impact-threshold" : 0.0 + }, + "not-optimized-cnecs" : { + "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false + }, + "extensions" : { + "open-rao-search-tree-parameters" : { + "objective-function" : { + "curative-min-obj-improvement" : 0.0 + }, + "range-actions-optimization" : { + "max-mip-iterations" : 5, + "pst-sensitivity-threshold" : 1.0E-6, + "pst-model" : "CONTINUOUS", + "hvdc-sensitivity-threshold" : 1.0E-6, + "injection-ra-sensitivity-threshold" : 1.0E-6, + "ra-range-shrinking" : "DISABLED", + "linear-optimization-solver" : { + "solver" : "CBC", + "relative-mip-gap" : 0.001, + "solver-specific-parameters" : null + } + }, + "topological-actions-optimization" : { + "max-preventive-search-tree-depth" : 5, + "max-curative-search-tree-depth" : 5, + "predefined-combinations" : [ ], + "skip-actions-far-from-most-limiting-element" : false, + "max-number-of-boundaries-for-skipping-actions" : 0 + }, + "second-preventive-rao" : { + "execution-condition" : "DISABLED", + "re-optimize-curative-range-actions" : false, + "hint-from-first-preventive-rao" : false + }, + "load-flow-and-sensitivity-computation" : { + "load-flow-provider" : "OpenLoadFlow", + "sensitivity-provider" : "OpenLoadFlow", + "sensitivity-failure-overcost" : 10000.0, + "sensitivity-parameters" : { + "version" : "1.0", + "load-flow-parameters" : { + "version" : "1.9", + "voltageInitMode" : "UNIFORM_VALUES", + "transformerVoltageControlOn" : false, + "phaseShifterRegulationOn" : false, + "useReactiveLimits" : true, + "twtSplitShuntAdmittance" : true, + "shuntCompensatorVoltageControlOn" : false, + "readSlackBus" : false, + "writeSlackBus" : false, + "dc" : false, + "distributedSlack" : true, + "balanceType" : "PROPORTIONAL_TO_GENERATION_P", + "dcUseTransformerRatio" : false, + "countriesToBalance" : [ "GR", "BE", "SK", "TR", "CH", "RS", "PL", "UA", "BG", "ES", "ME", "CZ", "HR", "AL", "RO", "HU", "AT", "FR", "PT", "DE", "MK", "BA", "SI", "IT", "NL" ], + "connectedComponentMode" : "MAIN", + "hvdcAcEmulation" : true, + "dcPowerFactor" : 1.0, + "extensions" : { + "open-load-flow-parameters" : { + "slackBusSelectionMode" : "MOST_MESHED", + "slackBusesIds" : [ ], + "slackDistributionFailureBehavior" : "LEAVE_ON_SLACK_BUS", + "lowImpedanceBranchMode" : "REPLACE_BY_ZERO_IMPEDANCE_LINE", + "loadPowerFactorConstant" : false, + "plausibleActivePowerLimit" : 10000.0, + "newtonRaphsonStoppingCriteriaType" : "UNIFORM_CRITERIA", + "maxActivePowerMismatch" : 0.01, + "maxReactivePowerMismatch" : 0.01, + "maxVoltageMismatch" : 1.0E-4, + "maxAngleMismatch" : 1.0E-5, + "maxRatioMismatch" : 1.0E-5, + "maxSusceptanceMismatch" : 1.0E-4, + "slackBusPMaxMismatch" : 1.0, + "voltagePerReactivePowerControl" : false, + "maxNewtonRaphsonIterations" : 30, + "maxOuterLoopIterations" : 20, + "newtonRaphsonConvEpsPerEq" : 1.0E-4, + "voltageInitModeOverride" : "NONE", + "transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "shuntVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "minPlausibleTargetVoltage" : 0.8, + "maxPlausibleTargetVoltage" : 1.2, + "minNominalVoltageTargetVoltageCheck" : 20.0, + "minRealisticVoltage" : 0.5, + "maxRealisticVoltage" : 1.5, + "lowImpedanceThreshold" : 1.0E-8, + "reactiveRangeCheckMode" : "MAX", + "networkCacheEnabled" : false, + "svcVoltageMonitoring" : true, + "stateVectorScalingMode" : "NONE", + "maxSlackBusCount" : 1, + "debugDir" : null, + "incrementalTransformerRatioTapControlOuterLoopMaxTapShift" : 3, + "secondaryVoltageControl" : false, + "reactiveLimitsMaxPqPvSwitch" : 3, + "phaseShifterControlMode" : "CONTINUOUS_WITH_DISCRETISATION", + "alwaysUpdateNetwork" : false, + "mostMeshedSlackBusSelectorMaxNominalVoltagePercentile" : 95.0, + "reportedFeatures" : [ ], + "slackBusCountryFilter" : [ ], + "actionableSwitchesIds" : [ ], + "asymmetrical" : false, + "reactivePowerDispatchMode" : "Q_EQUAL_PROPORTION", + "outerLoopNames" : null, + "useActiveLimits" : true, + "lineSearchStateVectorScalingMaxIteration" : 10, + "lineSearchStateVectorScalingStepFold" : 1.3333333333333333, + "maxVoltageChangeStateVectorScalingMaxDv" : 0.1, + "maxVoltageChangeStateVectorScalingMaxDphi" : 0.17453292519943295, + "linePerUnitMode" : "IMPEDANCE", + "useLoadModel" : false, + "dcApproximationType" : "IGNORE_R", + "simulateAutomationSystems" : false + } + } + } + } + }, + "multi-threading" : { + "available-cpus" : 4 + } + } + } +} \ No newline at end of file diff --git a/data/rao/rao_parameters_costly.json b/data/rao/rao_parameters_costly.json new file mode 100644 index 0000000..9d9a804 --- /dev/null +++ b/data/rao/rao_parameters_costly.json @@ -0,0 +1,142 @@ +{ + "version" : "3.1", + "objective-function" : { + "type" : "MIN_COST", + "unit" : "MW" + }, + "range-actions-optimization" : { + "pst-ra-min-impact-threshold" : 0.01, + "hvdc-ra-min-impact-threshold" : 0.001, + "injection-ra-min-impact-threshold" : 0.001 + }, + "topological-actions-optimization" : { + "relative-minimum-impact-threshold" : 0.0, + "absolute-minimum-impact-threshold" : 0.0 + }, + "not-optimized-cnecs" : { + "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false + }, + "extensions" : { + "open-rao-search-tree-parameters" : { + "objective-function" : { + "curative-min-obj-improvement" : 0.0 + }, + "range-actions-optimization" : { + "max-mip-iterations" : 5, + "pst-sensitivity-threshold" : 1.0E-6, + "pst-model" : "APPROXIMATED_INTEGERS", + "hvdc-sensitivity-threshold" : 1.0E-6, + "injection-ra-sensitivity-threshold" : 1.0E-6, + "ra-range-shrinking" : "DISABLED", + "linear-optimization-solver" : { + "solver" : "CBC", + "relative-mip-gap" : 0.001, + "solver-specific-parameters" : null + } + }, + "topological-actions-optimization" : { + "max-preventive-search-tree-depth" : 5, + "max-curative-search-tree-depth" : 5, + "predefined-combinations" : [ ], + "skip-actions-far-from-most-limiting-element" : false, + "max-number-of-boundaries-for-skipping-actions" : 0 + }, + "second-preventive-rao" : { + "execution-condition" : "DISABLED", + "re-optimize-curative-range-actions" : false, + "hint-from-first-preventive-rao" : false + }, + "load-flow-and-sensitivity-computation" : { + "load-flow-provider" : "OpenLoadFlow", + "sensitivity-provider" : "OpenLoadFlow", + "sensitivity-failure-overcost" : 10000.0, + "sensitivity-parameters" : { + "version" : "1.0", + "load-flow-parameters" : { + "version" : "1.9", + "voltageInitMode" : "UNIFORM_VALUES", + "transformerVoltageControlOn" : false, + "phaseShifterRegulationOn" : false, + "useReactiveLimits" : true, + "twtSplitShuntAdmittance" : true, + "shuntCompensatorVoltageControlOn" : false, + "readSlackBus" : false, + "writeSlackBus" : false, + "dc" : false, + "distributedSlack" : true, + "balanceType" : "PROPORTIONAL_TO_GENERATION_P", + "dcUseTransformerRatio" : false, + "countriesToBalance" : [ "GR", "BE", "SK", "TR", "CH", "RS", "PL", "UA", "BG", "ES", "ME", "CZ", "HR", "AL", "RO", "HU", "AT", "FR", "PT", "DE", "MK", "BA", "SI", "IT", "NL" ], + "connectedComponentMode" : "MAIN", + "hvdcAcEmulation" : true, + "dcPowerFactor" : 1.0, + "extensions" : { + "open-load-flow-parameters" : { + "slackBusSelectionMode" : "MOST_MESHED", + "slackBusesIds" : [ ], + "slackDistributionFailureBehavior" : "LEAVE_ON_SLACK_BUS", + "lowImpedanceBranchMode" : "REPLACE_BY_ZERO_IMPEDANCE_LINE", + "loadPowerFactorConstant" : false, + "plausibleActivePowerLimit" : 10000.0, + "newtonRaphsonStoppingCriteriaType" : "UNIFORM_CRITERIA", + "maxActivePowerMismatch" : 0.01, + "maxReactivePowerMismatch" : 0.01, + "maxVoltageMismatch" : 1.0E-4, + "maxAngleMismatch" : 1.0E-5, + "maxRatioMismatch" : 1.0E-5, + "maxSusceptanceMismatch" : 1.0E-4, + "slackBusPMaxMismatch" : 1.0, + "voltagePerReactivePowerControl" : false, + "maxNewtonRaphsonIterations" : 30, + "maxOuterLoopIterations" : 20, + "newtonRaphsonConvEpsPerEq" : 1.0E-4, + "voltageInitModeOverride" : "NONE", + "transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "shuntVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "minPlausibleTargetVoltage" : 0.8, + "maxPlausibleTargetVoltage" : 1.2, + "minNominalVoltageTargetVoltageCheck" : 20.0, + "minRealisticVoltage" : 0.5, + "maxRealisticVoltage" : 1.5, + "lowImpedanceThreshold" : 1.0E-8, + "reactiveRangeCheckMode" : "MAX", + "networkCacheEnabled" : false, + "svcVoltageMonitoring" : true, + "stateVectorScalingMode" : "NONE", + "maxSlackBusCount" : 1, + "debugDir" : null, + "incrementalTransformerRatioTapControlOuterLoopMaxTapShift" : 3, + "secondaryVoltageControl" : false, + "reactiveLimitsMaxPqPvSwitch" : 3, + "phaseShifterControlMode" : "CONTINUOUS_WITH_DISCRETISATION", + "alwaysUpdateNetwork" : false, + "mostMeshedSlackBusSelectorMaxNominalVoltagePercentile" : 95.0, + "reportedFeatures" : [ ], + "slackBusCountryFilter" : [ ], + "actionableSwitchesIds" : [ ], + "asymmetrical" : false, + "reactivePowerDispatchMode" : "Q_EQUAL_PROPORTION", + "outerLoopNames" : null, + "useActiveLimits" : true, + "lineSearchStateVectorScalingMaxIteration" : 10, + "lineSearchStateVectorScalingStepFold" : 1.3333333333333333, + "maxVoltageChangeStateVectorScalingMaxDv" : 0.1, + "maxVoltageChangeStateVectorScalingMaxDphi" : 0.17453292519943295, + "linePerUnitMode" : "IMPEDANCE", + "useLoadModel" : false, + "dcApproximationType" : "IGNORE_R", + "simulateAutomationSystems" : false + } + } + } + } + }, + "multi-threading" : { + "available-cpus" : 4 + }, + "costly-min-margin-parameters" : { + "shifted-violation-penalty" : 1000.0 + } + } + } +} \ No newline at end of file diff --git a/images/notebook_qr.jpg b/images/notebook_qr.jpg new file mode 100644 index 0000000..3ac34e5 Binary files /dev/null and b/images/notebook_qr.jpg differ diff --git a/images/read_the_docs_qr.jpg b/images/read_the_docs_qr.jpg new file mode 100644 index 0000000..361088c Binary files /dev/null and b/images/read_the_docs_qr.jpg differ diff --git a/open_rao.ipynb b/open_rao.ipynb new file mode 100644 index 0000000..83558ca --- /dev/null +++ b/open_rao.ipynb @@ -0,0 +1,1224 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# OpenRAO in pyPowsybl " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this notebook, you will learn how to use OpenRAO with pypowsybl to optimize a network situation given available remedial actions.\n", + "\n", + "The first step is to install pypowsybl and import the library." + ] + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:31.410165Z", + "start_time": "2025-09-08T15:18:31.408512Z" + } + }, + "cell_type": "code", + "source": "", + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:31.454890Z", + "start_time": "2025-09-08T15:18:31.452246Z" + } + }, + "source": "#pip install pypowsybl==1.12.0", + "outputs": [], + "execution_count": 1 + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:32.780345Z", + "start_time": "2025-09-08T15:18:31.533266Z" + } + }, + "source": [ + "import pypowsybl as pp\n", + "from pypowsybl.rao import Parameters as RaoParameters" + ], + "outputs": [], + "execution_count": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will consider a 12 bus example network in this notebook." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:32.790608Z", + "start_time": "2025-09-08T15:18:32.785512Z" + } + }, + "source": [ + "n12 = pp.network.load('./data/rao/12_node_network.uct')" + ], + "outputs": [], + "execution_count": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By drawing the network area diagram, you can get a better understanding of the substations and branches in the network." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:32.851613Z", + "start_time": "2025-09-08T15:18:32.833333Z" + } + }, + "source": [ + "n12.get_network_area_diagram()" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
BBE1AA1
\n
\n kV / °
\n
\n
\n
BBE2AA1
\n
\n kV / °
\n
\n kV / °
\n
\n
\n
DDE1AA1
\n
\n kV / °
\n
\n
\n
DDE2AA1
\n
\n kV / °
\n
\n
\n
DDE3AA1
\n
\n kV / °
\n
\n
\n
FFR1AA1
\n
\n kV / °
\n
\n
\n
FFR2AA1
\n
\n kV / °
\n
\n
\n
FFR3AA1
\n
\n kV / °
\n
\n
\n
NNL1AA1
\n
\n kV / °
\n
\n
\n
NNL2AA1
\n
\n kV / °
\n
\n
\n
NNL3AA1
\n
\n kV / °
\n
\n
\n
\n
\n" + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1 - Simple N case overload" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To check the initial situation we can just run a loadflow on the network and redraw the network." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:32.911941Z", + "start_time": "2025-09-08T15:18:32.896517Z" + } + }, + "source": [ + "pp.loadflow.run_ac(n12)\n", + "n12.get_network_area_diagram()" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 167\n \n \n \n \n \n \n \n \n \n \n \n -167\n \n \n \n \n \n \n \n \n \n \n \n \n \n -167\n \n \n \n \n \n \n \n \n \n \n \n 167\n \n \n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 333\n \n \n \n \n \n \n \n \n \n \n \n -333\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -167\n \n \n \n \n \n \n \n \n \n \n \n 167\n \n \n \n \n \n \n \n \n \n \n \n \n \n 167\n \n \n \n \n \n \n \n \n \n \n \n -167\n \n \n \n \n \n \n \n \n \n \n \n \n \n 333\n \n \n \n \n \n \n \n \n \n \n \n -333\n \n \n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n \n \n -0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n \n \n 500\n \n \n \n \n \n \n \n \n \n \n \n -500\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
BBE1AA1
\n
\n 400.0 kV / 0.6°
\n
\n
\n
BBE2AA1
\n
\n 400.0 kV / 0.0°
\n
\n 400.0 kV / 1.2°
\n
\n
\n
DDE1AA1
\n
\n 400.0 kV / 0.6°
\n
\n
\n
DDE2AA1
\n
\n 400.0 kV / 1.2°
\n
\n
\n
DDE3AA1
\n
\n 400.0 kV / -0.0°
\n
\n
\n
FFR1AA1
\n
\n 400.0 kV / -3.6°
\n
\n
\n
FFR2AA1
\n
\n 400.0 kV / -1.8°
\n
\n
\n
FFR3AA1
\n
\n 400.0 kV / -1.8°
\n
\n
\n
NNL1AA1
\n
\n 400.0 kV / 4.8°
\n
\n
\n
NNL2AA1
\n
\n 400.0 kV / 3.0°
\n
\n
\n
NNL3AA1
\n
\n 400.0 kV / 3.0°
\n
\n
\n
\n
\n" + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can see the initial flow on the line NNL2AA1 and BBE3AA1 is 500MW. However the PATL is only 410 MW so there is an overload on this line.\n", + "To solve it we can for instance close one of the other lines between NNL2AA1 and BBE3AA1." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:32.974684Z", + "start_time": "2025-09-08T15:18:32.959677Z" + } + }, + "source": [ + "n12.connect(\"NNL2AA1 BBE3AA1 2\")\n", + "pp.loadflow.run_ac(n12)\n", + "n12.get_network_area_diagram()" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 180\n \n \n \n \n \n \n \n \n \n \n \n -180\n \n \n \n \n \n \n \n \n \n \n \n \n \n -180\n \n \n \n \n \n \n \n \n \n \n \n 180\n \n \n \n \n \n \n \n \n \n \n \n \n \n 541\n \n \n \n \n \n \n \n \n \n \n \n -541\n \n \n \n \n \n \n \n \n \n \n \n \n \n 270\n \n \n \n \n \n \n \n \n \n \n \n -270\n \n \n \n \n \n \n \n \n \n \n \n \n \n 270\n \n \n \n \n \n \n \n \n \n \n \n -270\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 360\n \n \n \n \n \n \n \n \n \n \n \n -360\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -153\n \n \n \n \n \n \n \n \n \n \n \n 153\n \n \n \n \n \n \n \n \n \n \n \n \n \n 153\n \n \n \n \n \n \n \n \n \n \n \n -153\n \n \n \n \n \n \n \n \n \n \n \n \n \n 306\n \n \n \n \n \n \n \n \n \n \n \n -306\n \n \n \n \n \n \n \n \n \n \n \n \n \n -459\n \n \n \n \n \n \n \n \n \n \n \n 459\n \n \n \n \n \n \n \n \n \n \n \n \n \n -459\n \n \n \n \n \n \n \n \n \n \n \n 459\n \n \n \n \n \n \n \n \n \n \n \n \n \n -486\n \n \n \n \n \n \n \n \n \n \n \n 486\n \n \n \n \n \n \n \n \n \n \n \n \n \n -514\n \n \n \n \n \n \n \n \n \n \n \n 514\n \n \n \n \n \n \n \n \n \n \n \n \n \n -27\n \n \n \n \n \n \n \n \n \n \n \n 27\n \n \n \n \n \n \n \n \n \n \n \n \n \n 514\n \n \n \n \n \n \n \n \n \n \n \n -514\n \n \n \n \n \n \n \n \n \n \n \n \n \n 486\n \n \n \n \n \n \n \n \n \n \n \n -486\n \n \n \n \n \n \n \n \n \n \n \n \n \n -27\n \n \n \n \n \n \n \n \n \n \n \n 27\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
BBE1AA1
\n
\n 400.0 kV / 0.6°
\n
\n
\n
BBE2AA1
\n
\n 400.0 kV / 0.0°
\n
\n 400.0 kV / 1.3°
\n
\n
\n
DDE1AA1
\n
\n 400.0 kV / 0.2°
\n
\n
\n
DDE2AA1
\n
\n 400.0 kV / 0.7°
\n
\n
\n
DDE3AA1
\n
\n 400.0 kV / -0.4°
\n
\n
\n
FFR1AA1
\n
\n 400.0 kV / -3.8°
\n
\n
\n
FFR2AA1
\n
\n 400.0 kV / -2.0°
\n
\n
\n
FFR3AA1
\n
\n 400.0 kV / -1.9°
\n
\n
\n
NNL1AA1
\n
\n 400.0 kV / 4.1°
\n
\n
\n
NNL2AA1
\n
\n 400.0 kV / 2.3°
\n
\n
\n
NNL3AA1
\n
\n 400.0 kV / 2.4°
\n
\n
\n
\n
\n" + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As we can see, the new flow is 270MW, and **the overload has been solved**.\n", + "\n", + "This solution can be found by the RAO. For this we will need some input files: the network (which we already have), and a crac file which will contain information about available remedial actions, and CNECs (critical network elements and contingencies). For more information on the crac input, you can check this page: https://powsybl.readthedocs.io/projects/openrao/en/stable/input-data/crac/json.html" + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.051307Z", + "start_time": "2025-09-08T15:18:33.019705Z" + } + }, + "source": [ + "# prepare inputs\n", + "n12 = pp.network.load('./data/rao/12_node_network.uct')\n", + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(n12, \"./data/rao/N_case_crac.json\")\n", + "rao_parameters = RaoParameters()\n", + "rao_parameters.load_from_file_source(\"./data/rao/rao_parameters.json\")\n", + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.INFO)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s')\n", + "#run rao\n", + "raoResult = rao_runner.run(n12, rao_parameters)\n", + "result_json = raoResult.to_json()" + ], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:33,034 - WARNING - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:18:33,034 - WARNING - Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.\n", + "2025-09-08 17:18:33,035 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,035 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,036 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,036 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,037 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,037 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,037 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,037 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,038 - INFO - Running AC sensitivity analysis with 2 factors and 0 contingencies\n", + "2025-09-08 17:18:33,038 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,039 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002028186046532099, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,039 - INFO - Initial sensitivity analysis: cost = 90.0 (functional: 90.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,039 - INFO - Limiting element #01: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,039 - INFO - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:18:33,040 - INFO - Root leaf, cost: 90.0 (functional: 90.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,040 - INFO - Limiting element #01: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,040 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,040 - INFO - No range actions to optimize\n", + "2025-09-08 17:18:33,040 - INFO - Root leaf, cost: 90.0 (functional: 90.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,041 - INFO - No range actions activated\n", + "2025-09-08 17:18:33,041 - INFO - Limiting element #01: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,041 - INFO - Using base network '12_node_network' on variant 'SearchTreeWorkingVariantId'\n", + "2025-09-08 17:18:33,041 - INFO - Search depth 1 [start]\n", + "2025-09-08 17:18:33,041 - INFO - Leaves to evaluate: 1\n", + "2025-09-08 17:18:33,042 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,042 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,043 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,043 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,044 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,044 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,044 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,044 - INFO - Running AC sensitivity analysis with 2 factors and 0 contingencies\n", + "2025-09-08 17:18:33,045 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,045 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-3.2095159969713905E-4, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,045 - INFO - Evaluated network action(s): close NL2 BE3 2, cost: -139.73 (functional: -139.73, virtual: 0.0)\n", + "2025-09-08 17:18:33,046 - INFO - Optimized network action(s): close NL2 BE3 2, cost: -139.73 (functional: -139.73, virtual: 0.0)\n", + "2025-09-08 17:18:33,046 - INFO - Stop criterion reached, other threads may skip optimization.\n", + "2025-09-08 17:18:33,046 - INFO - Remaining leaves to evaluate: 0\n", + "2025-09-08 17:18:33,047 - INFO - Search depth 1 [end]\n", + "2025-09-08 17:18:33,047 - INFO - Search depth 1 best leaf: network action(s): close NL2 BE3 2, cost: -139.73 (functional: -139.73, virtual: 0.0)\n", + "2025-09-08 17:18:33,047 - INFO - Search depth 1 best leaf: No range actions activated\n", + "2025-09-08 17:18:33,047 - INFO - Limiting element #01: margin = 139.73 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,048 - INFO - Search-tree RAO completed with status DEFAULT\n", + "2025-09-08 17:18:33,048 - INFO - Best leaf: network action(s): close NL2 BE3 2, cost: -139.73 (functional: -139.73, virtual: 0.0)\n", + "2025-09-08 17:18:33,048 - INFO - Best leaf: No range actions activated\n", + "2025-09-08 17:18:33,048 - INFO - Limiting element #01: margin = 139.73 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,049 - INFO - Scenario \"preventive\": initial cost = 90.0 (functional: 90.0, virtual: 0.0), 1 network action(s) activated : close NL2 BE3 2, cost after preventive optimization = -139.73 (functional: -139.73, virtual: 0.0)\n", + "2025-09-08 17:18:33,049 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,049 - INFO - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:18:33,049 - INFO - Limiting element #01: margin = 139.73 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,049 - INFO - Cost before RAO = 90.0 (functional: 90.0, virtual: 0.0), cost after RAO = -139.73 (functional: -139.73, virtual: 0.0)\n" + ] + } + ], + "execution_count": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's examine the results of RAO." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.096145Z", + "start_time": "2025-09-08T15:18:33.092562Z" + } + }, + "source": [ + "result_json" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'RAO_RESULT',\n", + " 'version': '1.8',\n", + " 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao',\n", + " 'computationStatus': 'default',\n", + " 'executionDetails': 'The RAO only went through first preventive',\n", + " 'costResults': {'initial': {'functionalCost': 90.0,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'preventive': {'functionalCost': -139.73,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'outage': {'functionalCost': -139.73,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'curative': {'functionalCost': -139.73,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}}},\n", + " 'computationStatusMap': [],\n", + " 'flowCnecResults': [{'flowCnecId': 'NNL2AA1 BBE3AA1 1 - preventive',\n", + " 'initial': {'ampere': {'margin': -129.99, 'side1': {'flow': 721.77}},\n", + " 'megawatt': {'margin': -90.0, 'side1': {'flow': 500.0}}},\n", + " 'preventive': {'ampere': {'margin': 201.67, 'side1': {'flow': 390.11}},\n", + " 'megawatt': {'margin': 139.73, 'side1': {'flow': 270.27}}}}],\n", + " 'angleCnecResults': [],\n", + " 'voltageCnecResults': [],\n", + " 'networkActionResults': [{'networkActionId': 'close NL2 BE3 2',\n", + " 'activatedStates': [{'instant': 'preventive'}]}],\n", + " 'rangeActionResults': []}" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 8 + }, + { + "cell_type": "markdown", + "source": [ + "We can see that initially there was a cost of +90 (which corresponds to a worst margin of -90MW, ie a worst overload of 90MW). Then after preventive actions, a cost of -139.73 (ie a worst margin of +139.73MW).\n", + "Then we have the results per flow cnec. And finally we have the information of what actions were applied. Here we applied the action \"close NL2 BE3 2\" in the preventive state.\n", + "For more information about the RaoResult, you can check this page: https://powsybl.readthedocs.io/projects/openrao/en/stable/output-data/rao-result.html" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "## 2 - N-1 outage overload" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "In this next case we added a flow cnec which limits the flow on the line NNL2AA1 and BBE3AA1 to 450MW, after the loss of the line between DDE2AA1 and DDE3AA1, at the outage instant (ie before we have the time to apply any actions - for more information about instants in OpenRAO you can check this page: https://powsybl.readthedocs.io/projects/openrao/en/stable/castor/rao-steps.html).\n", + "This flow cnec will be overloaded even with the application of the topological action. Thankfully, we also added a preventive PST to solve the new constraint." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "source": [ + "# prepare inputs\n", + "n12 = pp.network.load('./data/rao/12_node_network.uct')\n", + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(n12, \"./data/rao/N-1_case_crac_outage.json\")\n", + "rao_parameters = RaoParameters()\n", + "rao_parameters.load_from_file_source(\"./data/rao/rao_parameters.json\")\n", + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.INFO)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s')\n", + "#run rao\n", + "raoResult = rao_runner.run(n12, rao_parameters)\n", + "result_json = raoResult.to_json()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.206128Z", + "start_time": "2025-09-08T15:18:33.143239Z" + } + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:33,145 - ERROR - BBE1AA1 BBE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,145 - ERROR - BBE1AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,145 - ERROR - FFR1AA1 FFR2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - FFR1AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - FFR2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - DDE1AA1 DDE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - DDE1AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - DDE2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,146 - ERROR - NNL1AA1 NNL2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - NNL1AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - NNL2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - FFR2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - DDE2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - NNL2AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,147 - ERROR - NNL2AA1 BBE3AA1 2 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,148 - ERROR - NNL2AA1 BBE3AA1 3 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,148 - ERROR - BBE2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,148 - ERROR - BBE2AA1 BBE3AA1 1 - Blank is not allowed, real transformer resistance must be greater than or equal to zero (0.0 ohm)\n", + "2025-09-08 17:18:33,148 - WARNING - BBE2AA1 BBE3AA1 1 - Blank is not allowed (0.0 S)\n", + "2025-09-08 17:18:33,149 - WARNING - BBE2AA1 BBE3AA1 1 - Transformer shunt conductance must be greater than or equal to zero (0.0 S)\n", + "2025-09-08 17:18:33,149 - WARNING - BBE2AA1 BBE3AA1 1 - For LTCs, transformer angle regulation voltage per tap should not be zero. Its absolute value should not be above 6 % (-0.68 %)\n", + "2025-09-08 17:18:33,150 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,151 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,153 - WARNING - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:18:33,154 - WARNING - Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.\n", + "2025-09-08 17:18:33,154 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,154 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,154 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,154 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,155 - WARNING - Contingency Contingency DE2 DE3 has an automaton or a curative remedial action but no CNECs associated.\n", + "2025-09-08 17:18:33,155 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,156 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,156 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,156 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,157 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,157 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,157 - INFO - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:33,158 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,158 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002028186046532099, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,158 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,159 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,159 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=1, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.004776402772810329, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,159 - INFO - Initial sensitivity analysis: cost = 133.3 (functional: 133.3, virtual: 0.0)\n", + "2025-09-08 17:18:33,159 - INFO - Limiting element #01: margin = -133.3 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,160 - INFO - Limiting element #02: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,160 - INFO - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:18:33,160 - INFO - Root leaf, cost: 133.3 (functional: 133.3, virtual: 0.0)\n", + "2025-09-08 17:18:33,160 - INFO - Limiting element #01: margin = -133.3 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,161 - INFO - Limiting element #02: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,161 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,163 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,163 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,164 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,164 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,164 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,165 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,165 - INFO - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:33,165 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,166 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=7.257322425457957E-4, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,166 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,166 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,167 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-4.960476474025199E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,167 - INFO - Iteration 1: better solution found with a cost of 42.72 (functional: 42.72)\n", + "2025-09-08 17:18:33,169 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,169 - INFO - Root leaf, 1 range action(s) activated, cost: 42.72 (functional: 42.72, virtual: 0.0)\n", + "2025-09-08 17:18:33,169 - INFO - range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,169 - INFO - Limiting element #01: margin = -42.72 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,170 - INFO - Limiting element #02: margin = 18.73 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,170 - INFO - Using base network '12_node_network' on variant 'SearchTreeWorkingVariantId'\n", + "2025-09-08 17:18:33,170 - INFO - Search depth 1 [start]\n", + "2025-09-08 17:18:33,171 - INFO - Leaves to evaluate: 1\n", + "2025-09-08 17:18:33,172 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,172 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,172 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,173 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,173 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,173 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,174 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,197 - INFO - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:33,197 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,198 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002408294433209335, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,199 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,199 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,199 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=4.3076653355456074E-11, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,200 - INFO - Evaluated network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,200 - INFO - Optimized network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,200 - INFO - Stop criterion reached, other threads may skip optimization.\n", + "2025-09-08 17:18:33,201 - INFO - Remaining leaves to evaluate: 0\n", + "2025-09-08 17:18:33,201 - INFO - Search depth 1 [end]\n", + "2025-09-08 17:18:33,201 - INFO - Search depth 1 best leaf: network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,201 - INFO - Search depth 1 best leaf: range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,202 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,202 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,202 - INFO - Search-tree RAO completed with status DEFAULT\n", + "2025-09-08 17:18:33,202 - INFO - Best leaf: network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,203 - INFO - Best leaf: range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,203 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,203 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,203 - INFO - Scenario \"preventive\": initial cost = 133.3 (functional: 133.3, virtual: 0.0), 1 network action(s) and 1 range action(s) activated : close NL2 BE3 2 and pst-range-action: -10, cost after preventive optimization = -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,203 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,204 - INFO - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:18:33,204 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,204 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,204 - INFO - Cost before RAO = 133.3 (functional: 133.3, virtual: 0.0), cost after RAO = -187.22 (functional: -187.22, virtual: 0.0)\n" + ] + } + ], + "execution_count": 9 + }, + { + "cell_type": "code", + "source": [ + "result_json" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.252415Z", + "start_time": "2025-09-08T15:18:33.249038Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'RAO_RESULT',\n", + " 'version': '1.8',\n", + " 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao',\n", + " 'computationStatus': 'default',\n", + " 'executionDetails': 'The RAO only went through first preventive',\n", + " 'costResults': {'initial': {'functionalCost': 133.3,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'preventive': {'functionalCost': -187.22,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'outage': {'functionalCost': -187.22,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'curative': {'functionalCost': -187.22,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}}},\n", + " 'computationStatusMap': [],\n", + " 'flowCnecResults': [{'flowCnecId': 'NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage',\n", + " 'initial': {'ampere': {'margin': -192.55, 'side1': {'flow': 842.07}},\n", + " 'megawatt': {'margin': -133.3, 'side1': {'flow': 583.3}}},\n", + " 'preventive': {'ampere': {'margin': 270.21, 'side1': {'flow': 379.3}},\n", + " 'megawatt': {'margin': 187.22, 'side1': {'flow': 262.78}}}},\n", + " {'flowCnecId': 'NNL2AA1 BBE3AA1 1 - preventive',\n", + " 'initial': {'ampere': {'margin': -129.99, 'side1': {'flow': 721.77}},\n", + " 'megawatt': {'margin': -90.0, 'side1': {'flow': 500.0}}},\n", + " 'preventive': {'ampere': {'margin': 286.51, 'side1': {'flow': 305.28}},\n", + " 'megawatt': {'margin': 198.5, 'side1': {'flow': 211.5}}}}],\n", + " 'angleCnecResults': [],\n", + " 'voltageCnecResults': [],\n", + " 'networkActionResults': [{'networkActionId': 'close NL2 BE3 2',\n", + " 'activatedStates': [{'instant': 'preventive'}]}],\n", + " 'rangeActionResults': [{'rangeActionId': 'pst-range-action',\n", + " 'initialTap': 0,\n", + " 'activatedStates': [{'instant': 'preventive', 'tap': -10}]}]}" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 10 + }, + { + "cell_type": "markdown", + "source": [ + "This time the initial worse overload was 133MW on the outage cnec. If you check the logs carefully (currently we cannot separate the OLF logs from the OpenRAO logs in pypowsybl which makes it a bit hard to read), you can see that we initially tried to solve the constraints with just the PST (root leaf), and still had an overload of 42MW.\n", + "Then we tried applying the topological action and reoptimized the pst, and ended up with a worst margin of 187MW! " + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "## 3 - N-1 curative overload" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "In this final case, we will also check the flow on line BE1 BE2, but this time at the curative instant. We will change the usage rule on the PST to be able to move it in curative to be able to solve the new constraint we have on the line." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "source": [ + "# prepare inputs\n", + "n12 = pp.network.load('./data/rao/12_node_network.uct')\n", + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(n12, \"./data/rao/N-1_case_crac_curative.json\")\n", + "rao_parameters = RaoParameters()\n", + "rao_parameters.load_from_file_source(\"./data/rao/rao_parameters.json\")\n", + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.INFO)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s')\n", + "#run rao\n", + "raoResult = rao_runner.run(n12, rao_parameters)\n", + "result_json = raoResult.to_json()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.361139Z", + "start_time": "2025-09-08T15:18:33.303300Z" + } + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:33,305 - ERROR - BBE1AA1 BBE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,306 - ERROR - BBE1AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,306 - ERROR - FFR1AA1 FFR2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,306 - ERROR - FFR1AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,306 - ERROR - FFR2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,307 - ERROR - DDE1AA1 DDE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,307 - ERROR - DDE1AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,307 - ERROR - DDE2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,308 - ERROR - NNL1AA1 NNL2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,308 - ERROR - NNL1AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,308 - ERROR - NNL2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,308 - ERROR - FFR2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,308 - ERROR - DDE2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - ERROR - NNL2AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - ERROR - NNL2AA1 BBE3AA1 2 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - ERROR - NNL2AA1 BBE3AA1 3 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - ERROR - BBE2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - ERROR - BBE2AA1 BBE3AA1 1 - Blank is not allowed, real transformer resistance must be greater than or equal to zero (0.0 ohm)\n", + "2025-09-08 17:18:33,309 - WARNING - BBE2AA1 BBE3AA1 1 - Blank is not allowed (0.0 S)\n", + "2025-09-08 17:18:33,310 - WARNING - BBE2AA1 BBE3AA1 1 - Transformer shunt conductance must be greater than or equal to zero (0.0 S)\n", + "2025-09-08 17:18:33,310 - WARNING - BBE2AA1 BBE3AA1 1 - For LTCs, transformer angle regulation voltage per tap should not be zero. Its absolute value should not be above 6 % (-0.68 %)\n", + "2025-09-08 17:18:33,311 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,312 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,312 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,315 - WARNING - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:18:33,315 - WARNING - Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.\n", + "2025-09-08 17:18:33,315 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,316 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,316 - WARNING - A threshold for the flowCnec BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,316 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,316 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,317 - WARNING - A threshold for the flowCnec BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,317 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,318 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,318 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,318 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,318 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,319 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,319 - INFO - Running AC sensitivity analysis with 6 factors and 1 contingencies\n", + "2025-09-08 17:18:33,319 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,320 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002028186046532099, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,320 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,320 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,321 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=1, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.004776402772810329, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,321 - INFO - Initial sensitivity analysis: cost = 133.3 (functional: 133.3, virtual: 0.0)\n", + "2025-09-08 17:18:33,321 - INFO - Limiting element #01: margin = -133.3 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,321 - INFO - Limiting element #02: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,321 - INFO - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:18:33,322 - INFO - Root leaf, cost: 133.3 (functional: 133.3, virtual: 0.0)\n", + "2025-09-08 17:18:33,322 - INFO - Limiting element #01: margin = -133.3 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,322 - INFO - Limiting element #02: margin = -90.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,322 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,324 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,324 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,324 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,325 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,325 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,325 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,325 - INFO - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:33,326 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,326 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=7.257322425457957E-4, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,326 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,327 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,327 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-4.960476474025199E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,327 - INFO - Iteration 1: better solution found with a cost of 42.72 (functional: 42.72)\n", + "2025-09-08 17:18:33,328 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,329 - INFO - Root leaf, 1 range action(s) activated, cost: 42.72 (functional: 42.72, virtual: 0.0)\n", + "2025-09-08 17:18:33,329 - INFO - range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,329 - INFO - Limiting element #01: margin = -42.72 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,329 - INFO - Limiting element #02: margin = 18.73 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,330 - INFO - Using base network '12_node_network' on variant 'SearchTreeWorkingVariantId'\n", + "2025-09-08 17:18:33,330 - INFO - Search depth 1 [start]\n", + "2025-09-08 17:18:33,330 - INFO - Leaves to evaluate: 1\n", + "2025-09-08 17:18:33,330 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,331 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,331 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,332 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,332 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,332 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,332 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,333 - INFO - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:33,333 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,334 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002408294433209335, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,334 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,334 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,334 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=4.3076653355456074E-11, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,335 - INFO - Evaluated network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,335 - INFO - Optimized network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,336 - INFO - Stop criterion reached, other threads may skip optimization.\n", + "2025-09-08 17:18:33,336 - INFO - Remaining leaves to evaluate: 0\n", + "2025-09-08 17:18:33,337 - INFO - Search depth 1 [end]\n", + "2025-09-08 17:18:33,337 - INFO - Search depth 1 best leaf: network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,337 - INFO - Search depth 1 best leaf: range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,337 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,337 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,338 - INFO - Search-tree RAO completed with status DEFAULT\n", + "2025-09-08 17:18:33,338 - INFO - Best leaf: network action(s): close NL2 BE3 2, cost: -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,338 - INFO - Best leaf: range action(s): pst-range-action: -10\n", + "2025-09-08 17:18:33,338 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,338 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,339 - INFO - Scenario \"preventive\": initial cost = 133.3 (functional: 133.3, virtual: 0.0), 1 network action(s) and 1 range action(s) activated : close NL2 BE3 2 and pst-range-action: -10, cost after preventive optimization = -187.22 (functional: -187.22, virtual: 0.0)\n", + "2025-09-08 17:18:33,339 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,339 - INFO - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:18:33,339 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,340 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,340 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,340 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,341 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,341 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,341 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,342 - INFO - Running AC sensitivity analysis with 6 factors and 1 contingencies\n", + "2025-09-08 17:18:33,342 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,342 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.002408294433209335, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,343 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,343 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,343 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=4.3076653355456074E-11, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,344 - INFO - Systematic sensitivity analysis after preventive remedial actions: cost = 237.65 (functional: 237.65, virtual: 0.0)\n", + "2025-09-08 17:18:33,344 - INFO - Limiting element #01: margin = -237.65 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,344 - INFO - Limiting element #02: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,344 - INFO - ----- Post-contingency perimeters optimization [start]\n", + "2025-09-08 17:18:33,347 - INFO - Optimizing scenario post-contingency Contingency DE2 DE3.\n", + "2025-09-08 17:18:33,347 - INFO - Optimizing curative state Contingency DE2 DE3 - curative.\n", + "2025-09-08 17:18:33,348 - INFO - Root leaf, cost: 237.65 (functional: 237.65, virtual: 0.0)\n", + "2025-09-08 17:18:33,348 - INFO - Limiting element #01: margin = -237.65 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,348 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,350 - WARNING - Network {CC0 SC0}: 11 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,350 - WARNING - Network {CC0 SC0}: 1 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,350 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,351 - INFO - Network {CC0 SC0} balance: active generation=1000.0 MW, active load=1000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,351 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,351 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,352 - INFO - Running AC sensitivity analysis with 2 factors and 1 contingencies\n", + "2025-09-08 17:18:33,352 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,353 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.001380331569489357, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,353 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,354 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,354 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=1, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.0011719159598300166, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,354 - INFO - Iteration 1: better solution found with a cost of -290.77 (functional: -290.77)\n", + "2025-09-08 17:18:33,355 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,356 - INFO - Root leaf, 1 range action(s) activated, cost: -290.77 (functional: -290.77, virtual: 0.0)\n", + "2025-09-08 17:18:33,356 - INFO - range action(s): pst-range-action: 6\n", + "2025-09-08 17:18:33,357 - INFO - Limiting element #01: margin = 290.77 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,357 - INFO - Scenario \"Contingency DE2 DE3\": initial cost = 237.65 (functional: 237.65, virtual: 0.0), 1 range action(s) activated : pst-range-action: 6, cost after curative optimization = -290.77 (functional: -290.77, virtual: 0.0)\n", + "2025-09-08 17:18:33,357 - INFO - Curative state Contingency DE2 DE3 - curative has been optimized.\n", + "2025-09-08 17:18:33,358 - INFO - ----- Post-contingency perimeters optimization [end]\n", + "2025-09-08 17:18:33,358 - INFO - Merging preventive and post-contingency RAO results:\n", + "2025-09-08 17:18:33,358 - INFO - Limiting element #01: margin = 187.22 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,359 - INFO - Limiting element #02: margin = 198.5 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,359 - INFO - Limiting element #03: margin = 290.77 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,359 - INFO - Cost before RAO = 133.3 (functional: 133.3, virtual: 0.0), cost after RAO = -187.22 (functional: -187.22, virtual: 0.0)\n" + ] + } + ], + "execution_count": 11 + }, + { + "cell_type": "code", + "source": [ + "result_json" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.405351Z", + "start_time": "2025-09-08T15:18:33.400432Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'RAO_RESULT',\n", + " 'version': '1.8',\n", + " 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao',\n", + " 'computationStatus': 'default',\n", + " 'executionDetails': 'The RAO only went through first preventive',\n", + " 'costResults': {'initial': {'functionalCost': 133.3,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'preventive': {'functionalCost': 237.65,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'outage': {'functionalCost': 237.65,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}},\n", + " 'curative': {'functionalCost': -187.22,\n", + " 'virtualCost': {'sensitivity-failure-cost': 0.0}}},\n", + " 'computationStatusMap': [],\n", + " 'flowCnecResults': [{'flowCnecId': 'BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative',\n", + " 'initial': {'ampere': {'margin': 152.35, 'side1': {'flow': 280.66}},\n", + " 'megawatt': {'margin': 105.55, 'side1': {'flow': 194.45}}},\n", + " 'preventive': {'ampere': {'margin': -343.12, 'side1': {'flow': 776.14}},\n", + " 'megawatt': {'margin': -237.65, 'side1': {'flow': 537.65}}},\n", + " 'curative': {'ampere': {'margin': 419.7, 'side1': {'flow': 13.32}},\n", + " 'megawatt': {'margin': 290.77, 'side1': {'flow': 9.23}}}},\n", + " {'flowCnecId': 'NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage',\n", + " 'initial': {'ampere': {'margin': -192.55, 'side1': {'flow': 842.07}},\n", + " 'megawatt': {'margin': -133.3, 'side1': {'flow': 583.3}}},\n", + " 'preventive': {'ampere': {'margin': 270.21, 'side1': {'flow': 379.3}},\n", + " 'megawatt': {'margin': 187.22, 'side1': {'flow': 262.78}}}},\n", + " {'flowCnecId': 'NNL2AA1 BBE3AA1 1 - preventive',\n", + " 'initial': {'ampere': {'margin': -129.99, 'side1': {'flow': 721.77}},\n", + " 'megawatt': {'margin': -90.0, 'side1': {'flow': 500.0}}},\n", + " 'preventive': {'ampere': {'margin': 286.51, 'side1': {'flow': 305.28}},\n", + " 'megawatt': {'margin': 198.5, 'side1': {'flow': 211.5}}}}],\n", + " 'angleCnecResults': [],\n", + " 'voltageCnecResults': [],\n", + " 'networkActionResults': [{'networkActionId': 'close NL2 BE3 2',\n", + " 'activatedStates': [{'instant': 'preventive'}]}],\n", + " 'rangeActionResults': [{'rangeActionId': 'pst-range-action',\n", + " 'initialTap': 0,\n", + " 'activatedStates': [{'instant': 'preventive', 'tap': -10},\n", + " {'instant': 'curative', 'contingency': 'Contingency DE2 DE3', 'tap': 6}]}]}" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 12 + }, + { + "cell_type": "markdown", + "source": [ + "This time, after preventive actions, we still have a positive cost (ie an overload). And it's only after the curative actions the cost finally becomes negative.\n", + "More precisely, we can check the informations for the curative cnec we added:\n" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "source": [ + "[x for x in result_json.get(\"flowCnecResults\") if x.get(\"flowCnecId\") == 'BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative']" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.453801Z", + "start_time": "2025-09-08T15:18:33.450163Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'flowCnecId': 'BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative',\n", + " 'initial': {'ampere': {'margin': 152.35, 'side1': {'flow': 280.66}},\n", + " 'megawatt': {'margin': 105.55, 'side1': {'flow': 194.45}}},\n", + " 'preventive': {'ampere': {'margin': -343.12, 'side1': {'flow': 776.14}},\n", + " 'megawatt': {'margin': -237.65, 'side1': {'flow': 537.65}}},\n", + " 'curative': {'ampere': {'margin': 419.7, 'side1': {'flow': 13.32}},\n", + " 'megawatt': {'margin': 290.77, 'side1': {'flow': 9.23}}}}]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 13 + }, + { + "cell_type": "markdown", + "source": [ + "As you can see, with no actions, there's actually a margin of 152MW on the line in curative! But by applying preventive actions (that aimed to solve the preventive and outage cnecs), we made the curative cnec unsecure, and we had to apply some curative action to make it secure again." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "## 4 - Costly Optimization" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "In this new case, the net generation in the Netherlands increased even more and the load in France increased too, increasing the initial overloads, and the actions we had until now are no longer sufficient to solve the problems. Fortunately, we have two generators, one in France and one in the Netherlands that can do redispatching. However this redispatching can be expensive, so we will change the objective function of the RAO: we no longer want to maximize the minimum margin, instead we want to secure the network at the minimum cost." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "source": [ + "# prepare inputs\n", + "n12 = pp.network.load('./data/rao/12_node_network_redispatching.uct')\n", + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(n12, \"./data/rao/N-1_case_crac_curative_redispatching.json\")\n", + "rao_parameters = RaoParameters()\n", + "rao_parameters.load_from_file_source(\"./data/rao/rao_parameters_costly.json\")\n", + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.INFO)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s')\n", + "#run rao\n", + "raoResult = rao_runner.run(n12, rao_parameters)\n", + "result_json = raoResult.to_json()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.612158Z", + "start_time": "2025-09-08T15:18:33.501576Z" + } + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:33,504 - ERROR - BBE1AA1 BBE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,504 - ERROR - BBE1AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,505 - ERROR - FFR1AA1 FFR2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,505 - ERROR - FFR1AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,506 - ERROR - FFR2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,506 - ERROR - DDE1AA1 DDE2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,506 - ERROR - DDE1AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,506 - ERROR - DDE2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,507 - ERROR - NNL1AA1 NNL2AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,507 - ERROR - NNL1AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,507 - ERROR - NNL2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,507 - ERROR - FFR2AA1 DDE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,508 - ERROR - DDE2AA1 NNL3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,508 - ERROR - NNL2AA1 BBE3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,508 - ERROR - NNL2AA1 BBE3AA1 2 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,508 - ERROR - NNL2AA1 BBE3AA1 3 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,509 - ERROR - BBE2AA1 FFR3AA1 1 - Real line resistance cannot be negative (0.0 ohm)\n", + "2025-09-08 17:18:33,509 - ERROR - BBE2AA1 BBE3AA1 1 - Blank is not allowed, real transformer resistance must be greater than or equal to zero (0.0 ohm)\n", + "2025-09-08 17:18:33,509 - WARNING - BBE2AA1 BBE3AA1 1 - Blank is not allowed (0.0 S)\n", + "2025-09-08 17:18:33,509 - WARNING - BBE2AA1 BBE3AA1 1 - Transformer shunt conductance must be greater than or equal to zero (0.0 S)\n", + "2025-09-08 17:18:33,509 - WARNING - BBE2AA1 BBE3AA1 1 - For LTCs, transformer angle regulation voltage per tap should not be zero. Its absolute value should not be above 6 % (-0.68 %)\n", + "2025-09-08 17:18:33,513 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,513 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,514 - WARNING - The iMax is now fetched in the network so the value in the CRAC will not be read.\n", + "2025-09-08 17:18:33,514 - WARNING - The initial setpoint is now read from the network so the value in the crac will not be read\n", + "2025-09-08 17:18:33,515 - WARNING - The initial setpoint is now read from the network so the value in the crac will not be read\n", + "2025-09-08 17:18:33,518 - WARNING - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:18:33,519 - WARNING - Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.\n", + "2025-09-08 17:18:33,519 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,519 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,519 - WARNING - A threshold for the flowCnec BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,520 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,520 - WARNING - A threshold for the flowCnec NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,520 - WARNING - A threshold for the flowCnec BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:33,521 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,521 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,522 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,522 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,522 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,522 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,523 - INFO - Running AC sensitivity analysis with 12 factors and 1 contingencies\n", + "2025-09-08 17:18:33,523 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,524 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-1.099476065746785E-9, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,524 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,524 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,525 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-2.589235492678199E-8, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,525 - INFO - Initial sensitivity analysis: cost = 716562.92 (functional: 0.0, virtual: 716562.92 {min-margin-violation-evaluator=716562.92})\n", + "2025-09-08 17:18:33,525 - INFO - Limiting element #01: margin = -716.56 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,526 - INFO - Limiting element #02: margin = -590.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,526 - INFO - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:18:33,526 - INFO - Root leaf, cost: 716562.92 (functional: 0.0, virtual: 716562.92 {min-margin-violation-evaluator=716562.92})\n", + "2025-09-08 17:18:33,527 - INFO - Limiting element #01: margin = -716.56 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,527 - INFO - Limiting element #02: margin = -590.0 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,527 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,536 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,537 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,537 - INFO - Network {CC0 SC0} has 12 buses and 16 branches\n", + "2025-09-08 17:18:33,537 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,538 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,538 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_0 (method='First slack')\n", + "2025-09-08 17:18:33,538 - INFO - Running AC sensitivity analysis with 8 factors and 1 contingencies\n", + "2025-09-08 17:18:33,539 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,539 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.0026220928996290027, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,540 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,540 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,540 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-6.412581576853427E-9, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,541 - INFO - Iteration 1: better solution found with a cost of 384414.43 (functional: 50020.00)\n", + "2025-09-08 17:18:33,549 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,550 - INFO - Root leaf, 3 range action(s) activated, cost: 384414.43 (functional: 50020.0, virtual: 334394.43 {min-margin-violation-evaluator=334394.43})\n", + "2025-09-08 17:18:33,550 - INFO - range action(s): pst-range-action: -10, redispatchingActionFR: 1000, redispatchingActionNL: 500\n", + "2025-09-08 17:18:33,550 - INFO - Limiting element #01: margin = -334.39 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,550 - INFO - Limiting element #02: margin = -231.31 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,551 - INFO - Root leaf, limiting \"min-margin-violation-evaluator\" constraint #01: flow = 784.39 MW, threshold = 450.00 MW, margin = -334.39 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\", CNEC name = \"NL2 BE3 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,551 - INFO - Root leaf, limiting \"min-margin-violation-evaluator\" constraint #02: flow = 641.31 MW, threshold = 410.00 MW, margin = -231.31 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\", CNEC name = \"NL2 BE3 1 - preventive\"\n", + "2025-09-08 17:18:33,551 - INFO - Using base network '12_node_network_redispatching' on variant 'SearchTreeWorkingVariantId'\n", + "2025-09-08 17:18:33,552 - INFO - Search depth 1 [start]\n", + "2025-09-08 17:18:33,552 - INFO - Leaves to evaluate: 1\n", + "2025-09-08 17:18:33,552 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,553 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,554 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,554 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,555 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,555 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,555 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,555 - INFO - Running AC sensitivity analysis with 8 factors and 1 contingencies\n", + "2025-09-08 17:18:33,556 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,556 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.00889825060106375, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,557 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,557 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,557 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=2.4709123636057484E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,558 - INFO - Evaluated network action(s): close NL2 BE3 2, cost: 50020.0 (functional: 50020.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,566 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,566 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,567 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,567 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,567 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,568 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,568 - INFO - Running AC sensitivity analysis with 8 factors and 1 contingencies\n", + "2025-09-08 17:18:33,568 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,569 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.010574641261840156, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,569 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,569 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,570 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=3.1885605267234496E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,570 - INFO - Iteration 1: better solution found with a cost of 39896.99 (functional: 39820.00)\n", + "2025-09-08 17:18:33,576 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,576 - INFO - Optimized network action(s): close NL2 BE3 2, 3 range action(s) activated, cost: 39896.99 (functional: 39820.0, virtual: 76.99 {min-margin-violation-evaluator=76.99})\n", + "2025-09-08 17:18:33,577 - INFO - Optimized network action(s): close NL2 BE3 2, limiting \"min-margin-violation-evaluator\" constraint #01: flow = 450.08 MW, threshold = 450.00 MW, margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\", CNEC name = \"NL2 BE3 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,577 - INFO - Remaining leaves to evaluate: 0\n", + "2025-09-08 17:18:33,578 - INFO - Search depth 1 [end]\n", + "2025-09-08 17:18:33,578 - INFO - Search depth 1 best leaf: network action(s): close NL2 BE3 2, 3 range action(s) activated, cost: 39896.99 (functional: 39820.0, virtual: 76.99 {min-margin-violation-evaluator=76.99})\n", + "2025-09-08 17:18:33,578 - INFO - Search depth 1 best leaf: range action(s): pst-range-action: -10, redispatchingActionFR: 898, redispatchingActionNL: 602\n", + "2025-09-08 17:18:33,578 - INFO - Limiting element #01: margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,578 - INFO - Limiting element #02: margin = 35.78 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,579 - INFO - Search depth 2 [start]\n", + "2025-09-08 17:18:33,579 - INFO - No more network action available\n", + "2025-09-08 17:18:33,579 - INFO - No better result found in search depth 2, exiting search tree\n", + "2025-09-08 17:18:33,579 - INFO - Search-tree RAO completed with status DEFAULT\n", + "2025-09-08 17:18:33,579 - INFO - Best leaf: network action(s): close NL2 BE3 2, 3 range action(s) activated, cost: 39896.99 (functional: 39820.0, virtual: 76.99 {min-margin-violation-evaluator=76.99})\n", + "2025-09-08 17:18:33,579 - INFO - Best leaf: range action(s): pst-range-action: -10, redispatchingActionFR: 898, redispatchingActionNL: 602\n", + "2025-09-08 17:18:33,580 - INFO - Limiting element #01: margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,580 - INFO - Limiting element #02: margin = 35.78 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,580 - INFO - Scenario \"preventive\": initial cost = 716562.92 (functional: 0.0, virtual: 716562.92 {min-margin-violation-evaluator=716562.92}), 1 network action(s) and 3 range action(s) activated : close NL2 BE3 2 and pst-range-action: -10, redispatchingActionFR: 898, redispatchingActionNL: 602, cost after preventive optimization = 39896.99 (functional: 39820.0, virtual: 76.99 {min-margin-violation-evaluator=76.99})\n", + "2025-09-08 17:18:33,580 - INFO - network action(s): close NL2 BE3 2, limiting \"min-margin-violation-evaluator\" constraint #01: flow = 450.08 MW, threshold = 450.00 MW, margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\", CNEC name = \"NL2 BE3 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,580 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,581 - INFO - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:18:33,581 - INFO - Connectable NNL2AA1 BBE3AA1 2 has been connected on each side.\n", + "2025-09-08 17:18:33,581 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,582 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,582 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,582 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,583 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,583 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,583 - INFO - Running AC sensitivity analysis with 12 factors and 1 contingencies\n", + "2025-09-08 17:18:33,583 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,584 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.010574641261840156, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,584 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,585 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,585 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=3.1885605267234496E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,585 - INFO - Systematic sensitivity analysis after preventive remedial actions: cost = 362454.98 (functional: 0.0, virtual: 362454.98 {min-margin-violation-evaluator=362454.98})\n", + "2025-09-08 17:18:33,586 - INFO - Limiting element #01: margin = -362.45 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,586 - INFO - Limiting element #02: margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,586 - INFO - ----- Post-contingency perimeters optimization [start]\n", + "2025-09-08 17:18:33,590 - INFO - Optimizing scenario post-contingency Contingency DE2 DE3.\n", + "2025-09-08 17:18:33,590 - INFO - Optimizing curative state Contingency DE2 DE3 - curative.\n", + "2025-09-08 17:18:33,590 - INFO - Root leaf, cost: 362454.98 (functional: 0.0, virtual: 362454.98 {min-margin-violation-evaluator=362454.98})\n", + "2025-09-08 17:18:33,591 - INFO - Limiting element #01: margin = -362.45 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,591 - INFO - Linear optimization on root leaf\n", + "2025-09-08 17:18:33,596 - WARNING - Network {CC0 SC0}: 8 generators have been discarded from active power control because of a targetP equals 0\n", + "2025-09-08 17:18:33,596 - WARNING - Network {CC0 SC0}: 4 generators have been discarded from active power control because of maxP not plausible\n", + "2025-09-08 17:18:33,597 - INFO - Network {CC0 SC0} has 12 buses and 17 branches\n", + "2025-09-08 17:18:33,597 - INFO - Network {CC0 SC0} balance: active generation=3000.0 MW, active load=3000.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar\n", + "2025-09-08 17:18:33,597 - INFO - Network {CC0 SC0}, slack buses are [BBE2AA1_1] (method='Most meshed bus')\n", + "2025-09-08 17:18:33,597 - INFO - Network {CC0 SC0}, reference bus is BBE2AA1_1 (method='First slack')\n", + "2025-09-08 17:18:33,598 - INFO - Running AC sensitivity analysis with 2 factors and 1 contingencies\n", + "2025-09-08 17:18:33,598 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,599 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-2.4915466934061214E-4, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,599 - INFO - Simulate contingency 'Contingency DE2 DE3'\n", + "2025-09-08 17:18:33,599 - INFO - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:33,599 - INFO - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-3.1015190415928373E-10, distributedActivePower=0.0))\n", + "2025-09-08 17:18:33,600 - INFO - Iteration 1: better solution found with a cost of 0.00 (functional: 0.00)\n", + "2025-09-08 17:18:33,606 - INFO - Iteration 2: same results as previous iterations, optimal solution found\n", + "2025-09-08 17:18:33,606 - INFO - Root leaf, 1 range action(s) activated, cost: 0.0 (functional: 0.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,607 - INFO - range action(s): pst-range-action: 1\n", + "2025-09-08 17:18:33,607 - INFO - Limiting element #01: margin = 0.73 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,608 - INFO - Scenario \"Contingency DE2 DE3\": initial cost = 362454.98 (functional: 0.0, virtual: 362454.98 {min-margin-violation-evaluator=362454.98}), 1 range action(s) activated : pst-range-action: 1, cost after curative optimization = 0.0 (functional: 0.0, virtual: 0.0)\n", + "2025-09-08 17:18:33,608 - INFO - Curative state Contingency DE2 DE3 - curative has been optimized.\n", + "2025-09-08 17:18:33,609 - INFO - ----- Post-contingency perimeters optimization [end]\n", + "2025-09-08 17:18:33,609 - INFO - Merging preventive and post-contingency RAO results:\n", + "2025-09-08 17:18:33,609 - INFO - Limiting element #01: margin = -0.08 MW, element NNL2AA1 BBE3AA1 1 at state Contingency DE2 DE3 - outage, CNEC ID = \"NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage\"\n", + "2025-09-08 17:18:33,610 - INFO - Limiting element #02: margin = 0.73 MW, element BBE1AA1 BBE2AA1 1 at state Contingency DE2 DE3 - curative, CNEC ID = \"BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative\"\n", + "2025-09-08 17:18:33,610 - INFO - Limiting element #03: margin = 35.78 MW, element NNL2AA1 BBE3AA1 1 at state preventive, CNEC ID = \"NNL2AA1 BBE3AA1 1 - preventive\"\n", + "2025-09-08 17:18:33,610 - INFO - Cost before RAO = 716562.92 (functional: 0.0, virtual: 716562.92 {min-margin-violation-evaluator=716562.92}), cost after RAO = 39896.99 (functional: 39820.0, virtual: 76.99 {min-margin-violation-evaluator=76.99})\n" + ] + } + ], + "execution_count": 14 + }, + { + "cell_type": "code", + "source": [ + "result_json" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:33.622711Z", + "start_time": "2025-09-08T15:18:33.619636Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'RAO_RESULT',\n", + " 'version': '1.8',\n", + " 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao',\n", + " 'computationStatus': 'default',\n", + " 'executionDetails': 'The RAO only went through first preventive',\n", + " 'costResults': {'initial': {'functionalCost': 0.0,\n", + " 'virtualCost': {'min-margin-violation-evaluator': 716562.92,\n", + " 'sensitivity-failure-cost': 0.0}},\n", + " 'preventive': {'functionalCost': 39820.0,\n", + " 'virtualCost': {'min-margin-violation-evaluator': 362454.98,\n", + " 'sensitivity-failure-cost': 0.0}},\n", + " 'outage': {'functionalCost': 39820.0,\n", + " 'virtualCost': {'min-margin-violation-evaluator': 362454.98,\n", + " 'sensitivity-failure-cost': 0.0}},\n", + " 'curative': {'functionalCost': 39820.0,\n", + " 'virtualCost': {'min-margin-violation-evaluator': 76.99,\n", + " 'sensitivity-failure-cost': 0.0}}},\n", + " 'computationStatusMap': [],\n", + " 'flowCnecResults': [{'flowCnecId': 'BBE1AA1 BBE2AA1 1 - Contingency DE2 DE3 - curative',\n", + " 'initial': {'ampere': {'margin': -128.4, 'side1': {'flow': 561.41}},\n", + " 'megawatt': {'margin': -88.93, 'side1': {'flow': 388.93}}},\n", + " 'preventive': {'ampere': {'margin': -523.36, 'side1': {'flow': 956.38}},\n", + " 'megawatt': {'margin': -362.45, 'side1': {'flow': 662.45}}},\n", + " 'curative': {'ampere': {'margin': 1.03, 'side1': {'flow': 431.98}},\n", + " 'megawatt': {'margin': 0.73, 'side1': {'flow': 299.27}}}},\n", + " {'flowCnecId': 'NNL2AA1 BBE3AA1 1 - Contingency DE2 DE3 - outage',\n", + " 'initial': {'ampere': {'margin': -1035.39, 'side1': {'flow': 1684.91}},\n", + " 'megawatt': {'margin': -716.56, 'side1': {'flow': 1166.56}}},\n", + " 'preventive': {'ampere': {'margin': -0.18, 'side1': {'flow': 649.69}},\n", + " 'megawatt': {'margin': -0.08, 'side1': {'flow': 450.08}}}},\n", + " {'flowCnecId': 'NNL2AA1 BBE3AA1 1 - preventive',\n", + " 'initial': {'ampere': {'margin': -852.3, 'side1': {'flow': 1444.08}},\n", + " 'megawatt': {'margin': -590.0, 'side1': {'flow': 1000.0}}},\n", + " 'preventive': {'ampere': {'margin': 51.6, 'side1': {'flow': 540.18}},\n", + " 'megawatt': {'margin': 35.78, 'side1': {'flow': 374.22}}}}],\n", + " 'angleCnecResults': [],\n", + " 'voltageCnecResults': [],\n", + " 'networkActionResults': [{'networkActionId': 'close NL2 BE3 2',\n", + " 'activatedStates': [{'instant': 'preventive'}]}],\n", + " 'rangeActionResults': [{'rangeActionId': 'pst-range-action',\n", + " 'initialTap': 0,\n", + " 'activatedStates': [{'instant': 'preventive', 'tap': -10},\n", + " {'instant': 'curative', 'contingency': 'Contingency DE2 DE3', 'tap': 1}]},\n", + " {'rangeActionId': 'redispatchingActionFR',\n", + " 'initialSetpoint': 500.0,\n", + " 'activatedStates': [{'instant': 'preventive', 'setpoint': 898.0}]},\n", + " {'rangeActionId': 'redispatchingActionNL',\n", + " 'initialSetpoint': 1000.0,\n", + " 'activatedStates': [{'instant': 'preventive', 'setpoint': 602.0}]}]}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 15 + }, + { + "cell_type": "markdown", + "source": [ + "If you check the initial cost in the result, you will notice the functional cost is now 0, and instead we have a virtual cost due to a \"min-margin-violation\". Indeed the new objective function is actually the cost of redispatching, and the overload has become a soft constraint.\n", + "And if you check the final result (after curative), then you will see the functional cost is 39820 and the virtual cost is only 76,99.\n", + "The 39820 value corresponds to the cost of the redispatching: 398 (up variation for FR action) * 50 (up variation cost) + 10 (activation cost) + 398 (down variation for NL action) * 50 (down variation cost) + 10 (activation cost). The costs for each action is defined in the crac file.\n", + "The 76,99 virtual cost is due to a remaining overload in the network. The cost of the overload can be configured via the [min margin optional parameters](https://powsybl.readthedocs.io/projects/openrao/en/stable/parameters/implementation-specific-parameters.html#min-margin-optional-parameters):\n", + "- the shifted-violation-penalty parameter sets the penalty for each MW/A of overload in the min margin, with respect to the shifted-violation-threshold\n", + "- the shifted-violation-threshold shifts the security domain of the CNECs to be considered as in violation. That way, you can for instance choose to penalize cnecs under 5 MW rather than penalizing all overloaded CNECs." + ], + "metadata": { + "collapsed": false + } + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/open_rao_angle_monitoring.ipynb b/open_rao_angle_monitoring.ipynb new file mode 100644 index 0000000..d749c60 --- /dev/null +++ b/open_rao_angle_monitoring.ipynb @@ -0,0 +1,1415 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2fdb50ba", + "metadata": {}, + "source": "# OpenRAO Angle Monitoring in pyPowsybl" + }, + { + "cell_type": "markdown", + "id": "efa399e1", + "metadata": {}, + "source": [ + "In this notebook, we'll explore how OpenRao monitoring algorithms work. \n", + "For network situations with angle or voltage overloads, the monitoring module will try to relieve these constraints by applying remedial actions. \n", + "\n", + "The first step is to install pypowsybl and import the library." + ] + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.322979Z", + "start_time": "2025-09-08T15:17:53.321183Z" + } + }, + "cell_type": "code", + "source": "#pip install pypowsybl==1.12.0", + "id": "6657842d8b2d9845", + "outputs": [], + "execution_count": 30 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.373498Z", + "start_time": "2025-09-08T15:17:53.371569Z" + } + }, + "cell_type": "code", + "source": [ + "import pypowsybl as pp\n", + "from pypowsybl.rao import Parameters as RaoParameters" + ], + "id": "4ad9bbcf2f4f85bf", + "outputs": [], + "execution_count": 31 + }, + { + "cell_type": "code", + "id": "initial_id", + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.422012Z", + "start_time": "2025-09-08T15:17:53.419904Z" + } + }, + "source": [ + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.INFO)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')" + ], + "outputs": [], + "execution_count": 32 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "Let's load a simple 3 node network.\n", + "- VL1 voltage level contains a generator producing 100 MW.\n", + "- VL2 voltage level contains a load consuming 100 MW.\n", + "- VL1 and VL3 are connected by a PST.\n", + "- VL2 and VL3 are connected by 2 lines, one of with has infinite resistance : that's why it has no power flowing through it." + ], + "id": "eda73ac35599f2e5" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.479424Z", + "start_time": "2025-09-08T15:17:53.470182Z" + } + }, + "cell_type": "code", + "source": [ + "network = pp.network.load(\"data/rao/monitoring/network.xiidm\")\n", + "network.get_network_area_diagram()" + ], + "id": "d923fa57b4d80171", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,472 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,473 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,474 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:17:53,475 - INFO - powsybl - Elapsed time: 8.7134E-5\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 385.7 kV / -3.7°
\n
\n
\n
VL3
\n
\n 392.6 kV / -1.8°
\n
\n
\n
\n
\n" + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 33 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "Now, let's run a loadflow on this network. We'll then be able to assess which lines are overloaded.", + "id": "ce005f42855370fb" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.538278Z", + "start_time": "2025-09-08T15:17:53.521703Z" + } + }, + "cell_type": "code", + "source": [ + "pp.loadflow.run_ac(network)\n", + "network.get_network_area_diagram()" + ], + "id": "e37a9b29dce42548", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,522 - INFO - powsybl - loadflow provider used is : OpenLoadFlow\n", + "2025-09-08 17:17:53,523 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:53,527 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬──────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼──────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ true │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ false │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P_MAX │\n", + "│ │ countriesToBalance │ [] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ true │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ true │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴──────────────────────────────────┘\n", + "2025-09-08 17:17:53,528 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:53,528 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:17:53,529 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,529 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:53,529 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:17:53,530 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,530 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,530 - INFO - powsybl - Load flow ran in 7 ms\n", + "2025-09-08 17:17:53,531 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,532 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,533 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:17:53,534 - INFO - powsybl - Elapsed time: 9.7283E-5\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 385.7 kV / -3.7°
\n
\n
\n
VL3
\n
\n 392.6 kV / -1.8°
\n
\n
\n
\n
\n" + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 34 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "The monitoring algorithm is run after a RAO has been run, on a network on which are applied the remedial actions optimized during the RAO to optimize flow CNECs. \n", + "To relieve Angle/Voltage CNECs, we won't be optimizing remedial actions because modelling the impact of remedial actions on angle/voltage values is highly complex and non linear. Instead, we'll be checking application conditions and applying remedial actions until CNECs are relieved.\n", + "\n", + "To run a monitoring, we need to load the following inputs:" + ], + "id": "90a656ec77b5fff2" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.592108Z", + "start_time": "2025-09-08T15:17:53.587442Z" + } + }, + "cell_type": "code", + "source": [ + "parameters = RaoParameters()\n", + "parameters.load_from_file_source(\"./data/rao/monitoring/rao_parameters.json\")\n", + "load_flow_parameters = parameters.loadflow_and_sensitivity_parameters.sensitivity_parameters.load_flow_parameters" + ], + "id": "2602f3b7325812ca", + "outputs": [], + "execution_count": 35 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "As stated previously, first we'll run a rao and save the rao_result. This rao_result will be used to load activated remedial actions during the monitoring module.", + "id": "c8c25cdba7a37a83" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.639605Z", + "start_time": "2025-09-08T15:17:53.635551Z" + } + }, + "cell_type": "code", + "source": [ + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(network, \"./data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_RA_on_load.json\")" + ], + "id": "4e5f0e41497f9f69", + "outputs": [], + "execution_count": 36 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.704778Z", + "start_time": "2025-09-08T15:17:53.690168Z" + } + }, + "cell_type": "code", + "source": "rao_result = rao_runner.run(network, parameters)", + "id": "979b8cf1fa67a46b", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,692 - WARNING - powsybl - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:17:53,692 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:53,692 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:53,693 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:53,693 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:53,694 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:17:53,694 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,695 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:53,695 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:17:53,695 - INFO - powsybl - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:17:53,695 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,696 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,696 - INFO - powsybl - Simulate contingency 'coL1'\n", + "2025-09-08 17:17:53,697 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,697 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3689737523340897, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,697 - INFO - powsybl - Initial sensitivity analysis: cost = -5.0 (functional: -5.0, virtual: 0.0)\n", + "2025-09-08 17:17:53,698 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:53,698 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:53,698 - INFO - powsybl - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:17:53,699 - INFO - powsybl - Stop criterion reached on Root leaf, cost: -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:17:53,699 - INFO - powsybl - Limiting element #01: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:53,699 - INFO - powsybl - Scenario \"preventive\": initial cost = -49.99 (functional: -49.99, virtual: 0.0), no remedial actions activated, cost after preventive optimization = -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:17:53,699 - INFO - powsybl - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:17:53,700 - INFO - powsybl - Systematic sensitivity analysis after preventive remedial actions: cost = -5.0 (functional: -5.0, virtual: 0.0)\n", + "2025-09-08 17:17:53,700 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:53,700 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:53,700 - INFO - powsybl - ----- Post-contingency perimeters optimization [start]\n", + "2025-09-08 17:17:53,702 - INFO - powsybl - Optimizing scenario post-contingency coL1.\n", + "2025-09-08 17:17:53,702 - INFO - powsybl - Optimizing curative state coL1 - curative.\n", + "2025-09-08 17:17:53,702 - INFO - powsybl - ----- Post-contingency perimeters optimization [end]\n", + "2025-09-08 17:17:53,703 - INFO - powsybl - Merging preventive and post-contingency RAO results:\n", + "2025-09-08 17:17:53,703 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:53,703 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:53,703 - INFO - powsybl - Cost before RAO = -5.0 (functional: -5.0, virtual: 0.0), cost after RAO = -5.0 (functional: -5.0, virtual: 0.0)\n" + ] + } + ], + "execution_count": 37 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "In this case, no remedial actions were applied during the RAO, the network was already secure.\n", + "\n", + "We'll also need a GLSK file to perform redispatching to balance the network following the application of remedial actions. Angle remedial actions are indeed injection actions on generators or loads. " + ], + "id": "ec951ddcb84a44b7" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.747806Z", + "start_time": "2025-09-08T15:17:53.744698Z" + } + }, + "cell_type": "code", + "source": "rao_runner.set_glsk_file_source(network, \"./data/rao/monitoring/angle_monitoring/GlskB45test.xml\")", + "id": "a8e68de35a37a9eb", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,746 - INFO - powsybl - CIM GLSK importer could import this document.\n" + ] + } + ], + "execution_count": 38 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "Before running the angle monitoring algorithm, let's look at the angle cnec's situation in the network. As you can see in the crac, AngleCnec acCru1 is defined between exporting element VL2 and importing element VL1, at curative instant after contingency coL1 that disconnects line L1. A minimum threshold is defined at -6°. Let's look at the network after disconnecting L1:", + "id": "a5eb0941e07fc55d" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.818165Z", + "start_time": "2025-09-08T15:17:53.799051Z" + } + }, + "cell_type": "code", + "source": [ + "network.disconnect(\"L1\")\n", + "pp.loadflow.run_ac(network)\n", + "network.get_network_area_diagram()" + ], + "id": "3322416d5d560809", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,801 - INFO - powsybl - loadflow provider used is : OpenLoadFlow\n", + "2025-09-08 17:17:53,801 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:53,805 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬──────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼──────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ true │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ false │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P_MAX │\n", + "│ │ countriesToBalance │ [] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ true │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ true │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴──────────────────────────────────┘\n", + "2025-09-08 17:17:53,806 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:53,807 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:17:53,807 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,808 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Network extension bus')\n", + "2025-09-08 17:17:53,808 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:17:53,808 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,809 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3689771093529304, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,810 - INFO - powsybl - Load flow ran in 7 ms\n", + "2025-09-08 17:17:53,810 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,812 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:17:53,813 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:17:53,813 - INFO - powsybl - Elapsed time: 1.57577E-4\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -100\n \n \n \n \n \n \n \n \n \n \n \n 100\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 100\n \n \n \n \n \n \n \n \n \n \n \n -100\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 368.1 kV / -7.7°
\n
\n
\n
VL3
\n
\n 383.2 kV / -3.7°
\n
\n
\n
\n
\n" + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 39 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "AngleCnec is unsecure with an angle of -7.7 < -6°.\n", + "Now let's run the angle monitoring algorithm." + ], + "id": "61b2c799e8525e56" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.898580Z", + "start_time": "2025-09-08T15:17:53.897014Z" + } + }, + "cell_type": "code", + "source": "", + "id": "9b815cc7b92b8784", + "outputs": [], + "execution_count": null + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:53.983596Z", + "start_time": "2025-09-08T15:17:53.948438Z" + } + }, + "cell_type": "code", + "source": [ + "result_with_angle_monitoring = rao_runner.run_angle_monitoring(network, rao_result, load_flow_parameters, \"OpenLoadFlow\")\n", + "df_angle_cnecs = result_with_angle_monitoring.get_angle_cnec_results()\n", + "df_angle_cnecs[['cnec_id', 'angle', 'margin']]" + ], + "id": "3a8f9fc4911af245", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:53,949 - INFO - powsybl - ----- ANGLE monitoring [start]\n", + "2025-09-08 17:17:53,950 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'preventive' [start]\n", + "2025-09-08 17:17:53,950 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:17:53,951 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:53,955 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:17:53,956 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:53,957 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:17:53,957 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,958 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL3_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:53,958 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL3_0 (method='First slack')\n", + "2025-09-08 17:17:53,958 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,959 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3679344606782542, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,959 - INFO - powsybl - Load flow ran in 8 ms\n", + "2025-09-08 17:17:53,960 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:17:53,960 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'preventive' [end]\n", + "2025-09-08 17:17:53,960 - INFO - powsybl - All ANGLE Cnecs are secure.\n", + "2025-09-08 17:17:53,961 - INFO - powsybl - Using base network 'phaseShifter' on variant 'ContingencyScenario7e84618f-15f0-4d24-8d13-69174072e437'\n", + "2025-09-08 17:17:53,961 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'coL1 - curative' [start]\n", + "2025-09-08 17:17:53,961 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:17:53,962 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:53,965 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:17:53,965 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:53,966 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:17:53,966 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,967 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL3_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:53,967 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL3_0 (method='First slack')\n", + "2025-09-08 17:17:53,967 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,968 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3679344606782542, distributedActivePower=0.0))\n", + "2025-09-08 17:17:53,968 - INFO - powsybl - Load flow ran in 5 ms\n", + "2025-09-08 17:17:53,968 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:17:53,969 - INFO - powsybl - Applied the following remedial action(s) in order to reduce constraints on CNEC \"acCur1\": Injection L1 - 2\n", + "2025-09-08 17:17:53,969 - INFO - powsybl - Redispatching -50.0 MW in FR [start]\n", + "2025-09-08 17:17:53,970 - WARNING - powsybl - Redispatching failed: asked=-50.0 MW, applied=0.0 MW\n", + "2025-09-08 17:17:53,970 - INFO - powsybl - Redispatching -50.0 MW in FR [end]\n", + "2025-09-08 17:17:53,970 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:17:53,970 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:53,974 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:17:53,974 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:53,975 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:17:53,975 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=50.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:53,975 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL3_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:53,975 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL3_0 (method='First slack')\n", + "2025-09-08 17:17:53,976 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:53,976 - INFO - powsybl - Slack bus active power (-49.75370763087723 MW) distributed in 1 distribution iteration(s)\n", + "2025-09-08 17:17:53,976 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=1, newtonRaphsonIterations=5, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=-0.10133730290569076, distributedActivePower=-49.75370763087723))\n", + "2025-09-08 17:17:53,977 - INFO - powsybl - Load flow ran in 6 ms\n", + "2025-09-08 17:17:53,977 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:17:53,977 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'coL1 - curative' [end]\n", + "2025-09-08 17:17:53,978 - INFO - powsybl - All ANGLE Cnecs are secure.\n", + "2025-09-08 17:17:53,979 - INFO - powsybl - ----- ANGLE monitoring [end]\n", + "2025-09-08 17:17:53,979 - INFO - powsybl - All ANGLE Cnecs are secure.\n" + ] + }, + { + "data": { + "text/plain": [ + " cnec_id angle margin\n", + "index \n", + "2 acCur1 -3.783208 2.216792" + ], + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cnec_idanglemargin
index
2acCur1-3.7832082.216792
\n", + "
" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 40 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:54.211517Z", + "start_time": "2025-09-08T15:17:54.210404Z" + } + }, + "cell_type": "code", + "source": "", + "id": "a2e560a9e9c3f68c", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "During the monitoring algorithm, a network action was applied, setting load LD2's value to 50 MW. The monitoring algorithm tried to perform the opposite redispatching action to maintain network balance, but scaling failed in our case, most likely because the network is so small. Balance was achieved during load flow computation via slack redistribution. \n", + "Applied network action made AngleCnec acCur1 secure, by shifting its' angle from -7.7° to -3.8°.\n", + "\n", + "Only load actions and generator actions can be used to relieve angle cnecs. In the following example, a topological action is defined (open L3) but it isn't even considered to relieve AngleCnec acCur1." + ], + "id": "308c5164b6845ca6" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:17:54.306012Z", + "start_time": "2025-09-08T15:17:54.257829Z" + } + }, + "cell_type": "code", + "source": [ + "network_2 = pp.network.load(\"./data/rao/monitoring/network.xiidm\")\n", + "rao_runner_2 = pp.rao.create_rao()\n", + "rao_runner_2.set_crac_file_source(network_2, \"./data/rao/monitoring/angle_monitoring/angle_monitoring_simple_case_with_topo.json\")\n", + "rao_result_2 = rao_runner_2.run(network_2, parameters)\n", + "print(rao_result_2.to_json())\n", + "rao_runner_2.set_glsk_file_source(network_2, \"./data/rao/monitoring/angle_monitoring/GlskB45test.xml\")\n", + "result_with_angle_monitoring_2 = rao_runner_2.run_angle_monitoring(network_2, rao_result_2, load_flow_parameters, \"OpenLoadFlow\")\n", + "df_angle_cnecs_2 = result_with_angle_monitoring_2.get_angle_cnec_results()\n", + "df_angle_cnecs_2[['cnec_id', 'angle', 'margin']]" + ], + "id": "8e949fbb5189ecce", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:17:54,262 - WARNING - powsybl - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:17:54,263 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:54,263 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:54,263 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:54,264 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:17:54,265 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:17:54,265 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:54,266 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:54,266 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:17:54,267 - INFO - powsybl - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:17:54,267 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:54,268 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:17:54,268 - INFO - powsybl - Simulate contingency 'coL1'\n", + "2025-09-08 17:17:54,268 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:54,269 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3689737523340897, distributedActivePower=0.0))\n", + "2025-09-08 17:17:54,269 - INFO - powsybl - Initial sensitivity analysis: cost = -5.0 (functional: -5.0, virtual: 0.0)\n", + "2025-09-08 17:17:54,270 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:54,270 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:54,270 - INFO - powsybl - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:17:54,270 - INFO - powsybl - Stop criterion reached on Root leaf, cost: -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:17:54,271 - INFO - powsybl - Limiting element #01: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:54,271 - INFO - powsybl - Scenario \"preventive\": initial cost = -49.99 (functional: -49.99, virtual: 0.0), no remedial actions activated, cost after preventive optimization = -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:17:54,271 - INFO - powsybl - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:17:54,272 - INFO - powsybl - Systematic sensitivity analysis after preventive remedial actions: cost = -5.0 (functional: -5.0, virtual: 0.0)\n", + "2025-09-08 17:17:54,272 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:54,272 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:54,272 - INFO - powsybl - ----- Post-contingency perimeters optimization [start]\n", + "2025-09-08 17:17:54,274 - INFO - powsybl - Optimizing scenario post-contingency coL1.\n", + "2025-09-08 17:17:54,274 - INFO - powsybl - Optimizing curative state coL1 - curative.\n", + "2025-09-08 17:17:54,275 - INFO - powsybl - ----- Post-contingency perimeters optimization [end]\n", + "2025-09-08 17:17:54,275 - INFO - powsybl - Merging preventive and post-contingency RAO results:\n", + "2025-09-08 17:17:54,276 - INFO - powsybl - Limiting element #01: margin = 5.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:17:54,276 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:17:54,276 - INFO - powsybl - Cost before RAO = -5.0 (functional: -5.0, virtual: 0.0), cost after RAO = -5.0 (functional: -5.0, virtual: 0.0)\n", + "2025-09-08 17:17:54,279 - INFO - powsybl - CIM GLSK importer could import this document.\n", + "2025-09-08 17:17:54,279 - INFO - powsybl - ----- ANGLE monitoring [start]\n", + "2025-09-08 17:17:54,280 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'preventive' [start]\n", + "2025-09-08 17:17:54,280 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:17:54,280 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:54,283 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:17:54,284 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:54,284 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:17:54,285 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:54,285 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:54,285 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:17:54,286 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:54,286 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:17:54,287 - INFO - powsybl - Load flow ran in 6 ms\n", + "2025-09-08 17:17:54,287 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:17:54,287 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'preventive' [end]\n", + "2025-09-08 17:17:54,288 - INFO - powsybl - All ANGLE Cnecs are secure.\n", + "2025-09-08 17:17:54,288 - INFO - powsybl - Using base network 'phaseShifter' on variant 'ContingencyScenario44b91257-0c83-4a98-9c19-b54a35bb2358'\n", + "2025-09-08 17:17:54,288 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'coL1 - curative' [start]\n", + "2025-09-08 17:17:54,289 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:17:54,289 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:17:54,292 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:17:54,293 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:17:54,293 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:17:54,294 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:17:54,294 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL3_0] (method='Most meshed bus')\n", + "2025-09-08 17:17:54,294 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL3_0 (method='First slack')\n", + "2025-09-08 17:17:54,295 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:17:54,295 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3679344606782542, distributedActivePower=0.0))\n", + "2025-09-08 17:17:54,295 - INFO - powsybl - Load flow ran in 5 ms\n", + "2025-09-08 17:17:54,296 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:17:54,296 - WARNING - powsybl - Remedial action Open L1 - 2 of AngleCnec acCur1 is ignored : it has an elementary action that's not an injection setpoint.\n", + "2025-09-08 17:17:54,297 - INFO - powsybl - Applied the following remedial action(s) in order to reduce constraints on CNEC \"acCur1\": \n", + "2025-09-08 17:17:54,298 - INFO - powsybl - -- 'ANGLE' Monitoring at state 'coL1 - curative' [end]\n", + "2025-09-08 17:17:54,298 - INFO - powsybl - Some ANGLE Cnecs are not secure:\n", + "2025-09-08 17:17:54,298 - INFO - powsybl - AngleCnec acCur1 (with importing network element VL1 and exporting network element VL2) at state coL1 - curative has an angle of -7.71°.\n", + "2025-09-08 17:17:54,299 - INFO - powsybl - ----- ANGLE monitoring [end]\n", + "2025-09-08 17:17:54,299 - INFO - powsybl - Some ANGLE Cnecs are not secure:\n", + "2025-09-08 17:17:54,300 - INFO - powsybl - AngleCnec acCur1 (with importing network element VL1 and exporting network element VL2) at state coL1 - curative has an angle of -7.71°.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'type': 'RAO_RESULT', 'version': '1.8', 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao', 'computationStatus': 'default', 'executionDetails': 'The RAO only went through first preventive', 'costResults': {'initial': {'functionalCost': -5.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'preventive': {'functionalCost': -5.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'outage': {'functionalCost': -5.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'auto': {'functionalCost': -5.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'curative': {'functionalCost': -5.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}}, 'computationStatusMap': [], 'flowCnecResults': [{'flowCnecId': 'cnec1 - curative', 'initial': {'megawatt': {'margin': 5.0, 'side2': {'flow': 0.0}}}, 'preventive': {'megawatt': {'margin': 5.0, 'side2': {'flow': 0.0}}}, 'auto': {'megawatt': {'margin': 5.0, 'side2': {'flow': 0.0}}}, 'curative': {'megawatt': {'margin': 5.0, 'side2': {'flow': 0.0}}}}, {'flowCnecId': 'cnec1 - preventive', 'initial': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 83.68}}, 'megawatt': {'margin': 49.99, 'side2': {'flow': 50.01}}}, 'preventive': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 83.68}}, 'megawatt': {'margin': 49.99, 'side2': {'flow': 50.01}}}}], 'angleCnecResults': [], 'voltageCnecResults': [], 'networkActionResults': [], 'rangeActionResults': []}\n" + ] + }, + { + "data": { + "text/plain": [ + " cnec_id angle margin\n", + "index \n", + "3 acCur1 -7.713852 -4.713852" + ], + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cnec_idanglemargin
index
3acCur1-7.713852-4.713852
\n", + "
" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 41 + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/open_rao_voltage_monitoring.ipynb b/open_rao_voltage_monitoring.ipynb new file mode 100644 index 0000000..64de741 --- /dev/null +++ b/open_rao_voltage_monitoring.ipynb @@ -0,0 +1,1241 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2fdb50ba", + "metadata": {}, + "source": "# OpenRAO Voltage Monitoring in pyPowsybl" + }, + { + "cell_type": "markdown", + "id": "efa399e1", + "metadata": {}, + "source": [ + "In this notebook, we'll explore how OpenRao monitoring algorithms work. \n", + "For network situations with angle or voltage overloads, the monitoring module will try to relieve these constraints by applying remedial actions. \n", + "\n", + "The first step is to install pypowsybl and import the library." + ] + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.408443Z", + "start_time": "2025-09-08T15:18:04.406131Z" + } + }, + "cell_type": "code", + "source": "#pip install pypowsybl==1.12.0", + "id": "6657842d8b2d9845", + "outputs": [], + "execution_count": 11 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.459151Z", + "start_time": "2025-09-08T15:18:04.455009Z" + } + }, + "cell_type": "code", + "source": [ + "import pypowsybl as pp\n", + "from pypowsybl.rao import Parameters as RaoParameters" + ], + "id": "4ad9bbcf2f4f85bf", + "outputs": [], + "execution_count": 12 + }, + { + "cell_type": "code", + "id": "initial_id", + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.512054Z", + "start_time": "2025-09-08T15:18:04.507016Z" + } + }, + "source": [ + "# set up logging\n", + "import logging\n", + "logging.getLogger('powsybl').setLevel(logging.DEBUG)\n", + "logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')" + ], + "outputs": [], + "execution_count": 13 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "Let's load a simple 3 node network.\n", + "- VL1 voltage level contains a generator producing 100 MW.\n", + "- VL2 voltage level contains a load consuming 100 MW.\n", + "- VL1 and VL3 are connected by a PST.\n", + "- VL2 and VL3 are connected by 2 lines, one of with has infinite resistance : that's why it has no power flowing through it." + ], + "id": "eda73ac35599f2e5" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.575209Z", + "start_time": "2025-09-08T15:18:04.562867Z" + } + }, + "cell_type": "code", + "source": [ + "network = pp.network.load(\"data/rao/monitoring/network.xiidm\")\n", + "network.get_network_area_diagram()" + ], + "id": "d923fa57b4d80171", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:04,564 - DEBUG - powsybl - XIIDM import done in 0 ms\n", + "2025-09-08 17:18:04,565 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:04,566 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:04,566 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:04,566 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:04,567 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:04,567 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:04,567 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:04,567 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:04,568 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:04,568 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:04,569 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:04,569 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:04,569 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:04,569 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:04,570 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:04,570 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:04,570 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:18:04,570 - INFO - powsybl - Elapsed time: 6.5015E-5\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 385.7 kV / -3.7°
\n
\n
\n
VL3
\n
\n 392.6 kV / -1.8°
\n
\n
\n
\n
\n" + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 14 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "Now, let's run a loadflow on this network. We'll then be able to assess which lines are overloaded.", + "id": "ce005f42855370fb" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.614861Z", + "start_time": "2025-09-08T15:18:04.590603Z" + } + }, + "cell_type": "code", + "source": [ + "pp.loadflow.run_ac(network)\n", + "network.get_network_area_diagram()" + ], + "id": "e37a9b29dce42548", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:04,591 - INFO - powsybl - loadflow provider used is : OpenLoadFlow\n", + "2025-09-08 17:18:04,592 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:18:04,595 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬──────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼──────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ true │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ false │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P_MAX │\n", + "│ │ countriesToBalance │ [] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ true │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ true │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴──────────────────────────────────┘\n", + "2025-09-08 17:18:04,596 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:18:04,596 - DEBUG - powsybl - Connected components computed in 0 ms\n", + "2025-09-08 17:18:04,597 - DEBUG - powsybl - Synchronous components computed in 0 ms\n", + "2025-09-08 17:18:04,597 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:04,597 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:18:04,598 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:04,598 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:04,598 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:18:04,599 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:04,599 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:04,599 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:04,600 - DEBUG - powsybl - Equation vector updated in 3 us\n", + "2025-09-08 17:18:04,600 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:04,600 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:04,600 - DEBUG - powsybl - Jacobian matrix built in 7 us\n", + "2025-09-08 17:18:04,601 - DEBUG - powsybl - Sparse LU decomposition done in 23 us\n", + "2025-09-08 17:18:04,601 - DEBUG - powsybl - LU decomposition done in 273 us\n", + "2025-09-08 17:18:04,601 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,602 - DEBUG - powsybl - |f(x)|=0.06774610629906617\n", + "2025-09-08 17:18:04,602 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:04,602 - DEBUG - powsybl - Jacobian matrix values updated in 9 us\n", + "2025-09-08 17:18:04,603 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019395586280388767, threshold is 1.0E-10) in 7 us\n", + "2025-09-08 17:18:04,603 - DEBUG - powsybl - LU decomposition updated in 350 us\n", + "2025-09-08 17:18:04,603 - DEBUG - powsybl - Equation vector updated in 3 us\n", + "2025-09-08 17:18:04,603 - DEBUG - powsybl - |f(x)|=2.0052326218707072E-4\n", + "2025-09-08 17:18:04,604 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:04,604 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:18:04,605 - DEBUG - powsybl - Network {CC0 SC0}, IIDM network updated in 0 ms\n", + "2025-09-08 17:18:04,605 - INFO - powsybl - Load flow ran in 12 ms\n", + "2025-09-08 17:18:04,606 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:04,606 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:04,607 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:04,607 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:04,607 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:04,607 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:04,607 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:04,608 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:04,608 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:04,608 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:04,609 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:04,609 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:04,609 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:04,609 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:04,609 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:04,610 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:04,610 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:18:04,610 - INFO - powsybl - Elapsed time: 4.6339E-5\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 50\n \n \n \n \n \n \n \n \n \n \n \n -50\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 385.7 kV / -3.7°
\n
\n
\n
VL3
\n
\n 392.6 kV / -1.8°
\n
\n
\n
\n
\n" + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 15 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "The monitoring algorithm is run after a RAO has been run, on a network on which are applied the remedial actions optimized during the RAO to optimize flow CNECs. \n", + "To relieve Angle/Voltage CNECs, we won't be optimizing remedial actions because modelling the impact of remedial actions on angle/voltage values is highly complex and non linear. Instead, we'll be checking application conditions and applying remedial actions until CNECs are relieved.\n", + "\n", + "To run a monitoring, we need to load the following inputs:" + ], + "id": "90a656ec77b5fff2" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.668677Z", + "start_time": "2025-09-08T15:18:04.664019Z" + } + }, + "cell_type": "code", + "source": [ + "parameters = RaoParameters()\n", + "parameters.load_from_file_source(\"./data/rao/rao_parameters.json\")\n", + "load_flow_parameters = parameters.loadflow_and_sensitivity_parameters.sensitivity_parameters.load_flow_parameters" + ], + "id": "2602f3b7325812ca", + "outputs": [], + "execution_count": 16 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "As stated previously, first we'll run a rao and save the rao_result. This rao_result will be used to load activated remedial actions during the monitoring module.", + "id": "c8c25cdba7a37a83" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.715348Z", + "start_time": "2025-09-08T15:18:04.711640Z" + } + }, + "cell_type": "code", + "source": [ + "rao_runner = pp.rao.create_rao()\n", + "rao_runner.set_crac_file_source(network, \"./data/rao/monitoring/voltage_monitoring/voltage_monitoring_simple_case_with_RA_on_load.json\")" + ], + "id": "4e5f0e41497f9f69", + "outputs": [], + "execution_count": 17 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:04.801655Z", + "start_time": "2025-09-08T15:18:04.760810Z" + } + }, + "cell_type": "code", + "source": "rao_result = rao_runner.run(network, parameters)", + "id": "979b8cf1fa67a46b", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:04,762 - WARNING - powsybl - Running RAO using Open RAO version 6.7.0-SNAPSHOT from git commit ea80e63634c4ff2038696d4ca76f99ed861d1263.\n", + "2025-09-08 17:18:04,762 - WARNING - powsybl - Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.\n", + "2025-09-08 17:18:04,763 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:04,763 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:04,763 - WARNING - powsybl - A threshold for the flowCnec cnec1 - preventive is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:04,764 - WARNING - powsybl - A threshold for the flowCnec cnec1 - curative is defined in MW but the loadflow computation is in AC. It will be imprecisely converted by the RAO which could create uncoherent results due to side effects\n", + "2025-09-08 17:18:04,764 - DEBUG - powsybl - Systematic sensitivity analysis [start]\n", + "2025-09-08 17:18:04,765 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:04,765 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 4 branches\n", + "2025-09-08 17:18:04,765 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:04,766 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:04,766 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:18:04,766 - INFO - powsybl - Running AC sensitivity analysis with 4 factors and 1 contingencies\n", + "2025-09-08 17:18:04,766 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:04,767 - DEBUG - powsybl - Equations index updated (7 columns)\n", + "2025-09-08 17:18:04,767 - DEBUG - powsybl - Variables index updated (7 rows)\n", + "2025-09-08 17:18:04,767 - DEBUG - powsybl - Equation vector updated in 6 us\n", + "2025-09-08 17:18:04,768 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:04,768 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:04,768 - DEBUG - powsybl - Jacobian matrix built in 9 us\n", + "2025-09-08 17:18:04,769 - DEBUG - powsybl - Sparse LU decomposition done in 24 us\n", + "2025-09-08 17:18:04,769 - DEBUG - powsybl - LU decomposition done in 775 us\n", + "2025-09-08 17:18:04,770 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,770 - DEBUG - powsybl - |f(x)|=0.06774610629906617\n", + "2025-09-08 17:18:04,770 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:04,770 - DEBUG - powsybl - Jacobian matrix values updated in 5 us\n", + "2025-09-08 17:18:04,771 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019395586280388767, threshold is 1.0E-10) in 5 us\n", + "2025-09-08 17:18:04,771 - DEBUG - powsybl - LU decomposition updated in 670 us\n", + "2025-09-08 17:18:04,772 - DEBUG - powsybl - Equation vector updated in 3 us\n", + "2025-09-08 17:18:04,772 - DEBUG - powsybl - |f(x)|=2.0052326218707072E-4\n", + "2025-09-08 17:18:04,773 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:04,773 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=2, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.17787785586249605, distributedActivePower=0.0))\n", + "2025-09-08 17:18:04,774 - DEBUG - powsybl - Jacobian matrix values updated in 9 us\n", + "2025-09-08 17:18:04,774 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019992185618309375, threshold is 1.0E-10) in 18 us\n", + "2025-09-08 17:18:04,774 - DEBUG - powsybl - LU decomposition updated in 367 us\n", + "2025-09-08 17:18:04,775 - INFO - powsybl - Simulate contingency 'coL1'\n", + "2025-09-08 17:18:04,775 - DEBUG - powsybl - Contingency 'coL1' without loss of connectivity\n", + "2025-09-08 17:18:04,775 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:04,776 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:04,776 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:04,776 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,777 - DEBUG - powsybl - |f(x0)|=0.5691286538358685\n", + "2025-09-08 17:18:04,777 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:04,777 - DEBUG - powsybl - Jacobian matrix built in 8 us\n", + "2025-09-08 17:18:04,778 - DEBUG - powsybl - Sparse LU decomposition done in 16 us\n", + "2025-09-08 17:18:04,778 - DEBUG - powsybl - LU decomposition done in 354 us\n", + "2025-09-08 17:18:04,778 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,779 - DEBUG - powsybl - |f(x)|=0.05597916961358258\n", + "2025-09-08 17:18:04,779 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:04,779 - DEBUG - powsybl - Jacobian matrix values updated in 5 us\n", + "2025-09-08 17:18:04,780 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.022981714360819472, threshold is 1.0E-10) in 5 us\n", + "2025-09-08 17:18:04,780 - DEBUG - powsybl - LU decomposition updated in 315 us\n", + "2025-09-08 17:18:04,780 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,781 - DEBUG - powsybl - |f(x)|=9.088382225742943E-4\n", + "2025-09-08 17:18:04,781 - DEBUG - powsybl - Start iteration 2\n", + "2025-09-08 17:18:04,781 - DEBUG - powsybl - Jacobian matrix values updated in 6 us\n", + "2025-09-08 17:18:04,781 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.020041432758458495, threshold is 1.0E-10) in 5 us\n", + "2025-09-08 17:18:04,782 - DEBUG - powsybl - LU decomposition updated in 308 us\n", + "2025-09-08 17:18:04,782 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:04,783 - DEBUG - powsybl - |f(x)|=1.9847708852864974E-7\n", + "2025-09-08 17:18:04,783 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:04,783 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3689675321228103, distributedActivePower=0.0))\n", + "2025-09-08 17:18:04,784 - DEBUG - powsybl - Jacobian matrix values updated in 5 us\n", + "2025-09-08 17:18:04,784 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991681598489332, threshold is 1.0E-10) in 4 us\n", + "2025-09-08 17:18:04,784 - DEBUG - powsybl - LU decomposition updated in 335 us\n", + "2025-09-08 17:18:04,785 - DEBUG - powsybl - Systematic sensitivity analysis [end]\n", + "2025-09-08 17:18:04,785 - INFO - powsybl - Initial sensitivity analysis: cost = 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,785 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,785 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:18:04,785 - INFO - powsybl - ----- Preventive perimeter optimization [start]\n", + "2025-09-08 17:18:04,786 - DEBUG - powsybl - Creating variants [InitialScenario]\n", + "2025-09-08 17:18:04,786 - DEBUG - powsybl - Creating variants [PreventiveScenario]\n", + "2025-09-08 17:18:04,786 - DEBUG - powsybl - Creating variants [SecondPreventiveScenario]\n", + "2025-09-08 17:18:04,786 - DEBUG - powsybl - Creating variants [SearchTreeWorkingVariantId]\n", + "2025-09-08 17:18:04,787 - DEBUG - powsybl - Evaluating root leaf\n", + "2025-09-08 17:18:04,787 - DEBUG - powsybl - Leaf has already been evaluated\n", + "2025-09-08 17:18:04,787 - INFO - powsybl - Stop criterion reached on Root leaf, cost: -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:18:04,787 - INFO - powsybl - Limiting element #01: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:18:04,787 - INFO - powsybl - Scenario \"preventive\": initial cost = -49.99 (functional: -49.99, virtual: 0.0), no remedial actions activated, cost after preventive optimization = -49.99 (functional: -49.99, virtual: 0.0)\n", + "2025-09-08 17:18:04,787 - INFO - powsybl - ----- Preventive perimeter optimization [end]\n", + "2025-09-08 17:18:04,788 - DEBUG - powsybl - Creating variants [PreventiveScenario]\n", + "2025-09-08 17:18:04,788 - INFO - powsybl - Systematic sensitivity analysis after preventive remedial actions: cost = 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,788 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,788 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:18:04,788 - INFO - powsybl - ----- Post-contingency perimeters optimization [start]\n", + "2025-09-08 17:18:04,789 - DEBUG - powsybl - Creating variants [ContingencyScenario7ce8bd6a-8322-487c-bf2f-7a043acdb02c]\n", + "2025-09-08 17:18:04,789 - DEBUG - powsybl - Filling network pool with 4 new copies of network phaseShifter on variant ContingencyScenario7ce8bd6a-8322-487c-bf2f-7a043acdb02c\n", + "2025-09-08 17:18:04,789 - DEBUG - powsybl - Copy n°1\n", + "2025-09-08 17:18:04,790 - DEBUG - powsybl - Copy n°2\n", + "2025-09-08 17:18:04,790 - DEBUG - powsybl - Copy n°3\n", + "2025-09-08 17:18:04,791 - DEBUG - powsybl - Copy n°4\n", + "2025-09-08 17:18:04,791 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool state save 6e893c41-60da-4645-8869-f046202555cd, OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d]\n", + "2025-09-08 17:18:04,791 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool state save 6e893c41-60da-4645-8869-f046202555cd, OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d]\n", + "2025-09-08 17:18:04,792 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool state save 6e893c41-60da-4645-8869-f046202555cd, OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d]\n", + "2025-09-08 17:18:04,792 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool state save 6e893c41-60da-4645-8869-f046202555cd, OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d]\n", + "2025-09-08 17:18:04,792 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d]\n", + "2025-09-08 17:18:04,793 - INFO - powsybl - Optimizing scenario post-contingency coL1.\n", + "2025-09-08 17:18:04,793 - INFO - powsybl - Optimizing curative state coL1 - curative.\n", + "2025-09-08 17:18:04,793 - DEBUG - powsybl - Creating variants [SearchTreeWorkingVariantId]\n", + "2025-09-08 17:18:04,794 - DEBUG - powsybl - Evaluating root leaf\n", + "2025-09-08 17:18:04,794 - DEBUG - powsybl - Leaf has already been evaluated\n", + "2025-09-08 17:18:04,794 - INFO - powsybl - Root leaf, cost: 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,795 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,795 - INFO - powsybl - Linear optimization on root leaf\n", + "2025-09-08 17:18:04,795 - INFO - powsybl - No range actions to optimize\n", + "2025-09-08 17:18:04,795 - INFO - powsybl - Root leaf, cost: 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,796 - INFO - powsybl - No range actions activated\n", + "2025-09-08 17:18:04,796 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,796 - INFO - powsybl - No network action available\n", + "2025-09-08 17:18:04,796 - INFO - powsybl - Search-tree RAO completed with status DEFAULT\n", + "2025-09-08 17:18:04,797 - INFO - powsybl - Best leaf: Root leaf, cost: 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,797 - INFO - powsybl - Best leaf: No range actions activated\n", + "2025-09-08 17:18:04,797 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,797 - INFO - powsybl - Scenario \"coL1\": initial cost = 95.0 (functional: 95.0, virtual: 0.0), no remedial actions activated, cost after curative optimization = 95.0 (functional: 95.0, virtual: 0.0)\n", + "2025-09-08 17:18:04,798 - INFO - powsybl - Curative state coL1 - curative has been optimized.\n", + "2025-09-08 17:18:04,798 - DEBUG - powsybl - Remaining post-contingency scenarios to optimize: 0\n", + "2025-09-08 17:18:04,798 - DEBUG - powsybl - Removing variant 'OpenRaoNetworkPool working variant c8c8955a-0e2f-476a-8c49-b444febd0f1d'\n", + "2025-09-08 17:18:04,799 - DEBUG - powsybl - Removing variant 'SearchTreeWorkingVariantId'\n", + "2025-09-08 17:18:04,799 - INFO - powsybl - ----- Post-contingency perimeters optimization [end]\n", + "2025-09-08 17:18:04,799 - INFO - powsybl - Merging preventive and post-contingency RAO results:\n", + "2025-09-08 17:18:04,799 - INFO - powsybl - Limiting element #01: margin = -95.0 MW, element L1 at state coL1 - curative, CNEC ID = \"cnec1 - curative\"\n", + "2025-09-08 17:18:04,800 - INFO - powsybl - Limiting element #02: margin = 49.99 MW, element L1 at state preventive, CNEC ID = \"cnec1 - preventive\"\n", + "2025-09-08 17:18:04,800 - INFO - powsybl - Cost before RAO = 95.0 (functional: 95.0, virtual: 0.0), cost after RAO = 95.0 (functional: 95.0, virtual: 0.0)\n" + ] + } + ], + "execution_count": 18 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "In this case, no remedial actions were applied during the RAO, the network was already secure.\n", + "\n" + ], + "id": "ec951ddcb84a44b7" + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "Before running the angle monitoring algorithm, let's look at the voltage cnec's situation in the network. As you can see in the crac, VoltageCnec vc is defined on VL2, at curative instant after contingency coL1 that disconnects PST PS1. A minimum threshold is defined at 340 kV, a maximum threshold at 350 kV. Let's look at the network after disconnecting PS1:", + "id": "a5eb0941e07fc55d" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:05.094268Z", + "start_time": "2025-09-08T15:18:05.068320Z" + } + }, + "cell_type": "code", + "source": [ + "network.disconnect(\"PS1\")\n", + "pp.loadflow.run_ac(network)\n", + "network.get_network_area_diagram()" + ], + "id": "3322416d5d560809", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:05,069 - INFO - powsybl - loadflow provider used is : OpenLoadFlow\n", + "2025-09-08 17:18:05,070 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:18:05,072 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬──────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼──────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ true │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ false │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P_MAX │\n", + "│ │ countriesToBalance │ [] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ true │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ true │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴──────────────────────────────────┘\n", + "2025-09-08 17:18:05,073 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:18:05,073 - DEBUG - powsybl - Connected components computed in 0 ms\n", + "2025-09-08 17:18:05,073 - DEBUG - powsybl - Synchronous components computed in 0 ms\n", + "2025-09-08 17:18:05,074 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:05,074 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:18:05,075 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:05,075 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL1_0] (method='Network extension bus')\n", + "2025-09-08 17:18:05,075 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL1_0 (method='First slack')\n", + "2025-09-08 17:18:05,076 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:05,076 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:05,076 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:05,077 - DEBUG - powsybl - Equation vector updated in 3 us\n", + "2025-09-08 17:18:05,077 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:05,077 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:05,077 - DEBUG - powsybl - Jacobian matrix built in 11 us\n", + "2025-09-08 17:18:05,078 - DEBUG - powsybl - Sparse LU decomposition done in 21 us\n", + "2025-09-08 17:18:05,078 - DEBUG - powsybl - LU decomposition done in 345 us\n", + "2025-09-08 17:18:05,078 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,079 - DEBUG - powsybl - |f(x)|=0.08500683913618383\n", + "2025-09-08 17:18:05,079 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:05,079 - DEBUG - powsybl - Jacobian matrix values updated in 6 us\n", + "2025-09-08 17:18:05,080 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668633, threshold is 1.0E-10) in 5 us\n", + "2025-09-08 17:18:05,080 - DEBUG - powsybl - LU decomposition updated in 302 us\n", + "2025-09-08 17:18:05,080 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,080 - DEBUG - powsybl - |f(x)|=0.0010560775453428916\n", + "2025-09-08 17:18:05,081 - DEBUG - powsybl - Start iteration 2\n", + "2025-09-08 17:18:05,081 - DEBUG - powsybl - Jacobian matrix values updated in 4 us\n", + "2025-09-08 17:18:05,081 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.01999167090866865, threshold is 1.0E-10) in 4 us\n", + "2025-09-08 17:18:05,082 - DEBUG - powsybl - LU decomposition updated in 290 us\n", + "2025-09-08 17:18:05,082 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,082 - DEBUG - powsybl - |f(x)|=1.857490290874069E-7\n", + "2025-09-08 17:18:05,082 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:05,083 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3689711101421578, distributedActivePower=0.0))\n", + "2025-09-08 17:18:05,083 - DEBUG - powsybl - Network {CC0 SC0}, IIDM network updated in 0 ms\n", + "2025-09-08 17:18:05,084 - INFO - powsybl - Load flow ran in 13 ms\n", + "2025-09-08 17:18:05,084 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:05,085 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:05,085 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:05,086 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:05,086 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:05,086 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:05,086 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:05,086 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:05,087 - INFO - powsybl - Loading component library from /DefaultLibrary...\n", + "2025-09-08 17:18:05,087 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/load.svg\n", + "2025-09-08 17:18:05,087 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/battery.svg\n", + "2025-09-08 17:18:05,088 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/generator.svg\n", + "2025-09-08 17:18:05,088 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/capacitor.svg\n", + "2025-09-08 17:18:05,088 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/inductor.svg\n", + "2025-09-08 17:18:05,088 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/svc.svg\n", + "2025-09-08 17:18:05,088 - DEBUG - powsybl - Reading subComponent /DefaultLibrary/unknown-component.svg\n", + "2025-09-08 17:18:05,089 - INFO - powsybl - Number of steps: 139\n", + "2025-09-08 17:18:05,089 - INFO - powsybl - Elapsed time: 5.3314E-5\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 100\n \n \n \n \n \n \n \n \n \n \n \n -100\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n -0\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
VL1
\n
\n 400.0 kV / 0.0°
\n
\n
\n
VL2
\n
\n 368.1 kV / -7.7°
\n
\n
\n
VL3
\n
\n 368.1 kV / -7.7°
\n
\n
\n
\n
\n" + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "execution_count": 19 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "VoltageCnec vc is unsecure with a voltage of 368 kV > 350 kV.\n", + "Now let's run the voltage monitoring algorithm." + ], + "id": "61b2c799e8525e56" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:05.141339Z", + "start_time": "2025-09-08T15:18:05.139737Z" + } + }, + "cell_type": "code", + "source": "", + "id": "9b815cc7b92b8784", + "outputs": [], + "execution_count": null + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-08T15:18:05.253649Z", + "start_time": "2025-09-08T15:18:05.194076Z" + } + }, + "cell_type": "code", + "source": [ + "result_with_voltage_monitoring = rao_runner.run_voltage_monitoring(network, rao_result, load_flow_parameters, \"OpenLoadFlow\")\n", + "df_voltage_cnecs = result_with_voltage_monitoring.get_voltage_cnec_results()\n", + "print(df_voltage_cnecs[['cnec_id', 'min_voltage', 'max_voltage', 'margin']])\n", + "print(result_with_voltage_monitoring.to_json())" + ], + "id": "3a8f9fc4911af245", + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-09-08 17:18:05,195 - INFO - powsybl - ----- VOLTAGE monitoring [start]\n", + "2025-09-08 17:18:05,196 - INFO - powsybl - -- 'VOLTAGE' Monitoring at state 'preventive' [start]\n", + "2025-09-08 17:18:05,196 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:18:05,196 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:18:05,199 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:18:05,200 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:18:05,200 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:05,200 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:18:05,201 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:05,201 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL2_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:05,201 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL2_0 (method='First slack')\n", + "2025-09-08 17:18:05,202 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:05,202 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:05,202 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:05,203 - DEBUG - powsybl - Equation vector updated in 5 us\n", + "2025-09-08 17:18:05,203 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:05,203 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:05,203 - DEBUG - powsybl - Jacobian matrix built in 7 us\n", + "2025-09-08 17:18:05,204 - DEBUG - powsybl - Sparse LU decomposition done in 20 us\n", + "2025-09-08 17:18:05,204 - DEBUG - powsybl - LU decomposition done in 326 us\n", + "2025-09-08 17:18:05,204 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,205 - DEBUG - powsybl - |f(x)|=0.08620220271786033\n", + "2025-09-08 17:18:05,205 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:05,205 - DEBUG - powsybl - Jacobian matrix values updated in 3 us\n", + "2025-09-08 17:18:05,206 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 4 us\n", + "2025-09-08 17:18:05,206 - DEBUG - powsybl - LU decomposition updated in 442 us\n", + "2025-09-08 17:18:05,206 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,207 - DEBUG - powsybl - |f(x)|=0.0010693405956603969\n", + "2025-09-08 17:18:05,207 - DEBUG - powsybl - Start iteration 2\n", + "2025-09-08 17:18:05,207 - DEBUG - powsybl - Jacobian matrix values updated in 3 us\n", + "2025-09-08 17:18:05,208 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 13 us\n", + "2025-09-08 17:18:05,208 - DEBUG - powsybl - LU decomposition updated in 515 us\n", + "2025-09-08 17:18:05,208 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,209 - DEBUG - powsybl - |f(x)|=1.8534582905074213E-7\n", + "2025-09-08 17:18:05,209 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:05,209 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3667399372342284, distributedActivePower=0.0))\n", + "2025-09-08 17:18:05,210 - DEBUG - powsybl - Network {CC0 SC0}, IIDM network updated in 0 ms\n", + "2025-09-08 17:18:05,210 - INFO - powsybl - Load flow ran in 13 ms\n", + "2025-09-08 17:18:05,210 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:18:05,210 - INFO - powsybl - -- 'VOLTAGE' Monitoring at state 'preventive' [end]\n", + "2025-09-08 17:18:05,211 - INFO - powsybl - All VOLTAGE Cnecs are secure.\n", + "2025-09-08 17:18:05,211 - INFO - powsybl - Using base network 'phaseShifter' on variant 'ContingencyScenario7ce8bd6a-8322-487c-bf2f-7a043acdb02c'\n", + "2025-09-08 17:18:05,211 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool state save 4943a583-7343-46f4-8659-47e13ee94acd, OpenRaoNetworkPool working variant 0c487c13-f3fe-454c-a397-121f4792d9a2]\n", + "2025-09-08 17:18:05,211 - DEBUG - powsybl - Creating variants [OpenRaoNetworkPool working variant 0c487c13-f3fe-454c-a397-121f4792d9a2]\n", + "2025-09-08 17:18:05,212 - INFO - powsybl - -- 'VOLTAGE' Monitoring at state 'coL1 - curative' [start]\n", + "2025-09-08 17:18:05,212 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:18:05,212 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:18:05,216 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:18:05,216 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:18:05,217 - DEBUG - powsybl - Connected components computed in 0 ms\n", + "2025-09-08 17:18:05,217 - DEBUG - powsybl - Synchronous components computed in 0 ms\n", + "2025-09-08 17:18:05,217 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:05,218 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:18:05,218 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=100.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:05,218 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL2_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:05,219 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL2_0 (method='First slack')\n", + "2025-09-08 17:18:05,219 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:05,219 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:05,219 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:05,220 - DEBUG - powsybl - Equation vector updated in 3 us\n", + "2025-09-08 17:18:05,220 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:05,220 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:05,221 - DEBUG - powsybl - Jacobian matrix built in 7 us\n", + "2025-09-08 17:18:05,221 - DEBUG - powsybl - Sparse LU decomposition done in 19 us\n", + "2025-09-08 17:18:05,221 - DEBUG - powsybl - LU decomposition done in 252 us\n", + "2025-09-08 17:18:05,222 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,222 - DEBUG - powsybl - |f(x)|=0.08620220271786033\n", + "2025-09-08 17:18:05,222 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:05,222 - DEBUG - powsybl - Jacobian matrix values updated in 3 us\n", + "2025-09-08 17:18:05,223 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 4 us\n", + "2025-09-08 17:18:05,223 - DEBUG - powsybl - LU decomposition updated in 278 us\n", + "2025-09-08 17:18:05,223 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,223 - DEBUG - powsybl - |f(x)|=0.0010693405956603969\n", + "2025-09-08 17:18:05,224 - DEBUG - powsybl - Start iteration 2\n", + "2025-09-08 17:18:05,224 - DEBUG - powsybl - Jacobian matrix values updated in 3 us\n", + "2025-09-08 17:18:05,224 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 3 us\n", + "2025-09-08 17:18:05,224 - DEBUG - powsybl - LU decomposition updated in 222 us\n", + "2025-09-08 17:18:05,225 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,225 - DEBUG - powsybl - |f(x)|=1.8534582905074213E-7\n", + "2025-09-08 17:18:05,225 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:05,226 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=0, newtonRaphsonIterations=3, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3667399372342284, distributedActivePower=0.0))\n", + "2025-09-08 17:18:05,226 - DEBUG - powsybl - Network {CC0 SC0}, IIDM network updated in 0 ms\n", + "2025-09-08 17:18:05,226 - INFO - powsybl - Load flow ran in 13 ms\n", + "2025-09-08 17:18:05,227 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:18:05,227 - INFO - powsybl - Applied the following remedial action(s) in order to reduce constraints on CNEC \"vc\": Injection L1 - 2\n", + "2025-09-08 17:18:05,227 - INFO - powsybl - Load-flow computation [start]\n", + "2025-09-08 17:18:05,228 - INFO - powsybl - Version: {repositoryName=powsybl-open-loadflow, mavenProjectVersion=1.16.0, gitVersion=9f4cb68a4139a1a5db7353e4b81ae590377f3096, gitBranch=UNKNOWN, buildTimestamp=2025-07-10T12:40:12.650Z}\n", + "2025-09-08 17:18:05,231 - INFO - powsybl - Parameters:\n", + "┌───────────────────────────┬───────────────────────────────────────────────────────────┬────────────────────────────────┐\n", + "│ Category │ Name │ Value │\n", + "├───────────────────────────┼───────────────────────────────────────────────────────────┼────────────────────────────────┤\n", + "│ Automation │ simulateAutomationSystems │ false │\n", + "│ DC │ dcApproximationType │ IGNORE_R │\n", + "│ │ dcPowerFactor │ 1.0 │\n", + "│ │ dcUseTransformerRatio │ false │\n", + "│ Debug │ alwaysUpdateNetwork │ false │\n", + "│ │ debugDir │ │\n", + "│ FastRestart │ actionableSwitchesIds │ [] │\n", + "│ │ actionableTransformersIds │ [] │\n", + "│ │ networkCacheEnabled │ false │\n", + "│ GeneratorVoltageControl │ disableInconsistentVoltageControls │ false │\n", + "│ │ disableVoltageControlOfGeneratorsOutsideActivePowerLimits │ false │\n", + "│ │ extrapolateReactiveLimits │ false │\n", + "│ │ fictitiousGeneratorVoltageControlCheckMode │ FORCED │\n", + "│ │ forceTargetQInReactiveLimits │ false │\n", + "│ │ reactiveLimitsMaxPqPvSwitch │ 3 │\n", + "│ │ reactivePowerDispatchMode │ Q_EQUAL_PROPORTION │\n", + "│ │ reactiveRangeCheckMode │ MAX │\n", + "│ │ svcVoltageMonitoring │ true │\n", + "│ │ voltagePerReactivePowerControl │ false │\n", + "│ │ voltageRemoteControl │ true │\n", + "│ │ voltageRemoteControlRobustMode │ true │\n", + "│ HVDC │ hvdcAcEmulation │ true │\n", + "│ Model │ asymmetrical │ false │\n", + "│ │ dc │ false │\n", + "│ │ linePerUnitMode │ IMPEDANCE │\n", + "│ │ lowImpedanceBranchMode │ REPLACE_BY_ZERO_IMPEDANCE_LINE │\n", + "│ │ lowImpedanceThreshold │ 1.0E-8 │\n", + "│ │ twtSplitShuntAdmittance │ true │\n", + "│ │ useLoadModel │ false │\n", + "│ NewtonKrylov │ maxNewtonKrylovIterations │ 100 │\n", + "│ │ newtonKrylovLineSearch │ false │\n", + "│ NewtonRaphson │ lineSearchStateVectorScalingMaxIteration │ 10 │\n", + "│ │ lineSearchStateVectorScalingStepFold │ 1.3333333333333333 │\n", + "│ │ maxActivePowerMismatch │ 0.01 │\n", + "│ │ maxAngleMismatch │ 1.0E-5 │\n", + "│ │ maxNewtonRaphsonIterations │ 15 │\n", + "│ │ maxRatioMismatch │ 1.0E-5 │\n", + "│ │ maxReactivePowerMismatch │ 0.01 │\n", + "│ │ maxSusceptanceMismatch │ 1.0E-4 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDphi │ 0.17453292519943295 │\n", + "│ │ maxVoltageChangeStateVectorScalingMaxDv │ 0.1 │\n", + "│ │ maxVoltageMismatch │ 1.0E-4 │\n", + "│ │ newtonRaphsonConvEpsPerEq │ 1.0E-4 │\n", + "│ │ newtonRaphsonStoppingCriteriaType │ UNIFORM_CRITERIA │\n", + "│ │ stateVectorScalingMode │ NONE │\n", + "│ OuterLoops │ maxOuterLoopIterations │ 20 │\n", + "│ │ outerLoopNames │ │\n", + "│ Performance │ computedConnectedComponentScope │ MAIN │\n", + "│ PhaseControl │ phaseShifterControlMode │ CONTINUOUS_WITH_DISCRETISATION │\n", + "│ │ phaseShifterRegulationOn │ false │\n", + "│ ReactivePowerControl │ generatorReactivePowerRemoteControl │ false │\n", + "│ │ transformerReactivePowerControl │ false │\n", + "│ ReferenceBus │ referenceBusSelectionMode │ FIRST_SLACK │\n", + "│ │ writeReferenceTerminals │ true │\n", + "│ Reporting │ reportedFeatures │ [] │\n", + "│ ShuntVoltageControl │ shuntCompensatorVoltageControlOn │ false │\n", + "│ │ shuntVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ SlackDistribution │ areaInterchangeControl │ false │\n", + "│ │ areaInterchangeControlAreaType │ ControlArea │\n", + "│ │ areaInterchangePMaxMismatch │ 2.0 │\n", + "│ │ balanceType │ PROPORTIONAL_TO_GENERATION_P │\n", + "│ │ countriesToBalance │ [TR, RO, BE, AT, FR, SK, BG, │\n", + "│ │ │ NL, CH, HU, MK, IT, HR, RS, │\n", + "│ │ │ UA, BA, SI, CZ, AL, ES, DE, │\n", + "│ │ │ GR, PT, PL, ME] │\n", + "│ │ distributedSlack │ true │\n", + "│ │ loadPowerFactorConstant │ false │\n", + "│ │ maxSlackBusCount │ 1 │\n", + "│ │ mostMeshedSlackBusSelectorMaxNominalVoltagePercentile │ 95.0 │\n", + "│ │ plausibleActivePowerLimit │ 5000.0 │\n", + "│ │ readSlackBus │ false │\n", + "│ │ slackBusCountryFilter │ [] │\n", + "│ │ slackBusPMaxMismatch │ 1.0 │\n", + "│ │ slackBusSelectionMode │ MOST_MESHED │\n", + "│ │ slackBusesIds │ [] │\n", + "│ │ slackDistributionFailureBehavior │ LEAVE_ON_SLACK_BUS │\n", + "│ │ useActiveLimits │ true │\n", + "│ │ writeSlackBus │ false │\n", + "│ Solver │ acSolverType │ NEWTON_RAPHSON │\n", + "│ TransformerVoltageControl │ generatorVoltageControlMinNominalVoltage │ -1.0 │\n", + "│ │ incrementalTransformerRatioTapControlOuterLoopMaxTapShift │ 3 │\n", + "│ │ transformerVoltageControlMode │ WITH_GENERATOR_VOLTAGE_CONTROL │\n", + "│ │ transformerVoltageControlOn │ false │\n", + "│ │ transformerVoltageControlUseInitialTapPosition │ false │\n", + "│ VoltageControls │ maxPlausibleTargetVoltage │ 1.2 │\n", + "│ │ maxRealisticVoltage │ 2.0 │\n", + "│ │ minNominalVoltageRealisticVoltageCheck │ 0.0 │\n", + "│ │ minNominalVoltageTargetVoltageCheck │ 20.0 │\n", + "│ │ minPlausibleTargetVoltage │ 0.8 │\n", + "│ │ minRealisticVoltage │ 0.5 │\n", + "│ │ secondaryVoltageControl │ false │\n", + "│ │ useReactiveLimits │ true │\n", + "│ │ voltageTargetPriorities │ [GENERATOR, TRANSFORMER, │\n", + "│ │ │ SHUNT] │\n", + "│ VoltageInit │ voltageInitMode │ UNIFORM_VALUES │\n", + "│ │ voltageInitModeOverride │ NONE │\n", + "└───────────────────────────┴───────────────────────────────────────────────────────────┴────────────────────────────────┘\n", + "2025-09-08 17:18:05,231 - INFO - powsybl - Outer loops: [DistributedSlack, VoltageMonitoring, ReactiveLimits]\n", + "2025-09-08 17:18:05,232 - DEBUG - powsybl - LF networks created in 0 ms\n", + "2025-09-08 17:18:05,232 - INFO - powsybl - Network {CC0 SC0} has 3 buses and 3 branches\n", + "2025-09-08 17:18:05,232 - INFO - powsybl - Network {CC0 SC0} balance: active generation=100.0 MW, active load=140.0 MW, reactive generation=0.0 MVar, reactive load=50.0 MVar\n", + "2025-09-08 17:18:05,233 - INFO - powsybl - Network {CC0 SC0}, slack buses are [VL2_0] (method='Most meshed bus')\n", + "2025-09-08 17:18:05,233 - INFO - powsybl - Network {CC0 SC0}, reference bus is VL2_0 (method='First slack')\n", + "2025-09-08 17:18:05,233 - INFO - powsybl - Start AC loadflow on network {CC0 SC0}\n", + "2025-09-08 17:18:05,234 - DEBUG - powsybl - Equations index updated (6 columns)\n", + "2025-09-08 17:18:05,234 - DEBUG - powsybl - Variables index updated (6 rows)\n", + "2025-09-08 17:18:05,234 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,234 - DEBUG - powsybl - |f(x0)|=1.1192721220071966\n", + "2025-09-08 17:18:05,235 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:05,235 - DEBUG - powsybl - Jacobian matrix built in 7 us\n", + "2025-09-08 17:18:05,235 - DEBUG - powsybl - Sparse LU decomposition done in 12 us\n", + "2025-09-08 17:18:05,236 - DEBUG - powsybl - LU decomposition done in 311 us\n", + "2025-09-08 17:18:05,236 - DEBUG - powsybl - Equation vector updated in 2 us\n", + "2025-09-08 17:18:05,236 - DEBUG - powsybl - |f(x)|=0.08620220271786033\n", + "2025-09-08 17:18:05,237 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:05,237 - DEBUG - powsybl - Jacobian matrix values updated in 3 us\n", + "2025-09-08 17:18:05,237 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 3 us\n", + "2025-09-08 17:18:05,237 - DEBUG - powsybl - LU decomposition updated in 228 us\n", + "2025-09-08 17:18:05,237 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,238 - DEBUG - powsybl - |f(x)|=0.0010693405956603969\n", + "2025-09-08 17:18:05,238 - DEBUG - powsybl - Start iteration 2\n", + "2025-09-08 17:18:05,239 - DEBUG - powsybl - Jacobian matrix values updated in 2 us\n", + "2025-09-08 17:18:05,239 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 3 us\n", + "2025-09-08 17:18:05,239 - DEBUG - powsybl - LU decomposition updated in 222 us\n", + "2025-09-08 17:18:05,239 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,239 - DEBUG - powsybl - |f(x)|=1.8534582905074213E-7\n", + "2025-09-08 17:18:05,240 - DEBUG - powsybl - 40.36673993723423 MW / 40.36673993723422 MW distributed at iteration 0 to 1 generators (0 at max power, 0 at min power)\n", + "2025-09-08 17:18:05,240 - INFO - powsybl - Slack bus active power (40.36673993723422 MW) distributed in 1 distribution iteration(s)\n", + "2025-09-08 17:18:05,241 - DEBUG - powsybl - Start outer loop 'DistributedSlack' iteration 0\n", + "2025-09-08 17:18:05,241 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,241 - DEBUG - powsybl - |f(x0)|=0.40366738305544736\n", + "2025-09-08 17:18:05,241 - DEBUG - powsybl - Start iteration 0\n", + "2025-09-08 17:18:05,242 - DEBUG - powsybl - Jacobian matrix values updated in 4 us\n", + "2025-09-08 17:18:05,242 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 3 us\n", + "2025-09-08 17:18:05,242 - DEBUG - powsybl - LU decomposition updated in 232 us\n", + "2025-09-08 17:18:05,243 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,243 - DEBUG - powsybl - |f(x)|=0.012804250496370755\n", + "2025-09-08 17:18:05,243 - DEBUG - powsybl - Start iteration 1\n", + "2025-09-08 17:18:05,243 - DEBUG - powsybl - Jacobian matrix values updated in 2 us\n", + "2025-09-08 17:18:05,244 - DEBUG - powsybl - Sparse LU decomposition updated (refactor rgrowth is 0.019991670908668668, threshold is 1.0E-10) in 2 us\n", + "2025-09-08 17:18:05,244 - DEBUG - powsybl - LU decomposition updated in 291 us\n", + "2025-09-08 17:18:05,244 - DEBUG - powsybl - Equation vector updated in 1 us\n", + "2025-09-08 17:18:05,244 - DEBUG - powsybl - |f(x)|=3.696679144198829E-5\n", + "2025-09-08 17:18:05,245 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:05,245 - DEBUG - powsybl - Already balanced\n", + "2025-09-08 17:18:05,245 - INFO - powsybl - AC loadflow complete on network {CC0 SC0} (result=AcLoadFlowResult(outerLoopIterations=1, newtonRaphsonIterations=5, solverStatus=CONVERGED, outerLoopStatus=STABLE, slackBusActivePowerMismatch=0.3011552165879561, distributedActivePower=40.36673993723423))\n", + "2025-09-08 17:18:05,246 - DEBUG - powsybl - Network {CC0 SC0}, IIDM network updated in 0 ms\n", + "2025-09-08 17:18:05,246 - INFO - powsybl - Load flow ran in 17 ms\n", + "2025-09-08 17:18:05,246 - INFO - powsybl - Load-flow computation [end]\n", + "2025-09-08 17:18:05,247 - INFO - powsybl - -- 'VOLTAGE' Monitoring at state 'coL1 - curative' [end]\n", + "2025-09-08 17:18:05,247 - INFO - powsybl - Some VOLTAGE Cnecs are not secure:\n", + "2025-09-08 17:18:05,247 - INFO - powsybl - Network element VL2 at state coL1 - curative has a min voltage of 363.62 kV and a max voltage of 363.62 kV.\n", + "2025-09-08 17:18:05,248 - DEBUG - powsybl - Removing variant 'OpenRaoNetworkPool working variant 0c487c13-f3fe-454c-a397-121f4792d9a2'\n", + "2025-09-08 17:18:05,248 - DEBUG - powsybl - Removing variant 'OpenRaoNetworkPool state save 4943a583-7343-46f4-8659-47e13ee94acd'\n", + "2025-09-08 17:18:05,248 - INFO - powsybl - ----- VOLTAGE monitoring [end]\n", + "2025-09-08 17:18:05,249 - INFO - powsybl - Some VOLTAGE Cnecs are not secure:\n", + "2025-09-08 17:18:05,249 - INFO - powsybl - Network element VL2 at state coL1 - curative has a min voltage of 363.62 kV and a max voltage of 363.62 kV.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " cnec_id min_voltage max_voltage margin\n", + "index \n", + "1 vc 363.622121 363.622121 -13.622121\n", + "{'type': 'RAO_RESULT', 'version': '1.8', 'info': 'Generated by Open RAO https://powsybl.readthedocs.io/projects/openrao', 'computationStatus': 'default', 'executionDetails': 'The RAO only went through first preventive', 'costResults': {'initial': {'functionalCost': 95.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'preventive': {'functionalCost': 95.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'outage': {'functionalCost': 95.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'auto': {'functionalCost': 95.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}, 'curative': {'functionalCost': 95.0, 'virtualCost': {'sensitivity-failure-cost': 0.0}}}, 'computationStatusMap': [], 'flowCnecResults': [{'flowCnecId': 'cnec1 - curative', 'initial': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 175.35}}, 'megawatt': {'margin': -95.0, 'side2': {'flow': 100.0}}}, 'preventive': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 175.35}}, 'megawatt': {'margin': -95.0, 'side2': {'flow': 100.0}}}, 'auto': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 175.35}}, 'megawatt': {'margin': -95.0, 'side2': {'flow': 100.0}}}, 'curative': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 175.35}}, 'megawatt': {'margin': -95.0, 'side2': {'flow': 100.0}}}}, {'flowCnecId': 'cnec1 - preventive', 'initial': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 83.68}}, 'megawatt': {'margin': 49.99, 'side2': {'flow': 50.01}}}, 'preventive': {'ampere': {'margin': 1.7976931348623157e+308, 'side2': {'flow': 83.68}}, 'megawatt': {'margin': 49.99, 'side2': {'flow': 50.01}}}}], 'angleCnecResults': [], 'voltageCnecResults': [{'voltageCnecId': 'vc', 'curative': {'kilovolt': {'margin': -13.62}}}], 'networkActionResults': [{'networkActionId': 'Injection L1 - 2', 'activatedStates': [{'instant': 'curative', 'contingency': 'coL1'}]}], 'rangeActionResults': []}\n" + ] + } + ], + "execution_count": 20 + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}