Example 2: Building a simple traffic scenario

The example on this page shows the simple steps to build traffic scenarios with SMARTS. In the example, we want to simulate traffic that moves towards a sports venue from all directions. You can use the standalone version of SMARTS to replicate the example.

First, let us download the road network around MCG, which is a major sports venue in Melbourne. You can use the steps described in Example 1: Simulating traffic in an arbitrary area around the world to download the data. You can also get the compressed data file from here.

Now, we define a source area and a destination area for random vehicles. A random vehicle moves from a source area to a destination area. To define a source/destination area, place mouse pointer to the top-left corner of the area. Press and hold the left mouse button to drag a rectangular window. Once the mouse button is released, you can choose the appropriate option from a popup menu. As shown in the screenshot, the source area has been defined. There is a label, S, attached to the area. A smaller area covering the sports venue has been drawn. This small area will be the destination area. The popup menu is shown. You can choose Set as destination to set the area as the destination area.

The following screenshot shows the simulation with the settings shown above. The number of random vehicles is 5000. Background map image is hidden for a clear view of the road network. The vehicles are generated uniformly at random in the source area. All the vehicles are travelling towards the destination area, which is marked with a letter, D.

You can define an arbitrary number of source/destination areas. For example, you can define multiple source areas around a city and multiple destination areas in the city. The areas can overlap with each other.

Removing a source/destination areas can be done in a few steps. First, move mouse pointer to the edge (the dashed line) of an existing source/destination area. Click the left mouse button. A popup menu will be shown. Select Remove source/destination window to remove the area.

In addition to defining source/destination areas, you can also add/remove traffic lights during setup. Once the simulation is started, you can block traffic lanes in case you want to examine the impact of certain road incidents. More details about these operations can be found in Using SMARTS as a Standalone Program.