Skip to content

Commit

Permalink
Add triggers to the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
manuGil committed Sep 27, 2024
1 parent c9480e7 commit c6ecffa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configs/modelling-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ models: # list of models for the energy network
capacity: 1000
states:
initial_soc: 0.5
triggers: # list of triggers for the of another model??. It must be an input, output or state of the model
- capacity
- soc_min
scenario_data: 'path/to/file' #path to the scenario data file for the model. This should be optional
- name: Battery2
type: BatteryModel # models can reuse the same type
Expand Down
2 changes: 2 additions & 0 deletions configs/modelling_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def validate(self, data, _is_scenario_schema=True): # _is_scenario_schema is a f
"outputs": And(dict, len, error="if 'outputs' is used, it must contain at least one key-value pair"),
Optional("parameters"): And(dict, len, error="if 'parameters' is used, it must contain at least one key-value pair"),
Optional("states"): And(dict, len, error="if 'states' is used, it must contain at least one key-value pair"),
Optional("triggers"): And(list, len, error="if 'trigger' is used, it must contain at least one key-value pair"),
Optional("scenario_data"): And(str, len, error="you must provide a scenario data file if using 'scenario_data'"),
} ]
),
Expand All @@ -64,3 +65,4 @@ def validate(self, data, _is_scenario_schema=True): # _is_scenario_schema is a f
# Any input, output, or state declared in the connection section must be declared in the models section

# TODO: Write a validator for the scenario data file. It should check that the fiel exists
# TODO: write a validator for triggers. It should check that the trigger is a valid input, output, or state.

0 comments on commit c6ecffa

Please sign in to comment.