Summed K of a list of fittings
64-bitThe total loss coefficient of the fittings on one link at its own Reynolds number and diameter.
K = Σ nᵢ × Kᵢ(Re, D)
Adds count times K for each fitting in order in a 64-bit sum; K for each comes from k2K or k3K. 3-K uses the row nominal size nps when it is given, otherwise the link diameter.
export function kOfList(pack, list, Re, Dinch) {
let c = cleaned.get(pack); if (!c) { c = cleanFittingPack(pack); cleaned.set(pack, c); }
if (!c.ok) throw needs(c.problems.join('; '));
let K = 0;
for (const f of list || []) {
const method = f.method === '2K' ? '2K' : '3K', row = c.pack.methods[method].fittings.find((x) => x.id === f.id);
if (!row) throw new Error(`No fitting "${f.id}" in the ${method} table of the fitting pack.`);
const n = f.count == null ? 1 : +f.count; if (!(n >= 0)) throw new Error('a fitting count must be zero or more');
K += n * (method === '2K' ? k2K(row, Re, Dinch) : k3K(row, Re, f.nps > 0 ? f.nps : Dinch));
}
return K;
}