Git Product home page Git Product logo

train-simulation's Introduction

SmartRail

Chris Shelton & Biraj Silwal

About

SmartRail is a simulation of light rail network built using JavaFx, JAVA concurrency, and JAVA thread.

Problem Description

SmartRail is a visionary system concept that allows trains to interact directly with the tracks and switches that a part of a light rail network. Each train is an independent agent, which selects a destination (normally based on a schedule, policy, or conductor input),discovers the route to the destination, and secures the route against possible collisions (by repositioning switches and setting lights).

Trains function independently of each other and cannot communicate with other trains.A train is aware of the track on which it is located and, similarly, the track is aware of the identity of the train present at that location. Two trains cannot be located on the same track–a route consists of multiple tracks that connect with each other.

For modularity and flexibility reasons, each component of the light rail system is aware only of its immediate neighbors in the system.

Simplifying Assumptions

  • The static components are stations, switches, and track segments. (We’re leaving out signal lights.) The configuration is loaded on from a file using the format specified below.
  • There are no rail crossings.
  • Trains enter and exit the system at stations only.
  • The conductor (that is, the user) selects the destination for a train.
  • Trains change direction only when at a station.
  • A train heading right/left can only travel to cities to the right/left.
  • Trains move at constant speeds.

Program GUI

  • Program initially reads configuration file to set up simulation.
  • User selects destination station for a train (initial starting station is top left station).
  • Display should have track segments, stations, switches, and trains clearly displayed and updated as the simulation progresses
  • When user selects a station, green color gets painted around selected station.

Implementation Details

  • Each component (train, tracks, stations, etc.) is an active object running on its own thread.
  • Each component can only talk to its immediate neighbors. (You should not call a method on a neighboring object that calls a method on the next object that calls a method on the next object, and so on.) Pass some sort of message to the neighbor instead and let the neighbor handle the message on its own thread.
  • Used concurrent data structures and synchronization to avoid deadlock and race conditions. Suggestion: give every object a BlockingQueue of messages as an “inbox” and just have everything for that object coordinated through processing the messages one at a time.

Docs

  • Object-Oriented Design file is inside the Docs folder
  • Other resources like config files and images are inside Resources folder.

Known Bugs

  • Stationary elements (stations, switches,track) do not indicate if they are in a locked or free state.
  • user cannot run two trains at the same time.

train-simulation's People

Contributors

birajsilwal avatar

Watchers

 avatar

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.