Read a line's segment list off a P&ID edge.
`pid-designer` writes ``data.segments`` on an edge: the run broken into
segments, each with a tube size, a bore, a developed length and a counted list
of fittings. Until this module existed the reader stopped at ``data.params``, so
an itemised line arrived at the solver as an *unstated* one and got a default
with a shrug -- while the drawing's own editor was greying out the line-level
``Length`` and ``Bore`` fields and saying "superseded by the segments below".
The field marked superseded was the only one being read.
The shapes are :mod:`feedtwin.model.segments`, which is also where the physics
of the thing is written down. This module is only the boundary: JSON in,
provenance checked, dataclasses out.
| list[str] feedtwin.pid.segments._check |
( |
LineSegment | segment, |
|
|
str | basis, |
|
|
str | place, |
|
|
float | run_bore = 0.0 ) |
|
protected |
What the drawing said that will not survive contact with the solver.
Every one of these is a case where the segment still produces a number --
the point is that the number is not the one the drawing appears to promise,
so it is said out loud rather than absorbed. ``run_bore`` is the narrowest
bore stated anywhere on the run [m], zero for none: what the solver sizes a
segment with no bore of its own at.
Definition at line 108 of file segments.py.
Referenced by read_segments().
| Curve | None feedtwin.pid.segments._curve |
( |
Any | raw, |
|
|
str | where, |
|
|
list[str] | warnings ) |
|
protected |
A ``{mdot, mdotUnit, dp, dpUnit}`` table, or None.
A curve is the top of the ladder, so a malformed one is *not* silently
dropped to a lower rung -- it is reported, and then dropped, because a run
somebody flowed and recorded badly is a thing to go and fix rather than to
quietly replace with a correlation.
Definition at line 184 of file segments.py.
References _floats().
Referenced by read_segments().
| LineLoss feedtwin.pid.segments.read_segments |
( |
Any | raw, |
|
|
str | where ) |
Read ``data.segments`` off an edge.
Absent, empty or malformed gives an empty :class:`LineLoss`, which the
caller reads as "this line says nothing" and falls back to the line-level
parameters -- the behaviour every existing drawing already gets.
Raises:
DiagramError: a segment states a value with no recognised provenance.
Same contract as the reader's own parameters, and for the same
reason: a number whose source is unrecognised means the document
came from something other than this drawing tool, and quietly
defaulting it turns a format mismatch into a figure nobody checked.
Definition at line 39 of file segments.py.
References _check(), _curve(), _fittings(), _known_fittings(), _param(), and min.