Skip to content

Commit 9d70db8

Browse files
phiedwbqth29Godelaine
authored
Force global 2P (#1294)
* force global 2P Signed-off-by: Philippe Edwards <philippe.edwards@rte-france.com> * fix after merge Signed-off-by: Thomas Bouquet <thomas.bouquet@rte-france.com> * bump parameters to v3.2 and add changelog Signed-off-by: Thomas Bouquet <thomas.bouquet@rte-france.com> * fix tests Signed-off-by: Thomas Bouquet <thomas.bouquet@rte-france.com> * add comments to getRaLimitationParameters Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * adapt 20.2.2 by using topo CRA to ensure CRA is kept in 2P now that 2P is global Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * clean/ adapt US20_1 Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * fix merge Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * delete re-optimize everywhere Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * update parameter files * update values far from ref Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * fix values Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * add UT to improve sonar Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * checkstyle Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * improve sonar Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * fix test Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * more sonar Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * PR changes Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> * Update ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/Leaf.java Co-authored-by: Thomas Bouquet <thomas.bouquet@rte-france.com> Signed-off-by: Godelaine <87479798+Godelaine@users.noreply.github.com> * Update ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/result/impl/PreventiveAndCurativesRaoResultImplTest.java Co-authored-by: Thomas Bouquet <thomas.bouquet@rte-france.com> Signed-off-by: Godelaine <87479798+Godelaine@users.noreply.github.com> * Update ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/result/impl/PreventiveAndCurativesRaoResultImplTest.java Co-authored-by: Thomas Bouquet <thomas.bouquet@rte-france.com> Signed-off-by: Godelaine <87479798+Godelaine@users.noreply.github.com> --------- Signed-off-by: Philippe Edwards <philippe.edwards@rte-france.com> Signed-off-by: Thomas Bouquet <thomas.bouquet@rte-france.com> Signed-off-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> Signed-off-by: Godelaine <87479798+Godelaine@users.noreply.github.com> Co-authored-by: Thomas Bouquet <thomas.bouquet@rte-france.com> Co-authored-by: Godelaine de Montmorillon <godelaine.demontmorillon@rte-france.com> Co-authored-by: Godelaine <87479798+Godelaine@users.noreply.github.com>
1 parent 6a7048c commit 9d70db8

File tree

182 files changed

+574
-983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+574
-983
lines changed

docs/algorithms/castor/rao-steps.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ The differences with the first preventive RAO are that, in this run:
194194
- **curative remedial actions** that were selected in the curative perimeter are supposed activated*, in order for
195195
the preventive RAO to focus on constraints that cannot be solved by curative actions.
196196

197-
_* It is possible to re-optimise curative range actions (for all curative instants) during second preventive RAO
198-
using [this parameter](../../parameters/implementation-specific-parameters.md#re-optimize-curative-range-actions)._
197+
_* Curative range actions (for all curative instants) are re-optimized during second preventive RAO.
199198

200199
![PATL vs TATL](../../_static/img/rao_steps.png){.forced-white-background}

docs/output-data/rao-logs/rao-business-warns.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ com.powsybl.openrao.commons.logs.RaoBusinessWarns
1818
| ra-optimisation | Available network action automaton | "CRAC has network action automatons with usage method AVAILABLE. These are not supported." | An automatic network action has an "available" usage method. The RAO only knows how to interpret "forced" usage method for automatons. | The given RA is not used in auto instant simulation. |
1919
| ra-optimisation | Wrong initial setpoint | "Range action {name} has an initial setpoint of {setpoint} that does not respect its allowed range [{min} {max}]. It will be filtered out of the linear problem." | The range action's initial setpoint does not respect its allowed range. This makes the initial situation infeasible, renders the problem hard to optimize, and the results harder to interpret. | The given RA is ignored in the RAO, and kept at its initial setpoint. |
2020
| ra-optimisation | Unaligned range actions in same group | "Range actions of group {group name} do not have the same initial setpoint. They will be filtered out of the linear problem." | Two or more range actions belonging to the same group have different initial setpoints. <br> This makes the initial situation infeasible, renders the problem hard to optimize, and the results harder to interpret. <br> The given RAs are ignored in the RAO, and kept at their initial setpoints. |
21-
| ra-optimisation | Excluded range actions from 2P | "Range action {name} will not be considered in 2nd preventive RAO as it is also curative (or its network element has an associated CRA)" | Range actions that are both preventive and curative cannot be re-optimized in the 2nd preventive optimization, because this would risk making their curative optimal setpoints infeasible (eg because of "relative to previous instant" ranges). | These range actions are ignored in 2nd preventive optimization. <br> They are kept at their 1st preventive optimization optimal setpoint for the preventive instant, and post-curative optimal setpoints for the curative instant. |
2221
| ra-optimisation | Network action application error | "Cannot apply remedial action combination {name}: {reason}" <br> or <br> "Could not create child leaf with network action combination {name}, the combination will be skipped: {reason}" | In the search tree, it may happen that a network action combination cannot be applied (for example a SwitchPair) | The search tree ignores the NA combination and moves on to the next one |
2322
| ra-optimisation | Range action abnormal iteration | "The new iteration found a worse result (abnormal). The leaf will be optimized again with the previous list of range actions." | When applying a limitation on the number of different remedial actions to use, the list of available remedial actions can change, thus multiple iterations of optimization are necessary. Although it should theoretically not happen, the possibility that the result worsens between two iterations is caught. | The RAO falls back to the list of available range actions from the previous iteration. |
2423
| ra-optimisation | Leaf evaluation failure | "Failed to evaluate leaf: {error message}" <br> or <br> "Impossible to optimize leaf: {description} because evaluation failed" <br> or <br> "Impossible to optimize leaf: {leaf description} because evaluation has not been performed" | The RAO may fail to evaluate & optimize a leaf (a network actions combination). | The RAO will ignore the leaf and move to the next one. |

docs/parameters.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Examples of rao parameters with business and implementation specific parameters
3636
:::{group-tab} JSON
3737
~~~json
3838
{
39-
"version" : "3.1",
39+
"version" : "3.2",
4040
"objective-function" : {
4141
"type" : "SECURE_FLOW",
4242
"unit" : "A",
@@ -83,7 +83,6 @@ Examples of rao parameters with business and implementation specific parameters
8383
},
8484
"second-preventive-rao" : {
8585
"execution-condition" : "POSSIBLE_CURATIVE_IMPROVEMENT",
86-
"re-optimize-curative-range-actions" : false,
8786
"hint-from-first-preventive-rao" : true
8887
},
8988
"load-flow-and-sensitivity-computation" : {
@@ -191,7 +190,6 @@ search-tree-multi-threading:
191190

192191
search-tree-second-preventive-rao:
193192
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
194-
re-optimize-curative-range-actions: true
195193
hint-from-first-preventive-rao: true
196194

197195
rao-not-optimized-cnecs:

docs/parameters/business-parameters.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ See also: [Modelling the maximum minimum relative margin objective function](../
183183
:::{group-tab} JSON
184184
~~~json
185185
{
186-
"version" : "3.1",
186+
"version" : "3.2",
187187
"objective-function" : {
188188
"type" : "SECURE_FLOW",
189189
"unit" : "A",
@@ -223,7 +223,6 @@ search-tree-multi-threading:
223223

224224
search-tree-second-preventive-rao:
225225
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
226-
re-optimize-curative-range-actions: true
227226
hint-from-first-preventive-rao: true
228227

229228
rao-not-optimized-cnecs:

docs/parameters/implementation-specific-parameters.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,6 @@ These parameters (second-preventive-rao) tune the behaviour of the [second preve
197197
- **MAX_MIN_MARGIN** or **MAX_MIN_RELATIVE_MARGIN**: 2nd preventive RAO is run if one curative perimeter reached an objective function value
198198
after optimisation that is worse than the preventive perimeter's (decreased by [curative-min-obj-improvement](#curative-min-obj-improvement))
199199

200-
##### re-optimize-curative-range-actions
201-
- **Expected value**: true/false
202-
- **Default value**: false
203-
- **Usage**:
204-
- **false**: the 2nd preventive RAO will optimize only the preventive remedial actions, keeping **all** optimal
205-
curative remedial actions selected during the curative RAO.
206-
- **true**: the 2nd preventive RAO will optimize preventive remedial actions **and** curative range actions, keeping
207-
only the optimal curative **topological** actions computed in the curative RAO.
208-
209200
##### hint-from-first-preventive-rao
210201
- **Expected value**: true/false
211202
- **Default value**: false
@@ -396,7 +387,7 @@ These parameters are meant to be used in costly optimization only.
396387
:::{group-tab} JSON
397388
~~~json
398389
{
399-
"version" : "3.1",
390+
"version" : "3.2",
400391
"extensions" : {
401392
"open-rao-search-tree-parameters": {
402393
"objective-function" : {
@@ -426,7 +417,6 @@ These parameters are meant to be used in costly optimization only.
426417
},
427418
"second-preventive-rao" : {
428419
"execution-condition" : "POSSIBLE_CURATIVE_IMPROVEMENT",
429-
"re-optimize-curative-range-actions" : false,
430420
"hint-from-first-preventive-rao" : true
431421
},
432422
"load-flow-and-sensitivity-computation" : {
@@ -527,7 +517,6 @@ search-tree-multi-threading:
527517

528518
search-tree-second-preventive-rao:
529519
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
530-
re-optimize-curative-range-actions: true
531520
hint-from-first-preventive-rao: true
532521

533522
search-tree-load-flow-and-sensitivity-computation:

ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/Rao.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import com.powsybl.commons.Versionable;
1515
import com.powsybl.commons.config.PlatformConfig;
1616
import com.powsybl.commons.util.ServiceLoaderCache;
17-
import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters;
18-
import com.powsybl.openrao.raoapi.parameters.extensions.SecondPreventiveRaoParameters;
1917
import com.powsybl.tools.Version;
2018

2119
import java.time.Instant;
@@ -63,8 +61,6 @@ public CompletableFuture<RaoResult> runAsync(RaoInput raoInput, RaoParameters pa
6361
.findFirst().orElseThrow();
6462
BUSINESS_WARNS.warn("Running RAO using Open RAO version {} from git commit {}.", openRaoVersion.getMavenProjectVersion(), openRaoVersion.getGitVersion());
6563

66-
deprecateNonGlobalSecondPreventive(parameters);
67-
6864
return provider.run(raoInput, parameters, targetEndInstant);
6965
}
7066

@@ -90,20 +86,9 @@ public RaoResult run(RaoInput raoInput, RaoParameters parameters, Instant target
9086
.findFirst().orElseThrow();
9187
BUSINESS_WARNS.warn("Running RAO using Open RAO version {} from git commit {}.", openRaoVersion.getMavenProjectVersion(), openRaoVersion.getGitVersion());
9288

93-
deprecateNonGlobalSecondPreventive(parameters);
94-
9589
return provider.run(raoInput, parameters, targetEndInstant).join();
9690
}
9791

98-
public void deprecateNonGlobalSecondPreventive(RaoParameters parameters) {
99-
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
100-
boolean reOptimizeCurativeRangeActions = SecondPreventiveRaoParameters.getSecondPreventiveReOptimizeCurativeRangeActions(parameters);
101-
if (!reOptimizeCurativeRangeActions) {
102-
BUSINESS_WARNS.warn("Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.");
103-
}
104-
}
105-
}
106-
10792
public RaoResult run(RaoInput raoInput, RaoParameters parameters) {
10893
return run(raoInput, parameters, null);
10994
}

ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/RaoParametersCommons.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ public final class RaoParametersCommons {
1616
private RaoParametersCommons() {
1717
}
1818

19-
public static final String RAO_PARAMETERS_VERSION = "3.1";
19+
/*
20+
CHANGELOG RAO Parameters v3
21+
---------------------------
22+
3.1: remove max-auto-search-tree-depth
23+
3.2: remove re-optimize-curative-range-actions
24+
*/
25+
26+
public static final String RAO_PARAMETERS_VERSION = "3.2";
2027

2128
// header
2229
public static final String VERSION = "version";
@@ -73,7 +80,6 @@ private RaoParametersCommons() {
7380
public static final String SECOND_PREVENTIVE_RAO = "second-preventive-rao";
7481
public static final String SECOND_PREVENTIVE_RAO_SECTION = "search-tree-second-preventive-rao";
7582
public static final String EXECUTION_CONDITION = "execution-condition";
76-
public static final String RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS = "re-optimize-curative-range-actions";
7783
public static final String HINT_FROM_FIRST_PREVENTIVE_RAO = "hint-from-first-preventive-rao";
7884

7985
// Not optimized cnecs parameters

ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonSecondPreventiveRaoParameters.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ private JsonSecondPreventiveRaoParameters() {
2828
static void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator jsonGenerator) throws IOException {
2929
jsonGenerator.writeObjectFieldStart(SECOND_PREVENTIVE_RAO);
3030
jsonGenerator.writeObjectField(EXECUTION_CONDITION, parameters.getSecondPreventiveRaoParameters().getExecutionCondition());
31-
jsonGenerator.writeBooleanField(RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS, parameters.getSecondPreventiveRaoParameters().getReOptimizeCurativeRangeActions());
3231
jsonGenerator.writeBooleanField(HINT_FROM_FIRST_PREVENTIVE_RAO, parameters.getSecondPreventiveRaoParameters().getHintFromFirstPreventiveRao());
3332
jsonGenerator.writeEndObject();
3433
}
@@ -39,10 +38,6 @@ static void deserialize(JsonParser jsonParser, OpenRaoSearchTreeParameters searc
3938
case EXECUTION_CONDITION:
4039
searchTreeParameters.getSecondPreventiveRaoParameters().setExecutionCondition(stringToExecutionCondition(jsonParser.nextTextValue()));
4140
break;
42-
case RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS:
43-
jsonParser.nextToken();
44-
searchTreeParameters.getSecondPreventiveRaoParameters().setReOptimizeCurativeRangeActions(jsonParser.getBooleanValue());
45-
break;
4641
case HINT_FROM_FIRST_PREVENTIVE_RAO:
4742
jsonParser.nextToken();
4843
searchTreeParameters.getSecondPreventiveRaoParameters().setHintFromFirstPreventiveRao(jsonParser.getBooleanValue());

ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SecondPreventiveRaoParameters.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
*/
2222
public class SecondPreventiveRaoParameters {
2323
private static final ExecutionCondition DEFAULT_EXECUTION_CONDITION = ExecutionCondition.DISABLED;
24-
private static final boolean DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS = true;
2524
private static final boolean DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO = false;
2625

2726
private ExecutionCondition executionCondition = DEFAULT_EXECUTION_CONDITION;
28-
private boolean reOptimizeCurativeRangeActions = DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS;
2927
private boolean hintFromFirstPreventiveRao = DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO;
3028

3129
public enum ExecutionCondition {
@@ -38,10 +36,6 @@ public void setExecutionCondition(ExecutionCondition executionCondition) {
3836
this.executionCondition = executionCondition;
3937
}
4038

41-
public void setReOptimizeCurativeRangeActions(boolean reOptimizeCurativeRangeActions) {
42-
this.reOptimizeCurativeRangeActions = reOptimizeCurativeRangeActions;
43-
}
44-
4539
public void setHintFromFirstPreventiveRao(boolean hintFromFirstPreventiveRao) {
4640
this.hintFromFirstPreventiveRao = hintFromFirstPreventiveRao;
4741
}
@@ -50,10 +44,6 @@ public ExecutionCondition getExecutionCondition() {
5044
return executionCondition;
5145
}
5246

53-
public boolean getReOptimizeCurativeRangeActions() {
54-
return reOptimizeCurativeRangeActions;
55-
}
56-
5747
public boolean getHintFromFirstPreventiveRao() {
5848
return hintFromFirstPreventiveRao;
5949
}
@@ -64,7 +54,6 @@ public static SecondPreventiveRaoParameters load(PlatformConfig platformConfig)
6454
platformConfig.getOptionalModuleConfig(SECOND_PREVENTIVE_RAO_SECTION)
6555
.ifPresent(config -> {
6656
parameters.setExecutionCondition(config.getEnumProperty(EXECUTION_CONDITION, ExecutionCondition.class, DEFAULT_EXECUTION_CONDITION));
67-
parameters.setReOptimizeCurativeRangeActions(config.getBooleanProperty(RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS, DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS));
6857
parameters.setHintFromFirstPreventiveRao(config.getBooleanProperty(HINT_FROM_FIRST_PREVENTIVE_RAO, DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO));
6958

7059
});
@@ -78,13 +67,6 @@ public static ExecutionCondition getSecondPreventiveExecutionCondition(RaoParame
7867
return DEFAULT_EXECUTION_CONDITION;
7968
}
8069

81-
public static boolean getSecondPreventiveReOptimizeCurativeRangeActions(RaoParameters parameters) {
82-
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
83-
return parameters.getExtension(OpenRaoSearchTreeParameters.class).getSecondPreventiveRaoParameters().getReOptimizeCurativeRangeActions();
84-
}
85-
return DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS;
86-
}
87-
8870
public static boolean getSecondPreventiveHintFromFirstPreventiveRao(RaoParameters parameters) {
8971
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
9072
return parameters.getExtension(OpenRaoSearchTreeParameters.class).getSecondPreventiveRaoParameters().getHintFromFirstPreventiveRao();

ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/json/JsonRaoParametersTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ void roundTrip() throws IOException {
7979
searchTreeParameters.getMultithreadingParameters().setAvailableCPUs(21);
8080
// Second preventive RAO parameters
8181
searchTreeParameters.getSecondPreventiveRaoParameters().setExecutionCondition(SecondPreventiveRaoParameters.ExecutionCondition.POSSIBLE_CURATIVE_IMPROVEMENT);
82-
searchTreeParameters.getSecondPreventiveRaoParameters().setReOptimizeCurativeRangeActions(true);
8382
searchTreeParameters.getSecondPreventiveRaoParameters().setHintFromFirstPreventiveRao(true);
8483
// Not optimized cnecs parameters
8584
parameters.getNotOptimizedCnecsParameters().setDoNotOptimizeCurativeCnecsForTsosWithoutCras(false);

0 commit comments

Comments
 (0)