handleiding_nieuw:sub_spacematrix
This is an old revision of the document!
<div id=“summary”>
<h3>Samenvatting</h3> <table> <tr><td>Laadvermogen (FSI × opp)</td><td id="summary_bvo">-</td></tr> <tr><td>Voorzieningenruimte totaal (m²)</td><td id="summary_voorz_tot">-</td></tr> <tr><td>Voorzieningenruimte per woning (m²)</td><td id="summary_voorz_per_won">-</td></tr> <tr><td>Woonruimte (m²)</td><td id="summary_wonen">-</td></tr> <tr><td>Totaal aantal woningen</td><td id="summary_woningen">-</td></tr> </table> </div>
</div>
<div id=“voorzieningen” class=“tabcontent”>
<div class="inputrow"> <label>Aantal bewoners per woning:</label> <input id="bewoners_per_woning" type="number" step="0.1" value="2.2"> </div> <table> <thead> <tr><th>Voorziening</th><th>Norm (m² per 1000)</th><th>Selecteer</th></tr> </thead> <tbody id="voorzieningentabel"></tbody> </table> <div class="inputrow"> <button onclick="berekenVoorzieningenruimte()">Toepassen in rekenblok</button> <div id="voorziening_resultaat"></div> </div>
</div>
<script> function updateStipje(fsi, gsi) {
const stip = document.getElementById("stipje"); const x = Math.min(100, Math.max(0, gsi * 190)); const y = Math.max(0, Math.min(100, (3 - fsi) * 35)); stip.style.left = `${x}%`; stip.style.top = `${y}%`;
} document.addEventListener(“DOMContentLoaded”, () ⇒ {
const updateSummary = (bvoTot, voorzTot, voorzPerWoning, woonruimte, woningen) => { document.getElementById("summary_bvo").innerText = `${bvoTot.toFixed(0)} m²`; document.getElementById("summary_voorz_tot").innerText = `${voorzTot.toFixed(0)} m²`; document.getElementById("summary_voorz_per_won").innerText = `${voorzPerWoning.toFixed(1)} m²`; document.getElementById("summary_wonen").innerText = `${woonruimte.toFixed(0)} m²`; document.getElementById("summary_woningen").innerText = `${woningen}`; };
window.updateLaadvermogen = function() { const opp = parseFloat(document.getElementById("opp").value); const fsi = parseFloat(document.getElementById("fsi").value); const gsi = parseFloat(document.getElementById("gsi").value); const bvoTot = opp * fsi; const voorzieningenruimte = parseFloat(document.getElementById("voorzieningenruimte").value);
updateStipje(fsi, gsi);
let gewogenBVO = 0; let totalPerc = 0; const details = []; for (let i = 0; i < 10; i++) { const perc = parseFloat(document.getElementById(`perc_${i}`).value) || 0; const bvo = parseFloat(document.getElementById(`bvo_${i}`).value) || 0; gewogenBVO += (perc / 100) * bvo; totalPerc += perc; details.push({ i, perc, bvo }); } if (gewogenBVO === 0) return;
let woningen = Math.floor(bvoTot / (gewogenBVO + voorzieningenruimte)); let sumWon = 0; let sumBVO = 0; let wonPerType = []; let restant = woningen;
for (let i = 0; i < details.length; i++) { const { perc } = details[i]; let aant = (perc / 100) * woningen; let afgerond = Math.floor(aant); wonPerType.push(afgerond); restant -= afgerond; } const decimaalSort = details.map((d, i) => ({ i, rest: ((d.perc / 100) * woningen) % 1 })) .sort((a, b) => b.rest - a.rest); for (let j = 0; j < restant; j++) { wonPerType[decimaalSort[j].i]++; } for (let i = 0; i < details.length; i++) { const aant = wonPerType[i]; const bvoTot = aant * details[i].bvo; document.getElementById(`aantal_${i}`).innerText = aant; document.getElementById(`totbvo_${i}`).innerText = bvoTot.toFixed(0); sumWon += aant; sumBVO += bvoTot; } document.getElementById("totaal_perc").innerText = `${totalPerc.toFixed(1)}%`; document.getElementById("totaal_gewbvo").innerText = `${gewogenBVO.toFixed(1)} m²`; document.getElementById("totaal_won").innerText = sumWon; document.getElementById("totaal_bvo").innerText = sumBVO.toFixed(0);
document.getElementById("output").innerHTML = `<p><b>Gewogen BVO/ehd:</b> ${gewogenBVO.toFixed(1)} m²<br><b>Totaal aantal woningen:</b> ${sumWon}</p>`;
const voorzieningenTot = sumWon * voorzieningenruimte; const wonenRuimte = bvoTot - voorzieningenTot; updateSummary(bvoTot, voorzieningenTot, voorzieningenruimte, wonenRuimte, sumWon); };
});
</script>
</body> </html>
handleiding_nieuw/sub_spacematrix.1746610552.txt.gz · Last modified: 2025/05/07 09:35 by support