STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1"""The parameter and component model: "nothing hardcoded", as a type.
2
3Every number describing hardware is a :class:`Param` -- a value, the unit it was
4written in, where it came from, and how well it is known::
5
6 from feedtwin.model import Param, Provenance
7
8 Param(1.2, "Cv", Provenance.MANUFACTURER, "SS-8BK-V51 datasheet rev C")
9
10There is no default for the source. A number with no provenance is a validation
11error, because "nobody remembers where this came from" is the state this layer
12exists to make impossible -- and it is the state most of a propulsion team's
13numbers are in by the second year.
14
15What each piece is for
16----------------------
17:mod:`~feedtwin.model.units`
18 Conversion at the boundary and dimension checking. Author in psi and
19 inches; the solver sees SI floats. A pressure written where a length
20 belongs fails at load with both dimensions named.
21
22:mod:`~feedtwin.model.param`
23 :class:`Param`, :class:`Provenance`, :class:`Uncertainty`, and the report
24 helpers that turn a pile of parameters into "nine measured, four datasheet,
25 two guesses".
26
27:mod:`~feedtwin.model.spec`
28 :class:`ComponentSpec` -- what a kind of component has. Loaded from
29 ``components.toml``, so a component's schema is data and only its physics is
30 code. Validation, the Phase 10 inspector and the generated parameter tables
31 all read this one declaration.
32
33:mod:`~feedtwin.model.segments`
34 :class:`LineSegment` and the loss-method ladder -- how a line's resistance
35 is known, and which of several statements of it wins.
36
37:mod:`~feedtwin.model.component`
38 :class:`ComponentInstance`, one configured piece of hardware, and the
39 provisional :class:`Component` protocol that Phase 03 implements against.
40
41:mod:`~feedtwin.model.catalog`
42 Part numbers to parameters, with datasheet values and measurements kept
43 separately so the difference between them stays visible.
44
45Serialisation is TOML in, plain dicts through, JSON for exact round-trips.
46Deliberately not YAML: PyYAML parses ``1e-3`` as the *string* ``"1e-3"``, which
47in a config full of orifice diameters is a silent, load-bearing bug.
48"""
49
50from __future__ import annotations
51
52from feedtwin.model.catalog import Catalog, CatalogError, Part, measured
53from feedtwin.model.component import (
54 Component,
55 ComponentInstance,
56 EvalContext,
57 PortState,
58)
59from feedtwin.model.param import (
60 Param,
61 Provenance,
62 Uncertainty,
63 assumed_params,
64 provenance_summary,
65)
66from feedtwin.model.segments import (
67 DEFAULT_METHOD,
68 LOSS_METHODS,
69 Fitting,
70 LineLoss,
71 LineSegment,
72 method_rank,
73)
74from feedtwin.model.spec import (
75 ComponentSpec,
76 ParamSpec,
77 PortSpec,
78 SpecError,
79 StateSpec,
80 default_param,
81 get_component_spec,
82 load_component_specs,
83 register_component_spec,
84 registered_component_types,
85)
86from feedtwin.model.units import (
87 DimensionMismatch,
88 Unit,
89 UnknownUnit,
90 check_dimension,
91 dimension_of,
92 from_si,
93 get_unit,
94 register_unit,
95 registered_units,
96 si_unit_of,
97 to_si,
98)
99
100__all__ = [
101 "Catalog",
102 "CatalogError",
103 "Component",
104 "ComponentInstance",
105 "ComponentSpec",
106 "DEFAULT_METHOD",
107 "DimensionMismatch",
108 "EvalContext",
109 "Fitting",
110 "LOSS_METHODS",
111 "LineLoss",
112 "LineSegment",
113 "Param",
114 "ParamSpec",
115 "Part",
116 "PortSpec",
117 "PortState",
118 "Provenance",
119 "SpecError",
120 "StateSpec",
121 "Uncertainty",
122 "Unit",
123 "UnknownUnit",
124 "assumed_params",
125 "check_dimension",
126 "default_param",
127 "dimension_of",
128 "from_si",
129 "get_component_spec",
130 "get_unit",
131 "load_component_specs",
132 "measured",
133 "method_rank",
134 "provenance_summary",
135 "register_component_spec",
136 "register_unit",
137 "registered_component_types",
138 "registered_units",
139 "si_unit_of",
140 "to_si",
141]