TRACI4MATLAB - USER’S MANUAL
Project:
Modelamiento y control de tr´afico en la ciudad de
Medell´ın - Segunda Etapa
Acronym: MOYCOT E2
Web site:
www.moycot.org
UNIVERSIDAD NACIONAL DE COLOMBIA
Authors: Andr´es Acosta, Jorge Espinosa, Jairo Espinosa.
c Copyright Universidad Nacional de Colombia, Polit´ecnico Jaime Isaza Cadavid
TraCI4Matlab - User’s Manual
Contents
Abstract
1 What is TraCI4Matlab?
1.1 Citing TraCI4Matlab . . . . .
. . . . .
. . . . . .
. . . . . .
. .
2 Installing TraCI4Matlab
2.1 Prerequisites . . . .
Installation . . . .
2.2
2.2.1
2.2.2
2.2.3
. . . . .
. . . . .
. . . . . .
. . . . . .
. . . . . .
. .
. . . . . .
. .
Step 1: Setting up the environment . . . . .
. .
Step 2: Getting TraCI4Matlab .
. . . . . .
. .
Step 3: Adding the additional dependencies to the Matlab’s
static Java path . . . .
. .
. . . . . .
Step 4: Adding TraCI4Matlab to the Matlab’s path . .
. .
. .
. . . . . .
Step 5: Testing TraCI4Matlab .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
2.2.4
2.2.5
. . . . .
. . . . . .
3 Using TraCI4Matlab
3.1 Building the simulation scenario in SUMO . . . . .
. . . . . .
3.2 Developing the application in Matlab . .
. .
. .
Step 1: Executing SUMO in server mode from Matlab and
initializing the connection . . .
. .
. . . . . .
Step 2: Developing the application . . . . .
. .
. .
. . . . . .
Step 3: Closing the connection .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
3.2.1
3.2.2
3.2.3
Bibliography
Page 2/17
3
4
4
6
6
6
6
9
9
9
10
13
13
13
13
14
16
16
TraCI4Matlab - User’s Manual
Abstract
This user’s manual describes the installation procedure of the TraCI4Matlab
package and a brief description of its usage. TraCI4Matlab is an implemen-
tation of the Traffic Control Interface (TraCI) for the Matlab Rprogramming
language, which allows the interaction with the Simulation of Urban Mobility
(SUMO) microscopic road traffic simulator.
Page 3/17
Chapter 1
What is TraCI4Matlab?
TraCI4Matlab is an Application Programming Interface (API) developed in Mat-
lab which allows the communication between any application developed in this lan-
guage and the Simulation of Urban Mobility (SUMO) microscopic road traffic sim-
ulator. The functions comprising TraCI4Matlab implement the Traffic Control In-
terface (TraCI) application level protocol which is built on top of the TCP/IP stack,
so that the application developed in Matlab, which is the client, can access and
modify the simulation environment provided by the server (SUMO). TraCI4Matlab
allows controlling SUMO objects such as vehicles, traffic lights, junctions, etc, en-
abling applications like traffic lights predictive control, dynamic route assignment
and vehicular communications, among others.
1.1 Citing TraCI4Matlab
If you use TraCI4Matlab in your research reports, articles and conferences, please
use this book chapter [1] to cite it, as follows:
@ i n c o l l e c t i o n { a c o s t a e t a l 2 0 1 5 ,
t h e {SUMO} { Road } { T r a f f i c }
t i t l e = {{ T r a C I }4 M a t l a b : { E n a b l i n g } t h e
{ I n t e g r a t i o n } o f
{ S i m u l a t o r } and { M a t l a b } { T h r o u g h } a
{ S o f t w a r e } {Re}− e n g i n e e r i n g { P r o c e s s } } ,
u r l = { h t t p : / / l i n k . s p r i n g e r . com /
10.1007/978 −3 −319 −15024 −6 9 } ,
u r l d a t e = {2017 −03 −06} ,
b o o k t i t l e = { M o d e l i n g { M o b i l i t y } w i t h { Open }
{ D a t a } } ,
p u b l i s h e r = { S p r i n g e r } ,
a u t h o r = { A c o s t a , Andr \ ’ e s F . and E s p i n o s a ,
J o r g e E . and E s p i n o s a ,
y e a r = { 2 0 1 5 } ,
p a g e s = {155−−170}
J a i r o } ,
4
}
TraCI4Matlab - User’s Manual
Page 5/17
Chapter 2
Installing TraCI4Matlab
2.1 Prerequisites
• Operating System: Windows 7 or higher
• Matlab RR2012b or higher
• SUMO 0.19.0 or higher. Installation instructions of SUMO can be found
here
Note: TraCI4Matlab is designed to preserve the same syntax of the TraCI-Python
client, which is part of the SUMO suite.
If you have little programming expe-
rience, we encourage you to get familiar with TraCI-Python before starting with
TraCI4Matlab.
2.2 Installation
2.2.1 Step 1: Setting up the environment
Set up the SUMO_HOME environment variable with system scope, with a value
corresponding to the root directory of the SUMO installation. For example, if
the SUMO version 0.27.1 was installed in C:, then the SUMO_HOME environment
variable would have a value of C:\sumo-0.27.1. Environment variables can
be configured as follows:
• Open the windows explorer, right click on “My computer” and click the
properties option, as showed in figure 2.2.
• On the left side of the window that opens, click in the link ”Advanced sys-
tem configuration”, then click in the button “Environment variables” and in
the “System variables” field, click on the button “New”, configure the vari-
able according to your SUMO installation, and click the “Accept” button, as
showed in figure 2.1.
6
TraCI4Matlab - User’s Manual
• Again in the “System variables” field, look for the ”path” variable and add
the route to the bin directory of the SUMO installation. This can be accom-
plished in Windows 10 by double clicking the ”path” variable then selecting
the “New” button as shown in figure 2.3, or in Windows 7 by adding a semi-
colon to the current value and then the corresponding route. Finally, click on
the “Accept” button.
Figure 2.1: Creating the SUMO HOME variable.
Page 7/17
TraCI4Matlab - User’s Manual
Figure 2.2: Access to the system properties.
Figure 2.3: Editing the Windows path.
Page 8/17