iobroker.eos-admin 9.0.30 → 9.0.33
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/NEXOWATT_EOS_BUILD_INFO.json +11 -12
- package/README.md +11 -11
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +111 -110
- package/adminWww/apple-touch-icon-eos-v2.png +0 -0
- package/adminWww/apple-touch-icon.png +0 -0
- package/adminWww/assets/{AdapterUpdateDialog-qC6MANmq.js → AdapterUpdateDialog-DBUqmmyD.js} +1 -1
- package/adminWww/assets/{Adapters-C8quekd0.js → Adapters-dDEp7o5h.js} +1 -1
- package/adminWww/assets/{ConfigManager-hRZCAWRy.js → ConfigManager-DbqTWi2N.js} +1 -1
- package/adminWww/assets/{Enums-Dd0Z2KfV.js → Enums-DjldGElU.js} +1 -1
- package/adminWww/assets/{Fields-WfHFtdYw.js → Fields-0GsPCJeU.js} +1 -1
- package/adminWww/assets/{Files-DyG14v5-.js → Files-COnUtEbg.js} +1 -1
- package/adminWww/assets/{Hosts-3pSXVMxW.js → Hosts-CwU1LujG.js} +1 -1
- package/adminWww/assets/{Instances-DT6fp_TN.js → Instances-CUX5mxMQ.js} +1 -1
- package/adminWww/assets/{Intro-C6pMFhbu.js → Intro-BhQmHn3A.js} +1 -1
- package/adminWww/assets/{Logs-suepwNkZ.js → Logs-B5SpNqHq.js} +1 -1
- package/adminWww/assets/{Objects-CpjVeEjv.js → Objects-COg_cFkz.js} +1 -1
- package/adminWww/assets/{Overview-CxZJgF7X.js → Overview-CitzUjBF.js} +1 -1
- package/adminWww/assets/{State-CUsia7sz.js → State-D5ljzf-T.js} +1 -1
- package/adminWww/assets/{UsedResources-C3zr7pM8.js → UsedResources-BY_NF2wB.js} +1 -1
- package/adminWww/assets/{Users-BoBSUBkO.js → Users-Cu93_-VF.js} +1 -1
- package/adminWww/assets/{bootstrap-CM9qXoc1.js → bootstrap-Dwfxhm2V.js} +3 -3
- package/adminWww/assets/{hostInit-BQPg9kSQ.js → hostInit-3BbTwhaZ.js} +1 -1
- package/adminWww/assets/{icons-material-CDhwkQ0o.js → icons-material-DjqX0l_7.js} +1 -1
- package/adminWww/assets/{index-BrXN_pu2.js → index-nddph2Sl.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-BEgWxsNI.js → installSVGRenderer-CPDIwFAL.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-3ef6056c.js → mf-entry-bootstrap-0-d1f0f40f.js} +2 -2
- package/adminWww/index.html +24 -24
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/remoteEntry-eos-9.0.33.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosUiProcess.js +31 -14
- package/build/lib/eosUiProcess.js.map +1 -1
- package/build/lib/eosUiProcessRpc.js +3 -1
- package/build/lib/eosUiProcessRpc.js.map +1 -1
- package/build/lib/eosUiProcessWorker.js +6 -4
- package/build/lib/eosUiProcessWorker.js.map +1 -1
- package/build/lib/web.js +9 -8
- package/build/lib/web.js.map +1 -1
- package/docs/README.md +3 -2
- package/docs/reports/unified-9.0.31/PRUEFBERICHT.md +22 -0
- package/docs/reports/unified-9.0.31/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.31/raw/INDEX.json +102 -0
- package/docs/reports/unified-9.0.31/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.31/raw/branding-build-node22.log +59 -0
- package/docs/reports/unified-9.0.31/raw/branding-node24.log +17 -0
- package/docs/reports/unified-9.0.31/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.31/raw/https-build-node22.log +235 -0
- package/docs/reports/unified-9.0.31/raw/https-node24.log +46 -0
- package/docs/reports/unified-9.0.31/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.31/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.31/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.31/raw/node22-tests-final.log +17170 -0
- package/docs/reports/unified-9.0.31/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.31/raw/node24-tests-final.log +2862 -0
- package/docs/reports/unified-9.0.31/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.31/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.31/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.31/raw/web-lint.log +0 -0
- package/docs/reports/unified-9.0.32/PRUEFBERICHT.md +34 -0
- package/docs/reports/unified-9.0.32/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.32/raw/INDEX.json +102 -0
- package/docs/reports/unified-9.0.32/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.32/raw/browser-cadence-headless.json +63 -0
- package/docs/reports/unified-9.0.32/raw/browser-flow-headless.json +328 -0
- package/docs/reports/unified-9.0.32/raw/focused.log +67 -0
- package/docs/reports/unified-9.0.32/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.32/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.32/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.32/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.32/raw/node22-tests-final.log +17212 -0
- package/docs/reports/unified-9.0.32/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.32/raw/node24-tests-final.log +2869 -0
- package/docs/reports/unified-9.0.32/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.32/raw/sbom.log +2 -0
- package/docs/reports/unified-9.0.32/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.32/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.32/raw/version-parity-928-929.log +6 -0
- package/docs/reports/unified-9.0.33/PRUEFBERICHT.md +60 -0
- package/docs/reports/unified-9.0.33/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.33/raw/INDEX.json +272 -0
- package/docs/reports/unified-9.0.33/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.33/raw/browser/UI_REVIEW.json +147 -0
- package/docs/reports/unified-9.0.33/raw/browser/admin-bundle.log +136 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-backup-settings-browser.log +67 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-customer-tariff-startup-browser.log +43 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-browser-smoke.log +438 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-cadence-browser-10s.log +108 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-evcs-delete-browser.log +1 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-history-setup-browser-smoke.log +49 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-kiosk-browser.log +59 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-admin-browser.log +71 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-installer-discovery-browser.log +11 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-pwa-trust-browser.log +35 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-controls-browser.log +78 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-health-browser.log +49 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-login-browser.log +34 -0
- package/docs/reports/unified-9.0.33/raw/browser/smarthome.log +46 -0
- package/docs/reports/unified-9.0.33/raw/browser-ten-seconds.json +108 -0
- package/docs/reports/unified-9.0.33/raw/changed-test-coverage.json +116 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-node22.jsonl +42 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-summary-node22.json +103 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-summary.json +103 -0
- package/docs/reports/unified-9.0.33/raw/connected-control.jsonl +42 -0
- package/docs/reports/unified-9.0.33/raw/display-ui-node22.log +162 -0
- package/docs/reports/unified-9.0.33/raw/display-ui.log +35 -0
- package/docs/reports/unified-9.0.33/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.33/raw/git-delivery-fix.log +10 -0
- package/docs/reports/unified-9.0.33/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.33/raw/license-central-node24.log +173 -0
- package/docs/reports/unified-9.0.33/raw/lint-final.log +45 -0
- package/docs/reports/unified-9.0.33/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.33/raw/node22-npm-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node22-tests-final.log +17646 -0
- package/docs/reports/unified-9.0.33/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node24-npm-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node24-tests-final.log +2941 -0
- package/docs/reports/unified-9.0.33/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/process-final-node22.log +220 -0
- package/docs/reports/unified-9.0.33/raw/process-final-node24.log +110 -0
- package/docs/reports/unified-9.0.33/raw/ram-picker.jsonl +12 -0
- package/docs/reports/unified-9.0.33/raw/reg-combined-node22.log +622 -0
- package/docs/reports/unified-9.0.33/raw/reg-combined.log +108 -0
- package/docs/reports/unified-9.0.33/raw/sbom-final.log +8 -0
- package/docs/reports/unified-9.0.33/raw/tariff-update-all-final-node22.log +1185 -0
- package/docs/reports/unified-9.0.33/raw/typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.33/raw/ui-functional-node24.log +430 -0
- package/docs/reports/unified-9.0.33/raw/ui-runtime-final-verification.log +1 -0
- package/docs/reports/unified-9.0.33/raw/update-controller-standard-7-2-5.log +4 -0
- package/docs/reports/unified-9.0.33/raw/worker-memory-eos933.log +12 -0
- package/docs/reports/unified-9.0.33/raw/worker-memory-flow932.log +12 -0
- package/docs/start/START_HIER_9.0.31.md +16 -0
- package/docs/start/START_HIER_9.0.32.md +16 -0
- package/docs/start/START_HIER_9.0.33.md +32 -0
- package/io-package.json +16 -16
- package/package.json +10 -5
- package/public/eos-tls/trust.html +1 -1
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +259 -157
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +341 -88
- package/release-manifests/unified/runtime.cdx.json +26 -26
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +2 -2
- package/ui/ems/consumers/sg-ready.js +26 -6
- package/ui/ems/datapoints.js +12 -4
- package/ui/ems/modules/charging-management.js +58 -67
- package/ui/ems/modules/core-limits.js +59 -36
- package/ui/ems/modules/prime-mover-control.js +141 -29
- package/ui/ems/modules/storage-control.js +31 -38
- package/ui/ems/modules/storage-mapping.js +14 -13
- package/ui/ems/modules/tarif-vis.js +38 -56
- package/ui/ems/services/measurement-freshness.js +58 -21
- package/ui/ems/services/safety-envelope.js +13 -6
- package/ui/io-package.json +13 -1
- package/ui/lib/datapoint-picker.js +27 -20
- package/ui/lib/eos-presentation-routes.js +2 -5
- package/ui/lib/tariff-price.js +7 -1
- package/ui/lib/ts-mirrors/ems/core-limits/core-runtime.js +5 -1
- package/ui/lib/ui-access-policy.js +12 -3
- package/ui/main.js +280 -190
- package/ui/package.json +4 -3
- package/ui/www/app.js +207 -87
- package/ui/www/ems-apps.html +1 -1
- package/ui/www/ems-apps.js +3 -2
- package/ui/www/energy-ledger.html +1 -1
- package/ui/www/evcs.html +1 -1
- package/ui/www/history.html +1 -1
- package/ui/www/index.html +2 -1
- package/ui/www/live-display.js +38 -4
- package/ui/www/logic.html +1 -1
- package/ui/www/login.html +1 -1
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/power-measurements.js +28 -3
- package/ui/www/settings.html +1 -1
- package/ui/www/simulation.html +1 -1
- package/ui/www/smarthome-config.html +1 -1
- package/ui/www/smarthome.html +1 -1
- package/ui/www/storagefarm.html +1 -1
- package/adminWww/remoteEntry-eos-9.0.30.js +0 -12
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
8
8
|
*
|
|
9
9
|
* Quelle: src-ts/runtime-executables/ems/modules/core-limits.ts
|
|
10
|
-
* Quell-Hash: sha256:
|
|
10
|
+
* Quell-Hash: sha256:8cfc36ca57999179b9e1695765fbd1e6e35eef0fc146d3b310fff381482736b8
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -331,6 +331,7 @@ function legacyComputeCentralBudgetGrant(runtime = {}, request = {}) {
|
|
|
331
331
|
* - Ohne irgendeinen physikalischen Beleg bleibt die Obergrenze 0 W.
|
|
332
332
|
*/
|
|
333
333
|
function legacyResolvePvBudgetPhysicalCapW({
|
|
334
|
+
storageFlowUsable = true,
|
|
334
335
|
measuredPvW = 0,
|
|
335
336
|
measuredPvFresh = false,
|
|
336
337
|
flowRawW = 0,
|
|
@@ -343,6 +344,7 @@ function legacyResolvePvBudgetPhysicalCapW({
|
|
|
343
344
|
exportEvidenceThresholdW = 250,
|
|
344
345
|
importToleranceW = 250,
|
|
345
346
|
} = {}) {
|
|
347
|
+
if (!storageFlowUsable) return { capW: 0, source: 'storage-flow-unverified', trusted: false, held: false };
|
|
346
348
|
const measuredW = Math.max(0, Number(measuredPvW) || 0);
|
|
347
349
|
const flowW = Math.max(0, Number(flowRawW) || 0);
|
|
348
350
|
const exportW = Math.max(0, Number(gridExportW) || 0);
|
|
@@ -1414,6 +1416,40 @@ class CoreLimitsModule extends BaseModule {
|
|
|
1414
1416
|
return fallback;
|
|
1415
1417
|
}
|
|
1416
1418
|
|
|
1419
|
+
// Core runs before charging management. Re-read the last classified meter
|
|
1420
|
+
// mappings against the current cycle's source cache, after NVP and EV have
|
|
1421
|
+
// changed. A previous cycle's aggregate cannot follow a real start or stop.
|
|
1422
|
+
_currentEvMeterPowers(now, maxAgeMs) {
|
|
1423
|
+
const meters = this.adapter?._zeroExportEvcsMeters;
|
|
1424
|
+
if (!(meters?.pvBaseByKey instanceof Map) || typeof this.dp?.getVerifiedMeasurementTimestampMs !== 'function') return null;
|
|
1425
|
+
let actualW = 0;
|
|
1426
|
+
let pvManagedW = 0;
|
|
1427
|
+
if (meters.ts > now || now - meters.ts > maxAgeMs) return { actualW, pvManagedW };
|
|
1428
|
+
const seen = new Map();
|
|
1429
|
+
for (const key of meters.keys) {
|
|
1430
|
+
const entry = this.dp.getEntry(key);
|
|
1431
|
+
const id = entry?.srcObjectId || entry?.objectId;
|
|
1432
|
+
if (!id) continue;
|
|
1433
|
+
// A shared meter identifies one physical load but no unique mode.
|
|
1434
|
+
if (seen.has(id)) {
|
|
1435
|
+
pvManagedW -= seen.get(id);
|
|
1436
|
+
seen.set(id, 0);
|
|
1437
|
+
continue;
|
|
1438
|
+
}
|
|
1439
|
+
const stamp = this.dp.getVerifiedMeasurementTimestampMs(key, now);
|
|
1440
|
+
if (!Number.isFinite(stamp) || now - stamp > maxAgeMs) continue;
|
|
1441
|
+
const watts = this.dp.getNumber(key, null);
|
|
1442
|
+
if (!Number.isFinite(watts) || watts < 0) continue;
|
|
1443
|
+
const row = meters.pvBaseByKey.get(key);
|
|
1444
|
+
const eligibleW = row && (row.id === entry.objectId || row.id === id) && Number.isFinite(row.baseW)
|
|
1445
|
+
? Math.max(0, watts - row.baseW) : 0;
|
|
1446
|
+
seen.set(id, eligibleW);
|
|
1447
|
+
actualW += watts;
|
|
1448
|
+
pvManagedW += eligibleW;
|
|
1449
|
+
}
|
|
1450
|
+
return { actualW, pvManagedW };
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1417
1453
|
/**
|
|
1418
1454
|
* Code-Teil: _resolveDirectPvPower
|
|
1419
1455
|
* Zweck: Vergleicht alle frischen direkten PV-Quellen und verwendet die
|
|
@@ -1921,41 +1957,25 @@ class CoreLimitsModule extends BaseModule {
|
|
|
1921
1957
|
// - die nicht ausgewaehlte Topologie ist in jedem Fall ausgeschlossen
|
|
1922
1958
|
let storageChargeW = 0;
|
|
1923
1959
|
let storageDischargeW = 0;
|
|
1924
|
-
|
|
1960
|
+
const batteryMappings = cfg.datapoints || {};
|
|
1961
|
+
const storageFlowExpected = storageTopology !== 'none'
|
|
1962
|
+
|| storageAuthority.farmAggregationActive === true
|
|
1963
|
+
|| ['batteryPower', 'storageChargePower', 'storageDischargePower', 'storageSoc']
|
|
1964
|
+
.some(key => Boolean(String(batteryMappings[key] || '').trim()));
|
|
1965
|
+
let storageFlowUsable = !storageFlowExpected;
|
|
1925
1966
|
try {
|
|
1926
|
-
const flow =
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
if (!usedCentralStorageFlow && storageTopology === 'farm') {
|
|
1937
|
-
// Kompatibilitaets-Fallback fuer Laufzeiten ohne zentralen Resolver:
|
|
1938
|
-
// bei ausgewaehlter Farm sind ausschliesslich Farmaggregate zulaessig.
|
|
1939
|
-
storageChargeW = Math.max(0, this._readCacheNumberMax(['storageFarm.totalChargePowerW'], 0) || 0);
|
|
1940
|
-
storageDischargeW = Math.max(0, this._readCacheNumberMax(['storageFarm.totalDischargePowerW'], 0) || 0);
|
|
1941
|
-
} else if (!usedCentralStorageFlow && storageTopology === 'single') {
|
|
1942
|
-
// Beim Einzelpfad duerfen keine alten Farmwerte in das Budget einfließen.
|
|
1943
|
-
storageChargeW = Math.max(0, this._readCacheNumberMax(['storageChargePower'], 0) || 0);
|
|
1944
|
-
storageDischargeW = Math.max(0, this._readCacheNumberMax(['storageDischargePower'], 0) || 0);
|
|
1945
|
-
const batteryPowerW = this._readCacheNumber(['batteryPower'], null);
|
|
1946
|
-
if (isFiniteNumber(batteryPowerW)) {
|
|
1947
|
-
const flowBatteryMapped = !!(cfg.datapoints && String(cfg.datapoints.batteryPower || '').trim());
|
|
1948
|
-
const invBattery = flowBatteryMapped && !!(cfg.settings && cfg.settings.flowInvertBattery);
|
|
1949
|
-
const signed = Math.round(invBattery ? -batteryPowerW : batteryPowerW);
|
|
1950
|
-
if (signed < -25) {
|
|
1951
|
-
storageChargeW = Math.max(storageChargeW, Math.abs(signed));
|
|
1952
|
-
storageDischargeW = 0;
|
|
1953
|
-
} else if (signed > 25) {
|
|
1954
|
-
storageDischargeW = Math.max(storageDischargeW, signed);
|
|
1955
|
-
storageChargeW = 0;
|
|
1956
|
-
}
|
|
1967
|
+
const flow = this.adapter?._nwResolveBatteryFlowFromCache?.({
|
|
1968
|
+
now, maxAgeMs: staleMs, deadbandW: 25, strictStale: true, observe: true,
|
|
1969
|
+
});
|
|
1970
|
+
const stamp = flow?.observedAt;
|
|
1971
|
+
if (Number.isFinite(stamp) && stamp > 0 && stamp <= now && now - stamp <= staleMs
|
|
1972
|
+
&& Number.isFinite(flow.chargeW) && flow.chargeW >= 0
|
|
1973
|
+
&& Number.isFinite(flow.dischargeW) && flow.dischargeW >= 0) {
|
|
1974
|
+
storageFlowUsable = true;
|
|
1975
|
+
storageChargeW = Math.round(flow.chargeW);
|
|
1976
|
+
storageDischargeW = Math.round(flow.dischargeW);
|
|
1957
1977
|
}
|
|
1958
|
-
}
|
|
1978
|
+
} catch { /* A configured storage with no observation cannot establish PV surplus. */ }
|
|
1959
1979
|
|
|
1960
1980
|
const evcsEnabled = cfg.enableChargingManagement !== false;
|
|
1961
1981
|
const thermalEnabled = cfg.enableThermalControl === true;
|
|
@@ -1980,14 +2000,15 @@ class CoreLimitsModule extends BaseModule {
|
|
|
1980
2000
|
|
|
1981
2001
|
// Nur aktive EMS-Apps dürfen alte Runtimewerte in Budget/Diagnose übernehmen.
|
|
1982
2002
|
const evcsUsedW = evcsEnabled ? evcsUsedRawW : 0;
|
|
1983
|
-
const
|
|
2003
|
+
const currentEvMeters = evcsEnabled ? this._currentEvMeterPowers(now, staleMs) : null;
|
|
2004
|
+
const evcsActualW = evcsEnabled ? (currentEvMeters?.actualW ?? evcsActualRawW) : 0;
|
|
1984
2005
|
const zeroExportMode = readZeroExportMode(this.adapter);
|
|
1985
2006
|
const zeroExportMeasurementIds = new Set();
|
|
1986
2007
|
// Bei Nulleinspeisung die vollständige FRISCHE EV-Aufnahme rekonstruieren,
|
|
1987
2008
|
// einschließlich Boost/Auto-Netzanteil. Der signierte NVP zieht Netzbezug
|
|
1988
2009
|
// bereits ab; ein zweiter Abzug am LP würde PV bei jedem Tick verlieren.
|
|
1989
2010
|
const evcsPvUsedW = evcsEnabled ? (zeroExportMode.active
|
|
1990
|
-
? measuredFlexibleLoadW(this.adapter, this.dp, 'evcs', zeroExportMeasurementIds, now) : evcsPvUsedRawW) : 0;
|
|
2011
|
+
? measuredFlexibleLoadW(this.adapter, this.dp, 'evcs', zeroExportMeasurementIds, now) : (currentEvMeters?.pvManagedW ?? evcsPvUsedRawW)) : 0;
|
|
1991
2012
|
// Bei Nulleinspeisung zählt nur gemessene Aufnahme, kein letzter Sollwert.
|
|
1992
2013
|
const thermalUsedW = thermalEnabled ? (zeroExportMode.active ? measuredFlexibleLoadW(this.adapter, this.dp, 'thermal', zeroExportMeasurementIds, now) : thermalUsedRawW) : 0, thermalActualW = thermalEnabled ? thermalActualRawW : 0;
|
|
1993
2014
|
const heatingRodUsedW = heatingRodEnabled ? (zeroExportMode.active ? measuredFlexibleLoadW(this.adapter, this.dp, 'heatingRod', zeroExportMeasurementIds, now) : heatingRodUsedRawW) : 0, heatingRodActualW = heatingRodEnabled ? heatingRodActualRawW : 0;
|
|
@@ -2012,6 +2033,7 @@ class CoreLimitsModule extends BaseModule {
|
|
|
2012
2033
|
? Math.max(0, now - this._lastTrustedPvPhysicalCapTs)
|
|
2013
2034
|
: null;
|
|
2014
2035
|
const pvPhysicalResolution = resolvePvBudgetPhysicalCapW({
|
|
2036
|
+
storageFlowUsable,
|
|
2015
2037
|
measuredPvW: pvPowerW,
|
|
2016
2038
|
measuredPvFresh: pvPowerInfo.fresh === true,
|
|
2017
2039
|
flowRawW: pvBudgetFlowRawW,
|
|
@@ -2327,6 +2349,7 @@ class CoreLimitsModule extends BaseModule {
|
|
|
2327
2349
|
importToleranceW: 250,
|
|
2328
2350
|
},
|
|
2329
2351
|
storage: {
|
|
2352
|
+
flowUsable: storageFlowUsable,
|
|
2330
2353
|
chargeW: storageChargeW,
|
|
2331
2354
|
dischargeW: storageDischargeW,
|
|
2332
2355
|
eligible: storageEligible,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
8
8
|
*
|
|
9
9
|
* Quelle: src-ts/runtime-executables/ems/modules/prime-mover-control.ts
|
|
10
|
-
* Quell-Hash: sha256:
|
|
10
|
+
* Quell-Hash: sha256:3f1030aba5b5f1e62a544da0f09dcecd353268007757398e3c7fdda3064afd79
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -86,6 +86,8 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
86
86
|
this.runtime = new Map();
|
|
87
87
|
this.actuatorContract = new ActuatorCommandContract();
|
|
88
88
|
this.stateCache = new Map();
|
|
89
|
+
this.pendingPulses = new Map();
|
|
90
|
+
this.loadedPulseState = new Set();
|
|
89
91
|
this.maxDevices = 10;
|
|
90
92
|
this.inited = false;
|
|
91
93
|
this.adapter = adapter;
|
|
@@ -95,6 +97,8 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
95
97
|
async init() {
|
|
96
98
|
await this.ensureObjects();
|
|
97
99
|
await this.loadConfig();
|
|
100
|
+
for (const device of this.devices)
|
|
101
|
+
await this.restorePulse(device);
|
|
98
102
|
this.inited = true;
|
|
99
103
|
}
|
|
100
104
|
root() { return this.spec.kind; }
|
|
@@ -149,6 +153,7 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
149
153
|
['retryCount', 'Wiederholungen', 'number', 'value', 0, ''],
|
|
150
154
|
['faultLocked', 'Fehlerverriegelung', 'boolean', 'indicator', false, ''],
|
|
151
155
|
['faultUntil', 'Fehlerverriegelung bis', 'number', 'value.time', 0, ''],
|
|
156
|
+
['pulseResetPending', 'Ausstehende Rücknahme eines Start-/Stoppimpulses', 'string', 'json', '', ''],
|
|
152
157
|
['writeContractStatus', 'Aktor Vertragsstatus', 'string', 'text', '', ''],
|
|
153
158
|
['minRunRemainingSec', 'Verbleibende Mindestlaufzeit', 'number', 'value.interval', 0, 's'],
|
|
154
159
|
['minOffRemainingSec', 'Verbleibender Mindeststillstand', 'number', 'value.interval', 0, 's'],
|
|
@@ -241,7 +246,7 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
241
246
|
const existing = this.runtime.get(id);
|
|
242
247
|
if (existing)
|
|
243
248
|
return existing;
|
|
244
|
-
const created = { wasRunning: null, stateSinceTs: 0, lastOnMs: 0, lastOffMs: 0, lastCmdMs: 0, lastCmd: '', reconstructed: false };
|
|
249
|
+
const created = { wasRunning: null, stateSinceTs: 0, lastOnMs: 0, lastOffMs: 0, lastCmdMs: 0, lastCmd: '', restoredPulse: false, reconstructed: false };
|
|
245
250
|
this.runtime.set(id, created);
|
|
246
251
|
return created;
|
|
247
252
|
}
|
|
@@ -430,6 +435,8 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
430
435
|
if (isActuatorAuthorityBlockedResult(result)) {
|
|
431
436
|
return { accepted: false, blocked: true, error: text(result.reason || 'blocked-by-authority') };
|
|
432
437
|
}
|
|
438
|
+
if (result === false || result?.accepted === false)
|
|
439
|
+
return { accepted: false, blocked: false, error: 'write-rejected' };
|
|
433
440
|
return { accepted: true, blocked: false, error: '' };
|
|
434
441
|
}
|
|
435
442
|
catch (error) {
|
|
@@ -450,30 +457,123 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
450
457
|
releaseAuthority,
|
|
451
458
|
};
|
|
452
459
|
}
|
|
453
|
-
async
|
|
454
|
-
if (
|
|
455
|
-
return
|
|
456
|
-
|
|
457
|
-
|
|
460
|
+
async restorePulse(device) {
|
|
461
|
+
if (this.loadedPulseState.has(device.id))
|
|
462
|
+
return true;
|
|
463
|
+
try {
|
|
464
|
+
const saved = await this.adapter.getStateAsync(`${this.deviceBase(device)}.pulseResetPending`);
|
|
465
|
+
if (saved?.val) {
|
|
466
|
+
const entry = JSON.parse(saved.val);
|
|
467
|
+
const expected = entry?.command === 'start' ? device.startWriteId : entry?.command === 'stop' ? device.stopWriteId : '';
|
|
468
|
+
if (device.commandProfile !== 'pulse' || !expected || entry.objectId !== expected
|
|
469
|
+
|| typeof entry.manual !== 'boolean' || !Number.isFinite(entry.issuedAt)) {
|
|
470
|
+
await this.setIfChanged(`${this.deviceBase(device)}.writeContractStatus`, 'pulse-reset-mapping-changed');
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
const pulse = { objectId: expected, command: entry.command, manual: entry.manual, issuedAt: entry.issuedAt, due: 0, busy: false, released: false, recovered: true };
|
|
474
|
+
const runtime = this.getRuntime(device.id);
|
|
475
|
+
runtime.lastCmd = pulse.command;
|
|
476
|
+
runtime.lastCmdMs = pulse.issuedAt;
|
|
477
|
+
runtime.restoredPulse = true;
|
|
478
|
+
this.pendingPulses.set(device.id, pulse);
|
|
479
|
+
await this.resetPulse(device, pulse);
|
|
480
|
+
}
|
|
481
|
+
else if (device.enabled && device.commandProfile === 'pulse') {
|
|
482
|
+
const base = this.deviceBase(device);
|
|
483
|
+
const [lastCommand, lastTimestamp] = await Promise.all([
|
|
484
|
+
this.adapter.getStateAsync(`${base}.lastCommand`), this.adapter.getStateAsync(`${base}.lastCommandTs`),
|
|
485
|
+
]);
|
|
486
|
+
if ((lastCommand?.val === 'start' || lastCommand?.val === 'stop') && Number.isFinite(lastTimestamp?.val)) {
|
|
487
|
+
const runtime = this.getRuntime(device.id);
|
|
488
|
+
runtime.lastCmd = lastCommand.val;
|
|
489
|
+
runtime.lastCmdMs = lastTimestamp.val;
|
|
490
|
+
runtime.restoredPulse = true;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
this.loadedPulseState.add(device.id);
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
catch (_error) {
|
|
497
|
+
await this.setIfChanged(`${this.deviceBase(device)}.writeContractStatus`, 'pulse-reset-state-unavailable');
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
async resetPulse(device, pulse) {
|
|
502
|
+
if (this.adapter._nwShuttingDown || pulse.busy || this.pendingPulses.get(device.id) !== pulse)
|
|
503
|
+
return;
|
|
504
|
+
pulse.busy = true;
|
|
505
|
+
try {
|
|
506
|
+
if (!pulse.released) {
|
|
507
|
+
const owner = pulse.manual ? this.manualOwner(device) : this.automaticOwner(device);
|
|
508
|
+
const attempt = await withActuatorShadowContext(this.adapter, {
|
|
509
|
+
...this.writeContext(device, owner, 'pulse-reset', pulse.manual, true),
|
|
510
|
+
kind: `${this.root()}-pulse-reset`,
|
|
511
|
+
}, () => this.rawWrite(pulse.objectId, false));
|
|
512
|
+
if (!attempt.accepted) {
|
|
513
|
+
await this.setIfChanged(`${this.deviceBase(device)}.writeContractStatus`, 'pulse-reset-retry');
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
pulse.released = true;
|
|
517
|
+
}
|
|
518
|
+
// Only acknowledge a recovered manual request after the contact has been lowered.
|
|
519
|
+
// A failed database read/clear leaves the journal intact for the next attempt.
|
|
520
|
+
if (pulse.recovered && pulse.manual) {
|
|
521
|
+
const id = `${this.userBase(device)}.command`;
|
|
522
|
+
const command = await this.adapter.getStateAsync(id);
|
|
523
|
+
if (command?.val === pulse.command && Number.isFinite(command.ts) && command.ts <= pulse.issuedAt) {
|
|
524
|
+
await this.adapter.setStateAsync(id, '', true);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
await this.adapter.setStateAsync(`${this.deviceBase(device)}.pulseResetPending`, '', true);
|
|
528
|
+
this.pendingPulses.delete(device.id);
|
|
529
|
+
const status = `${this.deviceBase(device)}.writeContractStatus`;
|
|
530
|
+
if (pulse.recovered || this.stateCache.get(status) === 'pulse-reset-retry')
|
|
531
|
+
await this.setIfChanged(status, 'pulse-reset-complete');
|
|
532
|
+
}
|
|
533
|
+
catch (_error) {
|
|
534
|
+
await this.setIfChanged(`${this.deviceBase(device)}.writeContractStatus`, 'pulse-reset-retry');
|
|
535
|
+
}
|
|
536
|
+
finally {
|
|
537
|
+
pulse.due = Date.now() + Math.max(250, Math.min(5000, device.retryDelayMs));
|
|
538
|
+
pulse.busy = false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
async pulseWrite(device, objectId, owner, reason, manual, desiredRunning) {
|
|
542
|
+
if (!objectId || this.adapter._nwShuttingDown || this.pendingPulses.has(device.id)) {
|
|
543
|
+
return { accepted: false, blocked: false, error: 'pulse-reset-pending-or-unavailable' };
|
|
544
|
+
}
|
|
545
|
+
const entry = { objectId, command: desiredRunning ? 'start' : 'stop', manual, issuedAt: Date.now() };
|
|
546
|
+
const pulse = { ...entry, due: 0, busy: true, released: false, recovered: false };
|
|
547
|
+
this.pendingPulses.set(device.id, pulse);
|
|
548
|
+
try {
|
|
549
|
+
// Persist before energising: a process or controller restart cannot lose the OFF obligation.
|
|
550
|
+
await this.adapter.setStateAsync(`${this.deviceBase(device)}.pulseResetPending`, JSON.stringify(entry), true);
|
|
551
|
+
}
|
|
552
|
+
catch (_error) {
|
|
553
|
+
this.pendingPulses.delete(device.id);
|
|
554
|
+
this.loadedPulseState.delete(device.id);
|
|
555
|
+
return { accepted: false, blocked: false, error: 'pulse-reset-state-unavailable' };
|
|
556
|
+
}
|
|
557
|
+
try {
|
|
558
|
+
if (this.adapter._nwShuttingDown)
|
|
559
|
+
return { accepted: false, blocked: false, error: 'shutdown' };
|
|
560
|
+
const attempt = await withActuatorShadowContext(this.adapter, this.writeContext(device, owner, reason, manual, false), () => this.rawWrite(objectId, true));
|
|
561
|
+
if (!attempt.accepted) {
|
|
562
|
+
// A rejected authority request never reached the output. Transport errors may have.
|
|
563
|
+
pulse.released = attempt.blocked;
|
|
564
|
+
pulse.busy = false;
|
|
565
|
+
await this.resetPulse(device, pulse);
|
|
566
|
+
return attempt;
|
|
567
|
+
}
|
|
568
|
+
pulse.due = Date.now() + device.pulseMs;
|
|
569
|
+
const schedule = this.adapter._nwSetTimeout || this.adapter.setTimeout;
|
|
570
|
+
if (typeof schedule === 'function')
|
|
571
|
+
schedule.call(this.adapter, () => { void this.resetPulse(device, pulse); }, device.pulseMs);
|
|
458
572
|
return attempt;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// Ein kuenstlicher Safety-Owner wuerde mit einer laufenden manuellen Lease
|
|
464
|
-
// konkurrieren und koennte den Reset selbst blockieren.
|
|
465
|
-
await withActuatorShadowContext(this.adapter, {
|
|
466
|
-
...this.writeContext(device, owner, `${reason}:pulse-reset`, manual, true),
|
|
467
|
-
kind: `${this.root()}-pulse-reset`,
|
|
468
|
-
}, () => this.rawWrite(objectId, false));
|
|
469
|
-
};
|
|
470
|
-
if (typeof this.adapter?._nwSetTimeout === 'function')
|
|
471
|
-
this.adapter._nwSetTimeout(() => { void reset(); }, device.pulseMs);
|
|
472
|
-
else if (typeof this.adapter?.setTimeout === 'function' && !this.adapter._nwShuttingDown)
|
|
473
|
-
this.adapter.setTimeout(() => { void reset(); }, device.pulseMs);
|
|
474
|
-
else
|
|
475
|
-
this.adapter?.log?.warn?.(`[${this.root()}] pulse reset for '${objectId}' could not be scheduled safely`);
|
|
476
|
-
return attempt;
|
|
573
|
+
}
|
|
574
|
+
finally {
|
|
575
|
+
pulse.busy = false;
|
|
576
|
+
}
|
|
477
577
|
}
|
|
478
578
|
async writeDesired(device, desiredRunning, owner, reason, manual) {
|
|
479
579
|
if (device.commandProfile === 'run-level') {
|
|
@@ -495,7 +595,7 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
495
595
|
return neutral;
|
|
496
596
|
return withActuatorShadowContext(this.adapter, this.writeContext(device, owner, reason, manual, !desiredRunning), () => this.rawWrite(active, true));
|
|
497
597
|
}
|
|
498
|
-
return this.pulseWrite(device, desiredRunning ? device.startWriteId : device.stopWriteId, owner, reason, manual);
|
|
598
|
+
return this.pulseWrite(device, desiredRunning ? device.startWriteId : device.stopWriteId, owner, reason, manual, desiredRunning);
|
|
499
599
|
}
|
|
500
600
|
async requestState(device, desiredRunning, reason, manual, readback) {
|
|
501
601
|
const owner = manual ? this.manualOwner(device) : this.automaticOwner(device);
|
|
@@ -509,7 +609,7 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
509
609
|
return confirmed;
|
|
510
610
|
}
|
|
511
611
|
const runtime = this.getRuntime(device.id);
|
|
512
|
-
if (!manual && device.requireReadback !== true && runtime.lastCmd === command && runtime.lastCmdMs > 0) {
|
|
612
|
+
if (!manual && (device.requireReadback !== true || runtime.restoredPulse) && runtime.lastCmd === command && runtime.lastCmdMs > 0) {
|
|
513
613
|
const settleRemainingMs = device.commandTimeoutMs - (now - runtime.lastCmdMs);
|
|
514
614
|
if (settleRemainingMs > 0) {
|
|
515
615
|
const deferred = this.actuatorContract.defer(key, desiredRunning, now, settleRemainingMs, 'command-settle-wait');
|
|
@@ -547,6 +647,7 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
547
647
|
});
|
|
548
648
|
runtime.lastCmdMs = Date.now();
|
|
549
649
|
runtime.lastCmd = command;
|
|
650
|
+
runtime.restoredPulse = false;
|
|
550
651
|
await this.setIfChanged(`${this.deviceBase(device)}.lastCommand`, command);
|
|
551
652
|
await this.setIfChanged(`${this.deviceBase(device)}.lastCommandTs`, runtime.lastCmdMs);
|
|
552
653
|
await this.setIfChanged(`${this.deviceBase(device)}.reason`, reason);
|
|
@@ -595,6 +696,14 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
595
696
|
return;
|
|
596
697
|
const now = Date.now();
|
|
597
698
|
for (const device of this.devices) {
|
|
699
|
+
if (!await this.restorePulse(device))
|
|
700
|
+
continue;
|
|
701
|
+
const pending = this.pendingPulses.get(device.id);
|
|
702
|
+
if (pending && pending.due <= now) {
|
|
703
|
+
await this.resetPulse(device, pending);
|
|
704
|
+
if (this.pendingPulses.has(device.id))
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
598
707
|
if (!device.enabled)
|
|
599
708
|
continue;
|
|
600
709
|
const base = this.deviceBase(device);
|
|
@@ -637,12 +746,15 @@ class PrimeMoverControlModule extends BaseModule {
|
|
|
637
746
|
const mode = this.normalizeMode(modeState?.val);
|
|
638
747
|
const commandState = await this.adapter.getStateAsync(`${user}.command`).catch(() => null);
|
|
639
748
|
const command = text(commandState?.val).toLowerCase();
|
|
640
|
-
if (command === 'start' || command === 'stop') {
|
|
749
|
+
if ((command === 'start' || command === 'stop') && !this.pendingPulses.has(device.id)) {
|
|
641
750
|
if (mode === 'manual')
|
|
642
751
|
await this.requestState(device, command === 'start', `manual:${command}`, true, running);
|
|
643
752
|
else
|
|
644
753
|
await this.setIfChanged(`${base}.reason`, 'manual:ignored_not_manual');
|
|
645
|
-
|
|
754
|
+
// A new manual command can arrive during the device write; consume only the observed request.
|
|
755
|
+
const current = await this.adapter.getStateAsync(`${user}.command`);
|
|
756
|
+
if (current?.val === commandState?.val && current?.ts === commandState?.ts)
|
|
757
|
+
await this.adapter.setStateAsync(`${user}.command`, '', true);
|
|
646
758
|
}
|
|
647
759
|
let status = '';
|
|
648
760
|
let reason = '';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
8
8
|
*
|
|
9
9
|
* Quelle: src-ts/runtime-executables/ems/modules/storage-control.ts
|
|
10
|
-
* Quell-Hash: sha256:
|
|
10
|
+
* Quell-Hash: sha256:0e05be0f979975a11f1064b0a4eca4959906ecdd5ead8eab6afccd67d1a6965e
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
'use strict';
|
|
75
75
|
|
|
76
76
|
const { BaseModule } = require('./base');
|
|
77
|
+
const { readFlowMeasurement } = require('../../lib/flow-measurement');
|
|
77
78
|
const { dynamicGridHasControl } = require('../services/dynamic-grid-ownership');
|
|
78
79
|
const { evaluateArbitrageRequest, selectConfiguredArbitrageRequest, configuredArbitrageFallbackProfile } = require('../services/arbitrage-control');
|
|
79
80
|
const { withActuatorShadowContext } = require('../services/actuator-shadow-arbiter');
|
|
@@ -930,13 +931,17 @@ function resolveStorageAntiExportTarget(input = {}) {
|
|
|
930
931
|
// einen zuvor akzeptierten Entladebefehl, darf kein neuer Entladevorgang
|
|
931
932
|
// gestartet werden. Das ist kein Abbruch einer laufenden Regelung, sondern
|
|
932
933
|
// verhindert einen neuen, physikalisch nicht begruendbaren Exportbefehl.
|
|
933
|
-
|
|
934
|
+
// An old self-consumption command cannot prove current battery discharge
|
|
935
|
+
// once its configured meter is unavailable and the NVP is exporting.
|
|
936
|
+
const stopWithoutFeedback = input.dischargeFeedbackLost === true && nvpW < -deadbandW;
|
|
937
|
+
if (belowTarget && (!physicalBaseKnown || stopWithoutFeedback)) {
|
|
934
938
|
return {
|
|
935
939
|
active: true,
|
|
936
940
|
requestedW,
|
|
937
941
|
targetW: 0,
|
|
938
|
-
status: 'block-new-discharge-without-anchor',
|
|
939
|
-
reason:
|
|
942
|
+
status: stopWithoutFeedback ? 'stop-export-without-feedback' : 'block-new-discharge-without-anchor',
|
|
943
|
+
reason: stopWithoutFeedback ? 'NVP-Anti-Export: Entladung gestoppt, konfigurierte Batterie-Istmessung fehlt'
|
|
944
|
+
: `NVP-Anti-Export: keine neue Entladung ohne Ist-/Kommandoanker bei NVP ${Math.round(nvpW)} W`,
|
|
940
945
|
nvpW,
|
|
941
946
|
targetNvpW,
|
|
942
947
|
nvpErrorW,
|
|
@@ -944,7 +949,7 @@ function resolveStorageAntiExportTarget(input = {}) {
|
|
|
944
949
|
graceMs,
|
|
945
950
|
exportActive,
|
|
946
951
|
belowTarget: true,
|
|
947
|
-
explicitStop:
|
|
952
|
+
explicitStop: stopWithoutFeedback,
|
|
948
953
|
capped: true,
|
|
949
954
|
capW: 0,
|
|
950
955
|
proportionalTargetW: 0,
|
|
@@ -2135,8 +2140,10 @@ class SpeicherRegelungModule extends BaseModule {
|
|
|
2135
2140
|
// bleiben weiterhin hart am NVP und an den Speichergrenzen begrenzt.
|
|
2136
2141
|
const storageCoupling = String(cfg.coupling || 'ac').trim().toLowerCase() === 'dc' ? 'dc' : 'ac';
|
|
2137
2142
|
const dcPvMapped = storageCoupling === 'dc' && !!String(cfg.dcPvPowerObjectId || '').trim();
|
|
2138
|
-
const
|
|
2139
|
-
const dcPvPowerAge =
|
|
2143
|
+
const dcPvSampleTs = dcPvMapped ? this.dp?.getVerifiedMeasurementTimestampMs?.('st.dcPvPowerW', now) : null;
|
|
2144
|
+
const dcPvPowerAge = Number.isFinite(dcPvSampleTs) ? now - dcPvSampleTs : null;
|
|
2145
|
+
const dcPvPowerW = dcPvPowerAge !== null && dcPvPowerAge >= 0 && dcPvPowerAge <= staleMs
|
|
2146
|
+
? this.dp.getNumber('st.dcPvPowerW', null) : null;
|
|
2140
2147
|
await this._setIfChanged('speicher.regelung.speicherKopplung', storageCoupling);
|
|
2141
2148
|
await this._setIfChanged('speicher.regelung.dcPvPowerW', (typeof dcPvPowerW === 'number' && Number.isFinite(dcPvPowerW)) ? Math.round(dcPvPowerW) : 0);
|
|
2142
2149
|
await this._setIfChanged('speicher.regelung.dcPvPowerAlterMs', (typeof dcPvPowerAge === 'number' && Number.isFinite(dcPvPowerAge)) ? Math.round(dcPvPowerAge) : null);
|
|
@@ -5667,7 +5674,15 @@ const _prevRampW = (typeof this._lastTargetW === 'number' && Number.isFinite(thi
|
|
|
5667
5674
|
const antiExportCommandAnchorW = lastAcceptedDischargeW > 0
|
|
5668
5675
|
? lastAcceptedDischargeW
|
|
5669
5676
|
: heldDischargeAnchorW;
|
|
5677
|
+
const signedFeedbackConfigured = !farmEnabled && source === 'eigenverbrauch'
|
|
5678
|
+
&& this._getStorageVendorProfile(cfg) === 'generic' && !!this.dp?.getEntry?.('st.batteryPowerW');
|
|
5679
|
+
const directTimestamp = signedFeedbackConfigured && battPowerFeedbackSource === 'single-storage'
|
|
5680
|
+
&& typeof this.dp?.getVerifiedMeasurementTimestampMs === 'function'
|
|
5681
|
+
? this.dp.getVerifiedMeasurementTimestampMs('st.batteryPowerW', now) : battPowerSampleTs;
|
|
5682
|
+
const dischargeFeedbackLost = signedFeedbackConfigured && (!battPowerTrusted || !Number.isFinite(directTimestamp)
|
|
5683
|
+
|| directTimestamp <= 0 || directTimestamp > now || now - directTimestamp > staleMs);
|
|
5670
5684
|
storageAntiExportDiag = resolveStorageAntiExportTarget({
|
|
5685
|
+
dischargeFeedbackLost,
|
|
5671
5686
|
requestedTargetW: targetBeforeAntiExportW,
|
|
5672
5687
|
commandAnchorW: antiExportCommandAnchorW,
|
|
5673
5688
|
storageActualW: antiExportStorageActualW,
|
|
@@ -7298,35 +7313,12 @@ const _prevRampW = (typeof this._lastTargetW === 'number' && Number.isFinite(thi
|
|
|
7298
7313
|
return null;
|
|
7299
7314
|
}
|
|
7300
7315
|
};
|
|
7316
|
+
const getCacheSample = (key) => readFlowMeasurement(adapter.stateCache, key, now, staleMs);
|
|
7301
7317
|
const getCacheAgeMs = (key) => {
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
const age = adapter._nwGetCacheAgeMs(key, now);
|
|
7305
|
-
return finite(age) ? Math.max(0, Number(age)) : null;
|
|
7306
|
-
}
|
|
7307
|
-
} catch {
|
|
7308
|
-
// Fallback auf den lokalen State-Cache.
|
|
7309
|
-
}
|
|
7310
|
-
const rec = getCacheRecord(key);
|
|
7311
|
-
const ts = Number(rec && rec.ts);
|
|
7312
|
-
return Number.isFinite(ts) && ts > 0 ? Math.max(0, now - ts) : null;
|
|
7313
|
-
};
|
|
7314
|
-
const getCacheValue = (key, fallback = null) => {
|
|
7315
|
-
try {
|
|
7316
|
-
if (adapter && typeof adapter._nwGetNumberFromCacheFresh === 'function') {
|
|
7317
|
-
const value = adapter._nwGetNumberFromCacheFresh(key, staleMs, fallback, now);
|
|
7318
|
-
return finite(value) ? Number(value) : fallback;
|
|
7319
|
-
}
|
|
7320
|
-
} catch {
|
|
7321
|
-
// Fallback auf den lokalen State-Cache.
|
|
7322
|
-
}
|
|
7323
|
-
const rec = getCacheRecord(key);
|
|
7324
|
-
const value = strictFiniteNumber(rec && rec.value, null);
|
|
7325
|
-
const age = getCacheAgeMs(key);
|
|
7326
|
-
if (value === null) return fallback;
|
|
7327
|
-
if (age !== null && age > staleMs) return fallback;
|
|
7328
|
-
return value;
|
|
7318
|
+
const sample = getCacheSample(key);
|
|
7319
|
+
return sample ? now - sample.ts : null;
|
|
7329
7320
|
};
|
|
7321
|
+
const getCacheValue = (key, fallback = null) => getCacheSample(key)?.value ?? fallback;
|
|
7330
7322
|
const getCacheString = (key) => {
|
|
7331
7323
|
const rec = getCacheRecord(key);
|
|
7332
7324
|
if (!rec || rec.value === null || rec.value === undefined) return '';
|
|
@@ -7402,8 +7394,8 @@ const _prevRampW = (typeof this._lastTargetW === 'number' && Number.isFinite(thi
|
|
|
7402
7394
|
const pvCandidates = [];
|
|
7403
7395
|
const pushPv = (value, source, ageMs, priority = 0) => {
|
|
7404
7396
|
if (!finite(value) || Number(value) < 0) return;
|
|
7405
|
-
const age =
|
|
7406
|
-
if (age
|
|
7397
|
+
const age = strictFiniteNumber(ageMs, null);
|
|
7398
|
+
if (age === null || age < 0 || age > staleMs) return;
|
|
7407
7399
|
pvCandidates.push({ w: Math.max(0, Number(value)), source, ageMs: age, priority });
|
|
7408
7400
|
};
|
|
7409
7401
|
|
|
@@ -7421,7 +7413,8 @@ const _prevRampW = (typeof this._lastTargetW === 'number' && Number.isFinite(thi
|
|
|
7421
7413
|
pushPv(
|
|
7422
7414
|
this.dp.getNumberFresh('ps.pvW', staleMs, null),
|
|
7423
7415
|
'ps.pvW',
|
|
7424
|
-
typeof this.dp.
|
|
7416
|
+
typeof this.dp.getVerifiedMeasurementTimestampMs === 'function'
|
|
7417
|
+
? now - (this.dp.getVerifiedMeasurementTimestampMs('ps.pvW', now) ?? -Infinity) : null,
|
|
7425
7418
|
70,
|
|
7426
7419
|
);
|
|
7427
7420
|
}
|
|
@@ -7437,7 +7430,7 @@ const _prevRampW = (typeof this._lastTargetW === 'number' && Number.isFinite(thi
|
|
|
7437
7430
|
|
|
7438
7431
|
const ages = [loadAgeMs, pvAgeMs, nvpAgeMs].filter((v) => finite(v)).map(Number);
|
|
7439
7432
|
const measurementSkewMs = ages.length >= 2 ? Math.max(...ages) - Math.min(...ages) : 0;
|
|
7440
|
-
const nvpFresh = rawNvpW !== null &&
|
|
7433
|
+
const nvpFresh = rawNvpW !== null && nvpAgeMs !== null && nvpAgeMs >= 0 && nvpAgeMs <= staleMs;
|
|
7441
7434
|
const loadFresh = loadW !== null && (loadAgeMs === null || loadAgeMs <= staleMs);
|
|
7442
7435
|
const pvFresh = pvW !== null && (pvAgeMs === null || pvAgeMs <= staleMs);
|
|
7443
7436
|
const aligned = measurementSkewMs <= maxSkewMs;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
8
8
|
*
|
|
9
9
|
* Quelle: src-ts/runtime-executables/ems/modules/storage-mapping.ts
|
|
10
|
-
* Quell-Hash: sha256:
|
|
10
|
+
* Quell-Hash: sha256:28e7bb224e3422ced7408bdf6231a491db4180efab7b605b12b140b4ccbeb087
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -92,19 +92,20 @@ class SpeicherMappingModule extends BaseModule {
|
|
|
92
92
|
await this._setIfChanged('speicher.socAlterMs', Math.round(socAge));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
// oder den gemischten AC-Ausgang als PV-Quelle missverstehen.
|
|
98
|
-
// Wichtig: Der Wert wird nur bei aktivem DC-/Hybrid-Typ und gemapptem DP genutzt;
|
|
99
|
-
// alte Mapping-Reste aus AC-Konfigurationen werden bewusst auf 0 gespiegelt.
|
|
95
|
+
// Repeated equal measurements keep their physical timestamp. An unmapped,
|
|
96
|
+
// invalid or missing source must not create a measured 0 W after restart.
|
|
100
97
|
const cfg = this._getCfg();
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
98
|
+
const mapped = cfg.coupling === 'dc' && !!String(cfg.dp?.dcPvPowerObjectId || '').trim();
|
|
99
|
+
const now = Date.now();
|
|
100
|
+
const ts = mapped ? this.dp.getVerifiedMeasurementTimestampMs?.('st.dcPvPowerW', now) : null;
|
|
101
|
+
const value = Number.isFinite(ts) ? this.dp.getNumber('st.dcPvPowerW', null) : null;
|
|
102
|
+
const observation = Number.isFinite(value) ? { val: Math.round(value), ts } : { val: null, ts: null };
|
|
103
|
+
const last = this._lastDcPvObservation;
|
|
104
|
+
if (!last || last.val !== observation.val || last.ts !== observation.ts) {
|
|
105
|
+
await this.adapter.setStateAsync('speicher.dcPvPowerW', { val: observation.val, ack: true, ts: observation.ts ?? now });
|
|
106
|
+
this._lastDcPvObservation = observation;
|
|
107
107
|
}
|
|
108
|
+
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
async _ensureStates() {
|
|
@@ -150,7 +151,7 @@ class SpeicherMappingModule extends BaseModule {
|
|
|
150
151
|
{ id: `${base}.mapping.e3dcMaxDischargePowerId`, name: 'E3/DC EMS.MAX_DISCHARGE_POWER Datenpunkt-ID', type: 'string', role: 'text', def: '' },
|
|
151
152
|
|
|
152
153
|
{ id: `${base}.socPct`, name: 'Speicher Ladezustand (SoC)', type: 'number', role: 'value.battery', def: 0 },
|
|
153
|
-
{ id: `${base}.dcPvPowerW`, name: 'DC-/Hybrid-PV Erzeugungsleistung', type: 'number', role: 'value.power', def:
|
|
154
|
+
{ id: `${base}.dcPvPowerW`, name: 'DC-/Hybrid-PV Erzeugungsleistung', type: 'number', role: 'value.power', def: null },
|
|
154
155
|
{ id: `${base}.socAlterMs`, name: 'SoC Alter (ms)', type: 'number', role: 'value.interval', def: 0 },
|
|
155
156
|
];
|
|
156
157
|
|