Add the temperature domain on the GPU manufacturer limit
DAILY_GPU_TEMPERATURE_LIMIT: red when an hourly GPU mean reached 97.5 °C (T.gpu, Jetson Nano Thermal Design Guide) in the last 24 hours, green otherwise, gray without measurement. Working sets WEISSHORN and NORDEND; all measured days are green. D-040 replaces D-036; the exploration note moves to docs/temperature/domaine/point-de-depart.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0990c16e6
commit
276c34ea38
12 files changed
+256
-19
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,71 @@
|
||||
"""L'analyse Temperature, pour la vérifier (D-016) : le panneau DAILY_GPU_TEMPERATURE_LIMIT, puis la série du GPU.
|
||||
|
||||
Usage : python3 src/temperature/all_analyses.py [CSV ou dossiers...] (défaut : data/WEISSHORN/ et data/NORDEND/)
|
||||
Écrit out/<STATION>_temperature.html et l'ouvre. Documentation : docs/temperature/analyses/daily_gpu_temperature_limit.md
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # src/ : paquets common, energy et temperature
|
||||
from common.page import AUTOSCALE_Y_JS, ROOT, open_html # noqa: E402 (bascule seule sur .venv si plotly manque)
|
||||
from common.stations import gaps, load_stations # noqa: E402
|
||||
from plotly.subplots import make_subplots # noqa: E402
|
||||
from energy.final import noon # noqa: E402 (points journaliers à midi UTC, D-019)
|
||||
from temperature import day_color as dc, gpu_temperature_limit as gl # noqa: E402
|
||||
|
||||
METRIC = "sensor_GPU_deg_c"
|
||||
STYLE = {"GREEN": ("#008300", "circle"), "RED": ("#d03b3b", "x"), None: ("#8c8c8c", "circle-open")} # couleurs d'Energy
|
||||
|
||||
|
||||
def figure(station, series):
|
||||
title = f"Analysis {gl.RULE['id']}"
|
||||
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.08, subplot_titles=[title, METRIC])
|
||||
group = dict(legendgroup=gl.RULE["id"], legendgrouptitle_text=title)
|
||||
pts = dc.run(series)["points"]
|
||||
x = [noon(p["t"].date()) for p in pts]
|
||||
fig.add_scatter(x=x, y=[p["facts"].get("max_deg_c") for p in pts], name="max of the last 24 h", mode="lines",
|
||||
line=dict(color="#52514e", width=1.5), hoverinfo="skip", row=1, col=1, **group)
|
||||
# Limite tracée comme une courbe (un point par jour) : AUTOSCALE_Y_JS la garde visible au zoom (D-013).
|
||||
fig.add_scatter(x=x, y=[gl.GPU_LIMIT_DEG_C] * len(x), name=f"limit {gl.GPU_LIMIT_DEG_C} °C", mode="lines",
|
||||
hoverinfo="skip", line=dict(color=STYLE["RED"][0], dash="dash", width=1), row=1, col=1, **group)
|
||||
for color, (c, symbol) in STYLE.items():
|
||||
sel = [p for p in pts if p["facts"]["color"] == color]
|
||||
if sel:
|
||||
fig.add_scatter(x=[noon(p["t"].date()) for p in sel], y=[p["facts"].get("max_deg_c", 0) for p in sel],
|
||||
name=color or "unknown", mode="markers", hovertemplate="%{text}<extra></extra>",
|
||||
text=[f"{p['t']:%Y-%m-%d}<br>" + "<br>".join(f"{k}={v}" for k, v in p["facts"].items())
|
||||
for p in sel],
|
||||
marker=dict(color=c, symbol=symbol, size=9, line=dict(color="white", width=1)),
|
||||
row=1, col=1, **group)
|
||||
|
||||
s = series[METRIC]
|
||||
fig.add_scatter(x=sorted(s), y=[s[t] for t in sorted(s)], name=METRIC, line=dict(width=1), row=2, col=1,
|
||||
legendgroup="mesures", legendgrouptitle_text="Mesures")
|
||||
for a, b in gaps(s):
|
||||
fig.add_vrect(x0=a, x1=b, fillcolor="gray", opacity=0.3, line_width=0, row=2, col=1)
|
||||
fig.update_yaxes(title_text="°C")
|
||||
fig.update_xaxes(showticklabels=True) # dates sous chaque graphique, pas seulement le dernier
|
||||
fig.update_yaxes(fixedrange=True) # zoom horizontal seulement : l'ordonnée est recalée par AUTOSCALE_Y_JS
|
||||
fig.update_layout(title=f"{station} : analysis {gl.RULE['id']}", height=700, legend=dict(groupclick="toggleitem"))
|
||||
return fig
|
||||
|
||||
|
||||
def main(paths):
|
||||
"""Pour chaque station qui a la température du GPU : out/<STATION>_temperature.html. -> chemins écrits."""
|
||||
(ROOT / "out").mkdir(exist_ok=True)
|
||||
written = []
|
||||
for station, series in sorted(load_stations(paths).items()):
|
||||
if METRIC not in series:
|
||||
print(f"{station} : ignorée, pas de {METRIC}")
|
||||
continue
|
||||
path = ROOT / "out" / f"{station}_temperature.html"
|
||||
figure(station, series).write_html(
|
||||
path, include_plotlyjs="cdn", post_script=AUTOSCALE_Y_JS, config={"scrollZoom": True})
|
||||
print(path)
|
||||
written.append(path)
|
||||
return written
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for p in main(sys.argv[1:] or [str(ROOT / "data" / d) for d in ("WEISSHORN", "NORDEND")]):
|
||||
open_html(p)
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Couleur du jour Temperature : DAILY_GPU_TEMPERATURE_LIMIT seule -> rouge si le GPU a atteint sa limite dans les 24 h (D-040).
|
||||
|
||||
Documentation : docs/temperature/analyses/daily_gpu_temperature_limit.md, docs/decisions.md (D-040)
|
||||
Bibliothèque standard uniquement (cible : système embarqué de la station).
|
||||
"""
|
||||
from temperature import gpu_temperature_limit as gl
|
||||
|
||||
# Une seule analyse, une seule limite sourcée : pas de matrice ni d'orange (D-040).
|
||||
COLOR = {True: "RED", False: "GREEN", None: None}
|
||||
|
||||
# Une phrase par couleur, en anglais (D-023) ; Green ne notifie rien (D-025), sa phrase ne sert qu'à la vue client.
|
||||
HEADLINE = {"GREEN": "The station's temperature is within the manufacturer's limit.",
|
||||
"RED": "The station overheated in the last 24 hours."}
|
||||
|
||||
RULE = {
|
||||
"id": "DAY_COLOR",
|
||||
"verdict": "aucun : anomaly = None ; la couleur est dans facts.color (None = inconnu)",
|
||||
"color": COLOR,
|
||||
"doc": "docs/decisions.md (D-040)",
|
||||
}
|
||||
|
||||
|
||||
def run(series):
|
||||
"""Couleur du jour, causale comme l'analyse. Un point par jour UTC."""
|
||||
points = []
|
||||
for p in gl.run(series)["points"]:
|
||||
facts = {**p["facts"], "color": COLOR[p["anomaly"]]}
|
||||
points.append({"t": p["t"], "value": facts["color"], "anomaly": None, "facts": facts})
|
||||
return {"analysis": RULE["id"], "rule": RULE, "points": points}
|
||||
@@ -0,0 +1,39 @@
|
||||
"""DAILY_GPU_TEMPERATURE_LIMIT : le GPU a-t-il atteint sa température maximale de fonctionnement dans les 24 dernières heures ?
|
||||
|
||||
Documentation : docs/temperature/analyses/daily_gpu_temperature_limit.md
|
||||
Bibliothèque standard uniquement (cible : système embarqué de la station).
|
||||
"""
|
||||
import math
|
||||
from datetime import timedelta
|
||||
|
||||
# Constantes (fiche daily_gpu_temperature_limit, « Constantes et sources »).
|
||||
# T.gpu, limite du constructeur : NVIDIA, Jetson Nano Thermal Design Guide, table 2-1 et § 4.3 (Tegra X1), citée et
|
||||
# confirmée sur le forum NVIDIA. Jetson Nano : hypothèse tirée des zones lues par le collecteur, à confirmer sur une station.
|
||||
GPU_LIMIT_DEG_C = 97.5
|
||||
WINDOW = timedelta(hours=24) # demande de l'utilisateur (2026-10-13) : un dépassement reste visible un jour
|
||||
|
||||
RULE = {
|
||||
"id": "DAILY_GPU_TEMPERATURE_LIMIT",
|
||||
"anomaly": "True : une moyenne horaire du GPU >= la limite dans les 24 h ; None : aucune mesure dans les 24 h",
|
||||
"gpu_limit_deg_c": GPU_LIMIT_DEG_C,
|
||||
"doc": "docs/temperature/analyses/daily_gpu_temperature_limit.md",
|
||||
}
|
||||
|
||||
|
||||
def run(series):
|
||||
"""Analyse causale : un point par jour UTC, sur les 24 h qui finissent à la dernière heure du jour présente dans la série
|
||||
(la journée entière pour un jour fini, les 24 dernières heures pour le jour en cours)."""
|
||||
gpu = series["sensor_GPU_deg_c"]
|
||||
last = {}
|
||||
for t in sorted(gpu):
|
||||
last[t.date()] = t
|
||||
points = []
|
||||
for t in last.values():
|
||||
window = {u: x for u, x in gpu.items() if t - WINDOW < u <= t and x is not None and math.isfinite(x)}
|
||||
if not window: # UNKNOWN : aucune mesure dans les 24 h
|
||||
points.append({"t": t, "value": None, "anomaly": None, "facts": {"hours_measured": 0}})
|
||||
continue
|
||||
hottest = max(window, key=window.get)
|
||||
facts = {"max_deg_c": window[hottest], "max_at": hottest.isoformat(), "hours_measured": len(window)}
|
||||
points.append({"t": t, "value": window[hottest], "anomaly": window[hottest] >= GPU_LIMIT_DEG_C, "facts": facts})
|
||||
return {"analysis": RULE["id"], "rule": RULE, "points": points}
|
||||
Reference in new issue
Block a user