A line's loss, as the drawing states it.
A P&ID line is rarely one bore of one length. It is a run: some tube, an elbow,
a reducer, more tube, a tee. `pid-designer` records exactly that -- an itemised
list of segments, each with a tube size, a bore, a developed length and a
counted list of fittings -- and this module is the shape that list arrives in.
How a loss is known, and which one wins
---------------------------------------
A segment declares one method. They are ordered by authority, and exactly one is
in force -- the vocabulary and the order are the drawing's, reproduced here
rather than reinvented:
1. ``curve`` -- Delta p against mdot from a cold flow. Beats everything.
2. ``measured_K`` -- one K fitted from a run. Same authority, less data.
3. ``itemised`` -- tube size, length, fittings. The correlations are used here.
4. ``lumped_K`` -- one K somebody estimated.
5. ``unstated`` -- nothing said; defaulted, and reported unchecked.
The point of the order is that "how well do we know this line" stops being a
matter of opinion. A line that has been flowed has a number that beats every
correlation; a line that has not been built yet has an itemised estimate. Both
are first-class, and which one is in force is never ambiguous.
The trap this module exists to avoid
------------------------------------
**A fitting's K already contains its own friction.** Crane TP-410, Hooper 2K and
Darby 3K all price the whole fitting -- the flow through it, not just the extra
loss over an equivalent length of tube. So if a run is measured end to end and
that number is used as ``L`` *while* the elbows in it are also counted as K, the
elbows get paid for twice.
On a 1.6 m run with three long-radius elbows at r/D 1.5 in a 10 mm bore, the
arcs are about 71 mm of the total: a 4.4% over-count of length. Friction is
roughly half the loss on a run like that, so it is about 2% on Delta p -- the
same order as miscounting an elbow, and in the same direction every time.
So the friction term uses the **tube** length, and fittings contribute **K
only**. A fitting's body length is not a loss input; it is recorded for the cut
list, which is the fabricator's problem. That is what :attr:`LineSegment.length_basis`
is for: ``"tube"`` means the stated length is already just tube, and
``"overall"`` means it is end to end and the fitting bodies have to come out of
it before it is used as ``L``.