feat: Anlagentopologie im Manager abbilden

This commit is contained in:
dh
2026-09-22 17:11:12 +00:00
parent a67018e68f
commit dbd728dd03
9 changed files with 1042 additions and 0 deletions
+50
View File
@@ -72,6 +72,35 @@ return static function (TestContext $test): void {
['InstanzID' => $warmwasserId, 'Aktiv' => true],
['InstanzID' => $pufferspeicherId, 'Aktiv' => true],
];
$wechselrichterKonfiguration = [[
'ID' => 'hybrid-1',
'Name' => 'Hybridwechselrichter',
'Typ' => 'hybrid',
'ACNennleistung_kW' => 10.0,
'ACEinspeisegrenze_kW' => 8.0,
'ACBezugsgrenze_kW' => 0.0,
]];
$pvKonfiguration = [[
'ID' => 'pv-1',
'Name' => 'Suedflaeche',
'DCLeistung_kWp' => 12.0,
'Neigung_Grad' => 30.0,
'Azimut_Grad' => 0.0,
'WechselrichterID' => 'hybrid-1',
'MPPT' => 'A',
'Modulanzahl' => 30,
'Modulleistung_Wp' => 400.0,
]];
$batterieKonfiguration = [[
'ID' => 'bat-1',
'Name' => 'Hausspeicher',
'Nennkapazitaet_kWh' => 13.5,
'Nutzkapazitaet_kWh' => 12.8,
'MaxLadeleistung_kW' => 5.0,
'MaxEntladeleistung_kW' => 5.0,
'WechselrichterID' => 'hybrid-1',
'Kopplung' => 'hybrid',
]];
$lizenzcode = trim((string) getenv('ENELIX_TEST_LICENSE_CODE'));
$managerId = $test->createInstance(
'{6F771B18-59D4-4C8A-B951-3B2FE9F6A2C4}',
@@ -87,6 +116,12 @@ return static function (TestContext $test): void {
'Lastspitzengrenze' => 0.0,
'SollwertSolarladen' => 0.0,
'Umschaltdifferenz' => 0.0,
'AnlagenWechselrichter' => json_encode(
$wechselrichterKonfiguration,
JSON_THROW_ON_ERROR
),
'AnlagenPVFlaechen' => json_encode($pvKonfiguration, JSON_THROW_ON_ERROR),
'AnlagenBatterien' => json_encode($batterieKonfiguration, JSON_THROW_ON_ERROR),
'DiagnosevariablenAnzeigen' => true,
]
);
@@ -163,6 +198,21 @@ return static function (TestContext $test): void {
$vorher = $lizenzInstallationID();
IPS_ApplyChanges($managerId);
$test->assertSame($vorher, $lizenzInstallationID());
$topologie = json_decode(
ENELIX_AnlagentopologieExportieren($managerId),
true,
512,
JSON_THROW_ON_ERROR
);
$test->assertSame($vorher, $topologie['installationId'] ?? null);
$test->assertSame('1.0', $topologie['version'] ?? null);
$test->assertSame(12.0, $topologie['summary']['pvDcKwp'] ?? null);
$test->assertSame(10.0, $topologie['summary']['pvAcKw'] ?? null);
$test->assertSame(12.8, $topologie['summary']['usableBatteryKwh'] ?? null);
$test->assertSame('hybrid-1', $topologie['sharedAcLimits'][0]['inverterId'] ?? null);
$test->assertSame(['pv-1'], $topologie['sharedAcLimits'][0]['pvArrayIds'] ?? null);
$test->assertSame(['bat-1'], $topologie['sharedAcLimits'][0]['batteryIds'] ?? null);
});
$zustandswert = static function (array $daten, int $instanzId, string $kennung) {
foreach ($daten['Verbraucher'] ?? [] as $verbraucher) {