Traffic Simulation


The following demo simulates traffic flow using Java programming language. It takes advantage of multithread, a unique feature function in Java. In particular, three threads operate concurrently to represent (1) the cars, (2) the traffic flow volume and (3) the traffic lights, respectively. More important is that network-oriented Java is able to link information of real-time traffic flow from different locations, which can be used to predict and broadcast short- and long-term traffic status. (you need Netscape 2.0 or above to view the simulation.)

The above demo is based on a simple traffic-flow model. However, the program can be easily extented to other comprehensive models. For instance, multiple traffic lanes are possible by adding a few changes into the program, so are different speeds for individual cars. In the current model, the number of the car on each road is assigned arbitrarily when the program starts (it could be linked to any data source via. network). You can relocate a car from one road to another by dragging it with your mouse. Occasionally, moving a car by hand might result in a pause. To continue, just drag a car into the intersection, traffic will resume. Buttons 'Stop Sign' and 'Traffic Light' allow you to switch between two traffic modes - stop-sign control or traffic-light control. Button 'New Schedule for Lights' allows you to change the period of all three traffic lights as a whole.

This applet is developed by Kelly Liu.

The source.

My home page.