diff --git a/Pufferspeicher/form.json b/Pufferspeicher/form.json index 14673db..979eedf 100644 --- a/Pufferspeicher/form.json +++ b/Pufferspeicher/form.json @@ -1,3 +1,4 @@ + { "elements": [ { @@ -100,45 +101,6 @@ "name": "Aussentemp", "caption": "Aussentemperatur", "suffix": "°C" - }, - { - "elements": [ - { - "type": "Select", - "name": "Stufen", - "caption": "Anzahl Stufen", - "options": [ - { "caption": "1-stufig", "value": 1 }, - { "caption": "2-stufig", "value": 2 }, - { "caption": "3-stufig", "value": 3 }, - { "caption": "4-stufig", "value": 4 } - ] - }, - { - "type": "NumberSpinner", - "name": "Stufe1", - "caption": "Wert Stufe 1", - "visible": "{Stufen} >= 1" - }, - { - "type": "NumberSpinner", - "name": "Stufe2", - "caption": "Wert Stufe 2", - "visible": "{Stufen} >= 2" - }, - { - "type": "NumberSpinner", - "name": "Stufe3", - "caption": "Wert Stufe 3", - "visible": "{Stufen} >= 3" - }, - { - "type": "NumberSpinner", - "name": "Stufe4", - "caption": "Wert Stufe 4", - "visible": "{Stufen} >= 4" - } - ] } ] -} \ No newline at end of file +} diff --git a/Pufferspeicher/module.php b/Pufferspeicher/module.php index 8c9b799..765344a 100644 --- a/Pufferspeicher/module.php +++ b/Pufferspeicher/module.php @@ -1,23 +1,14 @@ -RegisterPropertyInteger("PufferLeistung", 6000); $this->RegisterPropertyInteger("PufferTeilLeistung", 3000); - - $this->RegisterPropertyInteger("Stufe1", 100); - $this->RegisterPropertyInteger("Stufe2", 1000); - $this->RegisterPropertyInteger("Stufe3", 3000); - $this->RegisterPropertyInteger("Stufe4", 6000); - - - $this->RegisterPropertyInteger("ZeitKonstante", 120); $this->RegisterPropertyInteger("Pufferfuehler_PT1", 0); $this->RegisterPropertyInteger("Heizkontakt2_Puffer", 0); @@ -38,7 +29,6 @@ class Pufferspeicher extends IPSModule $this->RegisterVariableInteger("Aussentemperatur", "Aussentemperatur", "", 15); $this->RegisterVariableBoolean("Hysterese", "Hysterese","",false); - // Variabeln für Kommunkation mit Manager $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); $this->RegisterVariableInteger("PV_Prio", "PV_Prio"); @@ -49,29 +39,22 @@ class Pufferspeicher extends IPSModule $this->RegisterVariableInteger("Power", "Power", '', 0); $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving", "", true); $this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0); - // Hilfsvariabeln für Idle zustand $this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0); $this->SetValue("IdleCounter", 0); - // Initialisiere Idle $this->SetValue("Idle", true); $this->RegisterTimer("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");'); - } - public function ApplyChanges() { parent::ApplyChanges(); $this->SetTimerInterval("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000); - } - public function RequestAction($Ident, $Value) { switch ($Ident) { - case "SetAktuelle_Leistung": $this->SetValue("Power", (int)$Value); break; @@ -81,25 +64,22 @@ class Pufferspeicher extends IPSModule break; case "Do_UserCalc": - $this->SetAktuelle_Leistung($this->GetValue("Power")); $this->GetCurrentData($this->GetValue("Is_Peak_Shaving")); break; - default: throw new Exception("Invalid Ident"); } } - // Methode zum Setzen des aktuellen Stromverbrauchs public function SetAktuelle_Leistung(int $power) { // Schalte Kontakt Teillast und Vollast entsprechend der Power-Einstellung - if ($power == $this->ReadPropertyInteger("Stufe4")) { + if ($power == $this->ReadPropertyInteger("PufferLeistung")) { SetValue($this->ReadPropertyInteger("Heizkontakt2_Puffer"), true); SetValue($this->ReadPropertyInteger("Heizkontakt1_Puffer"), false); } elseif ( - $power == $this->ReadPropertyInteger("Stufe3") + $power == $this->ReadPropertyInteger("PufferTeilLeistung") ) { SetValue($this->ReadPropertyInteger("Heizkontakt2_Puffer"), false); SetValue($this->ReadPropertyInteger("Heizkontakt1_Puffer"), true); @@ -117,21 +97,18 @@ class Pufferspeicher extends IPSModule $this->ReadPropertyInteger("IdleCounterMax") ); } - // 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)))); // IdleCounter verarbeiten $this->ProcessIdleCounter(); } - // Methode zum Abrufen der aktuellen Daten public function GetCurrentData(bool $Peak) { $boilertemperatur_glätten = $this->ReadPropertyBoolean("Puffertemperatur_glätten"); - if ($boilertemperatur_glätten) { // Wenn Glättung aktiviert ist, führe das Glätten durch $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Pufferfuehler_PT1"); @@ -169,7 +146,6 @@ class Pufferspeicher extends IPSModule } - $at = GetValue($this->ReadPropertyInteger("Aussentemp")); $this->SetValue("Aussentemperatur", $at); $m = $this->GetValue("Steigung"); @@ -178,9 +154,7 @@ class Pufferspeicher extends IPSModule $maxAT = $this->ReadPropertyInteger("MaxAT_Temp"); // z.B. 20 $minAT = $this->ReadPropertyInteger("MinAT_Temp"); // z.B. 0 $m = ($maxVT - $minVT) / ($minAT - $maxAT); - $this->SetValue("Steigung", $m); - if ($at < $minAT){ $VT = $maxVT; } elseif ($at > $maxAT){ @@ -189,20 +163,17 @@ class Pufferspeicher extends IPSModule $VT = $m * $at + $maxVT; } $this->SetValue("Maximaltemperatur", $VT ); - $boilerTemp = $this->GetValue("Puffertemperatur"); $pufferLeistung = $this->ReadPropertyInteger("PufferLeistung"); $pufferTeilLeistung = $this->ReadPropertyInteger("PufferTeilLeistung"); $hyst = $this->GetValue("Hysterese"); - if($VT < $boilerTemp){ $this->SetValue("Hysterese", false ); }elseif($VT-5 >= $boilerTemp){ $this->SetValue("Hysterese", true); } - if ($Peak) { $this->SetValue( "PowerSteps", json_encode([0]) ); } else { @@ -215,7 +186,6 @@ class Pufferspeicher extends IPSModule } } } - private function ProcessIdleCounter() { // IdleCounter auslesen und verarbeiten @@ -227,7 +197,6 @@ class Pufferspeicher extends IPSModule $this->SetValue("Idle", true); } } - private function CheckIdle($power) { $lastpower = GetValue("Aktuelle_Leistung"); @@ -248,7 +217,5 @@ class Pufferspeicher extends IPSModule } } - } - ?>