iobroker.nexowatt-ui 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/STABLE_1_0_4_RELEASE_DE.md +92 -0
- package/docs/STABLE_1_0_5_RELEASE_DE.md +101 -0
- package/ems/modules/charging-management.js +184 -21
- package/ems/modules/storage-control.js +119 -24
- package/ems/services/pv-surplus-allocation.js +54 -2
- package/io-package.json +11 -11
- package/lib/ts-mirrors/ems/charging-management/charging-phase-selection.js +16 -4
- package/package.json +11 -4
- package/scripts/verify-rc60-universal-auto-wallbox.js +839 -0
- package/scripts/verify-stable-1.0.3-home-appcenter-access.cjs +8 -1
- package/scripts/verify-stable-1.0.4-auto-pv-phases.cjs +238 -0
- package/scripts/verify-stable-1.0.5-storage-protection-telemetry.cjs +284 -0
- package/scripts/verify-stable-release.cjs +19 -2
- package/www/manifest.webmanifest +2 -2
- package/www/settings.html +1 -1
- package/www/sw.js +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
NexoWatt EOS is the local platform for energy, charging and building control, including the responsive customer cockpit and installer workspace.
|
|
4
4
|
|
|
5
|
-
**Current stable release:** `1.0.
|
|
5
|
+
**Current stable release:** `1.0.5` (2026-09-12)
|
|
6
6
|
|
|
7
7
|
It provides live energy-flow visualization, historical analysis, SmartHome visualization, installer-controlled EMS applications, and selected customer controls for desktop, tablet, and smartphone use.
|
|
8
8
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# NexoWatt EOS 1.0.4 – offizielle Stable-Version
|
|
2
|
+
|
|
3
|
+
**Datum:** 2026-09-11
|
|
4
|
+
**Basis:** vollständiges Repository 1.0.3
|
|
5
|
+
|
|
6
|
+
## Verhalten
|
|
7
|
+
|
|
8
|
+
Die Kundenpriorität verteilt den physisch vorhandenen PV-Anteil zwischen Ladepunkten
|
|
9
|
+
und Speicher. Sie erzeugt weder zusätzliche PV-Leistung noch eine Netzladefreigabe.
|
|
10
|
+
Im PV-geführten Auto-Untermodus bleiben Start-/Stop-Hysterese, technische
|
|
11
|
+
Mindestleistung, gewählte Phasenart und alle Netz-/Stationsgrenzen verbindlich.
|
|
12
|
+
Unterhalb der fahrbaren Startleistung wird kein teilweiser Startanteil reserviert.
|
|
13
|
+
Der Speicher darf den kompletten ungenutzten Überschuss im Rahmen seiner Grenzen laden.
|
|
14
|
+
|
|
15
|
+
Ist im Automatikmodus Netzladen ausdrücklich freigegeben, bleibt der reguläre
|
|
16
|
+
Ladesollwert erhalten. Nur der nach anderen PV-/Min+PV-Ladepunkten noch verfügbare
|
|
17
|
+
PV-Anteil wird für den tatsächlich freigegebenen Auto-Ladebedarf reserviert.
|
|
18
|
+
Ein wartendes Fahrzeug ohne freigegebenen Sollwert blockiert keinen Auto-PV-Anteil.
|
|
19
|
+
Die Summe aller Reservierungen bleibt innerhalb des physischen PV-Budgets;
|
|
20
|
+
reines PV-Laden und Auto teilen dieselbe kundenseitige Obergrenze. Min+PV behält
|
|
21
|
+
seine netzgestützte technische Basis und den physischen PV-Zusatzanteil.
|
|
22
|
+
|
|
23
|
+
## Phasen und Übergabe
|
|
24
|
+
|
|
25
|
+
Die Runtime hat bisher individuelle Umschaltschwellen, Wartezeiten, Herstellerwerte
|
|
26
|
+
und laufende Phasen-Timer beim Aufruf der finalen TS-Phasenentscheidung verloren.
|
|
27
|
+
Diese Daten werden jetzt durchgängig weitergereicht. Fest 1p / fest 3p bleibt fest;
|
|
28
|
+
Auto 1p/3p benötigt einen passenden Schreibpfad. Während Stop/Umschaltung/Settle
|
|
29
|
+
bleiben Startreservierungen gesperrt. Bereits real fließende Leistung wird nicht
|
|
30
|
+
vorzeitig als frei angenommen. Nach Settle darf auf den aktuellen Phasen geladen
|
|
31
|
+
werden; der Cooldown verhindert nur einen weiteren Phasenwechsel.
|
|
32
|
+
|
|
33
|
+
Beim Hochschalten muss mindestens das konfigurierte 3p-Stromminimum verfügbar sein.
|
|
34
|
+
Die Strom-/Leistungsquantisierung und die gewählte aktuelle Phasenzahl werden im
|
|
35
|
+
bestehenden finalen Allocation- und Write-Plan geprüft. Ein Maximalwert unterhalb
|
|
36
|
+
der technischen Mindestleistung darf kein künstlich verkleinertes Startminimum ergeben.
|
|
37
|
+
|
|
38
|
+
Die PV-Rekonstruktion berücksichtigt auch laufende Speicherladung. Deshalb wird
|
|
39
|
+
PV-Potential nicht unsichtbar, nur weil der Speicher es vor einem EV-Start aufnimmt.
|
|
40
|
+
Frische Auto-Istleistung wird einbezogen, Netzbezug und Speicherentladung werden
|
|
41
|
+
weiterhin abgezogen. Sollwerte werden nicht als erzeugte PV-Leistung addiert.
|
|
42
|
+
|
|
43
|
+
## Diagnose
|
|
44
|
+
|
|
45
|
+
- chargingManagement.control.pvPriorityIncludesAuto
|
|
46
|
+
- chargingManagement.control.pvAutoPriorityReservedW
|
|
47
|
+
- chargingManagement.control.pvEvcsAutoPriorityMeasuredW
|
|
48
|
+
- chargingManagement.control.pvAutoPriorityJson
|
|
49
|
+
- vorhandene phaseSelectionJson / Phasenstatus / pvStartReservationW je Ladepunkt
|
|
50
|
+
|
|
51
|
+
Der alte DP pvPriorityPurePvOnly bleibt aus Kompatibilitätsgründen erhalten und ist false.
|
|
52
|
+
Keine zusätzliche unbeschränkte Historie, kein neuer schneller Poller, keine neuen
|
|
53
|
+
Produktionsabhängigkeiten. Die vorhandene begrenzte Diagnose-Publikation wird verwendet.
|
|
54
|
+
|
|
55
|
+
## Prüfumfang und Grenzen
|
|
56
|
+
|
|
57
|
+
Die Regression umfasst vollständige Regelticks mit echtem TS-Abschlussplan und
|
|
58
|
+
Executor gegen simulierte Datenpunkte, zusätzlich reine Budget-/Phasen-Pipeline-Tests.
|
|
59
|
+
Sie prüft Auto mit und ohne Netzfreigabe, feste 1p/3p, höhere Mindestströme, DC-
|
|
60
|
+
Mindestleistung, geteiltes PV-Budget, Leerlauf/Offline, Phasenwechsel und Settle.
|
|
61
|
+
Es wurde keine reale Wallbox oder reale Anlage angesteuert.
|
|
62
|
+
|
|
63
|
+
Auf der Kundenanlage müssen vor uneingeschränktem Betrieb Herstellerfreigabe für
|
|
64
|
+
Phasenwechsel, tatsächliche Phasenrückmeldung bzw. unterstützter Gerätevertrag,
|
|
65
|
+
Startgrenzen, Umschaltpause und Speicherübergabe kontrolliert überprüft werden.
|
|
66
|
+
Die Releasebezeichnung ist keine Zertifizierung und keine Aussage über einen
|
|
67
|
+
nicht durchgeführten Hardware-Dauertest.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Ausgeführte Softwareprüfungen (11.09.2026)
|
|
71
|
+
|
|
72
|
+
- Node.js 22.16.0; TypeScript 5.8.3 (lokal vorhandenes Build-Werkzeug).
|
|
73
|
+
- Vollständiger `npm run build:ts`: erfolgreich, einschließlich 120 produktiver
|
|
74
|
+
Runtime-Dateien, 483 Runtime-Spiegel und TypeScript-Deklarationsbuild.
|
|
75
|
+
- Vollständiger `npm run test:all`: erfolgreich, einschließlich Browser-Regression
|
|
76
|
+
für den Home-AppCenter und der bestehenden Status-/Speicher-/Sicherheitsprüfungen.
|
|
77
|
+
- Neue Auto-/Phasen-Regression: 37 Szenariogruppen, einschließlich echter
|
|
78
|
+
Regeltick-/Executor-Codepfade mit simulierten Datenpunkten.
|
|
79
|
+
- Zusätzliche PV-Prioritäts-, zentrale Budget-, Speicherrest-, Min+PV- und
|
|
80
|
+
TS-Phasen-Regressionsprüfungen: erfolgreich.
|
|
81
|
+
- `publish:check`, `verify-publish.js`, Runtime-Start-Smoke und Stable-Release-Gate:
|
|
82
|
+
erfolgreich. Runtime-Start-Smoke prüft Syntax, lokale Imports und eine mit
|
|
83
|
+
Test-Doubles konstruierbare Startkette, keinen gestarteten Kunden-ioBroker.
|
|
84
|
+
- Paketdateien: 323 versiegelte Einträge; npm-Pakettrockenlauf: 324 Einträge.
|
|
85
|
+
|
|
86
|
+
Eine neue Online-Installation über `npm ci` konnte wegen DNS-/Registry-Zugriffsfehlern
|
|
87
|
+
(`EAI_AGAIN`) in der Prüfumgebung nicht abgeschlossen werden. Daher wurden die
|
|
88
|
+
Build-/Testwerkzeuge aus lokal vorhandenen Installationen verwendet. Produktions-
|
|
89
|
+
und Entwicklungsabhängigkeiten sind gegenüber 1.0.3 unverändert. Eine erfolgreiche
|
|
90
|
+
frische Abhängigkeitsinstallation oder ein Live-Hardware-Test wird nicht behauptet.
|
|
91
|
+
Die Versionsverfügbarkeit in npm ist vor Veröffentlichung separat zu prüfen; der
|
|
92
|
+
bestehende `prepublishOnly`-Guard führt diese Prüfung aus.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# NexoWatt EOS 1.0.5 – offizielle Stable-Version
|
|
2
|
+
|
|
3
|
+
**Datum:** 2026-09-12
|
|
4
|
+
**Basis:** vollständige Repository-ZIP 1.0.4
|
|
5
|
+
|
|
6
|
+
## Gezielte Korrektur
|
|
7
|
+
|
|
8
|
+
Die Kundenwahl „Speicher schützen“ ist von der Messwertqualität getrennt. In Auto,
|
|
9
|
+
Boost und Min+PV wird eine unbekannte Fahrzeuglast nicht mehr als 0 W und damit als
|
|
10
|
+
Freigabe der Speicherentladung behandelt. Alte Wattwerte werden nicht als aktuelle
|
|
11
|
+
Messwerte fortgeschrieben; Sollwerte ersetzen keine gemessene Fahrzeugleistung.
|
|
12
|
+
|
|
13
|
+
Bei unbekannter geschützter Fahrzeuglast pausiert die gesamte Speicherentladung.
|
|
14
|
+
Der NVP allein erlaubt keine verlässliche Trennung von Hauslast und Fahrzeuglast.
|
|
15
|
+
Daher kann während dieser Störung auch der Hausverbrauch vorübergehend Netzbezug
|
|
16
|
+
verursachen. Das ist der beabsichtigte konservative Fehlerfall, keine Änderung der
|
|
17
|
+
Normalregelung. Echter Gesamtüberschuss nach Haus und Fahrzeug darf weiterhin in
|
|
18
|
+
den Speicher geladen werden. Speicherentladung wird nicht als PV interpretiert.
|
|
19
|
+
|
|
20
|
+
Nach Rückkehr gültiger Telemetrie ist ohne manuellen Reset wieder der bisherige
|
|
21
|
+
Hauslastausgleich aktiv. Frisch bestätigter Stillstand/Standby blockiert ihn nicht.
|
|
22
|
+
Ein Wechsel auf „Mitnutzen“ oder reines PV-Laden wird bei der nächsten vollständigen
|
|
23
|
+
Policy-Auswertung berücksichtigt; reines PV aktiviert weiterhin keinen Speicherschutz.
|
|
24
|
+
Die AppCenter-Bedienfreigabe bleibt eine Bedienfreigabe, keine neue Installateursperre.
|
|
25
|
+
|
|
26
|
+
## Verteilung und Schutzpfade
|
|
27
|
+
|
|
28
|
+
Auto-PV-Priorität, Gebäudeverbrauch, Wallbox-Startminimum, Phasenwahl/-umschaltung,
|
|
29
|
+
Umschaltpausen, Tarif-/Ladezielfreigaben und bestehende Netz-/Stations-/§14a-Grenzen
|
|
30
|
+
bleiben unverändert. Im Normalbetrieb wird nur der frische geschützte Fahrzeuganteil
|
|
31
|
+
aus der zulässigen Speicherentladung entfernt. Unterhalb des technisch zulässigen
|
|
32
|
+
PV-Ladestarts bleibt ungenutzter Überschuss für den Speicher verfügbar.
|
|
33
|
+
|
|
34
|
+
Die Korrektur sitzt in der gemeinsamen EVCS-Speicher-Policy und der vorhandenen
|
|
35
|
+
asymmetrischen Speicherschranke vor den Ausgangspfaden. Die bestehenden Protokoll-Writer bleiben erhalten. Für E3/DC RSCP wird ein
|
|
36
|
+
0-W-Stopp wegen unbekannter geschützter Fahrzeuglast ausdrücklich mit dem bereits
|
|
37
|
+
vorhandenen IDLE-Modus gesendet: NORMAL würde die lokale Eigenverbrauchsregelung
|
|
38
|
+
wieder freigeben. Diese Auswahl gilt nur für den betreffenden Störfallbefehl; die
|
|
39
|
+
gespeicherte Einstellung `e3dcZeroMode` und alle normalen Schreibpfade bleiben erhalten. Ein notwendiger Stopp
|
|
40
|
+
läuft über die vorhandene Zero-Write-Firewall und darf dort nicht gehalten werden.
|
|
41
|
+
|
|
42
|
+
## Snapshot und Diagnose
|
|
43
|
+
|
|
44
|
+
Ein begrenzter JSON-Snapshot enthält Freigabeabsicht, aktuelle Wattwerte, Anzahl
|
|
45
|
+
unbekannter geschützter Ladepunkte und einen Zeitstempel. Er wird im bestehenden
|
|
46
|
+
Regeltakt veröffentlicht, ohne zusätzlichen Timer oder unbeschränkte Historie.
|
|
47
|
+
Bei unvollständigem Tick, abgelaufenem Snapshot oder Wiederanlauf werden alte Wattwerte
|
|
48
|
+
verworfen, eine bekannte Schutzanforderung aber konservativ beibehalten. Der nächste
|
|
49
|
+
vollständige gültige Snapshot ersetzt sie, einschließlich bewusster Modusänderungen.
|
|
50
|
+
|
|
51
|
+
Neue beziehungsweise ergänzte Diagnosewerte:
|
|
52
|
+
|
|
53
|
+
- `chargingManagement.control.storagePolicyJson`
|
|
54
|
+
- `chargingManagement.control.storageProtectionRequestedWallboxes`
|
|
55
|
+
- `chargingManagement.control.storageProtectedUnknownWallboxes`
|
|
56
|
+
- `chargingManagement.wallboxes.<Ladepunkt>.storagePolicyLoadUnknown`
|
|
57
|
+
- `speicher.regelung.evcsSpeicherSchutzLastUnbekannt`
|
|
58
|
+
- `speicher.regelung.evcsSpeicherSchutzUnbekannteWallboxen`
|
|
59
|
+
- vorhandene `evcsSpeicherSchutzAktion` / `evcsSpeicherSchutzJson`
|
|
60
|
+
|
|
61
|
+
## Prüfgrenzen und Inbetriebnahme
|
|
62
|
+
|
|
63
|
+
Die automatisierten Tests verwenden simulierte ioBroker-Zustände und Schreibziele,
|
|
64
|
+
keine reale Kundenanlage. Vor Kundenfreigabe sind Schützen/Mitnutzen, ein kontrollierter
|
|
65
|
+
Telemetrieausfall mit laufender Ladung, Wiederkehr gültiger Werte sowie PV-Übergabe
|
|
66
|
+
an Fahrzeug und Speicher zu prüfen. Ein defekter oder unerreichbarer Speicherwriter
|
|
67
|
+
kann physische Vorgaben nicht garantieren; vorhandene Geräteschutz-/Watchdogkonzepte
|
|
68
|
+
bleiben erforderlich. Die Releasebezeichnung ist keine Hardware-Zertifizierung.
|
|
69
|
+
|
|
70
|
+
Eine frische Online-Abhängigkeitsinstallation (`npm ci`) scheiterte in der Prüfumgebung
|
|
71
|
+
an Registry-/DNS-Fehlern (`EAI_AGAIN`). Build/Tests verwenden lokal vorhandene Werkzeuge:
|
|
72
|
+
Node.js 22.16.0, TypeScript 5.8.3, Node-Typen 22.19.7. Der Lockfile verlangt Node-Typen
|
|
73
|
+
22.19.21; eine frische Installation genau dieser Entwicklungsabhängigkeiten wird daher
|
|
74
|
+
nicht behauptet. Die Produktions- und Entwicklungsabhängigkeiten wurden nicht geändert.
|
|
75
|
+
Die npm-Versionsverfügbarkeit prüft weiterhin der bestehende Publish-Guard.
|
|
76
|
+
|
|
77
|
+
## Testpflege ohne Änderung des Frontends
|
|
78
|
+
|
|
79
|
+
Zwei ältere Prüfskripte (`evcs-visual-online-state` und `evcs-online-id-depth`)
|
|
80
|
+
prüften noch veraltete Funktionssignaturen beziehungsweise Quelltextzeilen. Beide
|
|
81
|
+
schlugen auch im unveränderten 1.0.4-Repository fehl. Ihre Erwartungen entsprechen
|
|
82
|
+
jetzt dem bereits vorhandenen Online-/OCPP-Vertrag. Die Kachelprüfung führt zusätzlich
|
|
83
|
+
die echten Frontend-Hilfsfunktionen für Online, Leerlauf, Störung und veralteten Status
|
|
84
|
+
aus. Die produktive Online-Ermittlung und das Wallbox-Frontend wurden nicht geändert.
|
|
85
|
+
|
|
86
|
+
## Automatisierte Freigabeprüfung
|
|
87
|
+
|
|
88
|
+
- TypeScript-Build, Typecheck, Runtime-Synchronität und vollständige `test:all`-Kette.
|
|
89
|
+
- Neuer Speicherschutztest: 87 Szenariogruppen und 960 deterministische Grenzfälle.
|
|
90
|
+
- Vorhandener 1.0.4-Test: 37 Szenariogruppen zur Auto-/PV-/Phasenregelung.
|
|
91
|
+
- Zusätzliche 57 Speicher-, EVCS- und PV-Prüfskripte, einschließlich beider aktualisierter Online-Verträge.
|
|
92
|
+
- 4.400 Vergleichsfälle gegen die unveränderte 1.0.4-Basis: bestehende Ergebnisfelder
|
|
93
|
+
der normalen Speicherpolicy und der asymmetrischen Leistungsgrenze unverändert.
|
|
94
|
+
- Drei untergeordnete Speicher-Writer bytegleich auf Methodenebene. Im Dispatcher
|
|
95
|
+
kommt ausschließlich die E3/DC-IDLE-Auswahl für den neuen Telemetrie-Stopp hinzu.
|
|
96
|
+
- Echte Modul-Ticks mit simulierten Lese-/Schreibdatenpunkten für signed/split,
|
|
97
|
+
Sungrow und E3/DC; keine reale Hardware angesteuert.
|
|
98
|
+
|
|
99
|
+
Paketmanifest, npm-Pakettrockenlauf und abschließende ZIP-Prüfung gehören zur
|
|
100
|
+
Freigabe. Die frisch entpackte Repository-ZIP wird erneut gebaut und vollständig
|
|
101
|
+
getestet. Build-Zwischenstände und lokale Abhängigkeiten sind nicht Teil der ZIP.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
3
3
|
*
|
|
4
4
|
* Quelle: src-ts/runtime-executables/ems/modules/charging-management.ts
|
|
5
|
-
* Quell-Hash: sha256:
|
|
5
|
+
* Quell-Hash: sha256:d7cc5fbbbf978980b9bd0807719a20d5a635df2a2a0f83ecdfe7f8303deabf4a
|
|
6
6
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
7
7
|
*
|
|
8
8
|
* Zweck:
|
|
@@ -27,6 +27,7 @@ const { applySetpoint } = require('../consumers');
|
|
|
27
27
|
const { ReasonCodes } = require('../reasons');
|
|
28
28
|
const { computeChargingMinimumServicePlan, resolveAcChargingLimits } = require('../charging-budget-helpers');
|
|
29
29
|
const { recordAcceptedPowerTarget } = require('../services/accepted-power-effects');
|
|
30
|
+
const { buildAutoPvPriorityReservation } = require('../services/pv-surplus-allocation');
|
|
30
31
|
const { ChargingManagementAuditStore, finiteChargingAuditNumber, deriveChargingAuditLimiter, deriveChargingAuditGlobalLimiter, buildChargingAuditSnapshot, chargingAuditEventSignature, buildChargingAuditEvents } = require('../services/charging-management-audit');
|
|
31
32
|
const { Rc85EvcsDecisionGuard, rc85GridEnvelope, rc85OfflineReserveW, rc85IsHardReason, rc85RunIsolatedResult, rc86GridBinding } = require('../rc85-runtime-hardening');
|
|
32
33
|
const {
|
|
@@ -971,9 +972,10 @@ function computePendingPvStartIntentW({
|
|
|
971
972
|
// entsteht bewusst gar kein Pending-Intent. Der ungenutzte PV-Anteil bleibt
|
|
972
973
|
// dadurch im selben EMS-Zyklus fuer Speicher und nachgelagerte Verbraucher
|
|
973
974
|
// verfuegbar, statt als nicht fahrbare Teilreservierung liegen zu bleiben.
|
|
974
|
-
const startMinimumW = technicalW > 0
|
|
975
|
-
|
|
976
|
-
:
|
|
975
|
+
const startMinimumW = technicalW > 0 ? technicalW : Math.max(thresholdW, minW);
|
|
976
|
+
if (maxW + 1e-6 < startMinimumW) {
|
|
977
|
+
return { intentW: 0, totalDemandW: 0, reason: 'below-technical-minimum' };
|
|
978
|
+
}
|
|
977
979
|
if (!isAlreadyActive) {
|
|
978
980
|
const startAvailableW = Math.max(0, Math.min(potentialTotalW, pvAvailW));
|
|
979
981
|
if (startMinimumW > 0 && startAvailableW + 1e-6 < startMinimumW) {
|
|
@@ -2554,15 +2556,24 @@ function resolveEvcsStoragePolicyActualLoad({
|
|
|
2554
2556
|
activityThresholdW = 100,
|
|
2555
2557
|
storageProtectionRequested = false,
|
|
2556
2558
|
storageAssistRequested = false,
|
|
2559
|
+
physicalIdleConfirmed = false,
|
|
2557
2560
|
} = {}) {
|
|
2558
|
-
const
|
|
2561
|
+
const actualValid = actualPowerW !== null && actualPowerW !== undefined
|
|
2562
|
+
&& typeof actualPowerW !== 'boolean' && String(actualPowerW).trim() !== ''
|
|
2563
|
+
&& Number.isFinite(Number(actualPowerW));
|
|
2564
|
+
const actualW = actualValid ? Math.max(0, Math.abs(Number(actualPowerW))) : 0;
|
|
2559
2565
|
const thresholdW = Math.max(1, Number(activityThresholdW) || 100);
|
|
2560
2566
|
const state = String(vehicleStateNormalized || 'unknown');
|
|
2561
2567
|
const demandConfirmed = vehicleDemandConfirmed === true || state === 'charging';
|
|
2562
2568
|
const operational = online === true && enabled === true;
|
|
2563
|
-
const measurementUsable = operational && meterFresh === true;
|
|
2569
|
+
const measurementUsable = operational && meterFresh === true && actualValid;
|
|
2564
2570
|
const assistRequested = storageAssistRequested === true;
|
|
2565
2571
|
const protectionRequested = storageProtectionRequested === true && !assistRequested;
|
|
2572
|
+
// A missing measurement is not permission to discharge into the vehicle.
|
|
2573
|
+
// Never substitute an old reading or an unacknowledged charging command.
|
|
2574
|
+
// Only an independently confirmed physical idle reading may clear uncertainty
|
|
2575
|
+
// while the charging control itself is disabled/offline.
|
|
2576
|
+
const protectedLoadUnknown = protectionRequested && !measurementUsable && physicalIdleConfirmed !== true;
|
|
2566
2577
|
const actualVehicleLoadW = measurementUsable && demandConfirmed && actualW >= thresholdW
|
|
2567
2578
|
? actualW
|
|
2568
2579
|
: 0;
|
|
@@ -2571,6 +2582,7 @@ function resolveEvcsStoragePolicyActualLoad({
|
|
|
2571
2582
|
if (protectionRequested || assistRequested) {
|
|
2572
2583
|
if (!operational) reason = 'wallbox-not-operational';
|
|
2573
2584
|
else if (!meterFresh) reason = 'meter-not-fresh';
|
|
2585
|
+
else if (!actualValid) reason = 'meter-invalid';
|
|
2574
2586
|
else if (!demandConfirmed) reason = 'no-confirmed-vehicle-demand';
|
|
2575
2587
|
else if (actualW < thresholdW) reason = 'standby-below-activity-threshold';
|
|
2576
2588
|
else reason = assistRequested ? 'assist-actual-vehicle-load' : 'protect-actual-vehicle-load';
|
|
@@ -2585,6 +2597,8 @@ function resolveEvcsStoragePolicyActualLoad({
|
|
|
2585
2597
|
demandConfirmed,
|
|
2586
2598
|
vehicleStateNormalized: state,
|
|
2587
2599
|
actualVehicleLoadW,
|
|
2600
|
+
protectionRequested,
|
|
2601
|
+
protectedLoadUnknown,
|
|
2588
2602
|
protectedLoadW: protectionRequested ? actualVehicleLoadW : 0,
|
|
2589
2603
|
assistRequestedLoadW: assistRequested ? actualVehicleLoadW : 0,
|
|
2590
2604
|
protectedWallbox: protectionRequested && actualVehicleLoadW > 0,
|
|
@@ -3265,6 +3279,21 @@ class ChargingManagementModule extends BaseModule {
|
|
|
3265
3279
|
phaseSwitchCommandAllowed: w && w.phaseSwitchCommandAllowed,
|
|
3266
3280
|
phaseSwitchKey: w && w.phaseSwitchKey,
|
|
3267
3281
|
phaseSwitchValue: w && w.phaseSwitchValue,
|
|
3282
|
+
// Preserve the actual per-point phase contract, not only global defaults.
|
|
3283
|
+
supportsPhaseSwitch: !!(w && w.phaseSwitchKey),
|
|
3284
|
+
phaseSwitchValue1p: w && w.phaseSwitchValue1p,
|
|
3285
|
+
phaseSwitchValue3p: w && w.phaseSwitchValue3p,
|
|
3286
|
+
switchUpThresholdW: w && w.phaseSwitchUpThresholdW,
|
|
3287
|
+
switchDownThresholdW: w && w.phaseSwitchDownThresholdW,
|
|
3288
|
+
switchUpStableMs: w && w.phaseSwitchUpStableMs,
|
|
3289
|
+
switchDownStableMs: w && w.phaseSwitchDownStableMs,
|
|
3290
|
+
switchCooldownMs: w && w.phaseSwitchCooldownMs,
|
|
3291
|
+
switchSettleMs: w && w.phaseSwitchSettleMs,
|
|
3292
|
+
switchSafePowerW: w && w.phaseSwitchSafePowerW,
|
|
3293
|
+
highSinceMs: w && w.highSinceMs,
|
|
3294
|
+
lowSinceMs: w && w.lowSinceMs,
|
|
3295
|
+
cooldownUntilMs: w && w.cooldownUntilMs,
|
|
3296
|
+
settleUntilMs: w && w.settleUntilMs,
|
|
3268
3297
|
phaseSwitchReason: w && w.phaseSwitchReason,
|
|
3269
3298
|
phaseSwitchSafetyStopRequired: w && w.phaseSwitchSafetyStopRequired,
|
|
3270
3299
|
phaseSwitchCooldownRemainingMs: w && w.phaseSwitchCooldownRemainingMs,
|
|
@@ -3412,6 +3441,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
3412
3441
|
let reserveW = 0;
|
|
3413
3442
|
let pvReserveW = 0;
|
|
3414
3443
|
let pvIntentW = 0;
|
|
3444
|
+
let purePvIntentW = 0;
|
|
3415
3445
|
let activeDemandWallboxes = 0;
|
|
3416
3446
|
|
|
3417
3447
|
for (const plan of plans) {
|
|
@@ -3473,6 +3503,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
3473
3503
|
reserveW += reserveThisW;
|
|
3474
3504
|
pvReserveW += Math.min(reserveThisW, finalPvUsedW);
|
|
3475
3505
|
pvIntentW += computePvManagedDemandIntentW(effectiveMode, reserveThisW, minPowerW);
|
|
3506
|
+
if (effectiveMode === 'pv') purePvIntentW += reserveThisW;
|
|
3476
3507
|
activeDemandWallboxes += 1;
|
|
3477
3508
|
}
|
|
3478
3509
|
|
|
@@ -3482,6 +3513,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
3482
3513
|
reserveW: Math.max(0, Math.round(reserveW)),
|
|
3483
3514
|
pvReserveW: Math.max(0, Math.round(pvReserveW)),
|
|
3484
3515
|
pvIntentW: Math.max(0, Math.round(pvIntentW)),
|
|
3516
|
+
purePvIntentW: Math.max(0, Math.round(purePvIntentW)),
|
|
3485
3517
|
activeDemandWallboxes,
|
|
3486
3518
|
};
|
|
3487
3519
|
} catch (_eFinalAllocationMetrics) {
|
|
@@ -3489,6 +3521,37 @@ class ChargingManagementModule extends BaseModule {
|
|
|
3489
3521
|
}
|
|
3490
3522
|
}
|
|
3491
3523
|
|
|
3524
|
+
/** Attribute only the PV share of final, phase-checked Auto targets. */
|
|
3525
|
+
_buildAutoPvPriorityMetrics(allocationState, wbList, options) {
|
|
3526
|
+
const decision = allocationState && (allocationState.normalSourceDecision?.apply
|
|
3527
|
+
? allocationState.normalSourceDecision : allocationState.productiveDecision);
|
|
3528
|
+
const plans = decision && Array.isArray(decision.apply?.wallboxes) ? decision.apply.wallboxes : [];
|
|
3529
|
+
const bySafe = new Map((wbList || []).filter(w => w && w.safe).map(w => [String(w.safe), w]));
|
|
3530
|
+
const points = plans.map(plan => {
|
|
3531
|
+
const w = bySafe.get(String(plan.safe)) || {};
|
|
3532
|
+
const factor = Math.max(1, Number(plan.phases) || 1) * Math.max(1, Number(plan.voltageV) || 230);
|
|
3533
|
+
const basisCurrent = ['current', 'currentA'].includes(String(plan.controlBasis));
|
|
3534
|
+
const step = basisCurrent ? (Number(plan.stepA) || 0.1) : (Number(plan.stepW) || 1);
|
|
3535
|
+
const minRaw = basisCurrent ? Math.max(Number(plan.minA) || 0, (Number(plan.minPowerW) || 0) / factor)
|
|
3536
|
+
: Math.max(0, Number(plan.minPowerW) || 0);
|
|
3537
|
+
const technicalMinimumW = Math.ceil((minRaw - 1e-9) / step) * step * (basisCurrent ? factor : 1);
|
|
3538
|
+
return {
|
|
3539
|
+
safe: String(plan.safe), userMode: String(w.userMode || plan.userMode || 'auto'),
|
|
3540
|
+
effectiveMode: String(plan.effectiveMode || w.effectiveMode || ''),
|
|
3541
|
+
enabled: w.enabled !== false && plan.enabled !== false,
|
|
3542
|
+
online: w.online === true && plan.online === true,
|
|
3543
|
+
demandConfirmed: w.vehicleDemandConfirmed === true || plan.demandConfirmed === true,
|
|
3544
|
+
startProbeActive: w.vehicleStartProbeActive === true || plan.vehicleStartProbeActive === true,
|
|
3545
|
+
actualFresh: w.meterStale !== true && plan.staleAny !== true,
|
|
3546
|
+
actualW: Math.max(0, Number(w.actualPowerW) || 0),
|
|
3547
|
+
finalTargetW: Math.max(0, Number(plan.targetPowerW) || 0),
|
|
3548
|
+
technicalMinimumW,
|
|
3549
|
+
phaseTransition: plan.phaseSwitchRequired === true || plan.phaseSwitchSafetyStopRequired === true,
|
|
3550
|
+
};
|
|
3551
|
+
});
|
|
3552
|
+
return buildAutoPvPriorityReservation({ ...options, points });
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3492
3555
|
/** Code-Teil: _publishChargingPhaseSelectionRuntimeStates – Übernimmt Hysterese-/Cooldown-Zustände aus der TS-Phasenwahl und veröffentlicht lesbare Diagnose pro Ladepunkt. */
|
|
3493
3556
|
async _publishChargingPhaseSelectionRuntimeStates(phasePlan, wbList) {
|
|
3494
3557
|
const decisions = phasePlan && Array.isArray(phasePlan.wallboxes) ? phasePlan.wallboxes : [];
|
|
@@ -5061,7 +5124,11 @@ class ChargingManagementModule extends BaseModule {
|
|
|
5061
5124
|
await mk('chargingManagement.control.pvCapEffectiveW', 'Pure-PV customer-priority cap after hysteresis (W)', 'number', 'value.power');
|
|
5062
5125
|
await mk('chargingManagement.control.pvPureCapW', 'Pure-PV customer-priority cap (W)', 'number', 'value.power');
|
|
5063
5126
|
await mk('chargingManagement.control.pvPhysicalCapW', 'Physical PV cap for PV and Min+PV extra power (W)', 'number', 'value.power');
|
|
5064
|
-
await mk('chargingManagement.control.pvPriorityPurePvOnly', '
|
|
5127
|
+
await mk('chargingManagement.control.pvPriorityPurePvOnly', 'Legacy indicator: PV priority restricted to pure PV', 'boolean', 'indicator');
|
|
5128
|
+
await mk('chargingManagement.control.pvPriorityIncludesAuto', 'Customer PV priority includes Auto PV share', 'boolean', 'indicator');
|
|
5129
|
+
await mk('chargingManagement.control.pvAutoPriorityReservedW', 'PV share reserved by final Auto charging targets (W)', 'number', 'value.power');
|
|
5130
|
+
await mk('chargingManagement.control.pvEvcsAutoPriorityMeasuredW', 'Fresh Auto power used in physical PV reconstruction (W)', 'number', 'value.power');
|
|
5131
|
+
await mk('chargingManagement.control.pvAutoPriorityJson', 'Auto PV share and phase-aware start diagnostics', 'string', 'json');
|
|
5065
5132
|
await mk('chargingManagement.control.pvAvailable', 'PV available (hysteresis)', 'boolean', 'indicator');
|
|
5066
5133
|
await mk('chargingManagement.control.pvAllocationMode', 'PV surplus allocation mode', 'string', 'text');
|
|
5067
5134
|
await mk('chargingManagement.control.pvAllocationEvcsSharePct', 'PV surplus EVCS share (%)', 'number', 'value.percent');
|
|
@@ -5155,6 +5222,9 @@ class ChargingManagementModule extends BaseModule {
|
|
|
5155
5222
|
await mk('chargingManagement.control.storageAssistPowerAgeMs', 'Stationary storage discharge value age (ms)', 'number', 'value.interval');
|
|
5156
5223
|
await mk('chargingManagement.control.storageAssistPowerFresh', 'Stationary storage discharge value fresh', 'boolean', 'indicator');
|
|
5157
5224
|
await mk('chargingManagement.control.storageProtectedLoadW', 'EVCS load protected from storage (W)', 'number', 'value.power');
|
|
5225
|
+
await mk('chargingManagement.control.storageProtectionRequestedWallboxes', 'Ladepunkte mit gewähltem Speicherschutz', 'number', 'value');
|
|
5226
|
+
await mk('chargingManagement.control.storageProtectedUnknownWallboxes', 'Geschützte Ladepunkte mit unbekannter Fahrzeuglast', 'number', 'value');
|
|
5227
|
+
await mk('chargingManagement.control.storagePolicyJson', 'Atomarer EVCS-Speicher-Policy-Snapshot', 'string', 'json');
|
|
5158
5228
|
await mk('chargingManagement.control.storageProtectedWallboxes', 'EVCS wallboxes protected from storage', 'number', 'value');
|
|
5159
5229
|
await mk('chargingManagement.control.storageProtectedLoadTs', 'EVCS storage-protection timestamp', 'number', 'value.time');
|
|
5160
5230
|
await mk('chargingManagement.control.storageAssistRequestedLoadW', 'EVCS load allowed to use storage (W)', 'number', 'value.power');
|
|
@@ -5466,6 +5536,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
5466
5536
|
await mk('storageProtectionRequested', 'Speicher-Schutz für Ladepunkt explizit aktiv', 'boolean', 'indicator');
|
|
5467
5537
|
await mk('storagePolicyActualLoadW', 'Tatsächliche EV-Fahrzeuglast für Speicher-Policy (W)', 'number', 'value.power');
|
|
5468
5538
|
await mk('storagePolicyActualLoadActive', 'Tatsächliche EV-Fahrzeuglast für Speicher-Policy aktiv', 'boolean', 'indicator');
|
|
5539
|
+
await mk('storagePolicyLoadUnknown', 'Speicherschutz: Fahrzeuglast unbekannt', 'boolean', 'indicator');
|
|
5469
5540
|
await mk('storagePolicyActualLoadReason', 'Tatsächliche EV-Fahrzeuglast für Speicher-Policy Grund', 'string', 'text');
|
|
5470
5541
|
await mk('effectiveStorageAssist', 'Speicher-Mitnutzung effektiv', 'boolean', 'indicator');
|
|
5471
5542
|
await mk('storageAssistBlockedReason', 'Speicher-Mitnutzung Grund', 'string', 'text');
|
|
@@ -5988,7 +6059,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
5988
6059
|
try {
|
|
5989
6060
|
const caps = (this.adapter && this.adapter._emsCaps && typeof this.adapter._emsCaps === 'object') ? this.adapter._emsCaps : {};
|
|
5990
6061
|
const prev = (caps.evcsStoragePolicy && typeof caps.evcsStoragePolicy === 'object') ? caps.evcsStoragePolicy : {};
|
|
5991
|
-
this.adapter._emsCaps = { ...caps, evcsStoragePolicy: { ...prev, ...(patch || {}), ts: now } };
|
|
6062
|
+
this.adapter._emsCaps = { ...caps, evcsStoragePolicy: { ...prev, ...(patch || {}), ts: Number.isFinite(patch && patch.ts) ? patch.ts : now } };
|
|
5992
6063
|
} catch { /* diagnostics only */ }
|
|
5993
6064
|
};
|
|
5994
6065
|
|
|
@@ -6005,9 +6076,16 @@ class ChargingManagementModule extends BaseModule {
|
|
|
6005
6076
|
storageSource: '',
|
|
6006
6077
|
});
|
|
6007
6078
|
|
|
6008
|
-
//
|
|
6009
|
-
|
|
6079
|
+
// Do not publish a fresh 'no protection' verdict before reading the customer
|
|
6080
|
+
// choices. A failed/incomplete tick must discard old watts but retain the
|
|
6081
|
+
// protection intent conservatively until a complete snapshot replaces it.
|
|
6082
|
+
const pendingProtectedWallboxes = wallboxes.filter(w => w && w.storageAssistCustomerAllowed === true).length;
|
|
6083
|
+
publishEvStoragePolicyCaps({ protectedLoadW: 0, protectedWallboxes: 0,
|
|
6084
|
+
protectionRequestedWallboxes: pendingProtectedWallboxes,
|
|
6085
|
+
protectedUnknownWallboxes: pendingProtectedWallboxes, complete: false,
|
|
6086
|
+
assistRequestedLoadW: 0, source: 'charging-tick-reset' });
|
|
6010
6087
|
let storageProtectedLoadW = 0, storageProtectedWallboxes = 0, storageAssistRequestedLoadW = 0;
|
|
6088
|
+
let storageProtectionRequestedWallboxes = 0, storageProtectedUnknownWallboxes = 0;
|
|
6011
6089
|
try {
|
|
6012
6090
|
await Promise.all([
|
|
6013
6091
|
this._queueState('chargingManagement.control.storageProtectedLoadW', 0, true),
|
|
@@ -7264,7 +7342,8 @@ class ChargingManagementModule extends BaseModule {
|
|
|
7264
7342
|
vehicleDemandReason = String(vehicleDemand.reason || '');
|
|
7265
7343
|
const vehicleStateNormalized = String(vehicleDemand.state || 'unknown');
|
|
7266
7344
|
|
|
7267
|
-
//
|
|
7345
|
+
// Only measured vehicle watts are counted. Missing protected watts
|
|
7346
|
+
// are published separately as uncertainty, not as a fictitious 0-W load.
|
|
7268
7347
|
// Wallbox-Eigenverbrauch unterhalb der Aktivitaetsschwelle (z. B. ABL
|
|
7269
7348
|
// eMH1 mit rund 69 W im B2-Wartezustand) bleibt normale Gebaeudelast.
|
|
7270
7349
|
const storagePolicyActualLoad = resolveEvcsStoragePolicyActualLoad({
|
|
@@ -7277,13 +7356,18 @@ class ChargingManagementModule extends BaseModule {
|
|
|
7277
7356
|
activityThresholdW,
|
|
7278
7357
|
storageProtectionRequested,
|
|
7279
7358
|
storageAssistRequested,
|
|
7359
|
+
physicalIdleConfirmed: !meterStale && pWRawNum !== null
|
|
7360
|
+
&& Math.abs(pWRawNum) < Math.max(1, activityThresholdW),
|
|
7280
7361
|
});
|
|
7362
|
+
if (storagePolicyActualLoad.protectionRequested) storageProtectionRequestedWallboxes += 1;
|
|
7363
|
+
if (storagePolicyActualLoad.protectedLoadUnknown) storageProtectedUnknownWallboxes += 1;
|
|
7281
7364
|
storageProtectedLoadW += storagePolicyActualLoad.protectedLoadW;
|
|
7282
7365
|
storageAssistRequestedLoadW += storagePolicyActualLoad.assistRequestedLoadW;
|
|
7283
7366
|
if (storagePolicyActualLoad.protectedWallbox) storageProtectedWallboxes += 1;
|
|
7284
7367
|
try {
|
|
7285
7368
|
await this._queueState(`${ch}.storagePolicyActualLoadW`, Math.round(storagePolicyActualLoad.actualVehicleLoadW), true);
|
|
7286
7369
|
await this._queueState(`${ch}.storagePolicyActualLoadActive`, storagePolicyActualLoad.active === true, true);
|
|
7370
|
+
await this._queueState(`${ch}.storagePolicyLoadUnknown`, storagePolicyActualLoad.protectedLoadUnknown === true, true);
|
|
7287
7371
|
await this._queueState(`${ch}.storagePolicyActualLoadReason`, String(storagePolicyActualLoad.reason || ''), true);
|
|
7288
7372
|
} catch { /* diagnostics only */ }
|
|
7289
7373
|
|
|
@@ -7704,6 +7788,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
7704
7788
|
storageProtectionRequested,
|
|
7705
7789
|
storagePolicyActualLoadW: storagePolicyActualLoad.actualVehicleLoadW,
|
|
7706
7790
|
storagePolicyActualLoadReason: storagePolicyActualLoad.reason,
|
|
7791
|
+
storagePolicyLoadUnknown: storagePolicyActualLoad.protectedLoadUnknown,
|
|
7707
7792
|
effectiveStorageAssist: false,
|
|
7708
7793
|
storageAssistBlockedReason: storageAssistCustomerAllowed ? (userStorageAssistEnabled ? 'pending' : 'user-disabled') : 'installer-locked',
|
|
7709
7794
|
batteryContributionW: 0,
|
|
@@ -8411,6 +8496,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
8411
8496
|
let pvEvcsCmdW = 0;
|
|
8412
8497
|
let pvEvcsUsedW = 0;
|
|
8413
8498
|
let pvEvcsPhysicalPvManagedW = 0;
|
|
8499
|
+
let pvEvcsAutoPriorityMeasuredW = 0;
|
|
8414
8500
|
|
|
8415
8501
|
try {
|
|
8416
8502
|
for (const w of wbList) {
|
|
@@ -8423,12 +8509,16 @@ class ChargingManagementModule extends BaseModule {
|
|
|
8423
8509
|
pvEvcsActualW += a;
|
|
8424
8510
|
|
|
8425
8511
|
// Fuer die zentrale physikalische PV-Rekonstruktion zaehlt nur
|
|
8426
|
-
// gemessene Leistung von PV-/Min+PV-Ladepunkten.
|
|
8427
|
-
//
|
|
8428
|
-
//
|
|
8512
|
+
// gemessene Leistung von PV-/Min+PV- sowie Auto-Ladepunkten.
|
|
8513
|
+
// Auto wird danach mit seinem tatsaechlichen PV-Anteil reserviert;
|
|
8514
|
+
// Boost bleibt ausserhalb der Kundenaufteilung. Kommandowerte werden hier bewusst
|
|
8429
8515
|
// nicht verwendet; der NVP bildet den realen Leistungsfluss ab.
|
|
8430
8516
|
const effectiveMode = String(w.effectiveMode || '').trim().toLowerCase();
|
|
8431
|
-
if (effectiveMode === '
|
|
8517
|
+
if ((effectiveMode === 'normal' || effectiveMode === 'auto')
|
|
8518
|
+
&& normalizeWallboxModeOverride(w.userMode) === 'auto' && w.meterStale !== true) {
|
|
8519
|
+
pvEvcsPhysicalPvManagedW += a;
|
|
8520
|
+
pvEvcsAutoPriorityMeasuredW += a;
|
|
8521
|
+
} else if (effectiveMode === 'pv') {
|
|
8432
8522
|
pvEvcsPhysicalPvManagedW += a;
|
|
8433
8523
|
} else if (effectiveMode === 'minpv') {
|
|
8434
8524
|
// Min+PV-Grundlast kommt aus dem normalen Gesamt-/Netzbudget.
|
|
@@ -8478,6 +8568,7 @@ class ChargingManagementModule extends BaseModule {
|
|
|
8478
8568
|
await this._queueState('chargingManagement.control.pvEvcsCmdW', Math.round(pvEvcsCmdW || 0), true);
|
|
8479
8569
|
await this._queueState('chargingManagement.control.pvEvcsUsedW', Math.round(pvEvcsUsedW || 0), true);
|
|
8480
8570
|
await this._queueState('chargingManagement.control.pvEvcsPhysicalPvManagedW', Math.round(pvEvcsPhysicalPvManagedW || 0), true);
|
|
8571
|
+
await this._queueState('chargingManagement.control.pvEvcsAutoPriorityMeasuredW', Math.round(pvEvcsAutoPriorityMeasuredW || 0), true);
|
|
8481
8572
|
} catch {
|
|
8482
8573
|
// ignore
|
|
8483
8574
|
}
|
|
@@ -8789,7 +8880,8 @@ class ChargingManagementModule extends BaseModule {
|
|
|
8789
8880
|
await this._queueState('chargingManagement.control.pvCapEffectiveW', pvCapEffectiveWState || 0, true);
|
|
8790
8881
|
await this._queueState('chargingManagement.control.pvPureCapW', pvPureCapWState || 0, true);
|
|
8791
8882
|
await this._queueState('chargingManagement.control.pvPhysicalCapW', pvPhysicalCapWState || 0, true);
|
|
8792
|
-
await this._queueState('chargingManagement.control.pvPriorityPurePvOnly',
|
|
8883
|
+
await this._queueState('chargingManagement.control.pvPriorityPurePvOnly', false, true);
|
|
8884
|
+
await this._queueState('chargingManagement.control.pvPriorityIncludesAuto', true, true);
|
|
8793
8885
|
await this._queueState('chargingManagement.control.pvAvailable', !!pvAvailableState, true);
|
|
8794
8886
|
await this._queueState('chargingManagement.control.pvSurplusNoEvRawW', pvSurplusNoEvRawWState || 0, true);
|
|
8795
8887
|
await this._queueState('chargingManagement.control.pvSurplusNoEvAvg5mW', pvSurplusNoEvAvg5mWState || 0, true);
|
|
@@ -8912,7 +9004,8 @@ if (components.length) {
|
|
|
8912
9004
|
pvCapEffectiveW: (typeof pvCapEffectiveWState === 'number' && Number.isFinite(pvCapEffectiveWState)) ? pvCapEffectiveWState : null,
|
|
8913
9005
|
pvPureCapW: (typeof pvPureCapWState === 'number' && Number.isFinite(pvPureCapWState)) ? pvPureCapWState : null,
|
|
8914
9006
|
pvPhysicalCapW: (typeof pvPhysicalCapWState === 'number' && Number.isFinite(pvPhysicalCapWState)) ? pvPhysicalCapWState : null,
|
|
8915
|
-
pvPriorityPurePvOnly:
|
|
9007
|
+
pvPriorityPurePvOnly: false,
|
|
9008
|
+
pvPriorityIncludesAuto: true,
|
|
8916
9009
|
pvAvailable: !!pvAvailableState,
|
|
8917
9010
|
gridW: (typeof gridW === 'number' && Number.isFinite(gridW)) ? gridW : null,
|
|
8918
9011
|
gridImportNoEvW: (typeof gridImportNoEvW === 'number' && Number.isFinite(gridImportNoEvW)) ? gridImportNoEvW : null,
|
|
@@ -9567,7 +9660,22 @@ if (components.length) {
|
|
|
9567
9660
|
}
|
|
9568
9661
|
|
|
9569
9662
|
// Finaler Same-cycle Stand; persistente States darunter bleiben Diagnose/Fallback.
|
|
9570
|
-
|
|
9663
|
+
const completedStoragePolicy = {
|
|
9664
|
+
protectedLoadW: Math.max(0, Math.round(Number(storageProtectedLoadW || 0))),
|
|
9665
|
+
protectedWallboxes: Math.max(0, Math.round(Number(storageProtectedWallboxes || 0))),
|
|
9666
|
+
protectionRequestedWallboxes: storageProtectionRequestedWallboxes,
|
|
9667
|
+
protectedUnknownWallboxes: storageProtectedUnknownWallboxes,
|
|
9668
|
+
assistRequestedLoadW: Math.max(0, Math.round(Number(storageAssistRequestedLoadW || 0))),
|
|
9669
|
+
complete: true, source: 'charging-runtime', sampledAt: now, ts: Date.now(),
|
|
9670
|
+
};
|
|
9671
|
+
publishEvStoragePolicyCaps(completedStoragePolicy);
|
|
9672
|
+
// One bounded snapshot, no history or new timer. Its embedded timestamp
|
|
9673
|
+
// cannot turn old watts into fresh measurements after adapter restart.
|
|
9674
|
+
try {
|
|
9675
|
+
await this._queueState('chargingManagement.control.storagePolicyJson', JSON.stringify(completedStoragePolicy), true);
|
|
9676
|
+
await this._queueState('chargingManagement.control.storageProtectionRequestedWallboxes', storageProtectionRequestedWallboxes, true);
|
|
9677
|
+
await this._queueState('chargingManagement.control.storageProtectedUnknownWallboxes', storageProtectedUnknownWallboxes, true);
|
|
9678
|
+
} catch { /* runtime snapshot remains authoritative if diagnostic persistence fails */ }
|
|
9571
9679
|
|
|
9572
9680
|
// Publish diagnostics for UI. `storageAssistW` bleibt der Request an die
|
|
9573
9681
|
// Speicherregelung; nur `storageAssistAcceptedW` darf das Ladebudget erhoehen.
|
|
@@ -11792,9 +11900,21 @@ if (components.length) {
|
|
|
11792
11900
|
: 0;
|
|
11793
11901
|
const commandNowW = Math.max(0, Number(row.targetW) || 0);
|
|
11794
11902
|
const demandNowW = Math.max(0, Number(row.demandReserveW) || 0, actualNowW, commandNowW);
|
|
11795
|
-
|
|
11903
|
+
let technicalMinW = (w.chargerType === 'AC' && Number(w.phases || 0) === 3)
|
|
11796
11904
|
? Math.max(0, Math.max(num(w.minPW, 0), acMinPower3pW))
|
|
11797
11905
|
: Math.max(0, num(w.minPW, 0));
|
|
11906
|
+
// Reserve only a start that can actually be represented by this
|
|
11907
|
+
// charger's command step. Rounding down would hold PV for a
|
|
11908
|
+
// command which the final technical-minimum guard must stop.
|
|
11909
|
+
if (w.controlBasis === 'currentA' && w.chargerType === 'AC') {
|
|
11910
|
+
const factor = Math.max(1, num(w.phases, 3)) * Math.max(1, num(w.voltageV, 230));
|
|
11911
|
+
const stepA = num(w.stepA, 0) > 0 ? num(w.stepA, 0) : 0.1;
|
|
11912
|
+
const startA = Math.max(num(w.minA, 0), technicalMinW / factor);
|
|
11913
|
+
technicalMinW = Math.ceil((startA - 1e-9) / stepA) * stepA * factor;
|
|
11914
|
+
} else if (technicalMinW > 0) {
|
|
11915
|
+
const stepW = num(w.stepW, 0) > 0 ? num(w.stepW, 0) : 1;
|
|
11916
|
+
technicalMinW = Math.ceil((technicalMinW - 1e-9) / stepW) * stepW;
|
|
11917
|
+
}
|
|
11798
11918
|
const minPvBaseW = effMode === 'minpv'
|
|
11799
11919
|
? Math.max(
|
|
11800
11920
|
0,
|
|
@@ -11884,8 +12004,8 @@ if (components.length) {
|
|
|
11884
12004
|
let evcsControlReserveW = Math.max(0, Math.round(evcsActiveDemandReserveW));
|
|
11885
12005
|
let evcsControlPvReserveW = Math.max(0, Math.round(evcsActiveDemandPvReserveW));
|
|
11886
12006
|
let evcsControlPvIntentW = Math.max(0, Math.round(evcsActiveDemandPvIntentW));
|
|
11887
|
-
|
|
11888
|
-
|
|
12007
|
+
let evcsControlPendingPvIntentW = Math.max(0, Math.round(evcsPendingDemandPvIntentW));
|
|
12008
|
+
let evcsControlPendingDemandW = Math.max(0, Math.round(evcsPendingDemandTotalW));
|
|
11889
12009
|
let evcsControlTotalPvIntentW = Math.max(0, evcsControlPvIntentW + evcsControlPendingPvIntentW);
|
|
11890
12010
|
let evcsControlRemainingW = Number.isFinite(budgetW)
|
|
11891
12011
|
? Math.max(0, Math.round(Number(budgetW) - evcsControlReserveW))
|
|
@@ -12025,7 +12145,46 @@ if (components.length) {
|
|
|
12025
12145
|
evcsControlReserveW = finalAllocationMetrics.reserveW;
|
|
12026
12146
|
evcsControlPvReserveW = finalAllocationMetrics.pvReserveW;
|
|
12027
12147
|
evcsControlPvIntentW = finalAllocationMetrics.pvIntentW;
|
|
12148
|
+
// A tentative start was calculated before the final phase plan. It may
|
|
12149
|
+
// not reserve PV while the same plan orders stop/switch/settle.
|
|
12150
|
+
const phaseBySafe = new Map((tsAllocationState?.phasePlan?.wallboxes || []).map(p => [String(p.safe), p]));
|
|
12151
|
+
const finalDecision = tsAllocationState?.normalSourceDecision?.apply
|
|
12152
|
+
? tsAllocationState.normalSourceDecision : tsAllocationState?.productiveDecision;
|
|
12153
|
+
const finalBySafe = new Map((finalDecision?.apply?.wallboxes || []).map(p => [String(p.safe), p]));
|
|
12154
|
+
for (const row of debugAlloc) {
|
|
12155
|
+
if (!row || !(Number(row.pendingPvIntentTotalDemandW) > 0)) continue;
|
|
12156
|
+
const phase = phaseBySafe.get(String(row.safe));
|
|
12157
|
+
const final = finalBySafe.get(String(row.safe));
|
|
12158
|
+
const phaseBlocked = !!(phase && (phase.switchRequired || phase.safetyStopRequired || Number(phase.settleUntilMs) > now));
|
|
12159
|
+
// A ramp intent based on a raw command ceases to be real demand
|
|
12160
|
+
// when the final phase/technical/cap guard has rejected that start.
|
|
12161
|
+
// Preserve genuine start-minimum intents calculated from idle.
|
|
12162
|
+
const rawStartRejected = !!(final && Number(row.targetW) >= activityThresholdW
|
|
12163
|
+
&& !(Number(final.targetPowerW) > 0)
|
|
12164
|
+
&& !(row.meterStale !== true && Number(row.actualPowerW) >= activityThresholdW));
|
|
12165
|
+
if (!phaseBlocked && !rawStartRejected) continue;
|
|
12166
|
+
evcsControlPendingPvIntentW = Math.max(0, evcsControlPendingPvIntentW - (Number(row.pendingPvIntentW) || 0));
|
|
12167
|
+
evcsControlPendingDemandW = Math.max(0, evcsControlPendingDemandW - (Number(row.pendingPvIntentTotalDemandW) || 0));
|
|
12168
|
+
if (String(row.effectiveMode || '') === 'pv') {
|
|
12169
|
+
evcsPendingDemandPurePvIntentW = Math.max(0, evcsPendingDemandPurePvIntentW - (Number(row.pendingPvIntentW) || 0));
|
|
12170
|
+
}
|
|
12171
|
+
row.pendingPvIntentW = 0;
|
|
12172
|
+
row.pendingPvIntentTotalDemandW = 0;
|
|
12173
|
+
row.pendingPvIntentReason = phaseBlocked ? 'phase-transition-no-start-reservation' : 'final-plan-no-runnable-demand';
|
|
12174
|
+
const point = wbList.find(w => String(w.safe) === String(row.safe));
|
|
12175
|
+
if (point?.ch) await this._queueState(`${point.ch}.pvStartReservationW`, 0, true);
|
|
12176
|
+
}
|
|
12177
|
+
const autoPvMetrics = this._buildAutoPvPriorityMetrics(tsAllocationState, wbList, {
|
|
12178
|
+
priorityCapW: Math.max(0, Number(pvStartReadyBudgetW) || 0),
|
|
12179
|
+
physicalCapW: Math.max(0, Number(pvPhysicalCapW) || 0),
|
|
12180
|
+
otherPriorityReservedW: finalAllocationMetrics.purePvIntentW + Math.max(0, evcsPendingDemandPurePvIntentW),
|
|
12181
|
+
otherPhysicalReservedW: Math.max(evcsControlPvIntentW, evcsControlPvReserveW) + evcsControlPendingPvIntentW,
|
|
12182
|
+
});
|
|
12183
|
+
evcsControlPvReserveW += autoPvMetrics.reservedW;
|
|
12184
|
+
evcsControlPvIntentW += autoPvMetrics.reservedW;
|
|
12028
12185
|
evcsControlTotalPvIntentW = Math.max(0, evcsControlPvIntentW + evcsControlPendingPvIntentW);
|
|
12186
|
+
await this._queueState('chargingManagement.control.pvAutoPriorityReservedW', autoPvMetrics.reservedW, true);
|
|
12187
|
+
await this._queueState('chargingManagement.control.pvAutoPriorityJson', JSON.stringify(autoPvMetrics), true);
|
|
12029
12188
|
evcsControlRemainingW = Number.isFinite(budgetW)
|
|
12030
12189
|
? Math.max(0, Math.round(Number(budgetW) - evcsControlReserveW))
|
|
12031
12190
|
: 0;
|
|
@@ -12042,6 +12201,8 @@ if (components.length) {
|
|
|
12042
12201
|
budgetDebug.evcsFinalTargetPowerW = totalTargetPowerW;
|
|
12043
12202
|
budgetDebug.evcsFinalTargetCurrentA = totalTargetCurrentA;
|
|
12044
12203
|
budgetDebug.evcsFinalAllocationSource = 'ts-final-allocation-plan';
|
|
12204
|
+
budgetDebug.evcsPendingDemandPvIntentW = evcsControlPendingPvIntentW;
|
|
12205
|
+
budgetDebug.evcsPendingDemandReserveW = evcsControlPendingDemandW;
|
|
12045
12206
|
}
|
|
12046
12207
|
const budgetEntry = debugAlloc.find(a => a && a.type === 'budget');
|
|
12047
12208
|
if (budgetEntry && budgetEntry.details && typeof budgetEntry.details === 'object') {
|
|
@@ -12054,6 +12215,8 @@ if (components.length) {
|
|
|
12054
12215
|
budgetEntry.details.evcsFinalTargetPowerW = totalTargetPowerW;
|
|
12055
12216
|
budgetEntry.details.evcsFinalTargetCurrentA = totalTargetCurrentA;
|
|
12056
12217
|
budgetEntry.details.evcsFinalAllocationSource = 'ts-final-allocation-plan';
|
|
12218
|
+
budgetEntry.details.evcsPendingDemandPvIntentW = evcsControlPendingPvIntentW;
|
|
12219
|
+
budgetEntry.details.evcsPendingDemandReserveW = evcsControlPendingDemandW;
|
|
12057
12220
|
}
|
|
12058
12221
|
} catch (_eFinalAllocationDiagnostics) {
|
|
12059
12222
|
// diagnostics only
|