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
|
private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
||||||
{
|
{
|
||||||
$calcJsonId = $this->GetIDForIdent("CalcJSON");
|
$calcJsonId = $this->GetIDForIdent("CalcJSON");
|
||||||
@@ -621,18 +622,18 @@ private function CalculateBatteryDistribution(float $pEvW, float $pSdlW): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$batteriesRaw = json_decode($this->ReadPropertyString("Batteries"));
|
$batteriesRaw = json_decode($this->ReadPropertyString("Batteries"));
|
||||||
|
|
||||||
$totalPower_ist = 0;
|
$totalPower_ist = 0;
|
||||||
|
|
||||||
foreach ($batteriesRaw as $bat) {
|
foreach ($batteriesRaw as $bat) {
|
||||||
|
|
||||||
$totalPower_ist += GetValue($bat->register_bat_power);
|
$totalPower_ist += GetValue($bat->register_bat_power);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------
|
||||||
|
// ALT (nicht mehr gebraucht) -> AUSKOMMENTIERT
|
||||||
|
// ----------------------------
|
||||||
|
/*
|
||||||
$sumReq = (abs($pEvW) + abs($pSdlW));
|
$sumReq = (abs($pEvW) + abs($pSdlW));
|
||||||
$sumReqRel = ($pEvW + $pSdlW);
|
$sumReqRel = ($pEvW + $pSdlW);
|
||||||
|
|
||||||
@@ -644,43 +645,31 @@ if($sumReq==0){
|
|||||||
}else{
|
}else{
|
||||||
|
|
||||||
if($pEvW>=0){
|
if($pEvW>=0){
|
||||||
|
|
||||||
$this->SetValue("Aktuelle_Leistung_EV",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
$this->SetValue("Aktuelle_Leistung_EV",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$this->SetValue("Aktuelle_Leistung_EV",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
$this->SetValue("Aktuelle_Leistung_EV",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pEvW);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pSdlW>=0){
|
if($pSdlW>=0){
|
||||||
$this->SetValue("Aktuelle_Leistung_SDL",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW);
|
$this->SetValue("Aktuelle_Leistung_SDL",((1+($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$this->SetValue("Aktuelle_Leistung_SDL",((1-($totalPower_ist-$sumReqRel) / $sumReq)) * $pSdlW);
|
$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;
|
return $finalOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function WriteBatteryPowerSetpoints(array $distribution): void
|
private function WriteBatteryPowerSetpoints(array $distribution): void
|
||||||
{
|
{
|
||||||
IPS_LogMessage(
|
IPS_LogMessage(
|
||||||
|
|||||||
Reference in New Issue
Block a user