Auf stand Von testign gebracht

This commit is contained in:
2024-11-29 10:42:33 +01:00
parent 1a43a5d5a0
commit 09fe380580
10 changed files with 226 additions and 256 deletions

View File

@@ -5,30 +5,7 @@ class WP_Steuerung extends IPSModule
{
parent::Create();
// Prioritäten
$this->RegisterVariableInteger("LockPrio", "LockPrio");
$this->RegisterVariableInteger("UserPrio", "UserPrio");
// Energiehandling
$this->RegisterVariableBoolean("Idle", "Idle", "", true);
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
$this->RegisterVariableBoolean("Sperrzeit", "Sperrzeit", "", false);
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
// Trägheit
$this->RegisterPropertyInteger("IdleCounterMax", 4);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
$this->SetValue("IdleCounter", 0);
$this->RegisterVariableInteger("Mindestlaufzeit", "IdleCounter", "", 0);
$this->RegisterVariableInteger("Zustand_WP", "Zustand_WP", "", 1);
$this->RegisterVariableInteger("WP_Laufzeit_Zahler", "WP_Laufzeit_Zahler", "", 20*12);
$this->RegisterVariableBoolean("LetzterPeakwert", "LetzterPeakwert", "", false);
$this->RegisterVariableBoolean("LetzterPeakwert_Aenderung", "LetzterPeakwert_Aenderung", "", false);
// WP-Spezifische Properies
$this->RegisterPropertyInteger("WP_Leistung", 6000);
$this->RegisterPropertyInteger("Wolkenschwellwert", 60);
$this->RegisterPropertyInteger("Wolkenwert", 0);
@@ -38,9 +15,32 @@ class WP_Steuerung extends IPSModule
$this->RegisterPropertyInteger("Kontakt_Erhoeung", 0);
$this->RegisterPropertyBoolean("Schwellwert_Anwenden", false);
$this->RegisterPropertyInteger("Schwellwert", 0);
$this->RegisterPropertyInteger("WW_Temp", 1);
$this->RegisterPropertyInteger("WW_Temp", 1);
//Initialisieren
// WP-Spezifische Variabeln
$this->RegisterVariableBoolean("Sperrzeit", "Sperrzeit", "", false);
$this->RegisterVariableInteger("Mindestlaufzeit", "IdleCounter", "", 0);
$this->RegisterVariableInteger("Zustand_WP", "Zustand_WP", "", 1);
$this->RegisterVariableInteger("WP_Laufzeit_Zahler", "WP_Laufzeit_Zahler", "", 20*12);
$this->RegisterVariableBoolean("LetzterPeakwert", "LetzterPeakwert", "", false);
$this->RegisterVariableBoolean("LetzterPeakwert_Aenderung", "LetzterPeakwert_Aenderung", "", false);
// 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");
// Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
$this->SetValue("IdleCounter", 0);
// Initialisiere Idle
$this->SetValue("Idle", true);
}
@@ -53,8 +53,8 @@ class WP_Steuerung 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);
@@ -68,7 +68,7 @@ class WP_Steuerung extends IPSModule
}
// Methode zum Setzen des aktuellen Stromverbrauchs
public function SetCurrentPower(float $power)
public function SetAktuelle_Leistung(float $power)
{
$sperrzei_abs =
((60 *
@@ -122,7 +122,7 @@ class WP_Steuerung extends IPSModule
$this->SetValue("WP_Laufzeit_Zahler", 0);
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
} elseif (
$this->GetValue("CurrentPower") != $power ||
$this->GetValue("Aktuelle_Leistung") != $power ||
($this->GetValue("WP_Laufzeit_Zahler") > 240 &&
$this->GetValue("LetzterPeakwert") !=
$this->GetValue("LetzterPeakwert_Aenderung"))
@@ -145,24 +145,24 @@ class WP_Steuerung extends IPSModule
) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak && $power == 0) {
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
} elseif (
$LastPeak == false &&
$power == $this->ReadPropertyInteger("WP_Leistung")
) {
$this->SetValue("Zustand_WP", 3);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak == false && $power == 0) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
}
} elseif ($state == 2) {
// Sperre
@@ -172,24 +172,24 @@ class WP_Steuerung extends IPSModule
) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak && $power == 0) {
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
} elseif (
$LastPeak == false &&
$power == $this->ReadPropertyInteger("WP_Leistung")
) {
$this->SetValue("Zustand_WP", 3);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak == false && $power == 0) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
}
} elseif ($state == 3) {
// Erhöht
@@ -199,24 +199,24 @@ class WP_Steuerung extends IPSModule
) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak && $power == 0) {
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
} elseif (
$LastPeak == false &&
$power == $this->ReadPropertyInteger("WP_Leistung")
) {
$this->SetValue("Zustand_WP", 3);
$this->SetValue(
"CurrentPower",
"Aktuelle_Leistung",
$this->ReadPropertyInteger("WP_Leistung")
);
} elseif ($LastPeak == false && $power == 0) {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
$this->SetValue("Aktuelle_Leistung", 0);
}
} else {
$this->SetValue("Zustand_WP", 1);
@@ -255,7 +255,7 @@ class WP_Steuerung extends IPSModule
if($this->GetValue("WP_Laufzeit_Zahler")<(20*12)){
$this->SetValue("PowerSteps", json_encode([$this->GetValue("CurrentPower")]));
$this->SetValue("PowerSteps", json_encode([$this->GetValue("Aktuelle_Leistung")]));
}elseif($this->ReadPropertyBoolean("Schwellwert_Anwenden")==true && ($this->ReadPropertyInteger("Schwellwert")>GetValue($this->ReadPropertyInteger("WW_Temp"))) ){
@@ -268,7 +268,7 @@ class WP_Steuerung extends IPSModule
public function CheckIdle($power)
{
$lastpower = GetValue($this->GetIDForIdent("CurrentPower"));
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
if ($lastpower != $power) {
$this->SetValue("Idle", false);
$this->SetValue(