VENUS: VEhicular Network Universal Simulator

Participants: Hongzi Zhu, Jiangang Shen, Yunxiang Cai, Yasheng Wang

Sponsors: LION

Microscope traffic and VANET simulator

PDF

Introduction:


VENUS (VEhicular Network Universal Simulator) is a microscope traffic and VANET simulator and consist of three main components:


maptuner: generate electronic map which can be visualized and used for traffic


mapviewer: visualization of electronic map, generate and visualize traffic flow


trace_generate: generate vehicle traces without visualization


Here is source code: link

Here is detailed document:

We will introduce VENUS in three part: 1. Data Structure 2. File Organization 3. Usage


Part I: Data Structure:

1. Basic Data Structure:

Struct Item stores the information of a pointer to any data type:

struct Item
{
  void *datap;
  struct Item *prev;
  struct Item *next;
};
Struct Duallist organizes several items to a bi-directional linked list:

struct Duallist
{
  struct Item *head;
  unsigned long nItems;
};
The relationship between Struct Item and Struct Duallist can be shown with the figure below:



Structure of Duallist


2. Simulation Data Structure:

Organization of simulation data structure used in VENUS is shown in the figure below:


Organization of Simulation Data Structure


Struct Region stores information about the whole map, e.g., road, district, river, cross, etc.

Main content of Struct Region is shown below:


struct Region
{
  struct Polygon *chosen_polygon;    //polygon which describes the contour

  struct Duallist blocks;            //dual-list which stores all blocks

  struct Duallist roads;             //dual-list which stores all roads
  int roadNums;                       //total number of roads
  struct Duallist crosses;           //dual-list which stores all crosses
  int crossNums;                      //total number of crosses
  struct Duallist districts;         //dual-list which stores all districts
  struct Duallist rivers;            //dual-list which stores all rivers

};


Struct Road stores the information of a specific road, e.g., points which consist the road, road length, lanes on road, traffic light on road, etc. Main content of Struct Road is shown below:


struct Road
{
  int id;  //road ID

  struct Duallist origPoints;	     //origin data points of the road
  struct Duallist points;           //real data points of the road
  struct Duallist waittingV;  //vehicles waiting for generated on the road;
  
  double length;                     //road length
  int headEndAngle;                  //start angle of road
  int tailEndAngle;                  //end angle of road
  struct Cross *headEnd;            //start cross of road
  struct Cross *tailEnd;            //end cross of road
   
  struct Duallist lanes;           //lanes on road
  struct Duallist lane_lines;       //data points of lanes
  struct Trafficlight lights[3];  //traffic lights on road (turn left, forward, right)
};
Struct Lane stores the information of a specific lane on the road. The main content of Struct Lane is shown below:



struct Lane
{
  struct Duallist vehicles;   //vehicles on this lane
  struct Duallist Points;   //data points of this lane
  struct Duallist crossLanes;   //data structure connecting lane and other roads
  char type;    //first lane on road or not
  struct Road *onRoad;   //pointer to the road which this lane is located on
};
Struct Cross stores the information of a specific cross. The main content of Struct Cross is shown below:



struct Cross
{ 
  int number;  //cross id
  struct Point gPoint;  //coordinate of cross

  struct Duallist inRoads;  //roads which come in to the cross
  struct Duallist outRoads;  //roads which come out of the cross
};


Struct Vehicle stores the information of a specific vehicle. The main content of Struct Vehicles is shown below:


struct Vehicle
{
  
  int id;               // vehicle ID
  double position;	// distance to the start of road
  double v;		// speed
  double vmax;		// maximum speed
  double a;		// acceleration
  double b;		// deceleration
  double x;	    //  x coordinate
  double y;    //  y coordinate
  struct Lane *belongLane; // pointer to the lane which the vehicle is on
  struct Path *pathInfo;  // all roads from the start to the end of vehicle path
  struct Item *currentRoadItem;  // current road that vehicle is on
};

3. Trace Record Data Structure:

Struct Report stores the information of a specific vehicle at one timestamp:

struct Report 
{
  time_t timestamp;   //current timestamp
  struct Point gPoint;   //coordinate of the vehicle
  short speed;            //vehicle speed
  short angle;            //vehicle angle
  char state;             //vehicle type
  struct Trace* fromTrace;   //pointer to the trace which this report is on
};
Struct Trace stores a series of report, i.e, the trace of a specific vehicle:


struct Trace
{
  char vName[NAME_LENGTH];   //vehicle name/id
  struct Duallist reports;   //dual-list of vehicle report
  union Int_RGBO color;      //color of trace
  double oldx, oldy, oldangle;    //coordinate and angle of previous report
  int finished;                    //whether vehicle finishes its path
};
Struct Hashtable stores all the traces of the simulation:



struct Hashtable
{
  struct Item **head;   //entrance of hash table
  unsigned long size;   //size of hash table (number of row)
  unsigned long entries;    //size of filled row
  unsigned long count;      //number of data
  unsigned long (*hash_func)(void *);    //Hash function
  int(*equal_func)(void*, void*);        //compare function
};
The structure of Hash table is shown in the figure below:


Structure of Hash Table


Part II: File Organization:

Basic structure and function of source code:

Most important code files are located in ./common, ./geometry, ./GUI, ./trace these four folders.

./common: Realization of basic data structures like dual-list and hash-table, etc, and operations on these data structures like add and delete node from dual-list, etc. (common.h and common.c)


./geometry: Realization of basic struct used for map generation like Region, Road, River, Lane, Cross, etc,(geometry.h) and operations on these struct like generate or delete one Road/Region/Cross, etc. (geometry.c)

Source code of maptuner also locate in this folder


./GUI: Realization of GUI (visualization of map and traffic flow) with GTK toolkit (gtk_cairo.h and gtk_cairo.c) and events trigger when click a button (start/stop traffic flow, upscale/downscale map, etc). (events.h and events.c)

Source code of mapviewer also locate in this folder


./trace: Realization of traffic flow generation, struct of trace report/vehicles, etc, (trace.h) and operations on these structs like generate/delete one report (trace.c). One vehicle is set with a start cross and an end cross, a path between two cross is generated with a Shortest path finding algorithm. Krauss vehicle following model is utilized in VENUS and vehicles can automatically accelerate/decelerate/change lane due to different traffic situations. (mapsimulate.c)

Source code of trace_generate also locate in this folder



Part III: VENUS Usage:

Section I: maptuner

1. Usage:

./maptuner [-r "x1 y1 x2 y2 x3 y3..."] [-j scrapLength length]  [-c cell size] 
[-s districts.shp rivers.shp roads.shp roads.txt | -m source.map] 
[-e editmap.txt] output.map
-r: coordinate set of a polygon which is the contour of appointed area
-c: the whole map is divided into cells, -c can define the length of a cell (in meter)
-s: .shp file needed to consist a map, including districts.shp, rivers.shp and roads.shp, etc.
-m: output map file
 
Example1: generate electronic map of Shanghai from .shp file of Shanghai



make clean
make maptuner 
./maptuner -s ../maps/district.shp ../maps/river.shp ../maps/road.shp NULL shanghai.map

then a map named shanghai.map will be generated and can be used for visualization/traffic flow generation.


Example2: generate electronic map of an appointed rectangular area in Shanghai from .shp file of Shanghai, with cell size=20m






./maptuner -r "121.172388 31.303633 121.181830 31.303633 121.181830 31.296782 121.172388 
31.296782" -s ../maps/district.shp ../maps/river.shp ../maps/road.shp NULL shanghai.map -c 20

then a map named area1.map will be generated


2. Program Overview

The workflow of maptuner is shown in the figure below:



Section II:mapviewer:

1. Usage :

./mapviewer .map [-debug] [-c colormap] [-v .vmap] [-m contact_load_mode ] [-n contacts number] [-f contacts interval(hours)] [-g .edge .comm]  [.lst .cont .ogd .mgd .dsp .bus ...]

Example: generate traffic flow on shanghai.map and visualize it

make clean
make mapviewer
./mapviewer shanghai.map
(conduct real time simulation? 1 or 0:) 1
(Please input the number of cars:) 2000
(Please input the simulation time(seconds):) 2000

First shanghai.map will be visualized.


Visualization of Shanghai.map

Then you can click the start button to start the visualization of traffic flow. You can click the start button once again to continue/pause the traffic flow. You can also click the map with left/right mouse button to upscale/downscale the map.


Visualization of traffic flow

trace_generate: Usage: ./trace_generate .map output.mgd

Example: generate and record vehicle traces on shanghai.map


make clean
make trace_generate
./trace_generate shanghai.map trace.mgd
trace is recorded as the format below:


vehicle id, timestamp(second), longitude, latitude, speed(m/s), head angle, 0, current road id


Others:

For more details about VENUS, please refer to the appended paper.



Related Publications

Hongzi Zhu, Yanmin Zhu, Minglu Li and Lionel M. Ni
in Proceedings of ICPP 2007, Xi'an, China.
Hongzi Zhu, Yanmin Zhu, Minglu Li and Lionel M. Ni
in Proceedings of IEEE INFOCOM 2008, Phoenix, USA.
Minglu Li, Hongzi Zhu, Yanmin Zhu and Lionel M. Ni
IEEE Transactions on Vehicular Technology (IEEE TVT), 58(8), pp. 4088-4097, Oct. 2009.
Hongzi Zhu, Minglu Li, Yanmin Zhu and Lionel M. Ni
IEEE TPDS, 20(5), pp. 740-752, May 2009.
Hongzi Zhu, Minglu Li, Luoyi Fu, Guangtao Xue, Yanmin Zhu and Lionel M. Ni
IEEE Transactions on Distributed and Parallel Systems (IEEE TPDS), 22(8), pp. 1258-1266, Aug. 2011.
Hongzi Zhu, Shan Chang, Minglu Li, Sagar Naik and Sherman Shen
in Proceedings of IEEE INFOCOM 2011, Shanghai, China.
Shan Chang, Yong Qi, Hongzi Zhu, Jizhong Zhao and Xuemin (Sherman) Shen
IEEE Transactions on Distributed and Parallel Systems (IEEE TPDS), 23(6), pp 1103 - 1114, June, 2012.
Hongzi Zhu, Mianxiong Dong, Shan Chang, Yanmin Zhu, Minglu Li and Sherman Shen
in Proceedings of IEEE INFOCOM 2013, Turin, Italy.
Jun Qin, Hongzi Zhu, Yanmin Zhu, Li Lu, Guangtao Xue and Minglu Li
in Proceedings of IEEE INFOCOM 2014, Toronto, Canada.
Shan Chang, Hongzi Zhu, Mianxiong Dong, Kaoru Ota, Xiaoqiang Liu and Sherman Shen
IEEE Transactions on Vehicular Technology (IEEE TVT),65(7), pp. 4900-4910, 2016.
Jun Qin, Hongzi Zhu, Yanmin Zhu, Li Lu, Guangtao Xue and Minglu Li
IEEE Transactions on Parallel and Distributed Systems (IEEE TPDS), 27(6), pp. 1770-1782, 2016.
Feng Lv, Hongzi Zhu, Haibo Zhou, Wenchao Xu, Ning Zhang, Minglu Li and Xuemin (Sherman) Shen
IEEE Transactions on Vehicular Technology (IEEE TVT), 67(4), pp. 3586 - 3597, 2018.
Feng Lyu, Hongzi Zhu, Nan Cheng, Yanmin Zhu, Haibo Zhou, Wenchao Xu, Guangtao Xue and Minglu Li
in Proceedings of IEEE SECON 2018, Hong Kong, China.
Feng Lyu, Hongzi Zhu, Haibo Zhou, Liping Qian, Wenchao Xu, Minglu Li and Xuemin (Sherman) Shen
IEEE Transactions on Vehicular Technology, 67(11), pp. 10590-10602, 2018.
Yunxiang Cai, Hongzi Zhu, Xiao Wang, Shan Chang, Jiangang Shen and Minyi Guo
in Proceedings of IEEE INFOCOM 2021, Virtual Conference.
Yunxiang Cai, Hongzi Zhu, Shan Chang, Xiao Wang, Jiangang Shen and Minyi Guo
IEEE/ACM Transactions on Networking (TON), 30(4), pp. 1703-1716, 2022.
Jiangang Shen, Hongzi Zhu, Yunxiang Cai, Bangzhao Zhai, Xudong Wang, Shan Chang, Haibin Cai and Minyi Guo
in Proceedings of IEEE ICDCS 2022, Bologna, Italy.

Page View: 640