TUDelft-CNS-ATM / bluesky

The open source air traffic simulator
GNU General Public License v3.0
365 stars 244 forks source link

Is there any built- in function to calculate distance travel by the single aircraft? #492

Closed Grey-Hat-07 closed 9 months ago

Grey-Hat-07 commented 9 months ago

Note: While traveling one point to another the aircraft taking 100s of turns.
The function must calculate the total distance traveled by the aircraft

jooste commented 9 months ago

The total track distance flown for each aircraft is stored in traf.distflown. You can use it in a plugin like this:

import bluesky as bs

def somefunction():
    print(bs.traf.distflown)

You can also plot it while running bluesky: PLOT traf.distflown

Or log it to a CSV file with the following commands:

CRELOG MYLOG 1.0
MYLOG ADD traf.id traf.distflown
MYLOG ON
Grey-Hat-07 commented 9 months ago

thanks, it is working.

Grey-Hat-07 commented 9 months ago

Is there any similar exists for time taken by the aircraft to complete the trip?

jooste commented 9 months ago

No, although if you are using a logger you can take the difference of the timestep of first occurrence of a callsign and the last occurrence.