How bhaveshchhimwal/smart-traffic-system works
This is a compact multithreaded traffic-intersection simulator. The executable starts a traffic-generation thread and a controller loop; the generator changes lane state, while the controller selects a green lane using ambulance priority and a vehicle/wait-time score, updates waiting times, and displays the state. The graph separates those runtime responsibilities from the lane model. Relationships are grounded in the README and excerpts; no external services are shown.
Main entry points: main.cpp Simulation driver · Lane.cpp Lane state · TrafficController.cpp Signal update
Components 7
Simulation runtime
- Simulation driver
main.cpp - Traffic generator
core/TrafficController.cpp - State display
core/TrafficController.cpp
Signal control
- Signal update
core/TrafficController.cpp - Lane scheduler
core/TrafficController.cpp
Traffic model
- Lane state
models/Lane.cpp
Other components
- Process start
Connections 9
- Process start → Simulation driver: starts
README.md - Simulation driver → Traffic generator: starts thread
main.cpp - Simulation driver → Signal update: updates signals
main.cpp - Simulation driver → State display: displays state
main.cpp - Traffic generator → Lane state: adds cars
core/TrafficController.cpp - Signal update → Lane scheduler: selects lane
core/TrafficController.cpp - Lane scheduler → Lane state: reads priority
core/TrafficController.cpp - Signal update → Lane state: passes cars
core/TrafficController.cpp - State display → Lane state: reads state
core/TrafficController.cpp