This commit is contained in:
@@ -109,6 +109,23 @@ final class WarmwasserRegler
|
||||
return $bisher + $alpha * ($eingang - $bisher);
|
||||
}
|
||||
|
||||
public static function restzeitBisLastwechsel(
|
||||
int $letzterLastwechsel,
|
||||
int $jetzt,
|
||||
int $sperrzeitSekunden
|
||||
): int {
|
||||
if ($sperrzeitSekunden < 0) {
|
||||
throw new InvalidArgumentException('Die Lastwechsel-Sperrzeit darf nicht negativ sein.');
|
||||
}
|
||||
if ($letzterLastwechsel <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$verstrichen = max(0, $jetzt - $letzterLastwechsel);
|
||||
|
||||
return max(0, $sperrzeitSekunden - $verstrichen);
|
||||
}
|
||||
|
||||
public static function energieKWh(float $leistungW, int $dauerSekunden): float
|
||||
{
|
||||
if ($dauerSekunden < 0) {
|
||||
|
||||
Reference in New Issue
Block a user