3
votes

I am using Veins simulator, for creating cars with path I am using the following commands:

python c:/DLR/Sumo/tools/randomTrips.py -n test.net.xml -e 1200 -l
python c:/DLR/Sumo/tools/randomTrips.py -n test.net.xml -r test.rou.xml -e 1200 -l

This command generated 1200 vehicles for 1200 sec of simulation but I want to generated 1200 vehicles for 100 sec of simulation. How can I do that?

2
You should have a look at the documentation. -e defines the end time.Julian Heinovski
@JulianHeinovski Thank you. I overlooked at Arrival rate.Sam1324
@JulianHeinovski I am still not able to get my intended requirement. -e defines end time but I need say 1200 sec of simulation with just 100 vehicles and each vehicle starts at 0 seconds.Sam1324
Look at the example: To let n vehicles depart between times t0 and t1 set the options -b t0 -e t1 -p ((t1 - t0) / n). More control you cannot achieve by using randomTrips.py. Then you need to create a routes file.Julian Heinovski

2 Answers

1
votes

Just to answer this (mainly rephrasing what Julian Heinovski said in the comments)

randomTrips.py -n net.net.xml -o passenger.trips.xml -e 100

will generate 100 trips. If you want to make sure all of them are possible (connected in the network) you can add --validate but this will remove invalid trips (and you may end up with less than 100). You can simply play around with the number then.

To let all of them start at second 0 you can edit the trips file using a regular expression replacement, replacing all departure times with 0s. On *nix the following will probably do:

sed -i 's/depart="[0-9]*/depart="0/' passenger.trips.xml

Now you can start sumo for the period of your choice

sumo -n net.net.xml -r passenger.trips.xml -e 1200
0
votes

Number of vehicles randomly distributed over specified period of time can be generated using --begin, --end and --period options.

For example to generate 1200 vehicles for 100 sec of simulation, following command can be used:

python randomTrips.py -n net.net.xml -r net.rou.xml -o net.trip.xml --begin=0 --end=100 --period=0.083333

In short,

number of generated vehicles = (end - begin) / period