saref4syst

Modules

connection module

class Connection(connects_system=None, connects_system_at=None, outputPort=None)[source]

Bases: object

A class representing a connection of a system, i.e. an output of a system.

Parameters:
  • connects_system (Optional[System]) – The system that the connection is part of. Defaults to None.

  • connects_system_at (Optional[list]) – The connection point that the connection is part of. Defaults to None.

  • outputPort (Optional[str]) – The name of the property that the connection sends. Defaults to None.

connection_point module

class ConnectionPoint(connection_point_of=None, connects_system_through=None, inputPort=None)[source]

Bases: object

A class representing a connection point of a system, i.e. an input to a system.

Parameters:
  • connection_point_of (Optional[System]) – The system that the connection point is part of. Defaults to None.

  • connects_system_through (Optional[list]) – A list of systems that the connection point connects to. Defaults to None.

  • inputPort (Optional[str]) – The name of the property that the connection point receives. Defaults to None.

property connection_point_of: System | None

Get the system that the connection point is part of.

property connects_system_through: list

Get the list of systems that the connection point connects to.

property inputPort: str | None

Get the name of the property that the connection point receives.

system module

class System(connects_at=None, connected_through=None, input=None, output=None, id=None, **kwargs)[source]

Bases: object

A base-class representing a component model used as part of a simulation model. The methods initialize(), do_step() must be implemented by the subclass.

Parameters:
  • connects_at (Optional[list]) – A list of connection points that the system connects to.

  • connected_through (Optional[list]) – A list of systems that the system connects through.

  • input (Optional[dict]) – A dictionary of inputs to the system.

  • output (Optional[dict]) – A dictionary of outputs from the system.

  • outputGradient – A dictionary of output gradients to the system.

  • parameterGradient – A dictionary of parameter gradients to the system.

  • id (Optional[str]) – The id of the system.

do_step(secondTime, dateTime, step_size, stepIndex)[source]

Do a single step of the system.

Parameters:
  • secondTime (float) – The current time in seconds.

  • dateTime (datetime.datetime) – The current date and time.

  • step_size (int) – The step size of the simulation in seconds.

  • stepIndex (int) – The current step index.

Return type:

None

initialize(start_time, end_time, step_size, simulator)[source]

Initialize the system.

Parameters:
  • start_time (datetime.datetime) – The start time of the simulation.

  • end_time (datetime.datetime) – The end time of the simulation.

  • step_size (int) – The step size of the simulation in seconds.

  • simulator (core.Simulator) – The simulator.

Return type:

None

populate_config()[source]

Populate the config of the system.

Returns:

The config of the system.

Return type:

dict

property connected_through: list

Get the connected systems through.

property connects_at: list

Get the connection points.

property id: str

Get the id of the system.

property input: dict

Get the input of the system.

property output: dict

Get the output of the system.