← Back to projects
2024

Visual Transit Simulator

Role
Software Developer
Year
2024
Tech & Tools
JavaJavaScriptHTMLWebSocketsOOPSystem Design
Overview

A capstone project which simulates buses and trains through a visual interface on the University of Minnesota - Twin Cities campus.

Key Outcomes
  • Simulated real UMN campus bus and train routes
  • Built visual browser interface for real-time vehicle tracking
  • Implemented WebSocket communication between simulator and visualization modules
  • Modeled real-world transit entities using object-oriented design patterns
The Visual Transit Simulator Software

This is the visual transit simulator (VTS) software. The current VTS software models vehicle transit around the University of Minnesota campus. Specifically, the software simulates the behavior of vehicles and passengers on campus. The VTS software currently supports two types of vehicles: buses and trains. Vehicles provide service for a line. A line is made by two routes: an outbound and an inbound route. Vehicles go along a route, make stops, and pick up/drop off passengers. The simulation operates over a certain number of time units. In each time unit, the VTS software updates the state of the simulation by creating passengers at stops, moving vehicles along the routes, allowing a vehicle to pick up passengers at a stop, etc. The simulation is configured using a configuration file that specifies the simulated lines, the stops of the routes, and how likely it is that a passenger will show up at a certain stop at each time unit. Routes must be defined in pairs — there should be both an outbound and inbound route, and the routes should be specified one after the other. The ending stop of the outbound route should be at the same location as the starting stop of the inbound route, and vice versa. After a vehicle has passed a stop, it is possible for passengers to show up at stops the vehicle has already passed. For this reason, the simulator supports multiple vehicles to pick up new passengers. Each vehicle has its own understanding of its own route. Vehicles do not make more than one trip in the line they serve. When a vehicle finishes both of its routes, it exits the simulation. The VTS software is divided into two main modules: the visualization module and the simulator module. The visualization module displays the state of the simulation in a browser and is written in JavaScript and HTML. The simulator module is a web server application written in Java. The simulator module is divided into two parts: model classes and webserver classes. The model classes model real-world entities such as vehicles, and the webserver classes orchestrate the simulation. The two modules communicate with each other using WebSockets. The user interacts with the visualization module using the browser and can specify how long the simulation will run and how often new vehicles will be added to a route. The user also specifies when to start and pause the simulation.

Visual Transit Simulator GUI
VTS Software Details — Simulation Configuration

LINE_START, BUS_LINE, Campus Connector ROUTE_START, East Bound STOP, Blegen Hall, 44.972392, -93.243774, .15 STOP, Coffman, 44.973580, -93.235071, .3 STOP, Oak Street at University Avenue, 44.975392, -93.226632, .025 STOP, Transitway at 23rd Avenue SE, 44.975837, -93.222174, .05 STOP, Transitway at Commonwealth Avenue, 44.980753, -93.180669, .05 STOP, State Fairgrounds Lot S-108, 44.983375, -93.178810, .01 STOP, Buford at Gortner Avenue, 44.984540, -93.181692, .01 STOP, St. Paul Student Center, 44.984630, -93.186352, 0 ROUTE_END ROUTE_START, West Bound STOP, St. Paul Student Center, 44.984630, -93.186352, .35 STOP, Buford at Gortner Avenue, 44.984482, -93.181657, .05 STOP, State Fairgrounds Lot S-108, 44.983703, -93.178846, .01 STOP, Transitway at Commonwealth Avenue, 44.980663, -93.180808, .01 STOP, Thompson Center & 23rd Avenue SE, 44.976397, -93.221801, .025 STOP, Ridder Arena, 44.978058, -93.229176, .05 STOP, Pleasant Street at Jones-Eddy Circle, 44.978366, -93.236038, .1 STOP, Bruininks Hall, 44.974549, -93.236927, .3 STOP, Blegen Hall, 44.972638, -93.243591, 0 ROUTE_END LINE_END STORAGE_FACILITY_START SMALL_BUSES, 3 LARGE_BUSES, 2 ELECTRIC_TRAINS, 1 DIESEL_TRAINS, 5 STORAGE_FACILITY_END