leistungsintegral verändert damit das takten nincht so schnell läfunt

This commit is contained in:
2025-03-17 15:28:43 +01:00
parent 04a96ea3b1
commit 3f7de21ea6
6 changed files with 80 additions and 7 deletions

View File

@@ -59,6 +59,21 @@ 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)
{
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
@@ -175,7 +190,7 @@ public function RequestAction($Ident, $Value)
// Setze die neue aktuelle Leistung
$this->SetValue("Aktuelle_Leistung", $power);
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
// IdleCounter verarbeiten
$this->ProcessIdleCounter();

View File

@@ -35,6 +35,7 @@ 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);
@@ -83,6 +84,22 @@ 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);
if (empty($arr)) {
@@ -161,7 +178,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
// Setze die neue Aktuelle_Leistung
$this->SetValue("Aktuelle_Leistung", $power);
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
// IdleCounter verarbeiten
$this->ProcessIdleCounter();
}

View File

@@ -84,6 +84,20 @@ 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)
{
@@ -91,7 +105,7 @@ class Ladestation_Universal extends IPSModule
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
// Aktuelle Leistungsvorgabe setzen
SetValue($this->GetIDForIdent("Aktuelle_Leistung"), $power);
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
if ($power != $internalPower) {
// Setze die interne Leistungsvorgabe

View File

@@ -78,6 +78,20 @@ 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
}
// Methode zum Setzen der PowerSteps und Timer starten
@@ -120,7 +134,7 @@ class Verbraucher_1_Stufig extends IPSModule
$this->SetTimerOn();
}
$this->SetValue("Aktuelle_Leistung", $power);
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
$schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1");

View File

@@ -84,6 +84,20 @@ 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
public function SetAktuelle_Leistung(float $power)
@@ -263,8 +277,7 @@ class WP_Steuerung extends IPSModule
$this->SetValue("WP_Laufzeit_Zahler", $newCount + 1);
}
$this->SetValue("Bezogene_Energie", $this->GetValue("Bezogene_Energie")+($this->GetValue("Aktuelle_Leistung")*($this->ReadPropertyInteger("Interval")/3600)));
$this->IntegratePower();
}
// Methode zum Abrufen der aktuellen Daten

View File

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