component_model.utils.osp

Functions

make_osp_system_structure([name, models, ...])

Prepare a OspSystemStructure xml file according to OSP configuration specification.

component_model.utils.osp.make_osp_system_structure(name: str = 'OspSystemStructure', models: dict | None = None, connections: tuple = (), version: str = '0.1', start: float = 0.0, base_step: float = 0.01, algorithm: str = 'fixedStep', path: Path | str = '.')

Prepare a OspSystemStructure xml file according to OSP configuration specification.

Parameters:
  • name (str) – the name of the system model, used also as file name

  • models (dict) – dict of models (in OSP called ‘simulators’). A model is represented by a dict element modelName : {property:prop, variable:value, …}

  • connections (tuple)=() – tuple of model connections. Each connection is defined through a tuple of (model, variable, model, variable), where variable can be a tuple defining a variable group

  • version (str) – The version of the system model

  • start (float) – The simulation start time

  • base_step (float) – The base stepSize of the simulation. The exact usage depends on the algorithm chosen

  • algorithm (str) – The name of the algorithm

  • path (Path,str) – the path where the file should be saved

Returns:

  • The absolute path of the file as Path object

  • .. todo:: better stepSize control in dependence on algorithm selected, e.g. with fixedStep we should probably set all step sizes to the minimum of everything?