This commit is contained in:
@@ -6,8 +6,11 @@ use Belevo\EnelixEMS\SymconTest\TestContext;
|
||||
|
||||
return static function (TestContext $test): void {
|
||||
$testPasswort = hash('sha256', __FILE__);
|
||||
$goEAntwort = static function (int $status, float $leistung): string {
|
||||
$goEAntwort = static function (int $status, float $leistung, array $stroeme = []): string {
|
||||
$nrg = array_fill(0, 12, 0);
|
||||
foreach (array_values($stroeme) as $index => $strom) {
|
||||
$nrg[4 + $index] = $strom;
|
||||
}
|
||||
$nrg[11] = $leistung;
|
||||
return json_encode(['car' => $status, 'nrg' => $nrg], JSON_THROW_ON_ERROR);
|
||||
};
|
||||
@@ -16,14 +19,14 @@ return static function (TestContext $test): void {
|
||||
'go-e alt' => [
|
||||
'Geraetetyp' => 1,
|
||||
'Geraeteadresse' => '192.0.2.10',
|
||||
'Testantwort' => $goEAntwort(2, 1100),
|
||||
'Testantwort' => $goEAntwort(2, 1100, [160, 158, 159]),
|
||||
'Phasenzahl' => 3,
|
||||
'BefehlUrlTeil' => 'amp=16',
|
||||
],
|
||||
'go-e Gemini' => [
|
||||
'Geraetetyp' => 2,
|
||||
'Geraeteadresse' => '192.0.2.11',
|
||||
'Testantwort' => $goEAntwort(2, 2300),
|
||||
'Testantwort' => $goEAntwort(2, 2300, [10, 0, 0]),
|
||||
'Phasenzahl' => 1,
|
||||
'BefehlUrlTeil' => 'amp=16',
|
||||
],
|
||||
@@ -77,6 +80,23 @@ return static function (TestContext $test): void {
|
||||
]
|
||||
);
|
||||
|
||||
$stromerkennung = $test->createInstance(
|
||||
'{0D94913C-0F31-4C29-A685-6EB4AE58E55D}',
|
||||
'Ladestation Fahrzeugstromerkennung',
|
||||
[
|
||||
'Geraetetyp' => 2,
|
||||
'Geraeteadresse' => '192.0.2.13',
|
||||
'MaximalerLadestrom' => 20,
|
||||
'FahrzeugstromErkennungszeit' => 1,
|
||||
'Ladefreigabe' => true,
|
||||
'Solarladen' => true,
|
||||
'EinstellungenInVisu' => true,
|
||||
'DiagnosevariablenAnzeigen' => true,
|
||||
'Testmodus' => true,
|
||||
'Testantwort' => $goEAntwort(2, 10263, [15.9, 15.8, 15.7]),
|
||||
]
|
||||
);
|
||||
|
||||
$managerId = $test->createInstance(
|
||||
'{6F771B18-59D4-4C8A-B951-3B2FE9F6A2C4}',
|
||||
'Hilfsmanager Ladestation',
|
||||
@@ -84,7 +104,7 @@ return static function (TestContext $test): void {
|
||||
'AutomatischeSuche' => false,
|
||||
'VerbraucherZuordnung' => json_encode(array_map(
|
||||
static fn (int $id): array => ['InstanzID' => $id, 'Aktiv' => true],
|
||||
array_values($stationen)
|
||||
array_merge(array_values($stationen), [$stromerkennung])
|
||||
), JSON_THROW_ON_ERROR),
|
||||
]
|
||||
);
|
||||
@@ -161,7 +181,7 @@ return static function (TestContext $test): void {
|
||||
GetValue($test->objectByIdent('FahrzeugGeladen', $solarPause))
|
||||
);
|
||||
|
||||
IPS_SetProperty($solarPause, 'Testantwort', $goEAntwort(2, 2300));
|
||||
IPS_SetProperty($solarPause, 'Testantwort', $goEAntwort(2, 2300, [100, 100, 100]));
|
||||
IPS_ApplyChanges($solarPause);
|
||||
|
||||
$test->assertSame(
|
||||
@@ -229,6 +249,30 @@ return static function (TestContext $test): void {
|
||||
), 'Peak mit Solarladen muss die Ladestation stoppen.');
|
||||
});
|
||||
|
||||
$test->runCase('Fahrzeugstrom wird nach stabiler Unterschreitung begrenzt', static function (
|
||||
TestContext $test
|
||||
) use ($stromerkennung, $anforderungSenden): void {
|
||||
IPS_RequestAction($stromerkennung, 'Aktiv', true);
|
||||
IPS_RequestAction($stromerkennung, 'Solarladen', true);
|
||||
$anforderungSenden($stromerkennung, 13850);
|
||||
IPS_RequestAction($stromerkennung, 'Statuszyklus', false);
|
||||
IPS_Sleep(2100);
|
||||
IPS_RequestAction($stromerkennung, 'Statuszyklus', false);
|
||||
|
||||
$test->assertSame(
|
||||
16,
|
||||
GetValue($test->objectByIdent('FahrzeugMaximalstrom', $stromerkennung))
|
||||
);
|
||||
$test->assertSame(
|
||||
'[0,4150,4850,5550,6250,6950,7600,8300,9000,9700,10300,11000]',
|
||||
(string) GetValue($test->objectByIdent('LeistungsangebotDiagnose', $stromerkennung))
|
||||
);
|
||||
$test->assertTrue(str_contains(
|
||||
(string) GetValue($test->objectByIdent('LetzterGeraetebefehl', $stromerkennung)),
|
||||
'amp=16'
|
||||
));
|
||||
});
|
||||
|
||||
$test->runCase('Sollwert bleibt waehrend der Ladeanlaufzeit gueltig', static function (
|
||||
TestContext $test
|
||||
) use ($goEAntwort, $stationen, $anforderungSenden): void {
|
||||
|
||||
Reference in New Issue
Block a user