I'm not sure what you mean by "travel time". Usually the concept refers to
the time it takes for traveling a specified distance (i.e. the travel time
for a trip or the travel time for road). Your code looks is if you want to
determine the length of time during which a vehicle is traveling within 60
seconds. This makes little sense because the the vehicle will always spend
60s traveling when it is in the simulation for 60 seconds. If you want to
compare travel times, please describe exactly what kind of time you're
interested in (maybe with an example).

Am Fr., 4. März 2022 um 19:35 Uhr schrieb AM kb <[email protected]>:

> Hello dear Jakob,
> Actually, my goal is to compare two travel times in two different time
> intervals. I mean:
> for every 60 seconds:
>      for each edge:
>          compute travel tine
>          store travel time
>          compare it with the previous 60 seconds
>          if comparison exceed a threshold
>               change speed
>          else
>                continue simulation
> so, for this purpose what is your opinion, can I get travel time for every
> 60 seconds?
>
>
>
>
> On Fri, Mar 4, 2022 at 3:23 PM Jakob Erdmann <[email protected]>
> wrote:
>
>> By calling simulationStep within the loop 'for id in
>> traci.vehicle.getIDList()' vehicles may leave the simulation area and
>> thereby become unavailable for the iteration.
>> You could store the positions of all vehicles once, the call
>> simulationStep once and then compute whatever you wish to compute for all
>> vehicles that are still in the simulation.
>> However, I don't think that your code computes something useful. The
>> travel time in one time step is always equal to the duration of one time
>> step (the avgTT value that you compute may be less since you are only
>> looking at x, not y).
>>
>> Am Do., 3. März 2022 um 10:06 Uhr schrieb amir kr <[email protected]
>> >:
>>
>>> hello Jakob,
>>> yes but I want to calculate travel time in each time step and
>>> optimize it and I think fcd output can not change vehicles' positions
>>> dynamically.
>>> 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?
>>>
>>> On Wed, Mar 2, 2022 at 10:00 AM Jakob Erdmann <[email protected]>
>>> wrote:
>>>
>>>> Have you considered using fcd-output?
>>>> The simplest (though not the most efficient) way to retrieve data from
>>>> all vehicles is by looping over the list of all ids:
>>>>
>>>> for vehID in traci.vehicle.getIDList():
>>>>    traci.vehicle.getPosition(vehID)
>>>>
>>>> Am Di., 1. März 2022 um 14:59 Uhr schrieb amir kr <
>>>> [email protected]>:
>>>>
>>>>> Hello everyone,
>>>>> I want to get the position of all vehicles in each step time but when
>>>>> I want to use traci.vehicle.getPosition(VehID) I do not know what to put
>>>>> instead of VehID because I want to get the position of all vehicles. how
>>>>> can I fix it ?
>>>>> best regards,
>>>>> Amir,
>>>>> _______________________________________________
>>>>> sumo-user mailing list
>>>>> [email protected]
>>>>> To unsubscribe from this list, visit
>>>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>>>
>>>> _______________________________________________
>>>> sumo-user mailing list
>>>> [email protected]
>>>> To unsubscribe from this list, visit
>>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>>
>>> _______________________________________________
>>> sumo-user mailing list
>>> [email protected]
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>
>> _______________________________________________
>> sumo-user mailing list
>> [email protected]
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to