calliope-project / calliope

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

`flow_eff` -> `flow_in_eff` and `flow_out_eff` #512

Closed brynpickering closed 11 months ago

brynpickering commented 11 months ago

Allow for input and output flows to have different efficiencies (mostly useful for storage techs, but also conversion).

I did try to expand this to cover capacities too (see https://github.com/calliope-project/calliope/tree/add_in_out_params), but this leads to a lot of additional verbosity and base math for what I came to realise was little additional benefit.

The beenfit generally of splitting out in and out is that in reality there are technologies that work that way (conversion technologies that have a limit on e.g., biofuel flows in as well as on heat output; storage technologies with different charge capacities to discharge capacities; transmission links with different NTCs in each direction). However, expanding everything to account for flow_in_cap and flow_out_cap is cumbersome.

Hopefully it will be possible to at least set a different rated capacity for different carriers with the intro of #484, which would cover conversion techs. However, for storage / transmission techs (same in and out carrier), the issue still remains.

introducing flow_in_cap and flow_out_cap in custom math

It should be possible, for storage techs, to not define flow_cap_max and then to define instead one's own flow_in_cap_max and flow_out_cap_max and introduce that as the constraining params for input and output flows (although flow_cap will still be linked to flow_out, requiring careful consideration when applying costs).

For transmission techs, flow_cap is forced to be the same in both directions so it again would be somewhat meaningless if introducing flow_in_cap_max and flow_out_cap_max. The custom math might also be hard as you need to do it per link, so need to write the custom math per link tech (tech_name:remote_node) and make sure you're getting flow_in (export) and flow_out (import) the right way around!

Summary of changes in this pull request:

Reviewer checklist:

codecov[bot] commented 11 months ago

Codecov Report

Merging #512 (1e69f10) into main (3779e0d) will increase coverage by 0.21%. Report is 1 commits behind head on main. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
+ Coverage   93.21%   93.42%   +0.21%     
==========================================
  Files          28       28              
  Lines        3817     3804      -13     
  Branches      877      873       -4     
==========================================
- Hits         3558     3554       -4     
+ Misses        168      162       -6     
+ Partials       91       88       -3     
Files Coverage Δ
src/calliope/backend/backend_model.py 97.47% <100.00%> (+0.01%) :arrow_up:
src/calliope/backend/where_parser.py 97.67% <100.00%> (ø)
src/calliope/core/model.py 93.75% <100.00%> (+0.03%) :arrow_up:
src/calliope/preprocess/checks.py 85.16% <100.00%> (ø)
src/calliope/preprocess/model_run.py 91.82% <ø> (ø)
src/calliope/preprocess/nodes.py 93.75% <100.00%> (+3.17%) :arrow_up:

... and 1 file with indirect coverage changes