no message
This commit is contained in:
+122
-138
@@ -53,9 +53,8 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
}
|
||||
throw new Exception("Invalid Ident: " . $Ident);
|
||||
}
|
||||
public function Update()
|
||||
public function Update()
|
||||
{
|
||||
// Reentranzschutz – verhindert parallele Update()-Läufe
|
||||
$semKey = 'BatEVSDL_Update_' . $this->InstanceID;
|
||||
|
||||
if (!IPS_SemaphoreEnter($semKey, 5000)) {
|
||||
@@ -64,12 +63,10 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (!GetValue($this->GetIDForIdent("State"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache nur neu bauen, wenn nötig
|
||||
$this->BuildBatteryCache(false);
|
||||
|
||||
$cache = json_decode($this->GetBufferSafe("BatCacheJSON"), true);
|
||||
@@ -78,44 +75,29 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
return;
|
||||
}
|
||||
|
||||
// =====================
|
||||
// Zeitbasis (ms-genau)
|
||||
// =====================
|
||||
$now = microtime(true);
|
||||
|
||||
$lastTs = (float)$this->GetBufferSafe("Int_LastTs"); // Float!
|
||||
$Esdl_kWh = (float)$this->GetBufferSafe("Int_E_SDL_kWh"); // SDL-Konto in kWh
|
||||
$lastTs = (float)$this->GetBufferSafe("Int_LastTs");
|
||||
$Esdl_kWh = (float)$this->GetBufferSafe("Int_E_SDL_kWh");
|
||||
|
||||
if ($lastTs <= 0.0) {
|
||||
$lastTs = $now;
|
||||
$Esdl_kWh = 0.0;
|
||||
$lastTs = $now;
|
||||
}
|
||||
|
||||
|
||||
// Beim allerersten Lauf NICHT mit 0 % starten,
|
||||
// sondern virtuell auf Mitte setzen.
|
||||
// Bei symmetrischem SDL-Fenster ist das genau 50 %.
|
||||
/*
|
||||
if ($this->GetBufferSafe("Int_Init_SDL") !== "1") {
|
||||
$Esdl_kWh = $SDL_kWh_ges_cfg * 0.5;
|
||||
$this->SetBuffer("Int_Init_SDL", "1");
|
||||
}*/
|
||||
|
||||
$dtSec = $now - $lastTs;
|
||||
if ($dtSec < 0.0) $dtSec = 0.0;
|
||||
if ($dtSec > 10.0) $dtSec = 10.0; // optional: Kappe bei Aussetzern
|
||||
if ($dtSec > 10.0) $dtSec = 10.0;
|
||||
|
||||
$dtH = $dtSec / 3600.0;
|
||||
|
||||
$pSdlSollW = (float)GetValue($this->GetIDForIdent("Nennleistung_Soll_SDL"));
|
||||
|
||||
$calc = [
|
||||
"inputs" => $cache["inputs"] ?? [],
|
||||
"batteries" => [],
|
||||
"total" => []
|
||||
];
|
||||
|
||||
// =====================
|
||||
// Summen
|
||||
// =====================
|
||||
$sdlDisKW_ges = 0.0;
|
||||
$evDisKW_ges = 0.0;
|
||||
$sdlChKW_ges = 0.0;
|
||||
@@ -128,8 +110,6 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
$EV_kWh_ges = 0.0;
|
||||
$totalCapKWh = 0.0;
|
||||
|
||||
|
||||
|
||||
$SDL_kWh_ges_cfg = 0.0;
|
||||
$SDL_start_kWh_cfg = 0.0;
|
||||
|
||||
@@ -143,16 +123,13 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
: 0.0;
|
||||
|
||||
$startPct = max(0.0, min(100.0, $startPct));
|
||||
|
||||
$this->SetIdentValue("SDL_Start_Pos", round($startPct, 3));
|
||||
|
||||
if ($this->GetBufferSafe("Int_Init_SDL") !== "1") {
|
||||
$Esdl_kWh = max(0.0, min($SDL_kWh_ges_cfg, $SDL_start_kWh_cfg));
|
||||
$this->SetBuffer("Int_Init_SDL", "1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// aktueller virtueller SDL-Stand
|
||||
$sdlVirtPct = ($SDL_kWh_ges_cfg > 0.0)
|
||||
? ($Esdl_kWh / $SDL_kWh_ges_cfg * 100.0)
|
||||
: 0.0;
|
||||
@@ -162,77 +139,80 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
$sdlIsEmpty = ($sdlVirtPct <= 0.1);
|
||||
$sdlIsFull = ($sdlVirtPct >= 99.9);
|
||||
|
||||
foreach ($cache["bats"] as $i => $c) {
|
||||
$sdlHitUpperBySDL = false;
|
||||
$sdlHitLowerBySDL = false;
|
||||
|
||||
foreach ($cache["bats"] as $i => $c) {
|
||||
$capKWh = (float)($c["capKWh"] ?? 0.0);
|
||||
if ($capKWh <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// SoC lesen
|
||||
$socVarId = (int)($c["socVarId"] ?? 0);
|
||||
$socPct = $this->ReadSocPercent($socVarId);
|
||||
|
||||
$real_kWh = $capKWh / 100.0 * $socPct;
|
||||
|
||||
// vorkalkuliert
|
||||
$typ = (string)($c["typ"] ?? ("Bat " . ($i + 1)));
|
||||
$underKWh = (float)($c["underKWh"] ?? 0.0);
|
||||
$upKWh = (float)($c["upKWh"] ?? 0.0);
|
||||
|
||||
// Standard: EV darf nur zwischen underKWh und upKWh arbeiten
|
||||
if ($real_kWh > $upKWh && $pSdlSollW > 0.0) {
|
||||
$sdlHitUpperBySDL = true;
|
||||
}
|
||||
|
||||
if ($real_kWh < $underKWh && $pSdlSollW < 0.0) {
|
||||
$sdlHitLowerBySDL = true;
|
||||
}
|
||||
|
||||
$evUnderKWh = $underKWh;
|
||||
$evUpKWh = $upKWh;
|
||||
|
||||
// Wenn SDL virtuell leer ist, darf EV die untere SDL-Reserve verwenden
|
||||
if ($sdlIsEmpty) {
|
||||
$evUnderKWh = 0.0;
|
||||
}
|
||||
|
||||
// Wenn SDL virtuell voll ist, darf EV die obere SDL-Reserve verwenden
|
||||
if ($sdlIsFull) {
|
||||
$evUpKWh = $capKWh;
|
||||
}
|
||||
|
||||
$evWindowKWh = max(0.0, $evUpKWh - $evUnderKWh);
|
||||
|
||||
|
||||
$SDL_kWh = (float)($c["SDL_kWh_total"] ?? 0.0);
|
||||
$EV_kWh = (float)($c["EV_kWh_total"] ?? 0.0);
|
||||
$SDL_kWh = (float)($c["SDL_kWh_total"] ?? 0.0);
|
||||
$EV_kWh = (float)($c["EV_kWh_total"] ?? 0.0);
|
||||
|
||||
$sdlShareKW_laden = (float)($c["sdlShareKW_laden"] ?? 0.0);
|
||||
$sdlShareKW_entladen = (float)($c["sdlShareKW_entladen"] ?? 0.0);
|
||||
$evShareKW_laden = (float)($c["evShareKW_laden"] ?? 0.0);
|
||||
$evShareKW_entladen = (float)($c["evShareKW_entladen"] ?? 0.0);
|
||||
|
||||
// Defaults
|
||||
$EV_SOC = 0.0;
|
||||
$SDL_SOC = 0.0;
|
||||
|
||||
$sdlDisKW = 0.0; $evDisKW = 0.0;
|
||||
$sdlChKW = 0.0; $evChKW = 0.0;
|
||||
$sdlDisKW = 0.0;
|
||||
$evDisKW = 0.0;
|
||||
$sdlChKW = 0.0;
|
||||
$evChKW = 0.0;
|
||||
|
||||
$real_kWh_ev = 0.0;
|
||||
$real_kWh_sdl = 0.0;
|
||||
|
||||
// --- 3 Fälle ---
|
||||
if ($underKWh <= $real_kWh && $real_kWh <= $upKWh) {
|
||||
|
||||
// EV_SOC im Fenster dynamisch (0..100)
|
||||
if ($evWindowKWh > 0.0) {
|
||||
$EV_SOC = 100.0 * ($real_kWh - $evUnderKWh) / $evWindowKWh;
|
||||
} else {
|
||||
$EV_SOC = 0.0;
|
||||
}
|
||||
|
||||
$EV_SOC = is_finite($EV_SOC) ? max(0.0, min(100.0, $EV_SOC)) : 0.0;
|
||||
|
||||
// SDL_SOC (wie in deinem alten Code im Fenster)
|
||||
$denSDL = ($capKWh - $upKWh + $underKWh);
|
||||
if ($denSDL > 0.0) {
|
||||
$SDL_SOC = 100.0 * $underKWh / $denSDL;
|
||||
} else {
|
||||
$SDL_SOC = 0.0;
|
||||
}
|
||||
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
@@ -244,48 +224,58 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
$real_kWh_sdl = $real_kWh - $real_kWh_ev;
|
||||
|
||||
} elseif ($real_kWh > $evUpKWh) {
|
||||
|
||||
// Obere Grenze: EV = 100%
|
||||
$EV_SOC = 100.0;
|
||||
|
||||
// SDL_SOC (deine obere Formel)
|
||||
$den1 = ($capKWh - $real_kWh + $underKWh);
|
||||
$den2 = (2.0 * $underKWh);
|
||||
|
||||
if ($den1 > 0.0 && $den2 > 0.0) {
|
||||
$SDL_SOC = min(100.0, ($den1 / $den2) * 100.0);
|
||||
} else {
|
||||
$SDL_SOC = 0.0;
|
||||
}
|
||||
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = $evShareKW_entladen;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = 0.0; // EV darf oben nicht laden
|
||||
$evChKW = 0.0;
|
||||
|
||||
$real_kWh_ev = $capKWh - ($capKWh - $upKWh + $underKWh);
|
||||
$real_kWh_sdl = ($capKWh - $upKWh + $underKWh) - ($capKWh - $real_kWh);
|
||||
$real_kWh_ev = $evWindowKWh;
|
||||
$real_kWh_sdl = max(0.0, $real_kWh - $real_kWh_ev);
|
||||
|
||||
} elseif ($real_kWh < $evUnderKWh) {
|
||||
|
||||
// Untere Grenze: EV = 0%
|
||||
$EV_SOC = 0.0;
|
||||
|
||||
// SDL_SOC (deine untere Formel)
|
||||
$den = $upKWh + $underKWh;
|
||||
$SDL_SOC = ($den > 0.0) ? ($real_kWh * 100.0 / $den) : 0.0;
|
||||
$SDL_SOC = is_finite($SDL_SOC) ? max(0.0, min(100.0, $SDL_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = 0.0; // EV darf unten nicht entladen
|
||||
$evDisKW = 0.0;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = $evShareKW_laden;
|
||||
|
||||
$real_kWh_ev = 0.0;
|
||||
$real_kWh_sdl = $real_kWh;
|
||||
|
||||
} else {
|
||||
if ($evWindowKWh > 0.0) {
|
||||
$EV_SOC = 100.0 * ($real_kWh - $evUnderKWh) / $evWindowKWh;
|
||||
}
|
||||
|
||||
$EV_SOC = is_finite($EV_SOC) ? max(0.0, min(100.0, $EV_SOC)) : 0.0;
|
||||
|
||||
$sdlDisKW = $sdlShareKW_entladen;
|
||||
$evDisKW = $evShareKW_entladen;
|
||||
$sdlChKW = $sdlShareKW_laden;
|
||||
$evChKW = $evShareKW_laden;
|
||||
|
||||
$real_kWh_ev = max(0.0, min($evWindowKWh, $real_kWh - $evUnderKWh));
|
||||
$real_kWh_sdl = $real_kWh - $real_kWh_ev;
|
||||
}
|
||||
|
||||
// Null/Full Schutz
|
||||
if ($real_kWh <= 0.0) {
|
||||
$sdlDisKW = 0.0;
|
||||
$real_kWh_ev = 0.0;
|
||||
@@ -299,7 +289,6 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
$real_kWh_ev = max(0.0, $real_kWh_ev);
|
||||
$real_kWh_sdl = max(0.0, $real_kWh_sdl);
|
||||
|
||||
// Summen
|
||||
$totalCapKWh += $capKWh;
|
||||
|
||||
$sdlDisKW_ges += $sdlDisKW;
|
||||
@@ -317,134 +306,129 @@ class Bat_EV_SDL_V3_Beta extends IPSModule
|
||||
"idx" => $c["idx"] ?? $i,
|
||||
"typ" => $typ,
|
||||
"SoC_varId" => $socVarId,
|
||||
"SoC_pct" => round($socPct, 3),
|
||||
"SoC_pct" => round($socPct, 3),
|
||||
"Effektive kWh" => round($real_kWh, 3),
|
||||
|
||||
"EV_SOC" => round($EV_SOC, 3),
|
||||
"EV_SOC" => round($EV_SOC, 3),
|
||||
"SDL_SOC" => round($SDL_SOC, 3),
|
||||
|
||||
"EV_kWh" => round($real_kWh_ev, 3),
|
||||
"EV_kWh" => round($real_kWh_ev, 3),
|
||||
"SDL_kWh" => round($real_kWh_sdl, 3),
|
||||
|
||||
"under_grenze_kWh" => round($underKWh, 3),
|
||||
"up_grenze_kWh" => round($upKWh, 3),
|
||||
"up_grenze_kWh" => round($upKWh, 3),
|
||||
|
||||
"SDL_Charge_kW" => round($sdlChKW, 3),
|
||||
"SDL_Charge_kW" => round($sdlChKW, 3),
|
||||
"SDL_Discharge_kW" => round($sdlDisKW, 3),
|
||||
"EV_Charge_kW" => round($evChKW, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW, 3),
|
||||
"EV_Charge_kW" => round($evChKW, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW, 3),
|
||||
];
|
||||
}
|
||||
|
||||
// ============================
|
||||
// EV Anzeige: "normal" physikalisch (ja: aus realem SoC!)
|
||||
// ============================
|
||||
$evPosPct = ($EV_kWh_ges > 0.0) ? ($real_kWh_ev_ges / $EV_kWh_ges * 100.0) : 0.0;
|
||||
$evPosPct = ($EV_kWh_ges > 0.0)
|
||||
? ($real_kWh_ev_ges / $EV_kWh_ges * 100.0)
|
||||
: 0.0;
|
||||
|
||||
$evPosPct = max(0.0, min(100.0, $evPosPct));
|
||||
$this->SetIdentValue("SoC_EV", round($evPosPct, 3));
|
||||
|
||||
// ============================
|
||||
// SDL Anzeige: integriert mit Nennleistung_Soll_SDL
|
||||
// UND WICHTIG: bei Soll = 0 -> SoC stehen lassen (kein Resync!)
|
||||
// ============================
|
||||
$pSdlSollW = (float)GetValue($this->GetIDForIdent("Nennleistung_Soll_SDL"));
|
||||
$epsW = 1.0;
|
||||
$sdlActive = (abs($pSdlSollW) > $epsW);
|
||||
|
||||
// Soll auf erlaubte SDL-Leistung clampen (aus Summen kW->W)
|
||||
$maxSDL_ch = $sdlChKW_ges * 1000.0;
|
||||
$maxSDL_dis = $sdlDisKW_ges * 1000.0;
|
||||
$pSdlSollW = max(-$maxSDL_dis, min($maxSDL_ch, $pSdlSollW));
|
||||
|
||||
|
||||
// Soll auf erlaubte SDL-Leistung clampen (aus Summen kW->W)// Soll auf = $sdlChKW_ges * 1000.0;
|
||||
$maxSDL_dis = $sdlDisKW_ges * 1000.0;
|
||||
$pSdlSollW = max(-$maxSDL_dis, min($maxSDL_ch, $pSdlSollW));
|
||||
$pSdlSollW = max(-$maxSDL_dis, min($maxSDL_ch, $pSdlSollW));
|
||||
|
||||
/* ============================================================
|
||||
* RESYNC: Wenn sich Cache/SDL-Leistung geändert hat,
|
||||
* dann SDL-Integrator auf physikalischen Wert setzen,
|
||||
* damit SDL_Pos nicht plötzlich auf ~0% springt.
|
||||
* ============================================================ */
|
||||
$cacheHash = (string)$this->GetBufferSafe("BatCacheHash"); // wird in BuildBatteryCache() gesetzt
|
||||
$intHash = (string)$this->GetBufferSafe("Int_CFG_HASH"); // unser gespeicherter Hash
|
||||
$cacheHash = (string)$this->GetBufferSafe("BatCacheHash");
|
||||
$intHash = (string)$this->GetBufferSafe("Int_CFG_HASH");
|
||||
|
||||
// Erstinitialisierung
|
||||
if ($intHash === "") {
|
||||
$this->SetBuffer("Int_CFG_HASH", $cacheHash);
|
||||
$intHash = $cacheHash;
|
||||
}
|
||||
|
||||
if ($cacheHash !== "" && $cacheHash !== $intHash) {
|
||||
if ($cacheHash !== "" && $cacheHash !== $intHash) {
|
||||
$Esdl_kWh = max(0.0, min($SDL_kWh_ges_cfg, $SDL_start_kWh_cfg));
|
||||
|
||||
// Bei Cache-/SDL-Leistungsänderung wieder auf 50 %
|
||||
$SDL_start_kWh_cfg = 0.0;
|
||||
$lastTs = $now;
|
||||
$dtH = 0.0;
|
||||
|
||||
foreach ($cache["bats"] as $bc) {
|
||||
$SDL_start_kWh_cfg += (float)($bc["underKWh"] ?? 0.0);
|
||||
}
|
||||
|
||||
$Esdl_kWh = max(0.0, min($SDL_kWh_ges_cfg, $SDL_start_kWh_cfg));
|
||||
|
||||
$lastTs = $now;
|
||||
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||
|
||||
$this->SetBuffer("Int_CFG_HASH", $cacheHash);
|
||||
$this->SetBuffer("Int_Init_SDL", "1");
|
||||
|
||||
$this->SendDebug("SDL", "Reset wegen CacheHash-Change auf 50%: Esdl_kWh=" . round($Esdl_kWh, 3), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Init SDL-Konto einmalig auf physikalische Referenz (nur beim ersten Lauf)
|
||||
if ($this->GetBufferSafe("Int_Init_SDL") !== "1") {
|
||||
$Esdl_kWh = $SDL_kWh_ges_cfg * 0.5;
|
||||
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||
$this->SetBuffer("Int_CFG_HASH", $cacheHash);
|
||||
$this->SetBuffer("Int_Init_SDL", "1");
|
||||
|
||||
$this->SendDebug("SDL", "Reset wegen CacheHash-Change auf Startpunkt: Esdl_kWh=" . round($Esdl_kWh, 3), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* WICHTIG:
|
||||
* Nur wenn SDL selbst in Richtung Grenze fährt, wird der Integrator
|
||||
* auf den physikalischen Grenzpunkt gesetzt.
|
||||
*
|
||||
* EV überschreitet Grenze -> KEIN Sprung von SDL_Pos.
|
||||
*/
|
||||
if ($sdlHitUpperBySDL || $sdlHitLowerBySDL) {
|
||||
$Esdl_kWh = max(0.0, min($SDL_kWh_ges, $real_kWh_sdl_ges));
|
||||
$dtH = 0.0;
|
||||
|
||||
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||
|
||||
$this->SendDebug(
|
||||
"SDL",
|
||||
"Physikalischer Grenz-Anker: Esdl_kWh=" . round($Esdl_kWh, 3) .
|
||||
" upper=" . ($sdlHitUpperBySDL ? "1" : "0") .
|
||||
" lower=" . ($sdlHitLowerBySDL ? "1" : "0"),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
// Nur wenn aktiv integrieren, sonst: NICHTS -> Konto bleibt stehen
|
||||
if ($sdlActive) {
|
||||
$Esdl_kWh += (($pSdlSollW / 1000.0) * $dtH);
|
||||
}
|
||||
|
||||
// Clamp SDL-Konto
|
||||
$Esdl_kWh = ($SDL_kWh_ges > 0.0) ? max(0.0, min($SDL_kWh_ges, $Esdl_kWh)) : 0.0;
|
||||
$Esdl_kWh = ($SDL_kWh_ges > 0.0)
|
||||
? max(0.0, min($SDL_kWh_ges, $Esdl_kWh))
|
||||
: 0.0;
|
||||
|
||||
$sdlPosPct = ($SDL_kWh_ges > 0.0)
|
||||
? ($Esdl_kWh / $SDL_kWh_ges * 100.0)
|
||||
: 0.0;
|
||||
|
||||
$sdlPosPct = ($SDL_kWh_ges > 0.0) ? ($Esdl_kWh / $SDL_kWh_ges * 100.0) : 0.0;
|
||||
$sdlPosPct = max(0.0, min(100.0, $sdlPosPct));
|
||||
|
||||
$this->SetIdentValue("SDL_Pos", round($sdlPosPct, 3));
|
||||
|
||||
// ============================
|
||||
// Maximalleistungen anzeigen
|
||||
// ============================
|
||||
$this->SetIdentValue("P_SDL_laden", round($sdlChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_SDL_laden", round($sdlChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_SDL_entladen", round($sdlDisKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_laden", (int)round($evChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_entladen", (int)round($evDisKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_laden", (int)round($evChKW_ges * 1000.0, 0));
|
||||
$this->SetIdentValue("P_EV_entladen", (int)round($evDisKW_ges * 1000.0, 0));
|
||||
|
||||
// Total JSON
|
||||
$calc["total"] = [
|
||||
"SDL_SoC_pct" => round($sdlPosPct, 3),
|
||||
"EV_SoC_pct" => round($evPosPct, 3),
|
||||
"SDL_SoC_pct" => round($sdlPosPct, 3),
|
||||
"EV_SoC_pct" => round($evPosPct, 3),
|
||||
|
||||
"SDL_kWh_total" => round($SDL_kWh_ges, 3),
|
||||
"EV_kWh_total" => round($EV_kWh_ges, 3),
|
||||
"SDL_Charge_kW" => round($sdlChKW_ges, 3),
|
||||
"EV_kWh_total" => round($EV_kWh_ges, 3),
|
||||
|
||||
"SDL_Charge_kW" => round($sdlChKW_ges, 3),
|
||||
"SDL_Discharge_kW" => round($sdlDisKW_ges, 3),
|
||||
"EV_Charge_kW" => round($evChKW_ges, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW_ges, 3),
|
||||
"totalCap_kWh" => round($totalCapKWh, 3)
|
||||
"EV_Charge_kW" => round($evChKW_ges, 3),
|
||||
"EV_Discharge_kW" => round($evDisKW_ges, 3),
|
||||
|
||||
"totalCap_kWh" => round($totalCapKWh, 3),
|
||||
|
||||
"SDL_Start_pct" => round($startPct, 3),
|
||||
"SDL_IsEmpty" => $sdlIsEmpty,
|
||||
"SDL_IsFull" => $sdlIsFull,
|
||||
"SDL_HitUpperBySDL" => $sdlHitUpperBySDL,
|
||||
"SDL_HitLowerBySDL" => $sdlHitLowerBySDL
|
||||
];
|
||||
|
||||
$this->SetIdentValue("CalcJSON", json_encode($calc, JSON_PRETTY_PRINT));
|
||||
|
||||
// Setpoints wie gehabt
|
||||
$this->ApplySetpoints();
|
||||
|
||||
// ============================
|
||||
// Integrator State speichern (nur SDL)
|
||||
// ============================
|
||||
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||
$this->SetBuffer("Int_E_SDL_kWh", (string)$Esdl_kWh);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user