no message
This commit is contained in:
+13
-24
@@ -490,6 +490,7 @@ class Bat_EV_SDL_V2 extends IPSModule
|
||||
|
||||
|
||||
|
||||
|
||||
private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
||||
{
|
||||
$calcJsonId = $this->GetIDForIdent("CalcJSON");
|
||||
@@ -621,18 +622,18 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$batteriesRaw = json_decode($this->ReadPropertyString("Batteries"));
|
||||
|
||||
$totalPower_ist = 0;
|
||||
|
||||
foreach ($batteriesRaw as $bat) {
|
||||
|
||||
$totalPower_ist += GetValue($bat->register_bat_power);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------
|
||||
// ALT (nicht mehr gebraucht) -> AUSKOMMENTIERT
|
||||
// ----------------------------
|
||||
/*
|
||||
$sumReq = (abs($pEvW) + abs($pSdlW));
|
||||
$sumReqRel = ($pEvW + $pSdlW);
|
||||
|
||||
@@ -644,43 +645,31 @@ if($sumReq==0){
|
||||
}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) {
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist / 2);
|
||||
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist / 2);
|
||||
|
||||
} else {
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_EV",($totalPower_ist / $sumReq) * $pEvW);
|
||||
|
||||
$this->SetValue("Aktuelle_Leistung_SDL",($totalPower_ist / $sumReq) * $pSdlW);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// ----------------------------
|
||||
// NEU (genau deine gewünschte Logik)
|
||||
// aktuelle - EV_SOLL = aktuelle SDL
|
||||
// aktuelle - SDL_SOLL = aktuelle EV
|
||||
// ----------------------------
|
||||
$this->SetValue("Aktuelle_Leistung_SDL", $totalPower_ist - $pEvW);
|
||||
$this->SetValue("Aktuelle_Leistung_EV", $totalPower_ist - $pSdlW);
|
||||
|
||||
return $finalOutput;
|
||||
}
|
||||
|
||||
|
||||
private function WriteBatteryPowerSetpoints(array $distribution): void
|
||||
{
|
||||
IPS_LogMessage(
|
||||
|
||||
Reference in New Issue
Block a user