odys.optimization.formulations.commitment¶
The shared on/off model of generators and flexible loads (CommitmentFormulation), a reusable part both formulations compose: the status, start-up and shut-down indicators, and the minimum up and down times. Variable and constraint names carry the entity dimension as a prefix.
The constraints are written out on the Generators formulation page, and their flexible-load use in FL-2.
See also Commitment for the domain model and entity_arrays for the parameter arrays.
On/off logic shared by every entity type that can be switched on and off (generators, flexible loads).
CommitmentFormulation
¶
The on/off model of one entity type that can be switched on and off, composed by that type's formulation.
It is a reusable part, not a Formulation: it holds no variables (the
composing formulation does, and passes them in). Variable and constraint
names are prefixed with the dimension name ("generator", "flexible_load").
The status is 1 when the entity is on; a startup (shutdown) is 1 at the
step it turns on (off), counted from its initial status at t=0.
Source code in src/odys/optimization/formulations/commitment.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
dimension
property
¶
Return the dimension the entities are indexed along.
__init__(coordinates, states, context)
¶
Initialize the on/off model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
Coordinates
|
The labels of the entities along their dimension, which also names them. |
required |
states
|
CommitmentStateArrays
|
The minimum times in steps and the initial status of the entities. |
required |
context
|
ModelContext
|
The shared indexing of the problem. |
required |
Source code in src/odys/optimization/formulations/commitment.py
39 40 41 42 43 44 45 46 47 48 49 | |
costs(variables, arrays)
¶
Return the startup and shutdown cost at each step of each entity, in currency.
Source code in src/odys/optimization/formulations/commitment.py
171 172 173 174 175 176 | |
create_variables(model)
¶
Add the binary status, startup and shutdown indicators per scenario, time and entity.
Source code in src/odys/optimization/formulations/commitment.py
60 61 62 63 64 65 66 67 | |
initial_min_downtime_constraint(variables)
¶
An entity off for less than its minimum down time before the horizon does not start at t=0.
Source code in src/odys/optimization/formulations/commitment.py
161 162 163 164 165 | |
initial_min_uptime_constraint(variables)
¶
An entity on for less than its minimum up time before the horizon does not shut down at t=0.
Source code in src/odys/optimization/formulations/commitment.py
155 156 157 158 159 | |
min_downtime_constraints(variables)
¶
Once stopped, an entity stays off for its minimum down time, counting time off before the horizon.
One constraint per entity: the steps off in each window of min_down_steps, plus the steps off before
the horizon that fall in it, cover the window whenever the entity starts after it.
Source code in src/odys/optimization/formulations/commitment.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
min_uptime_constraints(variables)
¶
Once started, an entity stays on for its minimum up time, counting time on before the horizon.
One constraint per entity: the steps on in each window of min_up_steps, plus the steps on before
the horizon that fall in it, cover the window whenever the entity shuts down after it.
Source code in src/odys/optimization/formulations/commitment.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
name(what)
¶
Return the model name of a variable or constraint of this entity type, such as generator_status.
Source code in src/odys/optimization/formulations/commitment.py
56 57 58 | |
previous_status(variables)
¶
Return the status one step earlier, the initial status at t=0.
Source code in src/odys/optimization/formulations/commitment.py
167 168 169 | |
shutdown_lower_bound_constraint(variables)
¶
Shutdown indicator active when turning off, from the initial status at t=0.
Source code in src/odys/optimization/formulations/commitment.py
90 91 92 93 94 95 | |
shutdown_upper_bound_1_constraint(variables)
¶
Shutdown indicator bounded by previous status.
Source code in src/odys/optimization/formulations/commitment.py
97 98 99 100 101 102 | |
shutdown_upper_bound_2_constraint(variables)
¶
Shutdown indicator bounded by current status.
Source code in src/odys/optimization/formulations/commitment.py
104 105 106 107 108 109 | |
startup_lower_bound_constraint(variables)
¶
Startup indicator active when turning on, from the initial status at t=0.
Source code in src/odys/optimization/formulations/commitment.py
69 70 71 72 73 74 | |
startup_upper_bound_1_constraint(variables)
¶
Startup indicator bounded by current status.
Source code in src/odys/optimization/formulations/commitment.py
76 77 78 79 80 81 | |
startup_upper_bound_2_constraint(variables)
¶
Startup indicator bounded by previous status.
Source code in src/odys/optimization/formulations/commitment.py
83 84 85 86 87 88 | |
CommitmentVariables
¶
Bases: BaseModel
Decision variables of switching on and off: the binary status, startup and shutdown indicators.
Source code in src/odys/optimization/formulations/commitment.py
19 20 21 22 23 24 25 26 | |