Works out the pressure thrust on a blind end, picks a spring hanger from the maker table and flags a stop that closes.
How the precision is kept
Each helper is a short 64-bit formula or comparison on the numbers it is given. There are no built-in tables: the spring table is the maker table the caller passes in.
Calculations under this policy
3 calculations in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.
The axial force on a blind end or an unbalanced joint.
F = P × π × Di² ÷ 4
Math.PI times the diameter squared divided by 4, times the pressure, in left to right 64-bit order. P in MPa and Di in mm give newtons.
process/equip/pipestress2.js
line 11
CadCraft 0.8.2
export const pressureThrust = ({ P, Di }) => ({ F: P * Math.PI * Di * Di / 4, units: 'N', note: 'P in MPa and Di in mm; applies where the pressure is not balanced inside the run' });
Variable spring selection
64-bit
The spring sizes that carry the hot load and travel within the allowed load variation.
variation = |travel| × rate ÷ hot load
Filters the maker table by hot load range and travel, then computes variation as |travel| × rate ÷ hot load and keeps it if it is at most the allowed fraction.
process/equip/pipestress2.js
lines 12 to 22
CadCraft 0.8.2
export function selectSpring({ hotLoad, travel, table, maxVariation }) {
if (!Array.isArray(table) || !table.length) throw new Error('give the maker\'s spring table [{ size, rate (N/mm), loadMin (N), loadMax (N), travelMax (mm) }]. ' + NEEDS_SOURCE);
if (!(maxVariation > 0)) throw new Error('give the allowed load variation (a fraction, the project\'s)');
const ok = [];
for (const s of table) {
if (!(hotLoad >= s.loadMin && hotLoad <= s.loadMax && Math.abs(travel) <= s.travelMax)) continue;
const variation = Math.abs(travel) * s.rate / hotLoad; if (variation <= maxVariation) ok.push({ size: s.size, rate: s.rate, variation });
}
ok.sort((a, b) => a.variation - b.variation);
return { choices: ok, best: ok[0] || null, note: ok.length ? 'sorted by load variation; the maker\'s tables confirm the size' : 'no size in the table meets the load, the travel and the variation' };
}
Stop clearance check
64-bit
Whether the thermal displacement closes a gap or stop.
Takes the displacement on the stated axis, picks the plus or minus clearance by its sign and compares with a strict greater than. A displacement exactly equal to the clearance does not count as closing.
process/equip/pipestress2.js
lines 23 to 27
CadCraft 0.8.2
export function gapCheck(displacements, gaps) {
const out = [];
for (const g of gaps) { const d = displacements[g.node]; if (!d) continue; const v = d[g.axis] ?? 0; const closes = v > 0 ? v > g.plus : -v > g.minus; out.push({ node: g.node, axis: g.axis, displacement: v, clearance: v > 0 ? g.plus : g.minus, closes }); }
return { rows: out, closing: out.filter((r) => r.closes), note: 'a stop that closes adds a restraint: solve the run again with that node supported' };
}
In detail
Method
F = P × π × Di² ÷ 4; load variation = |travel| × rate ÷ hot load; a stop closes when the displacement is larger than the clearance on that side.
Number types
64-bit numbers.
Tolerances
None: the spring limits and the gap comparison use plain >= and > with no tolerance.
Approach: 64-bit, direct
Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.