diff --git a/Batterie/module.php b/Batterie/module.php index 394c696..e92148c 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -37,7 +37,6 @@ class Batterie extends IPSModule $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie_Zwischenwert", "Bezogene_Energie_Zwischenwert", "", 0); // Hilfsvariabeln für Idle zustand $this->RegisterPropertyInteger("IdleCounterMax", 2); @@ -61,20 +60,6 @@ class Batterie extends IPSModule $this->SetTimerInterval("Timer_Do_UserCalc_Battery",$this->ReadPropertyInteger("Interval")*1000); } - public function IntegratePower() { - - if (rand(1, 1000) === 1) { // 0.1% Chance - - $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); - $this->SetValue("Bezogene_Energie_Zwischenwert", 0); - - }else{ - $this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))); - } - - return; // Falls nichts gespeichert wird - } - private function GeneratePowerSteps($additionalValue) { @@ -192,7 +177,7 @@ public function RequestAction($Ident, $Value) // Setze die neue aktuelle Leistung $this->SetValue("Aktuelle_Leistung", $power); - $this->IntegratePower(); + $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); // IdleCounter verarbeiten $this->ProcessIdleCounter(); diff --git a/Boiler_2_Stufig_Mit_Fueler/module.php b/Boiler_2_Stufig_Mit_Fueler/module.php index f6c3ca6..b26a258 100644 --- a/Boiler_2_Stufig_Mit_Fueler/module.php +++ b/Boiler_2_Stufig_Mit_Fueler/module.php @@ -35,7 +35,6 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule $this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie_Zwischenwert", "Bezogene_Energie_Zwischenwert", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableInteger("Power", "Power", '', 0); $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving", "", true); @@ -85,20 +84,6 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule } - public function IntegratePower() { - - if (rand(1, 1000) === 1) { // 0.1% Chance - - $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); - $this->SetValue("Bezogene_Energie_Zwischenwert", 0); - - }else{ - $this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))); - } - - return; // Falls nichts gespeichert wird - } - public function getNextTimeAndTemperature($zeitplan) { $arr = json_decode($zeitplan, true); @@ -178,7 +163,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule // Setze die neue Aktuelle_Leistung $this->SetValue("Aktuelle_Leistung", $power); - $this->IntegratePower(); + $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); // IdleCounter verarbeiten $this->ProcessIdleCounter(); } diff --git a/HauptManager/module.php b/HauptManager/module.php index dbacf28..98e626c 100644 --- a/HauptManager/module.php +++ b/HauptManager/module.php @@ -164,7 +164,7 @@ class HauptManager extends IPSModule $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]) { - return $a["Bezogene_Energie"] <=> $b["Bezogene_Energie"]; + return round($a["Bezogene_Energie"]/2000) <=> round($b["Bezogene_Energie"]/2000); } return $a[$primaryKey] <=> $b[$primaryKey]; }); diff --git a/Ladestation_Universal/module.php b/Ladestation_Universal/module.php index 457c144..5d5bcfb 100644 --- a/Ladestation_Universal/module.php +++ b/Ladestation_Universal/module.php @@ -36,8 +36,6 @@ class Ladestation_Universal extends IPSModule $this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie_Zwischenwert", "Bezogene_Energie_Zwischenwert", "", 0); - $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableInteger("Power", "Power"); $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving"); @@ -86,19 +84,6 @@ class Ladestation_Universal extends IPSModule } - public function IntegratePower() { - - if (rand(1, 1000) === 1) { // 0.1% Chance - - $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); - $this->SetValue("Bezogene_Energie_Zwischenwert", 0); - - }else{ - $this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))); - } - - return; // Falls nichts gespeichert wird - } public function SetAktuelle_Leistung(int $power) @@ -107,7 +92,7 @@ class Ladestation_Universal extends IPSModule $internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung")); // Aktuelle Leistungsvorgabe setzen SetValue($this->GetIDForIdent("Aktuelle_Leistung"), $power); - $this->IntegratePower(); + $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); if ($power != $internalPower) { // Setze die interne Leistungsvorgabe diff --git a/Manager/module.php b/Manager/module.php index 7c3bae3..7bf3ff1 100644 --- a/Manager/module.php +++ b/Manager/module.php @@ -173,7 +173,7 @@ class Manager extends IPSModule $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]) { - return $a["Bezogene_Energie"] <=> $b["Bezogene_Energie"]; + return round($a["Bezogene_Energie"]/2000) <=> round($b["Bezogene_Energie"]/2000); } return $a[$primaryKey] <=> $b[$primaryKey]; }); diff --git a/Verbraucher_1_Stufig/module.php b/Verbraucher_1_Stufig/module.php index 278801c..4e1c221 100644 --- a/Verbraucher_1_Stufig/module.php +++ b/Verbraucher_1_Stufig/module.php @@ -29,7 +29,6 @@ class Verbraucher_1_Stufig extends IPSModule $this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie_Zwischenwert", "Bezogene_Energie_Zwischenwert", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableInteger("Power", "Power"); $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving"); @@ -79,19 +78,6 @@ class Verbraucher_1_Stufig extends IPSModule } } - public function IntegratePower() { - - if (rand(1, 1000) === 1) { // 0.1% Chance - - $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); - $this->SetValue("Bezogene_Energie_Zwischenwert", 0); - - }else{ - $this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))); - } - - return; // Falls nichts gespeichert wird - } @@ -135,7 +121,7 @@ class Verbraucher_1_Stufig extends IPSModule $this->SetTimerOn(); } $this->SetValue("Aktuelle_Leistung", $power); - $this->IntegratePower(); + $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); $boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung"); $schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1"); diff --git a/WP_Steuerung/module.php b/WP_Steuerung/module.php index 1331e33..c7af3e2 100644 --- a/WP_Steuerung/module.php +++ b/WP_Steuerung/module.php @@ -34,7 +34,6 @@ class WP_Steuerung extends IPSModule $this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableFloat("Bezogene_Energie_Zwischenwert", "Bezogene_Energie_Zwischenwert", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableInteger("Power", "Power"); $this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving"); @@ -85,19 +84,6 @@ class WP_Steuerung extends IPSModule } } - public function IntegratePower() { - - if (rand(1, 1000) === 1) { // 0.1% Chance - - $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); - $this->SetValue("Bezogene_Energie_Zwischenwert", 0); - - }else{ - $this->SetValue("Bezogene_Energie_Zwischenwert", $this->GetValue("Bezogene_Energie_Zwischenwert") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600))); - } - - return; // Falls nichts gespeichert wird - } // Methode zum Setzen des aktuellen Stromverbrauchs @@ -278,7 +264,7 @@ class WP_Steuerung extends IPSModule $this->SetValue("WP_Laufzeit_Zahler", $newCount + 1); } - $this->IntegratePower(); + $this->SetValue("Bezogene_Energie", ($this->GetValue("Bezogene_Energie") + ($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)))); } // Methode zum Abrufen der aktuellen Daten diff --git a/library.json b/library.json index 20d77d1..0c10c9b 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.194", + "version": "1.196", "build": 0, "date": 0 } \ No newline at end of file