Skip to content

Commit b0e063f

Browse files
authored
feat(time coupled): Change lead and lag time handling (#1681)
* stop forcing P to go through Pmin for generators with lead/lag going through startup/shutdown Signed-off-by: CHEN Roxane <roxane.chen@rte-france.com>
1 parent eee7f49 commit b0e063f

14 files changed

Lines changed: 774 additions & 207 deletions

File tree

docs/algorithms/castor/linear-problem/time-coupled-constraints/generator-constraints-filler.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,6 @@ $$- \epsilon_{P}^{\text{OFF}} T_{\textcolor{red}{\text{OFF}} \to \textcolor{red}
151151

152152
#### OFF to ON transition
153153

154-
##### With lead time
155-
156-
With a lead time, the generator must first step up to $P_{\min}$ before to be operated between $P_{\min}$ and $P_{\max}$
157-
under the power gradient constraints.
158-
159-
$$\left ( P_{\min}(g, t + \Delta_{\tau}) - \epsilon_{P}^{\text{OFF}} \right ) T_{\textcolor{red}{\text{OFF}} \to \textcolor{green}{\text{ON}}}(g,s,t) \leq P(g,s,t + \Delta_{\tau}) - P(g,s,t) \leq P_{\min}(g, t + \Delta_{\tau}) T_{\textcolor{red}{\text{OFF}} \to \textcolor{green}{\text{ON}}}(g,s,t)$$
160-
161-
##### Without lead time
162-
163154
$$\left ( P_{\min}(g, t + \Delta_{\tau}) - \epsilon_{P}^{\text{OFF}} \right ) T_{\textcolor{red}{\text{OFF}} \to \textcolor{green}{\text{ON}}}(g,s,t) \leq P(g,s,t + \Delta_{\tau}) - P(g,s,t) \leq \left ( P_{\min}(g, t + \Delta_{\tau}) + \nabla^{+}(g) \Delta_{\tau} \right ) T_{\textcolor{red}{\text{OFF}} \to \textcolor{green}{\text{ON}}}(g,s,t)$$
164155

165156
#### ON to ON transition
@@ -168,15 +159,6 @@ $$\nabla^{-}(g) \Delta_{\tau} T_{\textcolor{green}{\text{ON}} \to \textcolor{gre
168159

169160
#### ON to OFF transition
170161

171-
##### With lag time
172-
173-
With a lag time, the generator must step down from $P_{\min}$ to 0 instead of being shut down from any power value above
174-
$P_{\min}$.
175-
176-
$$- P_{\min}(g, t) T_{\textcolor{green}{\text{ON}} \to \textcolor{red}{\text{OFF}}}(g,s,t) \leq P(g,s,t + \Delta_{\tau}) - P(g,s,t) \leq - \left ( P_{\min}(g, t) - \epsilon_{P}^{\text{OFF}} \right ) T_{\textcolor{green}{\text{ON}} \to \textcolor{red}{\text{OFF}}}(g,s,t)$$
177-
178-
##### Without lag time
179-
180162
$$- \left ( P_{\min}(g, t) - \nabla^{-}(g) \Delta_{\tau} \right) T_{\textcolor{green}{\text{ON}} \to \textcolor{red}{\text{OFF}}}(g,s,t) \leq P(g,s,t + \Delta_{\tau}) - P(g,s,t) \leq - \left ( P_{\min}(g, t) - \epsilon_{P}^{\text{OFF}} \right ) T_{\textcolor{green}{\text{ON}} \to \textcolor{red}{\text{OFF}}}(g,s,t)$$
181163

182164
### C8 - Shut down prohibited

ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/GeneratorConstraintsFiller.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,25 +325,14 @@ private void addPowerVariationConstraints(LinearProblem linearProblem,
325325
generatorConstraints.getGeneratorId(), timestamp, LinearProblem.GeneratorState.OFF, LinearProblem.GeneratorState.ON
326326
);
327327
powerTransitionConstraintInf.setCoefficient(offOnTransitionVariable, -(nextPMin - OFF_POWER_THRESHOLD));
328-
if (generatorConstraints.getLeadTime().isPresent()) {
329-
// if the generator has a lead time, ON state starts at Pmin on a timestamp before power increases
330-
powerTransitionConstraintSup.setCoefficient(offOnTransitionVariable, -nextPMin);
331-
} else {
332-
// otherwise the power is simply constrained by the power gradient
333-
powerTransitionConstraintSup.setCoefficient(offOnTransitionVariable, -nextPMin - upwardPowerGradient * timestampDuration);
334-
}
328+
powerTransitionConstraintSup.setCoefficient(offOnTransitionVariable, -nextPMin - upwardPowerGradient * timestampDuration);
335329

336330
// ON -> OFF
337331
OpenRaoMPVariable onOffTransitionVariable = linearProblem.getGeneratorStateTransitionVariable(
338332
generatorConstraints.getGeneratorId(), timestamp, LinearProblem.GeneratorState.ON, LinearProblem.GeneratorState.OFF
339333
);
340-
if (lagTimeWithLeadTime.isPresent()) {
341-
// if the generator has a lag time, ON state finishes at Pmin on a timestamp before power decreases
342-
powerTransitionConstraintInf.setCoefficient(onOffTransitionVariable, pMin);
343-
} else {
344-
// otherwise the power is simply constrained by the power gradient
345-
powerTransitionConstraintInf.setCoefficient(onOffTransitionVariable, pMin - downwardPowerGradient * timestampDuration);
346-
}
334+
335+
powerTransitionConstraintInf.setCoefficient(onOffTransitionVariable, pMin - downwardPowerGradient * timestampDuration);
347336
powerTransitionConstraintSup.setCoefficient(onOffTransitionVariable, pMin - OFF_POWER_THRESHOLD);
348337
}
349338

ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/GeneratorConstraintsFillerTest.java

Lines changed: 85 additions & 31 deletions
Large diffs are not rendered by default.

ra-optimisation/search-tree-rao/src/test/resources/network/6Nodes.xiidm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<iidm:property name="geographicalName" value="BE1"/>
88
</iidm:bus>
99
</iidm:busBreakerTopology>
10-
<iidm:generator id="BBE1AA1 _generator" energySource="OTHER" minP="-9000.0" maxP="9000.0" voltageRegulatorOn="true" targetP="0.0" targetV="400.0" targetQ="0.0" bus="BBE1AA1 " connectableBus="BBE1AA1 ">
10+
<iidm:generator id="BBE1AA1 _generator" energySource="OTHER" minP="100.0" maxP="9000.0" voltageRegulatorOn="true" targetP="0.0" targetV="400.0" targetQ="0.0" bus="BBE1AA1 " connectableBus="BBE1AA1 ">
1111
<iidm:minMaxReactiveLimits minQ="-9000.0" maxQ="9000.0"/>
1212
</iidm:generator>
1313
</iidm:voltageLevel>

tests/src/test/resources/com/powsybl/openrao/tests/features/4_time_coupled/4_1_generator_constraints_ics.feature

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -227,41 +227,9 @@ Feature: 4.1: Time-coupled generator constraints with MARMOT with ICS files
227227
Then the functional cost for all timestamps is 3960
228228
Then the total cost for all timestamps is 26890.25
229229

230-
@fast @rao @dc @redispatching @marmot @costly
231-
Scenario: 4.1.6: Lead time and Pmin.
232-
The generator involved in the Belgian redispatching action has a 15 min lead time and must be operated at 1000 MW at
233-
2:30. Because of its lead time, it must be switched on at 1:30 and operated at its Pmin (100 MW), leading to a
234-
supplementary expense of 1000 in remedial actions for this generator. For grid balancing reasons, the French
235-
generator must be switched off thus doubling the expenses.
236-
StartUp is allowed for BBE2, Shutdown is allowed for FFR1.
237-
Given network files are in folder "epic93/TestCases_93_2_6"
238-
Given crac file is "epic93/cbcora_93_2_6.xml"
239-
Given ics static file is "epic93/static_93_2_6.csv"
240-
Given ics series file is "epic93/series_93_2_6.csv"
241-
Given configuration file is "epic93/RaoParameters_minCost_megawatt_dc.json"
242-
Given time-coupled rao inputs for CORE are:
243-
| Timestamp | Network |
244-
| 2019-01-08 00:30 | 2Nodes_0030.uct |
245-
| 2019-01-08 01:30 | 2Nodes_0130.uct |
246-
| 2019-01-08 02:30 | 2Nodes_0230.uct |
247-
When I launch marmot
248-
# Timestamp 00:30:
249-
Then the functional cost for timestamp "2019-01-08 00:30" is 0.0
250-
Then the preventive power of generator "RD_RA_BE_BBE2AA1_GENERATOR" at timestamp "2019-01-08 00:30" is 0.0 MW
251-
Then the preventive power of generator "RD_RA_FR_FFR1AA1_GENERATOR" at timestamp "2019-01-08 00:30" is 1000.0 MW
252-
# Timestamp 01:30: 10 * 1000 MW * 2 generators
253-
Then the functional cost for timestamp "2019-01-08 01:30" is 2000.0
254-
Then the preventive power of generator "RD_RA_BE_BBE2AA1_GENERATOR" at timestamp "2019-01-08 01:30" is 100.0 MW
255-
Then the preventive power of generator "RD_RA_FR_FFR1AA1_GENERATOR" at timestamp "2019-01-08 01:30" is 900.0 MW
256-
# Timestamp 02:30: 10 * 1000 MW * 2 generators
257-
Then the functional cost for timestamp "2019-01-08 02:30" is 20000.0
258-
Then the functional cost for all timestamps is 22000.0
259-
Then the preventive power of generator "RD_RA_BE_BBE2AA1_GENERATOR" at timestamp "2019-01-08 02:30" is 1000.0 MW
260-
Then the preventive power of generator "RD_RA_FR_FFR1AA1_GENERATOR" at timestamp "2019-01-08 02:30" is 0.0 MW
261-
262230
# TODO to be modified when check on generator constraint is performed at import
263231
@fast @rao @dc @redispatching @marmot @costly
264-
Scenario: 4.1.7: Inconsistent data : BE generator's program shuts down even though shutDown is not allowed,
232+
Scenario: 4.1.6: Inconsistent data : BE generator's program shuts down even though shutDown is not allowed,
265233
FR generator's program starts up even though startUp is not allowed.
266234
Given network files are in folder "epic93/TestCases_93_2_6"
267235
Given crac file is "epic93/cbcora_93_2_6.xml"

0 commit comments

Comments
 (0)