Skip to content

Commit

Permalink
Merge branch 'main' into angle_monitoring_noglsk
Browse files Browse the repository at this point in the history
  • Loading branch information
RoxaneChen02 authored Jan 17, 2025
2 parents c6caedc + f85345a commit e0ffd48
Show file tree
Hide file tree
Showing 60 changed files with 3,884 additions and 191 deletions.
89 changes: 68 additions & 21 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 (number of taps) | 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 (number of taps) | 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

0 comments on commit e0ffd48

Please sign in to comment.