calliope-project / calliope

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

Feature: allow for complete math overrides #606

Open irm-codebase opened 2 weeks ago

irm-codebase commented 2 weeks ago

What can be improved?

As of now, builds custom math "on top" of the pre-defined math.

While this is good to simplify the way users interact with Calliope, it introduces problems in cases were the math needs to be heavily modified since users have to essentially look in two different places and are limited by what we put in the base math.

I'd like to propose a simple override were users introduce the "base" math file themselves (with no guarantees from our side).

This would make the library much more flexible, and may even allow others to discover improvements to our base math.

Version

v0.7

irm-codebase commented 2 weeks ago

To do so, here are the steps I've identified:

The general idea is to let users remove the base math and specify everything on their own, if they choose to do so.

brynpickering commented 2 weeks ago

This issue is related to two different things: base math overriding and easier access to the model definition schema.

The model definition schema only controls the definition of parameters, it has no bearing on the math or the config (they are both different schema files). Hence why it isn't really linked to overriding the base math.

brynpickering commented 2 weeks ago

The math and config schema should not be user-configurable in any way. Changes to those will likely cause things to break elsewhere.

irm-codebase commented 2 weeks ago

@brynpickering I agree that the config_schema.yaml and math_schema.yaml should not be altered by users. I think the confusion was caused because I'm unfamiliar with the names people often use for things.

This PR is only about model_def_schema.yaml (what you call the model definition schema) and base.yaml. When it comes to these, I disagree: if you are replacing base.yaml, you should also replace the parameter definitions!

It does not make sense to allow removing the math formulation constraints and still have presets on the parameter side. In reality, users going this way are likely to re-use a lot of it, but it still should be a separate file.

irm-codebase commented 1 week ago

I've introduced #609, which only targets skipping base math. Depending on what is agreed upon, I could work on a separate PR for the add_schema parameter.