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()
|