Road Traffic Library

The Road Traffic Library allows you to model, simulate, and visualize vehicle traffic. The library supports detailed yet highly efficient physical level modeling of vehicle movement. It is suitable for modeling highway traffic, street traffic, on-site transportation at manufacturing sites, parking lots, or any other systems with vehicles, roads, and lanes.

The Road Traffic Library integrates well with AnyLogic Process Modeling Library, Pedestrian Library, and Rail Library, which means you can combine vehicle traffic models with models of trucks, cranes, ships, trains, passenger flows, manufacturing or business processes, and so on.

This library includes:

Reverse movement of cars and lanes where cars can move in both directions are not supported currently.

Road Traffic Library Blocks

The Road Traffic Library contains seven blocks that allow you to define vehicle flow:


Generates cars and puts them into the specified location inside a road network (on a road or in a parking lot). Arrivals of cars can be defined by interarrival times, arrival rate, rate schedule, arrival schedule, or inject() function calls.To generate cars of custom car type defined by user, specify the name of this car type in the New car field.


Removes a car from the model. Use CarDispose (and not Sink or Exit) to remove cars.

CarMoveTo The block that controls the car movement. A car can only move while inside a CarMoveToblock. When a car enters CarMoveTo, it calculates the way from its current location to the specified destination. The destination can be road, parking lot, bus stop or stop line. If the destination is a road, car will first move along the shortest way to the beginning of the road and then move along this road till exit. If there is no way from the car’s current location to the specified destination, car exits the block via onWayNotFound port.
CarEnter Together with CarExit, this block is used to model part of the car movement on a higher abstraction level, namely without detailed physical level road traffic modeling.
CarExit Removes the car from the road network and passes the car agent into the regular Process Modeling Library flowchart where it can go through delays, queues, decisions, etc. Together with CarEnter, this block is used to model part of the car movement on a higher abstraction level, namely without detailed physical level road traffic modeling.
TrafficLight Simulates the traffic light (also known as traffic signal, traffic semaphore, signal light, stop light) - signalling device positioned at road intersections, pedestrian crossings, and other locations to control conflicting flows of traffic. Controls car traffic at specified intersection or stop-line(s).

Optional block. With the help of RoadNetworkDescriptor developers get access to controlling all the vehicles located in one road network. Block allows to set actions which will be executed for each car in the following cases: on entering network, on entering road, on changing the lane, etc. This block also enables road density map that displays the current state of traffic jams on roads of the network.

Related topics

Road Traffic Library tutorial

Space markup for road traffic models