feat(control): connect physical feedback to bounded V4 command and fallback paths

This commit is contained in:
ENELIX Agent
2026-10-03 11:40:54 +00:00
parent 8eb9688942
commit 9878197aea
24 changed files with 891 additions and 7 deletions
+18 -2
View File
@@ -9,6 +9,7 @@ require_once __DIR__ . '/../libs/BatterieRegler.php';
require_once __DIR__ . '/../libs/BatterieNetzfahrplanV4TestTrait.php';
use Belevo\EnelixEMS\BatterieRegler;
use Belevo\EnelixEMS\NetzfahrplanV4Rueckmeldung;
use Belevo\EnelixEMS\Nachrichtenvertrag;
use Belevo\EnelixEMS\VerbraucherBasisTrait;
use Belevo\EnelixEMS\VerbraucherSchnittstelle;
@@ -197,6 +198,10 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
!$this->ReadPropertyBoolean('NachladenMitMaximalleistung')
);
$formular['elements'][]=['type'=>'ExpansionPanel','caption'=>'V4 physische Rueckmeldung (keine Freigabe)', 'items'=>[
['type'=>'Label','caption'=>'Quellenzuordnung fuer Vorschau und separaten Regeltest. Eine Modellaufteilung ist keine separate EV-/SDL-Messung.'],
['type'=>'ValidationTextBox','name'=>'NetzfahrplanV4RueckmeldungKonfiguration','caption'=>'Versionierte Quellenzuordnung (JSON)']
]];
return json_encode($formular, JSON_THROW_ON_ERROR);
}
@@ -392,6 +397,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
$this->aktualisiereEnergie($jetzt);
$messwerte = $this->leseMesswerte();
$messwerteGueltig = $messwerte['Gueltig'];
$this->SetBuffer('V4FeedbackEstimated', ($messwerte['V4FeedbackEstimated'] ?? false) ? '1' : '0');
$this->setzeZustand('Ladezustand', $messwerte['Ladezustand']);
$this->setzeZustand('LadezustandGueltig', $messwerteGueltig);
@@ -402,7 +408,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
$this->setzeSichtbareVariable(
'Leistungsquelle',
$messwerteGueltig
? Nachrichtenvertrag::LEISTUNGSQUELLE_GEMESSEN
? (($messwerte['V4FeedbackEstimated'] ?? false) ? Nachrichtenvertrag::LEISTUNGSQUELLE_BERECHNET : Nachrichtenvertrag::LEISTUNGSQUELLE_GEMESSEN)
: Nachrichtenvertrag::LEISTUNGSQUELLE_NICHT_VORHANDEN
);
$this->aktualisiereLadestatus(
@@ -527,6 +533,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
$gueltig = true;
foreach ($zuordnung as $property => $schluessel) {
if ($this->v4BatterieTestAktiv() && in_array($schluessel,['Netzleistung','Istleistung'],true)) continue;
$variablenID = $this->ReadPropertyInteger($property);
if (!$this->istMesswertAktuell($variablenID)) {
$gueltig = false;
@@ -535,6 +542,15 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
$werte[$schluessel] = (float) GetValue($variablenID);
}
if ($this->v4BatterieTestAktiv()) {
try {
$f=$this->v4BatterieRueckmeldung();
NetzfahrplanV4Rueckmeldung::requireTrial($f,$this->v4BatterieTestSitzung(),time());
$werte['Istleistung']=$f['batteryW'];$werte['Netzleistung']=$f['gridW'];
$werte['V4FeedbackEstimated']=$f['estimated'];
} catch (Throwable $e) { $gueltig=false; }
}
if ($werte['MaxLaden'] <= 0.0
|| $werte['MaxEntladen'] <= 0.0
|| $werte['Ladezustand'] < 0.0
@@ -714,7 +730,7 @@ class Batterie extends IPSModule implements VerbraucherSchnittstelle
? (float) $this->leseZustand('Istleistung')
: null,
'Leistungsquelle' => $messwerteGueltig
? Nachrichtenvertrag::LEISTUNGSQUELLE_GEMESSEN
? ($this->GetBuffer('V4FeedbackEstimated') === '1' ? Nachrichtenvertrag::LEISTUNGSQUELLE_BERECHNET : Nachrichtenvertrag::LEISTUNGSQUELLE_GEMESSEN)
: Nachrichtenvertrag::LEISTUNGSQUELLE_NICHT_VORHANDEN,
'Zustand' => [
[