Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] modify the function of the the traci.vehicle.rerouteTraveltime(vehID, currentTravelTimes)

Dear all 
If I modify the function of  the traci.vehicle.rerouteTraveltime(vehID, currentTravelTimes)


to
def rerouteTraveltime(self, vehID, currentTravelTimes=True):
"""rerouteTraveltime(string, bool) -> None Reroutes a vehicle. If
currentTravelTimes is True (default) then the current traveltime of the
edges is loaded and used for rerouting. If currentTravelTimes is False
custom travel times are used. The various functions and options for
customizing travel times are described at https://sumo.dlr.de/wiki/Simulation/Routing
When rerouteTraveltime has been called once with option
currentTravelTimes=True, all edge weights are set to the current travel
times at the time of that call (even for subsequent simulation steps).
"""
if currentTravelTimes:
time = self._connection.simulation.getTime()
if time != self.LAST_TRAVEL_TIME_UPDATE:
self.LAST_TRAVEL_TIME_UPDATE = time
for edge in self._connection.edge.getIDList():
self._connection.edge.adaptTraveltime(
edge, self._connection.edge.seteffort(edgeID,time))
self._connection._beginMessage(
tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_REROUTE_TRAVELTIME, vehID, 1 + 4)
self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 0)
self._connection._sendExact()
Could I use this modified function to modifty the travel time  to an artifical one which is not the real travel time that SUMO would be used to do the reroute algorithm?

Back to the top