This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user