Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Traci error

hello Jakob, 
I want to calculate travel time in each time step and to compute travel time for each vehicle in Traci I used this code:
    while step < 14000:
        traci.simulationStep()
        for id in traci.vehicle.getIDList():
            pos0 =traci.vehicle.getPosition(id)[0]
            speed0 =traci.vehicle.getSpeed(id)
            step += 0.4
            traci.simulationStep()
            pos1 =traci.vehicle.getPosition(id)[0]
            speed1 =traci.vehicle.getSpeed(id)
            if speed1 == 0:
                avgTT = 0
            else:
                avgTT =(pos1-pos0)/speed1
            avgTT_list.append(avgTT)
            print(avgTT_list)
        step += 0.4
but after some time step sumo raise this error 
    raise TraCIException(err, prefix[1], _RESULTS[prefix[2]])
traci.exceptions.TraCIException: Vehicle '1.3' is not known.
how can I fix it and do you have any suggestions for calculating the travel time of each vehicle in each time step?

Back to the top