branch main :
actual working branch:
Table of Contents
Simulating one day timetable for a Railway Network of trains
instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Software to be installed to run simulation.
- package_name
install package package
Procedure to locally set up the directory
- Get a free API Key at https://example.com
- Clone the repo
git clone https://github.com/vitelot/training.git
- Install packages
install blabla
- Provide Zuglaufdaten data in /data/hidden_data/ folder. Data may not be shared. You have to provide them on your own.
- in the script/ folder, run
phelp
andhelp
to have a hint on the accepted options for the preprocessing and the simulation. - run the preprocessing first. Use the script
p
for ease - run the simulation with the script
r
for ease
useful examples of how the project can be used. Additional screenshots, code examples and demos work well in this space.
For more examples, please refer to the Article/Documentation
- Add a parser for simulation
- Add CI feature and codecov, getting better coverage
- Feature 3
- Done Nested Feature
- Not Done Nested Feature
See the open issues for a full list of proposed features (and known issues).
-
/data/
: zipped data to be preprocessed -
/images/
: img needed for readme, for now -
/Preprocessing/
: scripts to handle preprocessing; everything needed to create the input for the simulation- preprocessing.jl : script that takes the unzipped data, creates right repos in /data/ and moves and manipulates it
-
/run/
: containing script for running main.jl in /simulation/ (see following) -
/simulation/
: libraries and main script of the simulation-
extern.jl : This file contains the definition of data structures,useful shortcuts,and the packages to be loaded. All the structs are commented, and we can find:
- mutable struct
Block
: , which has block_id, number of tracks and trains actually in it - mutable struct
Network
: fixed part of the railway network, so operational points and blocks (infrastructure) - mutable struct
Delay
: struct for inserting the delay - struct
Transit
: struct that stands for Event on the timetable: train arrived in ops with a delay... - mutable struct
DynTrain
: dynamical part of Train: where it is and where it's going - mutable struct
Train
: struct with id, dyntrain, and its schedule - mutable struct
Fleet
: how trains interact with the infrastructure (sort of timetable but ordered by train_id)
- mutable struct
-
functions.jl : This file contains the definition of functions that are NOT needed for initializing our system on the infrastructure
- function
dateToSeconds(d::String31)::Int
: Given a string in the format "yyyy-mm-dd HH:MM:SS" ; returns the number of seconds elapsed from the epoch - function
dateToSeconds(d::Int)::Int
: If the input is an Int do nothing; assuming that it is already the number of seconds elapsed from the epoch - function
runTest(RN::Network, FL::Fleet)
: If test mode is enabled, runs test without printing simulation results on std out - function
myRand(min::Float64, max::Float64)::Float64
: ranged random number generator - function
netStatus(S::Set{String}, BK::Dict{String,Block}; hashing::Bool=false)
: function that calculates the status of the simulation as a string of blocks and their occupancies in terms of train id; has also a hashing function to try to speed up - function
sort!(v::Vector{Transit})
- function
issorted(v::Vector{Transit})
- function
-
initialize.jl : This file contains all the functions that have to initialize the system. For example, loading the network, the block characteristics, the timetables
- function
loadInfrastructure()::Network
: takes the blocks.csv file and builds the network - function
loadFleet()::Fleet
: takes the timetable.csv file and loads the Fleet - function
loadDelays()::Tuple{Vector{DataFrame},Int}
: Takes all the delay files in the data/delays/ directory and loads it in a vector of dataframes; each df defines a different simulation to be done - function
resetDelays(FL::Fleet,delays_array::Vector{DataFrame},simulation_id::Int)
: takes the vector of df, resets to 0 the delays imposed to the previews simulation - function
imposeDelays(FL::Fleet,delays_array::Vector{DataFrame},simulation_id::Int)
: imposes the delays for the actual simulation - function
initEvent(FL::Fleet)::Dict{Int,Vector{Transit}}
: Creates the Event dict, having times as keys and events in that time as values
- function
-
parameters.jl : This file contains the functions to load the simulation options from /data/par.ini; If not existing, creates one as default
-
parser.jl : CLI parser
-
simulation.jl : core part of the simulation; it is called in main.jl; returns false if the simulation doesn't get stuck, true otherwise
-
-
/visualization/
: basic visualization of the delays in the simulation
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request (the feature will be added in the Roadmap)
Distributed under the GNU GPL 3 License. See LICENSE
for more information.
Simone Daniotti - [email protected]
Project Link: https://github.com/vitelot/training
- OBB for funding the project
- CSH Vienna for execution and working place