Validation of Inputs#
Validation of inputs is performed using pydantic and is based on model representations of the different configuration files, these models being classes within the source code. The attributes for these classes coincide with the keys for the relevant dictionary to be tested, in the case of Power Balance Models these are dictionaries read from TOML files.
The current schemas are loose but demonstrate the process for possible tightening of constraints in future.
API Configuration Validation#
The global configuration or API configuration input is validated with the following rules:
Key | Rule | Required |
---|---|---|
models |
Must be of type List[str] and contain models defined within the specified models directory.* |
|
parameters_directory |
Must be a filename, not a path. | |
simulation_options_file |
Must be a filename, not a path.. | |
plasma_scenario_file |
Must be a filename, not a path. | |
structural_params_file |
Must be a filename, not a path. | |
profiles_directory |
Must be the path to an existing directory. | |
parameters_directory |
Must be the path to an existing directory. | |
modelica_file_directory |
Must be the path to an existing directory. | |
sweep |
Must be of type Dict[str, List[T]] . Where all items in list are the same type. |
|
sweep_mode |
Must be one of set or combinations . |
* This rule does not apply if add_model
is used within the API to add a model after the configuration.
Simulation Options Validation#
The Modelica simulation options configuration is validated with the following rules:
Key | Rule | Required |
---|---|---|
stopTime |
Must be of type int and be above 1. |
|
startTime |
Must be of type int and be positive. |
|
stepSize |
Must be of type int or float , and be positive. |
|
solver |
Must be either of type string and recognised |
|
tolerance |
Must be of type float and positive. |
A check is also applied to ensure that the startTime
is before the stopTime
, and that the stepSize
is less than the stopTime
.
Plasma Scenario Validation#
The plasma scenario configuration is validated with the following rules:
Key | Rule | Required |
---|---|---|
plasma_ramp_up_start |
Must be a positive integer. | |
plasma_flat_top_start |
Must be a positive integer. | |
plasma_flat_top_end |
Must be a positive integer. | |
plasma_ramp_down_end |
Must be a positive integer. |
A check is also applied to ensure that the above are in the given order of increasing magnitude.