Giter Site home page Giter Site logo

raviq / simultra Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 8.0 82.17 MB

Multiagent hybrid simulator of road traffic in Qt/C++ and OpenStreetMap.

License: GNU General Public License v3.0

Makefile 2.68% C++ 92.70% QMake 0.07% C 1.32% Shell 3.23% M4 0.01%
traffic-simulation traffic-simulator distributed-systems agent-based-simulation agent-based-modeling agent-based-framework agent-based-architecture multiagent-systems complex-systems congestion-control

simultra's Introduction

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]

simultra's People

Contributors

raviq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.