diff --git a/Bat_EV_SDL _V2/module.php b/Bat_EV_SDL _V2/module.php index c35d0c3..32ba25a 100644 --- a/Bat_EV_SDL _V2/module.php +++ b/Bat_EV_SDL _V2/module.php @@ -629,6 +629,34 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array } +$sumReq = (abs($pEvW) + abs($pSdlW)); +$sumReqRel = ($pEvW + $pSdlW); + +if($sumReq==0){ + + $this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist / 2); + $this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist / 2); + +}else{ + + if($pEvW>=0){ + + $this->SetValue("Aktuelle_Leistung_EV",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW); + + }else{ + $this->SetValue("Aktuelle_Leistung_EV",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW); + + } + + if($pSdlW>=0){ + $this->SetValue("Aktuelle_Leistung_SDL",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW); + + }else{ + $this->SetValue("Aktuelle_Leistung_SDL",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW); + } + +} +/* $sumReq = (float)($pEvW + $pSdlW); if (!is_finite($sumReq) || abs($sumReq) < 0.01) { @@ -643,6 +671,9 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array $this->SetValue("Aktuelle_Leistung_SDL",($totalPower_ist / $sumReq) * $pSdlW); } + */ + + return $finalOutput; } diff --git a/VGT_Sub/module.json b/VGT_Sub/module.json index ff2a514..b865270 100644 --- a/VGT_Sub/module.json +++ b/VGT_Sub/module.json @@ -7,11 +7,11 @@ "VGT MQTT Device" ], "parentRequirements": [ - "{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}" + "{F7A0DD2E-7684-4520-B61B-9613D6163722}" ], "childRequirements": [], "implemented": [ - "{7F7632D9-FA40-4F38-8DEA-C83CD4325A32}" + "{018EF6B5-AB94-40C6-AA53-46943E824ACF}" ], "prefix": "VGT", "version": "1.0"