Simple SUMO Writing file example
1. Introduction
Running a sumo simulation "name" means writing 3 files
-
Name.nod.xml
-
Name.edg.xml
-
Name.rou.xml
and then, calling the "netconvert" program in order to obtain a SUMO simulation file. Running the SUMO interface will allow a visualization of the SUMO simulation. We are here only interested in the interface that netconvert gives us, as we we’ll have to write a program to integrate the simulation as a source term for a FEEL++ simulation.
2. Simple example description
Our simple example resides in two 2-lines road, that will aim at being the source term for the corresponding aerothermal pollution simulation benchmark.
The first step resides in writing the different nodes of our network : each roads has 3 nodes. 2 segments nodes and one used as "exit".
Here is the '.nod.xml' file corresponding.
<nodes>
<node id="1" x="-250.0" y="0.0" />
<node id="2" x="+250.0" y="0.0" />
<node id="3" x="+251.0" y="0.0" />
<node id="4" x="-250.0" y="2.0" />
<node id="5" x="+250.0" y="2.0" />
<node id="6" x="+251.0" y="2.0" />
<node id="7" x="-250.0" y="-30.0" />
<node id="8" x="+250.0" y="-30.0" />
<node id="9" x="+251.0" y="-30.0" />
<node id="10" x="-250.0" y="-32.0" />
<node id="11" x="+250.0" y="-32.0" />
<node id="12" x="+251.0" y="-32.0" />
</nodes>
Once the nodes are set, we can create an edge file, that will set witch segments are to be used as lines. It writes as follows :
<edges>
<edge from="1" id="1to2" to="2" />
<edge from="2" id="outroute1" to="3" />
<edge from="4" id="4to5" to="5" />
<edge from="5" id="outroute2" to="6" />
<edge from="7" id="7to8" to="8" />
<edge from="8" id="outroute3" to="9" />
<edge from="10" id="10to11" to="11" />
<edge from="11" id="outroute4" to="12" />
</edges>
Onces we have go the road lines, road remain to be set, in a "rou" file :
<routes>
<vType accel="1.0" decel="5.0" id="Car" length="2.0" maxSpeed="100.0" sigma="0.0" />
<route id="route1" edges="1to2 outroute1"/>
<route id="route2" edges="4to5 outroute2"/>
<route id="route3" edges="7to8 outroute3"/>
<route id="route4" edges="10to11 outroute4"/>
<vehicle depart="1" id="veh0" route="route1" type="Car" />
</routes>