In a previous post, I talked about the Stochastic Traffic Cellular Automaton. I am finally going to post some simulations of this method. If you want to see the code, please leave a comment.
In this simulation, I will be modeling the traffic flow of an intersection when a green light turns red. From personal experience, you know that traffic will slowly get backed-up behind the red light. This can be described as a shock wave.
In Chapter 5 in Mark Holmes book “Introduction to the Foundations of Applied Mathematics”, he sets-up the exact same problem. If you want more details on the problem, you can download the chapter for free on his website.
In my simulation, I have discretized the road into 1000 segments and evenly distribute 250 cars as the initial data. I then set the max speed
to 2 and the probability to slow-down
to .25.
The following picture shows you how the simulation ran. Each row (left to right) represents the entire road where the black spots represent cars. As you move down, you will see how the road changed for each time-step. It might take you some time to make sense of the picture.

As you can see, the traffic on the right hand side starts to pile-up more and more as time goes on. This can be easily seen by the following movie.
The top plot shows the simulation for the Stochastic Traffic Cellular Automaton model. The plot below it shows the exact solution to the continuous Lighthill-Whitham PDE Model which I described in my poster presentation. As you can see, the two models behave very similarly.
Lastly, I ran the simulation 10,000 times. After running the simulations, I calculated the probability that a car exists in a particular road segment. This created a traffic density curve similar to the Lighthill-Whitham model which is shown in the following video.

