leistungsintegral verändert damit das takten nincht so schnell läfunt
This commit is contained in:
@@ -84,6 +84,20 @@ class Ladestation_Universal extends IPSModule
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
@@ -91,7 +105,7 @@ class Ladestation_Universal extends IPSModule
|
||||
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||
// Aktuelle Leistungsvorgabe setzen
|
||||
SetValue($this->GetIDForIdent("Aktuelle_Leistung"), $power);
|
||||
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
|
||||
$this->IntegratePower();
|
||||
|
||||
if ($power != $internalPower) {
|
||||
// Setze die interne Leistungsvorgabe
|
||||
|
||||
Reference in New Issue
Block a user