Handler classes related to materials¶
MaterialHandler¶
- class simu.core.model.material.MaterialHandler¶
The material handler maintains the thermodynamic states represented as flows and states. When a model is created, the
interfacemethod can be used to define material ports. In thewithcontext, invoked by the parent model, defined ports are to be connected toMaterialinstances in the parent context. Finally, the model can create further (local) material instances.- __init__()¶
- define_port(
- name: str,
- spec: MaterialSpec | None = None,
Define a material port of the given name and specification. The name must be unique in this context. If no
specis given, any material is accepted.
- create_flow(
- name: str,
- definition: MaterialDefinition,
Create a Material as a flow in the local context.
- create_state(
- name: str,
- definition: MaterialDefinition,
Create a Material as a state in the local context.
- property ports: Mapping[str, MaterialSpec]¶
All defined ports of the model
- create_proxy() → MaterialProxy¶
Create a proxy object for configuration in material context
MaterialProxy¶
- class simu.core.model.material.MaterialProxy¶
- __init__(handler: MaterialHandler)¶
- connect(name: str, material: Material)¶
Connect the material in local context to the port with given name of the child model
- connect_many(**materials: Material)¶
Connect several materials at once, calling
connect()for each specification. This method can obviously only be used if the names of the ports are valid variable identifiers in python.
- free_ports() → Collection[str]¶
Return collection of all ports that are yet free
- finalise()¶
check that all ports are connected