Hello, vehicles may pass multiple edges in a single step (depending on edge length and vehicle speed). This could be the reason why your check does not catch all vehicles in time. The easiest solution would be to add stops at the end of each route. This way vehicles will wait for however long you want instead of disappearing. See http://sumo.dlr.de/wiki/TraCI/Change_Vehicle_State#stop_.280x12.29 http://sumo.dlr.de/wiki/TraCI/Change_Vehicle_State#resume_.280x19.29
regards, Jakob 2017-01-02 7:09 GMT+01:00 Li Yan <[email protected]>: > Dear SUMO contributors, > > > > I'm using SUMO with Python to simulate the movement of taxicabs. To collect > relevant statistics, I expect the taxicabs to start and end movement at the > time I wish. But the problem I encountered is: even if I continuously > update > the route of the taxicabs before they arrive at the previously scheduled > destination (by checking whether the current edge is on the [-2] index of > the current route), the vehicles will leave the network gradually > regardless > of my route update function. I'm sure my route update function (using > traci.vehicle.changeTarget()) works: > > > > hello hello > > change route, wait > > targetEdge: -1 96337886 1.0 4 None > > None > > currentEdge: gneE198 > > hello hello > > change route, wait > > targetEdge: -1 97234470#2 1.0 4 None > > None > > currentEdge: 25435153#0 > > hello hello > > change route, wait > > targetEdge: -1 243508824#6 1.0 4 None > > None > > currentEdge: -97234776#2.4 > > ----------- > > taxi1 plan: > > -1 243508824#6 1.0 4 None > > current: 243508824#6 10.1719127836 > > operatingState: 2 > > currentStatus: 0 > > countPassengers: 0 > > nextUpdate: -1 243508824#6 1.0 4 None > > None > > route length: 9553 total edges: 8567 > > ----------- > > Traceback (most recent call last): > > File "drt.py", line 206, in <module> > > run(runId) > > File "drt.py", line 70, in run > > while traci.simulation.getMinExpectedNumber() > 0: > > File "Z:\sumo-0.23.0\tools\traci\simulation.py", line 186, in > getMinExpectedNu > > mber > > return _getUniversal(tc.VAR_MIN_EXPECTED_VEHICLES) > > File "Z:\sumo-0.23.0\tools\traci\simulation.py", line 52, in > _getUniversal > > result = traci._sendReadOneStringCmd(tc.CMD_GET_SIM_VARIABLE, varID, > "") > > File "Z:\sumo-0.23.0\tools\traci\__init__.py", line 330, in > _sendReadOneString > > Cmd > > return _checkResult(cmdID, varID, objID) > > File "Z:\sumo-0.23.0\tools\traci\__init__.py", line 359, in _checkResult > > result = _sendExact() > > File "Z:\sumo-0.23.0\tools\traci\__init__.py", line 293, in _sendExact > > _connections[""].send(length + _message.string) > > KeyError: '' > > > > As you can see from the log, taxi1 changed its route each time when it is > about to reach the last edge on route. But at the last step, it drove into > edge "243508824#6" and left the network. I've searched and known that the > vehicles' leaving can be avoided by repeatedly updating its route. It seems > to me that there are some other parameters controlling the end of vehicle > movement. The road network is a closed loop without dead end or dead start. > I've also specified start time and end time in sumocfg: > > > > <time> > > <begin value="0"/> > > <end value="36600"/> > > </time> > > > > But this doesn't work because I give the vehicles routes dynamically. Could > you please shed some light on this problem? Thank you and happy new year! > > > > Best regards, > > Li > > > > Li Yan, Ph.D. candidate > > Department of Computer Science > > University of Virginia > > Personal website: <http://www.people.virginia.edu/~ly4ss/> > http://www.people.virginia.edu/~ly4ss/ > > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > sumo-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sumo-user > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ sumo-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sumo-user
