HHT-α railway impact simulator with Bouc–Wen hysteresis, inspired by the dynamic load models discussed in DZSF Bericht 53 (2024) (“Überprüfung und Anpassung der Anpralllasten aus dem Eisenbahnverkehr”).
It provides:
- A command line interface (
railway-sim) for single runs and studies (speed mixes + envelopes, sensitivity, convergence) - CSV output for post‑processing
- Optional ASCII plots for headless terminals (SSH, Termux, containers)
- Optional Streamlit-based UI/dashboard (extra deps)
⚠️ Python: ≥ 3.10 (project metadata).
⚠️ On very new Python versions (e.g. 3.13), some scientific wheels may not be available on all platforms yet.
git clone https://github.com/sflabbe/railway-impact-simulator.git
cd railway-impact-simulatorLinux / macOS / WSL:
python -m venv .venv
source .venv/bin/activateWindows (PowerShell):
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1Upgrade packaging tools:
python -m pip install --upgrade pip setuptools wheelpython -m pip install .Check that the entry point is available:
railway-sim --helpThe UI dependencies are bundled as an extra named ui:
python -m pip install ".[ui]"Example configs live in configs/.
railway-sim run `
--config configs/ice1_aluminum.yml `
--speed-kmh 80 `
--output-dir results/ice1_80 `
--ascii-plotrailway-sim run \
--config configs/ice1_aluminum.yml \
--speed-kmh 80 \
--output-dir results/ice1_80 \
--ascii-plotOutput files typically include:
results.csv(time history)run.log(log file)
railway-sim run \
--config configs/ice1_steel.yml \
--speed-kmh 120 \
--output-dir results/ice1_steel_120 \
--plotExample: speed mix 320 / 200 / 120 km/h with weights 0.2 / 0.4 / 0.4 for the envelope of Impact_Force_MN:
railway-sim parametric \
--base-config configs/ice1_aluminum.yml \
--speeds "320:0.2,200:0.4,120:0.4" \
--quantity Impact_Force_MN \
--output-dir results_parametric/track_mix \
--prefix track_mix \
--ascii-plotrailway-sim convergence \
--config configs/traxx_freight.yml \
--dts "2e-4,1e-4,5e-5" \
--quantity Impact_Force_MN \
--out results_parametric/convergenceThe live terminal monitor provides a full-screen progress view with live plots while a simulation runs. It is designed for headless terminals, including SSH sessions.
Requirements:
- A TTY for stdin and stdout.
- Python curses support (available on Linux, macOS, and WSL; Windows Python may not ship with curses).
Run it by adding --live-monitor:
railway-sim run \
--config configs/ice1_aluminum.yml \
--speed-kmh 80 \
--output-dir results/ice1_80_live \
--live-monitorUseful flags:
--live-refresh-s 0.05controls how often the UI refreshes.--live-sample-s 0.02controls how often the solver emits progress samples.--live-holdkeeps the monitor open until you pressq.--live-auto-closeexits the monitor automatically on completion.
Expected output (first lines of the full screen view):
Railway impact simulator status running
step 120/400 30.0% t 0.0120 s dt 1.00e-04 wall 1.2 s
solver newton iters 3 max resid 1.20e-06 contact 1
F 12.345 MN pen 1.234 mm v -22.220 m/s a 0.500 g Eb 1.234e-05
Troubleshooting:
If you request --live-monitor in a non-interactive shell, the CLI runs without the monitor and logs a warning.
If your terminal does not support Unicode, the UI falls back to ASCII sparklines.
Press q to quit, p to pause, v to switch views, and s to save a text snapshot in the output directory.
These keys are commonly used when tuning the nonlinear solver:
solver:"newton"(default) or"picard"(legacy fixed-point).max_iter: Newton–Raphson max iterations per step.newton_tol: Newton–Raphson residual tolerance.picard_max_iters: Picard max iterations per step.picard_tol: Picard residual tolerance.
Backward compatibility: if a YAML sets
max_iterornewton_tolbut omits Picard controls, the simulator mirrors those values intopicard_max_iters/picard_tol.
Configs are loaded from --config / --base-config and merged into internal defaults.
- Descriptive metadata keys like
case_name/notesare accepted and ignored by the solver. - Other unknown keys are ignored with a warning (helps catch typos).
- The example configs under
configs/are the best reference for valid keys and units.
Minimal override example:
# quickstart.yml
v0_init: -22.22 # [m/s] towards the barrier (sign convention)
T_max: 0.40 # [s] total simulated time
h_init: 1.0e-4 # [s] timestepNote: if you set
T_maxandh_initbut do not setstep, the simulator derives a consistentstep ≈ T_max / h_init.
.
├── configs/ # YAML example configs (ICE1, TRAXX, etc.)
├── docs/ # Documentation and reports
├── examples/ # Scripts and worked examples
├── src/ # Library + CLI implementation
├── tests/ # Pytest regression tests
└── tools/ # Helper scripts (portable builds, utilities)
The Streamlit app entry point is:
src/railway_simulator/core/app.py
Start the UI after installing .[ui]:
railway-sim uiOpen http://127.0.0.1:8501 (default) in your browser.
PROJECT_SUMMARY.md– overview / roadmapARCHITECTURE.md– system design notesDEVELOPER_GUIDE.md– developer notes and local workflowsVALIDATION_Pioneer.md– validation notesCITATION_REFERENCE.md– citation/reference notes
MIT License — see LICENSE.
If you use this simulator in academic work, cite the repository and the DZSF research report it is based on
(see CITATION_REFERENCE.md).