Spaces:
Running
Running
Match HVAC AI Control Center: all O1-O20 studios, Operations and OEH guide
Browse files- README.md +1 -1
- app.js +392 -0
- index.html +36 -190
- physics.js +304 -0
- shell.css +93 -0
- style.css +0 -28
README.md
CHANGED
|
@@ -10,7 +10,7 @@ short_description: Interactive O1–O20 HVAC guide simulation (no BMS writes)
|
|
| 10 |
|
| 11 |
# HVAC Optimization — O1–O20 simulation
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
- Sliders and KPIs are **GUIDE_POTENTIAL** only — not measured building savings.
|
| 16 |
- No live BMS, no production writes.
|
|
|
|
| 10 |
|
| 11 |
# HVAC Optimization — O1–O20 simulation
|
| 12 |
|
| 13 |
+
Same **HVAC AI Control Center** chrome as the product: header, sidebar, fleet overview, and every **O1–O20** studio with Operations + OEH guide tabs and the official teaching curves.
|
| 14 |
|
| 15 |
- Sliders and KPIs are **GUIDE_POTENTIAL** only — not measured building savings.
|
| 16 |
- No live BMS, no production writes.
|
app.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const CATS = {
|
| 2 |
+
scheduling: { label: "Scheduling", color: "#F0A93A" },
|
| 3 |
+
"plant-control": { label: "Plant Control", color: "#4FD1C5" },
|
| 4 |
+
ventilation: { label: "Ventilation", color: "#5B9BD5" },
|
| 5 |
+
"variable-speed": { label: "Variable Speed", color: "#9C7BDB" },
|
| 6 |
+
operations: { label: "Operations", color: "#6FCF97" },
|
| 7 |
+
};
|
| 8 |
+
const MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
|
| 9 |
+
const GROUPS = [
|
| 10 |
+
["scheduling", "Scheduling"],
|
| 11 |
+
["plant-control", "Plant Control"],
|
| 12 |
+
["ventilation", "Ventilation"],
|
| 13 |
+
["variable-speed", "Variable Speed"],
|
| 14 |
+
["operations", "Operations"],
|
| 15 |
+
];
|
| 16 |
+
|
| 17 |
+
let catalog = [];
|
| 18 |
+
let byId = {};
|
| 19 |
+
let tab = "ops";
|
| 20 |
+
let included = false;
|
| 21 |
+
let achieved = 70;
|
| 22 |
+
let annualCost = 250000;
|
| 23 |
+
let sliders = {};
|
| 24 |
+
let checks = {};
|
| 25 |
+
let openGroups = { scheduling: true, "plant-control": false, ventilation: false, "variable-speed": false, operations: false };
|
| 26 |
+
|
| 27 |
+
function route() {
|
| 28 |
+
const raw = (location.hash || "#/overview").replace(/^#\/?/, "");
|
| 29 |
+
const id = raw.split("?")[0].toUpperCase();
|
| 30 |
+
if (raw.includes("view=guide")) tab = "guide";
|
| 31 |
+
if (/^O\d+$/.test(id) && byId[id]) return { page: "opp", id };
|
| 32 |
+
return { page: "overview" };
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
function go(path) {
|
| 36 |
+
location.hash = path;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
function esc(s) {
|
| 40 |
+
return String(s ?? "")
|
| 41 |
+
.replace(/&/g, "&")
|
| 42 |
+
.replace(/</g, "<")
|
| 43 |
+
.replace(/>/g, ">");
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
function navItem(href, label, active, oid) {
|
| 47 |
+
return `<a class="nav-item ${active ? "active" : ""}" href="${href}">${
|
| 48 |
+
oid ? `<span class="nav-oid">${esc(oid)}</span>` : ""
|
| 49 |
+
}<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(label)}</span></a>`;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function renderSidebar(current) {
|
| 53 |
+
const r = route();
|
| 54 |
+
let html = `<div class="nav-sec">Platform</div>${navItem("#/overview", "Fleet Overview", r.page === "overview")}`;
|
| 55 |
+
html += `<div class="nav-sec">Opportunities</div>`;
|
| 56 |
+
GROUPS.forEach(([sec, title]) => {
|
| 57 |
+
const color = CATS[sec].color;
|
| 58 |
+
const items = catalog.filter((o) => o.section === sec);
|
| 59 |
+
const expanded = openGroups[sec] || items.some((o) => r.id === o.opportunity_id);
|
| 60 |
+
html += `<div>
|
| 61 |
+
<button class="group-btn" data-group="${sec}"><span style="color:${color}">▸</span> <span>${title}</span></button>
|
| 62 |
+
<div class="group-body" style="display:${expanded ? "block" : "none"}">`;
|
| 63 |
+
items.forEach((o) => {
|
| 64 |
+
html += navItem(`#/${o.opportunity_id}`, o.title, r.id === o.opportunity_id, o.opportunity_id);
|
| 65 |
+
});
|
| 66 |
+
html += `</div></div>`;
|
| 67 |
+
});
|
| 68 |
+
document.getElementById("sidebar").innerHTML = html;
|
| 69 |
+
document.querySelectorAll("[data-group]").forEach((btn) => {
|
| 70 |
+
btn.onclick = () => {
|
| 71 |
+
const g = btn.dataset.group;
|
| 72 |
+
openGroups[g] = !openGroups[g];
|
| 73 |
+
renderSidebar();
|
| 74 |
+
};
|
| 75 |
+
});
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
function drawChart(canvas, pts, color, xType) {
|
| 79 |
+
if (!canvas || !pts.length) return;
|
| 80 |
+
const ctx = canvas.getContext("2d");
|
| 81 |
+
const w = (canvas.width = canvas.clientWidth * 2);
|
| 82 |
+
const h = (canvas.height = canvas.clientHeight * 2);
|
| 83 |
+
ctx.clearRect(0, 0, w, h);
|
| 84 |
+
const ys = pts.flatMap((p) => [p.baseline, p.optimized]);
|
| 85 |
+
const ymin = Math.min(...ys);
|
| 86 |
+
const ymax = Math.max(...ys);
|
| 87 |
+
const span = ymax - ymin || 1;
|
| 88 |
+
const xOf = (i) => (i / Math.max(pts.length - 1, 1)) * w;
|
| 89 |
+
const yOf = (v) => h - ((v - ymin) / span) * (h - 24) - 12;
|
| 90 |
+
ctx.strokeStyle = "rgba(255,255,255,0.06)";
|
| 91 |
+
ctx.lineWidth = 2;
|
| 92 |
+
for (let i = 1; i < 4; i++) {
|
| 93 |
+
ctx.beginPath();
|
| 94 |
+
ctx.moveTo(0, (h / 4) * i);
|
| 95 |
+
ctx.lineTo(w, (h / 4) * i);
|
| 96 |
+
ctx.stroke();
|
| 97 |
+
}
|
| 98 |
+
const line = (key, stroke, dash) => {
|
| 99 |
+
ctx.beginPath();
|
| 100 |
+
ctx.strokeStyle = stroke;
|
| 101 |
+
ctx.lineWidth = 4;
|
| 102 |
+
ctx.setLineDash(dash || []);
|
| 103 |
+
pts.forEach((p, i) => {
|
| 104 |
+
const x = xOf(i);
|
| 105 |
+
const y = yOf(p[key]);
|
| 106 |
+
if (i === 0) ctx.moveTo(x, y);
|
| 107 |
+
else ctx.lineTo(x, y);
|
| 108 |
+
});
|
| 109 |
+
ctx.stroke();
|
| 110 |
+
ctx.setLineDash([]);
|
| 111 |
+
};
|
| 112 |
+
line("baseline", "#64748b", [10, 8]);
|
| 113 |
+
line("optimized", color);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
function sliderDefaults(item) {
|
| 117 |
+
const v = {};
|
| 118 |
+
(item.sliders || []).forEach((s) => {
|
| 119 |
+
v[s.key] = sliders[s.key] ?? s.default;
|
| 120 |
+
});
|
| 121 |
+
return v;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
function fmtSlider(v, unit, step) {
|
| 125 |
+
const d = step < 1 ? 2 : 0;
|
| 126 |
+
return `${Number(v).toFixed(d)}${unit ? ` ${unit}` : ""}`;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
function renderOverview() {
|
| 130 |
+
tab = "ops";
|
| 131 |
+
const sections = GROUPS.map(([sec, title]) => {
|
| 132 |
+
const cards = catalog
|
| 133 |
+
.filter((o) => o.section === sec)
|
| 134 |
+
.map(
|
| 135 |
+
(o) => `<a class="glass-card" href="#/${o.opportunity_id}">
|
| 136 |
+
<div>
|
| 137 |
+
<div style="display:flex;justify-content:space-between;gap:8px">
|
| 138 |
+
<span class="mono" style="font-size:10px;padding:2px 6px;border-radius:6px;border:1px solid rgba(34,211,238,0.25);background:rgba(6,182,212,0.1);color:#67e8f9">${esc(o.opportunity_id)}</span>
|
| 139 |
+
<span class="badge badge-warn">AWAITING TELEMETRY</span>
|
| 140 |
+
</div>
|
| 141 |
+
<h3 style="font-size:15px;margin:12px 0 0;font-weight:600">${esc(o.title)}</h3>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="muted" style="font-size:11px;margin-top:12px;padding-top:12px;border-top:1px solid rgba(255,255,255,0.06)">
|
| 144 |
+
GUIDE_POTENTIAL ${esc(String(o.pct))}% · ${esc(o.control_kind || "control")}
|
| 145 |
+
</div>
|
| 146 |
+
</a>`
|
| 147 |
+
)
|
| 148 |
+
.join("");
|
| 149 |
+
return `<section style="margin-bottom:28px">
|
| 150 |
+
<h2 class="muted" style="font-size:11px;letter-spacing:0.16em;text-transform:uppercase;margin:0 0 10px">${esc(title)}</h2>
|
| 151 |
+
<div class="kpi-grid">${cards}</div>
|
| 152 |
+
</section>`;
|
| 153 |
+
}).join("");
|
| 154 |
+
document.getElementById("root").innerHTML = `
|
| 155 |
+
<div style="margin-bottom:20px">
|
| 156 |
+
<div class="muted" style="font-size:10px;letter-spacing:0.18em;text-transform:uppercase">Fleet</div>
|
| 157 |
+
<h1 style="margin:6px 0 0;font-size:1.55rem">Overview</h1>
|
| 158 |
+
<p class="muted" style="max-width:42rem">Same Control Center as the product: O1–O20, Operations vs OEH guide. This Space has no live BMS — telemetry stays AWAITING / SIMULATED. Guide % is GUIDE_POTENTIAL, not measured kWh.</p>
|
| 159 |
+
</div>${sections}`;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
function renderGuide(item) {
|
| 163 |
+
const cat = CATS[item.section] || CATS.scheduling;
|
| 164 |
+
const v = sliderDefaults(item);
|
| 165 |
+
const pts = window.OehPhysics.seriesFor(item.opportunity_id, v, item.x_type);
|
| 166 |
+
const metrics = window.OehPhysics.metricsFor(item.opportunity_id, pts, v);
|
| 167 |
+
const effectivePct = included ? (item.pct * achieved) / 100 : 0;
|
| 168 |
+
const dollars = annualCost * (effectivePct / 100);
|
| 169 |
+
const optWidth = included ? Math.max(100 - effectivePct, 4) : 100;
|
| 170 |
+
const circ = 2 * Math.PI * 32;
|
| 171 |
+
const dash = (item.pct / 100) * circ;
|
| 172 |
+
const equip = String(item.equipment || "")
|
| 173 |
+
.split(",")
|
| 174 |
+
.map((s) => s.trim())
|
| 175 |
+
.filter(Boolean);
|
| 176 |
+
const sliderHtml = (item.sliders || [])
|
| 177 |
+
.map(
|
| 178 |
+
(sl) => `<label>
|
| 179 |
+
<span class="mono muted" style="font-size:11px">${esc(sl.label)}</span>
|
| 180 |
+
<div style="display:flex;align-items:center;gap:8px;margin-top:4px">
|
| 181 |
+
<input type="range" data-key="${esc(sl.key)}" min="${sl.min}" max="${sl.max}" step="${sl.step}" value="${v[sl.key]}" style="accent-color:${cat.color};flex:1" />
|
| 182 |
+
<span class="mono" style="width:4.5rem;text-align:right;font-size:11px;color:${cat.color}">${fmtSlider(v[sl.key], sl.unit, sl.step)}</span>
|
| 183 |
+
</div>
|
| 184 |
+
</label>`
|
| 185 |
+
)
|
| 186 |
+
.join("");
|
| 187 |
+
return `
|
| 188 |
+
<div class="kpi-tile" style="display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap">
|
| 189 |
+
<div>
|
| 190 |
+
<div class="mono" style="font-size:11px;text-transform:uppercase;letter-spacing:0.08em;color:${cat.color}">OEH guide ${esc(item.opportunity_id)} · SIMULATED — not live BMS · agent read-only</div>
|
| 191 |
+
<p style="color:#cbd5e1;max-width:42rem">${esc(item.summary)}</p>
|
| 192 |
+
</div>
|
| 193 |
+
<div style="display:flex;align-items:center;gap:16px">
|
| 194 |
+
<button type="button" id="include-btn" style="background:none;border:0;cursor:pointer;text-align:center">
|
| 195 |
+
<div class="mono muted" style="font-size:9px;text-transform:uppercase">Include in savings estimate</div>
|
| 196 |
+
<div style="width:3.5rem;height:1.75rem;border-radius:999px;border:1px solid ${included ? "#34d399" : "rgba(255,255,255,0.2)"};background:${included ? "rgba(16,185,129,0.2)" : "rgba(255,255,255,0.05)"};position:relative;margin:6px auto">
|
| 197 |
+
<span style="position:absolute;top:2px;width:1.25rem;height:1.25rem;border-radius:999px;background:${included ? "#34d399" : "#64748b"};left:${included ? "1.95rem" : "2px"}"></span>
|
| 198 |
+
</div>
|
| 199 |
+
<div class="mono" style="font-size:9px;color:${included ? "#6ee7b7" : "#64748b"}">${included ? "INCLUDED" : "NOT INCLUDED"}</div>
|
| 200 |
+
</button>
|
| 201 |
+
<div style="position:relative;width:76px;height:76px">
|
| 202 |
+
<svg width="76" height="76" viewBox="0 0 76 76" style="transform:rotate(-90deg)">
|
| 203 |
+
<circle cx="38" cy="38" r="32" stroke="rgba(255,255,255,0.08)" stroke-width="6" fill="none"></circle>
|
| 204 |
+
<circle cx="38" cy="38" r="32" stroke="${cat.color}" stroke-width="6" fill="none" stroke-linecap="round" stroke-dasharray="${circ}" stroke-dashoffset="${circ - dash}"></circle>
|
| 205 |
+
</svg>
|
| 206 |
+
<div style="position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center" class="mono">
|
| 207 |
+
<strong>${item.pct}%</strong>
|
| 208 |
+
<span class="muted" style="font-size:8px;text-transform:uppercase">OEH potential</span>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
<div class="kpi-tile" style="margin-top:12px">
|
| 214 |
+
<div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Guide comparison (simulated) — ${esc(item.scope)}</div>
|
| 215 |
+
<div style="display:flex;align-items:center;gap:12px;margin-bottom:8px"><span class="mono muted" style="width:6rem;font-size:11px">Baseline</span><div style="flex:1;height:20px;border-radius:4px;background:rgba(255,255,255,0.06)"><div style="height:100%;width:100%;background:#64748b"></div></div><span class="mono" style="width:2.5rem;text-align:right;font-size:11px">100%</span></div>
|
| 216 |
+
<div style="display:flex;align-items:center;gap:12px"><span class="mono muted" style="width:6rem;font-size:11px">Optimized</span><div style="flex:1;height:20px;border-radius:4px;background:rgba(255,255,255,0.06)"><div style="height:100%;width:${optWidth}%;background:${cat.color}"></div></div><span class="mono" style="width:2.5rem;text-align:right;font-size:11px;color:${cat.color}">${optWidth.toFixed(0)}%</span></div>
|
| 217 |
+
</div>
|
| 218 |
+
<div class="kpi-tile" style="margin-top:12px">
|
| 219 |
+
<div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:12px">Simulation console — ${esc(item.sim_label)}</div>
|
| 220 |
+
<div class="slider-row" id="guide-sliders">${sliderHtml}</div>
|
| 221 |
+
<div class="chart-wrap" style="margin-top:12px"><canvas id="guide-chart"></canvas></div>
|
| 222 |
+
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding-top:12px;margin-top:8px;border-top:1px solid rgba(255,255,255,0.06)">
|
| 223 |
+
${metrics.map((m) => `<div><div class="mono" style="font-size:18px;font-weight:700;color:${cat.color}">${esc(m.value)}</div><div class="mono muted" style="font-size:9px;text-transform:uppercase;margin-top:4px">${esc(m.label)}</div></div>`).join("")}
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
<div class="kpi-tile" style="margin-top:12px">
|
| 227 |
+
<div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Savings Calculator</div>
|
| 228 |
+
<p class="muted" style="font-size:11px">Not verified M&V. Not a BMS result. Assumed spend only.</p>
|
| 229 |
+
<div class="slider-row">
|
| 230 |
+
<label><span class="mono muted" style="font-size:11px">Assumed annual ${esc(item.scope)} spend (USD)</span>
|
| 231 |
+
<div style="margin-top:6px;display:flex;align-items:center;gap:4px;border:1px solid rgba(255,255,255,0.1);border-radius:6px;padding:0 8px;background:rgba(0,0,0,0.2)">
|
| 232 |
+
<span class="muted">$</span>
|
| 233 |
+
<input id="annual" type="number" min="0" step="1000" value="${annualCost}" style="width:100%;background:transparent;border:0;padding:8px;outline:none" class="mono" />
|
| 234 |
+
</div>
|
| 235 |
+
</label>
|
| 236 |
+
<label><span class="mono muted" style="font-size:11px">Assumed achievement (% of OEH max ${item.pct}%)</span>
|
| 237 |
+
<div style="display:flex;align-items:center;gap:8px;margin-top:10px">
|
| 238 |
+
<input id="achieved" type="range" min="0" max="100" value="${achieved}" style="flex:1;accent-color:${cat.color}" />
|
| 239 |
+
<span class="mono" style="color:${cat.color};width:2.5rem;text-align:right">${achieved}%</span>
|
| 240 |
+
</div>
|
| 241 |
+
</label>
|
| 242 |
+
</div>
|
| 243 |
+
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:16px;padding-top:12px;border-top:1px solid rgba(255,255,255,0.06)">
|
| 244 |
+
<div><div class="mono" style="font-size:18px;font-weight:700;${included ? `color:${cat.color}` : "color:#475569"}">${effectivePct.toFixed(1)}%</div><div class="mono muted" style="font-size:9px;text-transform:uppercase;margin-top:4px">Effective saving</div></div>
|
| 245 |
+
<div><div class="mono" style="font-size:18px;font-weight:700;${included ? `color:${cat.color}` : "color:#475569"}">$${Math.round(dollars).toLocaleString()}</div><div class="mono muted" style="font-size:9px;text-transform:uppercase;margin-top:4px">Estimated $ / year</div></div>
|
| 246 |
+
<div><div class="mono" style="font-size:18px;font-weight:700;${included ? `color:${cat.color}` : "color:#475569"}">$${Math.round(dollars * 5).toLocaleString()}</div><div class="mono muted" style="font-size:9px;text-transform:uppercase;margin-top:4px">Projected / 5 years</div></div>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
${item.scenario ? `<div class="kpi-tile" style="margin-top:12px;background:${cat.color}26;border-color:${cat.color}"><div class="mono" style="font-size:10px;text-transform:uppercase;color:${cat.color};margin-bottom:6px">Field result · OEH example (not this building)</div><p style="margin:0">${esc(item.scenario)}</p></div>` : ""}
|
| 250 |
+
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:12px">
|
| 251 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Control Principle</div><p style="margin:0;color:#cbd5e1">${esc(item.principle)}</p></div>
|
| 252 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Typical current practice</div><p style="margin:0;color:#cbd5e1">${esc(item.practice)}</p></div>
|
| 253 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Recommended action</div><p style="margin:0;color:#cbd5e1">${esc(item.recommendation)}</p></div>
|
| 254 |
+
</div>
|
| 255 |
+
<div class="kpi-tile" style="margin-top:12px">
|
| 256 |
+
<div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Commissioning checklist — minimum equipment</div>
|
| 257 |
+
<ul style="display:grid;grid-template-columns:1fr 1fr;gap:8px;list-style:none;padding:0;margin:0">
|
| 258 |
+
${equip
|
| 259 |
+
.map(
|
| 260 |
+
(eq, i) => `<li><button type="button" class="check-eq" data-i="${i}" style="background:none;border:0;display:flex;gap:8px;text-align:left;cursor:pointer;color:#cbd5e1">
|
| 261 |
+
<span style="width:16px;height:16px;border-radius:4px;border:1px solid ${checks[i] ? cat.color : "rgba(255,255,255,0.2)"};background:${checks[i] ? cat.color : "transparent"};flex-shrink:0;margin-top:2px"></span>
|
| 262 |
+
<span style="${checks[i] ? "text-decoration:line-through;color:#64748b" : ""}">${esc(eq)}</span>
|
| 263 |
+
</button></li>`
|
| 264 |
+
)
|
| 265 |
+
.join("")}
|
| 266 |
+
</ul>
|
| 267 |
+
</div>
|
| 268 |
+
<div style="display:flex;gap:8px;margin-top:12px">
|
| 269 |
+
${item.prev_id ? `<a class="btn-secondary mono" style="flex:1;font-size:11px" href="#/${item.prev_id}">← ${esc(item.prev_id)}</a>` : `<div style="flex:1"></div>`}
|
| 270 |
+
${item.next_id ? `<a class="btn-secondary mono" style="flex:1;font-size:11px" href="#/${item.next_id}">${esc(item.next_id)} →</a>` : ""}
|
| 271 |
+
</div>`;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
function bindGuide(item) {
|
| 275 |
+
const cat = CATS[item.section] || CATS.scheduling;
|
| 276 |
+
const canvas = document.getElementById("guide-chart");
|
| 277 |
+
const v = sliderDefaults(item);
|
| 278 |
+
drawChart(canvas, window.OehPhysics.seriesFor(item.opportunity_id, v, item.x_type), cat.color, item.x_type);
|
| 279 |
+
document.getElementById("include-btn")?.addEventListener("click", () => {
|
| 280 |
+
included = !included;
|
| 281 |
+
render();
|
| 282 |
+
});
|
| 283 |
+
document.getElementById("annual")?.addEventListener("change", (e) => {
|
| 284 |
+
annualCost = Number(e.target.value) || 0;
|
| 285 |
+
render();
|
| 286 |
+
});
|
| 287 |
+
document.getElementById("achieved")?.addEventListener("input", (e) => {
|
| 288 |
+
achieved = Number(e.target.value);
|
| 289 |
+
render();
|
| 290 |
+
});
|
| 291 |
+
document.querySelectorAll("#guide-sliders input").forEach((input) => {
|
| 292 |
+
input.addEventListener("input", () => {
|
| 293 |
+
sliders[input.dataset.key] = Number(input.value);
|
| 294 |
+
render();
|
| 295 |
+
});
|
| 296 |
+
});
|
| 297 |
+
document.querySelectorAll(".check-eq").forEach((btn) => {
|
| 298 |
+
btn.addEventListener("click", () => {
|
| 299 |
+
const i = Number(btn.dataset.i);
|
| 300 |
+
checks[i] = !checks[i];
|
| 301 |
+
render();
|
| 302 |
+
});
|
| 303 |
+
});
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
function renderOps(item) {
|
| 307 |
+
const inputs = (item.required_inputs || []).map((x) => `<li>${esc(x)}</li>`).join("");
|
| 308 |
+
const risks = (item.risks || []).map((x) => `<li>${esc(x)}</li>`).join("");
|
| 309 |
+
return `
|
| 310 |
+
<div class="kpi-tile" style="border-color:rgba(251,191,36,0.25)">
|
| 311 |
+
<div class="badge badge-warn">AWAITING TELEMETRY</div>
|
| 312 |
+
<p style="margin:10px 0 0;color:#cbd5e1">No live BMS in this Space. Operations KPIs stay empty on purpose — same contract as the product (NO LIVE DATA / AWAITING TELEMETRY). Open <strong>OEH guide</strong> for the teaching simulation used in the app.</p>
|
| 313 |
+
</div>
|
| 314 |
+
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:12px">
|
| 315 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase">Telemetry</div><strong>NO DATA</strong></div>
|
| 316 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase">ML</div><strong>NO DATA</strong></div>
|
| 317 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase">BMS</div><strong>OFFLINE</strong></div>
|
| 318 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase">Dispatch</div><strong>WRITE OFF</strong></div>
|
| 319 |
+
</div>
|
| 320 |
+
<div class="kpi-tile" style="margin-top:12px">
|
| 321 |
+
<div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Recommended control logic</div>
|
| 322 |
+
<p style="margin:0;color:#cbd5e1">${esc(item.recommended_control_logic || item.principle)}</p>
|
| 323 |
+
</div>
|
| 324 |
+
<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px">
|
| 325 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Required inputs</div><ul class="muted">${inputs}</ul></div>
|
| 326 |
+
<div class="kpi-tile"><div class="mono muted" style="font-size:10px;text-transform:uppercase;margin-bottom:8px">Risks</div><ul class="muted">${risks}</ul></div>
|
| 327 |
+
</div>`;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
function renderOpportunity(item) {
|
| 331 |
+
const cat = CATS[item.section] || CATS.scheduling;
|
| 332 |
+
const kind = item.control_kind === "advisory" ? "Advisory — no automatic plant write" : "Supervisory control (simulation)";
|
| 333 |
+
document.getElementById("root").innerHTML = `
|
| 334 |
+
<div class="workspace" style="border-top:3px solid ${cat.color}">
|
| 335 |
+
<div style="padding:20px 20px 12px">
|
| 336 |
+
<div class="muted" style="font-size:11px">${esc(CATS[item.section]?.label || item.section)} / ${esc(item.opportunity_id)}</div>
|
| 337 |
+
<div class="mono" style="font-size:10px;letter-spacing:0.18em;color:#22d3ee;margin-top:8px">${esc(item.opportunity_id)}</div>
|
| 338 |
+
<h1 style="margin:6px 0 0;font-size:1.55rem;font-weight:600">${esc(item.title)}</h1>
|
| 339 |
+
<p class="muted" style="max-width:42rem">${esc(item.summary)}</p>
|
| 340 |
+
<div style="display:flex;flex-wrap:wrap;gap:6px;margin-top:12px">
|
| 341 |
+
<span class="badge badge-warn">Telemetry NO DATA</span>
|
| 342 |
+
<span class="badge badge-muted">ML NO DATA</span>
|
| 343 |
+
<span class="badge badge-danger">BMS OFFLINE</span>
|
| 344 |
+
<span class="badge badge-muted">${esc(kind)}</span>
|
| 345 |
+
</div>
|
| 346 |
+
</div>
|
| 347 |
+
<div style="display:flex;gap:4px;padding:0 20px 16px" role="tablist">
|
| 348 |
+
<button class="tab-btn" data-tab="ops" ${tab === "ops" ? `style="border-color:${cat.color};color:${cat.color};background:${cat.color}18"` : ""}>Operations</button>
|
| 349 |
+
<button class="tab-btn" data-tab="guide" ${tab === "guide" ? `style="border-color:${cat.color};color:${cat.color};background:${cat.color}18"` : ""}>OEH guide</button>
|
| 350 |
+
</div>
|
| 351 |
+
</div>
|
| 352 |
+
<div id="studio" style="margin-top:16px">${tab === "guide" ? renderGuide(item) : renderOps(item)}</div>`;
|
| 353 |
+
document.querySelectorAll(".tab-btn").forEach((btn) => {
|
| 354 |
+
btn.onclick = () => {
|
| 355 |
+
tab = btn.dataset.tab;
|
| 356 |
+
if (tab === "guide") {
|
| 357 |
+
sliders = {};
|
| 358 |
+
checks = {};
|
| 359 |
+
}
|
| 360 |
+
render();
|
| 361 |
+
};
|
| 362 |
+
});
|
| 363 |
+
if (tab === "guide") bindGuide(item);
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
function render() {
|
| 367 |
+
renderSidebar();
|
| 368 |
+
const r = route();
|
| 369 |
+
if (r.page === "opp") renderOpportunity(byId[r.id]);
|
| 370 |
+
else renderOverview();
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
fetch("catalog.json")
|
| 374 |
+
.then((r) => r.json())
|
| 375 |
+
.then((data) => {
|
| 376 |
+
catalog = data;
|
| 377 |
+
byId = Object.fromEntries(data.map((o) => [o.opportunity_id, o]));
|
| 378 |
+
let lastId = null;
|
| 379 |
+
window.addEventListener("hashchange", () => {
|
| 380 |
+
const r = route();
|
| 381 |
+
if (r.id !== lastId) {
|
| 382 |
+
sliders = {};
|
| 383 |
+
checks = {};
|
| 384 |
+
lastId = r.id || null;
|
| 385 |
+
}
|
| 386 |
+
render();
|
| 387 |
+
});
|
| 388 |
+
render();
|
| 389 |
+
})
|
| 390 |
+
.catch(() => {
|
| 391 |
+
document.getElementById("root").textContent = "Could not load catalog.json";
|
| 392 |
+
});
|
index.html
CHANGED
|
@@ -3,199 +3,45 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
-
<title>HVAC
|
| 7 |
-
<
|
| 8 |
-
:root {
|
| 9 |
-
--bg: #070b12;
|
| 10 |
-
--panel: #0c121c;
|
| 11 |
-
--line: rgba(255,255,255,.08);
|
| 12 |
-
--text: #e8eef7;
|
| 13 |
-
--muted: #8b9bb0;
|
| 14 |
-
--accent: #3d9cf0;
|
| 15 |
-
--good: #3ecf8e;
|
| 16 |
-
--warn: #e0b34a;
|
| 17 |
-
}
|
| 18 |
-
* { box-sizing: border-box; }
|
| 19 |
-
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, sans-serif; }
|
| 20 |
-
a { color: var(--accent); }
|
| 21 |
-
header {
|
| 22 |
-
display: flex; align-items: center; justify-content: space-between; gap: 16px;
|
| 23 |
-
padding: 14px 20px; border-bottom: 1px solid var(--line); background: #080e18;
|
| 24 |
-
position: sticky; top: 0; z-index: 2;
|
| 25 |
-
}
|
| 26 |
-
header h1 { margin: 0; font-size: 15px; letter-spacing: .04em; }
|
| 27 |
-
header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
|
| 28 |
-
.badge { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; color: var(--warn); }
|
| 29 |
-
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100% - 58px); }
|
| 30 |
-
nav { border-right: 1px solid var(--line); overflow: auto; padding: 12px; }
|
| 31 |
-
nav button {
|
| 32 |
-
display: block; width: 100%; text-align: left; background: transparent; color: var(--text);
|
| 33 |
-
border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; margin-bottom: 2px;
|
| 34 |
-
}
|
| 35 |
-
nav button:hover, nav button.active { background: #152033; }
|
| 36 |
-
nav .oid { color: var(--accent); font-weight: 700; margin-right: 6px; }
|
| 37 |
-
nav .sec { color: var(--muted); font-size: 11px; display: block; margin: 10px 8px 6px; text-transform: uppercase; letter-spacing: .1em; }
|
| 38 |
-
main { padding: 20px 24px 40px; overflow: auto; }
|
| 39 |
-
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
|
| 40 |
-
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
|
| 41 |
-
.kpi span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
|
| 42 |
-
.kpi strong { font-size: 20px; }
|
| 43 |
-
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
|
| 44 |
-
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
|
| 45 |
-
input[type=range] { width: 100%; }
|
| 46 |
-
.slider { margin: 12px 0; }
|
| 47 |
-
.slider label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
|
| 48 |
-
ul { margin: 0; padding-left: 18px; color: var(--muted); }
|
| 49 |
-
canvas { width: 100%; height: 160px; background: #0a1018; border-radius: 8px; }
|
| 50 |
-
footer { color: var(--muted); font-size: 12px; margin-top: 24px; }
|
| 51 |
-
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } nav { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); } }
|
| 52 |
-
</style>
|
| 53 |
</head>
|
| 54 |
-
<body>
|
| 55 |
-
<header>
|
| 56 |
-
<div>
|
| 57 |
-
<
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
</div>
|
| 60 |
-
<span class="badge">GUIDE_POTENTIAL · SIMULATION</span>
|
| 61 |
</header>
|
| 62 |
-
<div class="
|
| 63 |
-
<
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
</div>
|
| 66 |
-
<script>
|
| 67 |
-
|
| 68 |
-
scheduling: "Scheduling",
|
| 69 |
-
"plant-control": "Plant control",
|
| 70 |
-
ventilation: "Ventilation",
|
| 71 |
-
"variable-speed": "Variable speed",
|
| 72 |
-
operations: "Operations & maintenance",
|
| 73 |
-
};
|
| 74 |
-
let catalog = [];
|
| 75 |
-
let current = null;
|
| 76 |
-
let values = {};
|
| 77 |
-
|
| 78 |
-
function energyIndex(item) {
|
| 79 |
-
const sliders = item.sliders || [];
|
| 80 |
-
if (!sliders.length) return 100;
|
| 81 |
-
let score = 0;
|
| 82 |
-
sliders.forEach((s) => {
|
| 83 |
-
const v = Number(values[s.key]);
|
| 84 |
-
const span = (s.max - s.min) || 1;
|
| 85 |
-
score += (v - s.min) / span;
|
| 86 |
-
});
|
| 87 |
-
score /= sliders.length;
|
| 88 |
-
const pct = Number(item.pct) || 10;
|
| 89 |
-
return Math.max(40, Math.round(100 - pct * score));
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
function drawChart(item) {
|
| 93 |
-
const c = document.getElementById("chart");
|
| 94 |
-
if (!c) return;
|
| 95 |
-
const ctx = c.getContext("2d");
|
| 96 |
-
const w = c.width = c.clientWidth * 2;
|
| 97 |
-
const h = c.height = 320;
|
| 98 |
-
ctx.clearRect(0, 0, w, h);
|
| 99 |
-
ctx.strokeStyle = "#1c2a3d";
|
| 100 |
-
ctx.lineWidth = 2;
|
| 101 |
-
for (let i = 1; i < 4; i++) {
|
| 102 |
-
const y = (h / 4) * i;
|
| 103 |
-
ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(w, y); ctx.stroke();
|
| 104 |
-
}
|
| 105 |
-
const idx = energyIndex(item);
|
| 106 |
-
ctx.strokeStyle = "#3d9cf0";
|
| 107 |
-
ctx.lineWidth = 4;
|
| 108 |
-
ctx.beginPath();
|
| 109 |
-
for (let x = 0; x <= 24; x++) {
|
| 110 |
-
const y = h * 0.25 + (h * 0.5) * (idx / 100) + Math.sin(x / 3) * 18;
|
| 111 |
-
const px = (x / 24) * w;
|
| 112 |
-
if (x === 0) ctx.moveTo(px, y); else ctx.lineTo(px, y);
|
| 113 |
-
}
|
| 114 |
-
ctx.stroke();
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
function render(item) {
|
| 118 |
-
current = item;
|
| 119 |
-
values = {};
|
| 120 |
-
(item.sliders || []).forEach((s) => { values[s.key] = s.default; });
|
| 121 |
-
document.querySelectorAll("nav button").forEach((b) => b.classList.toggle("active", b.dataset.id === item.opportunity_id));
|
| 122 |
-
const kind = item.control_kind === "advisory" ? "Advisory / no auto plant write" : "Supervisory control (simulation)";
|
| 123 |
-
document.getElementById("main").innerHTML = `
|
| 124 |
-
<h2>${item.opportunity_id} · ${item.title}</h2>
|
| 125 |
-
<p style="color:var(--muted)">${item.guide_section || item.section} · printed guide p.${item.guide_page || "—"}</p>
|
| 126 |
-
<div class="kpis">
|
| 127 |
-
<div class="kpi"><span>Guide potential</span><strong>${item.pct || "—"}%</strong></div>
|
| 128 |
-
<div class="kpi"><span>Control kind</span><strong style="font-size:14px">${kind}</strong></div>
|
| 129 |
-
<div class="kpi"><span>Relative energy index</span><strong id="idx">${energyIndex(item)}</strong></div>
|
| 130 |
-
<div class="kpi"><span>Impact class</span><strong style="font-size:14px">GUIDE_POTENTIAL</strong></div>
|
| 131 |
-
</div>
|
| 132 |
-
<div class="card">
|
| 133 |
-
<h3>${item.sim_label || "Teaching curve"}</h3>
|
| 134 |
-
<canvas id="chart"></canvas>
|
| 135 |
-
<p style="color:var(--muted);font-size:12px;margin:8px 0 0">Illustrative index from slider position × guide %. Not a live kWh meter.</p>
|
| 136 |
-
</div>
|
| 137 |
-
<div class="card" id="sliders"></div>
|
| 138 |
-
<div class="card"><h3>Strategy</h3><p>${item.summary || ""}</p></div>
|
| 139 |
-
<div class="card"><h3>Principle</h3><p>${item.principle || ""}</p></div>
|
| 140 |
-
<div class="card"><h3>Typical practice</h3><p>${item.practice || ""}</p></div>
|
| 141 |
-
<div class="card"><h3>Recommendation</h3><p>${item.recommendation || ""}</p></div>
|
| 142 |
-
<div class="card"><h3>Required inputs</h3><ul>${(item.required_inputs || []).map((x) => `<li>${x}</li>`).join("")}</ul></div>
|
| 143 |
-
<div class="card"><h3>Risks</h3><ul>${(item.risks || []).map((x) => `<li>${x}</li>`).join("")}</ul></div>
|
| 144 |
-
<div class="card"><h3>Benefits</h3><ul>${(item.benefits || []).map((x) => `<li>${x}</li>`).join("")}</ul></div>
|
| 145 |
-
${item.scenario ? `<div class="card"><h3>Guide case study</h3><p>${item.scenario}</p></div>` : ""}
|
| 146 |
-
<footer>
|
| 147 |
-
Full Next.js + FastAPI Docker app (simulation BMS, writes disabled) lives in
|
| 148 |
-
<a href="https://github.com/suban-godugu/hvac">github.com/suban-godugu/hvac</a>
|
| 149 |
-
under <code>huggingface-space/</code>. Hosting that container on Hugging Face requires a PRO plan
|
| 150 |
-
(<a href="https://huggingface.co/pro">huggingface.co/pro</a>).
|
| 151 |
-
Source guide: NSW OEH / AIRAH — Optimising your heating, ventilation and air conditioning systems.
|
| 152 |
-
</footer>`;
|
| 153 |
-
const box = document.getElementById("sliders");
|
| 154 |
-
box.innerHTML = "<h3>Interactive teaching sliders</h3>";
|
| 155 |
-
(item.sliders || []).forEach((s) => {
|
| 156 |
-
const wrap = document.createElement("div");
|
| 157 |
-
wrap.className = "slider";
|
| 158 |
-
wrap.innerHTML = `<label><span>${s.label}</span><span id="v-${s.key}">${s.default} ${s.unit || ""}</span></label>
|
| 159 |
-
<input type="range" min="${s.min}" max="${s.max}" step="${s.step}" value="${s.default}" data-key="${s.key}" />`;
|
| 160 |
-
box.appendChild(wrap);
|
| 161 |
-
});
|
| 162 |
-
box.querySelectorAll("input").forEach((input) => {
|
| 163 |
-
input.addEventListener("input", () => {
|
| 164 |
-
values[input.dataset.key] = Number(input.value);
|
| 165 |
-
const s = item.sliders.find((x) => x.key === input.dataset.key);
|
| 166 |
-
document.getElementById("v-" + s.key).textContent = input.value + " " + (s.unit || "");
|
| 167 |
-
document.getElementById("idx").textContent = energyIndex(item);
|
| 168 |
-
drawChart(item);
|
| 169 |
-
});
|
| 170 |
-
});
|
| 171 |
-
requestAnimationFrame(() => drawChart(item));
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
fetch("catalog.json")
|
| 175 |
-
.then((r) => r.json())
|
| 176 |
-
.then((data) => {
|
| 177 |
-
catalog = data;
|
| 178 |
-
const nav = document.getElementById("nav");
|
| 179 |
-
let last = "";
|
| 180 |
-
data.forEach((item) => {
|
| 181 |
-
if (item.section !== last) {
|
| 182 |
-
const h = document.createElement("div");
|
| 183 |
-
h.className = "sec";
|
| 184 |
-
h.textContent = SECTIONS[item.section] || item.section;
|
| 185 |
-
nav.appendChild(h);
|
| 186 |
-
last = item.section;
|
| 187 |
-
}
|
| 188 |
-
const b = document.createElement("button");
|
| 189 |
-
b.dataset.id = item.opportunity_id;
|
| 190 |
-
b.innerHTML = `<span class="oid">${item.opportunity_id}</span>${item.title}`;
|
| 191 |
-
b.onclick = () => render(item);
|
| 192 |
-
nav.appendChild(b);
|
| 193 |
-
});
|
| 194 |
-
render(data[0]);
|
| 195 |
-
})
|
| 196 |
-
.catch(() => {
|
| 197 |
-
document.getElementById("main").textContent = "Could not load catalog.json";
|
| 198 |
-
});
|
| 199 |
-
</script>
|
| 200 |
</body>
|
| 201 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<title>HVAC AI Control Center</title>
|
| 7 |
+
<link rel="stylesheet" href="shell.css" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
</head>
|
| 9 |
+
<body class="hvac-shell">
|
| 10 |
+
<header class="hvac-header">
|
| 11 |
+
<div class="hvac-header-inner">
|
| 12 |
+
<div style="display:flex;align-items:center;gap:12px;min-width:0">
|
| 13 |
+
<div class="logo">AI</div>
|
| 14 |
+
<div>
|
| 15 |
+
<div style="font-size:13px;font-weight:600;color:#f8fafc;line-height:1">HVAC AI</div>
|
| 16 |
+
<div class="muted" style="font-size:11px;margin-top:4px">Skyline Corporate Center · Bengaluru</div>
|
| 17 |
+
</div>
|
| 18 |
+
</div>
|
| 19 |
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end">
|
| 20 |
+
<span class="badge badge-danger">BMS OFFLINE</span>
|
| 21 |
+
<span class="badge badge-warn">TEL SIMULATED</span>
|
| 22 |
+
<span class="badge badge-muted">ADVISORY</span>
|
| 23 |
+
<span class="badge badge-danger">SAFETY HOLD</span>
|
| 24 |
+
<span class="mono muted" style="font-size:10px">WRITE OFF</span>
|
| 25 |
+
</div>
|
| 26 |
</div>
|
|
|
|
| 27 |
</header>
|
| 28 |
+
<div class="hvac-body">
|
| 29 |
+
<aside class="hvac-sidebar">
|
| 30 |
+
<div style="padding:14px 16px;border-bottom:1px solid rgba(255,255,255,0.06)">
|
| 31 |
+
<div class="muted" style="font-size:10px;font-weight:600;letter-spacing:0.18em;text-transform:uppercase">Control Center</div>
|
| 32 |
+
<div style="font-size:11px;color:#cbd5e1;margin-top:2px">Twenty supervisory opportunities</div>
|
| 33 |
+
</div>
|
| 34 |
+
<nav id="sidebar"></nav>
|
| 35 |
+
<div style="border-top:1px solid rgba(255,255,255,0.06);padding:10px 12px;display:flex;gap:8px;background:#070c16">
|
| 36 |
+
<span class="badge badge-muted">BMS OFFLINE</span>
|
| 37 |
+
<span class="badge badge-warn">TEL SIMULATED</span>
|
| 38 |
+
</div>
|
| 39 |
+
</aside>
|
| 40 |
+
<main class="hvac-main">
|
| 41 |
+
<div style="max-width:1600px;margin:0 auto" id="root">Loading…</div>
|
| 42 |
+
</main>
|
| 43 |
</div>
|
| 44 |
+
<script src="physics.js"></script>
|
| 45 |
+
<script src="app.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
</body>
|
| 47 |
</html>
|
physics.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** OEH teaching curves — same model as backend/services/oeh_guide_physics.py. Always SIMULATED. */
|
| 2 |
+
(function (g) {
|
| 3 |
+
const clamp = (v, a, b) => Math.max(a, Math.min(b, v));
|
| 4 |
+
const avg = (arr) => (arr.length ? arr.reduce((s, n) => s + n, 0) / arr.length : 0);
|
| 5 |
+
const oat = (hour, mean, amp) => mean + amp * Math.cos((hour - 15) * (Math.PI / 12));
|
| 6 |
+
const loadCurve = (hour) => clamp(Math.sin(((hour - 6) / 14) * Math.PI), 0.05, 1);
|
| 7 |
+
const occupancyCurve = (hour) => clamp(Math.sin(((hour - 8) / 10) * Math.PI), 0.03, 1);
|
| 8 |
+
const f = (v, key, d) => {
|
| 9 |
+
const n = Number(v[key]);
|
| 10 |
+
return Number.isFinite(n) ? n : d;
|
| 11 |
+
};
|
| 12 |
+
const pct = (n) => `${n.toFixed(0)}%`;
|
| 13 |
+
|
| 14 |
+
function pointAt(oid, x, v) {
|
| 15 |
+
if (oid === "O1") {
|
| 16 |
+
const occ = f(v, "occStart", 8.5);
|
| 17 |
+
const sev = f(v, "severity", 50);
|
| 18 |
+
const baseStart = occ - 2.5, baseStop = 17.5;
|
| 19 |
+
const optStart = occ - (0.5 + (sev / 100) * 2);
|
| 20 |
+
const optStop = 17.5 - (0.1 + ((100 - sev) / 100) * 0.4);
|
| 21 |
+
return [baseStart <= x && x < baseStop ? 100 : 0, optStart <= x && x < optStop ? 100 : 0];
|
| 22 |
+
}
|
| 23 |
+
if (oid === "O2") {
|
| 24 |
+
const db = f(v, "deadBand", 1);
|
| 25 |
+
const pb = f(v, "propBand", 1);
|
| 26 |
+
const dev = clamp(3 * Math.sin(((x - 9) / 14) * Math.PI), -3, 3);
|
| 27 |
+
const out = (d, band, p) => {
|
| 28 |
+
const half = band / 2;
|
| 29 |
+
if (Math.abs(d) <= half) return 0;
|
| 30 |
+
return clamp(((Math.abs(d) - half) / Math.max(p, 0.01)) * 100, 0, 100);
|
| 31 |
+
};
|
| 32 |
+
return [out(dev, 1, 1), out(dev, db, pb)];
|
| 33 |
+
}
|
| 34 |
+
if (oid === "O3") {
|
| 35 |
+
const phases = [0, 1.2, 2.4, 3.6, 4.8];
|
| 36 |
+
const devs = phases.map((ph) => Math.max(0, 2.5 * Math.sin(((x - 8 + ph) / 12) * Math.PI)));
|
| 37 |
+
devs[4] += f(v, "faultBias", 1.5);
|
| 38 |
+
const baseline = Math.max(...devs);
|
| 39 |
+
const n = Math.min(Math.trunc(f(v, "numAvg", 3)), 5);
|
| 40 |
+
const sorted = [...devs].sort((a, b) => b - a);
|
| 41 |
+
const optimized = sorted.slice(0, n).reduce((s, n) => s + n, 0) / n;
|
| 42 |
+
return [baseline, optimized];
|
| 43 |
+
}
|
| 44 |
+
if (oid === "O4") {
|
| 45 |
+
const load = (f(v, "peakLoad", 75) / 100) * loadCurve(x);
|
| 46 |
+
const delay = f(v, "stageDelay", 10);
|
| 47 |
+
const baseline = clamp(Math.ceil(load * 3 + 0.45), 0, 3);
|
| 48 |
+
const optimized = clamp(Math.ceil(load * 3 - ((delay - 5) / 15) * 0.3), 0, 3);
|
| 49 |
+
return [baseline, optimized];
|
| 50 |
+
}
|
| 51 |
+
if (oid === "O5") {
|
| 52 |
+
const demand = (f(v, "demandAmp", 80) / 100) * loadCurve(x);
|
| 53 |
+
const openNeeded = 40 + demand * 60;
|
| 54 |
+
const optSpeed = clamp(100 * (openNeeded / Math.max(f(v, "targetOpen", 92), 1)), 25, 100);
|
| 55 |
+
return [100, (optSpeed / 100) ** 3 * 100];
|
| 56 |
+
}
|
| 57 |
+
if (oid === "O6") {
|
| 58 |
+
const demand = (f(v, "heatSeverity", 60) / 100) * (1 - loadCurve(x));
|
| 59 |
+
const floor = f(v, "boilerType", 1) ? 40 : 55;
|
| 60 |
+
return [82, floor + demand * (82 - floor)];
|
| 61 |
+
}
|
| 62 |
+
if (oid === "O7") {
|
| 63 |
+
const load = (f(v, "loadSeverity", 80) / 100) * loadCurve(x);
|
| 64 |
+
return [6.5, 6.5 + (1 - load) * 5.5];
|
| 65 |
+
}
|
| 66 |
+
if (oid === "O8") {
|
| 67 |
+
const wb = oat(x, f(v, "wetBulbMean", 20), 4);
|
| 68 |
+
return [f(v, "wetBulbMean", 20) + 11.5, wb + f(v, "approach", 3.5)];
|
| 69 |
+
}
|
| 70 |
+
if (oid === "O9") {
|
| 71 |
+
const load = 100 * loadCurve(x) * (f(v, "loadVar", 60) / 100) + (1 - f(v, "loadVar", 60) / 100) * 70;
|
| 72 |
+
const baseline = 5 + (100 - load) * 0.08;
|
| 73 |
+
const optimized = f(v, "valveType", 0) ? 2 + (100 - load) * 0.02 : baseline;
|
| 74 |
+
return [baseline, optimized];
|
| 75 |
+
}
|
| 76 |
+
if (oid === "O10") {
|
| 77 |
+
const temp = oat(x, f(v, "oatMean", 18), 6);
|
| 78 |
+
const active = temp < 21 && f(v, "dewPoint", 10) < 12;
|
| 79 |
+
const demand = 100 * loadCurve(x);
|
| 80 |
+
return [demand, active ? demand * 0.15 : demand];
|
| 81 |
+
}
|
| 82 |
+
if (oid === "O11") {
|
| 83 |
+
const residual = f(v, "residual", 27);
|
| 84 |
+
const low = f(v, "overnightLow", 16);
|
| 85 |
+
if (x < 4) return [residual - 1, residual - 1];
|
| 86 |
+
if (x < 7.5) {
|
| 87 |
+
const pf = clamp((x - 4) / 2.5, 0, 1);
|
| 88 |
+
return [residual, residual - pf * Math.max(0, residual - 2 - low)];
|
| 89 |
+
}
|
| 90 |
+
return [23, 23];
|
| 91 |
+
}
|
| 92 |
+
if (oid === "O12") {
|
| 93 |
+
const occ = f(v, "peakOcc", 80) * occupancyCurve(x);
|
| 94 |
+
return [100, clamp(30 + occ * 0.7, 30, 100)];
|
| 95 |
+
}
|
| 96 |
+
if (oid === "O13") {
|
| 97 |
+
const density = f(v, "peakDensity", 55) * occupancyCurve(x);
|
| 98 |
+
const speed = clamp(25 + density * 0.75, 25, 100);
|
| 99 |
+
return [100, (speed / 100) ** 3 * 100];
|
| 100 |
+
}
|
| 101 |
+
if (oid === "O14") {
|
| 102 |
+
const load = (f(v, "loadAmp", 75) / 100) * loadCurve(x);
|
| 103 |
+
const speed = clamp(100 * ((40 + load * 60) / 95), 30, 100);
|
| 104 |
+
return [100, (speed / 100) ** 3 * 100];
|
| 105 |
+
}
|
| 106 |
+
if (oid === "O15") return [95, clamp((oat(x, f(v, "ambientMean", 20), 6) - 2) * 2.8, 25, 100)];
|
| 107 |
+
if (oid === "O16") {
|
| 108 |
+
const load = (f(v, "loadAmp", 75) / 100) * loadCurve(x);
|
| 109 |
+
return [100, clamp(100 * (1 - f(v, "idlePct", 20) / 100) * (0.4 + 0.6 * load), 20, 100)];
|
| 110 |
+
}
|
| 111 |
+
if (oid === "O17") return [100 + x * 1.6, 100 - (f(v, "coordScore", 55) / 100) * x * 3.2];
|
| 112 |
+
if (oid === "O18") return [100 + x * 0.3, 100 - (f(v, "coverage", 50) / 100) * x * 0.9];
|
| 113 |
+
if (oid === "O19") {
|
| 114 |
+
const base = 100 + x * 1.2;
|
| 115 |
+
return [base, base * (1 - clamp(f(v, "freq", 4) / 12, 0, 1))];
|
| 116 |
+
}
|
| 117 |
+
if (oid === "O20") {
|
| 118 |
+
const baseline = clamp(100 - x * 4, 40, 100);
|
| 119 |
+
const factor = f(v, "accessCtrl", 1) * 0.5 + clamp(f(v, "backupFreq", 4) / 12, 0, 1) * 0.5;
|
| 120 |
+
return [baseline, clamp(100 - x * 4 * (1 - factor), 40, 100)];
|
| 121 |
+
}
|
| 122 |
+
return [100, 100];
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
function seriesFor(oid, sliders, xType) {
|
| 126 |
+
const n = xType === "month" ? 12 : 24;
|
| 127 |
+
const out = [];
|
| 128 |
+
for (let x = 0; x < n; x++) {
|
| 129 |
+
const [b, o] = pointAt(oid, x, sliders);
|
| 130 |
+
out.push({ x, baseline: Math.round(b * 1000) / 1000, optimized: Math.round(o * 1000) / 1000 });
|
| 131 |
+
}
|
| 132 |
+
return out;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
function metricsFor(oid, pts, v) {
|
| 136 |
+
const ab = avg(pts.map((p) => p.baseline));
|
| 137 |
+
const ao = avg(pts.map((p) => p.optimized));
|
| 138 |
+
const last = pts[pts.length - 1] || { baseline: 0, optimized: 0 };
|
| 139 |
+
if (oid === "O1") {
|
| 140 |
+
const bh = pts.filter((p) => p.baseline > 0).length;
|
| 141 |
+
const oh = pts.filter((p) => p.optimized > 0).length;
|
| 142 |
+
const red = bh ? ((bh - oh) / bh) * 100 : 0;
|
| 143 |
+
return [
|
| 144 |
+
{ label: "Baseline runtime", value: `${bh} h/day` },
|
| 145 |
+
{ label: "Optimized runtime", value: `${oh} h/day` },
|
| 146 |
+
{ label: "Operating hours cut", value: pct(red) },
|
| 147 |
+
];
|
| 148 |
+
}
|
| 149 |
+
if (oid === "O2") {
|
| 150 |
+
const red = ab ? ((ab - ao) / ab) * 100 : 0;
|
| 151 |
+
return [
|
| 152 |
+
{ label: "Baseline avg output", value: `${ab.toFixed(0)}%` },
|
| 153 |
+
{ label: "Optimized avg output", value: `${ao.toFixed(0)}%` },
|
| 154 |
+
{ label: "Est. HVAC energy cut", value: pct(red) },
|
| 155 |
+
];
|
| 156 |
+
}
|
| 157 |
+
if (oid === "O3") {
|
| 158 |
+
const red = ab ? ((ab - ao) / ab) * 100 : 0;
|
| 159 |
+
return [
|
| 160 |
+
{ label: "Baseline signal (high-select)", value: `${ab.toFixed(1)}°C` },
|
| 161 |
+
{ label: "Optimized signal (weighted)", value: `${ao.toFixed(1)}°C` },
|
| 162 |
+
{ label: "Over-cooling reduced", value: pct(red) },
|
| 163 |
+
];
|
| 164 |
+
}
|
| 165 |
+
if (oid === "O4") {
|
| 166 |
+
const red = ab ? clamp(((ab - ao) / ab) * 100, 0, 10) : 0;
|
| 167 |
+
return [
|
| 168 |
+
{ label: "Avg stages — baseline", value: ab.toFixed(1) },
|
| 169 |
+
{ label: "Avg stages — optimized", value: ao.toFixed(1) },
|
| 170 |
+
{ label: "Chiller-hours saved", value: pct(red) },
|
| 171 |
+
];
|
| 172 |
+
}
|
| 173 |
+
if (oid === "O5")
|
| 174 |
+
return [
|
| 175 |
+
{ label: "Baseline fan power", value: "100%" },
|
| 176 |
+
{ label: "Optimized fan power", value: `${ao.toFixed(0)}%` },
|
| 177 |
+
{ label: "Fan energy saved", value: pct(clamp(100 - ao, 0, 30)) },
|
| 178 |
+
];
|
| 179 |
+
if (oid === "O6")
|
| 180 |
+
return [
|
| 181 |
+
{ label: "Baseline flow temp", value: "82°C" },
|
| 182 |
+
{ label: "Optimized avg flow temp", value: `${ao.toFixed(0)}°C` },
|
| 183 |
+
{ label: "Boiler efficiency gain", value: `${clamp((82 - ao) * 0.15, 0, 5).toFixed(1)}%` },
|
| 184 |
+
];
|
| 185 |
+
if (oid === "O7") {
|
| 186 |
+
const per = f(v, "compType", 0) ? 4.5 : 2.5;
|
| 187 |
+
return [
|
| 188 |
+
{ label: "Baseline CHW temp", value: "6.5°C" },
|
| 189 |
+
{ label: "Optimized avg CHW temp", value: `${ao.toFixed(1)}°C` },
|
| 190 |
+
{ label: "Chiller energy saved", value: pct(clamp((ao - 6.5) * per, 0, 15)) },
|
| 191 |
+
];
|
| 192 |
+
}
|
| 193 |
+
if (oid === "O8") {
|
| 194 |
+
const sav = clamp((ab - ao) * 2.5, 0, 15);
|
| 195 |
+
return [
|
| 196 |
+
{ label: "Baseline CW temp", value: `${ab.toFixed(1)}°C` },
|
| 197 |
+
{ label: "Optimized avg CW temp", value: `${ao.toFixed(1)}°C` },
|
| 198 |
+
{ label: "Chiller energy saved", value: pct(sav) },
|
| 199 |
+
];
|
| 200 |
+
}
|
| 201 |
+
if (oid === "O9") {
|
| 202 |
+
const sav = clamp((ab - ao) * 3, 0, 15);
|
| 203 |
+
return [
|
| 204 |
+
{ label: "Baseline efficiency loss", value: `${ab.toFixed(1)}%` },
|
| 205 |
+
{ label: "Optimized efficiency loss", value: `${ao.toFixed(1)}%` },
|
| 206 |
+
{ label: "Compressor energy saved", value: pct(sav) },
|
| 207 |
+
];
|
| 208 |
+
}
|
| 209 |
+
if (oid === "O10") {
|
| 210 |
+
const hours = pts.filter((p) => p.optimized < p.baseline * 0.9).length;
|
| 211 |
+
const sav = ab ? clamp(((ab - ao) / ab) * 100, 0, 20) : 0;
|
| 212 |
+
return [
|
| 213 |
+
{ label: "Economy cycle active", value: `${hours} h/day` },
|
| 214 |
+
{ label: "Optimized avg compressor load", value: `${ao.toFixed(0)}%` },
|
| 215 |
+
{ label: "Compressor energy saved", value: pct(sav) },
|
| 216 |
+
];
|
| 217 |
+
}
|
| 218 |
+
if (oid === "O11") {
|
| 219 |
+
const window = pts.filter((p) => p.x >= 4 && p.x < 7.5);
|
| 220 |
+
const minOpt = window.length ? Math.min(...window.map((p) => p.optimized)) : f(v, "residual", 27);
|
| 221 |
+
const residual = f(v, "residual", 27);
|
| 222 |
+
return [
|
| 223 |
+
{ label: "Residual temp", value: `${residual.toFixed(1)}°C` },
|
| 224 |
+
{ label: "Purged down to", value: `${minOpt.toFixed(1)}°C` },
|
| 225 |
+
{ label: "Start-up energy saved", value: pct(clamp((residual - minOpt) * 4, 0, 20)) },
|
| 226 |
+
];
|
| 227 |
+
}
|
| 228 |
+
if (oid === "O12") {
|
| 229 |
+
const est = Math.round(400 + (f(v, "peakOcc", 80) / 100) * (f(v, "co2SP", 800) - 400));
|
| 230 |
+
return [
|
| 231 |
+
{ label: "Optimized avg OA flow", value: `${ao.toFixed(0)}%` },
|
| 232 |
+
{ label: "Peak CO₂ estimate", value: `${est} ppm` },
|
| 233 |
+
{ label: "Ventilation energy saved", value: pct(clamp(100 - ao, 0, 20)) },
|
| 234 |
+
];
|
| 235 |
+
}
|
| 236 |
+
if (oid === "O13")
|
| 237 |
+
return [
|
| 238 |
+
{ label: "Baseline fan power", value: "100%" },
|
| 239 |
+
{ label: "Optimized avg fan power", value: `${ao.toFixed(0)}%` },
|
| 240 |
+
{ label: "Fan energy saved", value: pct(clamp(100 - ao, 0, 80)) },
|
| 241 |
+
];
|
| 242 |
+
if (oid === "O14")
|
| 243 |
+
return [
|
| 244 |
+
{ label: "Baseline pump power", value: "100%" },
|
| 245 |
+
{ label: "Optimized avg pump power", value: `${ao.toFixed(0)}%` },
|
| 246 |
+
{ label: "Pumping energy saved", value: pct(clamp(100 - ao, 0, 30)) },
|
| 247 |
+
];
|
| 248 |
+
if (oid === "O15") {
|
| 249 |
+
const sav = ab ? clamp(((ab - ao) / ab) * 100, 0, 30) : 0;
|
| 250 |
+
return [
|
| 251 |
+
{ label: "Baseline fan power", value: `${ab.toFixed(0)}%` },
|
| 252 |
+
{ label: "Optimized avg fan power", value: `${ao.toFixed(0)}%` },
|
| 253 |
+
{ label: "Condenser fan energy saved", value: pct(sav) },
|
| 254 |
+
];
|
| 255 |
+
}
|
| 256 |
+
if (oid === "O16")
|
| 257 |
+
return [
|
| 258 |
+
{ label: "Baseline pump power", value: "100%" },
|
| 259 |
+
{ label: "Optimized avg pump power", value: `${ao.toFixed(0)}%` },
|
| 260 |
+
{ label: "CW pump energy saved", value: pct(clamp(100 - ao, 0, 30)) },
|
| 261 |
+
];
|
| 262 |
+
if (oid === "O17") {
|
| 263 |
+
const sav = last.baseline ? clamp(((last.baseline - last.optimized) / last.baseline) * 100, 0, 50) : 0;
|
| 264 |
+
return [
|
| 265 |
+
{ label: "Year-end index — no plan", value: last.baseline.toFixed(0) },
|
| 266 |
+
{ label: "Year-end index — with plan", value: last.optimized.toFixed(0) },
|
| 267 |
+
{ label: "Total energy saved", value: pct(sav) },
|
| 268 |
+
];
|
| 269 |
+
}
|
| 270 |
+
if (oid === "O18") {
|
| 271 |
+
const cov = f(v, "coverage", 50);
|
| 272 |
+
const sav = last.baseline ? clamp(((last.baseline - last.optimized) / last.baseline) * 100, 0, 10) : 0;
|
| 273 |
+
return [
|
| 274 |
+
{ label: "Total energy saved", value: pct(sav) },
|
| 275 |
+
{ label: "Est. NABERS star gain", value: `+${((cov / 100) * 0.5).toFixed(1)} ★` },
|
| 276 |
+
{ label: "Training coverage", value: `${cov.toFixed(0)}%` },
|
| 277 |
+
];
|
| 278 |
+
}
|
| 279 |
+
if (oid === "O19") {
|
| 280 |
+
const sav = last.baseline ? clamp(((last.baseline - last.optimized) / last.baseline) * 100, 0, 20) : 0;
|
| 281 |
+
return [
|
| 282 |
+
{ label: "Year-end index — reactive", value: last.baseline.toFixed(0) },
|
| 283 |
+
{ label: "Year-end index — maintained", value: last.optimized.toFixed(0) },
|
| 284 |
+
{ label: "HVAC energy saved", value: pct(sav) },
|
| 285 |
+
];
|
| 286 |
+
}
|
| 287 |
+
if (oid === "O20") {
|
| 288 |
+
const sav = clamp((last.optimized - last.baseline) * 0.2, 0, 10);
|
| 289 |
+
return [
|
| 290 |
+
{ label: "Settings retained — baseline", value: `${last.baseline.toFixed(0)}%` },
|
| 291 |
+
{ label: "Settings retained — managed", value: `${last.optimized.toFixed(0)}%` },
|
| 292 |
+
{ label: "HVAC energy saved", value: pct(sav) },
|
| 293 |
+
];
|
| 294 |
+
}
|
| 295 |
+
const sav = ab ? clamp(((ab - ao) / ab) * 100, 0, 80) : 0;
|
| 296 |
+
return [
|
| 297 |
+
{ label: "Baseline avg", value: ab.toFixed(1) },
|
| 298 |
+
{ label: "Optimized avg", value: ao.toFixed(1) },
|
| 299 |
+
{ label: "Guide reduction", value: pct(sav) },
|
| 300 |
+
];
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
g.OehPhysics = { seriesFor, metricsFor, clamp };
|
| 304 |
+
})(window);
|
shell.css
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
html, body {
|
| 2 |
+
margin: 0;
|
| 3 |
+
min-height: 100%;
|
| 4 |
+
background: #05080f;
|
| 5 |
+
color: #e2e8f0;
|
| 6 |
+
font-family: "Segoe UI", system-ui, sans-serif;
|
| 7 |
+
color-scheme: dark;
|
| 8 |
+
}
|
| 9 |
+
a { color: inherit; text-decoration: none; }
|
| 10 |
+
button, select, input { font: inherit; color: inherit; }
|
| 11 |
+
.hvac-shell { min-height: 100vh; display: flex; flex-direction: column; background: #05080f; }
|
| 12 |
+
.hvac-header {
|
| 13 |
+
sticky: top;
|
| 14 |
+
position: sticky; top: 0; z-index: 40; height: 4rem;
|
| 15 |
+
background: rgba(7, 13, 24, 0.88); backdrop-filter: blur(16px);
|
| 16 |
+
border-bottom: 1px solid rgba(255,255,255,0.07);
|
| 17 |
+
padding: 0 1.25rem; display: flex; align-items: center;
|
| 18 |
+
}
|
| 19 |
+
.hvac-header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 1rem; }
|
| 20 |
+
.logo {
|
| 21 |
+
width: 2.25rem; height: 2.25rem; border-radius: 0.75rem;
|
| 22 |
+
border: 1px solid rgba(34, 211, 238, 0.25);
|
| 23 |
+
background: linear-gradient(to bottom right, rgba(34,211,238,0.2), rgba(6,182,212,0.05));
|
| 24 |
+
box-shadow: 0 0 24px rgba(34,211,238,0.12);
|
| 25 |
+
display: flex; align-items: center; justify-content: center; color: #67e8f9; font-weight: 700;
|
| 26 |
+
}
|
| 27 |
+
.badge {
|
| 28 |
+
font-size: 10px; font-family: ui-monospace, Consolas, monospace;
|
| 29 |
+
letter-spacing: 0.06em; text-transform: uppercase;
|
| 30 |
+
border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
|
| 31 |
+
padding: 3px 8px; background: rgba(255,255,255,0.03);
|
| 32 |
+
}
|
| 33 |
+
.badge-live { color: #5eead4; border-color: rgba(45,212,191,0.35); }
|
| 34 |
+
.badge-warn { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
|
| 35 |
+
.badge-danger { color: #f87171; border-color: rgba(248,113,113,0.35); }
|
| 36 |
+
.badge-muted { color: #94a3b8; }
|
| 37 |
+
.hvac-body { display: flex; flex: 1; min-height: 0; }
|
| 38 |
+
.hvac-sidebar {
|
| 39 |
+
width: 18rem; flex-shrink: 0; background: #080e18;
|
| 40 |
+
border-right: 1px solid rgba(255,255,255,0.07);
|
| 41 |
+
height: calc(100vh - 4rem); position: sticky; top: 4rem;
|
| 42 |
+
display: flex; flex-direction: column; overflow: hidden;
|
| 43 |
+
}
|
| 44 |
+
.hvac-sidebar nav { flex: 1; overflow: auto; padding: 0.5rem; }
|
| 45 |
+
.nav-sec { padding: 10px 8px 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #475569; }
|
| 46 |
+
.nav-item {
|
| 47 |
+
display: flex; align-items: center; gap: 8px; padding: 6px 10px;
|
| 48 |
+
font-size: 11.5px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; color: #94a3b8;
|
| 49 |
+
}
|
| 50 |
+
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,0.035); }
|
| 51 |
+
.nav-item.active { border-left-color: #22d3ee; color: #cffafe; background: rgba(6,182,212,0.1); font-weight: 600; }
|
| 52 |
+
.nav-oid { font-family: ui-monospace, Consolas, monospace; width: 2rem; flex-shrink: 0; color: #64748b; }
|
| 53 |
+
.nav-item.active .nav-oid { color: #22d3ee; }
|
| 54 |
+
.group-btn {
|
| 55 |
+
width: 100%; display: flex; align-items: center; justify-content: space-between;
|
| 56 |
+
background: none; border: 0; padding: 6px 8px; color: #cbd5e1; font-size: 12px; font-weight: 600; cursor: pointer;
|
| 57 |
+
}
|
| 58 |
+
.hvac-main { flex: 1; padding: 1.75rem 2rem; overflow: auto; }
|
| 59 |
+
.workspace {
|
| 60 |
+
border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.08); overflow: hidden;
|
| 61 |
+
background: linear-gradient(to bottom, #121c2e, #0d1524);
|
| 62 |
+
box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 12px 32px rgba(0,0,0,0.22);
|
| 63 |
+
}
|
| 64 |
+
.kpi-tile {
|
| 65 |
+
background: #0c121c; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 16px;
|
| 66 |
+
}
|
| 67 |
+
.glass-card {
|
| 68 |
+
display: flex; flex-direction: column; justify-content: space-between;
|
| 69 |
+
padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
|
| 70 |
+
background: rgba(12, 18, 28, 0.9);
|
| 71 |
+
}
|
| 72 |
+
.glass-card:hover h3 { color: #cffafe; }
|
| 73 |
+
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
|
| 74 |
+
.tab-btn {
|
| 75 |
+
padding: 6px 12px; font-size: 11px; font-family: ui-monospace, Consolas, monospace;
|
| 76 |
+
text-transform: uppercase; letter-spacing: 0.08em; border-radius: 6px; border: 1px solid transparent;
|
| 77 |
+
background: transparent; cursor: pointer; color: #64748b;
|
| 78 |
+
}
|
| 79 |
+
.chart-wrap { height: 180px; position: relative; }
|
| 80 |
+
.chart-wrap canvas { width: 100%; height: 100%; }
|
| 81 |
+
.slider-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
| 82 |
+
@media (max-width: 900px) {
|
| 83 |
+
.hvac-sidebar { display: none; }
|
| 84 |
+
.slider-row { grid-template-columns: 1fr; }
|
| 85 |
+
}
|
| 86 |
+
input[type=range] { width: 100%; }
|
| 87 |
+
.mono { font-family: ui-monospace, Consolas, monospace; }
|
| 88 |
+
.muted { color: #64748b; }
|
| 89 |
+
.btn-secondary {
|
| 90 |
+
display: inline-flex; align-items: center; justify-content: center;
|
| 91 |
+
border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 8px 12px;
|
| 92 |
+
background: rgba(255,255,255,0.04); cursor: pointer;
|
| 93 |
+
}
|
style.css
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
body {
|
| 2 |
-
padding: 2rem;
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
-
}
|
| 5 |
-
|
| 6 |
-
h1 {
|
| 7 |
-
font-size: 16px;
|
| 8 |
-
margin-top: 0;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
p {
|
| 12 |
-
color: rgb(107, 114, 128);
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
max-width: 620px;
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.card p:last-child {
|
| 27 |
-
margin-bottom: 0;
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|