From 6cf8934acb65aec779aea3d0f7a9604f9ef7ec15 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Wed, 30 Sep 2026 19:29:10 +0200 Subject: [PATCH] test: run scenario tests at timespeed 20 by default eu07_td_timetable now takes about 20 s instead of 4 min. Its speed profile at 20 and 60 matched a real-time run within a few km/h and seconds; the physicslog keeps its 0.05 s rows. The runner polls the log every 0.25 s so it does not overshoot the case duration by a minute of simulation. --- tests/scenarios/README.md | 5 ++++- tests/scenarios/run.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/scenarios/README.md b/tests/scenarios/README.md index 77edb5a93..c233154d6 100644 --- a/tests/scenarios/README.md +++ b/tests/scenarios/README.md @@ -18,7 +18,10 @@ Python 3.10+, no extra packages. Options: - `--exe path/to/eu07.exe` picks the build to test; the default is the newest `cmake-build-*/bin/Release/eu07*.exe`. The build needs the `-ini` command line option. - name one or more cases to run only those, e.g. `run.py ... eu07_td_timetable`. -- `--timespeed 4` runs the simulation faster than real time. +- `--timespeed N` sets the simulation time multiplier, default 20: a 4-minute case runs in + about 20 s. Physics still steps finely (the physicslog keeps its 0.05 s rows) and the speed + profile at 20 and 60 matched a real-time run within a few km/h and seconds. Use + `--timespeed 1` to watch a run. Exit code is 0 when every case passed. Logs of each run (`log.txt`, `errors.txt`, the vehicle's physicslog) land in `tests/scenarios/out//`. diff --git a/tests/scenarios/run.py b/tests/scenarios/run.py index ad1f51ee7..b3736a929 100644 --- a/tests/scenarios/run.py +++ b/tests/scenarios/run.py @@ -149,7 +149,7 @@ def run_simulator(exe: Path, game_dir: Path, scenery: str, ini: Path, physicslog last_report = 0.0 try: while True: - time.sleep(1.0) + time.sleep(0.25) # at timespeed 20 that is 5 s of simulation result.rows = read_physicslog(physicslog) sim_t = result.rows[-1][COL_TIME] if result.rows else 0.0 wall = time.monotonic() - started @@ -308,7 +308,10 @@ def main() -> int: ap.add_argument("--game-dir", default=os.environ.get("EU07_GAME_DIR"), help="game install with scenery/ and dynamic/ (or EU07_GAME_DIR)") ap.add_argument("--exe", help="simulator executable (default: newest cmake-build-*/bin/Release/eu07*.exe)") - ap.add_argument("--timespeed", type=float, default=1.0, help="simulation time multiplier") + # 20 gave the same speed profile as 1 within a few km/h and seconds on eu07_td_timetable, + # in 20 s instead of 4 min; 1 is for watching a run + ap.add_argument("--timespeed", type=float, default=20.0, + help="simulation time multiplier, the simulator offers 1, 5, 20 and 60 (default 20)") args = ap.parse_args() if not args.game_dir: