Compare commits
2
Commits
d1fc62d43c
...
156591a91e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
156591a91e | ||
|
|
3cabf597ac |
@@ -117,6 +117,10 @@ class LadestationStandAlone extends IPSModule implements VerbraucherSchnittstell
|
|||||||
$this->initialisiereLokaleEinstellungen();
|
$this->initialisiereLokaleEinstellungen();
|
||||||
$this->aktualisiereVariablen();
|
$this->aktualisiereVariablen();
|
||||||
|
|
||||||
|
// Ein persistiertes Ladeende nach Neueinrichtung oder Modulupdate einmal neu pruefen.
|
||||||
|
$this->setzeZustand('FahrzeugGeladen', false);
|
||||||
|
$this->WriteAttributeInteger('LetzterGesetzterStrom', -1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->pruefeKonfiguration();
|
$this->pruefeKonfiguration();
|
||||||
} catch (Throwable $fehler) {
|
} catch (Throwable $fehler) {
|
||||||
@@ -301,7 +305,9 @@ class LadestationStandAlone extends IPSModule implements VerbraucherSchnittstell
|
|||||||
);
|
);
|
||||||
$status = LadestationRegler::normalisiereStatus(
|
$status = LadestationRegler::normalisiereStatus(
|
||||||
$rohstatus,
|
$rohstatus,
|
||||||
$this->ReadAttributeBoolean('ZustandFahrzeugVerbunden')
|
$this->ReadAttributeBoolean('ZustandFahrzeugVerbunden'),
|
||||||
|
$this->ReadAttributeBoolean('ZustandFahrzeugGeladen'),
|
||||||
|
$this->ReadAttributeInteger('LetzterGesetzterStrom') >= 6
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($status as $ident => $wert) {
|
foreach ($status as $ident => $wert) {
|
||||||
|
|||||||
@@ -34,8 +34,12 @@ final class LadestationRegler
|
|||||||
* @param array{Rohstatus: int, Istleistung_W: float} $rohstatus
|
* @param array{Rohstatus: int, Istleistung_W: float} $rohstatus
|
||||||
* @return array<string, int|float|bool>
|
* @return array<string, int|float|bool>
|
||||||
*/
|
*/
|
||||||
public static function normalisiereStatus(array $rohstatus, bool $warVerbunden): array
|
public static function normalisiereStatus(
|
||||||
{
|
array $rohstatus,
|
||||||
|
bool $warVerbunden,
|
||||||
|
bool $warGeladen = false,
|
||||||
|
bool $ladungErwartet = true
|
||||||
|
): array {
|
||||||
$verbunden = $rohstatus['Rohstatus'] !== 1;
|
$verbunden = $rohstatus['Rohstatus'] !== 1;
|
||||||
$leistung = max(0.0, $rohstatus['Istleistung_W']);
|
$leistung = max(0.0, $rohstatus['Istleistung_W']);
|
||||||
$phasen = self::PHASEN_UNBEKANNT;
|
$phasen = self::PHASEN_UNBEKANNT;
|
||||||
@@ -47,7 +51,8 @@ final class LadestationRegler
|
|||||||
$nenner = $phasen === self::PHASEN_EIN ? 230.0 : 1.71 * 400.0;
|
$nenner = $phasen === self::PHASEN_EIN ? 230.0 : 1.71 * 400.0;
|
||||||
$ladestrom = $leistung / $nenner;
|
$ladestrom = $leistung / $nenner;
|
||||||
$ermittelterMaximalstrom = 2.5 + $ladestrom;
|
$ermittelterMaximalstrom = 2.5 + $ladestrom;
|
||||||
$geladen = $warVerbunden && $ermittelterMaximalstrom < 6.0;
|
$geladen = $warGeladen
|
||||||
|
|| ($warVerbunden && $ladungErwartet && $ermittelterMaximalstrom < 6.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$verbunden) {
|
if (!$verbunden) {
|
||||||
|
|||||||
@@ -44,6 +44,28 @@ final class LadestationReglerTest extends TestCase
|
|||||||
self::assertSame(4, $status['Fahrzeugstatus']);
|
self::assertSame(4, $status['Fahrzeugstatus']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAbsichtlichGestoppteLadungWirdNichtAlsGeladenErkannt(): void
|
||||||
|
{
|
||||||
|
$status = LadestationRegler::normalisiereStatus([
|
||||||
|
'Rohstatus' => 2,
|
||||||
|
'Istleistung_W' => 0.0,
|
||||||
|
], true, false, false);
|
||||||
|
|
||||||
|
self::assertFalse($status['FahrzeugGeladen']);
|
||||||
|
self::assertSame(2, $status['Fahrzeugstatus']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testErkanntesLadeendeBleibtBisZumAbsteckenErhalten(): void
|
||||||
|
{
|
||||||
|
$status = LadestationRegler::normalisiereStatus([
|
||||||
|
'Rohstatus' => 2,
|
||||||
|
'Istleistung_W' => 0.0,
|
||||||
|
], true, true, false);
|
||||||
|
|
||||||
|
self::assertTrue($status['FahrzeugGeladen']);
|
||||||
|
self::assertSame(4, $status['Fahrzeugstatus']);
|
||||||
|
}
|
||||||
|
|
||||||
public function testBetriebsartUndSolarladenBestimmenDasLeistungsangebot(): void
|
public function testBetriebsartUndSolarladenBestimmenDasLeistungsangebot(): void
|
||||||
{
|
{
|
||||||
$solarPV = LadestationRegler::leistungsangebot(true, true, true, false, 1, 16, true, false);
|
$solarPV = LadestationRegler::leistungsangebot(true, true, true, false, 1, 16, true, false);
|
||||||
|
|||||||
@@ -61,6 +61,22 @@ return static function (TestContext $test): void {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$solarPause = $test->createInstance(
|
||||||
|
'{0D94913C-0F31-4C29-A685-6EB4AE58E55D}',
|
||||||
|
'Ladestation Solarpause',
|
||||||
|
[
|
||||||
|
'Geraetetyp' => 1,
|
||||||
|
'Geraeteadresse' => '192.0.2.12',
|
||||||
|
'MaximalerLadestrom' => 16,
|
||||||
|
'Ladefreigabe' => true,
|
||||||
|
'Solarladen' => true,
|
||||||
|
'EinstellungenInVisu' => true,
|
||||||
|
'DiagnosevariablenAnzeigen' => true,
|
||||||
|
'Testmodus' => true,
|
||||||
|
'Testantwort' => $goEAntwort(2, 0),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$managerId = $test->createInstance(
|
$managerId = $test->createInstance(
|
||||||
'{6F771B18-59D4-4C8A-B951-3B2FE9F6A2C4}',
|
'{6F771B18-59D4-4C8A-B951-3B2FE9F6A2C4}',
|
||||||
'Hilfsmanager Ladestation',
|
'Hilfsmanager Ladestation',
|
||||||
@@ -120,6 +136,44 @@ return static function (TestContext $test): void {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$test->runCase('Solarpause wird nicht als Ladeende erkannt', static function (
|
||||||
|
TestContext $test
|
||||||
|
) use ($solarPause): void {
|
||||||
|
IPS_RequestAction($solarPause, 'Solarladen', true);
|
||||||
|
|
||||||
|
$test->assertSame(
|
||||||
|
false,
|
||||||
|
GetValue($test->objectByIdent('FahrzeugGeladen', $solarPause))
|
||||||
|
);
|
||||||
|
$test->assertSame(
|
||||||
|
2,
|
||||||
|
GetValue($test->objectByIdent('Fahrzeugstatus', $solarPause))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$test->runCase('ApplyChanges prueft ein gespeichertes Ladeende neu', static function (
|
||||||
|
TestContext $test
|
||||||
|
) use ($goEAntwort, $solarPause): void {
|
||||||
|
IPS_RequestAction($solarPause, 'Solarladen', false);
|
||||||
|
IPS_RequestAction($solarPause, 'Statuszyklus', false);
|
||||||
|
$test->assertSame(
|
||||||
|
true,
|
||||||
|
GetValue($test->objectByIdent('FahrzeugGeladen', $solarPause))
|
||||||
|
);
|
||||||
|
|
||||||
|
IPS_SetProperty($solarPause, 'Testantwort', $goEAntwort(2, 2300));
|
||||||
|
IPS_ApplyChanges($solarPause);
|
||||||
|
|
||||||
|
$test->assertSame(
|
||||||
|
false,
|
||||||
|
GetValue($test->objectByIdent('FahrzeugGeladen', $solarPause))
|
||||||
|
);
|
||||||
|
$test->assertSame(
|
||||||
|
3,
|
||||||
|
GetValue($test->objectByIdent('Fahrzeugstatus', $solarPause))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
$test->runCase('Solar- und Peakbetrieb liefern die Enelix-1-Angebote', static function (
|
$test->runCase('Solar- und Peakbetrieb liefern die Enelix-1-Angebote', static function (
|
||||||
TestContext $test
|
TestContext $test
|
||||||
) use ($stationen, $anforderungSenden): void {
|
) use ($stationen, $anforderungSenden): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user