no message

This commit is contained in:
belevo\mh
2026-04-17 13:38:46 +02:00
parent 38b335e7f7
commit deec2aafda
+31 -1
View File
@@ -667,7 +667,7 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
/*
$eps = 0.01;
$aktEV = 0.0;
@@ -716,7 +716,37 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
$this->SetValue("Aktuelle_Leistung_EV", (float)$aktEV);
$this->SetValue("Aktuelle_Leistung_SDL", (float)$aktSDL);
*/
$eps = 0.01;
$sumSoll = (float)($pEvW + $pSdlW);
if (abs($sumSoll) > $eps) {
// Normalfall: wir skalieren so, dass EV+SDL genau totalPower_ist ergibt
$factor = (float)($totalPower_ist / $sumSoll);
$aktEV = (float)($pEvW * $factor);
$aktSDL = (float)($pSdlW * $factor);
} else {
// Sonderfall: Soll hebt sich nahezu auf (sumSoll ~ 0)
// -> wenn Ist ebenfalls ~0: Soll anzeigen
if (abs($totalPower_ist) < 50.0) { // 50W Toleranz kannst du anpassen
$aktEV = (float)$pEvW;
$aktSDL = (float)$pSdlW;
} else {
// Ist ist nicht 0 obwohl Sollsumme 0 -> Abweichung zuweisen (z.B. SDL)
$aktEV = (float)$pEvW;
$aktSDL = (float)($totalPower_ist - $aktEV);
// Alternative: Abweichung EV geben:
// $aktSDL = (float)$pSdlW;
// $aktEV = (float)($totalPower_ist - $aktSDL);
}
}
$this->SetValue("Aktuelle_Leistung_EV", $aktEV);
$this->SetValue("Aktuelle_Leistung_SDL", $aktSDL);