feat(batterie): Nachladeleistung begrenzen
Tests / test (push) Successful in 48s

This commit is contained in:
dh
2026-10-01 15:56:23 +00:00
parent 6cd7bf19f5
commit 8d83b083bf
9 changed files with 173 additions and 14 deletions
+24
View File
@@ -83,6 +83,30 @@ final class BatterieModulstrukturTest extends TestCase
}
}
public function testNachladebegrenzungIstImFormularKonfigurierbar(): void
{
$modul = (string) file_get_contents(self::MODULPFAD . 'module.php');
$formular = (string) file_get_contents(self::MODULPFAD . 'form.json');
self::assertStringContainsString(
"RegisterPropertyBoolean('NachladenMitMaximalleistung', true)",
$modul
);
self::assertStringContainsString(
"RegisterPropertyInteger('MaximaleNachladeleistung', 0)",
$modul
);
self::assertStringContainsString(
"'FormNachladenMitMaximalleistung'",
$formular
);
self::assertStringContainsString(
'"name": "MaximaleNachladeleistung"',
$formular
);
self::assertStringContainsString('"suffix": " W"', $formular);
}
public function testLoggingDiagnoseUndAktionsbuttonsSindVorhanden(): void
{
$modul = (string) file_get_contents(self::MODULPFAD . 'module.php');
+32
View File
@@ -82,6 +82,38 @@ final class BatterieReglerTest extends TestCase
);
}
public function testNachladeleistungBegrenztNurSchutzbedingtesLaden(): void
{
self::assertSame(
[400],
BatterieRegler::leistungsangebot(
true, true, false, 19.0, 20.0, 10.0, true,
0.0, 0.0, 1000.0, 1000.0, 400.0
)
);
self::assertSame(
[['Von_W' => 0, 'Bis_W' => 400]],
BatterieRegler::leistungsangebot(
true, true, true, 10.0, 20.0, 10.0, true,
0.0, 0.0, 1000.0, 1000.0, 400.0
)
);
self::assertSame(
[['Von_W' => -1000, 'Bis_W' => 400]],
BatterieRegler::leistungsangebot(
true, true, true, 15.0, 20.0, 10.0, true,
0.0, 0.0, 1000.0, 1000.0, 400.0
)
);
self::assertSame(
[['Von_W' => -1000, 'Bis_W' => 1000]],
BatterieRegler::leistungsangebot(
true, true, false, 50.0, 20.0, 10.0, false,
0.0, 0.0, 1000.0, 1000.0, 400.0
)
);
}
public function testWechselrichtersteuerungBietetNurNull(): void
{
self::assertSame(
+26
View File
@@ -163,6 +163,32 @@ PHP
}
);
$test->runCase(
'Benutzerdefinierte Nachladeleistung begrenzt das Schutzangebot',
static function (TestContext $test) use (
$batterieID,
$ladezustandID,
$managerdatenSenden
): void {
$test->configureInstance($batterieID, [
'Batteriemanagement' => 2,
'NachladenMitMaximalleistung' => false,
'MaximaleNachladeleistung' => 400,
]);
IPS_RequestAction($batterieID, 'Aktiv', true);
SetValue($ladezustandID, 19.0);
$managerdatenSenden('PV', null);
$angebotID = $test->objectByIdent('LeistungsangebotDiagnose', $batterieID);
$test->waitUntil(
static fn (): bool => json_decode(
(string) GetValue($angebotID),
true
) === [400]
);
}
);
$test->runCase(
'Wechselrichtersteuerung setzt Leistung auf null und Automatikmodus',
static function (TestContext $test) use (