/* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 tools Self-contained ADDITIVE script for 5 new standalone tool pages: screed, ramp, mono, formwork, leveler. Deploy: upload batch4-tools.js to the Media Library as a .txt file and add a script tag after the v6 script on the 5 new pages, or add as a new WPCode snippet limited to the 5 new pages. This file is built from framework-batch4.js + chunk-*.js + boot. batch 4 never modifies the existing tools, V6 code, the batch 1 (P2) script, the batch 2 (P3) script, or the batch 3 (P4) script. Its namespace is P5 and it never writes to window.P2, window.P3, window.P4, window.CC, or any V6/P2/P3/P4 internals. ============================================================ */ (function(){ "use strict"; if(window.P5_BUILT) return; window.P5_BUILT = true; var P5 = window.P5 = {}; /* ============ 1. CONSTANTS ============ */ /* Bag yields from manufacturer specifications (Quikrete) */ P5.BAG = { b80:0.60, b60:0.45, b50:0.375, b40:0.30 }; /* 80/60/50/40 lb, ft3 */ P5.BAGKG = { k25:0.0117, k20:0.0094 }; /* 25/20 kg, m3 */ P5.CTMIX_FT3 = 0.43; /* 47 lb countertop mix, ft3 */ P5.DENSITY_LB_FT3 = 150; /* normal weight concrete, lb/ft3 */ P5.DENSITY_KG_M3 = 2400; /* normal weight concrete, kg/m3 */ P5.DENSITY_LIGHT_LB_FT3 = 110; /* lightweight concrete, lb/ft3 */ P5.DENSITY_LIGHT_KG_M3 = 1760; /* lightweight concrete, kg/m3 */ P5.BAG94_KG = 42.6377; /* one 94 lb cement bag, kg (94 x 0.45359237) */ P5.M3_PER_YD3 = 0.764555; /* cubic metres per cubic yard */ P5.LBFT2_PER_KGM2 = 0.204816; /* lb/ft2 per kg/m2 (evaporation rate) */ P5.MPH_TO_KMH = 1.609344; /* wind speed conversion */ P5.PSI_TO_MPA = 0.00689476; /* strength conversion */ P5.FT3_PER_M3 = 35.3146667; P5.M3_PER_FT3 = 0.0283168466; P5.LB_PER_KG = 2.20462262; P5.KG_PER_LB = 0.45359237; P5.GAL_TO_LITRE = 3.78541; P5.GRAVEL_T_PER_M3 = 1.5; /* crushed stone / gravel, tonnes per m3 (same constant as the existing Gravel tool, GravelBase.co.uk) */ P5.SCREED_DRY_FACTOR = 1.33; /* wet screed volume to dry materials volume (screed worked examples) */ P5.CEMENT_KG_M3 = 1440; /* bulk density of Portland cement, kg/m3 */ P5.SAND_KG_M3 = 1600; /* bulk density of sharp sand, kg/m3 */ P5.SAND_T_PER_M3 = 1.6; /* sand, tonnes per m3 */ P5.SLC_RATE = 1.7; /* self levelling compound consumption, kg/m2 per mm (default, user adjustable) */ P5.FORM_STUD_FT = 1.3333333; /* wall form stud spacing, ft (16 in) */ P5.FORM_WALER_FT = 2; /* wall form waler row spacing, ft (24 in) */ P5.FORM_LUMBER_FT = 10; /* standard waler board length, ft */ P5.FORM_TIE_FT = 2; /* form tie grid spacing, ft (2 ft x 2 ft) */ P5.FORM_SHEET_FT2 = 32; /* one 4 ft x 8 ft plywood sheet, ft2 */ P5.FORM_RELEASE_FT2_GAL = 750; /* form release agent coverage, ft2 per gallon */ P5.ADA_MAX_DENOM = 12; /* ADA maximum ramp slope 1:12 (2010 ADA Standards section 405.2) */ P5.ADA_MAX_RISE_IN = 30; /* ADA maximum rise per ramp run, in (section 405.6) */ P5.ADA_MIN_WIDTH_IN = 36; /* ADA minimum clear ramp width, in (section 405.5) */ P5.ADA_LANDING_IN = 60; /* ADA minimum landing length, in (section 405.7) */ P5.ADA_HANDRAIL_RISE_IN = 6; /* handrails required when a ramp run rises more than 6 in (section 405.8) */ P5.BAG50LB_KG = 22.6796; /* one 50 lb bag, kg (50 x 0.45359237) */ /* ============ 2b. PHASE 2 BATCH 4 HEADER STYLES (pages use .p5-units) ============ */ (function(){ if(typeof document === 'undefined') return; if(document.getElementById('p5style')) return; var s = document.createElement('style'); s.id = 'p5style'; s.textContent = '.p5-units{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}' +'.p5-units button{border:1px solid #e2e8f0;background:#ffffff;border-radius:10px;padding:9px 14px;' +'font-size:14px;font-weight:600;cursor:pointer;color:#0f172a;white-space:nowrap}' +'.p5-units button:hover{background:#f1f5f9}' +'.p5-units button.on{background:#1e40af;border-color:#1e40af;color:#fff}' +'.p5CurSym{font-weight:600;color:#0f172a;padding:0 4px}' +'#p5uCur{min-width:86px}' +'.p5check{display:flex;align-items:center;gap:8px;margin-top:10px;font-size:14px;color:#0f172a}' +'.p5check input{width:18px;height:18px;accent-color:#1e40af}' /* P5 standalone selects (bag, mix, type, slope) sit alone in a .cc-unitrow but inherit V6's 76px unit-select width, truncating their long texts ("25 k"). Widen only these named selects; unit selects beside inputs keep the 76px width. Specificity (0,3,0) beats V6's (0,1,1). */ +'.cc-panel .cc-unitrow .bagSel,.cc-panel .cc-unitrow .lbagSel,.cc-panel .cc-unitrow .mixSel,.cc-panel .cc-unitrow .stypeSel,.cc-panel .cc-unitrow .slopeSel{flex:1 1 auto;width:auto;min-width:120px}'; document.head.appendChild(s); })(); /* ============ 2. HELPERS ============ */ P5.num = function(v){ v = parseFloat(v); return (isFinite(v) && v > 0) ? v : 0; }; P5.ceilSafe = function(x){ return Math.ceil(x - 1e-9) || 0; }; P5.esc = function(s){ return String(s).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"'); }; P5.fmt = function(v, d){ if(!isFinite(v)) return '0'; var s = v.toFixed(d===undefined?2:d); if(s.indexOf('.')>=0) s = s.replace(/\.?0+$/,''); return s; }; var TO_FT = { ft:1, 'in':1/12, m:1/0.3048, cm:1/30.48, mm:1/304.8 }; var TO_IN = { 'in':1, ft:12, m:1/0.0254, cm:1/2.54, mm:1/25.4 }; P5.toFt = function(v, u){ v = parseFloat(v); if(!isFinite(v)) return 0; return v*(TO_FT[u||'ft']||1); }; P5.toIn = function(v, u){ v = parseFloat(v); if(!isFinite(v)) return 0; return v*(TO_IN[u||'in']||1); }; P5.convertVal = function(v, fromU, toU, kind){ v = parseFloat(v); if(!isFinite(v)) return ''; var base = (kind==='sm') ? TO_IN : TO_FT; var out = (v*(base[fromU]||1)) / (base[toU]||1); return String(Math.round(out*10000)/10000); }; P5.bagsNeeded = function(ft3){ ft3 = P5.num(ft3); return { b80:P5.ceilSafe(ft3/P5.BAG.b80), b60:P5.ceilSafe(ft3/P5.BAG.b60), b50:P5.ceilSafe(ft3/P5.BAG.b50), b40:P5.ceilSafe(ft3/P5.BAG.b40) }; }; P5.bagsNeededM3 = function(m3){ m3 = P5.num(m3); return { k25:P5.ceilSafe(m3/P5.BAGKG.k25), k20:P5.ceilSafe(m3/P5.BAGKG.k20) }; }; P5.weightLb = function(ft3){ return ft3*P5.DENSITY_LB_FT3; }; P5.weightKg = function(m3){ return m3*P5.DENSITY_KG_M3; }; P5.trucks = function(y){ return P5.ceilSafe(P5.num(y)/10); }; /* US, 10 yd3 */ P5.trucksM3 = function(m){ return P5.ceilSafe(P5.num(m)/8); }; /* UK, 8 m3 */ /* ============ 3. ICONS (batch 4 only; names do not clash with P2/P3/V6) ============ */ var I = { cube:'', bags:'', copy:'', print:'', share:'', reset:'', truck:'', wall:'', pile:'', trowel:'', slab:'', walk:'', tube:'', counter:'', roller:'', joint:'', scale:'', drop:'', sun:'', wind:'', floor:'', ramp:'', edge:'', form:'', level:'' }; P5.ICONS = I; /* ============ 4. UNIT / CURRENCY STATE ============ */ P5.UNITS = 'imp'; P5.CUR = '$'; try{ var _u = localStorage.getItem('cc_units'), _c = localStorage.getItem('cc_cur'); if(_u==='imp'||_u==='met') P5.UNITS = _u; if(_c==='$'||_c==='£'||_c==='€') P5.CUR = _c; }catch(e){} /* ============ 5. FIELD COMPONENTS ============ */ var FIELD_UNITS = ['ft','in','m','cm','mm']; P5.unitSelectHTML = function(fieldId, kind, defUnit){ var list = (kind==='len'||kind==='sm') ? FIELD_UNITS : (kind==='yd3' ? ['yd3','m3','ft3'] : []); if(!list.length) return ''; var h = ''; }; P5.fieldHTML = function(f){ var isDim = (f.kind==='len'||f.kind==='sm'||f.kind==='yd3'); var sel = isDim ? P5.unitSelectHTML(f.id, f.kind, f.defUnit||'ft') : ''; var suffix = (f.kind==='usd') ? ''+P5.CUR+'' : ''; var quick = ''; if(f.quick && f.quick.length){ quick = '
'; f.quick.forEach(function(q){ quick += ''; }); quick += '
'; } var hide = f.hideShape ? ' data-hideshape="'+f.hideShape+'"' : ''; return '
' +'
'+(sel||suffix)+'
'+quick+'
'; }; /* Waste percentage selector row */ P5.wasteRowHTML = function(defPct){ defPct = defPct || 10; function opt(v, lbl){ return ''; } return '
' +'
' +'
'; }; P5.readWaste = function(panel){ var wcus = panel.querySelector('.wasteCustom'); var wv = wcus ? parseFloat(wcus.value) : NaN; if(isFinite(wv) && wv>0) return Math.min(wv,100); var wsel = panel.querySelector('.wasteSel'); return wsel ? (parseFloat(wsel.value)||0) : 0; }; P5.priceFieldHTML = function(fid, label, ph, note){ return '
' +'
' +''+P5.CUR+'
'; }; P5.checkHTML = function(fid, label, checked){ return ''; }; /* ============ 6. RESULT COMPONENTS ============ */ P5.cardsHTML = function(cards){ var h = '
'; cards.forEach(function(c){ h += '
'+(I[c.icon]||I.cube)+'' +''+c.big+''+c.lbl+'
'; }); return h+'
'; }; P5.subHTML = function(items){ var h = '
'; items.forEach(function(it){ h += ''+it[0]+' '+it[1]+''; }); return h+'
'; }; P5.nwColHTML = function(title, cards, sub){ return '

'+title+'

'+P5.cardsHTML(cards)+P5.subHTML(sub)+'
'; }; P5.workingHTML = function(text){ return '
Working: '+text+'
'; }; P5.noteHTML = function(text){ return '

'+text+'

'; }; /* Bag selector: 80/60/50/40 lb and 25/20 kg */ var BAG_OPTIONS = [ { id:'b80', label:'80 lb' }, { id:'b60', label:'60 lb' }, { id:'b50', label:'50 lb' }, { id:'b40', label:'40 lb' }, { id:'k25', label:'25 kg' }, { id:'k20', label:'20 kg' } ]; P5.selectedBag = 'b80'; P5.bagLabel = function(id){ var m = { b80:'80 lb', b60:'60 lb', b50:'50 lb', b40:'40 lb', k25:'25 kg', k20:'20 kg' }; return m[id] || '80 lb'; }; P5.bagSelectorHTML = function(){ var h = '
'; BAG_OPTIONS.forEach(function(b){ var on = (b.id===P5.selectedBag); h += ''; }); return h+'
'; }; P5.wireBags = function(panel, mode, rerender){ panel.querySelectorAll('[data-bag]').forEach(function(b){ b.addEventListener('click', function(){ P5.selectedBag = b.getAttribute('data-bag'); rerender(); }); }); }; /* Copy / print / share / reset */ P5.actionsHTML = function(modeId){ return '
' +'' +'' +'' +'
'; }; function copyText(txt, btn){ var done = function(ok){ var sp = btn.querySelector('span'), old = sp.textContent; btn.classList.add('ok'); sp.textContent = ok ? 'Copied' : 'Copy failed'; setTimeout(function(){ btn.classList.remove('ok'); sp.textContent = old; }, 1600); }; if(navigator.clipboard && navigator.clipboard.writeText){ navigator.clipboard.writeText(txt).then(function(){ done(true); }, function(){ done(false); }); } else { var ta = document.createElement('textarea'); ta.value = txt; ta.style.position='fixed'; ta.style.opacity='0'; document.body.appendChild(ta); ta.select(); try{ done(document.execCommand('copy')); }catch(e){ done(false); } document.body.removeChild(ta); } } P5.buildShareURL = function(mode, panel){ var params = new URLSearchParams(); params.set('tool', mode.id); panel.querySelectorAll('input[data-fid]').forEach(function(inp){ if(inp.value) params.set(inp.getAttribute('data-fid'), inp.value); }); panel.querySelectorAll('select.cc-funit').forEach(function(sel){ params.set(sel.getAttribute('data-funit')+'_u', sel.value); }); var wsel = panel.querySelector('.wasteSel'); if(wsel) params.set('waste', wsel.value); var base = window.location.origin + window.location.pathname; return base + '#' + mode.id + '?' + params.toString(); }; P5.doAction = function(act, btn, panel, mode){ var txt = panel._summary || 'Concrete Calculator: concretequantity.com'; if(act==='print'){ window.print(); return; } if(act==='reset'){ panel.querySelectorAll('input[data-fid], input.wasteCustom').forEach(function(i){ i.value=''; }); var wsel = panel.querySelector('.wasteSel'); if(wsel) wsel.value='10'; P5.calcPanel(mode, panel); P5.updatePreview(mode, panel); return; } if(act==='share'){ var url = P5.buildShareURL(mode, panel); if(navigator.share){ navigator.share({title:mode.title, text:panel._summary||'', url:url}) .catch(function(){ copyText(url, btn); }); return; } copyText(url, btn); return; } copyText(txt, btn); }; P5.wireActions = function(panel, mode){ panel.querySelectorAll('.cc-act, .cc-reset').forEach(function(b){ b.addEventListener('click', function(){ P5.doAction(b.getAttribute('data-act'), b, panel, mode); }); }); }; /* ============ 7. LIVE SVG PREVIEW ============ */ P5.dimLabel = function(txt, x, y, anchor){ return ''+P5.esc(txt)+''; }; P5.getLiveDims = function(mode, panel){ var live = {}; panel.querySelectorAll('input[data-fid]').forEach(function(inp){ var fid = inp.getAttribute('data-fid'); var sel = panel.querySelector('select.cc-funit[data-funit="'+fid+'"]'); if(inp.value) live[fid] = { val: inp.value, unit: sel ? sel.value : '' }; }); var shapeSel = panel.querySelector('.shapeSel'); if(shapeSel) live.shape = shapeSel.value; return live; }; P5.updatePreview = function(mode, panel){ var wrap = panel.querySelector('.cc-diagram'); if(!wrap || !mode.diagram) return; wrap.innerHTML = mode.diagram(P5.getLiveDims(mode, panel)) + '
Live preview updates as you type
'; }; /* ============ 8. VALIDATION ============ */ var VLIMIT = { len:5000, sm:1200, num:100000, yd3:100000, usd:1000000 }; P5.validateFields = function(mode, vals, units){ var empty = '
'+(mode.empty||'Enter your measurements above to see results instantly.')+'
'; var allFields = (mode.fields||[]).concat(mode.extraFields||[]); for(var i=0;i]*>/g,''); if(f.optional) continue; if(raw===''||raw==null) return empty; var x = parseFloat(raw); if(!isFinite(x)) return ''; if(x<0) return ''; if(x===0) return ''; var u = units[f.id] || f.defUnit || 'ft'; var imp = x; if(f.kind==='len') imp = x*(TO_FT[u]||1); else if(f.kind==='sm') imp = x*(TO_IN[u]||1); else if(f.kind==='yd3'){ if(u==='m3') imp = x*1.30795; else if(u==='ft3') imp = x/27; } var lim = VLIMIT[f.kind]||100000; if(imp > lim) return ''; } return null; }; /* ============ 9. RELATED CALCULATORS + VERIFIED FOOTER ============ */ var ALL_LINKS = { slab:['Slab','/slab-concrete-calculator/'], footing:['Footing','/footing-concrete-calculator/'], wall:['Wall','/wall-concrete-calculator/'], column:['Column','/column-concrete-calculator/'], posthole:['Post Holes','/post-hole-concrete-calculator/'], circle:['Circle Slab','/circular-slab-concrete-calculator/'], curb:['Curb','/curb-concrete-calculator/'], stairs:['Stairs','/stairs-concrete-calculator/'], bags:['Bags','/concrete-bag-calculator/'], mix:['Mix Ratio','/concrete-mix-ratio-calculator/'], rebar:['Rebar','/rebar-calculator/'], cost:['Cost','/concrete-cost-calculator/'], driveway:['Driveway','/driveway-concrete-calculator/'], gravel:['Gravel','/gravel-calculator/'], blocks:['Block Wall','/block-wall-calculator/'], mortar:['Mortar','/mortar-calculator/'], readymix:['Ready Mix vs Bags','/ready-mix-vs-bags-calculator/'], patio:['Patio','/patio-concrete-calculator/'], sidewalk:['Sidewalk','/sidewalk-concrete-calculator/'], sonotube:['Sonotube Piers','/sonotube-concrete-calculator/'], countertop:['Countertop','/countertop-concrete-calculator/'], sealer:['Sealer','/concrete-sealer-calculator/'], weight:['Weight','/concrete-weight-calculator/'], truckload:['Truck Load','/concrete-truck-load-calculator/'], wcratio:['Water Cement Ratio','/water-cement-ratio-calculator/'], evaporation:['Evaporation Rate','/concrete-evaporation-rate-calculator/'], retainingwall:['Retaining Wall','/retaining-wall-calculator/'], screed:['Floor Screed','/floor-screed-calculator/'], ramp:['Ramp','/concrete-ramp-calculator/'], mono:['Monolithic Slab','/monolithic-slab-calculator/'], formwork:['Wall Formwork','/concrete-formwork-calculator/'], leveler:['Self Levelling Compound','/self-levelling-compound-calculator/'] }; P5.relatedHTML = function(links){ var h = ''; }; P5.verifiedHTML = function(text){ return '
Last verified: 26 Oct 2026. '+text+'
'; }; /* ============ 10. MODE REGISTRY ============ */ P5._modes = {}; P5.register = function(mode){ if(!mode || !mode.id) return; P5._modes[mode.id] = mode; }; /* ============ 11. PANEL BUILD + CALC ============ */ P5.calcPanel = function(mode, panel){ if(mode.syncExtras) mode.syncExtras(panel); var vals = {}, units = {}; panel.querySelectorAll('input[data-fid]').forEach(function(inp){ var fid = inp.getAttribute('data-fid'); vals[fid] = inp.value.trim(); var sel = panel.querySelector('select.cc-funit[data-funit="'+fid+'"]'); units[fid] = sel ? sel.value : null; }); var box = panel.querySelector('.cc-out'); var verr = P5.validateFields(mode, vals, units); if(verr){ box.innerHTML = verr; panel._summary=''; return; } if(mode.validateExtra){ var xerr = mode.validateExtra(panel, vals, units); if(xerr){ box.innerHTML = xerr; panel._summary=''; return; } } var imp = mode.toImp(vals, units); var res = mode.render(imp, vals, units, panel); box.innerHTML = res.html; panel._summary = res.summary || ''; P5.wireBags(panel, mode, function(){ P5.calcPanel(mode, panel); }); P5.wireActions(panel, mode); }; P5.buildPanel = function(mode){ var p = document.createElement('div'); p.className = 'cc-panel on'; p.setAttribute('role','tabpanel'); var inner = '

'+mode.title+'

' +'

'+mode.formula+'

' +'
' +'
'; (mode.fields||[]).forEach(function(f){ inner += P5.fieldHTML(f); }); if(mode.extrasHTML) inner += mode.extrasHTML(); inner += '
' +'
' + P5.relatedHTML(mode.links || []) + P5.verifiedHTML(mode.verified || ''); p.innerHTML = inner; p.querySelectorAll('input,select').forEach(function(el){ el.addEventListener('input', function(){ P5.calcPanel(mode, p); P5.updatePreview(mode, p); }); el.addEventListener('change', function(){ P5.calcPanel(mode, p); P5.updatePreview(mode, p); }); }); p.querySelectorAll('select.cc-funit').forEach(function(sel){ sel.addEventListener('change', function(){ var fid = sel.getAttribute('data-funit'); var inp = p.querySelector('input[data-fid="'+fid+'"]'); if(!inp || !inp.value){ P5.calcPanel(mode, p); P5.updatePreview(mode, p); return; } var field = null; (mode.fields||[]).forEach(function(f){ if(f.id===fid) field=f; }); if(!field) return; var oldU = sel.getAttribute('data-prev') || field.defUnit || 'ft'; var newU = sel.value; if(oldU!==newU) inp.value = P5.convertVal(inp.value, oldU, newU, field.kind); sel.setAttribute('data-prev', newU); P5.calcPanel(mode, p); P5.updatePreview(mode, p); }); sel.setAttribute('data-prev', sel.value); }); /* Quick value buttons */ p.querySelectorAll('[data-quick]').forEach(function(b){ b.addEventListener('click', function(){ var fid = b.getAttribute('data-qfid'); var inp = p.querySelector('input[data-fid="'+fid+'"]'); var sel = p.querySelector('select.cc-funit[data-funit="'+fid+'"]'); if(inp){ var qv = b.getAttribute('data-quick'); if(sel && (sel.value==='m'||sel.value==='cm'||sel.value==='mm')){ var cm = parseFloat(qv)*2.54; if(sel.value==='m') inp.value = P5.fmt(cm/100,3); else if(sel.value==='cm') inp.value = P5.fmt(cm,1); else inp.value = P5.fmt(cm*10,0); } else { inp.value = qv; if(sel) sel.value='in'; } p.querySelectorAll('[data-qfid="'+fid+'"]').forEach(function(x){ x.classList.remove('on'); }); b.classList.add('on'); P5.calcPanel(mode, p); P5.updatePreview(mode, p); } }); }); P5.calcPanel(mode, p); P5.updatePreview(mode, p); return p; }; /* ============ 12. HEADER TOGGLES + BOOT ============ */ P5.wireHeader = function(){ var ui = document.getElementById('p5uImp'), um = document.getElementById('p5uMet'), uc = document.getElementById('p5uCur'); function paint(){ if(ui) ui.classList.toggle('on', P5.UNITS==='imp'); if(um) um.classList.toggle('on', P5.UNITS==='met'); if(uc) uc.textContent = (P5.CUR==='£' ? '£ GBP' : (P5.CUR==='€' ? '€ EUR' : '$ USD')); document.querySelectorAll('.p5CurSym').forEach(function(s){ s.textContent = P5.CUR; }); } if(ui) ui.onclick = function(){ P5.UNITS='imp'; try{localStorage.setItem('cc_units','imp');}catch(e){} document.querySelectorAll('.cc-funit').forEach(function(sel){ var fid = sel.getAttribute('data-funit'); var inp = document.querySelector('input[data-fid="'+fid+'"]'); var target = 'ft'; var inpKind = inp ? inp.getAttribute('data-kind') : 'len'; if(inpKind==='sm') target = 'in'; else if(inpKind==='yd3') target = 'yd3'; if(inp && inp.value){ var oldU = sel.value; inp.value = P5.convertVal(inp.value, oldU, target, (target==='in'?'sm':'len')); } sel.value = target; sel.setAttribute('data-prev', target); }); paint(); P5.rerenderAll(); }; if(um) um.onclick = function(){ P5.UNITS='met'; try{localStorage.setItem('cc_units','met');}catch(e){} document.querySelectorAll('.cc-funit').forEach(function(sel){ var fid = sel.getAttribute('data-funit'); var inp = document.querySelector('input[data-fid="'+fid+'"]'); var inpKind = inp ? inp.getAttribute('data-kind') : 'len'; var isSm = (inpKind==='sm'); var target = isSm ? 'cm' : 'm'; if(inpKind==='yd3') target = 'm3'; if(inp && inp.value){ inp.value = P5.convertVal(inp.value, sel.value, target, isSm?'sm':'len'); } sel.value = target; sel.setAttribute('data-prev', target); }); paint(); P5.rerenderAll(); }; if(uc) uc.onclick = function(){ P5.CUR = (P5.CUR==='$') ? '£' : ((P5.CUR==='£') ? '€' : '$'); try{localStorage.setItem('cc_cur',P5.CUR);}catch(e){} paint(); P5.rerenderAll(); }; paint(); }; P5.rerenderAll = function(){ Object.keys(P5._modes).forEach(function(id){ var panel = document.getElementById('p5p-'+id); if(panel) { P5.calcPanel(P5._modes[id], panel); P5.updatePreview(P5._modes[id], panel); } }); }; P5.boot = function(){ var id = window.CC_SINGLE; var mode = P5._modes[id]; if(!mode) return; var c = document.getElementById('ccSingle'); if(!c) return; var p = P5.buildPanel(mode); p.id = 'p5p-'+mode.id; c.appendChild(p); P5.wireHeader(); }; if(typeof document !== 'undefined'){ if(document.readyState === 'loading'){ document.addEventListener('DOMContentLoaded', P5.boot); } else { P5.boot(); } } })(); /* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 chunk - Screed ADDITIVE chunk. Registers the 'screed' mode with P5. Does not touch V6, the batch 1 (P2) script, the batch 2 (P3) script, the batch 3 (P4) script, or any existing tools. Constants: - Dry volume factor 1.33: wet screed volume x 1.33 gives the dry materials volume (screed worked examples, 1:4 mix) - Cement bulk density 1,440 kg/m3; sharp sand 1,600 kg/m3 (standard published bulk densities used by mix calculators) - BS 8204-1 minimum thicknesses: bonded 25 mm, unbonded 50 mm, floating 65 mm (levelling screeds) Note: this tool sizes a sand and cement levelling screed (floor topping), not structural concrete. It is not a mortar tool: mortar is for joints and brickwork, screed is a floor layer laid over a slab or insulation. ============================================================ */ (function(){ "use strict"; P5.calcScreed = function(o){ // o: {areaM2, thickMm, ratio} ratio = sand parts per 1 cement. // {waste} waste percent, {bagKg} cement bag size in kg. var wet = (o.areaM2||0) * ((o.thickMm||0)/1000); var orderWet = wet * (1 + (o.waste||0)/100); var dry = orderWet * P5.SCREED_DRY_FACTOR; var parts = 1 + (o.ratio||4); var cementVol = dry / parts; var cementKg = cementVol * P5.CEMENT_KG_M3; var sandVol = dry * (o.ratio||4) / parts; var sandTonnes = sandVol * P5.SAND_T_PER_M3; var bagKg = o.bagKg || 25; return { areaM2: o.areaM2||0, thickMm: o.thickMm||0, wet: wet, orderWet: orderWet, dry: dry, cementVol: cementVol, cementKg: cementKg, bags: P5.ceilSafe(cementKg/bagKg), sandVol: sandVol, sandTonnes: sandTonnes, ft3: wet * P5.FT3_PER_M3, yd3: wet / P5.M3_PER_YD3, orderFt3: orderWet * P5.FT3_PER_M3, orderYd3: orderWet / P5.M3_PER_YD3 }; }; function screedSVG(live){ function t(fid, fb){ var e = live[fid]; if(e && e.val !== '') return P5.esc(String(e.val)+' '+(e.unit||'')); return fb; } var h = ''; h += '' + '' + '' + '' + '' + P5.dimLabel(t('l','Length'), 75, 92) + P5.dimLabel(t('t','Thickness'), 110, 52) + 'Screed layer' + 'Slab / insulation below'; h += ''; return h; } P5.register({ id:'screed', tab:'Screed', title:'Floor Screed Calculator', formula:'Wet volume = Area x Thickness; dry volume = wet x 1.33; cement = dry / (1 + sand parts)', diagram: screedSVG, fields:[ {id:'l',label:'Length',kind:'len',ph:'5',defUnit:'m'}, {id:'w',label:'Width',kind:'len',ph:'4',defUnit:'m'}, {id:'t',label:'Screed thickness',kind:'sm',ph:'50',defUnit:'mm',quick:[1,2]} ], extrasHTML:function(){ return '
' +'
' +'
' +'
' +'
' +'
' + P5.wasteRowHTML(10); }, empty:'Enter the room size and screed thickness above.', toImp:function(vals,units){ return { lFt:P5.toFt(vals.l,units.l), wFt:P5.toFt(vals.w,units.w), tIn:P5.toIn(vals.t,units.t) }; }, render:function(imp, vals, units, panel){ var mixSel = panel.querySelector('.mixSel'); var ratio = mixSel ? parseFloat(mixSel.value) : 4; var stypeSel = panel.querySelector('.stypeSel'); var stype = stypeSel ? stypeSel.value : 'bonded'; var bagSel = panel.querySelector('.bagSel'); var bagKg = bagSel ? parseFloat(bagSel.value) : 25; var waste = P5.readWaste(panel); var areaM2 = imp.lFt * 0.3048 * imp.wFt * 0.3048; var thickMm = imp.tIn * 25.4; var R = P5.calcScreed({areaM2:areaM2, thickMm:thickMm, ratio:ratio, waste:waste, bagKg:bagKg}); var mins = {bonded:25, unbonded:50, floating:65}; var typeNames = {bonded:'Bonded', unbonded:'Unbonded', floating:'Floating'}; var h = '

Floor screed materials

'; h += '
'; h += P5.nwColHTML('Cement', [{icon:'bags',big:P5.fmt(R.bags,0),lbl:'Bags of '+bagKg+' kg'},{icon:'cube',big:P5.fmt(R.cementKg,0),lbl:'Kilograms of cement'}], [[P5.fmt(R.cementVol),'m3 of cement (dry volume)'],['1 : '+P5.fmt(ratio,1),'cement to sand mix']]); h += P5.nwColHTML('Sand', [{icon:'pile',big:P5.fmt(R.sandVol),lbl:'m3 of Sand'},{icon:'pile',big:P5.fmt(R.sandTonnes),lbl:'Tonnes of Sand'}], [[P5.fmt(R.wet),'m3 wet screed'],[P5.fmt(R.orderWet),'m3 with '+P5.fmt(waste,0)+'% waste'],[P5.fmt(R.dry),'m3 dry materials']]); h += '
'; h += P5.workingHTML('Area = '+P5.fmt(areaM2)+' m2. Wet volume = '+P5.fmt(areaM2)+' x '+P5.fmt(thickMm,1)+' mm = '+P5.fmt(R.wet)+' m3; with waste '+P5.fmt(R.orderWet)+' m3; dry volume = '+P5.fmt(R.orderWet)+' x 1.33 = '+P5.fmt(R.dry)+' m3. Cement = '+P5.fmt(R.dry)+' / '+(1+ratio)+' = '+P5.fmt(R.cementKg,0)+' kg = '+P5.fmt(R.bags,0)+' bags. Sand = '+P5.fmt(R.sandVol)+' m3 ('+P5.fmt(R.sandTonnes)+' tonnes).'); if(thickMm < mins[stype]){ h += P5.noteHTML('Thickness warning: a '+typeNames[stype].toLowerCase()+' levelling screed should be at least '+mins[stype]+' mm thick to BS 8204-1. Your '+P5.fmt(thickMm,1)+' mm layer is below that minimum, so check the construction type or increase the thickness.'); } else { h += P5.noteHTML(typeNames[stype]+' screed minimum to BS 8204-1: '+mins[stype]+' mm. Your '+P5.fmt(thickMm,1)+' mm layer meets that minimum. Bonded screeds need a clean, sound slab and a bonding agent or grout; unbonded and floating screeds sit on a separating membrane or insulation.'); } h += P5.noteHTML('Screed dries at roughly 1 mm per day up to 50 mm thick in normal indoor conditions, so a 50 mm screed needs about 50 days before floor finishes go down. Do not force dry with direct heat. Quantities are estimates: actual cement and sand vary with moisture, compaction and how level the slab below is.'); h += P5.actionsHTML('screed')+'
'; var summary = 'Floor screed ('+P5.fmt(areaM2)+' m2 at '+P5.fmt(thickMm,1)+' mm, 1:'+P5.fmt(ratio,1)+'): '+P5.fmt(R.bags,0)+' bags of '+bagKg+' kg cement and '+P5.fmt(R.sandVol)+' m3 sand ('+P5.fmt(R.sandTonnes)+' tonnes). via concretequantity.com/floor-screed-calculator/'; return {html:h, summary:summary}; }, verified:'Dry volume factor 1.33, cement bulk density 1,440 kg/m3 and sand bulk density 1,600 kg/m3: standard published values used by screed and mix calculators. BS 8204-1 minimum thicknesses: bonded 25 mm, unbonded 50 mm, floating 65 mm. Drying guide of about 1 mm per day to 50 mm: widely published screed drying guidance.', links:['slab','mortar','gravel','bags','cost','leveler'] }); })(); /* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 chunk - Ramp ADDITIVE chunk. Registers the 'ramp' mode with P5. Does not touch V6, the batch 1 (P2) script, the batch 2 (P3) script, the batch 3 (P4) script, or any existing tools. Constants (2010 ADA Standards for Accessible Design): - Maximum running slope 1:12 (8.33%), section 405.2 - Maximum rise per ramp run 30 in, section 405.6 - Minimum clear width 36 in, section 405.5 - Minimum landing length 60 in, section 405.7 - Handrails required when a run rises more than 6 in, section 405.8 Model: the ramp is a uniform thickness slab laid on a prepared slope, so ramp volume = sloped length x width x thickness. Intermediate landings are flat slabs 60 in long at the same width and thickness. This is a planning and materials tool, not a code compliance certification: local codes can be stricter than the federal baseline. ============================================================ */ (function(){ "use strict"; P5.calcRamp = function(o){ // o: {riseIn, denom, widthFt, thickIn} {waste} waste percent. var runIn = (o.riseIn||0) * (o.denom||12); var riseFt = (o.riseIn||0)/12; var runFt = runIn/12; var slopeLenFt = Math.sqrt(runFt*runFt + riseFt*riseFt); var slopePct = (o.denom||12) ? (100/(o.denom||12)) : 0; var angleDeg = Math.atan(1/(o.denom||12)) * 180/Math.PI; var runs = P5.ceilSafe((o.riseIn||0)/P5.ADA_MAX_RISE_IN); if(runs < 1) runs = 1; var landings = runs - 1; var thickFt = (o.thickIn||0)/12; var rampFt3 = slopeLenFt * (o.widthFt||0) * thickFt; var landingFt3 = landings * (P5.ADA_LANDING_IN/12) * (o.widthFt||0) * thickFt; var totalFt3 = rampFt3 + landingFt3; var orderFt3 = totalFt3 * (1 + (o.waste||0)/100); return { runIn: runIn, runFt: runFt, slopeLenFt: slopeLenFt, slopePct: slopePct, angleDeg: angleDeg, runs: runs, landings: landings, rampFt3: rampFt3, landingFt3: landingFt3, totalFt3: totalFt3, orderFt3: orderFt3, yd3: totalFt3/27, orderYd3: orderFt3/27, m3: totalFt3 * P5.M3_PER_FT3, orderM3: orderFt3 * P5.M3_PER_FT3, bags80: P5.ceilSafe(orderFt3/P5.BAG.b80), slopeOk: (o.denom||12) >= P5.ADA_MAX_DENOM, widthOk: (o.widthFt||0)*12 >= P5.ADA_MIN_WIDTH_IN, handrails: (o.riseIn||0) > P5.ADA_HANDRAIL_RISE_IN }; }; function rampSVG(live){ function t(fid, fb){ var e = live[fid]; if(e && e.val !== '') return P5.esc(String(e.val)+' '+(e.unit||'')); return fb; } var h = ''; h += '' + '' + '' + '' + '' + P5.dimLabel(t('rise','Rise'), 146, 60) + P5.dimLabel('Run', 75, 104) + P5.dimLabel('1 : 12 max', 75, 52); h += ''; return h; } P5.register({ id:'ramp', tab:'Ramp', title:'Concrete Ramp Calculator', formula:'Run = Rise x slope denominator; sloped length = sqrt(run squared + rise squared); volume = sloped length x width x thickness', diagram: rampSVG, fields:[ {id:'rise',label:'Total vertical rise',kind:'sm',ph:'24',defUnit:'in'}, {id:'width',label:'Ramp width',kind:'len',ph:'3',defUnit:'ft'}, {id:'t',label:'Slab thickness',kind:'sm',ph:'4',defUnit:'in',quick:[4,6]} ], extrasHTML:function(){ return '
' +'
' + P5.wasteRowHTML(10); }, empty:'Enter the total rise, width and slab thickness above.', toImp:function(vals,units){ return { riseIn:P5.toIn(vals.rise,units.rise), widthFt:P5.toFt(vals.width,units.width), tIn:P5.toIn(vals.t,units.t) }; }, render:function(imp, vals, units, panel){ var slopeSel = panel.querySelector('.slopeSel'); var denom = slopeSel ? parseFloat(slopeSel.value) : 12; var waste = P5.readWaste(panel); var R = P5.calcRamp({riseIn:imp.riseIn, denom:denom, widthFt:imp.widthFt, thickIn:imp.tIn, waste:waste}); var h = '

Concrete ramp

'; h += '
'; h += P5.nwColHTML('Concrete', [{icon:'ramp',big:P5.fmt(R.totalFt3,1),lbl:'Cubic Feet (net)'},{icon:'cube',big:P5.fmt(R.yd3),lbl:'Cubic Yards (net)'},{icon:'bags',big:P5.fmt(R.bags80,0),lbl:'80 lb Bags (with waste)'}], [[P5.fmt(R.orderFt3,1),'ft3 to order'],[P5.fmt(R.orderYd3),'yd3 to order'],[P5.fmt(R.orderM3),'m3 to order']]); h += P5.nwColHTML('Ramp layout', [{icon:'ramp',big:P5.fmt(R.runFt,1),lbl:'Feet of Run'},{icon:'ramp',big:P5.fmt(R.slopeLenFt,1),lbl:'Feet of Sloped Surface'}], [['1 : '+P5.fmt(denom,0),'slope'],[P5.fmt(R.slopePct,2)+'%','grade'],[P5.fmt(R.angleDeg,2)+' deg','angle'],[R.runs+' run'+(R.runs>1?'s':''),'at 30 in max rise each'],[R.landings+' intermediate landing'+(R.landings!==1?'s':''),'60 in long each']]); h += '
'; h += P5.workingHTML('Run = '+P5.fmt(imp.riseIn,1)+' in x '+P5.fmt(denom,0)+' = '+P5.fmt(R.runFt,1)+' ft. Sloped length = sqrt('+P5.fmt(R.runFt,1)+' squared + '+(imp.riseIn/12).toFixed(2)+' squared) = '+P5.fmt(R.slopeLenFt,2)+' ft. Ramp concrete = '+P5.fmt(R.slopeLenFt,2)+' x '+P5.fmt(imp.widthFt,1)+' ft x '+P5.fmt(imp.tIn,1)+' in = '+P5.fmt(R.rampFt3,1)+' ft3. Landings add '+P5.fmt(R.landingFt3,1)+' ft3, total '+P5.fmt(R.totalFt3,1)+' ft3.'); if(R.slopeOk && R.widthOk){ h += P5.noteHTML('Slope check: 1 : '+P5.fmt(denom,0)+' ('+P5.fmt(R.slopePct,2)+'%) is within the ADA maximum running slope of 1 : 12, and the width of '+P5.fmt(imp.widthFt*12,0)+' in meets the ADA minimum clear width of 36 in.'); } else { if(!R.slopeOk) h += P5.noteHTML('Slope check: 1 : '+P5.fmt(denom,0)+' is steeper than the ADA maximum of 1 : 12. Lengthen the run, add a switchback, or treat it as an assisted ramp only.'); if(!R.widthOk) h += P5.noteHTML('Width check: the ADA minimum clear width is 36 in. Your ramp is '+P5.fmt(imp.widthFt*12,0)+' in wide.'); } if(R.handrails){ h += P5.noteHTML('Handrails: a ramp run rising more than 6 in needs handrails on both sides to ADA section 405.8. This rise needs handrails.'); } if(R.landings > 0){ h += P5.noteHTML('Landings: no single ramp run may rise more than 30 in, so this climb is split into '+R.runs+' runs with '+R.landings+' level landing'+(R.landings!==1?'s':'')+' of 60 in between them. Top and bottom landings are needed too and are not counted in the concrete above.'); } h += P5.noteHTML('Planning figures only, not a code compliance certification. Landings, handrails, edge protection, cross slope and drainage also decide whether a ramp passes inspection, and local codes can be stricter than the federal baseline.'); h += P5.actionsHTML('ramp')+'
'; var summary = 'Concrete ramp (rise '+P5.fmt(imp.riseIn,1)+' in at 1:'+P5.fmt(denom,0)+', '+P5.fmt(imp.widthFt,1)+' ft wide): run '+P5.fmt(R.runFt,1)+' ft, '+P5.fmt(R.totalFt3,1)+' ft3 ('+P5.fmt(R.yd3)+' yd3) net, '+P5.fmt(R.bags80,0)+' bags of 80 lb with waste. via concretequantity.com/concrete-ramp-calculator/'; return {html:h, summary:summary}; }, verified:'ADA limits from the 2010 ADA Standards for Accessible Design: maximum running slope 1:12 (section 405.2), maximum rise per run 30 in (section 405.6), minimum clear width 36 in (section 405.5), minimum landing length 60 in (section 405.7), handrails when a run rises more than 6 in (section 405.8). Ramp volume is the sloped slab model: sloped length x width x thickness.', links:['stairs','sidewalk','patio','slab','bags','cost'] }); })(); /* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 chunk - Mono ADDITIVE chunk. Registers the 'mono' mode with P5. Does not touch V6, the batch 1 (P2) script, the batch 2 (P3) script, the batch 3 (P4) script, or any existing tools. A monolithic slab is a slab and its perimeter footing poured as one piece: a flat field slab plus a thickened edge beam around the perimeter. The edge beam is deeper than the field slab, so the extra concrete is the perimeter ring area times the extra depth. The ring area is perimeter x edge width minus the four corners counted twice (4 x edge width squared). This tool is different from the existing slab tool (flat slab only) and the existing footing tool (strip footings alone): it combines both in one pour and avoids double counting the corners where the edge beam turns. Edge width and edge depth are the total dimensions of the thickened edge, not additions on top of the slab thickness. ============================================================ */ (function(){ "use strict"; P5.calcMono = function(o){ // o: {lFt, wFt, tIn, ewIn, edIn} {waste} waste percent. var tFt = (o.tIn||0)/12; var ewFt = (o.ewIn||0)/12; var edFt = (o.edIn||0)/12; var fieldFt3 = (o.lFt||0) * (o.wFt||0) * tFt; var perimeter = 2 * ((o.lFt||0) + (o.wFt||0)); var ringFt2 = perimeter * ewFt - 4 * ewFt * ewFt; if(ringFt2 < 0) ringFt2 = 0; var extraFt = edFt - tFt; if(extraFt < 0) extraFt = 0; var edgeFt3 = ringFt2 * extraFt; var totalFt3 = fieldFt3 + edgeFt3; var orderFt3 = totalFt3 * (1 + (o.waste||0)/100); return { fieldFt3: fieldFt3, perimeter: perimeter, ringFt2: ringFt2, edgeFt3: edgeFt3, totalFt3: totalFt3, orderFt3: orderFt3, yd3: totalFt3/27, orderYd3: orderFt3/27, m3: totalFt3 * P5.M3_PER_FT3, orderM3: orderFt3 * P5.M3_PER_FT3, bags80: P5.ceilSafe(orderFt3/P5.BAG.b80), areaFt2: (o.lFt||0) * (o.wFt||0), edgeShallow: (o.edIn||0) <= (o.tIn||0) }; }; function monoSVG(live){ function t(fid, fb){ var e = live[fid]; if(e && e.val !== '') return P5.esc(String(e.val)+' '+(e.unit||'')); return fb; } var h = ''; h += '' + '' + '' + '' + P5.dimLabel(t('l','Length'), 75, 98) + P5.dimLabel(t('ew','Edge width'), 75, 56) + 'Thickened edge all round'; h += ''; return h; } P5.register({ id:'mono', tab:'Monolithic Slab', title:'Monolithic Slab Calculator', formula:'Total = field slab (L x W x thickness) + edge ring (perimeter x edge width minus 4 corners) x extra depth', diagram: monoSVG, fields:[ {id:'l',label:'Slab length',kind:'len',ph:'40',defUnit:'ft'}, {id:'w',label:'Slab width',kind:'len',ph:'30',defUnit:'ft'}, {id:'t',label:'Field slab thickness',kind:'sm',ph:'4',defUnit:'in',quick:[4,6]}, {id:'ew',label:'Edge beam width',kind:'sm',ph:'12',defUnit:'in',quick:[12,16,20]}, {id:'ed',label:'Edge beam total depth',kind:'sm',ph:'12',defUnit:'in',quick:[12,16,24]} ], extrasHTML:function(){ return P5.wasteRowHTML(10); }, empty:'Enter the slab size, field thickness and edge beam size above.', toImp:function(vals,units){ return { lFt:P5.toFt(vals.l,units.l), wFt:P5.toFt(vals.w,units.w), tIn:P5.toIn(vals.t,units.t), ewIn:P5.toIn(vals.ew,units.ew), edIn:P5.toIn(vals.ed,units.ed) }; }, render:function(imp, vals, units, panel){ var waste = P5.readWaste(panel); var R = P5.calcMono({lFt:imp.lFt, wFt:imp.wFt, tIn:imp.tIn, ewIn:imp.ewIn, edIn:imp.edIn, waste:waste}); var h = '

Monolithic slab concrete

'; h += '
'; h += P5.nwColHTML('Concrete', [{icon:'edge',big:P5.fmt(R.totalFt3,1),lbl:'Cubic Feet (net)'},{icon:'cube',big:P5.fmt(R.yd3),lbl:'Cubic Yards (net)'},{icon:'bags',big:P5.fmt(R.bags80,0),lbl:'80 lb Bags (with waste)'}], [[P5.fmt(R.orderFt3,1),'ft3 to order'],[P5.fmt(R.orderYd3),'yd3 to order'],[P5.fmt(R.orderM3),'m3 to order']]); h += P5.nwColHTML('Breakdown', [{icon:'slab',big:P5.fmt(R.fieldFt3,1),lbl:'Field Slab ft3'},{icon:'edge',big:P5.fmt(R.edgeFt3,1),lbl:'Edge Beam ft3'}], [[P5.fmt(R.areaFt2,0),'ft2 slab area'],[P5.fmt(R.perimeter,0),'ft perimeter'],[P5.fmt(R.ringFt2,1),'ft2 edge ring area']]); h += '
'; h += P5.workingHTML('Field slab = '+P5.fmt(imp.lFt,1)+' x '+P5.fmt(imp.wFt,1)+' x '+(imp.tIn/12).toFixed(3)+' ft = '+P5.fmt(R.fieldFt3,1)+' ft3. Edge ring = '+P5.fmt(R.perimeter,0)+' ft perimeter x '+(imp.ewIn/12).toFixed(2)+' ft minus 4 corners ('+P5.fmt(4*(imp.ewIn/12)*(imp.ewIn/12),2)+' ft2) = '+P5.fmt(R.ringFt2,1)+' ft2. Edge beam = '+P5.fmt(R.ringFt2,1)+' x '+((imp.edIn-imp.tIn)/12).toFixed(3)+' ft extra depth = '+P5.fmt(R.edgeFt3,1)+' ft3. Total = '+P5.fmt(R.totalFt3,1)+' ft3 ('+P5.fmt(R.yd3)+' yd3).'); if(R.edgeShallow){ h += P5.noteHTML('Edge note: the edge beam depth is no deeper than the field slab, so there is no thickened edge to add. The total is just the flat slab volume. Increase the edge depth above the field thickness to model a real monolithic edge.'); } else { h += P5.noteHTML('Monolithic pour: slab and edge beam go in as one piece, so there is no cold joint between them. The edge depth shown is the total depth at the perimeter, including the field slab thickness, not an extra layer on top.'); } h += P5.noteHTML('Footings must reach below the local frost line and suit the soil and loads, which this volume tool does not check. Treat the edge depth as a planning figure and confirm footing sizes against local code before pouring.'); h += P5.actionsHTML('mono')+'
'; var summary = 'Monolithic slab ('+P5.fmt(imp.lFt,1)+' x '+P5.fmt(imp.wFt,1)+' ft, '+P5.fmt(imp.tIn,1)+' in field, '+P5.fmt(imp.ewIn,1)+' x '+P5.fmt(imp.edIn,1)+' in edge): '+P5.fmt(R.totalFt3,1)+' ft3 ('+P5.fmt(R.yd3)+' yd3) net, '+P5.fmt(R.bags80,0)+' bags of 80 lb with waste. via concretequantity.com/monolithic-slab-calculator/'; return {html:h, summary:summary}; }, verified:'Ring area geometry: perimeter x edge width minus 4 x edge width squared removes the double counted corners, verified by the rectangle minus inner rectangle identity (L x W minus (L minus 2w) x (W minus 2w)). Volumes are plain geometry from the entered dimensions; no structural sizing is claimed.', links:['slab','footing','driveway','bags','cost','rebar'] }); })(); /* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 chunk - Formwork ADDITIVE chunk. Registers the 'formwork' mode with P5. Does not touch V6, the batch 1 (P2) script, the batch 2 (P3) script, the batch 3 (P4) script, or any existing tools. Wall formwork material planning (not structural form design): - Form contact area = 2 sides x length x height - Plywood: one 4 ft x 8 ft sheet covers 32 ft2 - Studs: vertical supports at 16 in (1.33 ft) spacing, one extra stud at the end of each side, both sides - Walers: horizontal boards at 24 in (2 ft) row spacing, 10 ft boards, both sides - Ties: one tie per 2 ft x 2 ft grid point - Release agent: 750 ft2 per gallon Counts are rounded up to whole pieces to buy. This tool plans materials only: it does not check form pressure, plywood strength, tie ratings or bracing, which need a qualified designer for tall or fast pours. ============================================================ */ (function(){ "use strict"; P5.calcFormwork = function(o){ // o: {lenFt, heightFt, walls} walls = number of identical walls. var walls = o.walls || 1; var areaFt2 = 2 * (o.lenFt||0) * (o.heightFt||0) * walls; var sheets = P5.ceilSafe(areaFt2 / P5.FORM_SHEET_FT2); var studsPerSide = Math.floor((o.lenFt||0) / P5.FORM_STUD_FT) + 1; var studs = studsPerSide * 2 * walls; var walerRows = P5.ceilSafe((o.heightFt||0) / P5.FORM_WALER_FT); var walerBoardsPerRow = P5.ceilSafe((o.lenFt||0) / P5.FORM_LUMBER_FT); var walers = walerRows * walerBoardsPerRow * 2 * walls; var ties = P5.ceilSafe((o.lenFt||0) / P5.FORM_TIE_FT) * P5.ceilSafe((o.heightFt||0) / P5.FORM_TIE_FT) * walls; var releaseGal = areaFt2 / P5.FORM_RELEASE_FT2_GAL; return { areaFt2: areaFt2, areaM2: areaFt2 * 0.092903, sheets: sheets, studsPerSide: studsPerSide, studs: studs, walerRows: walerRows, walerBoardsPerRow: walerBoardsPerRow, walers: walers, ties: ties, releaseGal: releaseGal, releaseL: releaseGal * P5.GAL_TO_LITRE }; }; function formworkSVG(live){ function t(fid, fb){ var e = live[fid]; if(e && e.val !== '') return P5.esc(String(e.val)+' '+(e.unit||'')); return fb; } var h = ''; h += '' + '' + '' + P5.dimLabel(t('l','Length'), 75, 102) + P5.dimLabel(t('height','Height'), 140, 52) + 'Plywood, studs, walers, ties'; h += ''; return h; } P5.register({ id:'formwork', tab:'Formwork', title:'Concrete Formwork Calculator', formula:'Form area = 2 x length x height; sheets = area / 32 ft2; studs at 16 in; walers at 24 in; ties on a 2 ft grid', diagram: formworkSVG, fields:[ {id:'l',label:'Wall length',kind:'len',ph:'20',defUnit:'ft'}, {id:'height',label:'Wall height',kind:'len',ph:'8',defUnit:'ft'}, {id:'walls',label:'Number of identical walls',kind:'num',ph:'1',optional:true} ], empty:'Enter the wall length and height above.', toImp:function(vals,units){ return { lenFt:P5.toFt(vals.l,units.l), heightFt:P5.toFt(vals.height,units.height), walls:(parseFloat(vals.walls)||1) }; }, render:function(imp, vals, units, panel){ var R = P5.calcFormwork({lenFt:imp.lenFt, heightFt:imp.heightFt, walls:imp.walls}); var h = '

Wall formwork materials

'; h += '
'; h += P5.nwColHTML('Sheets and timber', [{icon:'form',big:P5.fmt(R.sheets,0),lbl:'Plywood Sheets (4 x 8 ft)'},{icon:'form',big:P5.fmt(R.studs,0),lbl:'Studs (16 in spacing)'},{icon:'form',big:P5.fmt(R.walers,0),lbl:'Waler Boards (10 ft)'}], [[P5.fmt(R.areaFt2,0),'ft2 form contact area'],[P5.fmt(R.areaM2,1),'m2 contact area'],[R.studsPerSide+' per side','studs, end stud included'],[R.walerRows+' rows','of walers per side']]); h += P5.nwColHTML('Ties and release agent', [{icon:'form',big:P5.fmt(R.ties,0),lbl:'Form Ties (2 ft grid)'},{icon:'drop',big:P5.fmt(R.releaseGal,2),lbl:'Gallons Release Agent'}], [[P5.fmt(R.releaseL,2),'litres release agent'],['750 ft2 per gallon','release coverage']]); h += '
'; h += P5.workingHTML('Form area = 2 sides x '+P5.fmt(imp.lenFt,1)+' ft x '+P5.fmt(imp.heightFt,1)+' ft'+(imp.walls>1?' x '+P5.fmt(imp.walls,0)+' walls':'')+' = '+P5.fmt(R.areaFt2,0)+' ft2. Sheets = '+P5.fmt(R.areaFt2,0)+' / 32 = '+P5.fmt(R.sheets,0)+'. Studs = (floor('+P5.fmt(imp.lenFt,1)+' / 1.33) + 1) x 2 sides'+(imp.walls>1?' x '+P5.fmt(imp.walls,0)+' walls':'')+' = '+P5.fmt(R.studs,0)+'. Walers = '+R.walerRows+' rows x '+R.walerBoardsPerRow+' boards x 2 sides'+(imp.walls>1?' x '+P5.fmt(imp.walls,0)+' walls':'')+' = '+P5.fmt(R.walers,0)+'. Ties = '+P5.fmt(R.ties,0)+'. Release agent = '+P5.fmt(R.releaseGal,2)+' gallons.'); h += P5.noteHTML('Materials planning only. This tool does not check concrete pressure on the forms, plywood bending strength, tie load ratings or bracing. Tall walls, fast pour rates and hot weather raise form pressure sharply: get tall or critical formwork designed by a qualified person.'); h += P5.noteHTML('Counts are rounded up to whole pieces and include one end stud per side. Allow extra for cuts, corners, bracing and waste: timber and plywood offcuts add up fast on real walls.'); h += P5.actionsHTML('formwork')+'
'; var summary = 'Wall formwork ('+P5.fmt(imp.lenFt,1)+' x '+P5.fmt(imp.heightFt,1)+' ft'+(imp.walls>1?', '+P5.fmt(imp.walls,0)+' walls':'')+'): '+P5.fmt(R.sheets,0)+' plywood sheets, '+P5.fmt(R.studs,0)+' studs, '+P5.fmt(R.walers,0)+' waler boards, '+P5.fmt(R.ties,0)+' ties, '+P5.fmt(R.releaseGal,2)+' gallons release agent. via concretequantity.com/concrete-formwork-calculator/'; return {html:h, summary:summary}; }, verified:'Formwork planning constants from published formwork calculators and guides: 4 ft x 8 ft plywood sheets (32 ft2), stud spacing 16 in, waler row spacing 24 in with 10 ft boards, tie grid 2 ft x 2 ft, release agent coverage 750 ft2 per gallon. Counts are whole pieces rounded up; no structural form design is claimed.', links:['wall','footing','column','rebar','bags'] }); })(); /* ============================================================ ConcreteQuantity Calculator: Phase 2 batch 4 chunk - Leveler ADDITIVE chunk. Registers the 'leveler' mode with P5. Does not touch V6, the batch 1 (P2) script, the batch 2 (P3) script, the batch 3 (P4) script, or any existing tools. Self levelling compound quantities from the manufacturer consumption method: weight = area x thickness x consumption rate (kg per m2 per mm). Default rate 1.7 kg/m2/mm sits just above the published ARDEX K 15 figure (a 20 kg bag covers about 12 m2 at 1 mm, about 1.67 kg/m2/mm) and inside the published 1.60 to 1.70 kg/m2/mm band for 25 kg bags (about 14 to 15 m2 per mm). The rate is user adjustable because every product prints its own rate on the bag. This tool is different from the screed tool: screed is a sand and cement layer mixed on site, while self levelling compound is a bagged, pourable product dosed by the manufacturer's kg per m2 per mm rate. ============================================================ */ (function(){ "use strict"; P5.calcLeveler = function(o){ // o: {areaM2, thickMm, rate} rate = kg/m2 per mm. // {waste} waste percent, {bagKg} bag size in kg. var kg = (o.areaM2||0) * (o.thickMm||0) * (o.rate||P5.SLC_RATE); var orderKg = kg * (1 + (o.waste||0)/100); var bagKg = o.bagKg || 25; var volM3 = (o.areaM2||0) * ((o.thickMm||0)/1000); var coverPerBag = (o.thickMm||0) > 0 ? bagKg / ((o.rate||P5.SLC_RATE) * (o.thickMm||0)) : 0; return { kg: kg, orderKg: orderKg, bags: P5.ceilSafe(orderKg/bagKg), volM3: volM3, volL: volM3 * 1000, coverPerBag: coverPerBag, areaM2: o.areaM2||0, thickMm: o.thickMm||0 }; }; function levelerSVG(live){ function t(fid, fb){ var e = live[fid]; if(e && e.val !== '') return P5.esc(String(e.val)+' '+(e.unit||'')); return fb; } var h = ''; h += '' + '' + '' + '' + '' + P5.dimLabel(t('l','Length'), 75, 92) + P5.dimLabel(t('t','Thickness'), 112, 56) + 'Thin levelling layer'; h += ''; return h; } P5.register({ id:'leveler', tab:'Self Levelling', title:'Self Levelling Compound Calculator', formula:'Weight = Area x Thickness x consumption rate (kg per m2 per mm); bags = weight / bag size', diagram: levelerSVG, fields:[ {id:'l',label:'Length',kind:'len',ph:'5',defUnit:'m'}, {id:'w',label:'Width',kind:'len',ph:'4',defUnit:'m'}, {id:'t',label:'Average thickness',kind:'sm',ph:'3',defUnit:'mm'} ], extrasHTML:function(){ return '
' +'
' +'
' +'
' + P5.wasteRowHTML(10); }, empty:'Enter the room size and average thickness above.', validateExtra:function(panel, vals, units){ var empty = '
Enter the room size and average thickness above.
'; if(!vals.l || !vals.w || !vals.t) return empty; return null; }, toImp:function(vals,units){ return { lFt:P5.toFt(vals.l,units.l), wFt:P5.toFt(vals.w,units.w), tIn:P5.toIn(vals.t,units.t) }; }, render:function(imp, vals, units, panel){ var rateInp = panel.querySelector('#p5-rate'); var rate = rateInp && rateInp.value ? parseFloat(rateInp.value) : P5.SLC_RATE; if(!isFinite(rate) || rate <= 0) rate = P5.SLC_RATE; var lbagSel = panel.querySelector('.lbagSel'); var bagKg = lbagSel ? parseFloat(lbagSel.value) : 25; var waste = P5.readWaste(panel); var areaM2 = imp.lFt * 0.3048 * imp.wFt * 0.3048; var thickMm = imp.tIn * 25.4; var R = P5.calcLeveler({areaM2:areaM2, thickMm:thickMm, rate:rate, waste:waste, bagKg:bagKg}); var bagLabel = (bagKg === 22.6796) ? '50 lb' : (P5.fmt(bagKg,0)+' kg'); var h = '

Self levelling compound

'; h += '
'; h += P5.nwColHTML('Bags to buy', [{icon:'bags',big:P5.fmt(R.bags,0),lbl:'Bags of '+bagLabel},{icon:'cube',big:P5.fmt(R.orderKg,0),lbl:'Kilograms (with waste)'}], [[P5.fmt(R.kg,0),'kg net'],[P5.fmt(R.coverPerBag,2),'m2 covered per bag at this thickness']]); h += P5.nwColHTML('Volume', [{icon:'level',big:P5.fmt(R.volM3,3),lbl:'Cubic Metres'},{icon:'level',big:P5.fmt(R.volL,0),lbl:'Litres'}], [[P5.fmt(areaM2),'m2 floor area'],[P5.fmt(thickMm,1),'mm average thickness'],[P5.fmt(rate,2),'kg per m2 per mm used']]); h += '
'; h += P5.workingHTML('Weight = '+P5.fmt(areaM2)+' m2 x '+P5.fmt(thickMm,1)+' mm x '+P5.fmt(rate,2)+' kg/m2/mm = '+P5.fmt(R.kg,0)+' kg; with '+P5.fmt(waste,0)+'% waste '+P5.fmt(R.orderKg,0)+' kg = '+P5.fmt(R.bags,0)+' bags. Volume = '+P5.fmt(R.volM3,3)+' m3. One bag covers '+P5.fmt(R.coverPerBag,2)+' m2 at this thickness.'); h += P5.noteHTML('Measure the average thickness, not the thinnest spot: floors that slope need the average of the shallow and deep ends, and a floor with one deep dip needs more than the average suggests. If the deepest spot is deeper than your product allows in one pour, lay it in two layers.'); h += P5.noteHTML('Always check the rate on your own bag: products vary, and a lightweight or rapid setting compound can use a different kg per m2 per mm figure. The default 1.7 is a planning figure, not a substitute for the product data sheet. Prime porous concrete first, or the compound can pin hole.'); h += P5.actionsHTML('leveler')+'
'; var summary = 'Self levelling compound ('+P5.fmt(areaM2)+' m2 at '+P5.fmt(thickMm,1)+' mm, '+P5.fmt(rate,2)+' kg/m2/mm): '+P5.fmt(R.bags,0)+' bags of '+bagLabel+' ('+P5.fmt(R.orderKg,0)+' kg with waste). via concretequantity.com/self-levelling-compound-calculator/'; return {html:h, summary:summary}; }, verified:'Consumption method from manufacturer guidance: weight = area x thickness x kg per m2 per mm. Default rate 1.7 kg/m2/mm sits just above the ARDEX K 15 published figure (20 kg bag covers about 12 m2 at 1 mm, about 1.67 kg/m2/mm) and inside the published 1.60 to 1.70 band for 25 kg bags (about 14 to 15 m2 per mm). Rate is user adjustable; the product data sheet governs.', links:['screed','slab','sealer','bags','cost'] }); })();