1
votes

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:

  1. The total number of vehicles is fixed, e.g., 1000.
  2. The departure time of vehicles is random within the simulation time.
  3. All vehicles are expected to begin at road 1, and end at road 10 (they don't have to arrive if the simulation time is reached).
  4. It would be better if the type of vehicle can also be randomized.

I have read the documentation of SUMO Simulation/Randomness, but still get no clue how to satisfy the above requirements. Any suggestion is appreciated.

1

1 Answers

2
votes

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.