Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Costly optimization of range actions #1243

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
77 changes: 58 additions & 19 deletions docs/castor/linear-problem/core-problem-filler.md

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions docs/castor/linear-problem/discrete-pst-tap-filler.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ information [here](/input-data/crac/json.md#range-actions))

## Defined optimization variables

| Name | Symbol | Details | Type | Index | Unit | Lower bound | Upper bound |
|----------------------------------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------|---------|-----------------------------------------------------------------------------------------------|--------------------------|-------------|-------------|
| PstRangeAction tap upward variation | $\Delta t^{+} (r, s)$ | upward tap variation of PstRangeAction $r$, at state $s$, between two iterations of the optimisation | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit (number of taps) | 0 | $+\infty$ |
| PstRangeAction tap downward variation | $\Delta t^{-} (r, s)$ | downward tap variation of PstRangeAction $r$, at state $s$, between two iterations of the optimisation | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit (number of taps) | 0 | $+\infty$ |
| PstRangeAction tap upward variation binary | $\delta ^{+} (r, s)$ | indicates whether the tap of PstRangeAction $r$ has increased, at state $s$, between two iterations of the optimisation | Binary | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | 1 |
| PstRangeAction tap downward variation binary | $\delta ^{-} (r, s)$ | indicates whether the tap of PstRangeAction $r$ has decreased, at state $s$, between two iterations of the optimisation | Binary | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | 1 |
| Name | Symbol | Details | Type | Index | Unit | Lower bound | Upper bound |
|----------------------------------------------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------|--------------------------|-------------|-------------|
| PstRangeAction tap upward variation | $\Delta t^{+} (r, s)$ | upward tap variation of PstRangeAction $r$, at state $s$, between two iterations of the optimisation | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit (number of taps) | 0 | $+\infty$ |
| PstRangeAction tap downward variation | $\Delta t^{-} (r, s)$ | downward tap variation of PstRangeAction $r$, at state $s$, between two iterations of the optimisation | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit (number of taps) | 0 | $+\infty$ |
| PstRangeAction tap upward variation binary | $\delta ^{+} (r, s)$ | indicates whether the tap of PstRangeAction $r$ has increased, at state $s$, between two iterations of the optimisation | Binary | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | 1 |
| PstRangeAction tap downward variation binary | $\delta ^{-} (r, s)$ | indicates whether the tap of PstRangeAction $r$ has decreased, at state $s$, between two iterations of the optimisation | Binary | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | 1 |
| PstRangeAction tap | $\tau (r, s)$ | tap position of the PST of range action $r$ at state $s$ | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | min PST tap | max PST tap |
| Total PstRangeAction upward tap variation | $\Delta_{total} t^{+} (r, s)$ | total upward tap variation of PstRangeAction $r$, at state $s$, from the pre-perimeter tap position | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | $+\infty$ |
| Total PstRangeAction downward tap variation | $\Delta_{total} t^{-} (r, s)$ | total downward tap variation of PstRangeAction $r$, at state $s$, from the pre-perimeter tap position | Integer | One variable for every element of PstRangeActions and for evey state in which it is optimized | No unit | 0 | $+\infty$ |

## Used optimization variables

Expand Down Expand Up @@ -88,6 +91,18 @@ $c^{+}_{tap \rightarrow a}(r, s)$ (resp. $c^{-}_{tap \rightarrow a}(r, s)$) is s

<br>

### Tap variable

$$\tau(r, s) = \Delta t^{+} - \Delta t^{-} + t_{n}(r, s)$$

### Total tap variation

$$\Delta_{total} t^{+} (r, s) - \Delta_{total} t^{-} (r, s) = \tau(r, s) -
\begin{cases}
\tau(r, s') & \text{if $r$ was previously available at state $s'$}\\
t_{0}(r, s) & \text{otherwise}
\end{cases}$$

### Tap variation can only be in one direction, upward or downward

$$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ RaoResult runSecondPreventiveAndAutoRao(CastorContingencyScenarios castorConting
if (entry.getValue() instanceof SkippedOptimizationResultImpl) {
newPostContingencyResults.put(state, new SkippedOptimizationResultImpl(state, new HashSet<>(), new HashSet<>(), postCraSensitivityAnalysisOutput.getSensitivityStatus(entry.getKey()), raoParameters.getLoadFlowAndSensitivityParameters().getSensitivityFailureOvercost()));
} else {
newPostContingencyResults.put(state, new CurativeWithSecondPraoResult(state, entry.getValue(), secondPreventiveRaoResult.perimeterResult(), secondPreventiveRaoResult.remedialActionsExcluded(), postCraSensitivityAnalysisOutput));
newPostContingencyResults.put(state, new CurativeWithSecondPraoResult(state, entry.getValue(), secondPreventiveRaoResult.perimeterResult(), secondPreventiveRaoResult.remedialActionsExcluded(), postCraSensitivityAnalysisOutput, raoParameters.getObjectiveFunctionParameters().getType().costOptimization()));
}
}
RaoLogger.logMostLimitingElementsResults(BUSINESS_LOGS, postCraSensitivityAnalysisOutput, raoParameters.getObjectiveFunctionParameters().getType(), NUMBER_LOGGED_ELEMENTS_END_RAO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private BestTapFinder() {
/**
* This function computes the best tap positions for PstRangeActions that were optimized in the linear problem.
* It is a little smarter than just rounding the optimal angle to the closest tap position:
* if the optimal angle is close to the limit between two tap positions, it will chose the one that maximizes the
* if the optimal angle is close to the limit between two tap positions, it will choose the one that maximizes the
* minimum margin on the 10 most limiting elements (pre-optim)
* If virtual costs are an important part of the optimization, it is highly recommended to use APPROXIMATED_INTEGERS
* taps in the linear optimization, rather than relying on the best tap finder to round the taps.
Expand Down Expand Up @@ -157,7 +157,7 @@ static Map<Integer, Double> computeMinMarginsForBestTaps(Network network,
double approxLimitAngle = 0.5 * (closestAngle + otherAngle);
if (Math.abs(angle - approxLimitAngle) / Math.abs(closestAngle - otherAngle) < 0.15) {
// Angle is too close to the limit between two tap positions
// Chose the tap that maximizes the margin on the most limiting element
// Choose the tap that maximizes the margin on the most limiting element
Pair<Double, Double> margins = computeMinMargins(network, pstRangeAction, closestAngle, otherAngle, linearOptimizationResult, unit);
if (margins.getRight() > margins.getLeft()) {
return Map.of(closestTap, margins.getLeft(), otherTap, margins.getRight());
Expand Down
Loading
Loading