TraCI An Interface For Coupling Road Traffic and N
TraCI An Interface For Coupling Road Traffic and N
Axel Wegener1 , Michał Piórkowski2 , Maxim Raya2 , Horst Hellbrück1 , Stefan Fischer1 and Jean-Pierre Hubaux2
1 Institute of Telematics, University of Luebeck, Germany
{michal.piorkowski,maxim.raya,jean-pierre.hubaux}@epfl.ch
Keywords: Vehicular Ad-Hoc Networks (VANETs), Net- ditions, they will adjust their speed accordingly. In return, this
work Simulation, Node Mobility will also affect other vehicles, including those that are not part
of the VANET.
Abstract Several tools are available for network simulations: e.g.
Vehicular Ad-Hoc Networks (VANETs) enable communica- ns2 [2], JiST/SWANS [3] or Shawn [4]. But none of them
tion among vehicles as well as between vehicles and roadside qualifies as a VANET simulator (as is the case with ns2 or
infrastructures. Currently available software tools for VANET GloMoSim for ad-hoc networks), mainly because none of
research still lack the ability to asses the usability of vehic- them allows to evaluate how the networking applications in-
ular applications. In this article, we present Traffic Control fluence mobility. They are mostly concerned about assessing
Interface (TraCI) a technique for interlinking road traffic and the performance of routing, forwarding, MAC layer proto-
network simulators. It permits us to control the behavior of cols, etc. of VANETs under realistic but unmodifiable mobil-
vehicles during simulation runtime, and consequently to bet- ity scenarios. The common approach to integrate mobility is
ter understand the influence of VANET applications on traffic to either rely on stand-alone road traffic simulators, such as
patterns. SUMO [5], Vissim [6], MatSim [7], TRANSIMS [8], or to
In contrast to the existing approaches, i.e., generating mo- use collected mobility traces specific to some geographical
bility traces that are fed to a network simulator as static input region [9, 10]. Tools with such functionalities can be found
files, the online coupling allows the adaptation of drivers’ be- in [11–13].
havior during simulation runtime. This technique is not lim- We address the problem of application-centric mobility-
ited to a special traffic simulator or to a special network sim- oriented evaluation of VANETs by proposing TraCI: Traffic
ulator. We introduce a general framework for controlling the Control Interface. Specifically, we suggest an open-source
mobility which is adaptable towards other research areas. architecture that couples two simulators: a road traffic and a
We describe the basic concept, design decisions and the network simulator. In such a realistic simulation setup, mobil-
message format of this open-source architecture. Addition- ity patterns are not pre-established as fixed trace files. Instead,
ally, we provide implementations for non-commercial traffic the traffic and network simulators are connected in real time
and network simulators namely SUMO and ns2, respectively. by TraCI thus enabling the control of mobility attributes of
This coupling enables for the first time systematic evaluations each simulated vehicle. Thus, the movement of each vehicle
of VANET applications in realistic settings. can be influenced by the VANET application running inside
the network simulator. We claim that this approach will allow
to fully evaluate VANET applications in realistic scenarios.
1. INTRODUCTION
Our contribution is the new open-source architecture for
VANETs appear to be the most promising applications of
coupling traffic and network simulators that aims to achieve
mobile ad-hoc networks and will have a strong impact on road
two goals:
traffic efficiency and safety as provisioned by the Intelligent
Transportation System (ITS) community [1]. 1. To create a generic API for controlling a traffic simulator
An exhaustive evaluation of VANET applications requires so that a road traffic simulator can be coupled with a
more than a deep understanding of information generation network simulator or any other simulator that needs to
and networking aspects within VANETs. It is just as impor- control the road traffic.
tant to investigate how vehicular applications affect the move-
ment of vehicles, because as a consequence of a more exten- 2. To set a ground for a framework for implementing
sive knowledge of the surrounding traffic patterns (as reported VANET applications that can influence vehicle move-
by VANET applications) drivers will adapt their driving strat- ment during runtime [13].
egy – ranging from speed changes to route selection. This new
driver behavior might cause again a change in traffic patterns. The paper is organized as follows. In Section 2. we present
For example, if drivers are warned about hazardous road con- the related work. In Section 3. we introduce the concept of
2. RELATED WORK
In recent years new simulation tools for VANETs have
been developed; these tools can be classified into three differ-
ent approaches. The first approach uses real maps to generate
random waypoint mobility traces [14, 15] or more realistic Figure 1. System architecture and an operation example of
traces [10]. The second approach uses integrated road traffic the command-response exchange between the network and
and network simulators, i.e., a network simulator with em- the traffic simulator presented as a timeline diagram. This
bedded realistic mobility component, such as [16–18]. The example shows an exchange of four TraCI messages, two
third approach couples a commercial traffic simulator with a commands: [SetMaxSpeed] and [SimulationStep] and two re-
network simulator [19, 20]. sponses: [Status] and [Status, MoveNode, MoveNode]. It cor-
Note that only the second and the third approach have the responds to a scenario when two vehicles exchange VANET
potential to evaluate VANETs at application-centric level un- messages and one of them decides to adjust its maximum
der realistic scenarios.However, the major shortcoming of the speed.
existing tools is that the information exchanged between ve-
hicles cannot influence their whereabouts. The only exception
in the class of integrated simulators is a framework proposed
To better understand the concept of mobility primitives,
by Wang et al. [18]. It allows for controlling vehicle move-
let us consider the Road Condition Warning application that
ments by using an intelligent driving behavior module, coded
belongs to the class of Vehicle-to-Vehicle Decentralized En-
in the agent logic that simulates the vehicle. Our solution is
vironmental Notification applications as proposed by the
more generic, because it is based on a different architecture,
Car2Car Communication Consortium (C2C-CC) [21]. A ve-
which allows us to use various road traffic as well as network
hicle that detects an incident immediately starts broadcast-
simulators. In the class of the coupled traffic and network
ing a specific warning message to nearby vehicles; this mes-
simulators there are two exceptions, [19, 20]. They achieve
sage includes the type of warning, its location and occurrence
necessary real-time coupling between two simulators, VIS-
time. Each vehicle that receives such a warning may adjust its
SIM or CARISMA (for road traffic) and ns2 (for communi-
movement accordingly. For example, while approaching the
cation). But it remains unclear what features are supported
scene, a vehicle may first slow down, then change the lane
to control the traffic simulation. Furthermore, both VISSIM
and finally speed up.
and CARISMA are commercial products that are not pub-
In order to identify all mobility primitives specific to
licly available. Our open-source system architecture allows
VANETs, we studied the set of vehicular applications pro-
researchers to couple non-licenced, as well as licensed, tools
posed by C2C-CC. In Table 1, we present a taxonomy of
that are widely used in both the ITS and VANET communi-
VANET applications, i.e., use cases and the associated mobil-
ties.
ity primitives. The complex mobility patterns of a driver can
be represented by a certain sequence of mobility primitives
3. APPROACH proposed here. We rely on these mobility primitives to spec-
3.1. Mobility Primitives ify the set of atomic mobility commands used by the network
simulator to control movements of vehicles. The detailed def-
Any complex mobility pattern, which is a result of a de-
inition of these commands is presented in Section 4.
cision taken by a driver, can be decomposed into a sequence
of mobility primitives such as ‘change speed’, ‘change lane’,
‘change route’, etc. These mobility primitives are indepen- 3.2. System Architecture
dent from VANET applications. They depend on macroscopic TraCI avoids the creation of mobility traces prior to the
(road network topology, speed limits, etc.), as well as mi- ad-hoc network simulation. Both simulators run concurrently,
croscopic (current vehicle speed, location, etc.) mobility con- whereby the ad-hoc network simulator controls the road traf-
straints. fic simulator. Therefore, we extend the road traffic simula-
tor by a TraCI-Server and the network simulator by a TraCI- However, given that the simulation time step is usualy very
Client. These two components communicate over a TCP con- short - for traffic efficiency applications approximately 1[s]
nection. The general system architecture is depicted in Fig- and for safety applications - 0.1[s], this kind of drawback is
ure 1 negligible.
Once the TCP connection is established, the network sim- When the simulation ends either in the traffic or the net-
ulator controls the traffic simulator via the data exchange work simulator, it closes the TCP connection. This causes the
protocol, which enables movement changes for each simu- other simulator to stop too.
lated vehicle. Thus, it is possible to instantaneously adjust
the movement of individual vehicles due to information gen- 4. PROTOCOL DETAILS
erated within the VANET. As described in the previous section, a TCP connection be-
Data exchange between the simulators is controlled by the tween the mobility generator and network simulator is used
network simulator that sends commands as requests to the for the exchange of data. Both the network and the road traf-
road traffic simulator. Upon reception of the commands, the fic simulator use TraCI messages (cf. Figure 2) to bundle, re-
traffic simulator performs actions that result in one or more spectively, a set of commands or responses.
responses to each command.
0 7 8 15
To ensure time synchronization between both simulators,
Message length including
the network simulator sends periodically, every simulation Header
this header
step, e.g. 1[s], a command to the road traffic simulator that
Length
contains the actual simulation time plus one simulation step Identifier
Command0
(cf. Section 4.2.). The road traffic simulator performs the next Command0 content
simulation step and sends the resulting vehicle positions back ..
.
to the network simulator. Those vehicle positions are con- Length
Identifier
verted into linear movements by the network simulator, so Commandn−1
Commandn−1 content
that all vehicles reach their positions at a time instant as spec-
ified by the traffic simulator (cf. Section 4.4.).As a small Figure 2. TraCI message format: TraCI messages are com-
drawback of this method, the actual execution of the atomic posed of a small header and a variable number of commands.
mobility commands is delayed by one simulation step, since
the road traffic simulator is always one simulation step ahead. The TraCI message, as depicted in Figure 2, consists of a
• Move Node contains a movement information for one 4.1. Data Types
vehicle. It serves as a response to the Simulation Step To save the computation time, our protocol does not use
command to transfer the mobility into the network sim- structural information within its messages as XML does. In-
ulator. stead, all messages are composed of a stream of elementary
data types. These elementary data types are byte, integer,
Commands from the second group represent the atomic float, double and string.
mobility primitives identified for the use cases in Section 3. All numeric data types are interpreted as signed, only for
They are used to affect the behavior of a single vehicle. the datatype byte exists an unsigned counterpart.
In addition, we introduce the composed data type position
• Set Maximum Speed limits vehicle’s speed or removes that is based on the aforementioned elementary data types.
such a limit (change speed primitive). We use two different types of position representations: Carte-
sian 3D positions and positions on a road map. The former
• Stop Node causes a vehicle to stop and wait for a period format is necessary, since in the vast majority of the network
of time at a certain position as soon as the vehicle gets simulators the Cartesian coordinates are used to represent
there (stop primitive). node’s position. The latter format can be used for example at
the application layer (implemented also in the network simu-
• Change Lane fixes a vehicle to a specific lane for a cer-
lator), where information about map location can be required
tain amount of time.
to perform application-specific actions. To specify which rep-
• Change Route causes the traffic simulator to reroute an resentation is used, a ubyte identifier is put in front of each
individual vehicle by setting a particular travel time for position (later on referred to as PositionType).
a road segment. 3D Position. In most cases, network simulators work with
3D coordinates to describe node positions.
• Change Target changes the destination of a vehicle.
ubyte float float float
The environmental commands that give access to the simu- 00000011 X Y Z
lation scenario form the third group. The simulation scenario
is maintained mainly by the traffic simulator, as it holds the
road map, points of interest, building footprints, traffic lights, The ubyte identifier for 3D positions is 0x03. It is fol-
public transportation and so on. Depending on the network lowed by three float variables describing the Cartesian X,
simulation’s focus, a subset of this information is required Y and Z coordinates.
within the network simulation as well. We currently support Road Map Position. To relieve the network simulator
the following set of environmental commands. from converting Cartesian coordinates to positions on a road
4.2. Command Simulation Step (Id 0x01) 4.5. Command Set Maximum Speed (Id 0x11)
integer float
double ubyte
NodeId MaxSpeed
TargetTime PositionType
[9] Richard M. Fujimoto, Randall Guensler, Michael P. [21] Roberto Baldessari, Bert Bödekker, Matthias Dee-
Hunter, Hao Wu, Mahesh Palekar, Jaesup Lee, gener, Andreas Festag, Walter Franz, C. Christo-
and Joonho Ko. CRAWDAD data set gat- pher Kellum, Timo Kosch, Andras Kovacs, Massimil-
ech/vehicular (v. 2006-03-15), March 2006. iano Lenardi, Cornelius Menig, Timo Peichl, Matthias
http://crawdad.cs.dartmouth.edu/gatech/vehicular. Röckl, Dieter Seeberger, Markus Straßberger, Hannes
Stratil, Hans-Jörg Vögel, Benjamin Weyl, and Wenhui
[10] Valery Naumov, Rainer Baumann, and Thomas Gross. Zhang. Car-2-Car Communication Consortium - Man-
An Evaluation of Inter-Vehicle Ad Hoc Networks Based ifesto (Version 1.1), August 2007. http://www.car-2-
on Realistic Vehicular Traces. In Proc. of MobiHoc ’06, car.org/index.php?id=570.
pages 108–119, 2006.
[22] Wiki for the Traffic Control Interface.
[11] Rapid Generation of Realistic Simulation for VANET. http://sumo.sf.net/wiki/index.php/TraCI.
http://www.csie.ncku.edu.tw/ klan/move/index.htm.
[23] Stefan Krauß. Microscopic Modeling of Traffic Flow:
[12] TraceExporter: Exports SUMO dumps as ns2 traces. Investigation of Collision Free Vehicle Dynamics. PhD
http://sumo.sourceforge.net/wiki/index.php/traceExporter. thesis, Universität zu Köln, April 1998.
[13] TraNS: Joint Traffic and Network Simulator - [24] Marc Torrent-Moreno. Inter-Vehicle Communications:
Application-centric framework for evaluation of Achieving Safety in a Distributed Wireless Environment:
VANETs. http://trans.epfl.ch. Challenges, Systems and Protocols. PhD thesis, Univer-
sitätsverlag Karlsruhe, 2007.
[14] Amit Kumar Saha and David B. Johnson. Modeling
Mobility for Vehicular Ad Hoc Networks. In Proc. of [25] Axel Wegener, Horst Hellbrück, Stefan Fischer, Chris-
VANET ’04 (Poster abstract), pages 91–92, 2004. tiane Schmidt, and Sándor Fekete. AutoCast: An Adap-
tive Data Dissemination Protocol for Traffic Informa-
[15] D. R. Choffnes and F. E. Bustamante. An Integrated tion Systems. In Proc. of VTC ’07, Baltimore, USA,
Mobility and Traffic Model for Vehicular Wireless Net- October 2007.
works. In Proc. of VANET ’05, pages 69–78, 2005.