no message
This commit is contained in:
@@ -663,8 +663,47 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
|||||||
// aktuelle - EV_SOLL = aktuelle SDL
|
// aktuelle - EV_SOLL = aktuelle SDL
|
||||||
// aktuelle - SDL_SOLL = aktuelle EV
|
// 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;
|
return $finalOutput;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user