-
Notifications
You must be signed in to change notification settings - Fork 0
Handling Simulations that Utilize SUMO
In a Webots simulation that utilizes SUMO, users must configure a SUMO Interface node to hook into the simulation. This interface is extremely intuitive and easy to configure. However, whenever we run such a simulation in parallel, problems arise from the interface attempting to start several instances of the simulation on the same networking port. After extensive testing, we found there are two ways to successfully configure a Webots-SUMO simulation for parallelization, as follows:
1. Changing the port number in the simulation's world (.wbt) file in an accompanying portable batch script job (.pbs) file.
The logic here is that changing the port number in between the spawning of each instance will ensure all instances operate on their own unique port. This is accomplished by adding a line to your PBS job script. The goal is to go into the simulation's world file (which is human-readable), and automatically identify the line that controls the port of the SUMO interface. There are likely countless ways to accomplish this, but see below for a solution we devised using the awk command:
awk '$0 ~ /port/ { $1 = " " $1; $2++ } 1' ~/PATH_TO_WORLD_FILE/WORLD_FILE.wbt > tmp$$ && mv tmp$$ ~/PATH_TO_WORLD_FILE/WORLD_FILE.wbt
This option requires no supplemental code, but it much more manually intensive. Its best understood through an example: if I wanted to run my Webots-SUMO simulation 8 times, I would create 8 copies of the simulation folder, and append an index flag (i.e. SIMULATION_FOLDER_0, SIMULATION_FOLDER_1, SIMULATION_FOLDER_2, ...) to each copy. Then, when I go to run my PBS job script, I would use the $PBS_ARRAY_INDEX file to loop through all the copies of the simulation.