From 1b6770f05cc13c615f7a316f5123fd1495a84d26 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Tue, 30 Sep 2025 15:55:20 +0200 Subject: [PATCH] no message --- Pufferspeicher/module.php | 108 +++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/Pufferspeicher/module.php b/Pufferspeicher/module.php index fd55f35..0b820d6 100644 --- a/Pufferspeicher/module.php +++ b/Pufferspeicher/module.php @@ -2,56 +2,66 @@ RegisterPropertyInteger("PufferLeistung", 6000); - $this->RegisterPropertyInteger("PufferTeilLeistung", 3000); - $this->RegisterPropertyInteger("ZeitKonstante", 120); - $this->RegisterPropertyInteger("Pufferfuehler_PT1", 0); - $this->RegisterPropertyInteger("Heizkontakt2_Puffer", 0); - $this->RegisterPropertyInteger("Heizkontakt1_Puffer", 0); - $this->RegisterPropertyInteger("Aussentemp", 20); - $this->RegisterPropertyInteger("MinVT_Temp", 20); - $this->RegisterPropertyInteger("MaxVT_Temp", 80); - $this->RegisterPropertyInteger("MaxAT_Temp", 20); - $this->RegisterPropertyInteger("MinAT_Temp", 0); - $this->RegisterPropertyBoolean("Puffertemperatur_glätten", 0); - $this->RegisterPropertyInteger("Interval", 5); // Recheninterval - - // Puffer spezifische Variablen - $this->RegisterVariableInteger("Steigung","Steigung","",0); - $this->RegisterVariableInteger("Maximaltemperatur"," Berechnete Maximaltemperatur VT","",60); - $this->RegisterVariableInteger("Puffertemperatur", "Puffertemperatur", "", 40); - $this->RegisterVariableInteger("Aussentemperatur", "Aussentemperatur", "", 15); - $this->RegisterVariableBoolean("Hysterese", "Hysterese","",0); - - // Variabeln für Kommunkation mit Manager - $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); - $this->RegisterVariableInteger("PV_Prio", "PV_Prio"); - $this->RegisterVariableBoolean("Idle", "Idle", "", 0); - $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableString("PowerSteps", "PowerSteps"); - $this->RegisterVariableInteger("Power", "Power", '', 0); - $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving", "", 1); - $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", 0); - $this->RegisterTimer("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");'); - } +public function Create() +{ + parent::Create(); - public function ApplyChanges() - { - parent::ApplyChanges(); - $this->SetTimerInterval("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000); - } + // Properties + $this->RegisterPropertyInteger("PufferLeistung", 6000); + $this->RegisterPropertyInteger("PufferTeilLeistung", 3000); + $this->RegisterPropertyInteger("ZeitKonstante", 120); + $this->RegisterPropertyInteger("Pufferfuehler_PT1", 0); + $this->RegisterPropertyInteger("Heizkontakt2_Puffer", 0); + $this->RegisterPropertyInteger("Heizkontakt1_Puffer", 0); + $this->RegisterPropertyInteger("Aussentemp", 20); + $this->RegisterPropertyInteger("MinVT_Temp", 20); + $this->RegisterPropertyInteger("MaxVT_Temp", 80); + $this->RegisterPropertyInteger("MaxAT_Temp", 20); + $this->RegisterPropertyInteger("MinAT_Temp", 0); + $this->RegisterPropertyBoolean("Puffertemperatur_glätten", false); + $this->RegisterPropertyInteger("Interval", 5); + $this->RegisterPropertyInteger("IdleCounterMax", 2); + + // Variablen + $this->RegisterVariableInteger("Steigung", "Steigung", "", 0); + $this->RegisterVariableInteger("Maximaltemperatur", "Berechnete Maximaltemperatur VT", "", 60); + $this->RegisterVariableInteger("Puffertemperatur", "Puffertemperatur", "", 40); + $this->RegisterVariableInteger("Aussentemperatur", "Aussentemperatur", "", 15); + $this->RegisterVariableBoolean("Hysterese", "Hysterese", "", 0); + + $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); + $this->RegisterVariableInteger("PV_Prio", "PV_Prio"); + $this->RegisterVariableBoolean("Idle", "Idle", "", 1); + $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); + $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); + $this->RegisterVariableString("PowerSteps", "PowerSteps"); + $this->RegisterVariableInteger("Power", "Power", "", 0); + $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving", "", 2); + $this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0); + $this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0); + + // Timer + $this->RegisterTimer( + "Timer_Do_UserCalc_Boiler", + 0, + 'IPS_RequestAction($_IPS["TARGET"], "Do_UserCalc", "");' + ); +} + +public function ApplyChanges() +{ + parent::ApplyChanges(); + + // Defaultwerte erst hier setzen! + $this->SetValue("IdleCounter", 0); + $this->SetValue("Idle", true); + + // Timer-Intervall aus Property übernehmen + $this->SetTimerInterval( + "Timer_Do_UserCalc_Boiler", + $this->ReadPropertyInteger("Interval") * 1000 + ); +} public function RequestAction($Ident, $Value) {