1

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.

J.G
  • 190
  • 3
  • 13

1 Answers1

2

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.

Michael
  • 3,510
  • 1
  • 11
  • 23
  • Thanks, Michael. This is exactly what I need. One more question here. For the probability in ``, instead of setting it manually, is there also a randomized way to do so? – J.G Apr 11 '18 at 20:50
  • What do you mean by a randomized probability? Do you mean that the probability that a value is chosen is a random variable by itself? No that is not possible (and to be honest I doubt its usefulness) unless of course you generate that file with a script. – Michael Apr 12 '18 at 11:27