diff --git a/Bat_EV_SDL_V3_Beta/module.php b/Bat_EV_SDL_V3_Beta/module.php index 654e513..0703940 100644 --- a/Bat_EV_SDL_V3_Beta/module.php +++ b/Bat_EV_SDL_V3_Beta/module.php @@ -781,12 +781,16 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array // Parameter: Toleranzband + Anzahl Treffer // Beispiel: 300W Band, 2 Treffer (bei 2s Update => ~4s stabil) - $tolW = 300.0; - $needHits = 2; - // Gefilterte Werte - $fEV = $filterCurrent("EV", $rawEV, $targetEV, $tolW, $needHits); - $fSDL = $filterCurrent("SDL", $rawSDL, $targetSDL, $tolW, $needHits); + $tolPct = 0.10; // 10% + $needHits = 2; // 2 Treffer hintereinander (oder 1 für sofort) + + $tolW_EV = abs($targetEV) * $tolPct; + $tolW_SDL = abs($targetSDL) * $tolPct; + + $fEV = $filterCurrent("EV", $rawEV, $targetEV, $tolW_EV, $needHits); + $fSDL = $filterCurrent("SDL", $rawSDL, $targetSDL, $tolW_SDL, $needHits); + // Setzen (wichtig: SetIdentValue!) $this->SetIdentValue("Aktuelle_Leistung_EV", (float)$fEV);