From 8bacecd7c028306eff8372f1eede7943958762cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Tue, 22 Apr 2025 16:55:52 +0200 Subject: [PATCH] anpassungen an der pending_zeit, und fertig ausbau des askoheat moduls --- Ansteuerung_Askoheat/form.json | 78 +++++++++++++++++++++++++-- Ansteuerung_Askoheat/module.php | 77 ++++++++++++++------------ Boiler_2_Stufig_Mit_Fueler/module.php | 1 - Ladestation_v2/module.php | 2 +- 4 files changed, 119 insertions(+), 39 deletions(-) diff --git a/Ansteuerung_Askoheat/form.json b/Ansteuerung_Askoheat/form.json index 6069099..9097e63 100644 --- a/Ansteuerung_Askoheat/form.json +++ b/Ansteuerung_Askoheat/form.json @@ -4,7 +4,6 @@ "type": "Label", "caption": "Einstellungen für einstufigen Verbruacher Ein-Aus" }, - { "type": "NumberSpinner", "name": "IdleCounterMax", @@ -24,9 +23,80 @@ "suffix": "" }, { - "type": "ValidationTextBox", - "name": "IP_Adresse", - "caption": "IP-Adresse Askoheat" + "type": "SelectVariable", + "name": "Variable_Leistung", + "caption": "Variable mit der Nennleistung", + "test": true + }, + { + "type": "SelectVariable", + "name": "Variable_Temperatur", + "caption": "Variable mit der Solltemperatur Boiler", + "test": true + }, + { + "type": "SelectVariable", + "name": "Variable_Temperatur_Ist", + "caption": "Variable mit der Isttemperatur Boiler", + "test": true + }, + { + "type":"Select", + "name":"Boilertemperatur_glätten", + "caption":"Boilertemperatur glätten", + "options":[ + { + "caption":"Ja", + "value":true + }, + { + "caption":"Nein", + "value":false + } + ] + }, + { + "type": "NumberSpinner", + "name": "ZeitKonstante", + "caption": "Zeit Konstante", + "suffix": "" + }, + { + "type": "NumberSpinner", + "name": "Boilervolumen", + "caption": "Boilervolumen", + "suffix": "Liter" + }, + { + "type": "List", + "name": "Zeitplan", + "caption": "Zeitplan für Solltemperaturen", + "columns": [ + { + "caption": "Uhrzeit", + "name": "Uhrzeit", + "width": "150px", + "add": "00:00", + "edit": { + "type": "ValidationTextBox" + } + }, + { + "caption": "Solltemperatur", + "name": "Solltemperatur", + "width": "150px", + "add": 0, + "edit": { + "type": "NumberSpinner" + } + } + ], + "add": true, + "delete": true, + "sort": { + "column": "Uhrzeit", + "direction": "ascending" + } } ] diff --git a/Ansteuerung_Askoheat/module.php b/Ansteuerung_Askoheat/module.php index 583296a..5ed066d 100644 --- a/Ansteuerung_Askoheat/module.php +++ b/Ansteuerung_Askoheat/module.php @@ -8,9 +8,15 @@ class Ansteuerung_Askoheat extends IPSModule parent::Create(); // Verbraucherspezifische Properties - $this->RegisterPropertyInteger("BoilerLeistung", 4000); // Standardwert für Volllast - $this->RegisterPropertyString("IP_Adresse", ""); // Standardwert für Volllast + $this->RegisterPropertyInteger("ZeitKonstante", 120); + $this->RegisterPropertyBoolean("Boilertemperatur_glätten", false); + $this->RegisterPropertyInteger("Boilervolumen", 300); + $this->RegisterPropertyString("Zeitplan", ""); + $this->RegisterPropertyInteger("BoilerLeistung", 3500); // Standardwert für Volllast $this->RegisterPropertyInteger("Interval", 5); // Recheninterval + $this->RegisterPropertyInteger("Variable_Leistung", 0); // Recheninterval + $this->RegisterPropertyInteger("Variable_Temperatur", 0); // Recheninterval + $this->RegisterPropertyInteger("Variable_Temperatur_Ist", 0); // Recheninterval // Variabeln für Kommunkation mit Manager $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); @@ -24,6 +30,13 @@ class Ansteuerung_Askoheat extends IPSModule $this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0); $this->RegisterVariableFloat("Boilertemperatur", "Boilertemperatur", "", 0); + // Boiler spezifische Variablen + $this->RegisterVariableInteger("Mindesttemperatur","Mindesttemperatur","",45); + $this->RegisterVariableInteger("Maximaltemperatur","Maximaltemperatur","",60); + $this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65); + $this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0); + $this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0); + // Hilfsvariabeln für Idle zustand $this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0); @@ -55,10 +68,6 @@ class Ansteuerung_Askoheat extends IPSModule $this->SetValue("Is_Peak_Shaving", (bool)$Value); break; - case "ResetPowerSteps": - $this->ResetPowerSteps($Value); - break; - case "Do_UserCalc": $this->SetAktuelle_Leistung($this->GetValue("Power")); $this->GetCurrentData($this->GetValue("Is_Peak_Shaving")); @@ -123,20 +132,8 @@ class Ansteuerung_Askoheat extends IPSModule // 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("BoilerLeistungVolllast")) { - SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), true); - SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), false); - } elseif ( - $power == $this->ReadPropertyInteger("BoilerLeistungTeillast") - ) { - SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), false); - SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), true); - } else { - SetValue($this->ReadPropertyInteger("Kontakt_Volllast"), false); - SetValue($this->ReadPropertyInteger("Kontakt_Teillast"), false); - } - + IPS_RequestAction($this->ReadPropertyInteger("Variable_Leistung"), $power); + // Prüfe auf Änderung der Power im Vergleich zur letzten Einstellung $lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung")); if ($power != $lastPower) { @@ -154,6 +151,20 @@ class Ansteuerung_Askoheat extends IPSModule $this->ProcessIdleCounter(); } + + + public function Calc_Seven_Steps(int $power) + { + $steps = []; + $increment = $power / 7; + + for ($i = 0; $i <= 7; $i++) { + $steps[] = $i * $increment; + } + + return $steps; + } + // Methode zum Abrufen der aktuellen Daten public function GetCurrentData(bool $Peak) { @@ -164,7 +175,7 @@ class Ansteuerung_Askoheat extends IPSModule if ($boilertemperatur_glätten) { // Wenn Glättung aktiviert ist, führe das Glätten durch - $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); + $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Variable_Temperatur_Ist"); if (IPS_VariableExists($boilerFuehlerPT1ID)) { $boilerPT1 = GetValue($boilerFuehlerPT1ID); @@ -187,7 +198,7 @@ class Ansteuerung_Askoheat extends IPSModule $this->SetValue("Boilertemperatur", $newBoilerTemp); } else { // Wenn Glättung nicht aktiviert ist, setze die Boilertemperatur direkt auf den Wert des Boilerfühlers - $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); + $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Variable_Temperatur_Ist"); if (IPS_VariableExists($boilerFuehlerPT1ID)) { $boilerPT1 = GetValue($boilerFuehlerPT1ID); @@ -204,8 +215,7 @@ class Ansteuerung_Askoheat extends IPSModule $minTemp = $this->GetValue("Mindesttemperatur"); $maxTemp = $this->GetValue("Maximaltemperatur"); $LegioTemp = $this->GetValue("Legionellentemperatur"); - $teilLeistung = $this->ReadPropertyInteger("BoilerLeistungTeillast"); - $vollLeistung = $this->ReadPropertyInteger("BoilerLeistungVolllast"); + $vollLeistung = $this->ReadPropertyInteger("BoilerLeistung"); $nextEntry = $this->getNextTimeAndTemperature($this->ReadPropertyString("Zeitplan")); @@ -220,8 +230,9 @@ class Ansteuerung_Askoheat extends IPSModule - $AktuelleVollast = GetValue( - $this->ReadPropertyInteger("Kontakt_Volllast") + $boilerIsOn = (GetValue($this->ReadPropertyInteger("Variable_Leistung"))>0); + $AktuelleVollast = GetValue( + $this->ReadPropertyInteger("Variable_Leistung") ); $AktuelleTeillast = GetValue( $this->ReadPropertyInteger("Kontakt_Teillast") @@ -246,14 +257,14 @@ class Ansteuerung_Askoheat extends IPSModule if ($Peak) { if ($boilerTemp < $minTemp) { - $this->SetValue( "PowerSteps", json_encode([0, $teilLeistung, $vollLeistung]) ); + $this->SetValue( "PowerSteps", json_encode($this->Calc_Seven_Steps($vollLeistung)) ); } elseif ( $boilerTemp < $minTemp + 5 && - ($AktuelleVollast || $AktuelleTeillast) + ($boilerIsOn) ) { $this->SetValue( "PowerSteps", - json_encode([0, $teilLeistung, $vollLeistung]) + json_encode($this->Calc_Seven_Steps($vollLeistung)) ); } else { $this->SetValue("PowerSteps", json_encode([0])); @@ -263,14 +274,14 @@ class Ansteuerung_Askoheat extends IPSModule $this->SetValue("PowerSteps", json_encode([$vollLeistung])); } elseif ( $boilerTemp < $minTemp + 5 && - ($AktuelleVollast || $AktuelleTeillast) + ($boilerIsOn) ) { $this->SetValue("PowerSteps", json_encode([$vollLeistung])); } elseif ($boilerTemp < $maxTemp - 5) { - $this->SetValue("PowerSteps", json_encode([0, $teilLeistung, $vollLeistung])); - } elseif ( $boilerTemp < $maxTemp && ($AktuelleVollast || $AktuelleTeillast) + $this->SetValue("PowerSteps", json_encode($this->Calc_Seven_Steps($vollLeistung))); + } elseif ( $boilerTemp < $maxTemp && ($boilerIsOn) ) { - $this->SetValue( "PowerSteps", json_encode([0, $teilLeistung, $vollLeistung])); + $this->SetValue( "PowerSteps", json_encode($this->Calc_Seven_Steps($vollLeistung))); } else { $this->SetValue("PowerSteps", json_encode([0])); } diff --git a/Boiler_2_Stufig_Mit_Fueler/module.php b/Boiler_2_Stufig_Mit_Fueler/module.php index f8d1220..5dfffd2 100644 --- a/Boiler_2_Stufig_Mit_Fueler/module.php +++ b/Boiler_2_Stufig_Mit_Fueler/module.php @@ -25,7 +25,6 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule $this->RegisterVariableInteger("Maximaltemperatur","Maximaltemperatur","",60); $this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65); $this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0); - //$this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0); $this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0); diff --git a/Ladestation_v2/module.php b/Ladestation_v2/module.php index 8571294..2df94ec 100644 --- a/Ladestation_v2/module.php +++ b/Ladestation_v2/module.php @@ -439,7 +439,7 @@ class Ladestation_v2 extends IPSModule } - if($counter>(55/($this->ReadPropertyInteger("Interval")))){ + if($counter>(90/($this->ReadPropertyInteger("Interval")))){ $this->SetValue("Pending_Counter", 0); $this->Calc_Max_Current($this->GetValue("Is_1_ph"));