Large cities around the world face numerous challenges to guarantee the quality of life of its citizens. A promising approach to cope with these problems is the concept of Smart Cities, of which the main idea is the use of Information and Communication Technologies to improve city services. Being able to simulate the execution of Smart Cities scenarios would be extremely beneficial for the advancement of the field. Such a simulator, like many others, would need to represent a large number of various agents (e.g. cars, hospitals, and gas pipelines). One possible approach for doing this in a computer system is to use the actor model as a programming paradigm so that each agent corresponds to an actor. The Erlang programming language is based on the actor model and is the most commonly used implementation of it. In this paper, we present the first version of InterSCSimulator, an open-source, extensible, large-scale Traffic Simulator for Smart Cities developed in Erlang, capable of simulating millions of agents using a real map of a large city. Future versions will be extended to address other Smart City domains.
The main requirements addressed by InterSCSimulator are:
City Road Network Definition: A Smart City simulator has to represent the city road network in a model easy to manipulate algorithmically. A good approach is to create a digraph based on the city map, which can be acquired from many different services such as Open Street Maps (OSM) or Google Maps. The model used must allow large scale simulations with millions of vehicles.
Trips Definition: It is necessary to define all the trips that will be performed during the simulation. To implement this we have two alternatives: creating a tool to generate random trips or converting an origin-destination matrix (when available) for the city we intend to simulate.
Vehicles Simulation: All traffic simulators must use a car model to calculate the speed of the cars. There are many models available in the literature, from the simple free model to complex models.
Output Generation: The simulator must generate different outputs to allow the analysis of the results of the simulation. The most common approach is to generate a file with all the events occurred in the simulation, allowing the development of visualization and statistical tools.
Besides the functional requirements, a Smart City simulator also must meet the following non-functional requirements:
Scalability: To simulate Smart City scenarios, it is necessary to manage millions of actors such as cars, people, buildings, and sensors. Therefore, the simulator scenarios have to scale from hundreds to millions of actors. To achieve this, distributed and parallel simulations are almost mandatory.
Usability: Creating descriptions of simulated scenarios for the simulator should be easy, enabling people with no knowledge of the internal implementation of the simulator to develop scenarios with little effort. Thus, the programming model has to be intuitive and independent of the internal implementation of the simulator.
Extensibility: It is unlikely that a simulator will provide all required features for Smart City simulations. The simulator has to be easily extensible, offering simple mechanisms for implementing new actors and changing their behavior, for implementing new metrics, and for the modification of the behavior of the simulator itself. So, it is important not only that the simulator be open source, but also well documented and implemented with high quality, extensible code.
InterSCSimulator has four main components: the Scenario Definition that receives the input files and creates the city graph and first vehicles; the Simulation Engine that executes the simulation algorithms and models and generates the simulation output; the Map Visualization that receives the simulation output and creates a visual visualization of the city map and the movement of the vehicles; finally, the Chart Visualization that also receives the simulation output and generates a series of charts with information about the simulated scenario.
Simulation of São Paulo (Map and OD matrix)
Simulation using the map of New York
In this video each color represents actors that are doing different actions such as going to work, going home or going to a hospital.
This video shows a zoom in the downtown São Paulo, mainly the Radial Leste avenue.