This commit is contained in:
@@ -10,14 +10,14 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class BatterieReglerTest extends TestCase
|
||||
{
|
||||
public function testLeistungsrasterBehaeltGrobeUndFeineSchritte(): void
|
||||
public function testLeistungsbereichBleibtInnerhalbDynamischerGrenzen(): void
|
||||
{
|
||||
self::assertSame(
|
||||
[
|
||||
-1000, -750, -500, -250, -200, -150, -100, -50,
|
||||
0, 50, 100, 150, 200, 250, 500, 750, 1000,
|
||||
],
|
||||
BatterieRegler::leistungsraster(1000.0, 1000.0)
|
||||
[['Von_W' => -999, 'Bis_W' => 1000]],
|
||||
BatterieRegler::leistungsangebot(
|
||||
true, true, false, 50.0, 20.0, 10.0, false,
|
||||
0.0, 0.0, 1000.9, 999.9
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,12 +28,10 @@ final class BatterieReglerTest extends TestCase
|
||||
self::assertFalse(BatterieRegler::hystereseAktiv(22.1, 20.0, 2.0, true));
|
||||
}
|
||||
|
||||
public function testPvAngebotEntsprichtDemBisherigenSocVerhalten(): void
|
||||
public function testPvAngebotVerwendetStufenloseBereicheMitBisherigerSocLogik(): void
|
||||
{
|
||||
$voll = BatterieRegler::leistungsraster(1000.0, 1000.0);
|
||||
|
||||
self::assertSame(
|
||||
$voll,
|
||||
[['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
|
||||
@@ -47,7 +45,7 @@ final class BatterieReglerTest extends TestCase
|
||||
)
|
||||
);
|
||||
self::assertSame(
|
||||
[-1000, -750, -500, -250, -200, -150, -100, -50, 0],
|
||||
[['Von_W' => -1000, 'Bis_W' => 0]],
|
||||
BatterieRegler::leistungsangebot(
|
||||
true, true, false, 100.0, 20.0, 10.0, false,
|
||||
0.0, 0.0, 1000.0, 1000.0
|
||||
@@ -66,6 +64,24 @@ final class BatterieReglerTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testPeakEinschraenkungenWerdenAlsBereicheGemeldet(): void
|
||||
{
|
||||
self::assertSame(
|
||||
[['Von_W' => -1000, 'Bis_W' => 0]],
|
||||
BatterieRegler::leistungsangebot(
|
||||
true, true, true, 21.0, 20.0, 10.0, true,
|
||||
0.0, 0.0, 1000.0, 1000.0
|
||||
)
|
||||
);
|
||||
self::assertSame(
|
||||
[['Von_W' => 0, 'Bis_W' => 1000]],
|
||||
BatterieRegler::leistungsangebot(
|
||||
true, true, true, 10.0, 20.0, 10.0, true,
|
||||
0.0, 0.0, 1000.0, 1000.0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testWechselrichtersteuerungBietetNurNull(): void
|
||||
{
|
||||
self::assertSame(
|
||||
@@ -186,6 +202,9 @@ final class BatterieReglerTest extends TestCase
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
BatterieRegler::leistungsraster(-1.0, 1000.0);
|
||||
BatterieRegler::leistungsangebot(
|
||||
true, true, false, 50.0, 20.0, 10.0, false,
|
||||
0.0, 0.0, -1.0, 1000.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,17 @@ final class NachrichtenvertragTest extends TestCase
|
||||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
public function testLeistungswertWirdInEinzelwertenUndBereichenGefunden(): void
|
||||
{
|
||||
$angebot = [0, ['Von_W' => 1000, 'Bis_W' => 2000], 3000];
|
||||
|
||||
self::assertTrue(Nachrichtenvertrag::enthaeltLeistungswert($angebot, 0));
|
||||
self::assertTrue(Nachrichtenvertrag::enthaeltLeistungswert($angebot, 1537));
|
||||
self::assertTrue(Nachrichtenvertrag::enthaeltLeistungswert($angebot, 2000));
|
||||
self::assertFalse(Nachrichtenvertrag::enthaeltLeistungswert($angebot, 999));
|
||||
self::assertFalse(Nachrichtenvertrag::enthaeltLeistungswert($angebot, 2500));
|
||||
}
|
||||
|
||||
public function testNegativePrioritaetWirdAbgelehnt(): void
|
||||
{
|
||||
$daten = $this->verbraucherdaten();
|
||||
|
||||
@@ -119,10 +119,10 @@ PHP
|
||||
): void {
|
||||
IPS_RequestAction($batterieID, 'Aktiv', true);
|
||||
$managerdatenSenden('PV', null);
|
||||
$managerdatenSenden('PV', 500);
|
||||
$managerdatenSenden('PV', 537);
|
||||
|
||||
$test->waitUntil(
|
||||
static fn (): bool => (float) GetValue($leistungID) === 500.0
|
||||
static fn (): bool => (float) GetValue($leistungID) === 537.0
|
||||
&& (int) GetValue($modusID) === 11
|
||||
&& (int) GetValue($managementID) === 2
|
||||
);
|
||||
@@ -136,9 +136,9 @@ PHP
|
||||
$modusID,
|
||||
$leistungID
|
||||
): void {
|
||||
$managerdatenSenden('PV', -500);
|
||||
$managerdatenSenden('PV', -843);
|
||||
$test->waitUntil(
|
||||
static fn (): bool => (float) GetValue($leistungID) === 500.0
|
||||
static fn (): bool => (float) GetValue($leistungID) === 843.0
|
||||
&& (int) GetValue($modusID) === 12
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user