Tools/Trip

From Sumo
Revision as of 10:18, 26 May 2014 by Namdre (talk | contribs) (help on using vehicle classes)
Jump to navigation Jump to search

randomTrips.py

"randomTrips.py" generates a set of random trips for a given network (option "-n"). It does so by choosing source and destination edge either uniformly at random or weighted by length (option "-l"), by number of lanes (option "-L") or both. The resulting trips are stored in an xml file (option "-o", default trips.trips.xml) suitable for the DUAROUTER which is called automatically if the "-r" option (with a filename for the resulting route file) is given. The trips are distributed evenly in an interval defined by begin (option "-b", default 0) and end time (option "-e", default 3600) in seconds. The number of trips is defined by the repetition rate (option "-p", default 1) in seconds. Every trip has an id consisting of a prefix (option "-t", default "t") and a running number. Example call:

<SUMO_HOME>/tools/trip/randomTrips.py -n input_net.net.xml -e 50 -l

The script does not check whether the chosen destination may be reached from the source. This task is performed by the router.

The option --min-distance <FLOAT> ensures a minimum straight-line distance (in meter) between start and end edges of a trip. The script will keep sampling from the edge distribution until enough trips with sufficient distance are found.

The option --fringe-factor <FLOAT> increases the probability that trips will start/end at the fringe of the network. If the value 10 is given, edges that have no successor or no predecessor will be 10 times more likely to be chosen as start- or endpoint of a trip. This is usefull when modelling through-traffic which starts and ends at the outside of the simulated area.

For additional ways to influence edge probabilities call

<SUMO_HOME>/tools/trip/randomTrips.py --help

generating vehicles with additional parameters

With the option --trip-parameters <STRING>, additional parameters can be given to the generated vehicles (note, usage of the quoting characters).

 <SUMO_HOME>/tools/trip/randomTrips.py -n input_net.net.xml --trip-parameters="departLane=\"best\" departSpeed=\"max\" departPos=\"random\""

This would make the random vehicles be distributed randomly on their starting edges and inserted with high speed on a reasonable lane.

If the generated vehicles should have a specific vehicle type, an additional-file needs to be prepared:

<additional>
  <vType id="myType" maxSpeed="27" vClass="passenger"/>
</additional>

Then load this file (assume it was saved as type.add.xml) with the option --additional-file

<SUMO_HOME>/tools/trip/randomTrips.py -n input_net.net.xml --trip-parameters="type=\"myType\"" --additional-file type.add.xml 
   --vclass passenger

Note the use of the option --vclass which ensures that random start- and arrival-edges allow a specific vehicle class.

route2trips.py

This script generates a trip file from a route file by stripping all route information except for start and end edge. It has a single parameter which is the route file and prints the trip file to stdout. Example:

<SUMO_HOME>/tools/trip/route2trips.py input_routes.rou.xml