Loads at the joints
64-bitTurns roof, snow and ceiling loads in kPa into forces in kN at the joints of the frame.
top chord: w = (dead × L + snow × Δx) × spacing; bottom chord: w = ceiling × Δx × spacing; half to each end
Roof dead load is taken on the member's sloped length and snow and ceiling loads on its plan length, each divided by 1000 for meters, times the spacing in meters. Half of each member's load goes to each end joint by plain addition.
/** kN at each node of the frame from kPa loads: roof dead on the slope, snow on plan, ceiling dead on plan; `spacing` mm between trusses. */
export function nodalLoads(g, { roofDead = 0, snow = 0, ceilingDead = 0 }, spacing) {
const s = spacing / 1000, out = new Map();
const add = (id, v) => out.set(id, (out.get(id) || 0) + v);
for (const m of solvable(g)) {
const dx = Math.abs(g.nodes[m.b].x - g.nodes[m.a].x);
let w = 0;
if (m.role === 'top') w = (roofDead * (m.len / 1000) + snow * (dx / 1000)) * s; // dead on the slope, snow on plan
else if (m.role === 'bottom') w = ceilingDead * (dx / 1000) * s; // ceiling on plan
if (w) { add(m.a, w / 2); add(m.b, w / 2); }
}
return out;
}