leistungsintegral verändert damit das takten nincht so schnell läfunt
This commit is contained in:
+16
-1
@@ -59,6 +59,21 @@ class Batterie extends IPSModule
|
||||
$this->SetTimerInterval("Timer_Do_UserCalc_Battery",$this->ReadPropertyInteger("Interval")*1000);
|
||||
}
|
||||
|
||||
public function IntegratePower() {
|
||||
|
||||
if (rand(1, 1000) === 1) { // 0.1% Chance
|
||||
|
||||
$this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))));
|
||||
$this->SetValue("Bezogene_Energie_Zwischenwert", 0);
|
||||
|
||||
}else{
|
||||
$this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
|
||||
}
|
||||
|
||||
return; // Falls nichts gespeichert wird
|
||||
}
|
||||
|
||||
|
||||
private function GeneratePowerSteps($additionalValue)
|
||||
{
|
||||
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
|
||||
@@ -175,7 +190,7 @@ public function RequestAction($Ident, $Value)
|
||||
|
||||
// Setze die neue aktuelle Leistung
|
||||
$this->SetValue("Aktuelle_Leistung", $power);
|
||||
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
|
||||
$this->IntegratePower();
|
||||
|
||||
// IdleCounter verarbeiten
|
||||
$this->ProcessIdleCounter();
|
||||
|
||||
Reference in New Issue
Block a user