This page was automatically generated by NetLogo 5.0.3. The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

powered by NetLogo

view/download model file: trafficHexCA.nlogo


This is model of city traffic based on elementary cellular automata (ECA) on an hexagonal grid.
More info at


Click on “Setup” and then on “Go” or “Step”. The controls above these buttons should be set before “Setup”, the others can be changed anytime.

SCENARIO Loads default scenarios, choose “custom” for testing alternative scenarios.

GRID-SIZE-X and GRID-SIZE-Y determine how many streets will be with each orientation (vertical and horizontal). Use GRID-SIZE-X=0 for freeway model (Rule 184), i.e. no intersections.

SIX-DIRS? If true, streets flow in six directions (alternating).
***Notice that if this is true, the nubmer of streets in x and y should be even, otherwise there are problems with boundary conditions…

DENSITY. Determines probabilistically how many cells are occupied by vehicles.

%VERTICAL Determines probabilistically the percentage of cars on vertical streets (complementary to horizontal ones)

METHOD. Choose between following methods:
“Marching”: all lights march in step, either vertical or horizontal
“Green-wave”: Lights are synchronized so that vehicels flowing eastbound or southbound would not need to stop (at a flow speed of 1)

The next parameter affects the marching or green wave methods

P Duration of a green light, i.e. half a period (T/2). To avoid stopping of vehicels, set this equal to half the length of the street or equal to a factor of half the length of the street.

The following parameters affect the self-organizing method. See paper for a description.



MINGREEN (t_min)





The Velocity plot shows the percentage of vehicles moving, i.e. if v=1, no vehicle stops, and if v=0, all vehicles are stopped.

The Flux plot shows the velocity multiplied by the density. In the rule 184 model of highway traffic (i.e. no intersections, grid-size-x = 0), the maximum possible flux is $J=0.5$, at a density $rho=0.5$. This is because vehicles need at least one cell between them to move. If there are less vehicles, the flux will be lower, since there is no movement in free space. If there are more vehicles, then the flux will also be lower, since stopped vehicles do not move.


The green wave method works fine for only two directions. However, when vehicles flow in six directions, the performance is relatively bad, because vehicles going opposite to the green wave face anti-correlated lights.

The self-organizing mehtod can achieve free flow in six directions for low densities.

At which densities each method reaches a gridlock (flow=0)?

See how performance varies as more streets are added (for different methods).


Gershenson, C. & D. A. Rosenblueth (2012). Self-organizing traffic lights at multiple-street intersections. Complexity 17(4):23-39. doi:10.1002/cplx.20392

Based on:

About ECA:

Carlos Gershenson's homepage