Hi,

I am having a problem with tripinfo.xml. I am starting a simulation and
lets say it runs for 10 seconds and then I make a saveState (let's call
this state 0). During this time 3 cars have finished their journey and
their info was written in the tripinfo file. I continue the simulation for
10 more seconds (let's call this simulation 1) and 2 more cars' info is
written in the file, I calculate the distance driven by all cars so far.
Now I use loadState to load back state 0, that I saved earlier without
stopping the simulation (traci.close) and I do another 10 seconds
simulation with a bit of randomness and try to calculate the distance
again. The problem is the 2 cars from simulation 1 are still there in the
file. Is there a way to restore the tripinfo file to the same state when
state 0 was saved. Or is there a way to specify a different tripinfo file
with loadState.

On Tue, Feb 16, 2021 at 2:13 PM Jakob Erdmann <[email protected]> wrote:

> set option --tripinfo-output.write-unfinished
>
> Am Di., 16. Feb. 2021 um 20:37 Uhr schrieb . Abdullah <[email protected]>:
>
>> Hi,
>>
>> I have tried the --tripinfo-output option to get the total distance
>> traveled by all vehicles but it only gives me the values for those vehicles
>> that have reached their destination. Is there a way get distance travelled
>> by both vehicles that are still in the networking and those that have
>> finished their journey, together at the end of a simulation.
>>
>> On Sat, Feb 13, 2021 at 12:29 PM . Abdullah <[email protected]> wrote:
>>
>>> Thank you Lokesh and Jakob for the ideas. I'll try them both and see how
>>> it goes. Thank you again.
>>>
>>> On Sat, Feb 13, 2021 at 4:55 AM Jakob Erdmann <[email protected]>
>>> wrote:
>>>
>>>> You can also use --statistic-output and multiply the number of arrived
>>>> vehicles ('inserted' - 'running')  with vehicleTripStatistic attribute
>>>> 'routeLength' .
>>>>
>>>> Am Sa., 13. Feb. 2021 um 01:37 Uhr schrieb Lokesh Das <
>>>> [email protected]>:
>>>>
>>>>> Hi Abdullah,
>>>>>
>>>>> You can use the tripinfo.xml file to calculate the total distance
>>>>> traveled by all vehicles at the end of the simulation.  The tripinfo file
>>>>> contains the total travel distance for every vehicle which has finished 
>>>>> its
>>>>> trip. You just need to parse it.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> On Fri, Feb 12, 2021 at 3:26 PM . Abdullah <[email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to calculate the total distance travelled by all vehicles
>>>>>> in a network from start to end of a simulation. Currently, I am doing the
>>>>>> following after every simulation step: get the list of all vehicle ids
>>>>>> using traci.vehicle.getIDList() and then iterate over the list and
>>>>>> call traci.vehicle.getDistance(vehid) and save this value to add up 
>>>>>> later.
>>>>>>
>>>>>> This becomes very slow as the number of vehicles increases over time.
>>>>>> If I do this once at the end of the simulation then I lose the 
>>>>>> information
>>>>>> about vehicles that have reached their destination between start and end.
>>>>>>
>>>>>> I was wondering if there is a way of finding the total distance
>>>>>> travelled once at the end of the simulation that also takes into account 
>>>>>> of
>>>>>> all the vehicles that have left the network.
>>>>>>
>>>>>> --
>>>>>> Thank you.
>>>>>> Abdullah
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>
>>>
>>> --
>>> Thank you.
>>> Abdullah
>>>
>>
>>
>> --
>> Thank you.
>> Abdullah
>> _______________________________________________
>> 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
>


-- 
Thank you.
Abdullah
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to