140 likes | 223 Vues
Lynn Jepsen. Traffic Light Simulation. Introduction and Background. Try and find the most efficient way to move cars through an intersection at different traffic densities Want to see waiting time and queue length go down Green light usage needs to go up
E N D
Lynn Jepsen Traffic Light Simulation
Introduction and Background • Try and find the most efficient way to move cars through an intersection at different traffic densities • Want to see waiting time and queue length go down • Green light usage needs to go up • Many traffic simulations out there, but none that I have seen with a learning light
Hierarchy Light Algorithm Traffic Light Stores four directions Simulation Stores multiple lanes Direction * Changes lanes for Cars* Lane Stores Cars (can't overlap) Deals with green/red/yellow light Car Remembers and Changes speed Remembers space
Simulation • Cars on each lane take up a certain number of spaces and have a certain speed at each instant • Speed and space is update every .1 sec along with graphics • Speed up when object in front is getting farther away but with a max. accel. • Slow down for red and most yellow lights • Use Java to show graphics
Light Algorithm (variables) • Wants to optimize efficiency • This is defined as queue length, wait time and green light usage • Independent variables are traffic density, cycle length (length of one cycle in intersection) and ratio (ratio of green light time in each direction) • Can NOT change traffic density
Light Algorithm • Uses previous data (past ten cycles) • Matching traffic density • Finds out which cycle had the smallest wait time, queue length, and greatest green light usage • Later averages all three cycles • Does the same for ratio • Looking for the best combination • Some randomness to match randomness of the road • Should begin to hover around one combo
Graphs • graph all three efficiency variables • north/south line and an east/west line • if the algorithm is really optimizing the intersection then the two lines are close to each other
Efficiency • The intersection can only be so efficient • If there are just too many cars for the number of lanes, then the algorithm will not work as well as it would in a lighter traffic density • This is not an exact science. There are too many variables in effect here • Traffic flow is just too erratic to predict well • You can’t possibly minimize wait time to the point where no one waits
Results and Conclusions • The simulation looks realistic • Light algorithm does cause fewer backups • Not perfect, but it keeps things under control and doesn't allow huge spikes