STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1"""The component library: pipes, fittings, orifices, valves, check valves.
2
3Configuration in, pressure drop out::
4
5 from feedtwin.comps import build_component, conditions_from_fluid
6 from feedtwin.model import ComponentInstance, Param, Provenance
7 from feedtwin.props import Fluid
8
9 line = build_component(ComponentInstance.build("FL-01", "pipe", {
10 "length": Param(2.0, "m", Provenance.MEASURED, "drawing"),
11 "bore": Param(7.75, "mm", Provenance.MANUFACTURER, "3/8 x 0.035 tube"),
12 }))
13
14 lox = conditions_from_fluid(Fluid("LOX"), p=3.0e6, T=90.0)
15 line.pressure_drop(mdot=1.5, flow=lox) # Pa
16
17Everything numeric comes from ``fluids``, which is validated against the books
18it implements -- Crane TP-410 for fitting losses, IEC 60534 for valve sizing,
19ISO 5167 for metering orifices. What this package adds is adapters, unit and
20provenance bookkeeping, and the registries that make correlation choice a
21config edit. It contributes no correlations of its own, on purpose: a wrong
22number here should be traceable to an adapter, never to a re-derivation.
23
24Two seams keep it extensible without editing this package:
25
26* ``register_fitting(name, fn)`` -- a fitting correlation, selected by
27 ``fitting.options.kind``.
28* ``register_builder(type, model, fn)`` -- the physics behind a (component
29 type, fidelity model) pair, which is how a new component type declared in
30 ``components.toml`` acquires behaviour.
31
32And every type carries a ``measured`` model that reads a flow-against-drop
33curve and supersedes the correlation entirely.
34"""
35
36from __future__ import annotations
37
38from feedtwin.comps.base import (
39 Builder,
40 FlowConditions,
41 HydraulicComponent,
42 InfeasibleOperatingPoint,
43 Violation,
44 build_component,
45 register_builder,
46 registered_builders,
47)
49 DEFAULT_FRICTION_METHOD,
50 FRICTION_METHODS,
51 LAMINAR_LIMIT,
52 FittingContext,
53 FittingK,
54 darcy_friction_factor,
55 fitting_K,
56 get_fitting,
57 register_fitting,
58 registered_fittings,
59 reynolds,
60 velocity,
61)
62from feedtwin.comps.manifold import (
63 DEFAULT_TURN_K,
64 Manifold,
65 ManifoldBranch,
66 ManifoldPort,
67 PortKind,
68 expand_manifold,
69 turn_K_from_geometry,
70)
71from feedtwin.comps.regulator import (
72 CurveRegulator,
73 IdealRegulator,
74 Regulator,
75)
76from feedtwin.comps.gas import (
77 GasOrifice,
78 choked_mass_flow,
79 critical_pressure_ratio,
80 subsonic_mass_flow,
81)
82from feedtwin.comps.relief import ReliefValve
83from feedtwin.comps.elements import (
84 CHARACTERISTICS,
85 GRAVITY,
86 Bend,
87 CheckValve,
88 Fitting,
89 FlexHose,
90 MeasuredElement,
91 OrificeCd,
92 OrificeISO5167,
93 Pipe,
94 Valve,
95 conditions_from_fluid,
96)
97
98__all__ = [
99 "CHARACTERISTICS",
100 "DEFAULT_FRICTION_METHOD",
101 "DEFAULT_TURN_K",
102 "FRICTION_METHODS",
103 "GRAVITY",
104 "LAMINAR_LIMIT",
105 "Builder",
106 "Bend",
107 "CheckValve",
108 "Fitting",
109 "FlexHose",
110 "FittingContext",
111 "FittingK",
112 "FlowConditions",
113 "GasOrifice",
114 "HydraulicComponent",
115 "InfeasibleOperatingPoint",
116 "CurveRegulator",
117 "IdealRegulator",
118 "Manifold",
119 "ManifoldBranch",
120 "ManifoldPort",
121 "MeasuredElement",
122 "PortKind",
123 "Regulator",
124 "ReliefValve",
125 "OrificeCd",
126 "OrificeISO5167",
127 "Pipe",
128 "Valve",
129 "Violation",
130 "build_component",
131 "choked_mass_flow",
132 "critical_pressure_ratio",
133 "expand_manifold",
134 "subsonic_mass_flow",
135 "conditions_from_fluid",
136 "darcy_friction_factor",
137 "fitting_K",
138 "get_fitting",
139 "register_builder",
140 "register_fitting",
141 "registered_builders",
142 "registered_fittings",
143 "reynolds",
144 "turn_K_from_geometry",
145 "velocity",
146]