Temperature joins the mockups' list of domains (D-041): a Red
notification on the support Home, and a one-line block on the client
view ("Hottest (24 h) 43 °C · limit 97.5 °C") for the stations that
measure the GPU. src/temperature/final.py writes the site figure; the
comparison page reuses its panel. Short two-layer guide in
docs/temperature/guide/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
316 lines
18 KiB
HTML
316 lines
18 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>AIMsight System Summary</title>
|
|
<script src="https://cdn.plot.ly/plotly-4.1.1.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/marked@12.0.2/marked.min.js"></script>
|
|
<style>
|
|
/* Maquette côté client : page System Summary + section Diagnostic (D-020 à D-023, D-039, D-041). Données injectées par summary.py. */
|
|
:root {
|
|
--sidebar: #2a3f54; --topbar: #ededed; --page: #f7f7f7; --panel-border: #e6e9ed;
|
|
--muted: #73879c; --text: #333; --line: #dee2e6;
|
|
--green: #008300; --orange: #eda100; --red: #d03b3b; --unknown: #8c8c8c;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
body { margin: 0; background: var(--page); color: var(--muted);
|
|
font: 13px/1.47 "Helvetica Neue", Roboto, Arial, "Droid Sans", sans-serif; }
|
|
svg.i { width: 15px; height: 15px; fill: currentColor; vertical-align: -2px; }
|
|
|
|
.sidebar { position: fixed; inset: 0 auto 0 0; width: 230px; background: var(--sidebar); color: #fff; }
|
|
.brand { height: 57px; padding: 0 10px; display: flex; align-items: center; font-size: 22px; }
|
|
.profile { display: flex; align-items: center; gap: 22px; padding: 18px 12px 24px; }
|
|
.avatar { width: 56px; height: 56px; border-radius: 50%; background: #9b59b6; border: 3px solid #fff;
|
|
display: grid; place-items: center; font-size: 19px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
|
|
.profile small { display: block; color: #bab8b8; font-size: 13px; }
|
|
.profile span { font-size: 14px; }
|
|
.section { padding: 0 23px 18px; font-size: 11px; font-weight: bold; letter-spacing: .3px; }
|
|
.nav a { display: flex; align-items: center; gap: 4px; padding: 13px 15px; color: #e7e7e7;
|
|
text-decoration: none; font-weight: bold; }
|
|
.nav a .chev { margin-left: auto; }
|
|
|
|
.topbar { margin-left: 230px; height: 52px; background: var(--topbar); border-bottom: 1px solid #d9dee4;
|
|
display: flex; align-items: center; justify-content: space-between; padding: 0 15px; }
|
|
.topbar .burger { color: #5a738e; width: 26px; height: 26px; }
|
|
.user { display: flex; align-items: center; gap: 10px; color: #515356; }
|
|
.user .avatar { width: 29px; height: 29px; border-width: 0; font-size: 11px; box-shadow: none; }
|
|
|
|
main { margin-left: 230px; padding: 10px 28px; }
|
|
.panel { background: #fff; border: 1px solid var(--panel-border); padding: 10px 17px 20px; }
|
|
.panel-title { display: flex; align-items: center; border-bottom: 2px solid var(--panel-border); padding: 4px 6px 12px; }
|
|
.panel-title h2 { margin: 0; font-size: 18px; font-weight: 400; }
|
|
.panel-title h2 small { font-size: 14px; margin-left: 10px; }
|
|
.panel-title .tools { margin-left: auto; color: #c5c7cb; }
|
|
|
|
/* Ajout : section Diagnostic, une ligne repliable par domaine (Energy, Storage, Cellular, Temperature). */
|
|
.diag { margin: 22px 22px 0; }
|
|
.diag > h3 { margin: 0 0 8px; font-size: 12px; font-weight: bold; letter-spacing: .4px; text-transform: uppercase; }
|
|
.diag-item { border: 1px solid var(--line); border-radius: 4px; }
|
|
.diag-item + .diag-item { margin-top: 8px; }
|
|
.diag-item > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px;
|
|
padding: 10px 14px; color: var(--text); font-size: 15px; }
|
|
.diag-item > summary::-webkit-details-marker { display: none; }
|
|
.status { padding: 2px 12px; border-radius: 999px; font-size: 13px; font-weight: bold; color: #fff; }
|
|
.status.GREEN { background: var(--green); } .status.ORANGE { background: var(--orange); color: #1a1a1a; }
|
|
.status.RED { background: var(--red); } .status.UNKNOWN { background: var(--unknown); }
|
|
.meta { color: var(--muted); font-size: 13px; }
|
|
.diag-item > summary .chev { margin-left: auto; width: 13px; height: 13px; transition: transform .15s; }
|
|
.diag-item[open] > summary .chev { transform: rotate(180deg); }
|
|
.diag-body { border-top: 1px solid var(--line); padding: 14px; }
|
|
.headline { margin: 0 0 12px; color: var(--text); font-size: 15px; }
|
|
.days { border-collapse: collapse; color: var(--text); }
|
|
.days th, .days td { padding: 5px 28px 5px 0; text-align: left; font-weight: normal; vertical-align: top; }
|
|
.days th { color: var(--muted); }
|
|
/* Échelle (batterie, espace libre, signal) : zones teintées, le trait marque la valeur du jour. */
|
|
.gauge { position: relative; display: flex; width: 320px; font-size: 10px; color: var(--muted); }
|
|
.gauge span { border-top: 10px solid; padding-top: 2px; text-align: center; white-space: nowrap; }
|
|
.gauge i { position: absolute; top: -3px; height: 16px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
|
|
.gauge-text { margin-top: 6px; }
|
|
/* Guide : partie 1 du manuel, rendue depuis le Markdown. */
|
|
.guide { max-width: 900px; margin-top: 6px; color: var(--text); }
|
|
.guide h3 { margin: 12px 0 6px; font-size: 16px; } .guide h4 { margin: 14px 0 6px; font-size: 14px; }
|
|
.guide h5 { margin: 10px 0 4px; font-size: 13px; }
|
|
.guide p, .guide ul { margin: 6px 0; }
|
|
.guide table { border-collapse: collapse; margin: 6px 0 10px; }
|
|
.guide th, .guide td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
|
|
.guide th { background: #f5f7fa; }
|
|
.sub { margin-top: 12px; }
|
|
.action { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
|
|
.action[hidden] { display: none; }
|
|
.action button { background: #2a78d6; color: #fff; border: 0; border-radius: 4px; padding: 7px 12px;
|
|
font: inherit; font-size: 14px; cursor: pointer; }
|
|
.sub > summary { cursor: pointer; color: var(--muted); }
|
|
.plot { margin-top: 10px; }
|
|
|
|
.collapse { margin: 22px 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
|
|
padding: 9px 0; display: flex; justify-content: space-between; color: var(--text); font-size: 15px; }
|
|
.collapse svg { width: 13px; height: 13px; }
|
|
#chart { margin: 10px 6px 0; height: 420px; }
|
|
.btn { margin: 18px 22px 0; display: inline-block; background: #6c757d; color: #fff; border-radius: 4px;
|
|
padding: 8px 13px; font-size: 15px; }
|
|
.metrics { margin: 0 22px; width: calc(100% - 44px); border-collapse: collapse; font-size: 15px; }
|
|
.metrics td { border: 1px solid var(--line); padding: 9px 8px; color: #212529; }
|
|
.metrics td:first-child { font-weight: bold; width: 39%; }
|
|
.metrics td:last-child { font-style: italic; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<svg style="display:none">
|
|
<symbol id="home" viewBox="0 0 20 20"><path d="M10 2 1 10h3v8h5v-5h2v5h5v-8h3z"/></symbol>
|
|
<symbol id="list" viewBox="0 0 20 20"><path d="M1 3h3v3H1zm5 0h13v3H6zM1 8.5h3v3H1zm5 0h13v3H6zM1 14h3v3H1zm5 0h13v3H6z"/></symbol>
|
|
<symbol id="cog" viewBox="0 0 20 20"><circle cx="10" cy="10" r="6" fill="none" stroke="currentColor" stroke-width="4" stroke-dasharray="2.4 2.3"/><circle cx="10" cy="10" r="5" fill="none" stroke="currentColor" stroke-width="3"/></symbol>
|
|
<symbol id="chev" viewBox="0 0 20 20"><path d="M4 7l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2.2"/></symbol>
|
|
<symbol id="burger" viewBox="0 0 20 20"><path d="M2 4h16v2.4H2zm0 4.8h16v2.4H2zm0 4.8h16V16H2z"/></symbol>
|
|
<symbol id="wrench" viewBox="0 0 20 20"><path d="M13.5 1.5a5 5 0 0 0-4.6 6.9L2 15.3 4.7 18l6.9-6.9a5 5 0 0 0 6.9-4.6l-3 3-2.8-.6-.6-2.8z"/></symbol>
|
|
</svg>
|
|
|
|
<aside class="sidebar">
|
|
<div class="brand">AIMsight monitoring</div>
|
|
<div class="profile"><div class="avatar">MP</div><div><small>Welcome,</small><span>Maxime Pasquier</span></div></div>
|
|
<div class="section">GENERAL</div>
|
|
<nav class="nav">
|
|
<a><svg class="i"><use href="#home"/></svg>Home</a>
|
|
<a><svg class="i"><use href="#list"/></svg>Explore<svg class="i chev"><use href="#chev"/></svg></a>
|
|
<a><svg class="i"><use href="#cog"/></svg>Settings<svg class="i chev"><use href="#chev"/></svg></a>
|
|
</nav>
|
|
</aside>
|
|
|
|
<header class="topbar">
|
|
<svg class="burger"><use href="#burger"/></svg>
|
|
<div class="user"><div class="avatar">MP</div>Maxime Pasquier ▾</div>
|
|
</header>
|
|
|
|
<main>
|
|
<section class="panel">
|
|
<div class="panel-title">
|
|
<h2><!--STATION--><small>System Summary</small></h2>
|
|
<span class="tools"><svg class="i"><use href="#wrench"/></svg> ▾</span>
|
|
</div>
|
|
|
|
<section class="diag" id="diag">
|
|
<h3>Diagnostic</h3>
|
|
</section>
|
|
<!-- Un bloc par domaine, rempli par le script ci-dessous ; le bouton d'action ne sert qu'à Energy. -->
|
|
<template id="diag-item">
|
|
<details class="diag-item">
|
|
<summary>
|
|
<b class="name"></b>
|
|
<span class="status"></span>
|
|
<span class="meta"></span>
|
|
<svg class="i chev"><use href="#chev"/></svg>
|
|
</summary>
|
|
<div class="diag-body">
|
|
<p class="headline"></p>
|
|
<table class="days"></table>
|
|
<div class="action" hidden>
|
|
<button type="button">Activate energy save mode</button>
|
|
<span class="note meta">The station sleeps between measurements to use less energy.</span>
|
|
</div>
|
|
<details class="sub history">
|
|
<summary>Full history</summary>
|
|
<div class="plot"></div>
|
|
</details>
|
|
<details class="sub">
|
|
<summary>Guide</summary>
|
|
<div class="guide"></div>
|
|
</details>
|
|
</div>
|
|
</details>
|
|
</template>
|
|
|
|
<div class="collapse">BusVoltage <svg><use href="#chev"/></svg></div>
|
|
<div id="chart"></div>
|
|
|
|
<div class="btn">Download CSV</div>
|
|
<table class="metrics" id="table"></table>
|
|
</section>
|
|
</main>
|
|
|
|
<script>
|
|
const DATA = /*DATA*/null;
|
|
const R = DATA.rule;
|
|
const NAME = { GREEN: "Green", ORANGE: "Orange", RED: "Red" };
|
|
const ACTION = { GREEN: "Nothing to do", ORANGE: "Watch", RED: "Contact support" };
|
|
// Nom du bloc, et ce qu'il évalue (phrase d'un jour inconnu). Les phrases des couleurs viennent de src/<domaine>/day_color.py.
|
|
const DOMAIN = { energy: ["Energy", "energy"], storage: ["Storage", "storage space"], cellular: ["Cellular", "4G connection"],
|
|
temperature: ["Temperature", "temperature"] };
|
|
const TREND = { BETTER: "↗ Better than the day before", STABLE: "→ Same as the day before", WORSE: "↘ Worse than the day before" };
|
|
|
|
// Échelle : zones [borne haute en %, nom, teinte, ...], trait à pct %, texte dessous ; le survol donne la valeur mesurée.
|
|
const TINT = { bad: "#f1c0c0", low: "#f8dca8", ok: "#e4ebdc", good: "#bfe0bf" };
|
|
const scale = (zones, pct, text, title = "") =>
|
|
`<div class="gauge" role="img" aria-label="${text}" title="${title}">` +
|
|
zones.map(([hi, name, tint], i) =>
|
|
`<span style="width:${hi - (i ? zones[i - 1][0] : 0)}%;border-color:${TINT[tint]}">${name}</span>`).join("") +
|
|
`<i style="left:${pct}%"></i></div><div class="gauge-text">${text}</div>`;
|
|
|
|
// Energy. Échelle de batterie : niveau de fin de nuit (le meilleur repère du niveau,
|
|
// docs/energy/domaine/comment-se-comporte-la-batterie.md), placé en % par la table OCV LiFePO4 du collecteur
|
|
// (docs/aimsight/collecteur_system_info.py, LIFEPO4_OCV_SOC).
|
|
// ponytail: sans compensation IR (la nuit, ~0,14 V sous la tension à vide) : repère un peu bas ; compenser avec BusCurrent si besoin.
|
|
const OCV = [[10.0, 0], [12.0, 10], [12.5, 20], [12.8, 30], [12.9, 40], [13.0, 50], [13.1, 60], [13.2, 70], [13.3, 80],
|
|
[13.4, 90], [13.6, 100]];
|
|
const soc = x => {
|
|
for (let i = 1; i < OCV.length; i++) {
|
|
const [v0, p0] = OCV[i - 1], [v1, p1] = OCV[i];
|
|
if (x <= v1) return Math.max(0, p0 + (p1 - p0) * (x - v0) / (v1 - v0));
|
|
}
|
|
return 100;
|
|
};
|
|
// Zones, aux points de la table : 10 % = 12,0 V (la station s'éteint dessous), 30 % = coude 12,8 V, 90 % = 13,4 V.
|
|
// Pas de % affiché : sur le plateau (30-90 %), 0,1 V vaut ~10 % de charge, la tension n'en dit pas plus.
|
|
const ZONES = [[10, "Off", "bad", "nearly empty, the station may shut down"], [30, "Low", "low", "low (under 30 %)"],
|
|
[90, "OK", "ok", "between 30 and 90 %"], [100, "Full", "good", "full"]];
|
|
const recharge = d => d.max_v == null ? "" : d.max_v >= R.full_charge_v ? "fully recharged today"
|
|
: d.rise_v >= R.min_rise_v ? "partially recharged today" : "not recharged today";
|
|
function battery(d) {
|
|
if (d.night_end_v == null) return "Unknown";
|
|
const pct = soc(d.night_end_v), zone = ZONES.find(z => pct < z[0]) || ZONES[ZONES.length - 1];
|
|
return scale(ZONES, pct, `This morning: ${zone[3]} · ${recharge(d)}`, `night end ${d.night_end_v.toFixed(3)} V`);
|
|
}
|
|
|
|
// Storage. Échelle de l'espace libre en fin de jour, sur les planchers de DAILY_STORAGE_STATE (arbitraires, D-034).
|
|
function freeSpace(d) {
|
|
if (d.free_percent == null) return "Unknown";
|
|
const [ok, low] = R.storage_floors;
|
|
return scale([[low, "Critical", "bad"], [ok, "Low", "low"], [100, "OK", "good"]], d.free_percent,
|
|
`${Math.round(d.free_percent)} % free`, `${d.free_gb} GiB free of ${d.usable_gb} GiB usable`);
|
|
}
|
|
// Date de saturation au rythme des 7 derniers jours (DAYS_UNTIL_STORAGE_FULL) ; en mois au-delà de 60 jours (affichage).
|
|
const day = s => new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "short", year: "numeric", timeZone: "UTC" });
|
|
function full(d) {
|
|
if (d.filling == null) return "Unknown (not enough days measured yet)";
|
|
if (!d.filling) return "Not expected: the storage is not filling up";
|
|
const n = d.days_until_full;
|
|
return `Around ${day(d.full_date)} (about ${n < 60 ? `${Math.round(n)} days` : `${Math.round(n / 30)} months`})`;
|
|
}
|
|
|
|
// Cellular. Envois du jour (DAILY_LINK_STATE), en mots, sur les envois attendus (un toutes les 15 min).
|
|
function sends(d) {
|
|
if (d.state == null) return "Unknown (incomplete day)";
|
|
const missing = d.n_missing ? `${d.n_missing} of ${R.expected_sends} sends missing` : "";
|
|
if (d.state === "DOWN") return ["4G link reported down", missing].filter(Boolean).join(" · ");
|
|
if (d.state === "MISSING") return missing || "Some data missing";
|
|
return "All data received";
|
|
}
|
|
// Échelle du signal (DAILY_SIGNAL_STATE, grille publiée) : quatre classes de même largeur, trait au milieu de la classe du jour,
|
|
// sans dBm. La classe ne change pas la couleur du jour tant que le signal est mesuré (D-037).
|
|
const SIGNAL = [[25, "Cell edge", "low"], [50, "Mid cell", "ok"], [75, "Good", "ok"], [100, "Excellent", "good"]];
|
|
function signal(d) {
|
|
if (d.signal_state == null) return "Unknown (not measured for most of the day)";
|
|
const i = R.signal_classes.length - 1 - R.signal_classes.indexOf(d.signal_state); // CLASSES va du meilleur au pire
|
|
return scale(SIGNAL, 25 * i + 12.5, SIGNAL[i][1]);
|
|
}
|
|
|
|
// Temperature. Plus haute moyenne horaire du GPU sur 24 h (DAILY_GPU_TEMPERATURE_LIMIT) et limite du constructeur (D-040) ;
|
|
// un °C se comprend sans être spécialiste. Pas d'échelle : ses bornes d'affichage n'auraient pas de source.
|
|
const hottest = d => d.max_deg_c == null ? "Unknown (not measured in the last 24 hours)"
|
|
: `${Math.round(d.max_deg_c)} °C · limit ${R.gpu_limit_deg_c} °C`;
|
|
|
|
// Deux lignes par bloc (une pour Temperature), en mots simples (côté client : pas de tension brute, pas de mécanisme d'analyse).
|
|
const ROWS = {
|
|
energy: d => [["Battery", battery(d)], ["Trend", TREND[d.trend] || "Unknown"]],
|
|
storage: d => [["Free space", freeSpace(d)], ["Full", full(d)]],
|
|
cellular: d => [["Data sent", sends(d)], ["Signal", signal(d)]],
|
|
temperature: d => [["Hottest (24 h)", hottest(d)]],
|
|
};
|
|
const chip = c => `<span class="status ${c || "UNKNOWN"}">${NAME[c] || "Unknown"}</span>`;
|
|
function autoscale(plotId) {
|
|
/*AUTOSCALE*/
|
|
}
|
|
|
|
for (const [key, dom] of Object.entries(DATA.domains)) {
|
|
const cur = dom.cur || {}, c = cur.color, [name, what] = DOMAIN[key];
|
|
const el = document.getElementById("diag-item").content.firstElementChild.cloneNode(true);
|
|
el.id = key;
|
|
el.querySelector(".name").textContent = name;
|
|
el.querySelector(".status").outerHTML = chip(c);
|
|
el.querySelector(".meta").textContent = `${DATA.label} · ${ACTION[c] || "Check data"}`;
|
|
el.querySelector(".headline").textContent = dom.headline[c] || `Not enough data to assess the station's ${what}.`;
|
|
el.querySelector(".days").innerHTML = ROWS[key](cur).map(([k, x]) => `<tr><th>${k}</th><td>${x}</td></tr>`).join("");
|
|
el.querySelector(".guide").innerHTML = marked.parse(dom.guide); // texte du projet, pas une saisie
|
|
// Energy, jours Orange et Red : remède proposé au client, veille profonde entre les mesures
|
|
// (docs/energy/domaine/comment-se-comporte-la-batterie.md). Action de la plateforme, pas du diagnostic (lecture seule).
|
|
// Maquette : le bouton n'envoie rien. Storage, Cellular et Temperature n'ont pas de remède connu : pas de bouton.
|
|
const action = el.querySelector(".action");
|
|
action.hidden = key !== "energy" || !["ORANGE", "RED"].includes(c);
|
|
action.querySelector("button").onclick = () =>
|
|
action.querySelector(".note").textContent = "Mockup: no command is sent to the station.";
|
|
// L'historique complet n'est tracé qu'à la première ouverture (un graphique caché n'a pas de largeur).
|
|
const plot = el.querySelector(".plot");
|
|
plot.id = `plot-${key}`;
|
|
el.querySelector(".history").addEventListener("toggle", e => {
|
|
if (!e.target.open || e.target.dataset.drawn) return;
|
|
e.target.dataset.drawn = "1";
|
|
Plotly.newPlot(plot, dom.figure.data, dom.figure.layout, { responsive: true, scrollZoom: true })
|
|
.then(() => autoscale(plot.id));
|
|
});
|
|
document.getElementById("diag").append(el);
|
|
}
|
|
|
|
document.getElementById("table").innerHTML =
|
|
DATA.table.map(([k, x]) => `<tr><td>${k}</td><td>${x}</td></tr>`).join("");
|
|
|
|
const lo = DATA.daily.map(p => p.lo), hi = DATA.daily.map(p => p.hi);
|
|
const extremes = (pts, name, fill, line, pos) => ({
|
|
x: pts.map(p => p[0]), y: pts.map(p => p[1]), name, mode: "markers+text", type: "scatter",
|
|
text: pts.map(p => p[1].toFixed(3)), textposition: pos, textfont: { size: 11, color: "#2a3f54" },
|
|
marker: { size: 8, color: fill, line: { color: line, width: 1.5 } }, hoverinfo: "x+y",
|
|
});
|
|
Plotly.newPlot("chart", [
|
|
{ x: DATA.hours.map(h => h[0]), y: DATA.hours.map(h => h[1]), name: "Battery Voltage", mode: "lines",
|
|
type: "scatter", line: { color: "#636efa", width: 2 }, connectgaps: false },
|
|
extremes(lo, "lowest daily value", "#a9b0fb", "#636efa", "bottom center"),
|
|
extremes(hi, "highest daily value", "#1bb38a", "#0b6e55", "top center"),
|
|
], {
|
|
margin: { l: 70, r: 10, t: 10, b: 40 }, paper_bgcolor: "#fff", plot_bgcolor: "#e5ecf6",
|
|
font: { family: "Helvetica Neue, Roboto, Arial, sans-serif", size: 12, color: "#2a3f54" },
|
|
xaxis: { type: "date", range: DATA.range, gridcolor: "#fff" },
|
|
yaxis: { gridcolor: "#fff", zeroline: false },
|
|
legend: { x: 1.02, y: 1, yanchor: "top" },
|
|
}, { displayModeBar: false, responsive: true });
|
|
</script>
|
|
</body>
|
|
</html>
|