no message
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "Label",
|
"type": "Label",
|
||||||
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
|
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
|
||||||
},
|
},
|
||||||
@@ -37,70 +37,6 @@
|
|||||||
"name": "IdleCounterMax",
|
"name": "IdleCounterMax",
|
||||||
"caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)",
|
"caption": "Zyklen zwischen zwei Leistungsänderungen (Multipliziert sich mit Interval)",
|
||||||
"suffix": ""
|
"suffix": ""
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "PufferLeistung",
|
|
||||||
"caption": "Puffer Volllast",
|
|
||||||
"suffix": "Watt"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "PufferTeilLeistung",
|
|
||||||
"caption": "Puffer Teillast",
|
|
||||||
"suffix": "Watt"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Label",
|
|
||||||
"caption": "Endpunkte der Pufferfunktion bestimmen: VT = f(AT)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "MaxVT_Temp",
|
|
||||||
"caption": "Max Temperatur VT",
|
|
||||||
"suffix": "°C"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "MinVT_Temp",
|
|
||||||
"caption": "Min Temperatur VT",
|
|
||||||
"suffix": "°C"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "MaxAT_Temp",
|
|
||||||
"caption": "Max Temperatur AT",
|
|
||||||
"suffix": "°C"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "NumberSpinner",
|
|
||||||
"name": "MinAT_Temp",
|
|
||||||
"caption": "Min Temperatur AT",
|
|
||||||
"suffix": "°C"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SelectVariable",
|
|
||||||
"name": "Pufferfuehler_PT1",
|
|
||||||
"caption": "Variable für Pufferfühler PT1",
|
|
||||||
"test": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SelectVariable",
|
|
||||||
"name": "Heizkontakt1_Puffer",
|
|
||||||
"caption": "Heizkontakt Puffer 1.Stufe",
|
|
||||||
"test": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SelectVariable",
|
|
||||||
"name": "Heizkontakt2_Puffer",
|
|
||||||
"caption": "Heizkontakt Puffer 2.Stufe",
|
|
||||||
"test": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SelectVariable",
|
|
||||||
"name": "Aussentemp",
|
|
||||||
"caption": "Aussentemperatur",
|
|
||||||
"suffix": "°C"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-155
@@ -1,35 +1,16 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
class Pufferspeicher extends IPSModule
|
class Pufferspeicher extends IPSModule
|
||||||
{
|
{
|
||||||
public function Create()
|
public function Create()
|
||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
// Boiler spezifische Properties
|
|
||||||
|
|
||||||
$this->RegisterPropertyInteger("PufferLeistung", 6000);
|
|
||||||
$this->RegisterPropertyInteger("PufferTeilLeistung", 3000);
|
|
||||||
$this->RegisterPropertyInteger("ZeitKonstante", 120);
|
$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->RegisterPropertyBoolean("Puffertemperatur_glätten", false);
|
||||||
$this->RegisterPropertyString("Zeitplan", "");
|
$this->RegisterPropertyInteger("Interval", 5)
|
||||||
$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","",false);
|
|
||||||
|
|
||||||
// Variabeln für Kommunkation mit Manager
|
// Variabeln für Kommunkation mit Manager
|
||||||
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
||||||
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
||||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||||
@@ -47,146 +28,16 @@ class Pufferspeicher extends IPSModule
|
|||||||
$this->SetValue("Idle", true);
|
$this->SetValue("Idle", true);
|
||||||
$this->RegisterTimer("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
|
$this->RegisterTimer("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function ApplyChanges()
|
public function ApplyChanges()
|
||||||
{
|
{
|
||||||
parent::ApplyChanges();
|
parent::ApplyChanges();
|
||||||
$this->SetTimerInterval("Timer_Do_UserCalc_Boiler",$this->ReadPropertyInteger("Interval")*1000);
|
$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;
|
|
||||||
|
|
||||||
case "GetCurrentData":
|
|
||||||
$this->SetValue("Is_Peak_Shaving", (bool)$Value);
|
|
||||||
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("PufferLeistung")) {
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt2_Puffer"), true);
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt1_Puffer"), false);
|
|
||||||
} elseif (
|
|
||||||
$power == $this->ReadPropertyInteger("PufferTeilLeistung")
|
|
||||||
) {
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt2_Puffer"), false);
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt1_Puffer"), true);
|
|
||||||
} else {
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt2_Puffer"), false);
|
|
||||||
SetValue($this->ReadPropertyInteger("Heizkontakt1_Puffer"), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prüfe auf Änderung der Power im Vergleich zur letzten Einstellung
|
|
||||||
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
|
||||||
if ($power != $lastPower) {
|
|
||||||
$this->SetValue("Idle", false);
|
|
||||||
$this->SetValue(
|
|
||||||
"IdleCounter",
|
|
||||||
$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");
|
private function ProcessIdleCounter()
|
||||||
if ($boilertemperatur_glätten) {
|
|
||||||
// Wenn Glättung aktiviert ist, führe das Glätten durch
|
|
||||||
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Pufferfuehler_PT1");
|
|
||||||
|
|
||||||
if (IPS_VariableExists($boilerFuehlerPT1ID)) {
|
|
||||||
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
|
|
||||||
} else {
|
|
||||||
$boilerPT1 = 0.0; // Standardwert
|
|
||||||
}
|
|
||||||
|
|
||||||
$boilerTempID = $this->GetIDForIdent("Boilertemperatur");
|
|
||||||
if (IPS_VariableExists($boilerTempID)) {
|
|
||||||
$boilerTemp = $this->GetValue("Boilertemperatur");
|
|
||||||
} else {
|
|
||||||
$boilerTemp = 0.0; // Standardwert
|
|
||||||
}
|
|
||||||
|
|
||||||
// PT
|
|
||||||
$time_constant= $this->ReadPropertyInteger("ZeitKonstante");
|
|
||||||
$delta_t = 5; // Zeitdifferenz zwischen den Messungen (30 Sekunden)
|
|
||||||
$alpha = $delta_t / ($time_constant + $delta_t);
|
|
||||||
$newBoilerTemp = $boilerTemp + $alpha * ($boilerPT1 - $boilerTemp);
|
|
||||||
$this->SetValue("Puffertemperatur", $newBoilerTemp);
|
|
||||||
} else {
|
|
||||||
// Wenn Glättung nicht aktiviert ist, setze die Boilertemperatur direkt auf den Wert des Boilerfühlers
|
|
||||||
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Pufferfuehler_PT1");
|
|
||||||
|
|
||||||
if (IPS_VariableExists($boilerFuehlerPT1ID)) {
|
|
||||||
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
|
|
||||||
} else {
|
|
||||||
$boilerPT1 = 0.0; // Standardwert
|
|
||||||
}
|
|
||||||
// Setze Boilertemperatur direkt auf den Wert des Boilerfühlers
|
|
||||||
$this->SetValue("Puffertemperatur", $boilerPT1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$at = GetValue($this->ReadPropertyInteger("Aussentemp"));
|
|
||||||
$this->SetValue("Aussentemperatur", $at);
|
|
||||||
$m = $this->GetValue("Steigung");
|
|
||||||
$minVT = $this->ReadPropertyInteger("MinVT_Temp"); // z.B. 20
|
|
||||||
$maxVT = $this->ReadPropertyInteger("MaxVT_Temp"); // z.B. 80
|
|
||||||
$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){
|
|
||||||
$VT = $minVT;
|
|
||||||
} else {
|
|
||||||
$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 {
|
|
||||||
if ($boilerTemp < $VT && $hyst== true) {
|
|
||||||
$this->SetValue("PowerSteps", json_encode([0,$pufferTeilLeistung ,$pufferLeistung]));
|
|
||||||
} elseif ($boilerTemp > $VT - 5 && $hyst== false) {
|
|
||||||
$this->SetValue("PowerSteps", json_encode([0]));
|
|
||||||
} else {
|
|
||||||
$this->SetValue("PowerSteps", json_encode([0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private function ProcessIdleCounter()
|
|
||||||
{
|
{
|
||||||
// IdleCounter auslesen und verarbeiten
|
// IdleCounter auslesen und verarbeiten
|
||||||
$idleCounter = $this->GetValue("IdleCounter");
|
$idleCounter = $this->GetValue("IdleCounter");
|
||||||
@@ -216,6 +67,5 @@ class Pufferspeicher extends IPSModule
|
|||||||
$this->SetValue("Idle", true);
|
$this->SetValue("Idle", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user