calliope-project / calliope

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

Custom math examples #502

Closed brynpickering closed 8 months ago

brynpickering commented 8 months ago

Fixes issue(s) #424

TODO: inject into the documentation somehow alongside YAML snippets to set up a model that can use them.

NOTE: none of the tests actually optimise the problem, I'm basing them working on the LP files looking right for the math I expect. When running alongside the base math, there's likely to be clashes between constraints that requires deactivating base math / updating where strings.

Summary of changes in this pull request:

Reviewer checklist:

codecov[bot] commented 8 months ago

Codecov Report

Merging #502 (5a14185) into main (34a38f7) will increase coverage by 0.01%. Report is 1 commits behind head on main. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #502      +/-   ##
==========================================
+ Coverage   92.36%   92.38%   +0.01%     
==========================================
  Files          32       32              
  Lines        4089     4098       +9     
  Branches      964      966       +2     
==========================================
+ Hits         3777     3786       +9     
  Misses        197      197              
  Partials      115      115              
Files Coverage Δ
src/calliope/backend/expression_parser.py 95.44% <100.00%> (+0.07%) :arrow_up:
src/calliope/backend/helper_functions.py 98.00% <100.00%> (+0.03%) :arrow_up: