feat(manager): Lizenzierung und Energietopologie verfeinern
Tests / test (push) Successful in 46s

This commit is contained in:
dh
2026-09-28 17:47:22 +00:00
parent 708a8ecea2
commit cf2ce3aff4
14 changed files with 517 additions and 151 deletions
+4 -9
View File
@@ -26,16 +26,12 @@ final class EinspeiseRegler
public static function verteile(
float $netzleistung,
float $einspeisegrenze,
float $toleranz,
array $wechselrichter,
array $letzteGrenzen = []
): array {
if ($einspeisegrenze < 0.0) {
throw new InvalidArgumentException('Einspeisegrenze darf nicht negativ sein.');
}
if ($toleranz < 0.0) {
throw new InvalidArgumentException('Einspeisetoleranz darf nicht negativ sein.');
}
if ($wechselrichter === []) {
throw new InvalidArgumentException('Mindestens ein regelbarer Wechselrichter ist erforderlich.');
}
@@ -81,12 +77,11 @@ final class EinspeiseRegler
$netzabweichung = $netzleistung + $einspeisegrenze;
$zielGesamt = $bisherigeGrenzeGesamt;
$nachIstleistungVerteilen = false;
if ($netzabweichung < -$toleranz) {
if ($netzabweichung < 0.0) {
$nachIstleistungVerteilen = $istleistungGesamt > 0.0;
$wirksameAbweichung = $netzabweichung + $toleranz;
$zielGesamt = min($bisherigeGrenzeGesamt, $istleistungGesamt) + $wirksameAbweichung;
} elseif ($netzabweichung > $toleranz) {
$zielGesamt = $bisherigeGrenzeGesamt + $netzabweichung - $toleranz;
$zielGesamt = min($bisherigeGrenzeGesamt, $istleistungGesamt) + $netzabweichung;
} elseif ($netzabweichung > 0.0) {
$zielGesamt = $bisherigeGrenzeGesamt + $netzabweichung;
}
$zielGesamt = max(0.0, min($zielGesamt, $nennleistungGesamt));