How do I get n number of vehicles in x seconds of simulation using the SUMO randomTrips script?

I am using the Veins simulator to create cars with a 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 has created 1200 cars for 1200 seconds of simulation, but I want to create 1200 cars for 100 seconds of simulation. How can i do this?

+3


source to share


1 answer


Just to answer this (basically paraphrasing what Julian Heinovsky said in the comments)

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

      

will generate 100 positives. If you want to make sure all of them are possible (network connected), you can add --validate

, but this will remove invalid disconnects (and you might get less than 100). You can just play with this number.

To make them all start at the second 0, you can edit the trips file by replacing the regex, replacing the entire departure time with 0. On * nix, it will probably do the following:



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

      

Now you can start sumo for your chosen period

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

      

+1


source







All Articles