feat(manager): Fahrplanvorgabe linear interpolieren
Tests / test (push) Successful in 54s

This commit is contained in:
dh
2026-10-01 12:16:10 +00:00
parent add1077674
commit 38353aed93
3 changed files with 122 additions and 23 deletions
+4 -23
View File
@@ -2757,29 +2757,10 @@ class Manager extends IPSModule implements ManagerSchnittstelle
return null;
}
$jetzt = time();
$naechsterAbstand = PHP_INT_MAX;
$vorgabe = null;
foreach ($fahrplan['points'] as $punkt) {
if (!is_array($punkt)
|| !is_string($punkt['time'] ?? null)
|| (!is_int($punkt['gridTargetW'] ?? null)
&& !is_float($punkt['gridTargetW'] ?? null))
) {
continue;
}
$zeitpunkt = strtotime($punkt['time']);
if ($zeitpunkt === false) {
continue;
}
$abstand = abs($zeitpunkt - $jetzt);
if ($abstand < $naechsterAbstand) {
$naechsterAbstand = $abstand;
$vorgabe = (float) $punkt['gridTargetW'];
}
}
return $naechsterAbstand <= 1800 ? $vorgabe : null;
return ManagerRegler::interpolierteFahrplanVorgabe(
$fahrplan['points'],
time()
);
}
private function synchronisiereAnlagentopologie(): void