Auf Testversion gebracht, V1.0

This commit is contained in:
2025-01-20 14:45:57 +01:00
parent 09fe380580
commit 278fafeca1
10 changed files with 642 additions and 105 deletions

View File

@@ -4,6 +4,27 @@
"type": "Label",
"caption": "Konfiguration der nötigen Schaltkontakte und Nennleistungen"
},
{
"type":"Select",
"name":"Boilertemperatur_glätten",
"caption":"Boilertemperatur glätten Ja oder Nein",
"options":[
{
"caption":"Ja",
"value":true
},
{
"caption":"Nein",
"value":false
}
]
},
{
"type": "NumberSpinner",
"name": "ZeitKonstante",
"caption": "Zeit Konstante",
"suffix": ""
},
{
"type": "NumberSpinner",
"name": "IdleCounterMax",
@@ -24,8 +45,8 @@
},
{
"type": "SelectVariable",
"name": "Boilertemperatur",
"caption": "Variable für Boilertemperatur",
"name": "Boilerfuehler_PT1",
"caption": "Variable für Boilerfühler PT1",
"test": true
},
{

View File

@@ -9,15 +9,23 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
// Boiler spezifische Properties
$this->RegisterPropertyInteger("BoilerLeistungTeillast", 3000);
$this->RegisterPropertyInteger("BoilerLeistungVolllast", 6000);
$this->RegisterPropertyInteger("Boilertemperatur", 0);
$this->RegisterPropertyInteger("ZeitKonstante", 120);
$this->RegisterPropertyInteger("Boilerfuehler_PT1", 0);
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
$this->RegisterPropertyInteger("Kontakt_Volllast", 0);
$this->RegisterPropertyBoolean("Boilertemperatur_glätten", false);
// 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);
$this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0);
// Variabeln für Kommunkation mit Manager
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
@@ -39,17 +47,25 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
public function ApplyChanges()
{
parent::ApplyChanges();
}
// Aktionen verarbeiten
public function RequestAction($Ident, $Value)
{
switch ($Ident) {
case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value);
break;
case "GetCurrentData":
return $this->GetCurrentData($Value);
$result = $this->GetCurrentData($Value);
return $result;
default:
throw new Exception("Invalid Ident");
}
@@ -94,7 +110,50 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
{
$LegioCounter = $this->GetValue("LegioCounter");
$boilerTemp = GetValue($this->ReadPropertyInteger("Boilertemperatur"));
$boilertemperatur_glätten = $this->ReadPropertyBoolean("Boilertemperatur_glätten");
if ($boilertemperatur_glätten) {
// Wenn Glättung aktiviert ist, führe das Glätten durch
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_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 = 30; // Zeitdifferenz zwischen den Messungen (30 Sekunden)
$alpha = $delta_t / ($time_constant + $delta_t);
$newBoilerTemp = $boilerTemp + $alpha * ($boilerPT1 - $boilerTemp);
$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");
if (IPS_VariableExists($boilerFuehlerPT1ID)) {
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
} else {
$boilerPT1 = 0.0; // Standardwert
}
// Setze Boilertemperatur direkt auf den Wert des Boilerfühlers
$this->SetValue("Boilertemperatur", $boilerPT1);
}
$minTemp = $this->GetValue("Mindesttemperatur");
$maxTemp = $this->GetValue("Maximaltemperatur");
$LegioTemp = $this->GetValue("Legionellentemperatur");
@@ -124,10 +183,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
if ($Peak) {
if ($boilerTemp < $minTemp) {
$this->SetValue(
"PowerSteps",
json_encode([0, $teilLeistung, $vollLeistung])
);
$this->SetValue( "PowerSteps", json_encode([0, $teilLeistung, $vollLeistung]) );
} elseif (
$boilerTemp < $minTemp + 5 &&
($AktuelleVollast || $AktuelleTeillast)
@@ -148,18 +204,10 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
) {
$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([0, $teilLeistung, $vollLeistung]));
} elseif ( $boilerTemp < $maxTemp && ($AktuelleVollast || $AktuelleTeillast)
) {
$this->SetValue(
"PowerSteps",
json_encode([0, $teilLeistung, $vollLeistung])
);
$this->SetValue( "PowerSteps", json_encode([0, $teilLeistung, $vollLeistung]));
} else {
$this->SetValue("PowerSteps", json_encode([0]));
}