leistungsintegral verändert damit das takten nincht so schnell läfunt

This commit is contained in:
2025-03-17 15:28:43 +01:00
parent 04a96ea3b1
commit 3f7de21ea6
6 changed files with 80 additions and 7 deletions

View File

@@ -78,6 +78,20 @@ class Verbraucher_1_Stufig 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
}
// Methode zum Setzen der PowerSteps und Timer starten
@@ -120,7 +134,7 @@ class Verbraucher_1_Stufig extends IPSModule
$this->SetTimerOn();
}
$this->SetValue("Aktuelle_Leistung", $power);
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
$schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1");