switch-model / switch

A Modern Platform for Planning High-Renewable Power Systems
http://switch-model.org/
Other
129 stars 85 forks source link

Support predetermined builds after period start #137

Open staadecker opened 3 years ago

staadecker commented 3 years ago

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.

https://github.com/switch-model/switch/blob/60a59533a62fe7b50c931519765d3c2a998aedc5/switch_model/generators/core/build.py#L328-L332

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