Perform Cosimulation Between Simulink and Eclipse SUMO Traffic Simulator
Configure a server and client relationship between Simulink® and Eclipse™ SUMO™ Traffic Simulator for cosimulation, and spawn a vehicle in the SUMO scenario.
To run this example you must:
Download and install the Automated Driving Toolbox™ Interface for Eclipse SUMO Traffic Simulator.
Download and install SUMO Version 1.20.0 on your system. The Automated Driving Toolbox Interface for Eclipse SUMO Traffic Simulator supports cosimulation with SUMO Version 1.20.0 on Windows® and Linux® platforms.
Open Model
Open the model. The model uses Server and Client blocks that configure and synchronize simulation between SUMO and Simulink.
open_system("ConfigureServerandClient.slx")
Configure Server
Double-click the Server block to open its block mask. The SUMO configuration file parameter, specifies the path to a SUMO configuration file, which must have the .sumocfg extension. This example specifies the path to the testConfig.sumocfg file, located at C:\SUMO\MyProject, on a Windows® machine. If you are not using a Windows machine, or have installed SUMO to a directory other than the default, you must manually specify this parameter. The Port parameter specifies the number of the port available on the SUMO server application for communication with clients.
The Number of clients parameter specifies how many clients can connect to the SUMO server. To enable the server to connect to multiple clients, specify a value greater than 1.
Selecting the Spawn random traffic parameter enables the SUMO server to spawn random traffic actors in your SUMO scenario. The Number of vehicles to spawn parameter specifies how many vehicles to add, which the server places at random positions in the road network at the start of the simulation.

Configure Client
Double-click the Client block to open its block mask. The Address and Port parameters specify IP address and port number of the SUMO server, respectively, to which the client connects. The port number you specify for the client must match the port number of the server. If you are connecting multiple clients to a single server, you can use the Client order parameter to set the priority of each client.
Perform Cosimulation
To begin cosimulating, on the Simulink Toolstrip, select Run, which launches the SUMO application interface and begins simulating the scenario, defined in the SUMO configuration file. You can visualize the simulation in the SUMO interface. Alternatively, you can simulate the model programmatically by using the sim command.
sim("ConfigureServerandClient.slx");Update Simulation Settings
This model uses the default simulation stop time of 10 seconds. If the SUMO simulation runs too fast, you can slow down the simulation by using simulation pacing. On the Simulink Toolstrip, select Run > Simulation Pacing. In the Simulation Pacing Options dialog box, select the Enable pacing to slow down simulation, and decrease the value of Simulation time per wall clock second to a value slightly less than 1, such as 0.8 seconds. Then, run the model again.