SpineOpt.jl icon indicating copy to clipboard operation
SpineOpt.jl copied to clipboard

Allow `user_constraints` to apply cumulatively over a range of time slices

Open DillonJ opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Currently user_constraints only apply to a single timeslice. The timeslice will be the lowest resolution timeslice of all the variables involved in the constraint.

Describe the solution you'd like We would like the possibility of creating a user_constraint that applies cumulatively over a range of timeslices. A simple way of doing this from a user point of view would be to allow a user_constraint__temporal_block relationship and this would then define the temporal resolution of the constraint where the LHS would be a sum over all timeslices in the related temporal_block

Describe alternatives you've considered There is a workaround that works very nicely... if you have any variable in the model that has a temporal resolution over which you want the user_constraint to apply, you can invlove that variable and give it a coefficient of zero in the constraint. For example, if your model has an investment temporal_block that spans the full year, you could define a unit__user_constraint relationship for an investment unit and set units_invested_available_coefficient to zero and this will have the desired effect. In fact, one could create a dummy unit with no flows and only an investment variable that could be used precisely for this purpose.

DillonJ avatar Oct 19 '23 06:10 DillonJ