|
17 | 17 |
|
18 | 18 | from pyomo.environ import value |
19 | 19 |
|
| 20 | +from temoa.components.utils import get_adjusted_existing_capacity |
| 21 | + |
20 | 22 | if TYPE_CHECKING: |
21 | 23 | from collections.abc import Iterable |
22 | 24 |
|
@@ -440,14 +442,18 @@ def check_existing_capacity(model: TemoaModel) -> None: |
440 | 442 | ) |
441 | 443 | logger.warning(msg) |
442 | 444 | continue |
443 | | - if t not in model.tech_all: |
| 445 | + adjusted_cap = get_adjusted_existing_capacity(model, r, t, v) |
| 446 | + if adjusted_cap <= 0.0: |
| 447 | + # Was retired in a previous period (myopic mode) |
444 | 448 | continue |
| 449 | + p = model.time_optimize.first() |
445 | 450 | life = value(model.lifetime_process[r, t, v]) |
446 | | - if (r, t, v) not in model.process_periods and v + life > model.time_optimize.first(): |
| 451 | + if (r, t, v) not in model.process_periods and v + life > p: |
| 452 | + surviving_cap = adjusted_cap * value(model.lifetime_survival_curve[r, p, t, v]) |
447 | 453 | msg = ( |
448 | | - f'Existing capacity {r, t, v} with lifetime {life} and capacity {cap} ' |
449 | | - 'should extend into future periods but is not an active process. ' |
450 | | - 'May be missing from Efficiency table or too small to carry forward ' |
451 | | - 'if running in myopic mode.' |
| 454 | + f'Existing capacity {r, t, v} with lifetime {life} and surviving capacity ' |
| 455 | + f'{surviving_cap} should extend into future periods but is not an active ' |
| 456 | + 'process. It may be missing from the Efficiency table or have too little ' |
| 457 | + 'capacity to output and carry forward if running in myopic mode.' |
452 | 458 | ) |
453 | 459 | logger.warning(msg) |
0 commit comments