Code Monkey home page Code Monkey logo

trafficflowdynamicsmodel's Introduction

Traffic Flow Dynamics Model

version license docs

A C++ library for generating traffic flow dynamics data using a reference model.

This project is part of a three-year thesis work for the Physics course at the Alma Mater Studiorum - University of Bologna.

Table of contents

  1. Citing
  2. Abstract
  3. Download
  4. Testing
  5. Compiling
  6. Data

Citing

If you use my code, please cite my work:

Berselli, Gregorio (2022) Modelli di traffico per la formazione della congestione su una rete stradale. [Laurea], Università di Bologna, Corso di Studio in Fisica [L-DM270] http://amslaurea.unibo.it/view/cds/CDS9244/

@phdthesis{amslaurea26332,
author = {Gregorio Berselli},
title = {Modelli di traffico per la formazione della congestione su una rete stradale},
url = {http://amslaurea.unibo.it/26332/},
year = {2022}
}

Abstract

English

Beginning in the 1950s, numerous models were developed with the intent of studying the traffic related phenomena. Some of them managed not only to explain the phenomena for which they were designed but highlighted other typical characteristics of dynamical systems, such as the presence of hysteresis loops and changes in distribution of travel times in congestion situations. This work aims to verify the validity of a simplified model designed for highlight the typical behaviors of a traffic system, in particular congestions that are created on the road network. This model is implemented by the C ++ Traffic Flow Dynamics Model library. For the analysis, the study uses Macroscopic Fundamental Diagrams, particular diagrams that relate the main observable of a road network such as velocity, density and flow. By varying the load introduced into the road network it is possible to study the system in different regimes: constant load, peaked load and periodic load. Through these studies, different properties typical of each regimen emerged and, for some of these, the presence of one or more hysteresis cycles has been verified and justified. Lastly, a brief ad-hoc analysis was carried out aimed at highlighting the changes in the distribution of travel times in relation to the traffic regime considered.

Italiano

A partire dagli anni ’50 furono sviluppati numerosi modelli con l’intento di studiare i fenomeni connessi al traffico. Alcuni di essi riuscirono non solo a spiegare i fenomeni per i quali erano stati ideati ma misero in evidenza altre caratteristiche tipiche dei sistemi dinamici, come la presenza di cicli di isteresi e cambiamenti nella distribuzione dei tempi di percorrenza in situazioni di congestione. Questo lavoro si propone di verificare la validità di un modello semplificato ideato per evidenziare i comportamenti tipici di un sistema di traffico, in particolare le congestioni che si vengono a creare sulla rete stradale. Tale modello viene implementato per mezzo della libreria C++ Traffic Flow Dynamics Model. Ai fini dello studio vengono utilizzati i Diagrammi Fondamentali Macroscopici, particolari diagrammi che mettono in relazione gli osservabili principali di un network stradale quali velocità, densità e flusso. Variando il carico immesso nella rete stradale è stato possibile studiare il sistema in diversi regimi: carico costante, carico piccato e carico periodico. Mediante questi studi sono emerse diverse proprietà tipiche di ogni regime e, per alcuni di essi, è stata verificata e giustificata la presenza di uno o più cicli di isteresi. In ultimo è stata effettuata una breve analisi ad-hoc volta a evidenziare i cambiamenti nella distrubuzione dei tempi di percorrenza in relazione al regime di traffico considerato.

Download

You can obtain the library downloading the src directory from the repository.

Otherwise, you can directly download a release.

Compiling

To use the library correctly it's better to include at least the Graph and Vehicle headers:

#include "./src/Graph.hpp"
#include "./src/Vehicle.hpp"

also, remember to link all the .cpp files when compiling your main, for instance:

g++ -std=c++20 -O3 ./main.cpp ./src/Graph.cpp ./src/Street.cpp ./src/Vehicle.cpp ./src/VehicleType.cpp

You can also try to work with the original main.cpp used for the report, building using the make file, like:

make linux

or:

make windows

Then, you can run the analysis you want to perform with the command make and one option (constant, peaked, periodic, traveltime). Make sure to uncomment all the necessary and comment the unnecessary into the main file before compiling it.

An easier approach is to run the library on Python keeping the optimization level given by C++. To make this you have to make the binding of the code on your personal environment.

To do so, in the main folder you can just run:

./build.sh

Then you can run any simulation done in the report running the example.py script with one option (constant, peaked, periodic, traveltime), for instance:

python3 example.py peaked

Testing

The test for all the classes are into the test.cpp file. To execute them, just run:

make test

Notice that these tests use doctest.

Data

Once run the simulation you can print data in two formats:

  1. latex, which prints data in a format readable by the package pgfplots of LaTeX;
  2. root, which prints data in a format readable by the C++ framework Root, developed by CERN.

There is also a way to visualize the network in which the streets change color based on their vehicle density. To do that there is a Python script, visual.py that prints a PNG file of an arbitrary instant of time. With this script you can also merge different PNG files into a unique GIF file, obtaining an output like this:

trafficflowdynamicsmodel's People

Contributors

grufoony avatar sbaldu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sbaldu

trafficflowdynamicsmodel's Issues

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.