Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b752378
force global 2P
phiedw Mar 5, 2025
c833369
Merge branch 'main' into disable_non_global_2p
bqth29 Jun 23, 2025
7f313c4
fix after merge
bqth29 Jun 23, 2025
c403815
bump parameters to v3.2 and add changelog
bqth29 Jun 23, 2025
f016a76
Merge branch 'main' into disable_non_global_2p
bqth29 Jul 9, 2025
b52700b
fix tests
bqth29 Jul 9, 2025
f8f277e
add comments to getRaLimitationParameters
Godelaine Jul 17, 2025
17ec121
adapt 20.2.2 by using topo CRA to ensure CRA is kept in 2P now that 2…
Godelaine Jul 17, 2025
fb1b1b1
clean/ adapt US20_1
Godelaine Jul 17, 2025
9affbb4
merge main
Godelaine Jul 17, 2025
dc661da
fix merge
Godelaine Jul 17, 2025
eaad711
delete re-optimize everywhere
Godelaine Jul 17, 2025
ba69b6f
update parameter files
Godelaine Jul 17, 2025
f7271dd
update values far from ref
Godelaine Jul 18, 2025
cec47f3
Merge branch 'updateCucumber' into disable_non_global_2p
Godelaine Jul 18, 2025
baad35e
fix values
Godelaine Jul 18, 2025
d5b51d1
add UT to improve sonar
Godelaine Jul 21, 2025
8ecec2a
checkstyle
Godelaine Jul 21, 2025
6da91b4
improve sonar
Godelaine Jul 22, 2025
1bd7ec8
fix test
Godelaine Jul 22, 2025
f4ae7f7
more sonar
Godelaine Jul 22, 2025
ae1ab36
PR changes
Godelaine Aug 19, 2025
665cf43
merge main
Godelaine Aug 19, 2025
e92784e
Update ra-optimisation/search-tree-rao/src/main/java/com/powsybl/open…
Godelaine Aug 19, 2025
9ee22d9
Update ra-optimisation/search-tree-rao/src/test/java/com/powsybl/open…
Godelaine Aug 19, 2025
c1adfee
Update ra-optimisation/search-tree-rao/src/test/java/com/powsybl/open…
Godelaine Aug 19, 2025
6ea8ede
Merge branch 'main' into disable_non_global_2p
bqth29 Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/algorithms/castor/rao-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ The differences with the first preventive RAO are that, in this run:
- **curative remedial actions** that were selected in the curative perimeter are supposed activated*, in order for
the preventive RAO to focus on constraints that cannot be solved by curative actions.

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

![PATL vs TATL](../../_static/img/rao_steps.png){.forced-white-background}
1 change: 0 additions & 1 deletion docs/output-data/rao-logs/rao-business-warns.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ com.powsybl.openrao.commons.logs.RaoBusinessWarns
| 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. |
| 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. |
| 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. |
| 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. |
| 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 |
| 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. |
| 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. |
Expand Down
4 changes: 1 addition & 3 deletions docs/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Examples of rao parameters with business and implementation specific parameters
:::{group-tab} JSON
~~~json
{
"version" : "3.1",
"version" : "3.2",
"objective-function" : {
"type" : "SECURE_FLOW",
"unit" : "A",
Expand Down Expand Up @@ -83,7 +83,6 @@ Examples of rao parameters with business and implementation specific parameters
},
"second-preventive-rao" : {
"execution-condition" : "POSSIBLE_CURATIVE_IMPROVEMENT",
"re-optimize-curative-range-actions" : false,
"hint-from-first-preventive-rao" : true
},
"load-flow-and-sensitivity-computation" : {
Expand Down Expand Up @@ -191,7 +190,6 @@ search-tree-multi-threading:

search-tree-second-preventive-rao:
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
re-optimize-curative-range-actions: true
hint-from-first-preventive-rao: true

rao-not-optimized-cnecs:
Expand Down
3 changes: 1 addition & 2 deletions docs/parameters/business-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ See also: [Modelling the maximum minimum relative margin objective function](../
:::{group-tab} JSON
~~~json
{
"version" : "3.1",
"version" : "3.2",
"objective-function" : {
"type" : "SECURE_FLOW",
"unit" : "A",
Expand Down Expand Up @@ -223,7 +223,6 @@ search-tree-multi-threading:

search-tree-second-preventive-rao:
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
re-optimize-curative-range-actions: true
hint-from-first-preventive-rao: true

rao-not-optimized-cnecs:
Expand Down
13 changes: 1 addition & 12 deletions docs/parameters/implementation-specific-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,6 @@ These parameters (second-preventive-rao) tune the behaviour of the [second preve
- **MAX_MIN_MARGIN** or **MAX_MIN_RELATIVE_MARGIN**: 2nd preventive RAO is run if one curative perimeter reached an objective function value
after optimisation that is worse than the preventive perimeter's (decreased by [curative-min-obj-improvement](#curative-min-obj-improvement))

##### re-optimize-curative-range-actions
- **Expected value**: true/false
- **Default value**: false
- **Usage**:
- **false**: the 2nd preventive RAO will optimize only the preventive remedial actions, keeping **all** optimal
curative remedial actions selected during the curative RAO.
- **true**: the 2nd preventive RAO will optimize preventive remedial actions **and** curative range actions, keeping
only the optimal curative **topological** actions computed in the curative RAO.

##### hint-from-first-preventive-rao
- **Expected value**: true/false
- **Default value**: false
Expand Down Expand Up @@ -396,7 +387,7 @@ These parameters are meant to be used in costly optimization only.
:::{group-tab} JSON
~~~json
{
"version" : "3.1",
"version" : "3.2",
"extensions" : {
"open-rao-search-tree-parameters": {
"objective-function" : {
Expand Down Expand Up @@ -426,7 +417,6 @@ These parameters are meant to be used in costly optimization only.
},
"second-preventive-rao" : {
"execution-condition" : "POSSIBLE_CURATIVE_IMPROVEMENT",
"re-optimize-curative-range-actions" : false,
"hint-from-first-preventive-rao" : true
},
"load-flow-and-sensitivity-computation" : {
Expand Down Expand Up @@ -527,7 +517,6 @@ search-tree-multi-threading:

search-tree-second-preventive-rao:
execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT
re-optimize-curative-range-actions: true
hint-from-first-preventive-rao: true

search-tree-load-flow-and-sensitivity-computation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import com.powsybl.commons.Versionable;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.commons.util.ServiceLoaderCache;
import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters;
import com.powsybl.openrao.raoapi.parameters.extensions.SecondPreventiveRaoParameters;
import com.powsybl.tools.Version;

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

deprecateNonGlobalSecondPreventive(parameters);

return provider.run(raoInput, parameters, targetEndInstant);
}

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

deprecateNonGlobalSecondPreventive(parameters);

return provider.run(raoInput, parameters, targetEndInstant).join();
}

public void deprecateNonGlobalSecondPreventive(RaoParameters parameters) {
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
boolean reOptimizeCurativeRangeActions = SecondPreventiveRaoParameters.getSecondPreventiveReOptimizeCurativeRangeActions(parameters);
if (!reOptimizeCurativeRangeActions) {
BUSINESS_WARNS.warn("Non re-optimizing curative range actions is deprecated. Curative range actions re-optimization will be mandatory in a future OpenRAO version.");
}
}
}

public RaoResult run(RaoInput raoInput, RaoParameters parameters) {
return run(raoInput, parameters, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ public final class RaoParametersCommons {
private RaoParametersCommons() {
}

public static final String RAO_PARAMETERS_VERSION = "3.1";
/*
CHANGELOG RAO Parameters v3
---------------------------
3.1: remove max-auto-search-tree-depth
3.2: remove re-optimize-curative-range-actions
*/

public static final String RAO_PARAMETERS_VERSION = "3.2";

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

// Not optimized cnecs parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ private JsonSecondPreventiveRaoParameters() {
static void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator jsonGenerator) throws IOException {
jsonGenerator.writeObjectFieldStart(SECOND_PREVENTIVE_RAO);
jsonGenerator.writeObjectField(EXECUTION_CONDITION, parameters.getSecondPreventiveRaoParameters().getExecutionCondition());
jsonGenerator.writeBooleanField(RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS, parameters.getSecondPreventiveRaoParameters().getReOptimizeCurativeRangeActions());
jsonGenerator.writeBooleanField(HINT_FROM_FIRST_PREVENTIVE_RAO, parameters.getSecondPreventiveRaoParameters().getHintFromFirstPreventiveRao());
jsonGenerator.writeEndObject();
}
Expand All @@ -39,10 +38,6 @@ static void deserialize(JsonParser jsonParser, OpenRaoSearchTreeParameters searc
case EXECUTION_CONDITION:
searchTreeParameters.getSecondPreventiveRaoParameters().setExecutionCondition(stringToExecutionCondition(jsonParser.nextTextValue()));
break;
case RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS:
jsonParser.nextToken();
searchTreeParameters.getSecondPreventiveRaoParameters().setReOptimizeCurativeRangeActions(jsonParser.getBooleanValue());
break;
case HINT_FROM_FIRST_PREVENTIVE_RAO:
jsonParser.nextToken();
searchTreeParameters.getSecondPreventiveRaoParameters().setHintFromFirstPreventiveRao(jsonParser.getBooleanValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
*/
public class SecondPreventiveRaoParameters {
private static final ExecutionCondition DEFAULT_EXECUTION_CONDITION = ExecutionCondition.DISABLED;
private static final boolean DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS = true;
private static final boolean DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO = false;

private ExecutionCondition executionCondition = DEFAULT_EXECUTION_CONDITION;
private boolean reOptimizeCurativeRangeActions = DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS;
private boolean hintFromFirstPreventiveRao = DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO;

public enum ExecutionCondition {
Expand All @@ -38,10 +36,6 @@ public void setExecutionCondition(ExecutionCondition executionCondition) {
this.executionCondition = executionCondition;
}

public void setReOptimizeCurativeRangeActions(boolean reOptimizeCurativeRangeActions) {
this.reOptimizeCurativeRangeActions = reOptimizeCurativeRangeActions;
}

public void setHintFromFirstPreventiveRao(boolean hintFromFirstPreventiveRao) {
this.hintFromFirstPreventiveRao = hintFromFirstPreventiveRao;
}
Expand All @@ -50,10 +44,6 @@ public ExecutionCondition getExecutionCondition() {
return executionCondition;
}

public boolean getReOptimizeCurativeRangeActions() {
return reOptimizeCurativeRangeActions;
}

public boolean getHintFromFirstPreventiveRao() {
return hintFromFirstPreventiveRao;
}
Expand All @@ -64,7 +54,6 @@ public static SecondPreventiveRaoParameters load(PlatformConfig platformConfig)
platformConfig.getOptionalModuleConfig(SECOND_PREVENTIVE_RAO_SECTION)
.ifPresent(config -> {
parameters.setExecutionCondition(config.getEnumProperty(EXECUTION_CONDITION, ExecutionCondition.class, DEFAULT_EXECUTION_CONDITION));
parameters.setReOptimizeCurativeRangeActions(config.getBooleanProperty(RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS, DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS));
parameters.setHintFromFirstPreventiveRao(config.getBooleanProperty(HINT_FROM_FIRST_PREVENTIVE_RAO, DEFAULT_HINT_FROM_FIRST_PREVENTIVE_RAO));

});
Expand All @@ -78,13 +67,6 @@ public static ExecutionCondition getSecondPreventiveExecutionCondition(RaoParame
return DEFAULT_EXECUTION_CONDITION;
}

public static boolean getSecondPreventiveReOptimizeCurativeRangeActions(RaoParameters parameters) {
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
return parameters.getExtension(OpenRaoSearchTreeParameters.class).getSecondPreventiveRaoParameters().getReOptimizeCurativeRangeActions();
}
return DEFAULT_RE_OPTIMIZE_CURATIVE_RANGE_ACTIONS;
}

public static boolean getSecondPreventiveHintFromFirstPreventiveRao(RaoParameters parameters) {
if (parameters.hasExtension(OpenRaoSearchTreeParameters.class)) {
return parameters.getExtension(OpenRaoSearchTreeParameters.class).getSecondPreventiveRaoParameters().getHintFromFirstPreventiveRao();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ void roundTrip() throws IOException {
searchTreeParameters.getMultithreadingParameters().setAvailableCPUs(21);
// Second preventive RAO parameters
searchTreeParameters.getSecondPreventiveRaoParameters().setExecutionCondition(SecondPreventiveRaoParameters.ExecutionCondition.POSSIBLE_CURATIVE_IMPROVEMENT);
searchTreeParameters.getSecondPreventiveRaoParameters().setReOptimizeCurativeRangeActions(true);
searchTreeParameters.getSecondPreventiveRaoParameters().setHintFromFirstPreventiveRao(true);
// Not optimized cnecs parameters
parameters.getNotOptimizedCnecsParameters().setDoNotOptimizeCurativeCnecsForTsosWithoutCras(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,10 @@ void checkMultiThreadingConfig() {
void checkSecondPreventiveRaoConfig() {
MapModuleConfig secondPreventiveRaoModuleConfig = platformCfg.createModuleConfig("search-tree-second-preventive-rao");
secondPreventiveRaoModuleConfig.setStringProperty("execution-condition", "POSSIBLE_CURATIVE_IMPROVEMENT");
secondPreventiveRaoModuleConfig.setStringProperty("re-optimize-curative-range-actions", Objects.toString(false));
secondPreventiveRaoModuleConfig.setStringProperty("hint-from-first-preventive-rao", Objects.toString(true));
RaoParameters parameters = RaoParameters.load(platformCfg);
SecondPreventiveRaoParameters params = parameters.getExtension(OpenRaoSearchTreeParameters.class).getSecondPreventiveRaoParameters();
assertEquals(SecondPreventiveRaoParameters.ExecutionCondition.POSSIBLE_CURATIVE_IMPROVEMENT, params.getExecutionCondition());
assertFalse(params.getReOptimizeCurativeRangeActions());
assertTrue(params.getHintFromFirstPreventiveRao());
}

Expand Down
Loading
Loading