Description
Hello there!
I'm opening this issue so that we don't forget about something we recently discovered in the Switch code. We don't have time to fix it right now, however I'd like to keep track of it.
Currently if we have a period named 2020
and we have generation being pre-built in the year 2020
, the following code behaves unexpectedly.
switch/switch_model/generators/core/build.py
Lines 328 to 332 in 60a5953
When this function is called for generation being pre-built in the year 2020
, build_year in m.PERIODS
is true despite the project not being a period build. This means the project will retire sooner than normal (i.e. generation pre-built in 2020
will retire before generation pre-built in 2019
).
I don't think there's an easy fix to the problem as currently gen_build_costs.csv
doesn't differentiate between pre-built generation and investment builds so there's no way to differentiate between the two. The best course of action is likely to display a warning/error if pre-build years conflict with a period label.
I wonder if the switch code wasn't designed to have pre-build years after a period starts.
Thank you!
Martin