mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-18 23:26:03 +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:
@@ -168,7 +168,12 @@ scenery is newer.
|
||||
the one whose physicslog is checked. Other vehicles of the consist take names made from it,
|
||||
e.g. `{{vehicle}}_s`. The td.scn cases share two fragments, `td_timetable.scn` (route set,
|
||||
train runs to Przystanek) and `td_red_signal.scn` (no route, exit signal at stop), and differ
|
||||
only in `vars.consist`. `td_red_signal_moving.scn` is the red signal one with the train
|
||||
only in `vars.consist`. Przystanek is a technical stop in that timetable (`pt`), where the AI
|
||||
doesn't wait for the departure time: it sets off as soon as it counts the train as standing at
|
||||
the W4, which is below 1 km/h, so the train stands there for a few seconds at most, or doesn't
|
||||
quite stop (since the AI braking of #264 the SN61 turns back at 0.4 km/h). The
|
||||
timetable cases therefore check that the train comes down to 1 km/h, with no hold, 1380-1420 m
|
||||
from the start (every vehicle stops at 1397-1401 m). `td_red_signal_moving.scn` is the red signal one with the train
|
||||
starting at `vars.velocity` km/h; with `track_friction` 0.03 it locks the wheels when braking
|
||||
and slides past the signal, so those cases set `test.fail_if_stop_overran no`.
|
||||
`td_red_signal_pass.scn` adds the `test_pass` event, which `test_mode_pass` puts as `event0`
|
||||
@@ -189,13 +194,14 @@ the row instead, logged by builds from this branch on.
|
||||
- `max_speed` `limit`, `tolerance`: never goes faster than `limit + tolerance`.
|
||||
- `brakes` `min_pressure`: after moving off, brake cylinder pressure reaches `min_pressure` bar
|
||||
(physicslog pressures are in bar whatever its header says; the brake pipe runs at 5.0).
|
||||
- `stops` `moving_speed`, `stop_speed`, `hold`: after reaching `moving_speed`, stays at or
|
||||
below `stop_speed` for `hold` seconds.
|
||||
- `stops` `moving_speed`, `stop_speed`, `hold`, optional `min_distance`, `max_distance`: after
|
||||
reaching `moving_speed`, stays at or below `stop_speed` for `hold` seconds; with the distances,
|
||||
that stop has to be between them (metres travelled, as in `distance`).
|
||||
- `stays_stopped` `moving_speed`, `stop_speed`: after moving off and stopping, never goes
|
||||
above `stop_speed` again.
|
||||
- `distance` `min`, `max`: total distance travelled. The physicslog has no position, so the
|
||||
distance comes from integrating the speed; on td.scn every vehicle's first stop after
|
||||
Stacja1 came out at 1400 m (+-3), and the red signal stop at 140 m.
|
||||
Stacja1 came out at 1400 m (+-4), and the red signal stop at 140 m.
|
||||
- `slips` `within`: the lead vehicle's wheels slip or lock at some point (within `within`
|
||||
seconds if given), so a slippery rail case does what it's meant to.
|
||||
- `slip_clears` `moving_speed`, `stop_speed`, `within` (*vehicle speed*): once stopped after
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 2 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{ "type": "starts", "min_speed": 20, "within": 150 },
|
||||
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
|
||||
{ "type": "brakes", "min_pressure": 0.5 },
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
|
||||
{ "type": "stops", "moving_speed": 20, "stop_speed": 1.0, "hold": 0, "min_distance": 1380, "max_distance": 1420 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user