Skip to content

Latest commit

 

History

History
257 lines (190 loc) · 9.36 KB

README.md

File metadata and controls

257 lines (190 loc) · 9.36 KB

simultra

Simultra

A multiagent simulator of road traffic

Build Status License: GPL v3

Table of Contents

Description

Simultra is an open-source, hybrid road traffic simulator designed to handle large roadmaps in real-time. It combines microscopic and mesoscopic simulations into one multiagent hybrid simulator. The large-scale maps are modelled mesoscopically in real-time, and the complex traffic interactions benefit from detailed agent-based microscopic simulations. To resolve the concurrency issues within the maps representation and the meso-micro transitions, Simultra combines an event-based mesoscopic model of the maps with a more detailed physical engine.

Features

  • Programmable agents that can emulate vehicles, drivers and intelligent traffic signals.
  • Realistic map rendering using OpenStreetMap.
  • Precipitation rendering on top of the traffic simulation layer.

Watch this simulation video from AAMAS 2016.

Architecture

Prerequisites

Building

Project structure

Simultra/
│   README.md                    // This file
│   LICENSE.md                   // GNU GENERAL PUBLIC LICENCE (v3)
│   simultra.pro                 // Required by qmake to build the project
│   Makefile                     // Automatically generated makefile
└───kore/                        // Core of the simulator
|       *.h *.c *.cpp
└───gui/                         // UI of roads, vehicles, traffic, etc.
|   |   *.h *.cpp *.ui
│   └───images/                  // Image manipulation routines
|       *.h *.cpp
└───build/
|   |   simultra.app             // The simulator
│   └───obj/
|       *.o moc_* ui_* qrc_*
└───resources/
│   └───config/                  // Configurations and simulation scenarios
│   └───RadarImages/             // Precipitation images
└───utils/
        *.h *.c *.cpp            // Debug, log, geometrical calculations, etc.   
│      
└───mapgraphics/                 // Required to build/link to libMapGraphics
│      
└───readosm/                     // Required to build/link to libreadosm

To build MapGraphics and generate libMapGraphics run

cd mapgraphics/
qmake MapGraphics.pro
make

To build readosm and generate libreadosm run

cd readosm/
make

To build simultra run

qmake simultra.pro
make

Usage

To configure and run a simulation you need to work on a number of files in config/.

  • Start by downloading the map of the area you are interested in from osm.org and name it map.osm .
  • Set the map topology in simx_map.xml.
  • Set the simulation scenario in simx_simulation.xml by specifying the vehicles and itineraries:

For each vehicle, we need to specify an XML entry:

<Vehicle type="TypeX">
  <Location>450 440</Location>
  <Direction>0</Direction>
  <Driver type="Slow1">
    <Lane>
      <Intersections>A B C D E</Intersections>
    </Lane>
  </Driver>
</Vehicle>

which contains the initial position of the vehicle, its orientation, driver type, and the intersections that define the itinerary of the driver.

  • Set the types of the vehicles and the divers in types.xml. An example of vehicle type specifies the mass, wheelbase, force, and the look of the vehicle:
<VehicleType name="TypeX">
  <Image>:/images/bluecar.png</Image>
  <Mass>1800.0</Mass>
  <Wheelbase>1</Wheelbase>
  <MotForce>5000</MotForce>
</VehicleType>

The driver type specifies the velocities of two angles (straight and turn) which will later be used in the behavioural model. Example:

<DriverType name="SlowType">
  <TurnVelocity>2</TurnVelocity>
  <StraightVelocity>12</StraightVelocity>
</DriverType>
  • Set the radar images in RadarImages/ for the precipitation simulation. Current build comes with examples of .gif images from the Japan Meteorological Agency.

  • It is important to set some of the parameters in config.h.

Now, running the simulator should give something like:

with

1. Play/Pause simulation. 11. Moving the map.
2. Stop simulation. 12. Adding precipitations.
3. Simulation clock. 13. About Simultra.
4. Shows the OSM view of the simulation. 14. Simulation area.
5. Shows the physical view of the simulation. 15. Order of the layers and rendering opacity.
6. Zoom (OSM Map). 16. Simulation components.
7. Zoom (Physics engine Map). 17. Vehicle's forces. Works in physical view.
8. Increase/Decrease vehicle size. 18. Flow parameters.
9. Center the map in one particular point (specified in config.h). 19. Traces, mobility data, etc.
10. Pedestrian mode. 20. Main view window.

What you can do

  • Zoom in/out, either with the mouse or button 6.
  • Drag the map in different directions by clicking on button 11 and using the mouse.
  • Start the simulation using button 1.
  • Go through the mobility data in area 19.
  • Set zoom scale to 6 and press button 12 to see how precipitation clusters change on top of the map.
  • Press button 13 to shown some information about Simultra.
  • Alternate layers in area 15 using the up and down buttons.

etc.

Integration in other projects

Simultra was used in other project either directly or after some changes on its design and code.

  • As a pipelined distributed architecture (project)

Improvements

  • There are currently too many configuration files. They can be either generated automatically in a pre-simulation phase or integrated in one JSON file (config.h too). Another way to avoid the heavy configuration is to randomly assign vehicles to the existing (OSM) paths. The assignments could be parametrised using some vehicle-per-lane distribution. Another option is to drag and drop vehicles on the OSM map.
  • Integrate traffic lights with OSM maps.
  • The precipitation data could in principle be acquired dynamically using some weather API.
  • Improvements on the (lat, lon) from/to (x, y) conversions.
  • Combining readosm and json.c.
  • More testing..

Contribution

Comments, feedback and ideas are welcome. If you find this project to be of any use, please let me know. If you find bugs or omissions in the code or documentation, please do not hesitate to submit an issue or open a pull request with a fix. Thank you.

Citation

Takayuki Ito, Takanobu Otsuka, Teruyoshi Imaeda, and Rafik Hadfi. "An Implementation of Large-Scale Holonic Multi-agent Society Simulator and Agent Behavior Model." Pacific Rim International Conference on Artificial Intelligence. Springer, Cham, 2018.

Rafik Hadfi, Masayuki Hayashi, and Takayuki Ito. "A pipeline multiagent architecture for road traffic simulation." Proceedings of ITS World Congress. 2017.

Rafik Hadfi and Takayuki Ito. "Multilayered Multiagent System for Traffic Simulation." Proceedings of the 2016 International Conference on Autonomous Agents & Multiagent Systems. International Foundation for Autonomous Agents and Multiagent Systems, 2016.

Rafik Hadfi and Takayuki Ito. "Holonic multiagent simulation of complex adaptive systems." International Conference on Practical Applications of Agents and Multi-Agent Systems. Springer, Cham, 2016.

License

This software was developed in the hope that it would be of some use to the AI community, and is freely available for redistribution and/or modification under the terms of the GNU General Public Licence. It is distributed WITHOUT WARRANTY; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.

(c) 2016-2018 Rafik Hadfi, [email protected]