GithubHelp home page GithubHelp logo

movsim / traffic-simulation-de Goto Github PK

View Code? Open in Web Editor NEW
969.0 969.0 142.0 31.54 MB

Source code for javascript simulation of website

Home Page: http://www.traffic-simulation.de

License: GNU General Public License v3.0

CSS 3.30% JavaScript 74.90% HTML 20.56% Shell 1.09% Gnuplot 0.15%

traffic-simulation-de's Introduction

MovSim

Movsim == Multi-model open-source vehicular-traffic Simulator

Current build status for branch Master: Build Status Master

Current build status for branch develop: Build Status Bidirectional

Quick links to this file:

Description

MovSim is a microscopic lane-based traffic simulator with xml-based configuration and csv text output. The simulator implements various car-following models and provides reference implementations for the models described in the textbook Traffic Flow Dynamics.

MovSim aims at modeling and simulating all basic traffic situations and discrete decision like lane changes, reacting to a traffic light, yielding and overtaking on rural roads. Lane changes are modeled with the general MOBIL strategy based on longitudinal accelerations which is applicable to other discrete decisions as well.

MovSim can be run from commandline or with a graphical user interface including visualization. Several output quantities can be written to file for further in-depth analysis. MovSim also provides a physics-based fuel-consumption model to calculate consumption on an individual or collective level.

Features:

  • multi-lane simulator including onramps, offramps, "flow-conserving bottlenecks" and traffic-lights
  • multiple models of different model classes (car-following models, coupled-map models and cellular automata)
    • Intelligent Driver Model (IDM) Paper, Wikipedia
    • Enhanced IDM/Adaptive Cruise Control Model Preprint
    • Optimal Velocity or Bando Model
    • Velocity Difference Model
    • Gipps Model Wikipedia
    • Krauss Model
    • Nagel-Schreckenberg Cellular Automaton Wikipedia
    • Kerner-Klenov-Wolf Cellular Automaton
  • general lane-changing model MOBIL Paper
  • detailed physics-based model for fuel consumption and emissions Paper and Book
  • drivers' behavioral models
  • text-file output of detectors, spatiotemporal fields, floating-car data etc.
  • road network description by the opendrive.org standard

Submodule Components:

  • The core contains the main MovSim library and a console application that can run a traffic simulation and produce .csv output for further processing or graphical display.
  • The viewer displays an animated traffic simulation.
  • The consumption comprises a physics-based fuel consumption model which can also be fed by csv data.
  • The xsd module comprises the xsd schema resources for the xml bindung (JAXB)
  • The common provides general functionality for all submodules.

Documentation

A mathematical description of the models as well as the basic simulation and evaluation concepts can be found in the book Traffic Flow Dynamics by Treiber/Kesting. A good starting point is the free chapter about Car-Following Models based on Driving Strategies.

Documentation by example can be found in the sim directory.

Installation

Install the git version control system and clone the repository via ssh

git clone [email protected]:movsim/movsim.git

or via https (to prevent firewall problems)

git clone https://github.com/movsim/movsim.git

Java is required at least in version 8 (JRE 1.8).

Apache Maven is the software build and management tool for MovSim.

MovSim produces csv/text-based output that can be plotted using gnuplot or other tools.

Usage

To build MovSim, type mvn install from the main MovSim directory.

To run the movsim core or viewer see their respective readme files: core and viewer.

Development

We follow the naming conventions of the Git Flow Model. Please checkout the branch develop to start with the latest source code.

Demos

There are a number of simulation scenarios defined in the sim directory.

Movsim can not only used for simulating road traffic but has been used to model a cross-country skiing race Youtube.

Commercial use

For commercial use, please contact the copyright holders at [email protected]

Copyright and License

MovSim is Copyright (C) 2010-2016 by Arne Kesting, Martin Treiber, Ralph Germ, and Martin Budden.

MovSim is licensed under GPL version 3.

For general questions use the contact at [email protected].

References

[1] M. Treiber and A. Kesting. Traffic Flow Dynamics, Data, Models and Simulation. Springer 2013.

[2] A. Kesting, M. Treiber, and D. Helbing. General lane-changing model MOBIL for car-following models. Transportation Research Record, 86-94 (2007). Paper

[3] A. Kesting, M. Treiber, and D. Helbing. Enhanced intelligent driver model to access the impact of driving strategies on traffic capacity. Philosophical Transactions of the Royal Society A, 4585-4605 (2010). Preprint

[4] A. Kesting, M. Treiber, and D. Helbing. Agents for Traffic Simulation. Chapter 11 in "Multi-Agent Systems: Simulation and Applications", 325-356 (2009). Preprint

[5] M. Treiber, A. Kesting, and D. Helbing. Delays, inaccuracies and anticipation in microscopic traffic models. Physica A: Statistical Mechanics and its Applications 71-88 (2006). Preprint

[6] M. Treiber, and A. Kesting. An open-source microscopic traffic simulator. IEEE Intelligent Transportation Systems Magazine, 6-13 (2010). Preprint

traffic-simulation-de's People

Contributors

akegermany avatar folding avatar movsim avatar mtgermany 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  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  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  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

traffic-simulation-de's Issues

collecting data

can we collect data (flow and speed) in other files using sublime text?

Modify simulation interval dt

This is indeed a great thing.
I want to use this simulation of stop and go traffic waves to obtain the trajectory of vehicles, but I found that the output trajectory interval is not regular (dt fluctuates between 0.67 and 1.33). I want to obtain an interval dt of 0.01, how to set it?

Range of velocities

Are the vehicles too "perfect"? They all accelerate to the same speed and maintain the speed. Should there be more random behavior?

Findleaderatlane

For the function findleaderatlane, it seems to step through vehicles and choose the last. How do we know this is the nearest? Seems like it should compute the distance and then check if the distance is minimum?

userCanDistortRoads

If I set userCanDistortRoads to true, I can drag the road freely, but it is reset as soon as I refresh. Is there anything I can do to save the changes I made to the road on the page

limiting deceleration

I wanted to limit the deceleration to physically reasonable values?
Is this the way to do it? Did not seem to limit the deceleration as desired.
I put it in road.js after the vehicle is created.
Thx

if (vehNew.type=="car")
{
vehNew.longModel.bmax = 5/3.6;
}
else
{
vehNew.longModel.bmax = 0.5/3.6;
}

Addition of the cacc following model

Greetings, Dr. MT. Firstly,This is a great job for you.
Secondly, I am going to replace the default following model(IDM and ACC model), I added the CACC code in the model.js file, but I'm not sure if I configured it correctly in the other files and enabled it successfully.
I am preparing to implement the vehicle CACC model in the ring.js file. Below is my configured CACC model code, I hope I can get your answer. Thanks!

//#################################
// CACC model
//#################################

/**
CACC (Cooperative Adaptive Cruise Control) constructor

@param v0: desired speed [m/s]
@param T: desired time gap [s]
@param s0: minimum gap [m]
@param a: maximum acceleration [m/s^2]
@param b: comfortable deceleration [m/s^2]
@param delta: headway time constant [s]
@param alpha: cooperative parameter [1/s]
@return: CACC instance (constructor)
*/

function CACC(v0, T, s0, a, b, delta, alpha) {
this.QnoiseAccel = QnoiseAccel; // m^2/s^3
this.driverfactor = 1; // if no transfer of driver individuality from master veh
this.v0 = v0;
this.T = T;
this.s0 = s0;
this.a = a;
this.b = b;
this.delta = delta;
this.alpha = alpha;
this.alpha_v0 = 1; // multiplicator for temporary reduction

// possible restrictions (value 1000 => initially no restriction)
this.speedlimit = 1000; // if effective speed limits, speedlimit<v0
this.speedmax = 1000; // if engine restricts speed, speedmax<speedlimit, v0
this.bmax = 18; // (2022) was=16
}

/**
CACC acceleration function

@param s: actual gap [m]
@param v: actual speed [m/s]
@param vl: leading speed [m/s]
@param al: leading acceleration [m/s^2] (only for common interface; ignored)
@return: acceleration [m/s^2]
*/

CACC.prototype.calcAcc = function (s, v, vl, al) {
var accRnd = s < this.s0 ? 0 : Math.sqrt(this.QnoiseAccel / dt) * (Math.random() - 0.5);
return accRnd + this.calcAccDet(s, v, vl, al);
};

CACC.prototype.calcAccDet = function (s, v, vl, al) {
var v0eff = this.v0 * this.driverfactor * this.alpha_v0; // (MT 2023-11)
v0eff = Math.min(v0eff, this.speedlimit, this.speedmax);
var aeff = this.a * this.driverfactor;

var accFree = v < v0eff ? aeff * (1 - Math.pow(v / v0eff, 4)) : aeff * (1 - v / v0eff);
var sstar = this.s0 + Math.max(0, v * this.T + 0.5 * v * (v - vl) / Math.sqrt(aeff * this.b));
var accInt = -aeff * Math.pow(sstar / Math.max(s, this.s0), 2);

return v0eff < 0.00001 ? 0 : Math.max(-this.bmax, accFree + accInt);
};

// Example Usage:
// var caccModel = new CACC(30, 1.5, 2, 2, 1, 1, 0.1);
// var acceleration = caccModel.calcAcc(s, v, vl, al);

Library / Wrapper for offline use?

We came across your software searching for ways to investigate the propagation of traffic waves.
The model needs to run offline, coupled to Python to interface AI toolkits.
Of course we would like to avoid a complete rewrite in Python :)

Maybe it is possible to run your code on the sever-side using NodeJS and interface somehow to inject and export data into the model.

Do you know what could be a good way to do this? Is there maybe a C library available that we could wrap? I found some rather simple implementations of IDM in Python that seem to be derived from your JS code, but they won't do.

Adding functions

Where can I add parameters like the distance between vehicles or the time it takes a car to start driving after the car in front of him did?

Thank you

onramp_BaWue_ger.html not working

On this page, i get this error :
Failed to load resource: the server responded with a status of 404 (Not Found) : control_gui_ger.js:1

This file doesn't exist on your github.

Can you help ?

record flow of traffic in a time period

Hello Dr. Treiber,

I'm working on a project and was wondering if there was a way to record the flow of traffic at the detectors.

I would like to record the flow value every 60 seconds for an hour to give me 60 data points that I require for my investigation.

Is there any way to do this automatically, as opposed to manually noting the flow at the specific times?

I will of course credit <traffic-simulation.de> in my work.

Kind Regards

Slider default "value" vs. "position" default mismatch

Sliders have a default "position" to the far left, but their default "value" does not always correspond to the minimum possible value that slider can take.
E.g. On the "Ringroad" simulation, the "Timewarp" slider position defaults to the far left, but the default "value" is "8 times", even though the minimum "value" is "0.1 times".

This produces a sub-par UX in my opinion, where the solution should be that the "value" and "position" of the sliders are always in sync and not just after the slider has been moved.

Weird circulation

Setting up the parameters as in the image below
IMAGE 2019-04-16 11:42:42

results in weird circulations of traffic.
image

Error with Latest download

Hi, I have downloaded the latest version of this project and it's giving me an error while running the project. I am researching on traffic-simulation and it would be a great help if you can provide me with the bug-free code. Thanks

Traffic signals

It would be awesome if the simulator would support traffic signals (static and dynamic ones).

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.