Skip to content

CS-Era/Jamact-Model-Simulator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulation output

Traffic Intersection Simulation with Stats

Python version License: MIT

A simulation developed from scratch using Pygame to simulate the movement of vehicles across a traffic intersection having traffic lights with a timer. Some statistics and analytical features added to the previous version to help in Modelling problems, Data Analysis tasks, and AI applications.


Features added:

  • Vehicle counts - The number of vehicles that have crossed the intersection is displayed adjacent to each traffic signal for each direction.
  • Time Elapsed - The time elapsed since the start of the simulation is displayed at the top right.
  • Simulation Duration - The total duration of simulation or end time can be set. The simulation will quit automatically when the time elapsed is equal to the simulation duration.
  • Printing timers on Terminal - The timer values of all signals are printed on the Terminal every second. This is useful for effective debugging while customizing the simulation according to your application.
  • Printing cumulative statistics - Statistics like direction-wise vehicle counts, total vehicles, and simulation time are printed on the Terminal at the end of the simulation, as shown in the image below.

Stats

Find a step-by-step guide to build this simulation here.


Demo

The video below shows the final output of the simulation.


Prerequisites

Python 3.1+


Installation

  • Step I: Clone the Repository
      $ git clone https://github.com/mihir-m-gandhi/Traffic-Intersection-Simulation-with-Stats
  • Step II: Install the required packages
      # On the terminal, move into Traffic-Intersection-Simulation-with-Stats directory
      $ cd Traffic-Intersection-Simulation-with-Stats
      $ pip install pygame
  • Step III: Run the code
      # To run simulation
      $ python simulation.py

Author

Mihir Gandhi - mihir-m-gandhi


License

This project is licensed under the MIT - see the LICENSE file for details.

About

Simulatore del modello Jamact

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%