Advanced Traffic Simulator

July 2024 - December 2024

Unity

C#

VS Code

Abstract

Transportation has always been a fundamental sector for the progress of society. It has allowed us to exchange resources, ideas, and services. In the last century, a period of great revolutions and changes, the widespread adoption of vehicles occurred. This led to the creation and development of roads, which resulted in the implementation of regulations and the addition of characteristic elements such as traffic lights, pedestrian crossings, or roundabouts, as well as traffic rules that enable safer and more organized circulation.

The increase in vehicle density on infrastructures has caused road congestion, resulting in a reduction in performance and the constant need for adaptation to meet the growing demands that arise. One of the main challenges is the environmental impact, which manifests through effects such as: vehicle emissions, resource extraction, air quality, the management of vehicles at the end of their useful life, and atmospheric consequences.

In line with what a traffic study involves and these challenges, the main goal is to propose a work environment capable of transferring these infrastructures with their characteristic elements to a digital environment, where the system will allow evaluating and comparing the results to make more informed decisions for the improvement of roads.

As a result, an integrated simulation system has been developed, which allows for semi-automatically transferring the study area to the digital environment, making and saving necessary modifications, generating alternatives to the original circuit, simulating the infrastructures, verifying their operation, extracting metrics, visualizing them through graphs or heatmaps, and comparing them against each other.

The main contribution of this project lies in the developed system, which can be a useful tool for evaluating and improving road infrastructures from both an efficiency perspective and an environmental one, by capturing details such as energy consumption, generated emissions, or fossil fuel consumption.

Overview

Simulation Archetype

The paradigm chosen to develop this simulation system is microscopic, which allows for high fidelity and more solid results that adapt to real-world road traffic conditions.

Elements

The key road elements consist of the following:

Road networks, that have been shaped based on graph extensions and the geometry of the edges created using Bézier curves. Roads also include parameters such as speed, priority, road type, and exit probability.

Traffic lights are defined by a starting delay and an initial state. Additionally, the durations for green, orange, and red states, as well as a security delay, can be specified. Traffic lights can also be synchronized with each other and set to operate in either a complementary and/or delayed manner.

Crosswalks simulate the random behavior of pedestrians crossing the road. This randomness is controlled by defining the minimum and maximum durations for an empty road or pedestrian crossing. These times are selected based on one of three possible distributions: uniform, random, or exponential.

Generators introduce vehicles into the system based on a defined flow and a global multiplier curve that adjusts vehicle input over time.

Destructors remove vehicles from the network when they reach a terminal node, based on the defined closed network.

Road Creation

To define the road networks, we have the following controls:

At a given point, an element such as a generator, crosswalk, or traffic light can be attached:

Finally, the parameters of the road and the elements can be modified, adjusting the synchronization of traffic lights, proper modeling of crosswalks, or simply setting preferences and speeds for the road segments:

Vehicles

Each vehicle adapts its behavior based on road conditions, other vehicles, and control elements.

With yield modeling capabilities, vehicles yield to others based on priority, enabling realistic incorporation points and roundabouts.

Save System

A crucial feature is the ability to save and load projects you are working on. This allows the creation of parallel systems with modifications on the main characteristics to determine which configuration works best.

Area Import

To prevent the user from handcrafting the entire road system, thanks to OSM data provided by Open Street Map we incorporate a map visualization system to select the area and download the OSM data associated with it.

After acquiring the OSM file, the import system generates the network based on the chosen settings.

Simulation

The simulation is structured into steps, each with a specific time interval, allowing for interactions between generators, traffic lights, crosswalks, and vehicles. An extension to this has been the possibility to pause, stop, speed up, or slow down playback of the simulation.

Additionally, vehicles are parameterized based on the following factors:

Using these parameters, the system estimates energy consumption, emissions, and fuel usage consumed/produced by the system, allowing for the adaptation to changes of combustion vehicles to electric ones, or also assess if the deadlines for vehicle emissions are met in a city.

Monitoring

The monitoring of the roads comes in three possible ways, visually on the visualization of the system, by the collection of data on each cell and the visualization on a heatmap or through timeline graphs overlaying.

For the heatmaps, we can visualize areas where vehicles frequently brake or accelerate, density of vehicles and many others... After this data has been collected the user can export the heatmaps to a set of images each one of the metrics.

Another possibility is to use the timeline, which includes the following metrics:

Furthermore, this data can be exported to a CSV which allows users to conduct further analysis in their preferred software, or for future use in the system itself as we will see on the following section.

Compare

All these previous developments culminate in the comparison system, which allows the user to assess which system is preferred based on performance in different metrics. The comparison of the metrics can be done using the time line graphs overlaying and comparing metrics individually, or instead the radial plots can be used that provide a holistic view of various user-selected metrics to be evaluated.

Other Features

Future Work

Some planned improvements and additions include:

Demonstration

This WebGL demo provides a preview of the full experience, with some features limited in this version:

  • Mouse: Click to interact with the interface, and click and drag to move around.
  • Scroll Wheel: Zoom in and out.
  • Keyboard:
    • W, A, S, D: Move the camera forward, left, backward, and right.
    • Q, E: Zoom in and out.

Excluded Features from the Demo:

  • Map Navigation and Area Download
  • Save and Load System
  • Heatmap Support
  • Export and Compare Monitored Data
  • 3D Camera and Improved Controls
  • Watermark Removed
  • Localization Support
  • Cross-platform Support for Windows, Linux, and macOS