calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
287 stars 93 forks source link

Add reserve margin constraints #517

Open FraSanvit opened 11 months ago

FraSanvit commented 11 months ago

Summary of changes in this pull request:

Reviewer checklist:

Open questions:

jmorrisnrel commented 9 months ago

I finally got a chance to review this functionality. Looking at the code the math of the constraints seems to make sense although I've been getting a number of errors/issues with running tests. I've included the simple model I've been using to test the behavior consisting of a flat 20MW demand and one supply generation capex tech. Perhaps I’m misusing the constraints or didn’t set up my environment correctly but some of the issues are definitely in the PR code here.

Planning reserve share isn't behaving like I'd expect: Example: Putting a target_reserve_share_equals of 0.5 in a system with flat 20MW demand and a single generator, I would expect the resulting capacity to be 30 MW representing (1+0.5)x the peak load of 20MW (assuming a default cap_value of 1.0). Instead I get 10MW of generation capacity. When I specify the tech in the group definition it drops the resulting capacity of the generator to 0 and doesn't meet any demand.

Other constraints throw a Pyomo error including the operating constraints:

target_reserve_abs_min/max/equals and target_reserve_adder_min/max/equals all throw an AttributeError when I try and include all loc/techs by leaving those filters blank or include techs in the group definition

The operating constraints likely fail because there is no default value set for the operating_reserve parameter in defaults.yaml

target_reserve_share_operating_min:

If I set the operating_reserve to 0 (just representing a flat reserve) I get similar strange behavior with the resulting capacities. Setting reserve_share_operating_equals to 0.5 I would similarly expect 30MW but instead get 0.5 kW. And a similar story of 20MW if I use _min.

target_reserve_abs_operating_min/max/equals has the same AttributeError as the planning reserve constraints. inputs.zip

FraSanvit commented 9 months ago

Hi @jmorrisnrel! I've created a repo with examples and a detailed guide on using the new functionalities. Also, I've tidied up and fixed some minor issues in the branch. Hope this can help.