Mindestlaufzeit eingefühgt für einstufige Verbracuher
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
class Verbraucher_1_Stufig extends IPSModule {
|
||||
|
||||
private $timerID;
|
||||
|
||||
public function Create() {
|
||||
parent::Create();
|
||||
|
||||
@@ -22,17 +23,18 @@ class Verbraucher_1_Stufig extends IPSModule {
|
||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
|
||||
$this->RegisterPropertyInteger("BoilerLeistung", 6000); // Standardwert für Volllast
|
||||
$this->RegisterPropertyInteger("Mindesttlaufzeit", 4); // Standardwert für Volllast
|
||||
$this->RegisterPropertyInteger("Zeit_Zwischen_Zustandswechseln", 1);
|
||||
$this->RegisterPropertyInteger("Schaltkontakt1", 0);
|
||||
|
||||
// Timer für Zeit_Zwischen_Zustandswechseln
|
||||
$this->RegisterTimer("ZustandswechselTimer", 0, 'Verbraucher_1_Stufig_ResetPowerSteps($_IPS[\'TARGET\']);');
|
||||
|
||||
//Initialisieren
|
||||
$this->SetValue("Idle", true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function ApplyChanges() {
|
||||
parent::ApplyChanges();
|
||||
}
|
||||
@@ -52,7 +54,6 @@ class Verbraucher_1_Stufig extends IPSModule {
|
||||
|
||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||
public function SetCurrentPower(float $power) {
|
||||
|
||||
$this->CheckIdle($power);
|
||||
$this->SetValue("CurrentPower", $power);
|
||||
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
|
||||
@@ -74,22 +75,34 @@ class Verbraucher_1_Stufig extends IPSModule {
|
||||
|
||||
if($schaltkontaktStatus){
|
||||
$this->SetValue("DailyOnTime", $this->GetValue("DailyOnTime") + 1);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Setzen der PowerSteps und Timer starten
|
||||
public function SetPowerSteps($powerSteps) {
|
||||
$this->SetValue("PowerSteps", $powerSteps);
|
||||
|
||||
// Timer setzen, der nach "Zeit_Zwischen_Zustandswechseln" abläuft
|
||||
$zeitZwischenZustandswechseln = $this->ReadPropertyInteger("Zeit_Zwischen_Zustandswechseln");
|
||||
$this->SetTimerInterval("ZustandswechselTimer", $zeitZwischenZustandswechseln * 1000); // Timer in Millisekunden
|
||||
}
|
||||
|
||||
// Methode zum Zurücksetzen von PowerSteps nach Ablauf des Timers
|
||||
public function ResetPowerSteps() {
|
||||
// PowerSteps wieder auf den ursprünglichen Zustand setzen (wie vorherige Funktionalität)
|
||||
$this->SetValue("PowerSteps", json_encode([$this->GetValue("CurrentPower")]));
|
||||
|
||||
// Timer stoppen
|
||||
$this->SetTimerInterval("ZustandswechselTimer", 0);
|
||||
}
|
||||
|
||||
// Methode zum Abrufen der aktuellen Daten
|
||||
public function GetCurrentData(bool $Peak) {
|
||||
|
||||
$IstNacht = $this->GetValue("IstNacht");
|
||||
$NeuesIstNacht = $this->ist_nachts();
|
||||
|
||||
if($IstNacht==true && $NeuesIstNacht==false){
|
||||
|
||||
$this->SetValue("DailyOnTime", 0);
|
||||
|
||||
}
|
||||
|
||||
$this->SetValue("IstNacht", $NeuesIstNacht);
|
||||
@@ -97,38 +110,23 @@ class Verbraucher_1_Stufig extends IPSModule {
|
||||
$DailyOnTime = $this->GetValue("DailyOnTime");
|
||||
$Mindestlaufzeit = $this->ReadPropertyInteger("Mindesttlaufzeit") * 60 * 12;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($NeuesIstNacht && ($DailyOnTime < $Mindestlaufzeit)){
|
||||
|
||||
if($Peak){
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode([0, $this->ReadPropertyInteger("BoilerLeistung")]));
|
||||
|
||||
}else{
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode([$this->ReadPropertyInteger("BoilerLeistung")]));
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($Peak){
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode([0]));
|
||||
|
||||
}else{
|
||||
|
||||
$this->SetValue("PowerSteps", json_encode([0, $this->ReadPropertyInteger("BoilerLeistung")]));
|
||||
|
||||
}}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function CheckIdle($power){
|
||||
|
||||
$lastpower = GetValue($this->GetIDForIdent("CurrentPower"));
|
||||
if($lastpower != $power){
|
||||
$this->SetValue("Idle", false);
|
||||
@@ -159,4 +157,4 @@ class Verbraucher_1_Stufig extends IPSModule {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"compatibility": {
|
||||
"version": "7.1"
|
||||
},
|
||||
"version": "0.9",
|
||||
"version": "0.10",
|
||||
"build": 0,
|
||||
"date": 0
|
||||
}
|
||||
Reference in New Issue
Block a user