Skip to content

Commit

Permalink
adapt to parameters v3
Browse files Browse the repository at this point in the history
Signed-off-by: Godelaine de Montmorillon <[email protected]>
  • Loading branch information
Godelaine committed Feb 7, 2025
2 parents 24e15c4 + 17e061f commit de34301
Show file tree
Hide file tree
Showing 305 changed files with 15,758 additions and 13,406 deletions.
9 changes: 9 additions & 0 deletions commons/src/main/java/com/powsybl/openrao/commons/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public String toString() {
return symbol;
}

public static Unit getEnum(String value) {
for (Unit v : values()) {
if (v.toString().equals(value)) {
return v;
}
}
throw new IllegalArgumentException();
}

public void checkPhysicalParameter(PhysicalParameter requestedPhysicalParameter) {
if (!requestedPhysicalParameter.equals(physicalParameter)) {
throw new OpenRaoException(String.format("%s Unit is not suited to measure a %s value.", this.toString(), requestedPhysicalParameter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ void testExportPreventivePureMnec() {

mockCnecResult(cnec1, 80, 20, 200, .1);

raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT);
raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN);
raoParameters.getObjectiveFunctionParameters().setUnit(Unit.MEGAWATT);
CneHelper cneHelper = new CneHelper(crac, raoResult, properties, CORE_CNE_EXPORT_PROPERTIES_PREFIX);
CoreCneCnecsCreator cneCnecsCreator = new CoreCneCnecsCreator(cneHelper, new MockCracCreationContext(crac));

Expand Down Expand Up @@ -272,7 +273,8 @@ void testExportPreventiveCnecAndMnec() {

mockCnecResult(cnec1, 80, 20, 200, .1);

raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT);
raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN);
raoParameters.getObjectiveFunctionParameters().setUnit(Unit.MEGAWATT);
CneHelper cneHelper = new CneHelper(crac, raoResult, properties, CORE_CNE_EXPORT_PROPERTIES_PREFIX);
CoreCneCnecsCreator cneCnecsCreator = new CoreCneCnecsCreator(cneHelper, new MockCracCreationContext(crac));

Expand Down
2 changes: 1 addition & 1 deletion docs/castor/linear-problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ $$\begin{equation}
\max MM - \sum_{lra \in \mathcal{LRA}} \Delta_{lra} c^{LRA}
\end{equation}$$

with $MM$ the minimum margin, $\mathcal{LRA}$ the set of LRAs, $\Delta_{lra}$ the variation of setpoint of the LRA $lra$, and $c^{LRA}$ the penalty cost (see [pst-penalty-cost](/parameters.md#pst-penalty-cost), [hvdc-penalty-cost](/parameters.md#hvdc-penalty-cost), and [injection-ra-penalty-cost](/parameters.md#injection-ra-penalty-cost)).
with $MM$ the minimum margin, $\mathcal{LRA}$ the set of LRAs, $\Delta_{lra}$ the variation of setpoint of the LRA $lra$, and $c^{LRA}$ the penalty cost (see [pst-ra-min-impact-threshold](/parameters.md#pst-ra-min-impact-threshold), [hvdc-ra-min-impact-threshold](/parameters.md#hvdc-ra-min-impact-threshold), and [injection-ra-min-impact-threshold](/parameters.md#injection-ra-min-impact-threshold)).

This way, if two solutions provide (almost) the same minimum margin, the problem will favor the one that changes the setpoints the
least.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ And $PTDF_{zTos}(z1, c)$, the zone-to-slack PTDF of bidding zone $z1$ on CNEC $c

| 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 |
| [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
6 changes: 2 additions & 4 deletions docs/output-data/core-cne/java-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ properties.setProperty("rao-result.export.core-cne.receiver-id", "RECEIVER_ID");
properties.setProperty("rao-result.export.core-cne.receiver-role", "A36"); // CAPACITY_COORDINATOR
properties.setProperty("rao-result.export.core-cne.time-interval", "2021-10-30T22:00Z/2021-10-31T23:00Z");
switch (raoParameters.getObjectiveFunctionParameters().getType()) {
case MAX_MIN_RELATIVE_MARGIN_IN_AMPERE -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "true");
case MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "true");
case MAX_MIN_MARGIN_IN_AMPERE -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "false");
case MAX_MIN_MARGIN_IN_MEGAWATT -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "false");
case MAX_MIN_RELATIVE_MARGIN -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "true");
case MAX_MIN_MARGIN -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "false");
}
if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) {
properties.setProperty("rao-result.export.core-cne.with-loop-flows", "true");
Expand Down
2 changes: 1 addition & 1 deletion docs/output-data/rao-result/execution-details.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This field can either contain information about the failure when the RAO fails, or macro information about which steps the [CASTOR RAO](/castor.md#algorithm) executed when it did not fail.
(See also: [Forbidding cost increase](/parameters.md#forbid-cost-increase), [Second preventive RAO parameters](/parameters.md#second-preventive-rao-parameters))
(See also: [Second preventive RAO parameters](/parameters.md#second-preventive-rao-parameters))

Note: This field replaced the optimizationStepsExecuted field.

Expand Down
Loading

0 comments on commit de34301

Please sign in to comment.