Auf stand Von testign gebracht
This commit is contained in:
@@ -46,11 +46,9 @@ class Belevo_Server_Kommunikation extends IPSModule
|
|||||||
if ($InfluxJaNein) {
|
if ($InfluxJaNein) {
|
||||||
// Timer auf 5 Minuten setzen
|
// Timer auf 5 Minuten setzen
|
||||||
$this->SetTimerInterval("Timer_Influx", 300000); // Alle 5 Minuten -> 5*60*1000=300000
|
$this->SetTimerInterval("Timer_Influx", 300000); // Alle 5 Minuten -> 5*60*1000=300000
|
||||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Influx Ja");
|
|
||||||
} else {
|
} else {
|
||||||
// Timer stoppen
|
// Timer stoppen
|
||||||
$this->SetTimerInterval("Timer_Influx", 0);
|
$this->SetTimerInterval("Timer_Influx", 0);
|
||||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Influx Nein");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,37 +6,33 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::Create();
|
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
|
// Boiler spezifische Properties
|
||||||
$this->RegisterPropertyInteger("BoilerLeistungTeillast", 3000);
|
$this->RegisterPropertyInteger("BoilerLeistungTeillast", 3000);
|
||||||
$this->RegisterPropertyInteger("BoilerLeistungVolllast", 6000);
|
$this->RegisterPropertyInteger("BoilerLeistungVolllast", 6000);
|
||||||
$this->RegisterPropertyInteger("Boilertemperatur", 0);
|
$this->RegisterPropertyInteger("Boilertemperatur", 0);
|
||||||
|
|
||||||
// Boiler spezifische Variablen
|
|
||||||
$this->RegisterVariableInteger("Boilermintemp","Boilermintemp","",45);
|
|
||||||
$this->RegisterVariableInteger("Boilermaxtemp","Boilermaxtemp","",60);
|
|
||||||
$this->RegisterVariableInteger("Boilerlegiotemp","Boilerlegiotemp","",65);
|
|
||||||
$this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0);
|
|
||||||
|
|
||||||
// Schaltkontakte
|
|
||||||
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
|
$this->RegisterPropertyInteger("Kontakt_Teillast", 0);
|
||||||
$this->RegisterPropertyInteger("Kontakt_Volllast", 0);
|
$this->RegisterPropertyInteger("Kontakt_Volllast", 0);
|
||||||
|
|
||||||
// Initialisieren
|
// Boiler spezifische Variablen
|
||||||
|
$this->RegisterVariableInteger("Mindesttemperatur","Mindesttemperatur","",45);
|
||||||
|
$this->RegisterVariableInteger("Maximaltemperatur","Maximaltemperatur","",60);
|
||||||
|
$this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65);
|
||||||
|
$this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 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");
|
||||||
|
|
||||||
|
// 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->SetValue("Idle", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +45,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
{
|
{
|
||||||
switch ($Ident) {
|
switch ($Ident) {
|
||||||
case "SetCurrentPower":
|
case "SetAktuelle_Leistung":
|
||||||
$this->SetCurrentPower($Value);
|
$this->SetAktuelle_Leistung($Value);
|
||||||
break;
|
break;
|
||||||
case "GetCurrentData":
|
case "GetCurrentData":
|
||||||
return $this->GetCurrentData($Value);
|
return $this->GetCurrentData($Value);
|
||||||
@@ -60,7 +56,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
// 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
|
// Schalte Kontakt Teillast und Vollast entsprechend der Power-Einstellung
|
||||||
if ($power == $this->ReadPropertyInteger("BoilerLeistungVolllast")) {
|
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
|
// 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) {
|
if ($power != $lastPower) {
|
||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
@@ -86,8 +82,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setze die neue CurrentPower
|
// Setze die neue Aktuelle_Leistung
|
||||||
$this->SetValue("CurrentPower", $power);
|
$this->SetValue("Aktuelle_Leistung", $power);
|
||||||
|
|
||||||
// IdleCounter verarbeiten
|
// IdleCounter verarbeiten
|
||||||
$this->ProcessIdleCounter();
|
$this->ProcessIdleCounter();
|
||||||
@@ -99,9 +95,9 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
$LegioCounter = $this->GetValue("LegioCounter");
|
$LegioCounter = $this->GetValue("LegioCounter");
|
||||||
|
|
||||||
$boilerTemp = GetValue($this->ReadPropertyInteger("Boilertemperatur"));
|
$boilerTemp = GetValue($this->ReadPropertyInteger("Boilertemperatur"));
|
||||||
$minTemp = $this->GetValue("Boilermintemp");
|
$minTemp = $this->GetValue("Mindesttemperatur");
|
||||||
$maxTemp = $this->GetValue("Boilermaxtemp");
|
$maxTemp = $this->GetValue("Maximaltemperatur");
|
||||||
$LegioTemp = $this->GetValue("Boilerlegiotemp");
|
$LegioTemp = $this->GetValue("Legionellentemperatur");
|
||||||
$teilLeistung = $this->ReadPropertyInteger("BoilerLeistungTeillast");
|
$teilLeistung = $this->ReadPropertyInteger("BoilerLeistungTeillast");
|
||||||
$vollLeistung = $this->ReadPropertyInteger("BoilerLeistungVolllast");
|
$vollLeistung = $this->ReadPropertyInteger("BoilerLeistungVolllast");
|
||||||
|
|
||||||
@@ -184,8 +180,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
|
|||||||
|
|
||||||
private function CheckIdle($power)
|
private function CheckIdle($power)
|
||||||
{
|
{
|
||||||
$lastpower = GetValue("CurrentPower");
|
$lastpower = GetValue("Aktuelle_Leistung");
|
||||||
if ($lastpower != GetValue("CurrentPower")) {
|
if ($lastpower != GetValue("Aktuelle_Leistung")) {
|
||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"IdleCounter",
|
"IdleCounter",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class CC100_HW extends IPSModule
|
|||||||
private $DigOutPID = "/sys/kernel/dout_drv/DOUT_DATA";
|
private $DigOutPID = "/sys/kernel/dout_drv/DOUT_DATA";
|
||||||
private $PT1PID = "/sys/bus/iio/devices/iio:device2/in_voltage13_raw";
|
private $PT1PID = "/sys/bus/iio/devices/iio:device2/in_voltage13_raw";
|
||||||
private $PT2PID = "/sys/bus/iio/devices/iio:device2/in_voltage1_raw";
|
private $PT2PID = "/sys/bus/iio/devices/iio:device2/in_voltage1_raw";
|
||||||
private $DIN_FILE = "/sys/bus/iio/devices/iio:device2/in_voltage1_raw";
|
private $DIN_FILE = "/sys/devices/platform/soc/44009000.spi/spi_master/spi0/spi0.0/din";
|
||||||
private $waitingTime = 1; // Waiting time (in ms) for a new attempt to write a digital output (if file is blocked)
|
private $waitingTime = 1; // Waiting time (in ms) for a new attempt to write a digital output (if file is blocked)
|
||||||
private $maxTime = 5000; // Max time (in ms) for the writing process
|
private $maxTime = 5000; // Max time (in ms) for the writing process
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ class CC100_HW extends IPSModule
|
|||||||
|
|
||||||
private function TryWriteFile($starttime)
|
private function TryWriteFile($starttime)
|
||||||
{
|
{
|
||||||
$this->readAndConvertToBools($DIN_FILE);
|
$this->readAndConvertToBools($this->DIN_FILE);
|
||||||
|
|
||||||
$currentTime = microtime(true) * 1000;
|
$currentTime = microtime(true) * 1000;
|
||||||
if ($currentTime - $starttime <= $this->maxTime) {
|
if ($currentTime - $starttime <= $this->maxTime) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"type": "Label",
|
"type": "Label",
|
||||||
"caption": "Aktuell wird nur Go-E ladestation zu testzwecken unterstützt!"
|
"caption": "Aktuell wird nur Go-E ladestation unterstützt!"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,41 +6,37 @@ class Ladestation_Universal extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
|
|
||||||
// Prioritäten
|
// Ladestationspezifische Properties
|
||||||
$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
|
|
||||||
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
|
||||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
|
||||||
$this->SetValue("IdleCounter", 0);
|
|
||||||
|
|
||||||
// Properties registrieren
|
|
||||||
$this->RegisterPropertyInteger("MinLeistung", 3600);
|
$this->RegisterPropertyInteger("MinLeistung", 3600);
|
||||||
$this->RegisterPropertyInteger("MaxLeistung", 11000);
|
$this->RegisterPropertyInteger("MaxLeistung", 11000);
|
||||||
|
|
||||||
$this->RegisterPropertyInteger("MinLeistung_1ph", 1400);
|
$this->RegisterPropertyInteger("MinLeistung_1ph", 1400);
|
||||||
$this->RegisterPropertyInteger("MaxLeistung_1ph", 7800);
|
$this->RegisterPropertyInteger("MaxLeistung_1ph", 7800);
|
||||||
$this->RegisterPropertyString("IP_Adresse", "0.0.0.0");
|
$this->RegisterPropertyString("IP_Adresse", "0.0.0.0");
|
||||||
|
|
||||||
$this->RegisterVariableBoolean("Ladebereit", "Ladebereit", "~Switch", 11);
|
// Ladestationspezifische Variabeln
|
||||||
$this->RegisterVariableBoolean("Solarladen", "Solarladen", "~Switch", 11);
|
$this->RegisterVariableBoolean("Ladebereit", "Ladebereit", "~Switch", 1);
|
||||||
|
$this->RegisterVariableBoolean("Solarladen", "Solarladen", "~Switch", 0);
|
||||||
$this->RegisterVariableInteger("Fahrzeugstatus", "Fahrzeugstatus", "", 0);
|
$this->RegisterVariableInteger("Fahrzeugstatus", "Fahrzeugstatus", "", 0);
|
||||||
$this->RegisterVariableInteger("Lademodus", "Lademodus", "", 0);
|
$this->RegisterVariableInteger("Lademodus", "Lademodus", "", 0);
|
||||||
$this->RegisterVariableFloat("Ladeleistung_Effektiv", "Ladeleistung_Effektiv", "", 0);
|
$this->RegisterVariableFloat("Ladeleistung_Effektiv", "Ladeleistung_Effektiv", "", 0);
|
||||||
|
|
||||||
$this->RegisterVariableBoolean("Peak", "Peak", "", 0);
|
$this->RegisterVariableBoolean("Peak", "Peak", "", 0);
|
||||||
|
|
||||||
$this->RegisterVariableInteger("Ladestrom", "Ladestrom");
|
$this->RegisterVariableInteger("Ladestrom", "Ladestrom");
|
||||||
$this->RegisterVariableInteger("Ladeleistung", "Ladeleistung");
|
$this->RegisterVariableInteger("Ladeleistung", "Ladeleistung");
|
||||||
|
|
||||||
// Initialisieren
|
// 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);
|
$this->SetValue("Idle", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +50,8 @@ class Ladestation_Universal extends IPSModule
|
|||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
{
|
{
|
||||||
switch ($Ident) {
|
switch ($Ident) {
|
||||||
case "SetCurrentPower":
|
case "SetAktuelle_Leistung":
|
||||||
$this->SetCurrentPower($Value);
|
$this->SetAktuelle_Leistung($Value);
|
||||||
break;
|
break;
|
||||||
case "GetCurrentData":
|
case "GetCurrentData":
|
||||||
$powerSteps = $this->GetCurrentData($Value);
|
$powerSteps = $this->GetCurrentData($Value);
|
||||||
@@ -65,11 +61,11 @@ class Ladestation_Universal extends IPSModule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetCurrentPower(int $power)
|
public function SetAktuelle_Leistung(int $power)
|
||||||
{
|
{
|
||||||
$internalPower = GetValue($this->GetIDForIdent("CurrentPower"));
|
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
// Aktuelle Leistungsvorgabe setzen
|
// Aktuelle Leistungsvorgabe setzen
|
||||||
SetValue($this->GetIDForIdent("CurrentPower"), $power);
|
SetValue($this->GetIDForIdent("Aktuelle_Leistung"), $power);
|
||||||
if ($power != $internalPower) {
|
if ($power != $internalPower) {
|
||||||
// Setze die interne Leistungsvorgabe
|
// Setze die interne Leistungsvorgabe
|
||||||
|
|
||||||
@@ -124,7 +120,7 @@ class Ladestation_Universal extends IPSModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ansonsten setze Ladeleistung auf die aktuelle Leistungsvorgabe (CurrentPower)
|
// Ansonsten setze Ladeleistung auf die aktuelle Leistungsvorgabe (Aktuelle_Leistung)
|
||||||
SetValue($this->GetIDForIdent("Ladeleistung"), $power);
|
SetValue($this->GetIDForIdent("Ladeleistung"), $power);
|
||||||
|
|
||||||
if (GetValue($this->GetIDForIdent("Lademodus")) == 0) {
|
if (GetValue($this->GetIDForIdent("Lademodus")) == 0) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "List",
|
"type": "List",
|
||||||
"name": "EnergyUserList",
|
"name": "Verbraucher_Liste",
|
||||||
"caption": "Verbraucher, die gemanagt werden sollen.",
|
"caption": "Verbraucher, die gemanagt werden sollen.",
|
||||||
"add": true,
|
"add": true,
|
||||||
"delete": true,
|
"delete": true,
|
||||||
@@ -32,12 +32,12 @@
|
|||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"caption": "Energieverbraucher",
|
"caption": "Energieverbraucher",
|
||||||
"name": "EnergyUser",
|
"name": "Verbraucher",
|
||||||
"width": "auto",
|
"width": "auto",
|
||||||
"add": 0,
|
"add": 0,
|
||||||
"edit": {
|
"edit": {
|
||||||
"type": "SelectInstance",
|
"type": "SelectInstance",
|
||||||
"filter": "EnergyUser"
|
"filter": "Verbraucher"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,24 +10,17 @@ class Manager extends IPSModule
|
|||||||
$this->RegisterPropertyInteger("Peakleistung", 0);
|
$this->RegisterPropertyInteger("Peakleistung", 0);
|
||||||
$this->RegisterPropertyInteger("Ueberschussleistung", 0);
|
$this->RegisterPropertyInteger("Ueberschussleistung", 0);
|
||||||
$this->RegisterPropertyInteger("Netzbezug", 0); // Initialisierung mit 0
|
$this->RegisterPropertyInteger("Netzbezug", 0); // Initialisierung mit 0
|
||||||
$this->RegisterPropertyString("EnergyUserList", "[]");
|
$this->RegisterPropertyString("Verbraucher_Liste", "[]");
|
||||||
|
|
||||||
// Timer registrieren
|
// Timer registrieren
|
||||||
$this->RegisterTimer(
|
$this->RegisterTimer("Timer_DistributeEnergy",5000,"IPS_RequestAction(" .$this->InstanceID .', "DistributeEnergy", "");');
|
||||||
"Timer_DistributeEnergy",
|
|
||||||
5000,
|
|
||||||
"IPS_RequestAction(" .
|
|
||||||
$this->InstanceID .
|
|
||||||
', "DistributeEnergy", "");'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ApplyChanges()
|
public function ApplyChanges()
|
||||||
{
|
{
|
||||||
parent::ApplyChanges();
|
parent::ApplyChanges();
|
||||||
|
//Liste aller Verbraucher einlesen
|
||||||
// Zusätzliche Konfigurationslogik hier hinzufügen
|
$Verbraucher_Liste = $this->ReadPropertyString("Verbraucher_Liste");
|
||||||
$energyUserList = $this->ReadPropertyString("EnergyUserList");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
@@ -49,133 +42,134 @@ class Manager extends IPSModule
|
|||||||
// Systemvariablen abrufen
|
// Systemvariablen abrufen
|
||||||
$Netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
$Netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||||
$Peakleistung = $this->ReadPropertyInteger("Peakleistung");
|
$Peakleistung = $this->ReadPropertyInteger("Peakleistung");
|
||||||
$Ueberschussleistung = $this->ReadPropertyInteger(
|
$Ueberschussleistung = $this->ReadPropertyInteger("Ueberschussleistung");
|
||||||
"Ueberschussleistung"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Fallunterscheidung
|
// Fallunterscheidung ob auf Solarladen oder Peakshaving gerregelt wird.
|
||||||
if ($Netzbezug < ($Peakleistung - $Ueberschussleistung) / 2) {
|
if ($Netzbezug < ($Peakleistung - $Ueberschussleistung) / 2) {
|
||||||
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
$remainingPower = -1 * (-1 * $Ueberschussleistung + $Netzbezug);
|
||||||
$getCurrentDataParam = false;
|
$Is_Peak_Shaving = false;
|
||||||
} else {
|
} else {
|
||||||
$remainingPower = $Peakleistung - $Netzbezug;
|
$remainingPower = $Peakleistung - $Netzbezug;
|
||||||
$getCurrentDataParam = true;
|
$Is_Peak_Shaving = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnergyUserList auslesen und dekodieren
|
// Alle Energieverbraucher auslesen und dekodieren
|
||||||
$energyUserListJSON = $this->ReadPropertyString("EnergyUserList");
|
$Verbraucher_Liste = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
||||||
$energyUserList = json_decode($energyUserListJSON, true);
|
|
||||||
|
|
||||||
if (empty($energyUserList)) {
|
if (empty($Verbraucher_Liste)) {
|
||||||
// Liste ist leer, daher nichts zu tun
|
// Liste ist leer, daher nichts zu tun
|
||||||
|
IPS_LogMessage("Manager", "aufgerufen leere liste");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schleife, um IPS_RequestAction für alle Benutzer auszuführen
|
// Frage alle Energieverbraucher ab, was sie für Leistungen benötigen könnten
|
||||||
foreach ($energyUserList as $user) {
|
foreach ($Verbraucher_Liste as $user) {
|
||||||
if (IPS_InstanceExists($user["EnergyUser"])) {
|
if (IPS_InstanceExists($user["Verbraucher"])) {
|
||||||
IPS_RequestAction(
|
IPS_RequestAction($user["Verbraucher"],"GetCurrentData", $Is_Peak_Shaving);
|
||||||
$user["EnergyUser"],
|
IPS_LogMessage("Manager", "aufgerufen getcurrentdata");
|
||||||
"GetCurrentData",
|
|
||||||
$getCurrentDataParam
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filteredEnergyUsers = [];
|
$filteredVerbraucher = []; // Array das später mit allen Verbrauchsdaten der Energieverbraucher gefüllt wird
|
||||||
$allIdle = true; // Variable zur Überprüfung, ob alle Benutzer Idle = true sind
|
$allIdle = true; // Variable zur Überprüfung, ob alle Benutzer Idle = true sind
|
||||||
$totalCurrentPower = 0; // Variable zur Summierung der CurrentPower Werte
|
$totalAktuelle_Leistung = 0; // Variable zur Summierung der Aktuelle_Leistung Werte
|
||||||
|
|
||||||
|
// Fülle das Array mit allen entsprechenden Werten der Verbraucher ab
|
||||||
|
foreach ($Verbraucher_Liste as $user) {
|
||||||
|
if (!IPS_InstanceExists($user["Verbraucher"])) {
|
||||||
|
IPS_LogMessage("Manager", "aufgerufen komisch");
|
||||||
|
|
||||||
foreach ($energyUserList as $user) {
|
|
||||||
if (!IPS_InstanceExists($user["EnergyUser"])) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Werte direkt von der EnergyUser-Instanz abrufen
|
// Werte direkt von der Verbraucher-Instanz abrufen
|
||||||
$currentPower = GetValue(IPS_GetObjectIDByIdent("CurrentPower", $user["EnergyUser"]));
|
$Aktuelle_Leistung = GetValue(IPS_GetObjectIDByIdent("Aktuelle_Leistung", $user["Verbraucher"]));
|
||||||
$usedEnergy = GetValue(IPS_GetObjectIDByIdent("UsedEnergy", $user["EnergyUser"]));
|
$Bezogene_Energie = GetValue(IPS_GetObjectIDByIdent("Bezogene_Energie", $user["Verbraucher"]));
|
||||||
$userPrio = GetValue(IPS_GetObjectIDByIdent("UserPrio", $user["EnergyUser"]));
|
$PV_Prio = GetValue(IPS_GetObjectIDByIdent("PV_Prio", $user["Verbraucher"]));
|
||||||
$lockPrio = GetValue(IPS_GetObjectIDByIdent("LockPrio", $user["EnergyUser"]));
|
$Sperre_Prio = GetValue(IPS_GetObjectIDByIdent("Sperre_Prio", $user["Verbraucher"]));
|
||||||
$idle = GetValue(IPS_GetObjectIDByIdent("Idle", $user["EnergyUser"]));
|
$idle = GetValue(IPS_GetObjectIDByIdent("Idle", $user["Verbraucher"]));
|
||||||
$powerStepsJson = GetValue(IPS_GetObjectIDByIdent("PowerSteps", $user["EnergyUser"]));
|
$powerStepsJson = GetValue(IPS_GetObjectIDByIdent("PowerSteps", $user["Verbraucher"]));
|
||||||
$powerSteps = json_decode($powerStepsJson, true);
|
$powerSteps = json_decode($powerStepsJson, true);
|
||||||
|
|
||||||
// EnergyUser-Daten zum gefilterten Array hinzufügen
|
// Verbraucher-Daten zum gefilterten Array hinzufügen
|
||||||
$filteredEnergyUsers[] = [
|
$filteredVerbraucher[] = [
|
||||||
"EnergyUser" => $user["EnergyUser"],
|
"Verbraucher" => $user["Verbraucher"],
|
||||||
"InstanceID" => $user["EnergyUser"],
|
"InstanceID" => $user["Verbraucher"],
|
||||||
"CurrentPower" => $currentPower,
|
"Aktuelle_Leistung" => $Aktuelle_Leistung,
|
||||||
"UsedEnergy" => $usedEnergy,
|
"Bezogene_Energie" => $Bezogene_Energie,
|
||||||
"UserPrio" => $userPrio,
|
"PV_Prio" => $PV_Prio,
|
||||||
"LockPrio" => $lockPrio,
|
"Sperre_Prio" => $Sperre_Prio,
|
||||||
"Idle" => $idle,
|
"Idle" => $idle,
|
||||||
"PowerSteps" => $powerSteps, // PowerSteps direkt hier hinzufügen
|
"PowerSteps" => $powerSteps,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Überprüfen, ob alle Benutzer Idle = true sind
|
// Überprüfen, ob alle Benutzer Idle = true sind, wenn einer nicht ist, wird später verworfen...
|
||||||
if (!$idle) {
|
if (!$idle) {
|
||||||
$allIdle = false;
|
$allIdle = false;
|
||||||
|
IPS_LogMessage("Manager", "nciht idle");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the totalCurrentPower to the remainingPower
|
// Addiere die aktuell bereits verwendete Leistung auf, um sie bei der verteilung zu berücksichtigen
|
||||||
$totalCurrentPower += $currentPower;
|
$totalAktuelle_Leistung += $Aktuelle_Leistung;
|
||||||
}
|
}
|
||||||
$remainingPower += $totalCurrentPower;
|
// Berücksichtigung der bereits verteilten Leistungen (nachher kann dafür wieder bei 0 begonnen werden zu verteilen)
|
||||||
|
$remainingPower += $totalAktuelle_Leistung;
|
||||||
|
|
||||||
if (empty($filteredEnergyUsers)) {
|
// Abbrechen wenn es keine gefilterten User gibt
|
||||||
|
if (empty($filteredVerbraucher)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wenn nicht alle Benutzer Idle = true sind, rufe SetCurrentPower mit CurrentPower Werten auf
|
// Wenn nicht alle Benutzer Idle = true sind, rufe SetAktuelle_Leistung mit Aktuelle_Leistung Werten auf, (alle Verbraucher behalten die aktuelle Leistung)
|
||||||
if (!$allIdle) {
|
if (!$allIdle) {
|
||||||
foreach ($filteredEnergyUsers as $user) {
|
foreach ($filteredVerbraucher as $user) {
|
||||||
IPS_RequestAction(
|
IPS_RequestAction($user["InstanceID"],"SetAktuelle_Leistung",$user["Aktuelle_Leistung"]);
|
||||||
$user["InstanceID"],
|
IPS_LogMessage("Manager", "aufgerufen nicht alle idle");
|
||||||
"SetCurrentPower",
|
|
||||||
$user["CurrentPower"]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sortiere die EnergyUser nach Priorität basierend auf dem Parameter
|
// Sortiere die Verbruacher nach Priorität entweder der PV_Prio oder der Peak Prio
|
||||||
usort($filteredEnergyUsers, function ($a, $b) use (
|
usort($filteredVerbraucher, function ($a, $b) use (
|
||||||
$getCurrentDataParam
|
$Is_Peak_Shaving
|
||||||
) {
|
) {
|
||||||
$primaryKey = $getCurrentDataParam ? "LockPrio" : "UserPrio";
|
$primaryKey = $Is_Peak_Shaving ? "Sperre_Prio" : "PV_Prio";
|
||||||
|
// Wenn die Prio geleich ist, sortiere danach welcher verbraucher bisher am wenigsten Energie bekommen hat.
|
||||||
if ($a[$primaryKey] == $b[$primaryKey]) {
|
if ($a[$primaryKey] == $b[$primaryKey]) {
|
||||||
return $a["UsedEnergy"] <=> $b["UsedEnergy"];
|
return $a["Bezogene_Energie"] <=> $b["Bezogene_Energie"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $a[$primaryKey] <=> $b[$primaryKey];
|
return $a[$primaryKey] <=> $b[$primaryKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Primärschlüssel für die Priorität basierend auf dem Parameter auswählen
|
// Primärschlüssel für die Priorität basierend auf dem Parameter auswählen (für sortierung in gruppen anschliessend)
|
||||||
$priorityKey = $getCurrentDataParam ? "LockPrio" : "UserPrio";
|
$priorityKey = $Is_Peak_Shaving ? "Sperre_Prio" : "PV_Prio";
|
||||||
|
|
||||||
// Schleife durch alle Prioritäten
|
// Schleife durch alle Prioritäten
|
||||||
$priorities = array_unique(
|
$priorities = array_unique(
|
||||||
array_column($filteredEnergyUsers, $priorityKey)
|
array_column($filteredVerbraucher, $priorityKey)
|
||||||
);
|
);
|
||||||
$groupedUsers = [];
|
$groupedUsers = [];
|
||||||
|
|
||||||
foreach ($priorities as $priority) {
|
foreach ($priorities as $priority) {
|
||||||
$groupedUsers[$priority] = array_filter(
|
$groupedUsers[$priority] = array_filter(
|
||||||
$filteredEnergyUsers,
|
$filteredVerbraucher,
|
||||||
function ($user) use ($priority, $priorityKey) {
|
function ($user) use ($priority, $priorityKey) {
|
||||||
return $user[$priorityKey] == $priority;
|
return $user[$priorityKey] == $priority;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Jetzt kannst du die Benutzer gruppenweise verarbeiten
|
// Jetzt werden die energien pro gruppe verteilt (Immer alle pro prio in einer gruppe miteinander)
|
||||||
foreach ($groupedUsers as $priority => $users) {
|
foreach ($groupedUsers as $priority => $users) {
|
||||||
// EnergyUser mit gleicher Priorität sammeln
|
// Verbraucher mit gleicher Priorität sammeln
|
||||||
$samePriorityUsers = isset($groupedUsers[$priority])
|
$samePriorityUsers = isset($groupedUsers[$priority])
|
||||||
? $groupedUsers[$priority]
|
? $groupedUsers[$priority]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
// Wenn keine EnergyUser mit gleicher Priorität vorhanden sind, überspringen
|
// Wenn keine Verbraucher mit gleicher Priorität vorhanden sind, überspringen
|
||||||
if (empty($samePriorityUsers)) {
|
if (empty($samePriorityUsers)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -189,28 +183,23 @@ class Manager extends IPSModule
|
|||||||
$withoutZero[] = $entry;
|
$withoutZero[] = $entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Methode für alle im withoutZero-Array aufrufen
|
// Verbraucher die nicht 0 annhemen können erhalten nun den minimalwert
|
||||||
if (!empty($withoutZero)) {
|
if (!empty($withoutZero)) {
|
||||||
foreach ($withoutZero as $entry) {
|
foreach ($withoutZero as $entry) {
|
||||||
$instanceID = $entry["InstanceID"];
|
$instanceID = $entry["InstanceID"];
|
||||||
$minPowerStep = min($entry["PowerSteps"]);
|
$minPowerStep = min($entry["PowerSteps"]);
|
||||||
|
|
||||||
// Simulierte Methode (Debug-Ausgabe)
|
IPS_RequestAction($instanceID,"SetAktuelle_Leistung",$minPowerStep
|
||||||
IPS_RequestAction(
|
|
||||||
$instanceID,
|
|
||||||
"SetCurrentPower",
|
|
||||||
$minPowerStep
|
|
||||||
);
|
);
|
||||||
$remainingPower -= $entry["CurrentPower"];
|
$remainingPower -= $entry["Aktuelle_Leistung"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nun die verteilen, die 0 erhalten können.
|
||||||
$samePriorityUsers = $withZero;
|
$samePriorityUsers = $withZero;
|
||||||
// Array für die verteilte Energie pro User erstellen
|
// Array für die verteilte Energie pro User erstellen
|
||||||
$userEnergyProv = [];
|
$userEnergyProv = [];
|
||||||
$userEnergyProv = array_fill_keys(
|
$userEnergyProv = array_fill_keys(array_column($samePriorityUsers, "InstanceID"), 0); // Initialisierung für jeden Benutzer auf 0 setzen
|
||||||
array_column($samePriorityUsers, "InstanceID"),
|
|
||||||
0
|
|
||||||
); // Initialisierung für jeden Benutzer auf 0 setzen
|
|
||||||
|
|
||||||
// Alle Schritte der Benutzer in einem Array sammeln
|
// Alle Schritte der Benutzer in einem Array sammeln
|
||||||
$allSteps = [];
|
$allSteps = [];
|
||||||
@@ -238,17 +227,16 @@ class Manager extends IPSModule
|
|||||||
// Aktualisiere die verbleibende Energie und die bereitgestellte Energie für den Benutzer
|
// Aktualisiere die verbleibende Energie und die bereitgestellte Energie für den Benutzer
|
||||||
$remainingPower -= $powerstep - $userEnergyProv[$user];
|
$remainingPower -= $powerstep - $userEnergyProv[$user];
|
||||||
$userEnergyProv[$user] = $powerstep;
|
$userEnergyProv[$user] = $powerstep;
|
||||||
} //else {
|
}
|
||||||
// Wenn nicht genug Energie vorhanden ist, setze die verbleibende Energie
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Energie für jeden EnergyUser verbrauchen und loggen
|
// Prüfen, dass jeder User mindestens seinen minimalwert an Leistung bekommt
|
||||||
foreach ($userEnergyProv as $userInstanceID => $energy) {
|
foreach ($userEnergyProv as $userInstanceID => $leistung) {
|
||||||
$weui = min(
|
$minimalleitsung = min(
|
||||||
array_column(
|
array_column(
|
||||||
array_filter($allSteps, function ($entry) use (
|
array_filter($allSteps, function ($entry) use (
|
||||||
$userInstanceID
|
$userInstanceID
|
||||||
) {
|
) {
|
||||||
return $entry["user"] == $userInstanceID;
|
return $entry["user"] == $userInstanceID;
|
||||||
}),
|
}),
|
||||||
@@ -256,15 +244,14 @@ class Manager extends IPSModule
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$energy = max($energy, $weui); // Testzeile
|
// Jedem user den höheren der beiden werte aus minimalwert oder vergebenem zuteilen
|
||||||
|
$leistung = max($leistung, $minimalleitsung);
|
||||||
|
|
||||||
// Methode SetCurrentPower für jeden EnergyUser aufrufen
|
// Methode SetAktuelle_Leistung für jeden Verbraucher mit der entsprechenden Energie aufrufen
|
||||||
if (IPS_InstanceExists($userInstanceID)) {
|
if (IPS_InstanceExists($userInstanceID)) {
|
||||||
IPS_RequestAction(
|
IPS_RequestAction($userInstanceID,"SetAktuelle_Leistung",$leistung);
|
||||||
$userInstanceID,
|
IPS_LogMessage("Manager", "aufgerufen setleistung normal");
|
||||||
"SetCurrentPower",
|
|
||||||
$energy
|
|
||||||
); // Annahme: SetCurrentPower wird über eine Aktionsanfrage ausgeführt
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,42 +7,35 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
|
|
||||||
// Prioritäten
|
// Verbraucherspezifische Properties
|
||||||
$this->RegisterVariableInteger("LockPrio", "LockPrio");
|
|
||||||
$this->RegisterVariableInteger("UserPrio", "UserPrio");
|
|
||||||
|
|
||||||
// Energiehandling
|
|
||||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
|
||||||
$this->RegisterVariableBoolean("IstNacht", "IstNacht", "", 0);
|
|
||||||
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
|
|
||||||
$this->RegisterVariableInteger("DailyOnTime", "DailyOnTime", "", 0);
|
|
||||||
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
|
|
||||||
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
|
|
||||||
|
|
||||||
// Neue Variable für den Timer-Status
|
|
||||||
$this->RegisterVariableBoolean("IsTimerActive", "IsTimerActive", "", 0);
|
|
||||||
$this->SetValue("IsTimerActive", false);
|
|
||||||
|
|
||||||
// Trägheit
|
|
||||||
$this->RegisterPropertyInteger("IdleCounterMax", 4);
|
|
||||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
|
||||||
$this->SetValue("IdleCounter", 0);
|
|
||||||
|
|
||||||
$this->RegisterPropertyInteger("BoilerLeistung", 6000); // Standardwert für Volllast
|
$this->RegisterPropertyInteger("BoilerLeistung", 6000); // Standardwert für Volllast
|
||||||
$this->RegisterPropertyInteger("Mindesttlaufzeit", 4); // Standardwert für Volllast
|
$this->RegisterPropertyInteger("Mindesttlaufzeit", 4); // Standardwert für Volllast
|
||||||
$this->RegisterPropertyInteger("Zeit_Zwischen_Zustandswechseln", 1);
|
$this->RegisterPropertyInteger("Zeit_Zwischen_Zustandswechseln", 1);
|
||||||
$this->RegisterPropertyInteger("Schaltkontakt1", 0);
|
$this->RegisterPropertyInteger("Schaltkontakt1", 0);
|
||||||
|
|
||||||
// Timer für Zeit_Zwischen_Zustandswechseln
|
// Verbraucherspezifische Variabeln
|
||||||
$this->RegisterTimer(
|
$this->RegisterVariableBoolean("IstNacht", "IstNacht", "", 0);
|
||||||
"ZustandswechselTimer",
|
$this->RegisterVariableInteger("DailyOnTime", "DailyOnTime", "", 0);
|
||||||
0,
|
$this->RegisterVariableBoolean("IsTimerActive", "IsTimerActive", "", 0);
|
||||||
"IPS_RequestAction(" .
|
|
||||||
$this->InstanceID .
|
|
||||||
', "ResetPowerSteps", "");'
|
|
||||||
);
|
|
||||||
|
|
||||||
//Initialisieren
|
// Verbraucherspezifischer Timer
|
||||||
|
$this->SetValue("IsTimerActive", false);
|
||||||
|
$this->RegisterTimer("ZustandswechselTimer",0,"IPS_RequestAction(" .$this->InstanceID .', "ResetPowerSteps", "");');
|
||||||
|
|
||||||
|
// 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);
|
$this->SetValue("Idle", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,8 +48,8 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
{
|
{
|
||||||
switch ($Ident) {
|
switch ($Ident) {
|
||||||
case "SetCurrentPower":
|
case "SetAktuelle_Leistung":
|
||||||
$this->SetCurrentPower($Value);
|
$this->SetAktuelle_Leistung($Value);
|
||||||
break;
|
break;
|
||||||
case "GetCurrentData":
|
case "GetCurrentData":
|
||||||
return $this->GetCurrentData($Value);
|
return $this->GetCurrentData($Value);
|
||||||
@@ -92,7 +85,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
// PowerSteps wieder auf den ursprünglichen Zustand setzen (wie vorherige Funktionalität)
|
// PowerSteps wieder auf den ursprünglichen Zustand setzen (wie vorherige Funktionalität)
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"PowerSteps",
|
"PowerSteps",
|
||||||
json_encode([$this->GetValue("CurrentPower")])
|
json_encode([$this->GetValue("Aktuelle_Leistung")])
|
||||||
);
|
);
|
||||||
|
|
||||||
// Timer stoppen
|
// Timer stoppen
|
||||||
@@ -102,13 +95,13 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
$this->SetValue("IsTimerActive", false);
|
$this->SetValue("IsTimerActive", false);
|
||||||
}
|
}
|
||||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||||
public function SetCurrentPower(float $power)
|
public function SetAktuelle_Leistung(float $power)
|
||||||
{
|
{
|
||||||
$this->CheckIdle($power);
|
$this->CheckIdle($power);
|
||||||
if ($this->GetValue("CurrentPower") != $power) {
|
if ($this->GetValue("Aktuelle_Leistung") != $power) {
|
||||||
$this->SetTimerOn();
|
$this->SetTimerOn();
|
||||||
}
|
}
|
||||||
$this->SetValue("CurrentPower", $power);
|
$this->SetValue("Aktuelle_Leistung", $power);
|
||||||
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
|
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
|
||||||
$schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1");
|
$schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1");
|
||||||
|
|
||||||
@@ -155,7 +148,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
// Timer ist aktiv, PowerSteps setzen
|
// Timer ist aktiv, PowerSteps setzen
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"PowerSteps",
|
"PowerSteps",
|
||||||
json_encode([$this->GetValue("CurrentPower")])
|
json_encode([$this->GetValue("Aktuelle_Leistung")])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Wenn Nacht und Mindestlaufzeit nicht erreicht ist
|
// Wenn Nacht und Mindestlaufzeit nicht erreicht ist
|
||||||
@@ -185,7 +178,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
|||||||
|
|
||||||
public function CheckIdle($power)
|
public function CheckIdle($power)
|
||||||
{
|
{
|
||||||
$lastpower = GetValue($this->GetIDForIdent("CurrentPower"));
|
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
if ($lastpower != $power) {
|
if ($lastpower != $power) {
|
||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
$this->SetValue("IdleCounter",$this->ReadPropertyInteger("IdleCounterMax"));
|
$this->SetValue("IdleCounter",$this->ReadPropertyInteger("IdleCounterMax"));
|
||||||
|
|||||||
@@ -5,30 +5,7 @@ class WP_Steuerung extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
|
|
||||||
// Prioritäten
|
// WP-Spezifische Properies
|
||||||
$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);
|
|
||||||
|
|
||||||
$this->RegisterPropertyInteger("WP_Leistung", 6000);
|
$this->RegisterPropertyInteger("WP_Leistung", 6000);
|
||||||
$this->RegisterPropertyInteger("Wolkenschwellwert", 60);
|
$this->RegisterPropertyInteger("Wolkenschwellwert", 60);
|
||||||
$this->RegisterPropertyInteger("Wolkenwert", 0);
|
$this->RegisterPropertyInteger("Wolkenwert", 0);
|
||||||
@@ -40,7 +17,30 @@ class WP_Steuerung extends IPSModule
|
|||||||
$this->RegisterPropertyInteger("Schwellwert", 0);
|
$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);
|
$this->SetValue("Idle", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ class WP_Steuerung extends IPSModule
|
|||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
{
|
{
|
||||||
switch ($Ident) {
|
switch ($Ident) {
|
||||||
case "SetCurrentPower":
|
case "SetAktuelle_Leistung":
|
||||||
$this->SetCurrentPower($Value);
|
$this->SetAktuelle_Leistung($Value);
|
||||||
break;
|
break;
|
||||||
case "GetCurrentData":
|
case "GetCurrentData":
|
||||||
return $this->GetCurrentData($Value);
|
return $this->GetCurrentData($Value);
|
||||||
@@ -68,7 +68,7 @@ class WP_Steuerung extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||||
public function SetCurrentPower(float $power)
|
public function SetAktuelle_Leistung(float $power)
|
||||||
{
|
{
|
||||||
$sperrzei_abs =
|
$sperrzei_abs =
|
||||||
((60 *
|
((60 *
|
||||||
@@ -122,7 +122,7 @@ class WP_Steuerung extends IPSModule
|
|||||||
$this->SetValue("WP_Laufzeit_Zahler", 0);
|
$this->SetValue("WP_Laufzeit_Zahler", 0);
|
||||||
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
} elseif (
|
} elseif (
|
||||||
$this->GetValue("CurrentPower") != $power ||
|
$this->GetValue("Aktuelle_Leistung") != $power ||
|
||||||
($this->GetValue("WP_Laufzeit_Zahler") > 240 &&
|
($this->GetValue("WP_Laufzeit_Zahler") > 240 &&
|
||||||
$this->GetValue("LetzterPeakwert") !=
|
$this->GetValue("LetzterPeakwert") !=
|
||||||
$this->GetValue("LetzterPeakwert_Aenderung"))
|
$this->GetValue("LetzterPeakwert_Aenderung"))
|
||||||
@@ -145,24 +145,24 @@ class WP_Steuerung extends IPSModule
|
|||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak && $power == 0) {
|
} elseif ($LastPeak && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 2);
|
$this->SetValue("Zustand_WP", 2);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
} elseif (
|
} elseif (
|
||||||
$LastPeak == false &&
|
$LastPeak == false &&
|
||||||
$power == $this->ReadPropertyInteger("WP_Leistung")
|
$power == $this->ReadPropertyInteger("WP_Leistung")
|
||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 3);
|
$this->SetValue("Zustand_WP", 3);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak == false && $power == 0) {
|
} elseif ($LastPeak == false && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
}
|
}
|
||||||
} elseif ($state == 2) {
|
} elseif ($state == 2) {
|
||||||
// Sperre
|
// Sperre
|
||||||
@@ -172,24 +172,24 @@ class WP_Steuerung extends IPSModule
|
|||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak && $power == 0) {
|
} elseif ($LastPeak && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 2);
|
$this->SetValue("Zustand_WP", 2);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
} elseif (
|
} elseif (
|
||||||
$LastPeak == false &&
|
$LastPeak == false &&
|
||||||
$power == $this->ReadPropertyInteger("WP_Leistung")
|
$power == $this->ReadPropertyInteger("WP_Leistung")
|
||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 3);
|
$this->SetValue("Zustand_WP", 3);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak == false && $power == 0) {
|
} elseif ($LastPeak == false && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
}
|
}
|
||||||
} elseif ($state == 3) {
|
} elseif ($state == 3) {
|
||||||
// Erhöht
|
// Erhöht
|
||||||
@@ -199,24 +199,24 @@ class WP_Steuerung extends IPSModule
|
|||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak && $power == 0) {
|
} elseif ($LastPeak && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 2);
|
$this->SetValue("Zustand_WP", 2);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
} elseif (
|
} elseif (
|
||||||
$LastPeak == false &&
|
$LastPeak == false &&
|
||||||
$power == $this->ReadPropertyInteger("WP_Leistung")
|
$power == $this->ReadPropertyInteger("WP_Leistung")
|
||||||
) {
|
) {
|
||||||
$this->SetValue("Zustand_WP", 3);
|
$this->SetValue("Zustand_WP", 3);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
"CurrentPower",
|
"Aktuelle_Leistung",
|
||||||
$this->ReadPropertyInteger("WP_Leistung")
|
$this->ReadPropertyInteger("WP_Leistung")
|
||||||
);
|
);
|
||||||
} elseif ($LastPeak == false && $power == 0) {
|
} elseif ($LastPeak == false && $power == 0) {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
$this->SetValue("CurrentPower", 0);
|
$this->SetValue("Aktuelle_Leistung", 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->SetValue("Zustand_WP", 1);
|
$this->SetValue("Zustand_WP", 1);
|
||||||
@@ -255,7 +255,7 @@ class WP_Steuerung extends IPSModule
|
|||||||
|
|
||||||
if($this->GetValue("WP_Laufzeit_Zahler")<(20*12)){
|
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"))) ){
|
}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)
|
public function CheckIdle($power)
|
||||||
{
|
{
|
||||||
$lastpower = GetValue($this->GetIDForIdent("CurrentPower"));
|
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
if ($lastpower != $power) {
|
if ($lastpower != $power) {
|
||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
$this->SetValue(
|
$this->SetValue(
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
"id": "{89CAF37C-8E6E-5312-8195-6DA8AB7E5E70}",
|
"id": "{89CAF37C-8E6E-5312-8195-6DA8AB7E5E70}",
|
||||||
"name": "Manager",
|
"name": "Manager",
|
||||||
"author": "Daniel Haefliger",
|
"author": "Daniel Haefliger",
|
||||||
"url": "https://git.belevo.ch/dh/Energiemanager_Symconmodule_Demo",
|
"url": "https://git.belevo.ch/dh/Symcon_Belevo_Energiemanagement",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "7.1"
|
"version": "7.1"
|
||||||
},
|
},
|
||||||
"version": "0.156",
|
"version": "0.172",
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user