diff --git a/Pufferspeicher/form.json b/Pufferspeicher/form.json index 0894eb7..49fc88d 100644 --- a/Pufferspeicher/form.json +++ b/Pufferspeicher/form.json @@ -1,42 +1,7 @@ + { "elements": [ - { - "type": "Label", - "caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen" - }, - { - "type":"Select", - "name":"Puffertemperatur_glätten", - "caption":"Puffertemperatur glätten", - "options":[ - { - "caption":"Ja", - "value":true - }, - { - "caption":"Nein", - "value":false - } - ] - }, - { - "type": "NumberSpinner", - "name": "ZeitKonstante", - "caption": "Zeit Konstante", - "suffix": "" - }, - { - "type": "NumberSpinner", - "name": "Interval", - "caption": "Intervall Neuberechnung der Werte Erst für spätere Versionen, aktuell auf 5 lassen!", - "suffix": "Sekunden" - }, - { - "type": "NumberSpinner", - "name": "IdleCounterMax", - "caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)", - "suffix": "" - } + ] } diff --git a/Pufferspeicher/module.php b/Pufferspeicher/module.php index 186793f..4bb4416 100644 --- a/Pufferspeicher/module.php +++ b/Pufferspeicher/module.php @@ -1,71 +1,14 @@ + RegisterPropertyInteger("ZeitKonstante", 120); - $this->RegisterPropertyBoolean("Puffertemperatur_glätten", false); - $this->RegisterPropertyInteger("Interval", 5) - - - // 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", "", 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); - } - - - private function ProcessIdleCounter() - { - // IdleCounter auslesen und verarbeiten - $idleCounter = $this->GetValue("IdleCounter"); - if ($idleCounter > 0) { - $this->SetValue("Idle", false); - $this->SetValue("IdleCounter", $idleCounter - 1); - } else { - $this->SetValue("Idle", true); - } - } - private function CheckIdle($power) - { - $lastpower = GetValue("Aktuelle_Leistung"); - if ($lastpower != GetValue("Aktuelle_Leistung")) { - $this->SetValue("Idle", false); - $this->SetValue( - "IdleCounter", - $this->ReadPropertyInteger("IdleCounterMax") - ); - } - // IdleCounter auslesen und verarbeiten - $idleCounter = $this->GetValue("IdleCounter"); - if ($idleCounter > 0) { - $this->SetValue("Idle", false); - $this->SetValue("IdleCounter", $idleCounter - 1); - } else { - $this->SetValue("Idle", true); - } } } ?>