Results

Each Result is the output of one or more variables.

A Result defines the label and dimension/suffix of the display of each variable.

Break down the final output into smaller Results to preserve readability.

Create a new Result

ID Title Description Values Link to edit Result
18 Energy var sim = v.drupal_bui_energy_simulator || v.energy_simulation || v.simulation || {}; var payload = window.drupalBuiPayload || {}; var net_floor_area = Number(v.a_use || (payload.building_parameters && payload.building_parameters.net_floor_area) || v.net_floor_area || 100); var b_heat_need = Number(sim.baseline_heating_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.baseline_heating_kwh) || v.baseline_heating_kwh || 0); var b_cool_need = Number(sim.baseline_cooling_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.baseline_cooling_kwh) || v.baseline_cooling_kwh || 0); var i_heat_need = Number(sim.improved_heating_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.improved_heating_kwh) || v.improved_heating_kwh || 0); var i_cool_need = Number(sim.improved_cooling_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.improved_cooling_kwh) || v.improved_cooling_kwh || 0); var getBaselineCoPText = function() { var source = String(v.heating_source || "").toLowerCase(); if (source.includes("gas_boiler")) return 0.85; if (source.includes("oil_boiler") || source.includes("wood_boiler")) return 0.80; if (source.includes("air_source_hp")) return 3.5; if (source.includes("electric_heater")) return 0.95; if (source.includes("district_heating")) return 0.85; return 1.0; }; var b_cop_text = getBaselineCoPText(); var getImprovedCoP = function() { var active_system = String(v['as'] || v.active_system || "").trim().toLowerCase(); var copMap = { "as_1": 1.0, "as_2": 0.9, "as_3": 0.9, "as_4": 0.9, "as_5": 0.85, "as_6": 0.85, "as_7": 0.9, "as_8": 5.91, "as_9": 0.95, "as_10": 0.9, "as_11": 0.9, "as_12": 0.95, "as_13": 5.88, "as_14": 5.91, "as_15": 4.1, "as_16": 5.91, "as_17": 0.9, "as_18": 1.0, "as_19": 1.0, "as_20": 1.0, "as_21": 0.98, "as_22": 1.0, "as_23": 1.0, "as_24": 0.85, "as_25": 0.85, "as_26": 0.85, "as_27": 0.98, "as_28": 0.98, "as_29": 0.98, "as_30": 0.98, "as_31": 5.88, "as_32": 5.88, "as_33": 4.08, "as_34": 1.0, "as_35": 4.29, "as_36": 0.98, "as_37": 4.08, "as_38": 4.29, "as_39": 4.08, "as_40": 0.9, "as_41": 0.98, "as_42": 1.0, "as_43": 0.85, "as_44": 0.9, "as_45": 1.0, "as_46": 4.1, "as_47": 4.1 }; if (copMap[active_system]) { return copMap[active_system]; } return Number(v.imp_cop) || 1.0; }; var i_cop_text = getImprovedCoP(); var b_heat_demand = b_heat_need / b_cop_text; var i_heat_demand = i_heat_need / i_cop_text; var b_cool_demand = b_cool_need; var i_cool_demand = i_cool_need; var b_total_need = b_heat_need + b_cool_need; var i_total_need = i_heat_need + i_cool_need; var b_total_demand = b_heat_demand + b_cool_demand; var i_total_demand = i_heat_demand + i_cool_demand; var b_sqm_need = (b_total_need / net_floor_area).toFixed(1); var i_sqm_need = (i_total_need / net_floor_area).toFixed(1); var b_sqm_demand = (b_total_demand / net_floor_area).toFixed(1); var i_sqm_demand = (i_total_demand / net_floor_area).toFixed(1); var reduction_need = b_total_need > 0 ? (((b_total_need - i_total_need) / b_total_need) * 100).toFixed(1) : "0.0"; var reduction_demand = b_total_demand > 0 ? (((b_total_demand - i_total_demand) / b_total_demand) * 100).toFixed(1) : "0.0"; var max_val_need = Math.max(b_total_need, i_total_need); var max_val_demand = Math.max(b_total_demand, i_total_demand); var drawBarFn = function(val, max_val) { if (max_val <= 0) return ''; var f = Math.round((val / max_val) * 25); return '█'.repeat(f) + '░'.repeat(25 - f); }; var results = {}; results.title = { type: "value", label: "--- 1A. ENERGY NEED (Building Envelope) ---", value: "", suffix: "" }; results.nfa = { type: "value", label: "Net Floor Area", value: net_floor_area.toFixed(1), suffix: " sqm" }; results.b_val_need = { type: "value", label: "Baseline Need", value: b_sqm_need, suffix: " kWh/sqm" }; results.b_bar_need = { type: "value", label: "", value: drawBarFn(b_total_need, max_val_need), suffix: "" }; results.i_val_need = { type: "value", label: "Improved Need", value: i_sqm_need, suffix: " kWh/sqm" }; results.i_bar_need = { type: "value", label: "", value: drawBarFn(i_total_need, max_val_need), suffix: "" }; results.red_need = { type: "value", label: "Envelope Reduction", value: reduction_need, suffix: " %" }; results.title2 = { type: "value", label: "--- 1B. ENERGY DEMAND (Active Systems) ---", value: "", suffix: "" }; results.cop_info = { type: "value", label: "System CoP", value: `Base: ${b_cop_text.toFixed(2)} | Imp: ${i_cop_text.toFixed(2)}`, suffix: "" }; results.b_val_demand = { type: "value", label: "Baseline Demand", value: b_sqm_demand, suffix: " kWh/sqm" }; results.b_bar_demand = { type: "value", label: "", value: drawBarFn(b_total_demand, max_val_demand), suffix: "" }; results.i_val_demand = { type: "value", label: "Improved Demand", value: i_sqm_demand, suffix: " kWh/sqm" }; results.i_bar_demand = { type: "value", label: "", value: drawBarFn(i_total_demand, max_val_demand), suffix: "" }; results.red_demand = { type: "value", label: "System Reduction", value: reduction_demand, suffix: " %" }; var b_heat_m = sim.monthly_heating_need_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.monthly_heating_need_kwh) || v.monthly_heating_need_kwh || []; var i_heat_m = sim.monthly_improved_heating_need_kwh || (window.drupalAssessmentAreas && window.drupalAssessmentAreas.monthly_improved_heating_need_kwh) || v.monthly_improved_heating_need_kwh || []; if (b_heat_m.length >= 12) { results.monthly_title = { type: "value", label: "--- Improved Monthly Heating Demand ---", value: "", suffix: "" }; var mNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var max_m_demand = 0; for (var i=0; i<12; i++) { var bh_dem = Number(b_heat_m[i]||0) / b_cop_text; var ih_dem = Number(i_heat_m[i]||0) / i_cop_text; max_m_demand = Math.max(max_m_demand, bh_dem, ih_dem); } for (var j=0; j<12; j++) { var bh_dem_val = Number(b_heat_m[j]||0) / b_cop_text; var ih_dem_val = Number(i_heat_m[j]||0) / i_cop_text; var fill_b_dem = max_m_demand > 0 ? Math.round((bh_dem_val / max_m_demand) * 10) : 0; var fill_i_dem = max_m_demand > 0 ? Math.round((ih_dem_val / max_m_demand) * 10) : 0; results[`m_${j}`] = { type: "value", label: mNames[j], value: `${'█'.repeat(fill_i_dem)}${'░'.repeat(10-fill_i_dem)} (${ih_dem_val.toFixed(0)})`, suffix: " kWh" }; } } return results;
19 Emissions let op_base = Number((v.lca_energy && v.lca_energy.op_baseline) || v.op_baseline || 0); let op_imp = Number((v.lca_energy && v.lca_energy.op_improved) || v.op_improved || 0); let mat_base = Number((v.lca_materials && v.lca_materials.embodied_carbon_baseline) || v.materials_baseline || 0); let mat_imp = Number((v.lca_materials && v.lca_materials.embodied_carbon) || v.materials_improved || 0); if (!mat_imp) { let ins_nested = Number((v.lca_insulation && v.lca_insulation.embodied_carbon) || 0); let win_nested = Number((v.lca_windows && v.lca_windows.embodied_carbon) || 0); let ins_flat = (Number(v.iwi_carbon)||0) + (Number(v.ewi_carbon)||0) + (Number(v.ri_carbon)||0) + (Number(v.bfi_carbon)||0); let win_flat = Number(v.w_carbon || 0); let ins = Math.max(ins_nested, ins_flat); let win = Math.max(win_nested, win_flat); mat_imp = ins + win; } let act_imp = Number(v.lca_active_result || (v.lca_active && v.lca_active.lca_active_result) || 0); let b_total = op_base; // Baseline is only energy across the study period let i_total = op_imp + mat_imp + act_imp; // Improved is materials + energy + active systems let reduction = b_total > 0 ? (((b_total - i_total) / b_total) * 100).toFixed(1) : "0.0"; let savings_kg = b_total - i_total; let savings_tons = savings_kg / 1000; let max_val = Math.max(b_total, i_total); function drawBar(val) { if (max_val <= 0) return ''; let f = Math.round((val / max_val) * 25); return '█'.repeat(f) + '░'.repeat(25 - f); } let results = {}; results.lca_title = { type: "value", label: "--- 2. LCA RESULTS ---", value: "", suffix: "" }; results.b_val = { type: "value", label: "Baseline Emissions (Energy)", value: (b_total / 1000).toFixed(1), suffix: " tons CO2eq" }; results.b_bar = { type: "value", label: "", value: drawBar(b_total), suffix: "" }; results.i_val = { type: "value", label: "Improved Emissions (Materials+Energy)", value: (i_total / 1000).toFixed(1), suffix: " tons CO2eq" }; results.i_bar = { type: "value", label: "", value: drawBar(i_total), suffix: "" }; results.red = { type: "value", label: "Achieved Reduction", value: reduction, suffix: " %" }; if (savings_tons > 0) { let trees = Math.round(savings_tons * 5); let flights = Math.round(savings_tons); results.env_trees = { type: "value", label: "Environmental Impact (Trees)", value: "Equals " + trees + " trees growing for 10 years", suffix: "" }; results.env_flights = { type: "value", label: "Environmental Impact (Flights)", value: "Equals " + flights + " flights London to NY", suffix: "" }; } else if (savings_tons < 0) { results.env_bad = { type: "value", label: "⚠️ Increased Emissions", value: "+" + Math.abs(savings_tons).toFixed(1), suffix: " tons CO2eq" }; } return results;
20 Costs // Support multiple naming conventions from the Drupal computed elements let en_base = Number(v.lcc_energy_base || 0); let en_imp = Number(v.lcc_energy_imp || 0); let mat_imp = Number(v.lcc_total || 0); if (!mat_imp) { // Try nested objects first (if webform mapped them to distinct keys) let ins_nested = Number((v.lcc_insulation && v.lcc_insulation.lcc_total_passive) || 0); let win_nested = Number((v.lcc_windows && v.lcc_windows.lcc_total_passive) || 0); // Try flat variables from the LCC scripts let iwi = Number(v.lcc_iwi || 0); let ewi = Number(v.lcc_ewi || 0); let ri = Number(v.lcc_ri || 0); let bfi = Number(v.lcc_bfi || 0); let win = Number(v.lcc_w || 0); let ins_flat = iwi + ewi + ri + bfi; let ins = Math.max(ins_nested, ins_flat); let win_val = Math.max(win_nested, win); mat_imp = ins + win_val; } // Active systems let act_imp = Number(v.lcc_total_active || (v.lcc_active && v.lcc_active.lcc_total_active) || 0); let b_total = en_base; let i_total = en_imp + mat_imp + act_imp; let reduction = b_total > 0 ? (((b_total - i_total) / b_total) * 100).toFixed(1) : "0.0"; let max_val = Math.max(b_total, i_total); function drawBar(val) { if (max_val <= 0) return ''; let f = Math.round((val / max_val) * 25); return '█'.repeat(f) + '░'.repeat(25 - f); } let lifecycle_years = Number(v.lifecycle_years || 50); // The LCC script uses a 50 year study period! let energy_savings_total = en_base - en_imp; let annual_energy_savings = energy_savings_total / lifecycle_years; let investment = Number(v.capex_materials || mat_imp) + Number(v.capex_active_systems || act_imp); let breakeven_years = annual_energy_savings > 0 ? (investment / annual_energy_savings).toFixed(1) : 'N/A'; function fmt(num) { return Math.round(num).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); } let results = {}; results.title = { type: "value", label: "--- 3. LCC RESULTS ---", value: "", suffix: "" }; results.b_val = { type: "value", label: "Baseline Cost (Energy)", value: fmt(b_total), suffix: " EUR" }; results.b_bar = { type: "value", label: "", value: drawBar(b_total), suffix: "" }; results.i_val = { type: "value", label: "Improved Cost (Materials+Energy)", value: fmt(i_total), suffix: " EUR" }; results.i_bar = { type: "value", label: "", value: drawBar(i_total), suffix: "" }; results.red = { type: "value", label: "Achieved Reduction", value: reduction, suffix: " %" }; results.fin_title = { type: "value", label: "--- FINANCIAL PAYBACK ---", value: "", suffix: "" }; results.fin_inv = { type: "value", label: "Total Investment", value: fmt(investment), suffix: " EUR" }; results.fin_sav = { type: "value", label: "Annual Energy Savings", value: fmt(annual_energy_savings), suffix: " EUR/year" }; results.fin_brk = { type: "value", label: "Breakeven Time", value: breakeven_years, suffix: " years" }; return results;
21 Smart Readiness Indicator let score = Number(v.sri_final_score || 0); let sri_class = 'G'; if (score >= 90) sri_class = 'A'; else if (score >= 80) sri_class = 'B'; else if (score >= 65) sri_class = 'C'; else if (score >= 50) sri_class = 'D'; else if (score >= 35) sri_class = 'E'; else if (score >= 20) sri_class = 'F'; let width = Math.min(Math.max(score, 0), 100); let fill = Math.round((width / 100) * 30); let bar = '█'.repeat(fill) + '░'.repeat(30 - fill); let results = {}; results.title = { type: "value", label: "--- 4. SRI RESULTS ---", value: "", suffix: "" }; results.cls = { type: "value", label: "SRI Class", value: sri_class, suffix: ` (Score: ${score.toFixed(1)}%)` }; results.bar = { type: "value", label: "", value: bar, suffix: "" }; results.ref_title = { type: "value", label: "Scale Reference", value: "", suffix: "" }; results.ref_a = { type: "value", label: "[A] 90-100%", value: sri_class === 'A' ? "<<<" : "", suffix: "" }; results.ref_b = { type: "value", label: "[B] 80-89%", value: sri_class === 'B' ? "<<<" : "", suffix: "" }; results.ref_c = { type: "value", label: "[C] 65-79%", value: sri_class === 'C' ? "<<<" : "", suffix: "" }; results.ref_d = { type: "value", label: "[D] 50-64%", value: sri_class === 'D' ? "<<<" : "", suffix: "" }; results.ref_e = { type: "value", label: "[E] 35-49%", value: sri_class === 'E' ? "<<<" : "", suffix: "" }; results.ref_f = { type: "value", label: "[F] 20-34%", value: sri_class === 'F' ? "<<<" : "", suffix: "" }; results.ref_g = { type: "value", label: "[G] 0-19%", value: sri_class === 'G' ? "<<<" : "", suffix: "" }; return results;