Electrical Conduit Size Calculator //top\\ -
function renderWireInputs() const container = document.getElementById('wiresContainer'); if (!container) return; container.innerHTML = ''; wires.forEach((wire, idx) => const div = document.createElement('div'); div.className = 'wire-entry'; div.innerHTML = ` <div class="wire-header"> <span>🔌 Conductor #$idx+1</span> <button class="btn-remove" data-idx="$idx" type="button">Remove</button> </div> <div class="wire-controls"> <select class="wire-size" data-idx="$idx"> $Object.keys(wireAreas).map(sz => `<option value="$sz" $wire.size === sz ? 'selected' : ''>AWG $sz</option>`).join('') </select> <select class="wire-insulation" data-idx="$idx"> <option value="THHN" $wire.insulation === 'THHN' ? 'selected' : ''>THHN / THWN</option> <option value="XHHW" $wire.insulation === 'XHHW' ? 'selected' : ''>XHHW</option> </select> </div> `; container.appendChild(div); ); // attach remove events document.querySelectorAll('.btn-remove').forEach(btn => btn.addEventListener('click', (e) => const idx = parseInt(btn.getAttribute('data-idx')); wires.splice(idx, 1); renderWireInputs(); ); ); // attach change listeners for dynamic updates document.querySelectorAll('.wire-size').forEach(sel => sel.addEventListener('change', (e) => const idx = parseInt(sel.getAttribute('data-idx')); wires[idx].size = sel.value; ); ); document.querySelectorAll('.wire-insulation').forEach(sel => sel.addEventListener('change', (e) => const idx = parseInt(sel.getAttribute('data-idx')); wires[idx].insulation = sel.value; ); );
function computeTotalArea() let total = 0; for (let w of wires) const areaObj = wireAreas[w.size]; if (areaObj && areaObj[w.insulation]) total += areaObj[w.insulation]; else if (areaObj && areaObj["THHN"]) total += areaObj["THHN"]; else total += 0.0133; // fallback return total; electrical conduit size calculator
let wireCount = 0; let wires = []; // store each wire object size, insulation function renderWireInputs() const container = document
function addWire() wires.push( size: "12", insulation: "THHN" ); renderWireInputs(); 'selected' : ''>
// Conduit internal areas (sq in) - based on NEC Table 4 for EMT, PVC40, RMC, IMC (approx values for typical sizes) const conduitAreas = "EMT": "1/2": 0.213, "3/4": 0.346, "1": 0.598, "1 1/4": 0.984, "1 1/2": 1.342, "2": 2.028, "2 1/2": 2.731, "3": 3.916, "3 1/2": 5.027, "4": 6.388 , "PVC": "1/2": 0.201, "3/4": 0.333, "1": 0.577, "1 1/4": 0.954, "1 1/2": 1.295, "2": 1.947, "2 1/2": 2.621, "3": 3.760, "3 1/2": 4.824, "4": 6.128 , "RIGID": "1/2": 0.215, "3/4": 0.347, "1": 0.602, "1 1/4": 0.990, "1 1/2": 1.350, "2": 2.038, "2 1/2": 2.743, "3": 3.930, "3 1/2": 5.043, "4": 6.405 , "IMC": "1/2": 0.214, "3/4": 0.348, "1": 0.603, "1 1/4": 0.985, "1 1/2": 1.342, "2": 2.040, "2 1/2": 2.734, "3": 3.922, "3 1/2": 5.030, "4": 6.390 ;
// initialization function init() wires.push( size: "12", insulation: "THHN" ); wires.push( size: "12", insulation: "THHN" ); renderWireInputs(); document.getElementById('addWireBtn').addEventListener('click', addWire); document.getElementById('calculateBtn').addEventListener('click', calculateConduit); calculateConduit(); // default calculation