iobroker.nexowatt-ui 0.7.27 → 0.7.28
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/ems/modules/peak-shaving.js +23 -9
- package/io-package.json +21 -3
- package/main.js +5 -1
- package/package.json +1 -1
- package/www/ems-apps.html +238 -0
- package/www/ems-apps.js +446 -3
- package/www/sw.js +1 -1
|
@@ -501,12 +501,22 @@ class PeakShavingModule extends BaseModule {
|
|
|
501
501
|
|
|
502
502
|
|
|
503
503
|
// Atypische Netznutzung / HLZF-Spitzenkappung (§19 Abs. 2 S. 1 StromNEV)
|
|
504
|
-
//
|
|
505
|
-
//
|
|
504
|
+
// strategyMode steuert die UI-Auswahl:
|
|
505
|
+
// - standard: nur klassische Lastspitzenkappung
|
|
506
|
+
// - atypical: nur HLZF-Cap innerhalb aktiver Hochlastzeitfenster
|
|
507
|
+
// - hybrid: klassisch + HLZF, es bindet immer das strengere Limit
|
|
508
|
+
// - monitor: HLZF-Diagnose ohne Peak-Shaving-Setpoint aus diesem Modul
|
|
506
509
|
const atypicalCfg = (cfg.atypical && typeof cfg.atypical === 'object') ? cfg.atypical : {};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
+
let strategyMode = String(cfg.strategyMode || cfg.strategy || '').trim().toLowerCase();
|
|
511
|
+
if (!['standard', 'atypical', 'hybrid', 'monitor'].includes(strategyMode)) {
|
|
512
|
+
const legacyMode = String(atypicalCfg.mode || '').trim().toLowerCase();
|
|
513
|
+
strategyMode = atypicalCfg.enabled ? (legacyMode === 'monitor' ? 'monitor' : 'hybrid') : 'standard';
|
|
514
|
+
}
|
|
515
|
+
const standardLimitEnabled = strategyMode === 'standard' || strategyMode === 'hybrid';
|
|
516
|
+
const atypicalRuntimeEnabled = !!atypicalCfg.enabled && (strategyMode === 'atypical' || strategyMode === 'hybrid' || strategyMode === 'monitor');
|
|
517
|
+
const atypicalMode = strategyMode === 'monitor' ? 'monitor' : String(atypicalCfg.mode || (strategyMode === 'atypical' ? 'enforce' : 'hybrid')).trim().toLowerCase(); // monitor|enforce|hybrid
|
|
518
|
+
const atypicalEnforce = atypicalRuntimeEnabled && atypicalMode !== 'monitor' && atypicalCfg.enforce !== false;
|
|
519
|
+
const atypicalSchedule = this._evaluateAtypicalSchedule({ ...atypicalCfg, enabled: atypicalRuntimeEnabled }, now);
|
|
510
520
|
const atypicalTarget = this._calculateAtypicalTarget(atypicalCfg);
|
|
511
521
|
const atypicalLimitCandidateW = (atypicalSchedule.active && atypicalEnforce && atypicalTarget.targetLimitW > 0) ? atypicalTarget.targetLimitW : 0;
|
|
512
522
|
const atypicalWantsPowerLimit = atypicalLimitCandidateW > 0;
|
|
@@ -543,7 +553,7 @@ class PeakShavingModule extends BaseModule {
|
|
|
543
553
|
let staleTimeoutSec = num(cfg.staleTimeoutSec, 300);
|
|
544
554
|
staleTimeoutSec = clamp(staleTimeoutSec, 1, 3600);
|
|
545
555
|
const staleMaxAgeMs = staleTimeoutSec * 1000;
|
|
546
|
-
const wantsPowerLimit = (typeof plantLimitW === 'number' && plantLimitW > 0) || atypicalWantsPowerLimit;
|
|
556
|
+
const wantsPowerLimit = (standardLimitEnabled && typeof plantLimitW === 'number' && plantLimitW > 0) || atypicalWantsPowerLimit;
|
|
547
557
|
const wantsPhaseLimit = (phaseMode === 'info' || phaseMode === 'enforce') && typeof maxPhaseA === 'number' && maxPhaseA > 0;
|
|
548
558
|
let staleMeter = false;
|
|
549
559
|
const staleKeys = [];
|
|
@@ -610,7 +620,7 @@ class PeakShavingModule extends BaseModule {
|
|
|
610
620
|
let reserveW = num(cfg.reserveW, 0);
|
|
611
621
|
let limitSource = '';
|
|
612
622
|
|
|
613
|
-
if (mode === 'dynamic') {
|
|
623
|
+
if (standardLimitEnabled && mode === 'dynamic') {
|
|
614
624
|
allowedPowerW = this.dp.getNumber('ps.allowedPowerW', null);
|
|
615
625
|
// Central plant limit is a hard cap (if configured). If not configured, allow dynamic DP only.
|
|
616
626
|
const baseMax = (typeof plantLimitW === 'number' && plantLimitW > 0) ? plantLimitW : Number.POSITIVE_INFINITY;
|
|
@@ -618,11 +628,15 @@ class PeakShavingModule extends BaseModule {
|
|
|
618
628
|
limitW = Math.min(baseMax, allowed) - Math.max(0, reserveW);
|
|
619
629
|
if (!Number.isFinite(limitW)) limitW = 0;
|
|
620
630
|
if (limitW > 0) limitSource = (Number.isFinite(baseMax) && Number.isFinite(allowed)) ? 'standard+dynamic' : (Number.isFinite(allowed) ? 'dynamic' : 'standard');
|
|
621
|
-
} else {
|
|
631
|
+
} else if (standardLimitEnabled) {
|
|
622
632
|
// static: fester Grenzwert, aber Reserve ebenfalls abziehen (Reserve ist keine dynamic-only Funktion)
|
|
623
633
|
const base = (typeof plantLimitW === 'number' && plantLimitW > 0) ? plantLimitW : 0;
|
|
624
634
|
limitW = Math.max(0, base - Math.max(0, reserveW));
|
|
625
635
|
if (limitW > 0) limitSource = 'standard';
|
|
636
|
+
} else {
|
|
637
|
+
// Atypisch-only/Monitor: kein permanenter Standard-Cap außerhalb der HLZF.
|
|
638
|
+
limitW = 0;
|
|
639
|
+
limitSource = '';
|
|
626
640
|
}
|
|
627
641
|
|
|
628
642
|
if (atypicalWantsPowerLimit) {
|
|
@@ -664,7 +678,7 @@ class PeakShavingModule extends BaseModule {
|
|
|
664
678
|
}
|
|
665
679
|
|
|
666
680
|
await this._publishAtypicalDiagnostics({
|
|
667
|
-
enabled: !!
|
|
681
|
+
enabled: !!atypicalRuntimeEnabled,
|
|
668
682
|
mode: atypicalMode,
|
|
669
683
|
enforce: atypicalEnforce,
|
|
670
684
|
schedule: atypicalSchedule,
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "nexowatt-ui",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.28",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.7.28": {
|
|
7
|
+
"en": "Peak-Shaving App-Center tab added: installers can now choose standard peak shaving, atypical high-load-window capping, hybrid mode or monitoring, configure §19 reference peak/threshold/minimum shift, calendar exceptions and high-load windows directly in the UI.",
|
|
8
|
+
"de": "Peak-Shaving-Reiter im App-Center ergänzt: Installateure können jetzt normale Lastspitzenkappung, atypische Hochlastzeitfenster-Kappung, Hybrid-Modus oder Monitoring wählen und §19-Referenzpeak, Schwelle, Mindestverlagerung, Kalenderausnahmen sowie Hochlastzeitfenster direkt in der UI konfigurieren."
|
|
9
|
+
},
|
|
6
10
|
"0.7.27": {
|
|
7
11
|
"en": "Added atypical peak shaving for high-load time windows. Peak-Shaving can now enforce an additional §19-style HLZF import cap, publish diagnostics under peakShaving.atypical.*, and feed the resulting limit into the central EMS caps through the existing peakShaving.control.limitW path.",
|
|
8
12
|
"de": "Atypische Lastspitzenkappung für Hochlastzeitfenster ergänzt. Peak-Shaving kann jetzt einen zusätzlichen §19-HLZF-Netzbezugscap anwenden, Diagnosewerte unter peakShaving.atypical.* veröffentlichen und das resultierende Limit über den bestehenden peakShaving.control.limitW-Pfad in die zentralen EMS-Caps einspeisen."
|
|
@@ -1937,12 +1941,26 @@
|
|
|
1937
1941
|
"holidays": [],
|
|
1938
1942
|
"bridgeDays": [],
|
|
1939
1943
|
"calendarExceptions": []
|
|
1940
|
-
}
|
|
1944
|
+
},
|
|
1945
|
+
"strategyMode": "standard",
|
|
1946
|
+
"mode": "static",
|
|
1947
|
+
"reserveW": 0,
|
|
1948
|
+
"safetyMarginW": 0,
|
|
1949
|
+
"hysteresisW": 500,
|
|
1950
|
+
"smoothingSeconds": 10,
|
|
1951
|
+
"activateDelaySeconds": 2,
|
|
1952
|
+
"releaseDelaySeconds": 5,
|
|
1953
|
+
"staleTimeoutSec": 300,
|
|
1954
|
+
"fastTripEnabled": true
|
|
1941
1955
|
}
|
|
1942
1956
|
},
|
|
1943
1957
|
"instanceObjects": [],
|
|
1944
|
-
"version": "0.7.
|
|
1958
|
+
"version": "0.7.28",
|
|
1945
1959
|
"news": {
|
|
1960
|
+
"0.7.28": {
|
|
1961
|
+
"en": "Peak-Shaving App-Center tab added: installers can now configure standard, atypical HLZF, hybrid or monitoring modes directly in the UI.",
|
|
1962
|
+
"de": "Peak-Shaving-Reiter im App-Center ergänzt: Installateure können Normalbetrieb, atypische HLZF-Kappung, Hybrid oder Monitoring direkt in der UI konfigurieren."
|
|
1963
|
+
},
|
|
1946
1964
|
"0.7.27": {
|
|
1947
1965
|
"en": "Added atypical peak shaving for high-load time windows. Peak-Shaving can now enforce an additional §19-style HLZF import cap, publish diagnostics under peakShaving.atypical.*, and feed the resulting limit into the central EMS caps through the existing peakShaving.control.limitW path.",
|
|
1948
1966
|
"de": "Atypische Lastspitzenkappung für Hochlastzeitfenster ergänzt. Peak-Shaving kann jetzt einen zusätzlichen §19-HLZF-Netzbezugscap anwenden, Diagnosewerte unter peakShaving.atypical.* veröffentlichen und das resultierende Limit über den bestehenden peakShaving.control.limitW-Pfad in die zentralen EMS-Caps einspeisen."
|
package/main.js
CHANGED
|
@@ -2147,6 +2147,10 @@ class NexoWattVis extends utils.Adapter {
|
|
|
2147
2147
|
try {
|
|
2148
2148
|
const ps = (out.peakShaving && typeof out.peakShaving === 'object' && !Array.isArray(out.peakShaving)) ? out.peakShaving : {};
|
|
2149
2149
|
out.peakShaving = ps;
|
|
2150
|
+
if (typeof ps.strategyMode !== 'string' || !['standard', 'atypical', 'hybrid', 'monitor'].includes(String(ps.strategyMode).trim().toLowerCase())) {
|
|
2151
|
+
ps.strategyMode = (ps.atypical && ps.atypical.enabled === true) ? 'hybrid' : 'standard';
|
|
2152
|
+
changed = true;
|
|
2153
|
+
}
|
|
2150
2154
|
if (!this._nwIsPlainObject(ps.atypical)) {
|
|
2151
2155
|
ps.atypical = {
|
|
2152
2156
|
enabled: false,
|
|
@@ -9398,7 +9402,7 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
|
|
|
9398
9402
|
// The runtime remains backward compatible by mapping App states to existing enable* flags.
|
|
9399
9403
|
const _nwAppCatalog = [
|
|
9400
9404
|
{ id: 'charging', label: 'Lademanagement', desc: 'PV-Überschussladen, Budget, Ladepunkte/Connectors', enableFlag: 'enableChargingManagement', mandatory: false },
|
|
9401
|
-
{ id: 'peak', label: 'Peak-Shaving', desc: 'Lastspitzenkappung / Import-Limit', enableFlag: 'enablePeakShaving', mandatory: false },
|
|
9405
|
+
{ id: 'peak', label: 'Peak-Shaving', desc: 'Lastspitzenkappung / Import-Limit / Atypische HLZF', enableFlag: 'enablePeakShaving', mandatory: false },
|
|
9402
9406
|
{ id: 'storage', label: 'Speicherregelung', desc: 'Eigenverbrauch / Speicher-Setpoints (herstellerunabhängig)', enableFlag: 'enableStorageControl', mandatory: false },
|
|
9403
9407
|
{ id: 'storagefarm', label: 'Speicherfarm', desc: 'Mehrere Speichersysteme als Pool/Gruppen', enableFlag: 'enableStorageFarm', mandatory: false },
|
|
9404
9408
|
{ id: 'thermal', label: 'Wärmepumpe & Klima', desc: 'PV-Überschuss-Steuerung (Setpoint, On/Off oder SG-Ready) mit Schnellsteuerung', enableFlag: 'enableThermalControl', mandatory: false },
|
package/package.json
CHANGED
package/www/ems-apps.html
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
<div class="nw-tabs" id="nw-ems-tabs">
|
|
48
48
|
<button type="button" class="nw-tab nw-tab--active" data-tab="apps">Apps</button>
|
|
49
49
|
<button type="button" class="nw-tab" data-tab="mapping">Zuordnung</button>
|
|
50
|
+
<button type="button" class="nw-tab" data-tab="peakconfig">Peak-Shaving</button>
|
|
50
51
|
<button type="button" class="nw-tab" data-tab="storagefarm">Speicherfarm</button>
|
|
51
52
|
<button type="button" class="nw-tab" data-tab="multiuse">MultiUse</button>
|
|
52
53
|
<button type="button" class="nw-tab" data-tab="flow">Energiefluss</button>
|
|
@@ -79,6 +80,243 @@
|
|
|
79
80
|
|
|
80
81
|
</div>
|
|
81
82
|
|
|
83
|
+
|
|
84
|
+
<div id="nw-tabpanel-peakconfig" data-tabpanel="peakconfig" style="display:none;">
|
|
85
|
+
|
|
86
|
+
<section class="nw-config-section">
|
|
87
|
+
<div class="nw-config-section__head">
|
|
88
|
+
<div>
|
|
89
|
+
<h2 class="nw-config-section__title">Peak-Shaving / Lastspitzenkappung</h2>
|
|
90
|
+
<div class="nw-config-section__subtitle" style="margin:0;opacity:.85;line-height:1.35;">
|
|
91
|
+
Einstellzentrale für normale Lastspitzenkappung, atypische HLZF-Kappung und Hybrid-Betrieb. Die Netzpunkt-Messung kommt weiterhin aus <b>Zuordnung → Allgemein</b>.
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div class="nw-config-grid" style="margin-top:12px;">
|
|
97
|
+
<div class="nw-config-card">
|
|
98
|
+
<div class="nw-config-card__header">
|
|
99
|
+
<div class="nw-config-card__title">Betriebsart</div>
|
|
100
|
+
<div class="nw-config-card__subtitle">Welche LSK-Logik soll der EMS-Core aktiv nutzen?</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="nw-config-card__body">
|
|
103
|
+
<div class="nw-config-field-row">
|
|
104
|
+
<label class="nw-config-field-label" for="psStrategyMode">LSK-Modus</label>
|
|
105
|
+
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
106
|
+
<select id="psStrategyMode" class="nw-config-input">
|
|
107
|
+
<option value="standard">Normale Lastspitzenkappung</option>
|
|
108
|
+
<option value="atypical">Atypische HLZF-Kappung</option>
|
|
109
|
+
<option value="hybrid">Hybrid: normal + atypisch</option>
|
|
110
|
+
<option value="monitor">Atypisch nur beobachten</option>
|
|
111
|
+
</select>
|
|
112
|
+
<div class="nw-config-help" style="margin-top:4px;opacity:.85;line-height:1.35;">
|
|
113
|
+
<b>Normal</b> begrenzt den Netzbezug immer am eingestellten Grenzwert. <b>Atypisch</b> begrenzt nur innerhalb der Hochlastzeitfenster. <b>Hybrid</b> nimmt immer den strengeren Grenzwert.
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div class="nw-config-field-row">
|
|
119
|
+
<label class="nw-config-field-label" for="psStandardMode">Standard-Limitquelle</label>
|
|
120
|
+
<div class="nw-config-field-control">
|
|
121
|
+
<select id="psStandardMode" class="nw-config-input">
|
|
122
|
+
<option value="static">Statisch: Netzanschlussleistung</option>
|
|
123
|
+
<option value="dynamic">Dynamisch: erlaubte Leistung per DP</option>
|
|
124
|
+
</select>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div class="nw-config-field-row">
|
|
129
|
+
<label class="nw-config-field-label" for="psReserveW">Reserve normal (W)</label>
|
|
130
|
+
<div class="nw-config-field-control">
|
|
131
|
+
<input id="psReserveW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 500" />
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<div class="nw-config-field-row">
|
|
136
|
+
<label class="nw-config-field-label" for="psSafetyMarginW">Sicherheitsmarge normal (W)</label>
|
|
137
|
+
<div class="nw-config-field-control">
|
|
138
|
+
<input id="psSafetyMarginW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 1000" />
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class="nw-config-field-row">
|
|
143
|
+
<label class="nw-config-field-label" for="psHysteresisW">Hysterese (W)</label>
|
|
144
|
+
<div class="nw-config-field-control">
|
|
145
|
+
<input id="psHysteresisW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 500" />
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<div class="nw-config-card">
|
|
152
|
+
<div class="nw-config-card__header">
|
|
153
|
+
<div class="nw-config-card__title">Regelverhalten</div>
|
|
154
|
+
<div class="nw-config-card__subtitle">Glättung, Verzögerung und Failsafe für reale Messwerte</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="nw-config-card__body">
|
|
157
|
+
<div class="nw-config-field-row">
|
|
158
|
+
<label class="nw-config-field-label" for="psSmoothingSeconds">Glättung (s)</label>
|
|
159
|
+
<div class="nw-config-field-control">
|
|
160
|
+
<input id="psSmoothingSeconds" class="nw-config-input" type="number" min="1" max="600" step="1" placeholder="10" />
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="nw-config-field-row">
|
|
164
|
+
<label class="nw-config-field-label" for="psActivateDelaySeconds">Einschaltverzögerung (s)</label>
|
|
165
|
+
<div class="nw-config-field-control">
|
|
166
|
+
<input id="psActivateDelaySeconds" class="nw-config-input" type="number" min="0" max="3600" step="1" placeholder="2" />
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="nw-config-field-row">
|
|
170
|
+
<label class="nw-config-field-label" for="psReleaseDelaySeconds">Freigabeverzögerung (s)</label>
|
|
171
|
+
<div class="nw-config-field-control">
|
|
172
|
+
<input id="psReleaseDelaySeconds" class="nw-config-input" type="number" min="0" max="3600" step="1" placeholder="5" />
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="nw-config-field-row">
|
|
176
|
+
<label class="nw-config-field-label" for="psStaleTimeoutSec">Messwert-Timeout (s)</label>
|
|
177
|
+
<div class="nw-config-field-control">
|
|
178
|
+
<input id="psStaleTimeoutSec" class="nw-config-input" type="number" min="1" max="3600" step="1" placeholder="300" />
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
<div class="nw-config-field-row">
|
|
182
|
+
<label class="nw-config-field-label" for="psFastTripEnabled">Fast-Trip</label>
|
|
183
|
+
<div class="nw-config-field-control" style="display:flex;align-items:center;gap:10px;">
|
|
184
|
+
<input id="psFastTripEnabled" class="nw-config-checkbox" type="checkbox" />
|
|
185
|
+
<span class="nw-config-field-hint" style="margin:0;">Schnelle Reaktion auf kurze Rohwert-/Maximalwert-Spitzen</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div class="nw-config-card">
|
|
192
|
+
<div class="nw-config-card__header">
|
|
193
|
+
<div class="nw-config-card__title">Atypische Netznutzung (§19)</div>
|
|
194
|
+
<div class="nw-config-card__subtitle">Zielwert für Hochlastzeitfenster aus Referenz-Peak, Entnahmeebene und Mindestverlagerung</div>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="nw-config-card__body">
|
|
197
|
+
<div class="nw-config-field-row">
|
|
198
|
+
<label class="nw-config-field-label" for="psAtypicalVoltageLevel">Entnahmeebene</label>
|
|
199
|
+
<div class="nw-config-field-control">
|
|
200
|
+
<select id="psAtypicalVoltageLevel" class="nw-config-input">
|
|
201
|
+
<option value="HOS">HöS</option>
|
|
202
|
+
<option value="HOS/HS">HöS/HS</option>
|
|
203
|
+
<option value="HS">HS</option>
|
|
204
|
+
<option value="HS/MS">HS/MS</option>
|
|
205
|
+
<option value="MS">MS</option>
|
|
206
|
+
<option value="MS/NS">MS/NS</option>
|
|
207
|
+
<option value="NS">NS</option>
|
|
208
|
+
</select>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div class="nw-config-field-row">
|
|
213
|
+
<label class="nw-config-field-label" for="psAtypicalThresholdPercent">Erheblichkeitsschwelle (%)</label>
|
|
214
|
+
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
215
|
+
<div style="display:flex;gap:8px;align-items:center;">
|
|
216
|
+
<input id="psAtypicalThresholdPercent" class="nw-config-input" type="number" min="0" max="100" step="0.1" placeholder="z.B. 20" />
|
|
217
|
+
<button id="psAtypicalApplyVoltageThreshold" type="button" class="nw-config-btn nw-config-btn--ghost">aus Ebene</button>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="nw-config-help" style="margin-top:4px;opacity:.85;">HöS 5 %, HöS/HS 10 %, HS 10 %, HS/MS 20 %, MS 20 %, MS/NS 30 %, NS 30 %.</div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<div class="nw-config-field-row">
|
|
224
|
+
<label class="nw-config-field-label" for="psAtypicalPAbsRefW">Referenz-Jahreshöchstlast P_abs_ref (W)</label>
|
|
225
|
+
<div class="nw-config-field-control">
|
|
226
|
+
<input id="psAtypicalPAbsRefW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 1000000" />
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<div class="nw-config-field-row">
|
|
231
|
+
<label class="nw-config-field-label" for="psAtypicalMinShiftW">Mindestverlagerung (W)</label>
|
|
232
|
+
<div class="nw-config-field-control">
|
|
233
|
+
<input id="psAtypicalMinShiftW" class="nw-config-input" type="number" min="0" step="100" placeholder="100000" />
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<div class="nw-config-field-row">
|
|
238
|
+
<label class="nw-config-field-label" for="psAtypicalTargetLimitW">Fester HLZF-Grenzwert (W, optional)</label>
|
|
239
|
+
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
240
|
+
<input id="psAtypicalTargetLimitW" class="nw-config-input" type="number" min="0" step="100" placeholder="leer = automatisch berechnen" />
|
|
241
|
+
<div class="nw-config-help" style="margin-top:4px;opacity:.85;">Leer lassen, wenn der Grenzwert aus P_abs_ref, Schwelle und Mindestverlagerung berechnet werden soll.</div>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<div class="nw-config-field-row">
|
|
246
|
+
<label class="nw-config-field-label" for="psAtypicalSafetyMarginW">HLZF-Sicherheitsmarge (W)</label>
|
|
247
|
+
<div class="nw-config-field-control">
|
|
248
|
+
<input id="psAtypicalSafetyMarginW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 2000" />
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div class="nw-config-card">
|
|
255
|
+
<div class="nw-config-card__header">
|
|
256
|
+
<div class="nw-config-card__title">Kalender / Ausnahmen</div>
|
|
257
|
+
<div class="nw-config-card__subtitle">Tage, an denen keine Hochlastzeitfenster gelten sollen</div>
|
|
258
|
+
</div>
|
|
259
|
+
<div class="nw-config-card__body">
|
|
260
|
+
<div class="nw-config-field-row">
|
|
261
|
+
<label class="nw-config-field-label" for="psAtypicalIncludeWeekends">Wochenenden berücksichtigen</label>
|
|
262
|
+
<div class="nw-config-field-control" style="display:flex;align-items:center;gap:10px;">
|
|
263
|
+
<input id="psAtypicalIncludeWeekends" class="nw-config-checkbox" type="checkbox" />
|
|
264
|
+
<span class="nw-config-field-hint" style="margin:0;">Standard: aus, da HLZF typischerweise nur an Werktagen aktiv sind.</span>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
<div class="nw-config-field-row">
|
|
268
|
+
<label class="nw-config-field-label" for="psAtypicalExcludeChristmasNewYear">24.12.–01.01. ausschließen</label>
|
|
269
|
+
<div class="nw-config-field-control" style="display:flex;align-items:center;gap:10px;">
|
|
270
|
+
<input id="psAtypicalExcludeChristmasNewYear" class="nw-config-checkbox" type="checkbox" />
|
|
271
|
+
<span class="nw-config-field-hint" style="margin:0;">Empfohlen aktiv lassen.</span>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
<div class="nw-config-field-row" style="align-items:flex-start;">
|
|
275
|
+
<label class="nw-config-field-label" for="psAtypicalHolidays">Feiertage</label>
|
|
276
|
+
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
277
|
+
<textarea id="psAtypicalHolidays" class="nw-config-input" rows="4" placeholder="2026-01-01 2026-04-03"></textarea>
|
|
278
|
+
<div class="nw-config-help" style="margin-top:4px;opacity:.85;">Ein Datum pro Zeile oder kommasepariert im Format YYYY-MM-DD.</div>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
<div class="nw-config-field-row" style="align-items:flex-start;">
|
|
282
|
+
<label class="nw-config-field-label" for="psAtypicalBridgeDays">Brückentage</label>
|
|
283
|
+
<div class="nw-config-field-control">
|
|
284
|
+
<textarea id="psAtypicalBridgeDays" class="nw-config-input" rows="3" placeholder="2026-05-15"></textarea>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
<div class="nw-config-field-row" style="align-items:flex-start;">
|
|
288
|
+
<label class="nw-config-field-label" for="psAtypicalCalendarExceptions">Weitere Ausnahmen</label>
|
|
289
|
+
<div class="nw-config-field-control">
|
|
290
|
+
<textarea id="psAtypicalCalendarExceptions" class="nw-config-input" rows="3" placeholder="2026-12-24"></textarea>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
<div class="nw-config-card" style="grid-column:1 / -1;">
|
|
297
|
+
<div class="nw-config-card__header">
|
|
298
|
+
<div class="nw-config-card__header-top">
|
|
299
|
+
<div>
|
|
300
|
+
<div class="nw-config-card__title">Hochlastzeitfenster</div>
|
|
301
|
+
<div class="nw-config-card__subtitle">Zeitfenster pro Saison/Monat. Mehrere Fenster pro Tag sind möglich.</div>
|
|
302
|
+
</div>
|
|
303
|
+
<div class="nw-config-row__actions">
|
|
304
|
+
<button id="psAtypicalAddWindow" type="button" class="nw-config-btn nw-config-btn--ghost">+ Fenster</button>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
<div class="nw-config-card__body">
|
|
309
|
+
<div class="nw-config-empty" style="margin:0 0 8px 0;">
|
|
310
|
+
Wochentage: ISO-Format 1=Mo … 7=So. Monate: 1–12. Wenn Monate leer sind, wird die Saison genutzt: Winter = 12/1/2, Sommer = 6/7/8, Übergang = 3/4/5/9/10/11.
|
|
311
|
+
</div>
|
|
312
|
+
<div id="psAtypicalWindows" class="nw-config-list"></div>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
</section>
|
|
317
|
+
|
|
318
|
+
</div>
|
|
319
|
+
|
|
82
320
|
<div id="nw-tabpanel-mapping" data-tabpanel="mapping" style="display:none;">
|
|
83
321
|
|
|
84
322
|
<section class="nw-config-section">
|
package/www/ems-apps.js
CHANGED
|
@@ -78,6 +78,32 @@
|
|
|
78
78
|
para14aConsumers: document.getElementById('para14aConsumers'),
|
|
79
79
|
addPara14aConsumer: document.getElementById('addPara14aConsumer'),
|
|
80
80
|
|
|
81
|
+
// Peak-Shaving / Lastspitzenkappung
|
|
82
|
+
psStrategyMode: document.getElementById('psStrategyMode'),
|
|
83
|
+
psStandardMode: document.getElementById('psStandardMode'),
|
|
84
|
+
psReserveW: document.getElementById('psReserveW'),
|
|
85
|
+
psSafetyMarginW: document.getElementById('psSafetyMarginW'),
|
|
86
|
+
psHysteresisW: document.getElementById('psHysteresisW'),
|
|
87
|
+
psSmoothingSeconds: document.getElementById('psSmoothingSeconds'),
|
|
88
|
+
psActivateDelaySeconds: document.getElementById('psActivateDelaySeconds'),
|
|
89
|
+
psReleaseDelaySeconds: document.getElementById('psReleaseDelaySeconds'),
|
|
90
|
+
psStaleTimeoutSec: document.getElementById('psStaleTimeoutSec'),
|
|
91
|
+
psFastTripEnabled: document.getElementById('psFastTripEnabled'),
|
|
92
|
+
psAtypicalVoltageLevel: document.getElementById('psAtypicalVoltageLevel'),
|
|
93
|
+
psAtypicalThresholdPercent: document.getElementById('psAtypicalThresholdPercent'),
|
|
94
|
+
psAtypicalApplyVoltageThreshold: document.getElementById('psAtypicalApplyVoltageThreshold'),
|
|
95
|
+
psAtypicalPAbsRefW: document.getElementById('psAtypicalPAbsRefW'),
|
|
96
|
+
psAtypicalMinShiftW: document.getElementById('psAtypicalMinShiftW'),
|
|
97
|
+
psAtypicalTargetLimitW: document.getElementById('psAtypicalTargetLimitW'),
|
|
98
|
+
psAtypicalSafetyMarginW: document.getElementById('psAtypicalSafetyMarginW'),
|
|
99
|
+
psAtypicalIncludeWeekends: document.getElementById('psAtypicalIncludeWeekends'),
|
|
100
|
+
psAtypicalExcludeChristmasNewYear: document.getElementById('psAtypicalExcludeChristmasNewYear'),
|
|
101
|
+
psAtypicalHolidays: document.getElementById('psAtypicalHolidays'),
|
|
102
|
+
psAtypicalBridgeDays: document.getElementById('psAtypicalBridgeDays'),
|
|
103
|
+
psAtypicalCalendarExceptions: document.getElementById('psAtypicalCalendarExceptions'),
|
|
104
|
+
psAtypicalWindows: document.getElementById('psAtypicalWindows'),
|
|
105
|
+
psAtypicalAddWindow: document.getElementById('psAtypicalAddWindow'),
|
|
106
|
+
|
|
81
107
|
// Tabs
|
|
82
108
|
tabs: document.getElementById('nw-ems-tabs'),
|
|
83
109
|
|
|
@@ -176,6 +202,104 @@
|
|
|
176
202
|
{ id: 'multiuse', label: 'MultiUse', desc: 'Speicher Multi‑Use (SoC‑Zonen: Notstrom/LSK/Eigenverbrauch)', mandatory: false }
|
|
177
203
|
];
|
|
178
204
|
|
|
205
|
+
|
|
206
|
+
const PS_VOLTAGE_THRESHOLDS = Object.freeze({
|
|
207
|
+
HOS: 5,
|
|
208
|
+
'HOS/HS': 10,
|
|
209
|
+
HS: 10,
|
|
210
|
+
'HS/MS': 20,
|
|
211
|
+
MS: 20,
|
|
212
|
+
'MS/NS': 30,
|
|
213
|
+
NS: 30,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
function _psVoltageKey(v) {
|
|
217
|
+
const s = String(v || 'MS').trim().toUpperCase().replace(/Ö/g, 'O').replace(/Ü/g, 'U').replace(/Ä/g, 'A');
|
|
218
|
+
if (s === 'HÖS' || s === 'HOS') return 'HOS';
|
|
219
|
+
if (s === 'HÖS/HS' || s === 'HOS/HS' || s === 'HOES/HS') return 'HOS/HS';
|
|
220
|
+
if (s === 'HS/MS') return 'HS/MS';
|
|
221
|
+
if (s === 'MS/NS') return 'MS/NS';
|
|
222
|
+
if (s === 'HS' || s === 'MS' || s === 'NS') return s;
|
|
223
|
+
return 'MS';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function _psThresholdForVoltage(v) {
|
|
227
|
+
const k = _psVoltageKey(v);
|
|
228
|
+
return Object.prototype.hasOwnProperty.call(PS_VOLTAGE_THRESHOLDS, k) ? PS_VOLTAGE_THRESHOLDS[k] : 20;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function _psNumOrNull(v) {
|
|
232
|
+
const n = Number(v);
|
|
233
|
+
return Number.isFinite(n) ? n : null;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function _psParseNumberList(value, min, max) {
|
|
237
|
+
const out = [];
|
|
238
|
+
const seen = new Set();
|
|
239
|
+
String(value || '')
|
|
240
|
+
.split(/[\s,;]+/)
|
|
241
|
+
.map(x => x.trim())
|
|
242
|
+
.filter(Boolean)
|
|
243
|
+
.forEach((x) => {
|
|
244
|
+
const n = Number(x);
|
|
245
|
+
if (!Number.isFinite(n)) return;
|
|
246
|
+
const i = Math.round(n);
|
|
247
|
+
if (Number.isFinite(min) && i < min) return;
|
|
248
|
+
if (Number.isFinite(max) && i > max) return;
|
|
249
|
+
if (seen.has(i)) return;
|
|
250
|
+
seen.add(i);
|
|
251
|
+
out.push(i);
|
|
252
|
+
});
|
|
253
|
+
out.sort((a, b) => a - b);
|
|
254
|
+
return out;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function _psFormatNumberList(arr) {
|
|
258
|
+
return Array.isArray(arr) ? arr.map(v => String(v)).join(',') : '';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function _psNormalizeDateToken(token) {
|
|
262
|
+
const s = String(token || '').trim();
|
|
263
|
+
if (!s) return '';
|
|
264
|
+
const m = s.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
265
|
+
if (m) return `${m[1].padStart(4, '0')}-${m[2].padStart(2, '0')}-${m[3].padStart(2, '0')}`;
|
|
266
|
+
return s;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function _psParseDateList(value) {
|
|
270
|
+
const out = [];
|
|
271
|
+
const seen = new Set();
|
|
272
|
+
String(value || '')
|
|
273
|
+
.split(/[\n,;]+/)
|
|
274
|
+
.map(_psNormalizeDateToken)
|
|
275
|
+
.filter(Boolean)
|
|
276
|
+
.forEach((x) => {
|
|
277
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(x)) return;
|
|
278
|
+
if (seen.has(x)) return;
|
|
279
|
+
seen.add(x);
|
|
280
|
+
out.push(x);
|
|
281
|
+
});
|
|
282
|
+
out.sort();
|
|
283
|
+
return out;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function _psFormatDateList(arr) {
|
|
287
|
+
return Array.isArray(arr) ? arr.map(v => String(v)).filter(Boolean).join('\n') : '';
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function _psSetNumberInput(el, value) {
|
|
291
|
+
if (!el) return;
|
|
292
|
+
const n = Number(value);
|
|
293
|
+
el.value = Number.isFinite(n) ? String(n) : '';
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function _psSetSelect(el, value, fallback) {
|
|
297
|
+
if (!el) return;
|
|
298
|
+
const v = String(value || fallback || '').trim();
|
|
299
|
+
const options = Array.from(el.options || []).map(o => o.value);
|
|
300
|
+
el.value = options.includes(v) ? v : (fallback || (options[0] || ''));
|
|
301
|
+
}
|
|
302
|
+
|
|
179
303
|
// Energiefluss-Monitor: Basis-Datapoints (VIS & Algorithmen)
|
|
180
304
|
const FLOW_BASE_DP_FIELDS = [
|
|
181
305
|
{ key: 'gridBuyPower', label: 'Netz Bezug (W/kW)', placeholder: '… (Import)', required: true, requiredGroup: 'gridPairOrSigned', power: true,
|
|
@@ -673,7 +797,7 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
673
797
|
if (app.id === 'peak') {
|
|
674
798
|
const row = document.createElement('div');
|
|
675
799
|
row.className = 'nw-config-card__row';
|
|
676
|
-
row.textContent = '
|
|
800
|
+
row.textContent = 'Konfiguration: Reiter „Peak-Shaving“. Dort normale LSK, atypische HLZF und Hybrid-Modus einstellen.';
|
|
677
801
|
body.appendChild(row);
|
|
678
802
|
}
|
|
679
803
|
|
|
@@ -736,6 +860,7 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
736
860
|
|
|
737
861
|
// Tabs: optional ein-/ausblenden (App-Center)
|
|
738
862
|
const tabMap = [
|
|
863
|
+
{ tab: 'peakconfig', app: 'peak' },
|
|
739
864
|
{ tab: 'thermal', app: 'thermal' },
|
|
740
865
|
{ tab: 'heatingrod', app: 'heatingrod' },
|
|
741
866
|
{ tab: 'bhkw', app: 'bhkw' },
|
|
@@ -764,6 +889,277 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
764
889
|
}
|
|
765
890
|
}
|
|
766
891
|
|
|
892
|
+
|
|
893
|
+
function _psDefaultWindow() {
|
|
894
|
+
return {
|
|
895
|
+
enabled: true,
|
|
896
|
+
label: 'HLZF',
|
|
897
|
+
season: 'winter',
|
|
898
|
+
months: [],
|
|
899
|
+
weekdays: [1, 2, 3, 4, 5],
|
|
900
|
+
from: '07:00',
|
|
901
|
+
to: '10:00',
|
|
902
|
+
validFrom: '',
|
|
903
|
+
validTo: '',
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function _psGetPeakCfg() {
|
|
908
|
+
currentConfig = currentConfig || {};
|
|
909
|
+
currentConfig.peakShaving = currentConfig.peakShaving && typeof currentConfig.peakShaving === 'object' ? currentConfig.peakShaving : {};
|
|
910
|
+
currentConfig.peakShaving.atypical = currentConfig.peakShaving.atypical && typeof currentConfig.peakShaving.atypical === 'object' ? currentConfig.peakShaving.atypical : {};
|
|
911
|
+
return currentConfig.peakShaving;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function _psGetWindowsFromCfg(cfg) {
|
|
915
|
+
const atypical = (cfg && cfg.atypical && typeof cfg.atypical === 'object') ? cfg.atypical : {};
|
|
916
|
+
if (Array.isArray(atypical.highLoadWindows)) return atypical.highLoadWindows;
|
|
917
|
+
if (Array.isArray(atypical.windows)) return atypical.windows;
|
|
918
|
+
return [];
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function buildAtypicalWindowsUI() {
|
|
922
|
+
if (!els.psAtypicalWindows) return;
|
|
923
|
+
const ps = _psGetPeakCfg();
|
|
924
|
+
const wins = _psGetWindowsFromCfg(ps);
|
|
925
|
+
els.psAtypicalWindows.innerHTML = '';
|
|
926
|
+
|
|
927
|
+
if (!wins.length) {
|
|
928
|
+
const empty = document.createElement('div');
|
|
929
|
+
empty.className = 'nw-config-empty';
|
|
930
|
+
empty.textContent = 'Noch keine Hochlastzeitfenster hinterlegt. Über „+ Fenster“ ein Zeitfenster hinzufügen.';
|
|
931
|
+
els.psAtypicalWindows.appendChild(empty);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
wins.forEach((win, idx) => {
|
|
935
|
+
const w = win && typeof win === 'object' ? win : {};
|
|
936
|
+
const row = document.createElement('div');
|
|
937
|
+
row.className = 'nw-config-card';
|
|
938
|
+
row.style.margin = '0 0 8px 0';
|
|
939
|
+
row.setAttribute('data-ps-hlzf-row', String(idx));
|
|
940
|
+
|
|
941
|
+
const header = document.createElement('div');
|
|
942
|
+
header.className = 'nw-config-card__header';
|
|
943
|
+
header.innerHTML = `
|
|
944
|
+
<div class="nw-config-card__header-top">
|
|
945
|
+
<div>
|
|
946
|
+
<div class="nw-config-card__title">Fenster ${idx + 1}</div>
|
|
947
|
+
<div class="nw-config-card__subtitle">Label, Saison/Monate, Wochentage und Uhrzeit</div>
|
|
948
|
+
</div>
|
|
949
|
+
<div class="nw-config-row__actions">
|
|
950
|
+
<button type="button" class="nw-config-btn nw-config-btn--ghost" data-ps-window-delete="${idx}">Entfernen</button>
|
|
951
|
+
</div>
|
|
952
|
+
</div>`;
|
|
953
|
+
|
|
954
|
+
const body = document.createElement('div');
|
|
955
|
+
body.className = 'nw-config-card__body';
|
|
956
|
+
body.innerHTML = `
|
|
957
|
+
<div class="nw-config-grid" style="grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;">
|
|
958
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
959
|
+
<span class="nw-config-field-label" style="width:auto;">Aktiv</span>
|
|
960
|
+
<input class="nw-config-checkbox" type="checkbox" data-ps-window-field="enabled" ${w.enabled === false ? '' : 'checked'} />
|
|
961
|
+
</label>
|
|
962
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
963
|
+
<span class="nw-config-field-label" style="width:auto;">Label</span>
|
|
964
|
+
<input class="nw-config-input" type="text" data-ps-window-field="label" value="${String(w.label || w.name || '').replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<')}" placeholder="z.B. Winter morgens" />
|
|
965
|
+
</label>
|
|
966
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
967
|
+
<span class="nw-config-field-label" style="width:auto;">Saison</span>
|
|
968
|
+
<select class="nw-config-input" data-ps-window-field="season">
|
|
969
|
+
<option value="">keine / Monate nutzen</option>
|
|
970
|
+
<option value="winter">Winter</option>
|
|
971
|
+
<option value="summer">Sommer</option>
|
|
972
|
+
<option value="transition">Übergang</option>
|
|
973
|
+
</select>
|
|
974
|
+
</label>
|
|
975
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
976
|
+
<span class="nw-config-field-label" style="width:auto;">Monate</span>
|
|
977
|
+
<input class="nw-config-input" type="text" data-ps-window-field="months" value="${_psFormatNumberList(w.months || w.month)}" placeholder="z.B. 1,2,12" />
|
|
978
|
+
</label>
|
|
979
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
980
|
+
<span class="nw-config-field-label" style="width:auto;">Wochentage</span>
|
|
981
|
+
<input class="nw-config-input" type="text" data-ps-window-field="weekdays" value="${_psFormatNumberList(w.weekdays || w.days)}" placeholder="1,2,3,4,5" />
|
|
982
|
+
</label>
|
|
983
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
984
|
+
<span class="nw-config-field-label" style="width:auto;">Von</span>
|
|
985
|
+
<input class="nw-config-input" type="time" data-ps-window-field="from" value="${String(w.from || w.start || w.startTime || '').replace(/"/g,'"')}" />
|
|
986
|
+
</label>
|
|
987
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
988
|
+
<span class="nw-config-field-label" style="width:auto;">Bis</span>
|
|
989
|
+
<input class="nw-config-input" type="time" data-ps-window-field="to" value="${String(w.to || w.end || w.endTime || '').replace(/"/g,'"')}" />
|
|
990
|
+
</label>
|
|
991
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
992
|
+
<span class="nw-config-field-label" style="width:auto;">Gültig von</span>
|
|
993
|
+
<input class="nw-config-input" type="date" data-ps-window-field="validFrom" value="${String(w.validFrom || w.validFromDate || '').replace(/"/g,'"')}" />
|
|
994
|
+
</label>
|
|
995
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
996
|
+
<span class="nw-config-field-label" style="width:auto;">Gültig bis</span>
|
|
997
|
+
<input class="nw-config-input" type="date" data-ps-window-field="validTo" value="${String(w.validTo || w.validToDate || '').replace(/"/g,'"')}" />
|
|
998
|
+
</label>
|
|
999
|
+
</div>`;
|
|
1000
|
+
row.appendChild(header);
|
|
1001
|
+
row.appendChild(body);
|
|
1002
|
+
els.psAtypicalWindows.appendChild(row);
|
|
1003
|
+
|
|
1004
|
+
const seasonSelect = row.querySelector('[data-ps-window-field="season"]');
|
|
1005
|
+
if (seasonSelect) {
|
|
1006
|
+
const sv = String(w.season || w.jahreszeit || '').trim().toLowerCase();
|
|
1007
|
+
if (['winter', 'summer', 'transition'].includes(sv)) seasonSelect.value = sv;
|
|
1008
|
+
else if (sv === 'sommer') seasonSelect.value = 'summer';
|
|
1009
|
+
else if (sv === 'uebergang' || sv === 'übergang') seasonSelect.value = 'transition';
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
function _psCollectWindowRows() {
|
|
1015
|
+
const out = [];
|
|
1016
|
+
if (!els.psAtypicalWindows) return out;
|
|
1017
|
+
const rows = Array.from(els.psAtypicalWindows.querySelectorAll('[data-ps-hlzf-row]'));
|
|
1018
|
+
for (const row of rows) {
|
|
1019
|
+
const get = (field) => row.querySelector(`[data-ps-window-field="${field}"]`);
|
|
1020
|
+
const enabledEl = get('enabled');
|
|
1021
|
+
const label = String((get('label') && get('label').value) || '').trim();
|
|
1022
|
+
const season = String((get('season') && get('season').value) || '').trim();
|
|
1023
|
+
const months = _psParseNumberList((get('months') && get('months').value) || '', 1, 12);
|
|
1024
|
+
const weekdays = _psParseNumberList((get('weekdays') && get('weekdays').value) || '', 0, 7);
|
|
1025
|
+
const from = String((get('from') && get('from').value) || '').trim();
|
|
1026
|
+
const to = String((get('to') && get('to').value) || '').trim();
|
|
1027
|
+
const validFrom = String((get('validFrom') && get('validFrom').value) || '').trim();
|
|
1028
|
+
const validTo = String((get('validTo') && get('validTo').value) || '').trim();
|
|
1029
|
+
const w = {
|
|
1030
|
+
enabled: enabledEl ? !!enabledEl.checked : true,
|
|
1031
|
+
...(label ? { label } : {}),
|
|
1032
|
+
...(season ? { season } : {}),
|
|
1033
|
+
...(months.length ? { months } : {}),
|
|
1034
|
+
...(weekdays.length ? { weekdays } : {}),
|
|
1035
|
+
...(from ? { from } : {}),
|
|
1036
|
+
...(to ? { to } : {}),
|
|
1037
|
+
...(validFrom ? { validFrom } : {}),
|
|
1038
|
+
...(validTo ? { validTo } : {}),
|
|
1039
|
+
};
|
|
1040
|
+
if (w.from && w.to) out.push(w);
|
|
1041
|
+
}
|
|
1042
|
+
return out;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function _psUpdateAtypicalFieldState() {
|
|
1046
|
+
const mode = els.psStrategyMode ? String(els.psStrategyMode.value || 'standard') : 'standard';
|
|
1047
|
+
const atypicalOn = mode === 'atypical' || mode === 'hybrid' || mode === 'monitor';
|
|
1048
|
+
const standardOn = mode === 'standard' || mode === 'hybrid';
|
|
1049
|
+
|
|
1050
|
+
const atypicalIds = [
|
|
1051
|
+
'psAtypicalVoltageLevel', 'psAtypicalThresholdPercent', 'psAtypicalApplyVoltageThreshold',
|
|
1052
|
+
'psAtypicalPAbsRefW', 'psAtypicalMinShiftW', 'psAtypicalTargetLimitW', 'psAtypicalSafetyMarginW',
|
|
1053
|
+
'psAtypicalIncludeWeekends', 'psAtypicalExcludeChristmasNewYear', 'psAtypicalHolidays',
|
|
1054
|
+
'psAtypicalBridgeDays', 'psAtypicalCalendarExceptions', 'psAtypicalAddWindow'
|
|
1055
|
+
];
|
|
1056
|
+
atypicalIds.forEach((id) => {
|
|
1057
|
+
const el = document.getElementById(id);
|
|
1058
|
+
if (el) el.disabled = !atypicalOn;
|
|
1059
|
+
});
|
|
1060
|
+
if (els.psAtypicalWindows) {
|
|
1061
|
+
els.psAtypicalWindows.querySelectorAll('input,select,textarea,button').forEach((el) => { el.disabled = !atypicalOn; });
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
const standardIds = ['psStandardMode', 'psReserveW'];
|
|
1065
|
+
standardIds.forEach((id) => {
|
|
1066
|
+
const el = document.getElementById(id);
|
|
1067
|
+
if (el) el.disabled = !standardOn;
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function buildPeakShavingUI() {
|
|
1072
|
+
if (!els.psStrategyMode) return;
|
|
1073
|
+
const ps = _psGetPeakCfg();
|
|
1074
|
+
const a = (ps.atypical && typeof ps.atypical === 'object') ? ps.atypical : {};
|
|
1075
|
+
|
|
1076
|
+
let strategy = String(ps.strategyMode || ps.strategy || '').trim().toLowerCase();
|
|
1077
|
+
if (!['standard', 'atypical', 'hybrid', 'monitor'].includes(strategy)) {
|
|
1078
|
+
strategy = a.enabled ? String(a.mode || 'hybrid').trim().toLowerCase() : 'standard';
|
|
1079
|
+
if (!['atypical', 'hybrid', 'monitor'].includes(strategy)) strategy = a.enabled ? 'hybrid' : 'standard';
|
|
1080
|
+
}
|
|
1081
|
+
_psSetSelect(els.psStrategyMode, strategy, 'standard');
|
|
1082
|
+
_psSetSelect(els.psStandardMode, String(ps.mode || 'static'), 'static');
|
|
1083
|
+
_psSetNumberInput(els.psReserveW, ps.reserveW);
|
|
1084
|
+
_psSetNumberInput(els.psSafetyMarginW, ps.safetyMarginW);
|
|
1085
|
+
_psSetNumberInput(els.psHysteresisW, ps.hysteresisW);
|
|
1086
|
+
_psSetNumberInput(els.psSmoothingSeconds, ps.smoothingSeconds);
|
|
1087
|
+
_psSetNumberInput(els.psActivateDelaySeconds, ps.activateDelaySeconds);
|
|
1088
|
+
_psSetNumberInput(els.psReleaseDelaySeconds, ps.releaseDelaySeconds);
|
|
1089
|
+
_psSetNumberInput(els.psStaleTimeoutSec, ps.staleTimeoutSec);
|
|
1090
|
+
if (els.psFastTripEnabled) els.psFastTripEnabled.checked = ps.fastTripEnabled !== false;
|
|
1091
|
+
|
|
1092
|
+
const vLevel = _psVoltageKey(a.voltageLevel || 'MS');
|
|
1093
|
+
_psSetSelect(els.psAtypicalVoltageLevel, vLevel, 'MS');
|
|
1094
|
+
const threshold = Number.isFinite(Number(a.thresholdPercent)) ? Number(a.thresholdPercent) : _psThresholdForVoltage(vLevel);
|
|
1095
|
+
_psSetNumberInput(els.psAtypicalThresholdPercent, threshold);
|
|
1096
|
+
_psSetNumberInput(els.psAtypicalPAbsRefW, a.annualPeakReferenceW ?? a.pAbsRefW ?? a.pAbsMaxW ?? a.referencePeakW ?? a.referencePeakPowerW);
|
|
1097
|
+
_psSetNumberInput(els.psAtypicalMinShiftW, a.minShiftW ?? 100000);
|
|
1098
|
+
_psSetNumberInput(els.psAtypicalTargetLimitW, a.targetLimitW ?? a.hlzfTargetW ?? a.highLoadLimitW ?? a.capW);
|
|
1099
|
+
_psSetNumberInput(els.psAtypicalSafetyMarginW, a.safetyMarginW);
|
|
1100
|
+
if (els.psAtypicalIncludeWeekends) els.psAtypicalIncludeWeekends.checked = a.includeWeekends === true;
|
|
1101
|
+
if (els.psAtypicalExcludeChristmasNewYear) els.psAtypicalExcludeChristmasNewYear.checked = a.excludeChristmasNewYear !== false;
|
|
1102
|
+
if (els.psAtypicalHolidays) els.psAtypicalHolidays.value = _psFormatDateList(a.holidays || a.holidayDates || []);
|
|
1103
|
+
if (els.psAtypicalBridgeDays) els.psAtypicalBridgeDays.value = _psFormatDateList(a.bridgeDays || a.bridgeDayDates || []);
|
|
1104
|
+
if (els.psAtypicalCalendarExceptions) els.psAtypicalCalendarExceptions.value = _psFormatDateList(a.calendarExceptions || a.exceptions || []);
|
|
1105
|
+
|
|
1106
|
+
buildAtypicalWindowsUI();
|
|
1107
|
+
_psUpdateAtypicalFieldState();
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
function collectPeakShavingConfigFromUI(baseCfg) {
|
|
1111
|
+
const out = deepMerge({}, baseCfg || {});
|
|
1112
|
+
if (!els.psStrategyMode) return out;
|
|
1113
|
+
|
|
1114
|
+
const strategy = String(els.psStrategyMode.value || 'standard').trim().toLowerCase();
|
|
1115
|
+
out.strategyMode = ['standard', 'atypical', 'hybrid', 'monitor'].includes(strategy) ? strategy : 'standard';
|
|
1116
|
+
if (els.psStandardMode) out.mode = (els.psStandardMode.value === 'dynamic') ? 'dynamic' : 'static';
|
|
1117
|
+
|
|
1118
|
+
const setNum = (key, el, min = 0, max = Number.POSITIVE_INFINITY) => {
|
|
1119
|
+
if (!el) return;
|
|
1120
|
+
const n = Number(el.value);
|
|
1121
|
+
if (Number.isFinite(n)) out[key] = Math.min(max, Math.max(min, n));
|
|
1122
|
+
else delete out[key];
|
|
1123
|
+
};
|
|
1124
|
+
setNum('reserveW', els.psReserveW, 0);
|
|
1125
|
+
setNum('safetyMarginW', els.psSafetyMarginW, 0);
|
|
1126
|
+
setNum('hysteresisW', els.psHysteresisW, 0);
|
|
1127
|
+
setNum('smoothingSeconds', els.psSmoothingSeconds, 1, 600);
|
|
1128
|
+
setNum('activateDelaySeconds', els.psActivateDelaySeconds, 0, 3600);
|
|
1129
|
+
setNum('releaseDelaySeconds', els.psReleaseDelaySeconds, 0, 3600);
|
|
1130
|
+
setNum('staleTimeoutSec', els.psStaleTimeoutSec, 1, 3600);
|
|
1131
|
+
if (els.psFastTripEnabled) out.fastTripEnabled = !!els.psFastTripEnabled.checked;
|
|
1132
|
+
|
|
1133
|
+
const atypicalEnabled = out.strategyMode === 'atypical' || out.strategyMode === 'hybrid' || out.strategyMode === 'monitor';
|
|
1134
|
+
const a = deepMerge({}, out.atypical || {});
|
|
1135
|
+
a.enabled = !!atypicalEnabled;
|
|
1136
|
+
a.mode = out.strategyMode === 'monitor' ? 'monitor' : (out.strategyMode === 'atypical' ? 'enforce' : 'hybrid');
|
|
1137
|
+
a.enforce = out.strategyMode !== 'monitor';
|
|
1138
|
+
a.voltageLevel = _psVoltageKey(els.psAtypicalVoltageLevel ? els.psAtypicalVoltageLevel.value : 'MS');
|
|
1139
|
+
|
|
1140
|
+
const threshold = _psNumOrNull(els.psAtypicalThresholdPercent && els.psAtypicalThresholdPercent.value);
|
|
1141
|
+
a.thresholdPercent = threshold === null ? _psThresholdForVoltage(a.voltageLevel) : Math.min(100, Math.max(0, threshold));
|
|
1142
|
+
|
|
1143
|
+
const pAbs = _psNumOrNull(els.psAtypicalPAbsRefW && els.psAtypicalPAbsRefW.value);
|
|
1144
|
+
if (pAbs !== null && pAbs > 0) a.annualPeakReferenceW = Math.round(pAbs); else delete a.annualPeakReferenceW;
|
|
1145
|
+
const minShift = _psNumOrNull(els.psAtypicalMinShiftW && els.psAtypicalMinShiftW.value);
|
|
1146
|
+
a.minShiftW = minShift !== null ? Math.max(0, Math.round(minShift)) : 100000;
|
|
1147
|
+
const target = _psNumOrNull(els.psAtypicalTargetLimitW && els.psAtypicalTargetLimitW.value);
|
|
1148
|
+
if (target !== null && target > 0) a.targetLimitW = Math.round(target); else delete a.targetLimitW;
|
|
1149
|
+
const margin = _psNumOrNull(els.psAtypicalSafetyMarginW && els.psAtypicalSafetyMarginW.value);
|
|
1150
|
+
if (margin !== null && margin >= 0) a.safetyMarginW = Math.round(margin); else delete a.safetyMarginW;
|
|
1151
|
+
|
|
1152
|
+
a.includeWeekends = !!(els.psAtypicalIncludeWeekends && els.psAtypicalIncludeWeekends.checked);
|
|
1153
|
+
a.excludeChristmasNewYear = !(els.psAtypicalExcludeChristmasNewYear && els.psAtypicalExcludeChristmasNewYear.checked === false);
|
|
1154
|
+
a.holidays = _psParseDateList(els.psAtypicalHolidays && els.psAtypicalHolidays.value);
|
|
1155
|
+
a.bridgeDays = _psParseDateList(els.psAtypicalBridgeDays && els.psAtypicalBridgeDays.value);
|
|
1156
|
+
a.calendarExceptions = _psParseDateList(els.psAtypicalCalendarExceptions && els.psAtypicalCalendarExceptions.value);
|
|
1157
|
+
a.highLoadWindows = _psCollectWindowRows();
|
|
1158
|
+
|
|
1159
|
+
out.atypical = a;
|
|
1160
|
+
return out;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
767
1163
|
function buildDpTable(container, fields, getter, setter, options) {
|
|
768
1164
|
container.innerHTML = '';
|
|
769
1165
|
|
|
@@ -6320,6 +6716,9 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
6320
6716
|
});
|
|
6321
6717
|
} catch (_e) {}
|
|
6322
6718
|
|
|
6719
|
+
// Peak-Shaving / Lastspitzenkappung
|
|
6720
|
+
try { buildPeakShavingUI(); } catch (_e) {}
|
|
6721
|
+
|
|
6323
6722
|
// Storage
|
|
6324
6723
|
const mode = (currentConfig.storage && typeof currentConfig.storage.controlMode === 'string') ? currentConfig.storage.controlMode : 'targetPower';
|
|
6325
6724
|
els.storageControlMode.value = (['targetPower','limits','enableFlags'].includes(mode)) ? mode : 'targetPower';
|
|
@@ -7221,8 +7620,8 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
7221
7620
|
// Grid-Constraints
|
|
7222
7621
|
patch.gridConstraints = deepMerge({}, currentConfig.gridConstraints || {});
|
|
7223
7622
|
|
|
7224
|
-
// PeakShaving
|
|
7225
|
-
patch.peakShaving =
|
|
7623
|
+
// PeakShaving / Lastspitzenkappung
|
|
7624
|
+
patch.peakShaving = collectPeakShavingConfigFromUI(currentConfig.peakShaving || {});
|
|
7226
7625
|
|
|
7227
7626
|
// Speicherfarm
|
|
7228
7627
|
patch.storageFarm = deepMerge({}, currentConfig.storageFarm || {});
|
|
@@ -8197,6 +8596,50 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
8197
8596
|
els.storageFeneconAcMode.addEventListener('input', _update);
|
|
8198
8597
|
}
|
|
8199
8598
|
|
|
8599
|
+
|
|
8600
|
+
// Peak-Shaving / HLZF UI wiring
|
|
8601
|
+
if (els.psStrategyMode) {
|
|
8602
|
+
els.psStrategyMode.addEventListener('change', () => {
|
|
8603
|
+
try { _psUpdateAtypicalFieldState(); } catch (_e) {}
|
|
8604
|
+
});
|
|
8605
|
+
}
|
|
8606
|
+
if (els.psAtypicalVoltageLevel) {
|
|
8607
|
+
els.psAtypicalVoltageLevel.addEventListener('change', () => {
|
|
8608
|
+
if (els.psAtypicalThresholdPercent && !String(els.psAtypicalThresholdPercent.value || '').trim()) {
|
|
8609
|
+
els.psAtypicalThresholdPercent.value = String(_psThresholdForVoltage(els.psAtypicalVoltageLevel.value));
|
|
8610
|
+
}
|
|
8611
|
+
});
|
|
8612
|
+
}
|
|
8613
|
+
if (els.psAtypicalApplyVoltageThreshold) {
|
|
8614
|
+
els.psAtypicalApplyVoltageThreshold.addEventListener('click', () => {
|
|
8615
|
+
if (els.psAtypicalThresholdPercent) {
|
|
8616
|
+
els.psAtypicalThresholdPercent.value = String(_psThresholdForVoltage(els.psAtypicalVoltageLevel ? els.psAtypicalVoltageLevel.value : 'MS'));
|
|
8617
|
+
}
|
|
8618
|
+
});
|
|
8619
|
+
}
|
|
8620
|
+
if (els.psAtypicalAddWindow) {
|
|
8621
|
+
els.psAtypicalAddWindow.addEventListener('click', () => {
|
|
8622
|
+
const ps = _psGetPeakCfg();
|
|
8623
|
+
ps.atypical.highLoadWindows = _psCollectWindowRows();
|
|
8624
|
+
ps.atypical.highLoadWindows.push(_psDefaultWindow());
|
|
8625
|
+
buildAtypicalWindowsUI();
|
|
8626
|
+
_psUpdateAtypicalFieldState();
|
|
8627
|
+
});
|
|
8628
|
+
}
|
|
8629
|
+
document.addEventListener('click', (e) => {
|
|
8630
|
+
const t = e && e.target ? e.target : null;
|
|
8631
|
+
const btn = t && t.closest ? t.closest('[data-ps-window-delete]') : null;
|
|
8632
|
+
if (!btn) return;
|
|
8633
|
+
const idx = Number(btn.getAttribute('data-ps-window-delete'));
|
|
8634
|
+
if (!Number.isFinite(idx)) return;
|
|
8635
|
+
const ps = _psGetPeakCfg();
|
|
8636
|
+
const rows = _psCollectWindowRows();
|
|
8637
|
+
rows.splice(idx, 1);
|
|
8638
|
+
ps.atypical.highLoadWindows = rows;
|
|
8639
|
+
buildAtypicalWindowsUI();
|
|
8640
|
+
_psUpdateAtypicalFieldState();
|
|
8641
|
+
}, true);
|
|
8642
|
+
|
|
8200
8643
|
// Browse buttons (event delegation) – works for dynamically created fields too
|
|
8201
8644
|
document.addEventListener('click', (e) => {
|
|
8202
8645
|
const t = e && e.target ? e.target : null;
|
package/www/sw.js
CHANGED