There's no way I'm touching this code again
WIP
A deterministic tool to perform railway route simulations.
📝 Python +3.8
📝 pip3
📝 PyQt5
(for full PyInstaller support)
📝 pipenv
(recommended)
📝 Packages inside pipfile
. They will be installed in the virtual environment with pipenv install
.
To get started:
- Clone the repo:
git clone https://github.com/danicc097/RailwaySim.git
- Install the required packages and corresponding versions with
pipenv install
- Run the main program file with
pipenv run python main.py
- If any changes are made to the
.ui
files, convert them later to python withui_to_py.ps1
orui_to_py.sh
. - To distribute using
PyInstaller
, the project can be easily built withbuild-windows.ps1
orbuild-linux.sh
after activating a virtual environment.
To ensure that the rolling stock complies with the predefined track speed limits at all points, it is necessary to take its total length into account. In a nutshell, this algorithm will offset the original speed limit by the train length when a target is encountered, i.e. when the next speed is higher than the preceding one, splitting the original array while preserving the rest of the track's parameters (grade, curve radius, etc.). The simulation point is set to be in the front of the train for further calculations.
Train length is equally essential to determine the average grade to which the system is subjected, instead of using the front car as only reference. A far more accurate equivalent grade can be obtained based on train length and weighing one grade step backwards at a time up until the total length is reached. Curve resistance is however independent of train length and calculated based on the current simulation point.
To determine the actual braking curve, whenever any intersection is found (A) between the powering/cruising and braking matrices, the remaining curve that follows is appended.
Total resistance effort is currently computed based on the following set of formulas. Custom formulas defined by the user with a given set of variables may be implemented in the future.
where m is the total mass in tonnes, u is speed in km/h and g is gravity in m/s2. RS is the starting resistance, introduced manually as deemed fit for the system. Rolling resistance RR is given by the Davis formula with coefficients A, B and C, which depend on the particular vehicle. Resistance due to grade, RG, is dependent on the track slope. Finally, RC is given by the empirical Desdovits formula and is passed the current curve radius and track gauge.Simply launch the whole package from the executable for your system. Currently built and tested in both Windows 10 and Ubuntu 18.04 via WSL.
WIP
RailwaySim supports passenger and freight trains. The desired option must be selected before running the simulation. This eases the end user's input of many rolling stock constants and will allow for more flexibility in the use of custom formulas for many parameters in the future.
Templates for route and effort data are provided, which may be filled following the specified units and with dot-decimal notation. Complete examples are also provided for reference.
Two critical parameters to allow for a reasonable result are distance steps for both braking and powering computations. Setting them to 1.0 m
will yield accurate and very fast results. For reference, an i5-6600 will take 10 seconds to simulate a 400.000 m route.
As of now, unless the project gains some traction, the only available solver is 1
. Any contribution/suggestion is welcome.
- Minimize operation time: normally used as a benchmark. Yields the fastest driving strategy possible with the given constraints.
- Minimize energy consumption: -
- Fixed travel time: -
An output CSV file is saved with relevant results to represent the unit's performance to the selected location, easily imported into the user's most preferred visualization software or ready to analyze in the beautifully integrated GUI's canvas.
☑️ Include WIPs
⬜ Custom report generation
⬜ Energy usage
📙 Open data from SNCF
📙 An algorithm for braking curve calculations in ERTMS train protection systems
📙 Quantitative Analysis of Regenerative energy in Electric Rail Traction Systems
📙 Modelling energy consumption in diesel multiple units
GPLv3 Licensed (LICENSE). © Daniel Castro, 2020.