Refactoring Manager-User schnittstelle (Andere Variabelnnamen

This commit is contained in:
2024-11-28 14:37:38 +01:00
parent 77ca1724f7
commit 93dbb34042
6 changed files with 170 additions and 182 deletions

View File

@@ -6,25 +6,12 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
{
parent::Create();
// Prioritäten
$this->RegisterVariableInteger("LockPrio", "LockPrio");
$this->RegisterVariableInteger("UserPrio", "UserPrio");
// Energiehandling
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
// Trägheit system
$this->RegisterPropertyInteger("IdleCounterMax", 2);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
$this->SetValue("IdleCounter", 0);
// Boiler spezifische Properties
$this->RegisterPropertyInteger("BoilerLeistungTeillast", 3000);
$this->RegisterPropertyInteger("BoilerLeistungVolllast", 6000);
$this->RegisterPropertyInteger("Boilertemperatur", 0);
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
$this->RegisterPropertyInteger("Kontakt_Volllast", 0);
// Boiler spezifische Variablen
$this->RegisterVariableInteger("Boilermintemp","Boilermintemp","",45);
@@ -32,11 +19,20 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
$this->RegisterVariableInteger("Boilerlegiotemp","Boilerlegiotemp","",65);
$this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0);
// Schaltkontakte
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
$this->RegisterPropertyInteger("Kontakt_Volllast", 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");
// Initialisieren
// Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
$this->SetValue("IdleCounter", 0);
// Initialisiere Idle
$this->SetValue("Idle", true);
}
@@ -49,8 +45,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
public function RequestAction($Ident, $Value)
{
switch ($Ident) {
case "SetCurrentPower":
$this->SetCurrentPower($Value);
case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value);
break;
case "GetCurrentData":
return $this->GetCurrentData($Value);
@@ -60,7 +56,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
}
// Methode zum Setzen des aktuellen Stromverbrauchs
public function SetCurrentPower(int $power)
public function SetAktuelle_Leistung(int $power)
{
// Schalte Kontakt Teillast und Vollast entsprechend der Power-Einstellung
if ($power == $this->ReadPropertyInteger("BoilerLeistungVolllast")) {
@@ -77,7 +73,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
}
// Prüfe auf Änderung der Power im Vergleich zur letzten Einstellung
$lastPower = GetValue($this->GetIDForIdent("CurrentPower"));
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
if ($power != $lastPower) {
$this->SetValue("Idle", false);
$this->SetValue(
@@ -86,8 +82,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
);
}
// Setze die neue CurrentPower
$this->SetValue("CurrentPower", $power);
// Setze die neue Aktuelle_Leistung
$this->SetValue("Aktuelle_Leistung", $power);
// IdleCounter verarbeiten
$this->ProcessIdleCounter();
@@ -184,8 +180,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
private function CheckIdle($power)
{
$lastpower = GetValue("CurrentPower");
if ($lastpower != GetValue("CurrentPower")) {
$lastpower = GetValue("Aktuelle_Leistung");
if ($lastpower != GetValue("Aktuelle_Leistung")) {
$this->SetValue("Idle", false);
$this->SetValue(
"IdleCounter",