GenXProject / GenX.jl

GenX: a configurable power system capacity expansion model for studying low-carbon energy futures. More details at : https://genx.mit.edu
https://genxproject.github.io/GenX.jl/
GNU General Public License v2.0
256 stars 105 forks source link

Add can_retire validation for multi-stage optimization #683

Closed lbonaldo closed 2 months ago

lbonaldo commented 2 months ago

Description

The current implementation of multi-stage optimization doesn't allow a resource to switch from can_retire = 0 to can_retire = 1 between stages. This PR adds a validation check on the can_retire flag and throws an error if necessary.

What type of PR is this? (check all applicable)

Checklist

How this can be tested

By running the multi-stage example with can_retire = 0 for some resources in stage = 1, and then switching to can_retire = 1 in stage = 2.

Post-approval checklist for GenX core developers

After the PR is approved

lbonaldo commented 2 months ago

The current multi-stage implementation utilizes the RET_CAP set to create variables for keeping track of retired capacity across all stages. If there is a change in this set between two stages, this function will throw an exception if a key is not found between the current and previous stages.