iobroker.nexowatt-ui 0.7.28 → 0.7.29
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 +217 -1
- package/io-package.json +5 -1
- package/package.json +1 -1
- package/www/ems-apps.html +90 -62
- package/www/ems-apps.js +181 -1
- package/www/sw.js +1 -1
|
@@ -192,6 +192,15 @@ class PeakShavingModule extends BaseModule {
|
|
|
192
192
|
/** @type {Map<string, {mode:string, phases:number, baseline:number|null, baselineEnabled:boolean|null}>} */
|
|
193
193
|
this._baselines = new Map();
|
|
194
194
|
this._wasActive = false;
|
|
195
|
+
|
|
196
|
+
// Atypische Nachkontrolle: laufende Jahres-/HLZF-Maxima werden über States persistiert.
|
|
197
|
+
this._atypicalReviewLoaded = false;
|
|
198
|
+
this._atypicalReviewState = {
|
|
199
|
+
resetIdentity: '',
|
|
200
|
+
pAbsMaxW: 0,
|
|
201
|
+
pHlzfMaxW: 0,
|
|
202
|
+
lastUpdate: 0,
|
|
203
|
+
};
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
_isEnabled() {
|
|
@@ -208,7 +217,7 @@ class PeakShavingModule extends BaseModule {
|
|
|
208
217
|
native: {},
|
|
209
218
|
});
|
|
210
219
|
|
|
211
|
-
for (const ch of ['measure', 'calc', 'control', 'dynamic', 'actuators', 'atypical']) {
|
|
220
|
+
for (const ch of ['measure', 'calc', 'control', 'dynamic', 'actuators', 'atypical', 'atypical.review']) {
|
|
212
221
|
await this.adapter.setObjectNotExistsAsync(`peakShaving.${ch}`, {
|
|
213
222
|
type: 'channel',
|
|
214
223
|
common: { name: ch },
|
|
@@ -265,7 +274,31 @@ class PeakShavingModule extends BaseModule {
|
|
|
265
274
|
await mk('peakShaving.atypical.deltaPercent', 'Verlagerung gegenüber P_abs_ref (%)', 'number', 'value');
|
|
266
275
|
await mk('peakShaving.atypical.eligiblePotential', '§19-Potenzial erfüllt Zielparameter', 'boolean', 'indicator');
|
|
267
276
|
await mk('peakShaving.atypical.binding', 'Bindendes Limit / Quelle', 'string', 'text');
|
|
277
|
+
await mk('peakShaving.atypical.gridOperator', 'Netzbetreiber Hochlastzeitfenster', 'string', 'text');
|
|
278
|
+
await mk('peakShaving.atypical.year', 'Gültigkeitsjahr Hochlastzeitfenster', 'number', 'value');
|
|
279
|
+
await mk('peakShaving.atypical.sourceDocument', 'HLZF Quelle / Dokument', 'string', 'text');
|
|
280
|
+
await mk('peakShaving.atypical.sourcePublishedAt', 'HLZF Veröffentlichungsdatum', 'string', 'text');
|
|
281
|
+
await mk('peakShaving.atypical.sourceUrl', 'HLZF Quell-URL / Ablage', 'string', 'text');
|
|
282
|
+
await mk('peakShaving.atypical.sourceNote', 'HLZF Bemerkung', 'string', 'text');
|
|
268
283
|
await mk('peakShaving.atypical.snapshotJson', 'Atypische Spitzenkappung Snapshot (JSON)', 'string', 'text');
|
|
284
|
+
|
|
285
|
+
await mk('peakShaving.atypical.review.enabled', 'Nachkontrolle aktiv', 'boolean', 'indicator');
|
|
286
|
+
await mk('peakShaving.atypical.review.status', 'Nachkontrolle Status', 'string', 'text');
|
|
287
|
+
await mk('peakShaving.atypical.review.year', 'Nachkontrolle Jahr', 'number', 'value');
|
|
288
|
+
await mk('peakShaving.atypical.review.resetIdentity', 'Nachkontrolle Reset-Identität', 'string', 'text');
|
|
289
|
+
await mk('peakShaving.atypical.review.pAbsMaxW', 'Gemessene Jahreshöchstlast P_abs_max (W)', 'number', 'value.power');
|
|
290
|
+
await mk('peakShaving.atypical.review.pHlzfMaxW', 'Gemessene HLZF-Höchstlast P_HLZF_max (W)', 'number', 'value.power');
|
|
291
|
+
await mk('peakShaving.atypical.review.pAbsEvalW', 'Bewertete Jahreshöchstlast P_abs (W)', 'number', 'value.power');
|
|
292
|
+
await mk('peakShaving.atypical.review.pHlzfEvalW', 'Bewertete HLZF-Höchstlast P_HLZF (W)', 'number', 'value.power');
|
|
293
|
+
await mk('peakShaving.atypical.review.deltaW', 'Nachkontrolle Verlagerung (W)', 'number', 'value.power');
|
|
294
|
+
await mk('peakShaving.atypical.review.deltaPercent', 'Nachkontrolle Verlagerung (%)', 'number', 'value');
|
|
295
|
+
await mk('peakShaving.atypical.review.thresholdOk', 'Erheblichkeitsschwelle erfüllt', 'boolean', 'indicator');
|
|
296
|
+
await mk('peakShaving.atypical.review.minShiftOk', 'Mindestverlagerung erfüllt', 'boolean', 'indicator');
|
|
297
|
+
await mk('peakShaving.atypical.review.savingsEur', 'Geschätzte Ersparnis (€)', 'number', 'value');
|
|
298
|
+
await mk('peakShaving.atypical.review.savingsOk', 'Bagatellgrenze erfüllt', 'boolean', 'indicator');
|
|
299
|
+
await mk('peakShaving.atypical.review.eligible', 'Nachkontrolle erfüllt', 'boolean', 'indicator');
|
|
300
|
+
await mk('peakShaving.atypical.review.lastUpdate', 'Nachkontrolle letzte Aktualisierung', 'number', 'value.time');
|
|
301
|
+
await mk('peakShaving.atypical.review.snapshotJson', 'Nachkontrolle Snapshot (JSON)', 'string', 'text');
|
|
269
302
|
}
|
|
270
303
|
|
|
271
304
|
|
|
@@ -433,10 +466,153 @@ class PeakShavingModule extends BaseModule {
|
|
|
433
466
|
};
|
|
434
467
|
}
|
|
435
468
|
|
|
469
|
+
_getAtypicalSourceInfo(atypicalCfg) {
|
|
470
|
+
const cfg = (atypicalCfg && typeof atypicalCfg === 'object') ? atypicalCfg : {};
|
|
471
|
+
const yearRaw = Number(cfg.year ?? cfg.validityYear ?? cfg.calendarYear ?? 0);
|
|
472
|
+
return {
|
|
473
|
+
gridOperator: String(cfg.gridOperatorName || cfg.gridOperator || cfg.networkOperator || cfg.netzbetreiber || '').trim(),
|
|
474
|
+
year: Number.isFinite(yearRaw) && yearRaw > 0 ? Math.round(yearRaw) : 0,
|
|
475
|
+
sourceDocument: String(cfg.sourceDocument || cfg.sourceName || cfg.source || '').trim(),
|
|
476
|
+
sourcePublishedAt: String(cfg.sourcePublishedAt || cfg.publishedAt || cfg.publicationDate || '').trim(),
|
|
477
|
+
sourceUrl: String(cfg.sourceUrl || cfg.sourceLink || cfg.sourcePath || '').trim(),
|
|
478
|
+
sourceNote: String(cfg.sourceNote || cfg.note || cfg.notes || '').trim(),
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
async _readOwnNumber(id, fallback = 0) {
|
|
483
|
+
try {
|
|
484
|
+
const st = await this.adapter.getStateAsync(id);
|
|
485
|
+
const n = st ? Number(st.val) : NaN;
|
|
486
|
+
return Number.isFinite(n) ? n : fallback;
|
|
487
|
+
} catch {
|
|
488
|
+
return fallback;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
async _readOwnString(id, fallback = '') {
|
|
493
|
+
try {
|
|
494
|
+
const st = await this.adapter.getStateAsync(id);
|
|
495
|
+
if (!st || st.val === null || st.val === undefined) return fallback;
|
|
496
|
+
return String(st.val);
|
|
497
|
+
} catch {
|
|
498
|
+
return fallback;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
async _ensureAtypicalReviewLoaded(resetIdentity) {
|
|
503
|
+
const identity = String(resetIdentity || '');
|
|
504
|
+
const st = this._atypicalReviewState || { resetIdentity: '', pAbsMaxW: 0, pHlzfMaxW: 0, lastUpdate: 0 };
|
|
505
|
+
if (this._atypicalReviewLoaded && st.resetIdentity === identity) return;
|
|
506
|
+
|
|
507
|
+
const persistedIdentity = await this._readOwnString('peakShaving.atypical.review.resetIdentity', '');
|
|
508
|
+
if (persistedIdentity && persistedIdentity === identity) {
|
|
509
|
+
st.resetIdentity = persistedIdentity;
|
|
510
|
+
st.pAbsMaxW = Math.max(0, await this._readOwnNumber('peakShaving.atypical.review.pAbsMaxW', 0));
|
|
511
|
+
st.pHlzfMaxW = Math.max(0, await this._readOwnNumber('peakShaving.atypical.review.pHlzfMaxW', 0));
|
|
512
|
+
st.lastUpdate = Math.max(0, await this._readOwnNumber('peakShaving.atypical.review.lastUpdate', 0));
|
|
513
|
+
} else {
|
|
514
|
+
st.resetIdentity = identity;
|
|
515
|
+
st.pAbsMaxW = 0;
|
|
516
|
+
st.pHlzfMaxW = 0;
|
|
517
|
+
st.lastUpdate = 0;
|
|
518
|
+
}
|
|
519
|
+
this._atypicalReviewState = st;
|
|
520
|
+
this._atypicalReviewLoaded = true;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
async _buildAtypicalReviewContext({ atypicalCfg, schedule, target, gridPowerRaw, effPower, staleMeter, now }) {
|
|
524
|
+
const cfg = (atypicalCfg && typeof atypicalCfg === 'object') ? atypicalCfg : {};
|
|
525
|
+
const review = (cfg.review && typeof cfg.review === 'object') ? cfg.review : ((cfg.nachkontrolle && typeof cfg.nachkontrolle === 'object') ? cfg.nachkontrolle : {});
|
|
526
|
+
const source = this._getAtypicalSourceInfo(cfg);
|
|
527
|
+
const year = Math.round(num(review.year ?? source.year, (new Date(now || Date.now())).getFullYear()) || (new Date(now || Date.now())).getFullYear());
|
|
528
|
+
const resetToken = String(review.resetToken || review.resetKey || '').trim();
|
|
529
|
+
const resetIdentity = `${year}|${resetToken}`;
|
|
530
|
+
const enabled = cfg.enabled === true && review.enabled !== false;
|
|
531
|
+
|
|
532
|
+
await this._ensureAtypicalReviewLoaded(resetIdentity);
|
|
533
|
+
const st = this._atypicalReviewState || { resetIdentity, pAbsMaxW: 0, pHlzfMaxW: 0, lastUpdate: 0 };
|
|
534
|
+
st.resetIdentity = resetIdentity;
|
|
535
|
+
|
|
536
|
+
const rawW = Number.isFinite(Number(gridPowerRaw)) ? Number(gridPowerRaw) : (Number.isFinite(Number(effPower)) ? Number(effPower) : null);
|
|
537
|
+
const importW = (rawW !== null && Number.isFinite(rawW)) ? Math.max(0, rawW) : null;
|
|
538
|
+
const measurementUsable = enabled && !staleMeter && importW !== null;
|
|
539
|
+
|
|
540
|
+
if (measurementUsable) {
|
|
541
|
+
if (importW > st.pAbsMaxW) st.pAbsMaxW = Math.round(importW);
|
|
542
|
+
if (schedule && schedule.active && importW > st.pHlzfMaxW) st.pHlzfMaxW = Math.round(importW);
|
|
543
|
+
st.lastUpdate = now || Date.now();
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
const manualPAbs = num(review.pAbsActualW ?? review.actualAnnualPeakW ?? review.pAbsIstW, null);
|
|
547
|
+
const manualHlzf = num(review.pHlzfMaxW ?? review.hlzfPeakW ?? review.pHlzfIstW, null);
|
|
548
|
+
const pAbsEvalW = (typeof manualPAbs === 'number' && manualPAbs > 0) ? manualPAbs : st.pAbsMaxW;
|
|
549
|
+
const pHlzfEvalW = (typeof manualHlzf === 'number' && manualHlzf >= 0) ? manualHlzf : st.pHlzfMaxW;
|
|
550
|
+
|
|
551
|
+
const thresholdPercent = Math.max(0, num(target && target.thresholdPercent, atypicalThresholdPercent(target && target.voltageLevel, 20)) || 0);
|
|
552
|
+
const minShiftW = Math.max(0, num(target && target.minShiftW, 100000) || 0);
|
|
553
|
+
const complete = pAbsEvalW > 0 && pHlzfEvalW >= 0;
|
|
554
|
+
const deltaW = complete ? Math.max(0, pAbsEvalW - pHlzfEvalW) : 0;
|
|
555
|
+
const deltaPercent = complete ? (deltaW / pAbsEvalW * 100) : 0;
|
|
556
|
+
const thresholdOk = complete && deltaPercent + 1e-9 >= thresholdPercent;
|
|
557
|
+
const minShiftOk = complete && deltaW + 1e-9 >= minShiftW;
|
|
558
|
+
|
|
559
|
+
const powerPrice = num(review.powerPriceEurPerKwYear ?? review.powerPriceEurPerKwA ?? review.leistungspreisEurProKwJahr, null);
|
|
560
|
+
const bagatelleEur = Math.max(0, num(review.savingsBagatelleEur ?? review.bagatelleEur ?? 500, 500) || 0);
|
|
561
|
+
const generalGridFeeEur = num(review.generalGridFeeEur ?? review.generalGridFee ?? review.allgemeinesNetzentgeltEur, null);
|
|
562
|
+
const maxReductionPercent = Math.min(100, Math.max(0, num(review.maxReductionPercent ?? 80, 80) || 0));
|
|
563
|
+
const grossSavingsEur = (complete && typeof powerPrice === 'number' && powerPrice > 0) ? ((deltaW / 1000) * powerPrice) : null;
|
|
564
|
+
const reductionCapEur = (grossSavingsEur !== null && typeof generalGridFeeEur === 'number' && generalGridFeeEur > 0) ? (generalGridFeeEur * maxReductionPercent / 100) : null;
|
|
565
|
+
const savingsEur = grossSavingsEur === null ? null : (reductionCapEur === null ? grossSavingsEur : Math.min(grossSavingsEur, reductionCapEur));
|
|
566
|
+
const savingsOk = savingsEur === null ? null : savingsEur + 1e-9 >= bagatelleEur;
|
|
567
|
+
const technicalEligible = complete && thresholdOk && minShiftOk;
|
|
568
|
+
const eligible = enabled && technicalEligible && (savingsOk === null ? true : savingsOk);
|
|
569
|
+
|
|
570
|
+
let status = 'disabled';
|
|
571
|
+
if (enabled) {
|
|
572
|
+
if (!complete) status = 'collecting';
|
|
573
|
+
else if (!thresholdOk) status = 'threshold-missing';
|
|
574
|
+
else if (!minShiftOk) status = 'min-shift-missing';
|
|
575
|
+
else if (savingsOk === false) status = 'bagatelle-missing';
|
|
576
|
+
else if (savingsOk === null) status = 'technical-ok-savings-open';
|
|
577
|
+
else status = 'eligible';
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return {
|
|
581
|
+
enabled,
|
|
582
|
+
status,
|
|
583
|
+
year,
|
|
584
|
+
resetIdentity,
|
|
585
|
+
measurementUsable,
|
|
586
|
+
pAbsMaxW: st.pAbsMaxW,
|
|
587
|
+
pHlzfMaxW: st.pHlzfMaxW,
|
|
588
|
+
pAbsEvalW,
|
|
589
|
+
pHlzfEvalW,
|
|
590
|
+
manualPAbsW: (typeof manualPAbs === 'number' && manualPAbs > 0) ? manualPAbs : null,
|
|
591
|
+
manualHlzfW: (typeof manualHlzf === 'number' && manualHlzf >= 0) ? manualHlzf : null,
|
|
592
|
+
thresholdPercent,
|
|
593
|
+
minShiftW,
|
|
594
|
+
deltaW,
|
|
595
|
+
deltaPercent,
|
|
596
|
+
thresholdOk,
|
|
597
|
+
minShiftOk,
|
|
598
|
+
powerPriceEurPerKwYear: typeof powerPrice === 'number' ? powerPrice : null,
|
|
599
|
+
bagatelleEur,
|
|
600
|
+
grossSavingsEur,
|
|
601
|
+
reductionCapEur,
|
|
602
|
+
savingsEur,
|
|
603
|
+
savingsOk,
|
|
604
|
+
technicalEligible,
|
|
605
|
+
eligible,
|
|
606
|
+
lastUpdate: st.lastUpdate || 0,
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
436
610
|
async _publishAtypicalDiagnostics(ctx) {
|
|
437
611
|
const c = (ctx && typeof ctx === 'object') ? ctx : {};
|
|
438
612
|
const schedule = (c.schedule && typeof c.schedule === 'object') ? c.schedule : {};
|
|
439
613
|
const target = (c.target && typeof c.target === 'object') ? c.target : {};
|
|
614
|
+
const source = (c.source && typeof c.source === 'object') ? c.source : {};
|
|
615
|
+
const review = (c.review && typeof c.review === 'object') ? c.review : {};
|
|
440
616
|
const set = async (id, val) => {
|
|
441
617
|
try { await this.adapter.setStateAsync(id, val, true); } catch { /* diagnostics only */ }
|
|
442
618
|
};
|
|
@@ -456,6 +632,31 @@ class PeakShavingModule extends BaseModule {
|
|
|
456
632
|
await set('peakShaving.atypical.deltaPercent', Number.isFinite(Number(target.deltaPercent)) ? Math.round(Number(target.deltaPercent) * 100) / 100 : 0);
|
|
457
633
|
await set('peakShaving.atypical.eligiblePotential', !!target.eligiblePotential);
|
|
458
634
|
await set('peakShaving.atypical.binding', String(c.binding || ''));
|
|
635
|
+
await set('peakShaving.atypical.gridOperator', String(source.gridOperator || ''));
|
|
636
|
+
await set('peakShaving.atypical.year', Number.isFinite(Number(source.year)) ? Math.round(Number(source.year)) : 0);
|
|
637
|
+
await set('peakShaving.atypical.sourceDocument', String(source.sourceDocument || ''));
|
|
638
|
+
await set('peakShaving.atypical.sourcePublishedAt', String(source.sourcePublishedAt || ''));
|
|
639
|
+
await set('peakShaving.atypical.sourceUrl', String(source.sourceUrl || ''));
|
|
640
|
+
await set('peakShaving.atypical.sourceNote', String(source.sourceNote || ''));
|
|
641
|
+
|
|
642
|
+
await set('peakShaving.atypical.review.enabled', !!review.enabled);
|
|
643
|
+
await set('peakShaving.atypical.review.status', String(review.status || ''));
|
|
644
|
+
await set('peakShaving.atypical.review.year', Number.isFinite(Number(review.year)) ? Math.round(Number(review.year)) : 0);
|
|
645
|
+
await set('peakShaving.atypical.review.resetIdentity', String(review.resetIdentity || ''));
|
|
646
|
+
await set('peakShaving.atypical.review.pAbsMaxW', Number.isFinite(Number(review.pAbsMaxW)) ? Math.round(Number(review.pAbsMaxW)) : 0);
|
|
647
|
+
await set('peakShaving.atypical.review.pHlzfMaxW', Number.isFinite(Number(review.pHlzfMaxW)) ? Math.round(Number(review.pHlzfMaxW)) : 0);
|
|
648
|
+
await set('peakShaving.atypical.review.pAbsEvalW', Number.isFinite(Number(review.pAbsEvalW)) ? Math.round(Number(review.pAbsEvalW)) : 0);
|
|
649
|
+
await set('peakShaving.atypical.review.pHlzfEvalW', Number.isFinite(Number(review.pHlzfEvalW)) ? Math.round(Number(review.pHlzfEvalW)) : 0);
|
|
650
|
+
await set('peakShaving.atypical.review.deltaW', Number.isFinite(Number(review.deltaW)) ? Math.round(Number(review.deltaW)) : 0);
|
|
651
|
+
await set('peakShaving.atypical.review.deltaPercent', Number.isFinite(Number(review.deltaPercent)) ? Math.round(Number(review.deltaPercent) * 100) / 100 : 0);
|
|
652
|
+
await set('peakShaving.atypical.review.thresholdOk', !!review.thresholdOk);
|
|
653
|
+
await set('peakShaving.atypical.review.minShiftOk', !!review.minShiftOk);
|
|
654
|
+
await set('peakShaving.atypical.review.savingsEur', Number.isFinite(Number(review.savingsEur)) ? Math.round(Number(review.savingsEur) * 100) / 100 : 0);
|
|
655
|
+
await set('peakShaving.atypical.review.savingsOk', review.savingsOk === true);
|
|
656
|
+
await set('peakShaving.atypical.review.eligible', !!review.eligible);
|
|
657
|
+
await set('peakShaving.atypical.review.lastUpdate', Number.isFinite(Number(review.lastUpdate)) ? Math.round(Number(review.lastUpdate)) : 0);
|
|
658
|
+
await set('peakShaving.atypical.review.snapshotJson', JSON.stringify(review || {}));
|
|
659
|
+
|
|
459
660
|
await set('peakShaving.atypical.snapshotJson', JSON.stringify({
|
|
460
661
|
ts: Date.now(),
|
|
461
662
|
mode: String(c.mode || ''),
|
|
@@ -463,6 +664,8 @@ class PeakShavingModule extends BaseModule {
|
|
|
463
664
|
enforce: !!c.enforce,
|
|
464
665
|
schedule,
|
|
465
666
|
target,
|
|
667
|
+
source,
|
|
668
|
+
review,
|
|
466
669
|
limitCandidateW: Number.isFinite(Number(c.limitCandidateW)) ? Math.round(Number(c.limitCandidateW)) : 0,
|
|
467
670
|
effectiveLimitW: Number.isFinite(Number(c.effectiveLimitW)) ? Math.round(Number(c.effectiveLimitW)) : 0,
|
|
468
671
|
binding: String(c.binding || ''),
|
|
@@ -677,12 +880,25 @@ class PeakShavingModule extends BaseModule {
|
|
|
677
880
|
limitW = Math.max(0, limitW - Math.max(0, safetyMarginW));
|
|
678
881
|
}
|
|
679
882
|
|
|
883
|
+
const atypicalSource = this._getAtypicalSourceInfo(atypicalCfg);
|
|
884
|
+
const atypicalReview = await this._buildAtypicalReviewContext({
|
|
885
|
+
atypicalCfg: { ...atypicalCfg, enabled: atypicalRuntimeEnabled },
|
|
886
|
+
schedule: atypicalSchedule,
|
|
887
|
+
target: atypicalTarget,
|
|
888
|
+
gridPowerRaw,
|
|
889
|
+
effPower,
|
|
890
|
+
staleMeter,
|
|
891
|
+
now,
|
|
892
|
+
});
|
|
893
|
+
|
|
680
894
|
await this._publishAtypicalDiagnostics({
|
|
681
895
|
enabled: !!atypicalRuntimeEnabled,
|
|
682
896
|
mode: atypicalMode,
|
|
683
897
|
enforce: atypicalEnforce,
|
|
684
898
|
schedule: atypicalSchedule,
|
|
685
899
|
target: atypicalTarget,
|
|
900
|
+
source: atypicalSource,
|
|
901
|
+
review: atypicalReview,
|
|
686
902
|
limitCandidateW: atypicalLimitCandidateW,
|
|
687
903
|
effectiveLimitW: atypicalWantsPowerLimit ? limitW : 0,
|
|
688
904
|
binding: atypicalWantsPowerLimit ? (limitSource || 'atypical') : '',
|
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.29",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.7.29": {
|
|
7
|
+
"en": "Peak-shaving App-Center now documents grid-operator high-load-window source data and adds §19 after-control diagnostics. The runtime tracks annual peak and HLZF peak, calculates shift percentage, minimum-shift status and estimated savings under peakShaving.atypical.review.*.",
|
|
8
|
+
"de": "Peak-Shaving App-Center erweitert: Netzbetreiber-/Quellnachweis für Hochlastzeitfenster sowie §19-Nachkontrolle ergänzt. Die Runtime führt Jahreshöchstlast und HLZF-Höchstlast mit, berechnet Verlagerung, Mindestverlagerung und grobe Ersparnis unter peakShaving.atypical.review.*."
|
|
9
|
+
},
|
|
6
10
|
"0.7.28": {
|
|
7
11
|
"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
12
|
"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."
|
package/package.json
CHANGED
package/www/ems-apps.html
CHANGED
|
@@ -156,27 +156,19 @@
|
|
|
156
156
|
<div class="nw-config-card__body">
|
|
157
157
|
<div class="nw-config-field-row">
|
|
158
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>
|
|
159
|
+
<div class="nw-config-field-control"><input id="psSmoothingSeconds" class="nw-config-input" type="number" min="1" max="600" step="1" placeholder="10" /></div>
|
|
162
160
|
</div>
|
|
163
161
|
<div class="nw-config-field-row">
|
|
164
162
|
<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>
|
|
163
|
+
<div class="nw-config-field-control"><input id="psActivateDelaySeconds" class="nw-config-input" type="number" min="0" max="3600" step="1" placeholder="2" /></div>
|
|
168
164
|
</div>
|
|
169
165
|
<div class="nw-config-field-row">
|
|
170
166
|
<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>
|
|
167
|
+
<div class="nw-config-field-control"><input id="psReleaseDelaySeconds" class="nw-config-input" type="number" min="0" max="3600" step="1" placeholder="5" /></div>
|
|
174
168
|
</div>
|
|
175
169
|
<div class="nw-config-field-row">
|
|
176
170
|
<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>
|
|
171
|
+
<div class="nw-config-field-control"><input id="psStaleTimeoutSec" class="nw-config-input" type="number" min="1" max="3600" step="1" placeholder="300" /></div>
|
|
180
172
|
</div>
|
|
181
173
|
<div class="nw-config-field-row">
|
|
182
174
|
<label class="nw-config-field-label" for="psFastTripEnabled">Fast-Trip</label>
|
|
@@ -208,7 +200,6 @@
|
|
|
208
200
|
</select>
|
|
209
201
|
</div>
|
|
210
202
|
</div>
|
|
211
|
-
|
|
212
203
|
<div class="nw-config-field-row">
|
|
213
204
|
<label class="nw-config-field-label" for="psAtypicalThresholdPercent">Erheblichkeitsschwelle (%)</label>
|
|
214
205
|
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
@@ -219,21 +210,14 @@
|
|
|
219
210
|
<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
211
|
</div>
|
|
221
212
|
</div>
|
|
222
|
-
|
|
223
213
|
<div class="nw-config-field-row">
|
|
224
214
|
<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>
|
|
215
|
+
<div class="nw-config-field-control"><input id="psAtypicalPAbsRefW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 1000000" /></div>
|
|
228
216
|
</div>
|
|
229
|
-
|
|
230
217
|
<div class="nw-config-field-row">
|
|
231
218
|
<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>
|
|
219
|
+
<div class="nw-config-field-control"><input id="psAtypicalMinShiftW" class="nw-config-input" type="number" min="0" step="100" placeholder="100000" /></div>
|
|
235
220
|
</div>
|
|
236
|
-
|
|
237
221
|
<div class="nw-config-field-row">
|
|
238
222
|
<label class="nw-config-field-label" for="psAtypicalTargetLimitW">Fester HLZF-Grenzwert (W, optional)</label>
|
|
239
223
|
<div class="nw-config-field-control nw-config-field-control--stack">
|
|
@@ -241,55 +225,103 @@
|
|
|
241
225
|
<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
226
|
</div>
|
|
243
227
|
</div>
|
|
244
|
-
|
|
245
228
|
<div class="nw-config-field-row">
|
|
246
229
|
<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>
|
|
230
|
+
<div class="nw-config-field-control"><input id="psAtypicalSafetyMarginW" class="nw-config-input" type="number" min="0" step="100" placeholder="z.B. 2000" /></div>
|
|
250
231
|
</div>
|
|
251
232
|
</div>
|
|
252
233
|
</div>
|
|
253
234
|
|
|
235
|
+
<div class="nw-config-card">
|
|
236
|
+
<div class="nw-config-card__header">
|
|
237
|
+
<div class="nw-config-card__title">Netzbetreiber / Nachweis</div>
|
|
238
|
+
<div class="nw-config-card__subtitle">Offizielle Quelle der Hochlastzeitfenster vom Netzbetreiber dokumentieren</div>
|
|
239
|
+
</div>
|
|
240
|
+
<div class="nw-config-card__body">
|
|
241
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalGridOperator">Netzbetreiber</label><div class="nw-config-field-control"><input id="psAtypicalGridOperator" class="nw-config-input" type="text" placeholder="z.B. Westnetz GmbH" /></div></div>
|
|
242
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalYear">Gültigkeitsjahr</label><div class="nw-config-field-control"><input id="psAtypicalYear" class="nw-config-input" type="number" min="2020" max="2100" step="1" placeholder="z.B. 2026" /></div></div>
|
|
243
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalSourceDocument">Quelle / Dokument</label><div class="nw-config-field-control"><input id="psAtypicalSourceDocument" class="nw-config-input" type="text" placeholder="z.B. Hochlastzeitfenster_2026_MS.pdf" /></div></div>
|
|
244
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalSourcePublishedAt">Veröffentlichungsdatum</label><div class="nw-config-field-control"><input id="psAtypicalSourcePublishedAt" class="nw-config-input" type="date" /></div></div>
|
|
245
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalSourceUrl">Quell-URL / Ablage</label><div class="nw-config-field-control"><input id="psAtypicalSourceUrl" class="nw-config-input" type="text" placeholder="optional: Link oder interner Ablagepfad" /></div></div>
|
|
246
|
+
<div class="nw-config-field-row" style="align-items:flex-start;"><label class="nw-config-field-label" for="psAtypicalSourceNote">Bemerkung</label><div class="nw-config-field-control"><textarea id="psAtypicalSourceNote" class="nw-config-input" rows="3" placeholder="z.B. Ebene MS, Stand 31.10., manuell aus PDF übernommen"></textarea></div></div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
254
250
|
<div class="nw-config-card">
|
|
255
251
|
<div class="nw-config-card__header">
|
|
256
252
|
<div class="nw-config-card__title">Kalender / Ausnahmen</div>
|
|
257
253
|
<div class="nw-config-card__subtitle">Tage, an denen keine Hochlastzeitfenster gelten sollen</div>
|
|
258
254
|
</div>
|
|
259
255
|
<div class="nw-config-card__body">
|
|
260
|
-
<div class="nw-config-field-row">
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
<div class="nw-config-
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
256
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalIncludeWeekends">Wochenenden berücksichtigen</label><div class="nw-config-field-control" style="display:flex;align-items:center;gap:10px;"><input id="psAtypicalIncludeWeekends" class="nw-config-checkbox" type="checkbox" /><span class="nw-config-field-hint" style="margin:0;">Standard: aus, da HLZF typischerweise nur an Werktagen aktiv sind.</span></div></div>
|
|
257
|
+
<div class="nw-config-field-row"><label class="nw-config-field-label" for="psAtypicalExcludeChristmasNewYear">24.12.–01.01. ausschließen</label><div class="nw-config-field-control" style="display:flex;align-items:center;gap:10px;"><input id="psAtypicalExcludeChristmasNewYear" class="nw-config-checkbox" type="checkbox" /><span class="nw-config-field-hint" style="margin:0;">Empfohlen aktiv lassen.</span></div></div>
|
|
258
|
+
<div class="nw-config-field-row" style="align-items:flex-start;"><label class="nw-config-field-label" for="psAtypicalHolidays">Feiertage</label><div class="nw-config-field-control nw-config-field-control--stack"><textarea id="psAtypicalHolidays" class="nw-config-input" rows="4" placeholder="2026-01-01 2026-04-03"></textarea><div class="nw-config-help" style="margin-top:4px;opacity:.85;">Ein Datum pro Zeile oder kommasepariert im Format YYYY-MM-DD.</div></div></div>
|
|
259
|
+
<div class="nw-config-field-row" style="align-items:flex-start;"><label class="nw-config-field-label" for="psAtypicalBridgeDays">Brückentage</label><div class="nw-config-field-control"><textarea id="psAtypicalBridgeDays" class="nw-config-input" rows="3" placeholder="2026-05-15"></textarea></div></div>
|
|
260
|
+
<div class="nw-config-field-row" style="align-items:flex-start;"><label class="nw-config-field-label" for="psAtypicalCalendarExceptions">Weitere Ausnahmen</label><div class="nw-config-field-control"><textarea id="psAtypicalCalendarExceptions" class="nw-config-input" rows="3" placeholder="2026-12-24"></textarea></div></div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div class="nw-config-card" style="grid-column:1 / -1;">
|
|
265
|
+
<div class="nw-config-card__header">
|
|
266
|
+
<div class="nw-config-card__title">Nachkontrolle / §19-Prüfung</div>
|
|
267
|
+
<div class="nw-config-card__subtitle">Live-Jahreskontrolle plus optionale Jahres-Endwerte aus RLM-/Zählerexport</div>
|
|
268
|
+
</div>
|
|
269
|
+
<div class="nw-config-card__body">
|
|
270
|
+
<div class="nw-config-empty" style="margin:0 0 10px 0;line-height:1.35;">
|
|
271
|
+
Der EMS-Core schreibt laufend unter <code>peakShaving.atypical.review.*</code>: absolute Jahreshöchstlast, höchste HLZF-Last, Verlagerung, Erheblichkeit, Mindestverlagerung, Bagatellgrenze und eine JSON-Zusammenfassung. Manuelle Werte überschreiben nur die Prüfung, nicht die laufende Messung.
|
|
272
|
+
</div>
|
|
273
|
+
<div class="nw-config-grid" style="grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;">
|
|
274
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
275
|
+
<span class="nw-config-field-label" style="width:auto;">Nachkontrolle aktiv</span>
|
|
276
|
+
<span style="display:flex;align-items:center;gap:10px;">
|
|
277
|
+
<input id="psAtypicalReviewEnabled" class="nw-config-checkbox" type="checkbox" />
|
|
278
|
+
<span class="nw-config-field-hint" style="margin:0;">Live-Werte mitführen</span>
|
|
279
|
+
</span>
|
|
280
|
+
</label>
|
|
281
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
282
|
+
<span class="nw-config-field-label" style="width:auto;">Reset-Schlüssel</span>
|
|
283
|
+
<input id="psAtypicalReviewResetToken" class="nw-config-input" type="text" placeholder="ändern = Jahreswerte neu starten" />
|
|
284
|
+
</label>
|
|
285
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
286
|
+
<span class="nw-config-field-label" style="width:auto;">Ist-Jahreshöchstlast P_abs_ist (W)</span>
|
|
287
|
+
<input id="psAtypicalReviewPAbsActualW" class="nw-config-input" type="number" min="0" step="100" placeholder="leer = Live-Maximum" />
|
|
288
|
+
</label>
|
|
289
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
290
|
+
<span class="nw-config-field-label" style="width:auto;">Max. HLZF-Leistung P_HLZF_max (W)</span>
|
|
291
|
+
<input id="psAtypicalReviewPHlzfMaxW" class="nw-config-input" type="number" min="0" step="100" placeholder="leer = Live-HLZF-Maximum" />
|
|
292
|
+
</label>
|
|
293
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
294
|
+
<span class="nw-config-field-label" style="width:auto;">Leistungspreis (€/kW*a)</span>
|
|
295
|
+
<input id="psAtypicalReviewPowerPriceEurPerKwYear" class="nw-config-input" type="number" min="0" step="0.01" placeholder="optional" />
|
|
296
|
+
</label>
|
|
297
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
298
|
+
<span class="nw-config-field-label" style="width:auto;">Arbeitspreis Netzentgelt (€/kWh)</span>
|
|
299
|
+
<input id="psAtypicalReviewEnergyPriceEurPerKwh" class="nw-config-input" type="number" min="0" step="0.0001" placeholder="optional" />
|
|
300
|
+
</label>
|
|
301
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
302
|
+
<span class="nw-config-field-label" style="width:auto;">Jahresarbeit (kWh)</span>
|
|
303
|
+
<input id="psAtypicalReviewAnnualEnergyKwh" class="nw-config-input" type="number" min="0" step="1" placeholder="optional" />
|
|
304
|
+
</label>
|
|
305
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
306
|
+
<span class="nw-config-field-label" style="width:auto;">Bagatellgrenze (€)</span>
|
|
307
|
+
<input id="psAtypicalReviewSavingsBagatelleEur" class="nw-config-input" type="number" min="0" step="1" placeholder="500" />
|
|
308
|
+
</label>
|
|
309
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
310
|
+
<span class="nw-config-field-label" style="width:auto;">Allg. Netzentgelt/Jahr (€)</span>
|
|
311
|
+
<input id="psAtypicalReviewGeneralGridFeeEur" class="nw-config-input" type="number" min="0" step="1" placeholder="optional für 80%-Deckel" />
|
|
312
|
+
</label>
|
|
313
|
+
<label class="nw-config-field-control nw-config-field-control--stack">
|
|
314
|
+
<span class="nw-config-field-label" style="width:auto;">Max. Reduzierung (%)</span>
|
|
315
|
+
<input id="psAtypicalReviewMaxReductionPercent" class="nw-config-input" type="number" min="0" max="100" step="1" placeholder="80" />
|
|
316
|
+
</label>
|
|
317
|
+
</div>
|
|
318
|
+
<div class="nw-config-field-row" style="align-items:flex-start;margin-top:10px;">
|
|
319
|
+
<label class="nw-config-field-label" for="psAtypicalReviewNote">Prüfnotiz</label>
|
|
289
320
|
<div class="nw-config-field-control">
|
|
290
|
-
<textarea id="
|
|
321
|
+
<textarea id="psAtypicalReviewNote" class="nw-config-input" rows="3" placeholder="z.B. Werte aus RLM-Jahresexport übernommen"></textarea>
|
|
291
322
|
</div>
|
|
292
323
|
</div>
|
|
324
|
+
<div id="psAtypicalReviewPreview" class="nw-config-empty" style="margin-top:10px;line-height:1.45;">Live-Nachkontrolle läuft im Adapter unter peakShaving.atypical.review.*. Manuelle Jahres-Endwerte sind optional; leer = laufende Messung verwenden.</div>
|
|
293
325
|
</div>
|
|
294
326
|
</div>
|
|
295
327
|
|
|
@@ -300,15 +332,11 @@
|
|
|
300
332
|
<div class="nw-config-card__title">Hochlastzeitfenster</div>
|
|
301
333
|
<div class="nw-config-card__subtitle">Zeitfenster pro Saison/Monat. Mehrere Fenster pro Tag sind möglich.</div>
|
|
302
334
|
</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>
|
|
335
|
+
<div class="nw-config-row__actions"><button id="psAtypicalAddWindow" type="button" class="nw-config-btn nw-config-btn--ghost">+ Fenster</button></div>
|
|
306
336
|
</div>
|
|
307
337
|
</div>
|
|
308
338
|
<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>
|
|
339
|
+
<div class="nw-config-empty" style="margin:0 0 8px 0;">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.</div>
|
|
312
340
|
<div id="psAtypicalWindows" class="nw-config-list"></div>
|
|
313
341
|
</div>
|
|
314
342
|
</div>
|
package/www/ems-apps.js
CHANGED
|
@@ -103,6 +103,24 @@
|
|
|
103
103
|
psAtypicalCalendarExceptions: document.getElementById('psAtypicalCalendarExceptions'),
|
|
104
104
|
psAtypicalWindows: document.getElementById('psAtypicalWindows'),
|
|
105
105
|
psAtypicalAddWindow: document.getElementById('psAtypicalAddWindow'),
|
|
106
|
+
psAtypicalGridOperator: document.getElementById('psAtypicalGridOperator'),
|
|
107
|
+
psAtypicalYear: document.getElementById('psAtypicalYear'),
|
|
108
|
+
psAtypicalSourceDocument: document.getElementById('psAtypicalSourceDocument'),
|
|
109
|
+
psAtypicalSourcePublishedAt: document.getElementById('psAtypicalSourcePublishedAt'),
|
|
110
|
+
psAtypicalSourceUrl: document.getElementById('psAtypicalSourceUrl'),
|
|
111
|
+
psAtypicalSourceNote: document.getElementById('psAtypicalSourceNote'),
|
|
112
|
+
psAtypicalReviewEnabled: document.getElementById('psAtypicalReviewEnabled'),
|
|
113
|
+
psAtypicalReviewResetToken: document.getElementById('psAtypicalReviewResetToken'),
|
|
114
|
+
psAtypicalReviewPAbsActualW: document.getElementById('psAtypicalReviewPAbsActualW'),
|
|
115
|
+
psAtypicalReviewPHlzfMaxW: document.getElementById('psAtypicalReviewPHlzfMaxW'),
|
|
116
|
+
psAtypicalReviewPowerPriceEurPerKwYear: document.getElementById('psAtypicalReviewPowerPriceEurPerKwYear'),
|
|
117
|
+
psAtypicalReviewEnergyPriceEurPerKwh: document.getElementById('psAtypicalReviewEnergyPriceEurPerKwh'),
|
|
118
|
+
psAtypicalReviewAnnualEnergyKwh: document.getElementById('psAtypicalReviewAnnualEnergyKwh'),
|
|
119
|
+
psAtypicalReviewSavingsBagatelleEur: document.getElementById('psAtypicalReviewSavingsBagatelleEur'),
|
|
120
|
+
psAtypicalReviewGeneralGridFeeEur: document.getElementById('psAtypicalReviewGeneralGridFeeEur'),
|
|
121
|
+
psAtypicalReviewMaxReductionPercent: document.getElementById('psAtypicalReviewMaxReductionPercent'),
|
|
122
|
+
psAtypicalReviewNote: document.getElementById('psAtypicalReviewNote'),
|
|
123
|
+
psAtypicalReviewPreview: document.getElementById('psAtypicalReviewPreview'),
|
|
106
124
|
|
|
107
125
|
// Tabs
|
|
108
126
|
tabs: document.getElementById('nw-ems-tabs'),
|
|
@@ -293,6 +311,88 @@
|
|
|
293
311
|
el.value = Number.isFinite(n) ? String(n) : '';
|
|
294
312
|
}
|
|
295
313
|
|
|
314
|
+
function _psSetTextInput(el, value) {
|
|
315
|
+
if (!el) return;
|
|
316
|
+
el.value = (value === null || value === undefined) ? '' : String(value);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function _psRound2(n) {
|
|
320
|
+
const x = Number(n);
|
|
321
|
+
return Number.isFinite(x) ? Math.round(x * 100) / 100 : 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function _psBuildAtypicalReviewFromUi() {
|
|
325
|
+
const voltageLevel = els.psAtypicalVoltageLevel ? els.psAtypicalVoltageLevel.value : 'MS';
|
|
326
|
+
const thresholdInput = _psNumOrNull(els.psAtypicalThresholdPercent && els.psAtypicalThresholdPercent.value);
|
|
327
|
+
const thresholdPercent = thresholdInput === null ? _psThresholdForVoltage(voltageLevel) : Math.min(100, Math.max(0, thresholdInput));
|
|
328
|
+
const minShiftInput = _psNumOrNull(els.psAtypicalMinShiftW && els.psAtypicalMinShiftW.value);
|
|
329
|
+
const minShiftW = minShiftInput === null ? 100000 : Math.max(0, minShiftInput);
|
|
330
|
+
const pAbsActualW = _psNumOrNull(els.psAtypicalReviewPAbsActualW && els.psAtypicalReviewPAbsActualW.value);
|
|
331
|
+
const pHlzfMaxW = _psNumOrNull(els.psAtypicalReviewPHlzfMaxW && els.psAtypicalReviewPHlzfMaxW.value);
|
|
332
|
+
const powerPrice = _psNumOrNull(els.psAtypicalReviewPowerPriceEurPerKwYear && els.psAtypicalReviewPowerPriceEurPerKwYear.value);
|
|
333
|
+
const bagatelleInput = _psNumOrNull(els.psAtypicalReviewSavingsBagatelleEur && els.psAtypicalReviewSavingsBagatelleEur.value);
|
|
334
|
+
const bagatelleEur = bagatelleInput === null ? 500 : Math.max(0, bagatelleInput);
|
|
335
|
+
const generalGridFee = _psNumOrNull(els.psAtypicalReviewGeneralGridFeeEur && els.psAtypicalReviewGeneralGridFeeEur.value);
|
|
336
|
+
const maxReductionInput = _psNumOrNull(els.psAtypicalReviewMaxReductionPercent && els.psAtypicalReviewMaxReductionPercent.value);
|
|
337
|
+
const maxReductionPercent = maxReductionInput === null ? 80 : Math.min(100, Math.max(0, maxReductionInput));
|
|
338
|
+
|
|
339
|
+
const complete = (pAbsActualW !== null && pAbsActualW > 0 && pHlzfMaxW !== null && pHlzfMaxW >= 0);
|
|
340
|
+
const deltaW = complete ? Math.max(0, pAbsActualW - pHlzfMaxW) : 0;
|
|
341
|
+
const deltaPercent = complete ? (deltaW / pAbsActualW * 100) : 0;
|
|
342
|
+
const thresholdOk = complete && deltaPercent + 1e-9 >= thresholdPercent;
|
|
343
|
+
const minShiftOk = complete && deltaW + 1e-9 >= minShiftW;
|
|
344
|
+
const grossSavingsEur = (complete && powerPrice !== null && powerPrice > 0) ? ((deltaW / 1000) * powerPrice) : null;
|
|
345
|
+
const reductionCapEur = (grossSavingsEur !== null && generalGridFee !== null && generalGridFee > 0) ? (generalGridFee * maxReductionPercent / 100) : null;
|
|
346
|
+
const savingsEur = grossSavingsEur === null ? null : (reductionCapEur === null ? grossSavingsEur : Math.min(grossSavingsEur, reductionCapEur));
|
|
347
|
+
const savingsOk = savingsEur === null ? null : savingsEur + 1e-9 >= bagatelleEur;
|
|
348
|
+
const technicalEligible = complete && thresholdOk && minShiftOk;
|
|
349
|
+
const eligible = technicalEligible && savingsOk === true;
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
complete,
|
|
353
|
+
thresholdPercent,
|
|
354
|
+
minShiftW,
|
|
355
|
+
pAbsActualW: pAbsActualW === null ? 0 : pAbsActualW,
|
|
356
|
+
pHlzfMaxW: pHlzfMaxW === null ? 0 : pHlzfMaxW,
|
|
357
|
+
deltaW,
|
|
358
|
+
deltaPercent,
|
|
359
|
+
powerPriceEurPerKwYear: powerPrice === null ? 0 : powerPrice,
|
|
360
|
+
generalGridFeeEur: generalGridFee === null ? 0 : generalGridFee,
|
|
361
|
+
maxReductionPercent,
|
|
362
|
+
bagatelleEur,
|
|
363
|
+
grossSavingsEur,
|
|
364
|
+
reductionCapEur,
|
|
365
|
+
savingsEur,
|
|
366
|
+
thresholdOk,
|
|
367
|
+
minShiftOk,
|
|
368
|
+
savingsOk,
|
|
369
|
+
technicalEligible,
|
|
370
|
+
eligible,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function _psUpdateAtypicalReviewPreview() {
|
|
375
|
+
if (!els.psAtypicalReviewPreview) return;
|
|
376
|
+
const r = _psBuildAtypicalReviewFromUi();
|
|
377
|
+
if (!r.complete) {
|
|
378
|
+
els.psAtypicalReviewPreview.textContent = 'Noch keine vollständigen Nachkontrollwerte eingetragen. Benötigt werden P_abs_ist und P_HLZF_max aus Live-Messung oder Jahres-/RLM-Export.';
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const parts = [
|
|
382
|
+
`Verlagerung: ${Math.round(r.deltaW)} W / ${_psRound2(r.deltaPercent)} %`,
|
|
383
|
+
`Schwelle: ${_psRound2(r.thresholdPercent)} % ${r.thresholdOk ? '✅' : '❌'}`,
|
|
384
|
+
`Mindestverlagerung: ${Math.round(r.minShiftW)} W ${r.minShiftOk ? '✅' : '❌'}`,
|
|
385
|
+
];
|
|
386
|
+
if (r.savingsEur === null) {
|
|
387
|
+
parts.push('Ersparnis: noch nicht berechnet (Leistungspreis fehlt) ⚠️');
|
|
388
|
+
} else {
|
|
389
|
+
parts.push(`Ersparnis grob: ${_psRound2(r.savingsEur)} € ${r.savingsOk ? '✅' : '❌'} (Bagatelle ${_psRound2(r.bagatelleEur)} €)`);
|
|
390
|
+
}
|
|
391
|
+
const status = r.eligible ? 'Status: §19-Nachkontrolle erfüllt ✅'
|
|
392
|
+
: (r.technicalEligible ? 'Status: technisch erfüllt, wirtschaftliche Prüfung noch offen/negativ ⚠️' : 'Status: Kriterien noch nicht erfüllt ❌');
|
|
393
|
+
els.psAtypicalReviewPreview.textContent = `${parts.join(' · ')} · ${status}`;
|
|
394
|
+
}
|
|
395
|
+
|
|
296
396
|
function _psSetSelect(el, value, fallback) {
|
|
297
397
|
if (!el) return;
|
|
298
398
|
const v = String(value || fallback || '').trim();
|
|
@@ -1050,8 +1150,14 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
1050
1150
|
const atypicalIds = [
|
|
1051
1151
|
'psAtypicalVoltageLevel', 'psAtypicalThresholdPercent', 'psAtypicalApplyVoltageThreshold',
|
|
1052
1152
|
'psAtypicalPAbsRefW', 'psAtypicalMinShiftW', 'psAtypicalTargetLimitW', 'psAtypicalSafetyMarginW',
|
|
1153
|
+
'psAtypicalGridOperator', 'psAtypicalYear', 'psAtypicalSourceDocument', 'psAtypicalSourcePublishedAt',
|
|
1154
|
+
'psAtypicalSourceUrl', 'psAtypicalSourceNote',
|
|
1053
1155
|
'psAtypicalIncludeWeekends', 'psAtypicalExcludeChristmasNewYear', 'psAtypicalHolidays',
|
|
1054
|
-
'psAtypicalBridgeDays', 'psAtypicalCalendarExceptions', 'psAtypicalAddWindow'
|
|
1156
|
+
'psAtypicalBridgeDays', 'psAtypicalCalendarExceptions', 'psAtypicalAddWindow',
|
|
1157
|
+
'psAtypicalReviewEnabled', 'psAtypicalReviewResetToken', 'psAtypicalReviewPAbsActualW',
|
|
1158
|
+
'psAtypicalReviewPHlzfMaxW', 'psAtypicalReviewPowerPriceEurPerKwYear',
|
|
1159
|
+
'psAtypicalReviewSavingsBagatelleEur', 'psAtypicalReviewGeneralGridFeeEur',
|
|
1160
|
+
'psAtypicalReviewMaxReductionPercent', 'psAtypicalReviewNote'
|
|
1055
1161
|
];
|
|
1056
1162
|
atypicalIds.forEach((id) => {
|
|
1057
1163
|
const el = document.getElementById(id);
|
|
@@ -1103,8 +1209,29 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
1103
1209
|
if (els.psAtypicalBridgeDays) els.psAtypicalBridgeDays.value = _psFormatDateList(a.bridgeDays || a.bridgeDayDates || []);
|
|
1104
1210
|
if (els.psAtypicalCalendarExceptions) els.psAtypicalCalendarExceptions.value = _psFormatDateList(a.calendarExceptions || a.exceptions || []);
|
|
1105
1211
|
|
|
1212
|
+
_psSetTextInput(els.psAtypicalGridOperator, a.gridOperatorName || a.gridOperator || a.networkOperator || a.netzbetreiber || '');
|
|
1213
|
+
_psSetNumberInput(els.psAtypicalYear, a.year || a.validityYear || a.calendarYear);
|
|
1214
|
+
_psSetTextInput(els.psAtypicalSourceDocument, a.sourceDocument || a.sourceName || a.source || '');
|
|
1215
|
+
_psSetTextInput(els.psAtypicalSourcePublishedAt, a.sourcePublishedAt || a.publishedAt || '');
|
|
1216
|
+
_psSetTextInput(els.psAtypicalSourceUrl, a.sourceUrl || a.sourceLink || '');
|
|
1217
|
+
_psSetTextInput(els.psAtypicalSourceNote, a.sourceNote || a.notes || a.comment || a.note || '');
|
|
1218
|
+
|
|
1219
|
+
const review = (a.review && typeof a.review === 'object') ? a.review : (a.nachkontrolle && typeof a.nachkontrolle === 'object' ? a.nachkontrolle : {});
|
|
1220
|
+
if (els.psAtypicalReviewEnabled) els.psAtypicalReviewEnabled.checked = review.enabled !== false;
|
|
1221
|
+
_psSetTextInput(els.psAtypicalReviewResetToken, review.resetToken || review.resetKey || '');
|
|
1222
|
+
_psSetNumberInput(els.psAtypicalReviewPAbsActualW, review.pAbsActualW ?? review.actualAnnualPeakW ?? review.pAbsIstW);
|
|
1223
|
+
_psSetNumberInput(els.psAtypicalReviewPHlzfMaxW, review.pHlzfMaxW ?? review.hlzfPeakW ?? review.pHlzfIstW);
|
|
1224
|
+
_psSetNumberInput(els.psAtypicalReviewPowerPriceEurPerKwYear, review.powerPriceEurPerKwYear ?? review.powerPriceEurPerKwA ?? review.leistungspreisEurProKwJahr);
|
|
1225
|
+
_psSetNumberInput(els.psAtypicalReviewEnergyPriceEurPerKwh, review.energyPriceEurPerKwh ?? review.arbeitspreisEurProKwh);
|
|
1226
|
+
_psSetNumberInput(els.psAtypicalReviewAnnualEnergyKwh, review.annualEnergyKwh ?? review.jahresarbeitKwh);
|
|
1227
|
+
_psSetNumberInput(els.psAtypicalReviewSavingsBagatelleEur, review.bagatelleEur ?? review.bagatellgrenzeEur ?? review.savingsBagatelleEur ?? 500);
|
|
1228
|
+
_psSetNumberInput(els.psAtypicalReviewGeneralGridFeeEur, review.generalGridFeeEur ?? review.generalGridFee ?? review.allgemeinesNetzentgeltEur);
|
|
1229
|
+
_psSetNumberInput(els.psAtypicalReviewMaxReductionPercent, review.maxReductionPercent ?? 80);
|
|
1230
|
+
_psSetTextInput(els.psAtypicalReviewNote, review.note || review.reviewNote || '');
|
|
1231
|
+
|
|
1106
1232
|
buildAtypicalWindowsUI();
|
|
1107
1233
|
_psUpdateAtypicalFieldState();
|
|
1234
|
+
_psUpdateAtypicalReviewPreview();
|
|
1108
1235
|
}
|
|
1109
1236
|
|
|
1110
1237
|
function collectPeakShavingConfigFromUI(baseCfg) {
|
|
@@ -1156,6 +1283,44 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
1156
1283
|
a.calendarExceptions = _psParseDateList(els.psAtypicalCalendarExceptions && els.psAtypicalCalendarExceptions.value);
|
|
1157
1284
|
a.highLoadWindows = _psCollectWindowRows();
|
|
1158
1285
|
|
|
1286
|
+
const setStr = (key, el) => {
|
|
1287
|
+
if (!el) return;
|
|
1288
|
+
const v = String(el.value || '').trim();
|
|
1289
|
+
if (v) a[key] = v; else delete a[key];
|
|
1290
|
+
};
|
|
1291
|
+
setStr('gridOperator', els.psAtypicalGridOperator);
|
|
1292
|
+
const year = _psNumOrNull(els.psAtypicalYear && els.psAtypicalYear.value);
|
|
1293
|
+
if (year !== null && year > 0) a.year = Math.round(year); else delete a.year;
|
|
1294
|
+
setStr('sourceDocument', els.psAtypicalSourceDocument);
|
|
1295
|
+
setStr('sourcePublishedAt', els.psAtypicalSourcePublishedAt);
|
|
1296
|
+
setStr('sourceUrl', els.psAtypicalSourceUrl);
|
|
1297
|
+
setStr('sourceNote', els.psAtypicalSourceNote);
|
|
1298
|
+
setStr('notes', els.psAtypicalSourceNote);
|
|
1299
|
+
|
|
1300
|
+
const review = {};
|
|
1301
|
+
if (els.psAtypicalReviewEnabled) review.enabled = !!els.psAtypicalReviewEnabled.checked;
|
|
1302
|
+
const resetToken = String((els.psAtypicalReviewResetToken && els.psAtypicalReviewResetToken.value) || '').trim();
|
|
1303
|
+
if (resetToken) review.resetToken = resetToken;
|
|
1304
|
+
const pAbsActual = _psNumOrNull(els.psAtypicalReviewPAbsActualW && els.psAtypicalReviewPAbsActualW.value);
|
|
1305
|
+
if (pAbsActual !== null && pAbsActual > 0) review.pAbsActualW = Math.round(pAbsActual);
|
|
1306
|
+
const pHlzf = _psNumOrNull(els.psAtypicalReviewPHlzfMaxW && els.psAtypicalReviewPHlzfMaxW.value);
|
|
1307
|
+
if (pHlzf !== null && pHlzf >= 0) review.pHlzfMaxW = Math.round(pHlzf);
|
|
1308
|
+
const price = _psNumOrNull(els.psAtypicalReviewPowerPriceEurPerKwYear && els.psAtypicalReviewPowerPriceEurPerKwYear.value);
|
|
1309
|
+
if (price !== null && price >= 0) review.powerPriceEurPerKwYear = price;
|
|
1310
|
+
const generalGridFee = _psNumOrNull(els.psAtypicalReviewGeneralGridFeeEur && els.psAtypicalReviewGeneralGridFeeEur.value);
|
|
1311
|
+
if (generalGridFee !== null && generalGridFee >= 0) review.generalGridFeeEur = generalGridFee;
|
|
1312
|
+
const energyPrice = _psNumOrNull(els.psAtypicalReviewEnergyPriceEurPerKwh && els.psAtypicalReviewEnergyPriceEurPerKwh.value);
|
|
1313
|
+
if (energyPrice !== null && energyPrice >= 0) review.energyPriceEurPerKwh = energyPrice;
|
|
1314
|
+
const annualEnergy = _psNumOrNull(els.psAtypicalReviewAnnualEnergyKwh && els.psAtypicalReviewAnnualEnergyKwh.value);
|
|
1315
|
+
if (annualEnergy !== null && annualEnergy >= 0) review.annualEnergyKwh = annualEnergy;
|
|
1316
|
+
const bag = _psNumOrNull(els.psAtypicalReviewSavingsBagatelleEur && els.psAtypicalReviewSavingsBagatelleEur.value);
|
|
1317
|
+
review.bagatelleEur = bag !== null && bag >= 0 ? bag : 500;
|
|
1318
|
+
const maxReduction = _psNumOrNull(els.psAtypicalReviewMaxReductionPercent && els.psAtypicalReviewMaxReductionPercent.value);
|
|
1319
|
+
review.maxReductionPercent = maxReduction !== null ? Math.min(100, Math.max(0, maxReduction)) : 80;
|
|
1320
|
+
const note = String((els.psAtypicalReviewNote && els.psAtypicalReviewNote.value) || '').trim();
|
|
1321
|
+
if (note) review.note = note;
|
|
1322
|
+
if (Object.keys(review).length) a.review = review; else delete a.review;
|
|
1323
|
+
|
|
1159
1324
|
out.atypical = a;
|
|
1160
1325
|
return out;
|
|
1161
1326
|
}
|
|
@@ -8615,8 +8780,23 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
8615
8780
|
if (els.psAtypicalThresholdPercent) {
|
|
8616
8781
|
els.psAtypicalThresholdPercent.value = String(_psThresholdForVoltage(els.psAtypicalVoltageLevel ? els.psAtypicalVoltageLevel.value : 'MS'));
|
|
8617
8782
|
}
|
|
8783
|
+
try { _psUpdateAtypicalReviewPreview(); } catch (_e) {}
|
|
8618
8784
|
});
|
|
8619
8785
|
}
|
|
8786
|
+
|
|
8787
|
+
[
|
|
8788
|
+
'psAtypicalThresholdPercent',
|
|
8789
|
+
'psAtypicalMinShiftW',
|
|
8790
|
+
'psAtypicalReviewPAbsActualW',
|
|
8791
|
+
'psAtypicalReviewPHlzfMaxW',
|
|
8792
|
+
'psAtypicalReviewPowerPriceEurPerKwYear',
|
|
8793
|
+
'psAtypicalReviewSavingsBagatelleEur',
|
|
8794
|
+
'psAtypicalReviewGeneralGridFeeEur',
|
|
8795
|
+
'psAtypicalReviewMaxReductionPercent',
|
|
8796
|
+
].forEach((id) => {
|
|
8797
|
+
const el = document.getElementById(id);
|
|
8798
|
+
if (el) el.addEventListener('input', () => { try { _psUpdateAtypicalReviewPreview(); } catch (_e) {} });
|
|
8799
|
+
});
|
|
8620
8800
|
if (els.psAtypicalAddWindow) {
|
|
8621
8801
|
els.psAtypicalAddWindow.addEventListener('click', () => {
|
|
8622
8802
|
const ps = _psGetPeakCfg();
|
package/www/sw.js
CHANGED