no message

This commit is contained in:
belevo\mh
2026-04-17 13:05:53 +02:00
parent c11362dd77
commit 2bbca149c4
+41 -2
View File
@@ -663,8 +663,47 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
// aktuelle - EV_SOLL = aktuelle SDL
// aktuelle - SDL_SOLL = aktuelle EV
// ----------------------------
$this->SetValue("Aktuelle_Leistung_SDL", $pSdlW);
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist + $pSdlW);
// ---------------------------------------------------------
// AKTUELLE_Leistung EV/SDL
// Ziel:
// - wenn beide aktiv: beide zeigen totalPower_ist (z.B. ~ -4000W)
// - wenn einer 0 ist: Umschaltbar -> auf "anderen" oder immer auf SDL
// ---------------------------------------------------------
$eps = 0.01;
// Wenn du willst, dass bei 0 immer SDL bekommt -> true setzen
$preferSDLWhenOneIsZero = true;
if (abs($pEvW) < $eps && abs($pSdlW) < $eps) {
$this->SetValue("Aktuelle_Leistung_EV", 0.0);
$this->SetValue("Aktuelle_Leistung_SDL", 0.0);
} elseif (abs($pEvW) < $eps || abs($pSdlW) < $eps) {
// Einer ist 0
if ($preferSDLWhenOneIsZero) {
// immer SDL bekommt totalPower_ist
$this->SetValue("Aktuelle_Leistung_EV", 0.0);
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist);
} else {
// "klassisch": der nicht-0 Kanal bekommt totalPower_ist
if (abs($pEvW) < $eps) {
$this->SetValue("Aktuelle_Leistung_EV", 0.0);
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist);
} else {
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist);
$this->SetValue("Aktuelle_Leistung_SDL", 0.0);
}
}
} else {
// Beide aktiv -> beide sollen ca. totalPower_ist anzeigen (dein Wunsch)
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist);
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist);
}
return $finalOutput;
}