Add DAILY_MAINS_POWER: on mains, a mains loss turns the day red at once
A station is on mains when its BusVoltage mean over the 3 days before the day is >= 14.0 V (solar never exceeds 13.50 V on VERMONT; mains stays >= 14.08 V). On mains, the mains loss decides the day color instead of the state x trend matrix: red as soon as an hour falls under 13.4 V (top of the OCV plateau; mains-on hours stay >= 13.65 V, mains-off hours are 13.1-13.3 V). On MISSISSIPPI the day turns red 1-2 h after the loss instead of 29-40 h with the matrix; WEISSHORN and NORDEND (mains) raise no false alert, VERMONT (solar) is unchanged (D-043). The matrix drawio gets the mains case, the site figure a third panel, and the support notification and the client Energy block header show "On mains" / "Not on mains" / "Mains unknown". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28ed86baba
commit
9177982de1
18 files changed
+359
-43
No files matched your search
@@ -12,7 +12,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # src/ : paquets c
|
||||
from common.page import ROOT, open_html # noqa: E402 (bascule seule sur .venv si plotly manque)
|
||||
from common.stations import gaps, load_stations # noqa: E402
|
||||
import plotly.graph_objects as go # noqa: E402
|
||||
from energy import battery_state as bs, battery_trend as bt, day_color as dc # noqa: E402
|
||||
from energy import battery_state as bs, battery_trend as bt, day_color as dc, mains_power as mp # noqa: E402
|
||||
from energy.final import STATE_STYLE, TREND_STYLE, noon # noqa: E402
|
||||
|
||||
# Statuts : noms et couleurs de la maquette System Summary (maquettes/user/summary_template.html).
|
||||
@@ -37,8 +37,13 @@ def parse_day(arg, series):
|
||||
def summary(station, f):
|
||||
"""Résumé texte traçable : couleur, règle, faits de J−1 et de J, tendance et ce qui l'a décidée."""
|
||||
d, prev, cur = f["day"], f["prev"], f["cur"]
|
||||
lines = [f"{station}, {d:%d/%m/%Y}: {COLOR[f['color']][0]}",
|
||||
f" rule: matrix state × trend (user manual § 7): {cur['state']} × {cur['trend']} → {f['color'] or 'unknown'}"]
|
||||
lines = [f"{station}, {d:%d/%m/%Y}: {COLOR[f['color']][0]}"]
|
||||
if cur["power"] == "MAINS": # sur secteur, la perte du secteur décide (fiche daily_mains_power)
|
||||
lines.append(f" rule: on mains (3-day mean {cur['mean_3_days_v']} V ≥ {mp.MAINS_MEAN_V} V):"
|
||||
f" {cur['hours_lost']} h < {mp.MAINS_LOST_V} V → {f['color'] or 'unknown'}")
|
||||
else:
|
||||
lines.append(f" rule: {dc.POWER_LABEL[cur['power']].lower()}, matrix state × trend (user manual § 7):"
|
||||
f" {cur['state']} × {cur['trend']} → {f['color'] or 'unknown'}")
|
||||
for tag, x, facts in (("D-1", d - timedelta(days=1), prev), ("D ", d, cur)):
|
||||
if not facts or facts.get("max_v") is None:
|
||||
lines.append(f" {tag} {x:%d/%m}: no measurement")
|
||||
@@ -113,7 +118,8 @@ def figure(station, f):
|
||||
ys = [v for v in h.values() if v is not None] + [bs.FULL_CHARGE_V, bs.PLATEAU_FLOOR_V] # seuils toujours visibles
|
||||
fig.update_yaxes(title_text="BusVoltage [V]", range=[min(ys) - 0.15, max(ys) + 0.15])
|
||||
fig.update_layout(title=f"{station}, {d:%d %b %Y}: <span style='color:{color}'>■ {name}</span>"
|
||||
f" · {f['cur']['state']} × {trend or 'unknown trend'}"
|
||||
+ (" · on mains, lost" if f["cur"]["hours_lost"] else " · on mains" if f["cur"]["power"] == "MAINS"
|
||||
else f" · {f['cur']['state']} × {trend or 'unknown trend'}")
|
||||
+ (" · provisional (day not over)" if provisional(f) else "")
|
||||
+ "<br><sup>gray band: no measurement · dashed: thresholds of the daily state"
|
||||
" · arrow: night end D-1 → D (trend)</sup>",
|
||||
|
||||
Reference in new issue
Block a user