dustinfast / PTC-Sim

A PTC Back Office Server with web interface, track/locomotive simulators, and EMP messaging subsystem.
MIT License
3 stars 4 forks source link
flask-web google-earth locomotive positive-train-control simulation

PTC-Sim - Positive Train Control Simulation

Heroku

This application is a Positive Train Control (PTC) Back Office Server (BOS) with web interface, track/locomotive simulators, and Edge Message Protocol (EMP) messaging subsystems. Development has begun with the intention of growing into an open-source PTC solution after observing first-hand the difficulties railroads are currently experiencing as they attempt to meet PTC implementation deadlines imposed by congress. It is a work in progress and distributable free under the MIT license. All images obtained under the Creative Common License.

PTC's mandate is to prevent:

Interoperability between railroads is also required, as defined by the Federal Railroad Administration's Interoperable Train Control (ITC) standard.

PTC-Sim currently implements broker-assisted EMP communication between simulated on-track devices (locomotives and 220 MHz radio base-stations) and the BOS. Locomotive tracking and computer-aided-dispatch (CAD) is facilitated by a web interface, where current device status and location are displayed graphically. For the simulation, each web client gets its own "sanbox", consisting of an independent broker and track/locomotive simulator.

Usage

From a Linux terminal, start the application with ./sim_bos.py, then navigate to `http://localhost:5000'

Application Structure

Components

Each component exists as a seperate entity. Communication between entities occurs via EMP messaging over TCP/IP.

Files

PTC-Sim
|   app_config.dat - Application configuration information.
|   lib_app.py - Shared application-level library.
|   lib_messaging.py - Messaging subsystem library.  
|   lib_track.py - Track simulation class library.
|   lib_web.py - Web interface library.
|   LICENSE - MIT License.
|   Procfile - Process definition, for use in virtual environments.
|   requirements.txt - Dependencies, for use in virtual environments.
|   runtime.txt - Python version def, for use in virtual environments.
|   README.md - This document.
|   sim_bos.py - The Back Office Server / web interface.
|
+---docs - Contains documentation.
|
+---logs - Created on startup to hold log files for each component.
|
+---static - Static web content, such as images, css, and js.
|
+---templates - Flask web templates
|       home.html - The main device and locomotive satus page. 
|       layout.html - Top-level container template, including navbar.
|
+---track
|       track_bases.json - JSON representation of the track's radio base stations.
|       track_locos.json - JSON representation of the railroad's locomotives.
|       track_rail.json - JSON representation of the track's main branch.

Dependencies / Technologies

Requires Python 2.7. Other dependencies managed by the application include: Flask, Jinja, JQuery, and the GoogleMaps API.

Preview

To preview PTC-Sim, navigate to https://ptc-sim.herokuapp.com/

PTC-Sim Screenshot

Unimplemented

At this point in development, some features typical in a PTC deployment, such as authentication, encryption, high availability, redundancy, and persistent data have not been implemented. Track simulation is also currently restricted to a single branch, however locomotives are not currently aware of each other on that branch. Additionally, the following TODO items are in progress: