In my traffic simulation network, I have a several segments of highway consisting of ten connected roads (e.g., id from 1 to 10). I want to randomly generate a flow satisfying the following requirement as many as possible:
I have read the documentation of SUMO Simulation/Randomness, but still get no clue how to satisfy the above requirements. Any suggestion is appreciated.
You should define a flow in a route file like this
<routes>
<flow id="myflow" begin="0" end="3600" number="1000" from="1" to="10"/>
</routes>
(adapt begin and end time as you see fit). You put it in a file called myflow.rou.xml and call duarouter like this
$ duarouter -n mynet.net.xml -r myflow.rou.xml --randomize-flows -o myroutes.rou.xml
You can then load the resulting routes with the net in a simulation.
To randomize the vehicle type the easiest way is to give a distribution for the default vehicle type:
<additional>
<vTypeDistribution id="DEFAULT_VEHTYPE">
<vType id="1" length="1"/>
<vType id="2" length="2"/>
<vType id="3" length="3"/>
</vTypeDistribution>
</additional>
you can of course add more parameters than just length and also add probabilities. Save this in a separate file mytypes.add.xml and load it as additional when running the simulation.