Component

class ospx.component.Component(name: str, properties: MutableMapping[Any, Any])

Bases: object

A component is an instance of a (component-) model.

A component represents an instance of a (component-) model. Any system structure can contain an arbitrary number of components. Important here is, that multiple components in a system structure can be instances of one and the same model. In practical terms this means that multiple components can refer to the same physical FMU file. n As components are instances of a model (FMU), they inherit the start values defined in the FMU’s modelDescription file upon instantiation; n howevere, being an instance, each component can alter and overwrite these start values. This is accomplished using the ‘initialize’ section inside a ‘component’ element in the ospx case dict. n See https://dnv-opensource.github.io/ospx/fileFormat.caseDict.html

Equivalent terms to ‘component’ are: n t ‘Simulator’ in OSP. See https://open-simulation-platform.github.io/libcosim/configuration#simulator n t ‘Simulation model’ in FMI for co-simulation. See https://github.com/modelica/fmi-standard/releases/download/v2.0.3/FMI-Specification-2.0.3.pdf n t ‘Component’ in SSP. See https://ssp-standard.org/publications/SSP10/SystemStructureAndParameterization10.pdf

__init__(name: str, properties: MutableMapping[Any, Any]) None

Methods

__init__(name, properties)

write_osp_model_description_xml()

Write the <component.name>_OspModelDescription.xml file in the current working directory.

Attributes

connectors

Returns a dict with all connectors defined by the component.

units

Returns a dict with all units defined in the component.

variables

Returns a dict with all scalar variables defined in the component.

variables_with_start_values

Return all scalar variables with start values.

write_osp_model_description_xml() None

Write the <component.name>_OspModelDescription.xml file in the current working directory.

property connectors: dict[str, Connector]

Returns a dict with all connectors defined by the component.

Returns:

dict with all connectors

Return type:

dict[str, Connector]

property units: dict[str, Unit]

Returns a dict with all units defined in the component.

Returns:

dict with all units

Return type:

dict[str, Unit]

property variables: dict[str, ScalarVariable]

Returns a dict with all scalar variables defined in the component.

Returns:

dict with all scalar variables

Return type:

dict[str, ScalarVariable]

property variables_with_start_values: dict[str, ScalarVariable]

Return all scalar variables with start values.

Returns a dict with all scalar variables for which start values (initial values) are defined in the component.

Returns:

dict with all scalar variables with start values defined.

Return type:

dict[str, ScalarVariable]