Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Adding multiple vehicle ids to routeSampler

For this, you can define a vTypeDistribuation 'truck' with three member types: https://sumo.dlr.de/docs/Definition_of_Vehicles%2C_Vehicle_Types%2C_and_Routes.html#route_and_vehicle_type_distributions

Am Mo., 15. Sept. 2025 um 09:37 Uhr schrieb Federico De Falco via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello everybody,
I am following this procedure to generate routes for a microsimulation that involves cars and trucks:

  1. Generate trips from O-D file for passengers and trucks:
    od2trips -n passengerTaz.taz.xml -z passengerTazCount.xml --prefix p -o passengerOd.xml
    od2trips -n truckTaz.taz.xml -z truckTazCount.xml --prefix t -o truckOd.xml

  2. Use duarouter to generate routes:
    duarouter -n Today.net.xml --additional-files ../../vehicles.vtype.xml --route-files passengerOd.xml --remove-loops true -o passengerRoutes.rou.xml
    duarouter -n Today.net.xml --additional-files ../../vehicles.vtype.xml --route-files truckOd.xml --remove-loops true -o truckRoutes.rou.xml

  3. Use routeSampler to force the number of vehicles through some edges:
    python3 $SUMO_HOME/tools/routeSampler.py --attributes="type=\"passenger1\"" -r passengerRoutes.rou.xml --edgedata-files passengerEdgeCount.xml --prefix p --total-count 45355 -o passengerOut.xml
    python3 $SUMO_HOME/tools/routeSampler.py --attributes="type=\"truck\"" -r truckRoutes.rou.xml --edgedata-files truckEdgeCount.xml --prefix t --total-count 3695 -o truckOut.xml

This works good for cars, but I have in my vehicles file 3 types of trucks:
  <vType  id="truck" vClass="truck" probability="0.333333333333" ...></vType>
  <vType  id="truck_semitrailer" vClass="truck" probability="0.333333333333"  ...></vType>
  <vType  id="truck_trailer" vClass="truck" probability="0.333333333333" ...></vType>

but only the one with id="truck" is used with probability that becomes 1.0. 
How can I have one single file for trucks that generates the three different types with probability 0.33?

Thank you.

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top