Skip to content

Commit

Permalink
Repair cucumber tests often by using the value of DC to have the corr…
Browse files Browse the repository at this point in the history
…ect Unit

Signed-off-by: Pauline Jean-Marie <pauline.jean-marie@artelys.com>
  • Loading branch information
Pauline Jean-Marie committed Oct 8, 2024
1 parent ba347ba commit 54aa50a
Show file tree
Hide file tree
Showing 27 changed files with 124 additions and 129 deletions.
2 changes: 1 addition & 1 deletion distribution/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rao:
default: SearchTreeRao

rao-parameters:
objective-function: MAX_MIN_MARGIN_IN_MEGAWATT
objective-function: MAX_MIN_MARGIN
max-number-of-iterations: 2
pst-penalty-cost: 0.01
pst-sensitivity-threshold : 0.2
Expand Down
6 changes: 3 additions & 3 deletions docs/castor/linear-problem/max-min-relative-margin-filler.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ And $PTDF_{zTos}(z1, c)$, the zone-to-slack PTDF of bidding zone $z1$ on CNEC $c

## Used parameters

| Name | Symbol | Details |
|------------------------------------------------------------------------|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [type](/parameters.md#type) | | This filler is only used if the objective function is MAX_MIN_MARGIN_IN_MEGAWATT, or MAX_MIN_MARGIN_IN_AMPERE. This parameter is also used to set the unit (AMPERE/MW) of the objective function |
| Name | Symbol | Details |
|------------------------------------------------------------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [type](/parameters.md#type) | | This filler is only used if the objective function is MAX_MIN_MARGIN |
| [ptdf-sum-lower-bound](/parameters.md#ptdf-sum-lower-bound) | $\varepsilon_{PTDF}$ | zToz PTDF sum below this value are lifted to the ptdf-sum-lower-bound, to avoid a bad conditionning of the problem where the value of relative margins are very high. <br>*Its impact on the accuracy of the problem is insignificant, as high relative margins do not usually define the min. relative margin.* |

## Defined optimization variables
Expand Down
25 changes: 8 additions & 17 deletions docs/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,15 @@ These parameters should be always set in the RAO parameters file or object.
These parameters (objective-function) configure the remedial action optimisation's objective function.

#### type

- **Expected value**: one of the following:
- "MAX_MIN_MARGIN_IN_MEGAWATT"
- "MAX_MIN_MARGIN_IN_AMPERE"
- "MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT"
- "MAX_MIN_RELATIVE_MARGIN_IN_AMPERE"
- **Default value**: "MAX_MIN_MARGIN_IN_MEGAWATT"
- "MAX_MIN_MARGIN"
- "MAX_MIN_RELATIVE_MARGIN"
- **Default value**: "MAX_MIN_MARGIN"
- **Usage**: this parameter sets the objective function of the RAO. For now, the existing objective function are:
- **MAX_MIN_MARGIN_IN_MEGAWATT**: maximization of the min(margin), where min(margin) is the smallest margin of all
CNECs and the margins are considered in MW.
- **MAX_MIN_MARGIN_IN_AMPERE**: maximization of the min(margin), where min(margin) is the smallest margin of all CNECs
and the margins are considered in A. Note that this objective function is not just a homothety of the previous one,
as CNECs from different voltage levels will not have the same weight in the objective function depending on the unit
considered (MW or A). This objective function only works in AC-load-flow mode (see [sensitivity-parameters](#sensitivity-parameters)).
- **MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT**: same as MAX_MIN_MARGIN_IN_MEGAWATT, but the margins will be relative
- **MAX_MIN_MARGIN**: maximization of the min(margin), where min(margin) is the smallest margin of all
CNECs.
- **MAX_MIN_RELATIVE_MARGIN**: same as MAX_MIN_MARGIN, but the margins will be relative
(divided by the absolute sum of PTDFs) when they are positive.
- **MAX_MIN_RELATIVE_MARGIN_IN_AMPERE**: same as MAX_MIN_MARGIN_IN_AMPERE, but the margins will be relative (divided
by the absolute sum of PTDFs) when they are positive.

#### preventive-stop-criterion
- **Expected value**: one of the following:
Expand Down Expand Up @@ -551,7 +542,7 @@ Zones are seperated by + or -.
{
"version" : "2.4",
"objective-function" : {
"type" : "MAX_MIN_RELATIVE_MARGIN_IN_AMPERE",
"type" : "MAX_MIN_RELATIVE_MARGIN",
"curative-min-obj-improvement" : 0.0,
"preventive-stop-criterion" : "SECURE",
"enforce-curative-security" : true
Expand Down Expand Up @@ -669,7 +660,7 @@ Zones are seperated by + or -.
Based on PowSyBl's [configuration mechanism](inv:powsyblcore:std:doc#user/configuration/index).
~~~yaml
rao-objective-function:
type: MAX_MIN_MARGIN_IN_AMPERE
type: MAX_MIN_MARGIN
preventive-stop-criterion: SECURE

rao-range-actions-optimization:
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ loadFlowAndSensitivityParameters.setLoadFlowProvider("OpenLoadFlow");
loadFlowAndSensitivityParameters.setSensitivityWithLoadFlowParameters(sensitivityAnalysisParameters);
raoParameters.setLoadFlowAndSensitivityParameters(loadFlowAndSensitivityParameters);

// Ask the RAO to maximize minimum margin in MW, and to stop when network is secure (i.e. when margins are positive)
// Ask the RAO to maximize minimum margin, and to stop when network is secure (i.e. when margins are positive)
ObjectiveFunctionParameters objectiveFunctionParameters = new ObjectiveFunctionParameters();
objectiveFunctionParameters.setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN_IN_MEGAWATT);
objectiveFunctionParameters.setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN);
objectiveFunctionParameters.setPreventiveStopCriterion(ObjectiveFunctionParameters.PreventiveStopCriterion.SECURE);
objectiveFunctionParameters.setCurativeStopCriterion(ObjectiveFunctionParameters.CurativeStopCriterion.SECURE);
raoParameters.setObjectiveFunctionParameters(objectiveFunctionParameters);
Expand Down Expand Up @@ -575,9 +575,9 @@ public class Main {
loadFlowAndSensitivityParameters.setSensitivityWithLoadFlowParameters(sensitivityAnalysisParameters);
raoParameters.setLoadFlowAndSensitivityParameters(loadFlowAndSensitivityParameters);

// Ask the RAO to maximize minimum margin in MW, and to stop when network is secure (i.e. when margins are positive)
// Ask the RAO to maximize minimum margin, and to stop when network is secure (i.e. when margins are positive)
ObjectiveFunctionParameters objectiveFunctionParameters = new ObjectiveFunctionParameters();
objectiveFunctionParameters.setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN_IN_MEGAWATT);
objectiveFunctionParameters.setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN);
objectiveFunctionParameters.setPreventiveStopCriterion(ObjectiveFunctionParameters.PreventiveStopCriterion.SECURE);
objectiveFunctionParameters.setCurativeStopCriterion(ObjectiveFunctionParameters.CurativeStopCriterion.SECURE);
raoParameters.setObjectiveFunctionParameters(objectiveFunctionParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ Feature: US 13.8: cross-validation curative and relative margin
And the remedial action "open_be1_be4" is used in preventive
And the remedial action "open_fr1_fr2" is used in preventive
And the tap of PstRangeAction "pst_be" should be -15 in preventive
Then 0 remedial actions are used after "co1_fr2_fr3_1" at "curative"
Then 2 remedial actions are used after "co1_fr2_fr3_1" at "curative"
And the remedial action "open_fr1_fr3" is used after "co1_fr2_fr3_1" at "curative"
And the tap of PstRangeAction "pst_fr" should be 12 after "co1_fr2_fr3_1" at "curative"
And the worst margin is 300 A on cnec "BBE4AA1 FFR5AA1 1 - preventive"
And the margin on cnec "BBE4AA1 FFR5AA1 1 - preventive" after PRA should be 300 A
And the margin on cnec "BBE2AA1 FFR3AA1 1 - preventive" after PRA should be 308 A
Then the margin on cnec "FFR2AA1 DDE3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 659 A
Then the margin on cnec "BBE4AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 344 A
Then the margin on cnec "FFR2AA1 DDE3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 408 A
Then the margin on cnec "BBE4AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 411 A
And the margin on cnec "FFR2AA1 DDE3AA1 1 - preventive" after PRA should be 470 A
And the value of the objective function after CRA should be -300

Expand All @@ -67,13 +69,15 @@ Feature: US 13.8: cross-validation curative and relative margin
And the remedial action "open_be1_be4" is used in preventive
And the remedial action "open_fr1_fr2" is used in preventive
And the tap of PstRangeAction "pst_be" should be -16 in preventive
Then 0 remedial actions are used after "co1_fr2_fr3_1" at "curative"
Then 2 remedial actions are used after "co1_fr2_fr3_1" at "curative"
And the remedial action "open_fr1_fr3" is used after "co1_fr2_fr3_1" at "curative"
And the tap of PstRangeAction "pst_fr" should be 12 after "co1_fr2_fr3_1" at "curative"
And the worst relative margin is 278 A on cnec "BBE2AA1 FFR3AA1 1 - preventive"
And the relative margin on cnec "BBE2AA1 FFR3AA1 1 - preventive" after PRA should be 278 A
Then the relative margin on cnec "FFR2AA1 DDE3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 793 A
Then the relative margin on cnec "BBE2AA1 FFR3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 372 A
Then the relative margin on cnec "FFR2AA1 DDE3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 494 A
Then the relative margin on cnec "BBE2AA1 FFR3AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 508 A
And the relative margin on cnec "BBE4AA1 FFR5AA1 1 - preventive" after PRA should be 514 A
And the relative margin on cnec "FFR2AA1 DDE3AA1 1 - preventive" after PRA should be 543 A
Then the relative margin on cnec "FFR3AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 433 A
Then the relative margin on cnec "BBE4AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 604 A
Then the relative margin on cnec "FFR3AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 604 A
Then the relative margin on cnec "BBE4AA1 FFR5AA1 1 - co1_fr2_fr3_1 - curative" after CRA should be 726 A
And the value of the objective function after CRA should be -278
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feature: US 15.11.4: ARAO with 2P
And the margin on cnec "NL2-BE3-O - curative" after CRA should be 8.9 MW
Then the optimization steps executed by the RAO should be "SECOND_PREVENTIVE_IMPROVED_FIRST"

@fast @rao @mock @ac @second-preventive @mnec
@fast @rao @mock @dc @second-preventive @mnec
Scenario: US 15.11.4.2: ARAO2
Given network file is "common/TestCase12Nodes2PSTs.uct"
Given crac file is "epic15/jsonCrac_ep15us11-4case2.json"
Expand All @@ -40,5 +40,5 @@ Feature: US 15.11.4: ARAO with 2P
And the remedial action "PRA_CRA_PST_BE" is not used after "Contingency_FR1_FR3" at "curative"
And the worst margin is -141 MW
And the value of the objective function after CRA should be 141
And the margin on cnec "NL2-BE3-O - curative" after CRA should be 224 MW
And the margin on cnec "NL2-BE3-O - curative" after CRA should be 205 MW
Then the optimization steps executed by the RAO should be "SECOND_PREVENTIVE_IMPROVED_FIRST"
Loading

0 comments on commit 54aa50a

Please sign in to comment.