STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.model.component.ComponentInstance Class Reference

Public Member Functions

ComponentInstance build (cls, str id, str type_name, dict[str, Param] params, *, dict[str, Curve]|None curves=None, dict[str, str]|None options=None, str model="", dict[str, str]|None connections=None, str part="", Sequence[LineSegment]|None segments=None)
str type (self)
str option (self, str name)
float si (self, str name)
dict[str, float] si_params (self)
dict[str, int] provenance (self)
list[str] assumptions (self)
list[str] unconnected_ports (self)
dict[str, Any] to_dict (self)
ComponentInstance from_dict (cls, Mapping[str, Any] data)
str __str__ (self)

Static Public Attributes

dict params [str, Param]
dict curves = field(default_factory=dict)
dict options = field(default_factory=dict)
dict connections = field(default_factory=dict)
str part = ""
tuple segments = ()

Detailed Description

One configured piece of hardware in a network.

Args:
    id: Unique within a network -- ``"SOL-01"``, ``"PR-01"``. These are the
        tags on the P&ID, deliberately, so a component in a simulation and
        the same component on the drawing have the same name.
    spec: Its declaration.
    model: Which fidelity model to evaluate it at.
    params: Validated parameters, defaults already filled in.
    connections: Port name to network node id.
    part: Catalog part number this was resolved from, if any. Kept for
        traceability: it is how a report can say which physical valve a
        result assumed.

Definition at line 117 of file component.py.

Member Function Documentation

◆ __str__()

str feedtwin.model.component.ComponentInstance.__str__ ( self)

Definition at line 292 of file component.py.

◆ assumptions()

list[str] feedtwin.model.component.ComponentInstance.assumptions ( self)
Parameters here that nobody has established. Worth reporting.

Definition at line 218 of file component.py.

References feedtwin.comps.correlations.FittingContext.params, feedtwin.model.catalog.Part.params, and params.

◆ build()

ComponentInstance feedtwin.model.component.ComponentInstance.build ( cls,
str id,
str type_name,
dict[str, Param] params,
* ,
dict[str, Curve] | None curves = None,
dict[str, str] | None options = None,
str model = "",
dict[str, str] | None connections = None,
str part = "",
Sequence[LineSegment] | None segments = None )
Validate a configuration and produce an instance from it.

The only supported way to make one: it runs the spec's validation, so an
instance that exists is one whose parameters are complete, dimensionally
sound and within bounds.

Definition at line 153 of file component.py.

Referenced by from_dict().

◆ from_dict()

ComponentInstance feedtwin.model.component.ComponentInstance.from_dict ( cls,
Mapping[str, Any] data )

◆ option()

str feedtwin.model.component.ComponentInstance.option ( self,
str name )
One categorical choice, defaults already resolved.

Definition at line 190 of file component.py.

References options.

◆ provenance()

dict[str, int] feedtwin.model.component.ComponentInstance.provenance ( self)
How many of this component's parameters came from where.

Definition at line 214 of file component.py.

References feedtwin.comps.correlations.FittingContext.params, feedtwin.model.catalog.Part.params, and params.

◆ si()

float feedtwin.model.component.ComponentInstance.si ( self,
str name )
One parameter as a plain float in canonical units.

Definition at line 200 of file component.py.

References feedtwin.comps.correlations.FittingContext.params, feedtwin.model.catalog.Part.params, and params.

◆ si_params()

dict[str, float] feedtwin.model.component.ComponentInstance.si_params ( self)
Every parameter as plain floats -- what a component resolves once.

Definition at line 210 of file component.py.

References feedtwin.comps.correlations.FittingContext.params, feedtwin.model.catalog.Part.params, and params.

◆ to_dict()

dict[str, Any] feedtwin.model.component.ComponentInstance.to_dict ( self)

Definition at line 237 of file component.py.

References connections, actuator_testing_gui.ActuatorTestingWindow.curves, feedtwin.model.catalog.Part.curves, curves, gui.App.curves, lc_calibration_gui.LCPlotWindow.curves, _USBD_HandleTypeDef.id, anonymous_namespace{config_broadcast_service_main.cpp}::BoardInfo.id, anonymous_namespace{idle_e2e.cpp}::Check.id, backend.routers.layerx.Job.id, check_t.id, detail::exception.id, engine.layerx.sources.Drawing.id, feedtwin.comps.base.HydraulicComponent.id(), feedtwin.comps.elements.OrificeISO5167.id, feedtwin.comps.gas.GasOrifice.id, feedtwin.comps.manifold.Manifold.id, feedtwin.comps.regulator.Regulator.id, feedtwin.comps.relief.ReliefValve.id, feedtwin.engine.component.InjectorLeg.id, feedtwin.engine.component.InjectorLeg.id(), feedtwin.session.core.Session.id, feedtwin.session.hookup.Knob.id, fsw::config::StateDef.id, engine.layerx.prepare.Prepared.model, engine.pipeline.config_schemas.CombustionEfficiencyConfig.model, engine.pipeline.config_schemas.EvaporationConfig.model, engine.pipeline.config_schemas.SMDConfig.model, engine.pipeline.config_schemas.SprayAngleConfig.model, engine.pipeline.stability.timelag.LagBreakdown.model, engine.pipeline.vehicle_drag.DragCurves.model, feedtwin.comps.relief.ReliefValve.model(), feedtwin.session.core.Session.model, options, feedtwin.comps.correlations.FittingContext.params, feedtwin.model.catalog.Part.params, params, part, anonymous_namespace{config_broadcast_service_main.cpp}::BoardInfo.type, backend.routers.timeseries.PressureSegment.type, basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >.type, basic_json< nlohmann::ordered_map >.type, BoardConfig.type, default_value_traits.type, engine.pipeline.config_schemas.CoaxialInjectorConfig.type, engine.pipeline.config_schemas.ImpingingInjectorConfig.type, engine.pipeline.config_schemas.InjectorBaseConfig.type, engine.pipeline.config_schemas.PintleInjectorConfig.type, engine.pipeline.config_schemas.PressureSegmentConfig.type, feedtwin.comps.base.HydraulicComponent.type(), type(), feedtwin.model.spec.ComponentSpec.type, float_traits_base< T, MantissaDigits, DecimalDigits >.type, fsw::config::BoardConfig.type, fsw::control::RobustDDPController::Command.type, fsw::control::RobustDDPController::Reference.type, integer_traits_base< T >.type, native_value_traits< T, NodeType >.type, radio_link::Frame.type, radio_rx_t.type, rec_t.type, and string_traits< T >.type.

Referenced by calibration_robustness.SystemConfig.save(), engine.control.robust_ddp.data_models.ControllerConfig.to_json(), and engine.control.robust_ddp.data_models.ControllerConfig.to_yaml().

◆ type()

◆ unconnected_ports()

list[str] feedtwin.model.component.ComponentInstance.unconnected_ports ( self)
Fluid ports with nothing attached.

Not an error on its own -- a network under construction has plenty --
but a dead end at solve time is a singular system, and naming it here is
far kinder than a linear-algebra failure later.

Definition at line 222 of file component.py.

References connections.

Member Data Documentation

◆ connections

dict feedtwin.model.component.ComponentInstance.connections = field(default_factory=dict)
static

Definition at line 139 of file component.py.

Referenced by to_dict(), and unconnected_ports().

◆ curves

dict feedtwin.model.component.ComponentInstance.curves = field(default_factory=dict)
static

◆ options

dict feedtwin.model.component.ComponentInstance.options = field(default_factory=dict)
static

◆ params

◆ part

str feedtwin.model.component.ComponentInstance.part = ""
static

Definition at line 140 of file component.py.

Referenced by to_dict().

◆ segments

tuple feedtwin.model.component.ComponentInstance.segments = ()
static

The documentation for this class was generated from the following file: