Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Rerouting by traci python

If vehicles perform automated rerouting based on the "device.rerouting" options they will use
ROUTING_MODE_AGGREGATED and ignore the values set with traci.edge.setEffort.
For details, see https://sumo.dlr.de/docs/Simulation/Routing.html#travel-time_values_for_routing

To route periodically according to custom weight values either
a)
- disable automated updating of aggregated weights by setting option <device.rerouting.adaptation-interval value="0"/>
- call traci.vehicle.setParameter(ANY_VEHICLE_ID, "device.rerouting.edge:EDGE_ID", str(TRAVEL_TIME))  for every EDGE_ID you wish to change (vehicle id is arbitrary but the vehicle must exist)

b)
- don't use device.rerouting
- trigger rerouting with customized edge weights (setEffort) by calling traci.vehicle.rerouteTravelTime(vehID, False)

Am Do., 30. März 2023 um 09:00 Uhr schrieb 최석환 <my2853121@xxxxxxxxx>:
Dear SUMO users, hello

I want vehicles to reroute according to the current road conditions probabilistically during the simulation with traci Python.
Also, I would like to modify the weight used for reroute to edgeEffort.

The code of traci Python I wrote is as follows.

while step < 86400:
    traci.simulationStep()
    if traci.simulation.getTime() % 360 == 0:
        for edge in edges:
            if edge.getID() in tazlist:
                traci.edge.setEffort(edge.getID(), traci.edge.getTraveltime(edge.getID()) + 30)
            else:
                traci.edge.setEffort(edge.getID(), traci.edge.getTraveltime(edge.getID()))

        for vehId in traci.simulation.getDepartedIDList():
            traci.vehicle.rerouteEffort(vehId)
    step += 1

I am not sure how the code written in <routing> in sumo.cfg is applied together with the rerouteEffort written in traci Python, and how to apply it through traci Python. I want the following codes to be applied.
weights.random-factor 
device.rerouting.period, 
device.rerouting.adaptation-steps, 
device.rerouting.adaptation-interval,
device.rerouting.with-taz,
device.rerouting.threads,
device.rerouting.synchronize,

You have reviewed my question, thank you very much. I hope you have a great day ahead.
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