TraCI access to aggregated edgeData output isn't yet implemented.
The easiest workaround is to create a multiEntryExit detector for each edge
and then use the TraCI function
multientryexit. getLastIntervalMeanTravelTime
If you place entry and exit at the start and end of each edge you can then
compute the average speed from the meanTravelTime (time / length)
It should be fairly easy to create the multiEntryExit defintions for the
whole network with a python script and traci (or sumolib
https://sumo.dlr.de/docs/Tools/Sumolib.html)

The alternative would be to retrieve all vehicles from each edge in every
step and create a running total of speeds and vehicle number.
>From these values you can compute average speed and traveltime (again by
using edge length).
The totals should then be reset each 60s

regards,
Jakob

Am Mo., 7. März 2022 um 09:13 Uhr schrieb AM kb <[email protected]>:

> Hi Jakob,
> actually, I need two outputs every minute and these two outputs exist in
> Edge base data output. The first output is travel time and the second
> output is speed. The definition of speed in the Edge-based data output page
> is the mean speed on the edge/lane within the reported interval and the
> definition of travel time is the time needed to pass the edge/lane. so my
> main question is that is there any way to get these outputs every minute
> using Traci? because in this page:
> https://sumo.dlr.de/docs/Simulation/Output/Lane-_or_Edge-based_Traffic_Measures.html
> I did not see anything about getting output using Traci. assume this simple
> loop :
> while step < x:
>       for each minute:
>            for id in traci.edge.getIDList():
>                    get edge-based data speed output
>                    get edge-based data travel time output
>        run the next minute simulation
>
>
>
> On Mon, Mar 7, 2022 at 11:16 AM Jakob Erdmann <[email protected]>
> wrote:
>
>> 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
>>
> _______________________________________________
> 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