Verbrauchermodule und betriebsartabhängige Angebote ergänzen
Tests / test (push) Successful in 42s

This commit is contained in:
dh
2026-09-21 18:46:17 +00:00
parent 7b6d1b2f07
commit 3c71626b5f
46 changed files with 4513 additions and 311 deletions
+40 -25
View File
@@ -79,6 +79,7 @@ class VerbraucherWarmwassererwaermer extends IPSModule implements VerbraucherSch
$this->RegisterAttributeFloat('Glaettungswert', 0.0);
$this->RegisterAttributeBoolean('GlaettungInitialisiert', false);
$this->RegisterAttributeString('Leistungsangebot', '[]');
$this->RegisterAttributeString('Betriebsart', Nachrichtenvertrag::BETRIEBSART_PV);
$this->RegisterAttributeString('Schaltfehler', '');
$this->RegisterAttributeFloat('ZustandIstleistung', 0.0);
$this->RegisterAttributeInteger('ZustandSollleistung', 0);
@@ -208,9 +209,20 @@ class VerbraucherWarmwassererwaermer extends IPSModule implements VerbraucherSch
throw new InvalidArgumentException('Der Manager hat diesen Verbraucher nicht aktiv zugeordnet.');
}
$this->WriteAttributeString('Betriebsart', $daten['Betriebsart']);
$this->regelzyklus(false);
$angebot = $this->leseLeistungsangebot();
$sollleistung = $daten['Sollleistung_W'];
if ($sollleistung === null) {
if ((bool) $this->leseZustand('SollwertGueltig')
&& !in_array((int) $this->leseZustand('Sollleistung'), $angebot, true)
) {
$this->setzeZustand('SollwertGueltig', false);
$this->regelzyklus(false);
}
$this->SetTimerInterval('RueckmeldungVerzoegert', 100);
return;
}
if (!in_array($sollleistung, $angebot, true)) {
throw new InvalidArgumentException('Sollleistung_W liegt nicht im aktuell gemeldeten Leistungsangebot.');
}
@@ -363,45 +375,47 @@ class VerbraucherWarmwassererwaermer extends IPSModule implements VerbraucherSch
(float) $this->ReadAttributeFloat('ZustandLegionellentemperatur')
);
$hysterese = $this->ReadPropertyFloat('Hysterese');
$maximaltemperaturErreicht = $this->ReadAttributeBoolean('MaximaltemperaturErreicht');
if ($temperatur >= $maximum) {
$maximaltemperaturErreicht = true;
} elseif ($temperatur <= $maximum - $hysterese) {
$maximaltemperaturErreicht = false;
}
$this->WriteAttributeBoolean('MaximaltemperaturErreicht', $maximaltemperaturErreicht);
$nachladen = (bool) $this->leseZustand('NachladenAktiv');
if ($temperatur < $minimum) {
$nachladen = true;
} elseif ($temperatur >= $minimum + $hysterese) {
$nachladen = false;
}
$this->setzeZustand('NachladenAktiv', $nachladen);
$zeitplanErfordertHeizen = false;
$naechster = WarmwasserRegler::naechsterZeitplaneintrag(
$this->ReadPropertyString('Zeitplan'),
new DateTimeImmutable('now')
);
if ($naechster !== null && $temperatur < $naechster['Solltemperatur']) {
$zeitplanErfordertHeizen = !WarmwasserRegler::kannZielErreichen(
if ($naechster !== null
&& $temperatur < $naechster['Solltemperatur']
&& !WarmwasserRegler::kannZielErreichen(
(float) $this->ReadPropertyInteger('Boilervolumen'),
$temperatur,
$naechster['Solltemperatur'],
max(0, $naechster['Zeitpunkt'] - $jetzt),
$maximalleistung
);
)
) {
$minimum = $naechster['Solltemperatur'];
}
if ($nachladen || $zeitplanErfordertHeizen) {
return [[$maximalleistung], false, true, $maximalleistung];
$stufeAktiv = (float) $this->leseZustand('Istleistung') > 0.0;
$nachladen = $temperatur < $minimum
|| ($temperatur < $minimum + $hysterese && $stufeAktiv);
$this->setzeZustand('NachladenAktiv', $nachladen);
$peakbetrieb = $this->ReadAttributeString('Betriebsart')
=== Nachrichtenvertrag::BETRIEBSART_PEAK;
$angebot = WarmwasserRegler::leistungsangebot(
$peakbetrieb,
$temperatur,
$minimum,
$maximum,
$hysterese,
$stufeAktiv,
$alleLeistungen
);
if ($angebot === [0]) {
return [$angebot, false, true, 0];
}
if ($maximaltemperaturErreicht) {
return [[0], false, true, 0];
if ($angebot === [$maximalleistung]) {
return [$angebot, false, true, $maximalleistung];
}
return [$alleLeistungen, true, true, null];
return [$angebot, true, true, null];
}
private function aktualisiereLegionellenstatus(bool $temperaturGueltig, int $jetzt): void
@@ -587,6 +601,7 @@ class VerbraucherWarmwassererwaermer extends IPSModule implements VerbraucherSch
'EmpfaengerID' => $managerID,
'Zeitpunkt' => time(),
],
'Betriebsart' => $this->ReadAttributeString('Betriebsart'),
'PrioritaetPV' => $this->ReadPropertyInteger('PrioritaetPV'),
'PrioritaetPeak' => $this->ReadPropertyInteger('PrioritaetPeak'),
'Leistungswerte_W' => $this->leseLeistungsangebot(),