Giter Site home page Giter Site logo

vitelot / training Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 3.24 MB

Macroscopic simulation of trains in a railway system

License: GNU General Public License v3.0

Julia 98.80% Shell 1.20%
railway queuing-system macroscopic-simulation trains trainsim julia-language

training's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo Logo

TRAINING: a delay handling simulation


Explore the docs »

View Demo · Report Bug · Request Feature

Main Programming Language

branch main :

build-main

codecov

actual working branch:

build-test-branch

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Code Structure
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

Simulating one day timetable for a Railway Network of trains

(back to top)

Built With

(back to top)

Please ignore all of this: we must write the readme again

Getting Started

instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

Software to be installed to run simulation.

  • package_name
    install package package

Installation

Procedure to locally set up the directory

  1. Get a free API Key at https://example.com
  2. Clone the repo
    git clone https://github.com/vitelot/training.git
  3. Install packages
     install blabla

(back to top)

Usage

  1. Provide Zuglaufdaten data in /data/hidden_data/ folder. Data may not be shared. You have to provide them on your own.
  2. in the script/ folder, run phelp and help to have a hint on the accepted options for the preprocessing and the simulation.
  3. run the preprocessing first. Use the script p for ease
  4. 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

(back to top)

Roadmap

  • 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).

(back to top)

Code Structure:

  • /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)
    • 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})
    • 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
    • main.jl

    • 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

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request (the feature will be added in the Roadmap)

(back to top)

License

Distributed under the GNU GPL 3 License. See LICENSE for more information.

(back to top)

Contact

Simone Daniotti - [email protected]

Project Link: https://github.com/vitelot/training

(back to top)

Acknowledgments

  • OBB for funding the project
  • CSH Vienna for execution and working place

(back to top)

training's People

Contributors

nickolson88 avatar simonedaniotti avatar snehal-shekatkar avatar vitelot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

training's Issues

Inexistent blocks after code rerun

Screenshot 2022-01-10 at 14 38 52

trainIni.in file in ~/prgs/training/preprocessing

#key value
#############################
#Range for the delay injected
#############################
step_beginning 3000
step_end 3000
step_length 3000
#############################
#List of trains to be delayed
#############################
SB24686
REX1961
REX1975
R2201
R2202

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.