1"""Where gauge and absolute pressure meet, and what a person is shown.
3Every pressure inside the model is absolute -- the equation of state, the
4choking ratios and the regulator all need it that way. Every pressure a person
5reads or types is absolute too, in psia (ADR 0007): the slides, the datasheets
6and EngineDesign all quote psia, and a screen that said psig sat 14.7 psi off
9What crosses the wire and what is saved stays **gauge**: a knob's ``psig``, the
10API's ``*_psi`` fields, run records, hookups, stand documents. That is what the
11stand's DAQ logs and what every saved file already holds; changing it would
12make each old record mean something else. :func:`psig` and :func:`from_psig`
13are the only two places the wire meets the model. Moved here from the
14feed-twin app when the marching session became library code, so a second
15caller -- EngineDesign's Layer X -- converts through the same two functions
18Text meant for people goes through :func:`say`, which prints psia from the
19model's own absolute pascals (it and :func:`psia` live in
20:mod:`feedtwin.model.pressure`, so the drawing reader can use them without
21importing the session; this is their address). A difference -- a bias, a
22droop, a sag, a residual -- is the same size either way and is written in
25The zero is the **standard** atmosphere, deliberately and only for gauge
26readings: it is the convention the stand's DAQ and the cockpit share. A caller
27that knows the absolute pressure it wants (an engine config states psia) should
28convert with :func:`from_psig` of ``(p_abs - ATMOSPHERE) / PSI`` -- which is
29exact -- rather than assume its site's atmosphere is this one.
32from __future__
import annotations
39PSI: float = get_unit(
"psi").factor
46ATMOSPHERE_PSI: float = ATMOSPHERE / PSI
49def psig(pascal: float) -> float:
50 """Absolute pressure [Pa] as the stand's transducers log it [psig].
52 A vented vessel reads 0.0, not 14.7. For the wire and saved files; text a
53 person reads goes through :func:`say`.
55 return (pascal - ATMOSPHERE) / PSI
59 """A gauge reading or dial setting [psig] as the absolute pressure the model
61 return gauge * PSI + ATMOSPHERE
65 """An absolute pressure stated in psia, as the gauge reading [psig] that
66 :func:`from_psig` turns back into exactly ``psia * PSI`` pascals."""
67 return (psia * PSI - ATMOSPHERE) / PSI
float from_psig(float gauge)
float psig_from_psia(float psia)