18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 20:24:59 +01:00

test(scenarios): the timetable cases check where the train stops, not how long

Przystanek on td.scn is a technical stop of the td/rozklad timetable (pt): the AI
doesn't wait there for the departure time but sets off as soon as it counts the
train as standing at the W4, below 1 km/h. How long the speed then stays under
0.5 km/h is only how fast the brake releases. With the AI braking of #264 the
trains creep up to the W4 at about 10 km/h on a light application and stood there
for 1-5 s; the SN61 turns back at 0.36 km/h without stopping. The hold of 5 s
(2 s for the SN61) failed for EP09, SN61 and Vectron and had well under a second
to spare for others.

The cases now check that the train comes down to 1 km/h, the AI's own standstill
at a W4, 1380-1420 m from the start; every vehicle stops at 1397-1401 m, before
and after #264. `stops` takes min_distance and max_distance for that.
This commit is contained in:
jerrrrycho
2026-11-08 11:16:33 +01:00
parent 491ed3e6da
commit 62526e9d6a
9 changed files with 23 additions and 13 deletions

View File

@@ -344,7 +344,7 @@ def check_brakes(rows, min_pressure, moving_speed=20):
return False, f"brake cylinder pressure never reached {min_pressure} bar after moving off"
def check_stops(rows, moving_speed, stop_speed, hold):
def check_stops(rows, moving_speed, stop_speed, hold, min_distance=None, max_distance=None):
start = _first_moving(rows, moving_speed)
if start is None:
return False, f"never reached {moving_speed} km/h"
@@ -356,7 +356,11 @@ def check_stops(rows, moving_speed, stop_speed, hold):
if stopped_at is None:
stopped_at = i
if r[COL_TIME] - rows[stopped_at][COL_TIME] >= hold:
return True, f"came to a stop at t={rows[stopped_at][COL_TIME]:.1f}s after {dist[stopped_at]:.0f} m"
where = dist[stopped_at]
detail = f"came to a stop at t={rows[stopped_at][COL_TIME]:.1f}s after {where:.0f} m"
if (min_distance is not None and where < min_distance) or (max_distance is not None and where > max_distance):
return False, f"{detail}, wanted between {min_distance} and {max_distance} m"
return True, detail
else:
stopped_at = None
return False, f"did not stay below {stop_speed} km/h for {hold}s after moving off"