This commit is contained in:
@@ -254,6 +254,25 @@ final class ManagerModulstrukturTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testManagerRegeltAktuelleVerbraucherTrotzFehlenderRueckmeldungen(): void
|
||||
{
|
||||
$inhalt = (string) file_get_contents(__DIR__ . '/../Manager/module.php');
|
||||
|
||||
self::assertStringNotContainsString("if (!\$synchronisiert) {", $inhalt);
|
||||
self::assertStringContainsString(
|
||||
"'Synchronisiert' => \$synchronisiert",
|
||||
$inhalt
|
||||
);
|
||||
self::assertStringContainsString(
|
||||
"'NichtGeregelt' => \$nichtGeregelt",
|
||||
$inhalt
|
||||
);
|
||||
self::assertStringContainsString(
|
||||
"\$ergebnis = ManagerRegler::verteile(",
|
||||
$inhalt
|
||||
);
|
||||
}
|
||||
|
||||
public function testManagerUebertraegtStoerungsvollsnapshotsMitRetry(): void
|
||||
{
|
||||
$inhalt = (string) file_get_contents(__DIR__ . '/../Manager/module.php');
|
||||
@@ -280,6 +299,13 @@ final class ManagerModulstrukturTest extends TestCase
|
||||
'"name":"StoermeldeAnschluss"',
|
||||
str_replace(' ', '', (string) file_get_contents(__DIR__ . '/../Manager/form.json'))
|
||||
);
|
||||
self::assertStringContainsString(
|
||||
"if (\$token === '') {\n"
|
||||
. " \$this->aktualisiereLizenzfreigabe(\n"
|
||||
. " \$this->ReadPropertyString('Lizenzcode'),\n"
|
||||
. " true",
|
||||
$inhalt
|
||||
);
|
||||
self::assertGreaterThanOrEqual(
|
||||
3,
|
||||
substr_count(
|
||||
|
||||
@@ -125,6 +125,34 @@ final class ManagerReglerTest extends TestCase
|
||||
self::assertSame(0, $ergebnis['Restabweichung_W']);
|
||||
}
|
||||
|
||||
public function testVeralteterVerbraucherBlockiertUeberschussverteilungNicht(): void
|
||||
{
|
||||
$ergebnis = ManagerRegler::verteile(
|
||||
-2411.0,
|
||||
0.0,
|
||||
[
|
||||
$this->verbraucher(
|
||||
44234,
|
||||
0,
|
||||
[['Von_W' => -39000, 'Bis_W' => 39000]],
|
||||
0
|
||||
),
|
||||
$this->verbraucher(38676, 1, [0, 4600], 0),
|
||||
$this->verbraucher(29743, 1, [0, 6500], 0),
|
||||
$this->verbraucher(43878, 2, [13850], 10151, false),
|
||||
$this->verbraucher(46052, 2, [11000], 0, false),
|
||||
],
|
||||
'PrioritaetPV'
|
||||
);
|
||||
|
||||
self::assertSame(12562, $ergebnis['Verteilbudget_W']);
|
||||
self::assertSame(
|
||||
[44234 => 2411, 29743 => 0, 38676 => 0],
|
||||
$ergebnis['Sollwerte']
|
||||
);
|
||||
self::assertSame(0, $ergebnis['Restabweichung_W']);
|
||||
}
|
||||
|
||||
public function testFehlendeIstleistungFaelltAufAngenommenenSollwertZurueck(): void
|
||||
{
|
||||
$verbraucher = $this->verbraucher(10, 0, [0, 3000], null, false);
|
||||
|
||||
@@ -444,4 +444,46 @@ return static function (TestContext $test): void {
|
||||
$test->objectByIdent('Sammelstoerung', $managerId)
|
||||
));
|
||||
});
|
||||
|
||||
$test->runCase('Veralteter Verbraucher blockiert aktuelle Verbraucher nicht', static function (
|
||||
TestContext $test
|
||||
) use (
|
||||
$managerId,
|
||||
$netzleistungId,
|
||||
$einStufigId,
|
||||
$warmwasserId,
|
||||
$pufferspeicherId,
|
||||
$melden,
|
||||
$verbraucherstatus
|
||||
): void {
|
||||
IPS_SetProperty($managerId, 'VerbraucherTimeout', 1);
|
||||
IPS_ApplyChanges($managerId);
|
||||
SetValue($netzleistungId, -2400.0);
|
||||
$melden();
|
||||
IPS_RequestAction($managerId, 'Regeln', true);
|
||||
$test->waitUntil(
|
||||
static fn (): bool => ($verbraucherstatus()['Synchronisiert'] ?? false) === true
|
||||
);
|
||||
|
||||
IPS_Sleep(1100);
|
||||
IPS_RequestAction($warmwasserId, 'Melden', true);
|
||||
IPS_RequestAction($pufferspeicherId, 'Melden', true);
|
||||
IPS_RequestAction($managerId, 'Regeln', true);
|
||||
|
||||
$daten = $verbraucherstatus();
|
||||
$test->assertSame(false, $daten['Synchronisiert'] ?? null);
|
||||
$test->assertSame(2, count($daten['Verbraucher'] ?? []));
|
||||
$test->assertSame(1, count($daten['NichtGeregelt'] ?? []));
|
||||
$test->assertSame(
|
||||
$einStufigId,
|
||||
$daten['NichtGeregelt'][0]['InstanzID'] ?? null
|
||||
);
|
||||
$test->assertSame(
|
||||
'Meldung ist veraltet',
|
||||
$daten['NichtGeregelt'][0]['Grund'] ?? null
|
||||
);
|
||||
$test->assertTrue(
|
||||
(float) GetValue($test->objectByIdent('Verteilbudget', $managerId)) > 0.0
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user