Example 1: Simulating traffic in an arbitrary area in the world

Any traffic simulation in SMARTS requires a road network. The simulator builds road networks based on OpenStreetMap data, which covers most parts of the world. There are two ways to get OpenStreetMap data with SMARTS. One is using a map downloading feature to download the data within SMARTS. Another is loading an existing OpenStreetMap file into the simulator.

This example demos how to quickly set up simulations based on OpenStreetMap. You can use the standalone version to try this example. In this example, we want to simulate traffic in a Sydney area. As we do not have the road network data for that area, we are going to download the data within the simulator. The steps are as follows.

  • Launch the standalone version of SMARTS.
  • Click Map in the control panel to show the options relevant to road maps.

  • Select Australia from the list of areas, as shown in the screenshot. Then click Locate.
  • Check the “Show map image in background” option to display background map. Please note that this option has been changed to “Show place names from GeoNames.org” from Jan 2020 as OpenStreetMap imposed some limitations of accessing map images from their servers. 
  • Use left-hold-and-drag to define a window that covers the area of interest. Once you release the mouse button, a menu will popup. Select Download road network from the menu.
  • The downloading progress will be constantly updated in the top-left corner of the interface. Once downloading is completed, the downloaded data is saved to download.osm, which is in the same directory of the simulator. Choose Yes in the confirmation window and load the road map from the downloaded data.
  • Now you can set other simulation parameters in the control panel. For example, we set the number of random private vehicles to 1000 while leaving other settings at their default values. Click Run Simulation to start the simulation. A screenshot of the simulation is shown below.

You can rename download.osm or move it to another directory as this file is rewritten each time OpenStreetMap data is downloaded within SMARTS. If you want to simulate traffic in the same area in the future, you do not have to download it again. Instead, you can import the OpenStreetMap file into SMARTS. To import such a file, simply click Import roads from OpenStreetMap file in the Map section on control panel and follow the prompts. Please note that you can also import OpenStreetMap files that you downloaded or edited with other websites/tools.