| @@ 297-321 (lines=25) @@ | ||
| 294 | return Constraint(block.MINUPTIMEFLOWS, m.TIMESTEPS, rule=_min_uptime_rule) |
|
| 295 | ||
| 296 | ||
| 297 | def _shutdown_constraint(block): |
|
| 298 | r""" |
|
| 299 | .. math:: |
|
| 300 | Y_{shutdown}(t) \geq Y_{status}(t-1) - Y_{status}(t) \\ |
|
| 301 | \forall t \in \textrm{TIMESTEPS}, \\ |
|
| 302 | \forall \textrm{SHUTDOWNFLOWS}. |
|
| 303 | """ |
|
| 304 | m = block.parent_block() |
|
| 305 | ||
| 306 | def _shutdown_rule(_, i, o, t): |
|
| 307 | """Rule definition for shutdown constraints of non-convex flows.""" |
|
| 308 | if t > m.TIMESTEPS.at(1): |
|
| 309 | expr = ( |
|
| 310 | block.shutdown[i, o, t] |
|
| 311 | >= block.status[i, o, t - 1] - block.status[i, o, t] |
|
| 312 | ) |
|
| 313 | else: |
|
| 314 | expr = ( |
|
| 315 | block.shutdown[i, o, t] |
|
| 316 | >= m.flows[i, o].nonconvex.initial_status |
|
| 317 | - block.status[i, o, t] |
|
| 318 | ) |
|
| 319 | return expr |
|
| 320 | ||
| 321 | return Constraint(block.SHUTDOWNFLOWS, m.TIMESTEPS, rule=_shutdown_rule) |
|
| 322 | ||
| 323 | ||
| 324 | def _startup_constraint(block): |
|
| @@ 333-346 (lines=14) @@ | ||
| 330 | """ |
|
| 331 | m = block.parent_block() |
|
| 332 | ||
| 333 | def _startup_rule(_, i, o, t): |
|
| 334 | """Rule definition for startup constraint of nonconvex flows.""" |
|
| 335 | if t > m.TIMESTEPS.at(1): |
|
| 336 | expr = ( |
|
| 337 | block.startup[i, o, t] |
|
| 338 | >= block.status[i, o, t] - block.status[i, o, t - 1] |
|
| 339 | ) |
|
| 340 | else: |
|
| 341 | expr = ( |
|
| 342 | block.startup[i, o, t] |
|
| 343 | >= block.status[i, o, t] |
|
| 344 | - m.flows[i, o].nonconvex.initial_status |
|
| 345 | ) |
|
| 346 | return expr |
|
| 347 | ||
| 348 | return Constraint(block.STARTUPFLOWS, m.TIMESTEPS, rule=_startup_rule) |
|
| 349 | ||