mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-17 06:54:09 +01:00
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.
This commit is contained in:
@@ -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/<case>/`.
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user