umbau der energiemenge, manager rundet jetzt auf 2kwh dadurch wird integratepower nicht mehr benötigt.

This commit is contained in:
2025-03-17 15:56:00 +01:00
parent 99b93484bf
commit e78a9f9a09
8 changed files with 8 additions and 81 deletions

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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];
});

View File

@@ -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

View File

@@ -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];
});

View File

@@ -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");

View File

@@ -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

View File

@@ -6,7 +6,7 @@
"compatibility": {
"version": "7.1"
},
"version": "1.194",
"version": "1.196",
"build": 0,
"date": 0
}