New model definition YAML structure #484
Replies: 3 comments
-
Summary of discussion just now: Definitions as listsStay with dicts of dicts, and leave pydantic aside for now. Top-level parametersUse the proposed syntax, but allow single-value definitions:
This internally gets magically turned into:
Multiple carriers / CostsA separate top-level config to say which parameters are lookup tables and optionally what their dims are (in any case, these should never become Pyomo objects - so good to treat them separately). Then processing any parameter would go through:
Costs could be dealt with slightly different in the "make-it-a-dict-magic" case: a cost could get a default This could all be embedded in the schema, but the schema cannot be easily appended by users? LinksStill needs more thought. One idea worth thinking more about is to use named links but track their flows separately, e.g. with an unconstrained |
Beta Was this translation helpful? Give feedback.
-
A few thoughts on links: Define in own top-level keylink_techs:
foo: # force explicit naming of a link
from: A
to: B
distance: 10
one_way: false
flow_in_eff: 0.95
flow_cap_max: 100 Advantages:
Disadvantages:
Define link in top-level key, referencing transmission techslinks:
foo: # force explicit naming of a link
from: A
to: B
distance: 10
one_way: false
tech: ac_transmission
techs:
ac_transmission:
parent: transmission
flow_in_eff: 0.95
flow_cap_max: 100 Advantages:
Disadvantages:
Define link in top-level key, referencing transmission techs in their own top-level-keylinks:
foo: # force explicit naming of a link
from: A
to: B
distance: 10
one_way: false
tech: ac_transmission
link_techs:
ac_transmission:
parent: transmission
flow_in_eff: 0.95
flow_cap_max: 100 Advantages:
Disadvantages:
Define links at nodes(could also be any of the other above ideas) nodes:
A:
links:
foo: # force explicit naming of a link
to: B
distance: 10
one_way: false
flow_in_eff: 0.95
flow_cap_max: 100 Advantages:
Disadvantages:
Do we need
|
Beta Was this translation helpful? Give feedback.
-
We have introduced our new YAML syntax in v0.7. Our pre-release documentation details all the decisions made w.r.t. a new YAML model definition structure. |
Beta Was this translation helpful? Give feedback.
-
This is something we've gone over a number of times in different issues (#362 , #483 , #452 , #324), so I thought I would move it to a discussion topic to consolidate different ideas and introduce new ones.
definitions as lists
This is something we were quite keen on in #362 , moving from:
to:
However, it makes overriding the model definition quite difficult. When doing the overriding, we have to search through the loaded lists for matching IDs and then apply the overrides to the dictionary contained in that list item. It is much more straightforward to use existing attrdict
union
functionality to achieve the same result, but with IDs as keys...Perhaps if we move to loading the model definition in as pydantic objects, then lists of dicts would make more sense.
Top-level parameters
Introduced as an possibility in #452, I've since looked into it and had to change the syntax proposal. It is not possible to have tuples in the YAML and it is not possible to have a list as a key. So the proposed syntax changes from:
to:
It is also straightforward to add a new dimension to the model this way:
Multiple carriers
As I have proposed in #483, carriers could be limited to
_in
/_out
as single values or lists of values. The same syntax as for top-level parameters could be applied at the tech-level to handle carrier-specific parameter values:This parameter structure could then be how the data is handled internally, converting the above into the below by prepending the tech name to
index
items andtechs
todims
:Costs
Costs always need to be linked to a cost class, and this could be done with the proposed parameter syntax, too:
Or, if defining multiple carriers:
The YAML schema could enforce that cost parameters are dictionaries with the keys "data", "index" and "dims", and that "dims" must contain "costs".
Links
I still don't have a clear idea of how to proceed on this, since it is perhaps less about how the user defines links, but how they are then structured within the processed model data. At any rate, the parameter definition approach described here would also work within
link_tech
andlink
definition. Otherwise, I would refer to #324 for now.Beta Was this translation helpful? Give feedback.
All reactions