MikeKP61 Posted February 5, 2020 Report Posted February 5, 2020 Hello, I am using a modified version of your Lua script "RecordtoCSV" to create a short flight data recording for various phases of flight as part of a college project. I have extended it to include the recording of more flight parameters through offsets but I am having difficulty finding one for distance traveled over ground (I'm sing MFSX Steam Edition) There is one offset for GPSDistance but I'm not sure if this is what I am looking for. I want to record the ground track distance and using Lua sum it to give a total at the end of the CSV recording. Could you help please? Tank you
Pete Dowson Posted February 5, 2020 Report Posted February 5, 2020 3 hours ago, MikeKP61 said: I am having difficulty finding one for distance traveled over ground I think you need to compute that from the difference between Lat/Lon positions -- i.e. a bit of spherical trigonometry. There are formulae for such calculations on the web (try Google). Of course if it isn't the straight line distance you'd need to sum all the inidividual distances. If the recordings are made at short enough intervals, or the aircraft is moving slowly enough, more simple formulae could be used assuming a flat surface instead of curved. 3 hours ago, MikeKP61 said: There is one offset for GPSDistance but I'm not sure if this is what I am looking for. I want to record the ground track distance and using Lua sum it to give a total at the end of the CSV recording. I don't know but I rather doubt that GPSdistance is what you seek. Pete
MikeKP61 Posted February 6, 2020 Author Report Posted February 6, 2020 I have been using the Lat/Long calculation for some tests like takeoff run distance and it works fine but for endurance I need the distance for a much longer run and I don’t think the same method will be as accurate as required. I have seen someone mention using ground speed and multiplying by the interval of each cycle of the recordtocsv programme but I’m not sure where to find the interval? Is it a preset length of time for each cycle or does it vary and if it does vary is there any way of setting the interval as a variable in the lua script to use it in an equation? Thank you Pete you have been very helpful.
John Dowson Posted February 7, 2020 Report Posted February 7, 2020 The elapsed time for each entry is also logged in each entry (first column), so you should be able to calculate the interval. Alternatively, you can also adjust the script to directly log the interval (since last entry) if required. Note that the record to csv.lua script as provided is sleeping for 48 milliseconds on each loop iteration, to allow logging roughly 20 times per second. You can adjust this to your requirements. This delay/interval is approximate, so you should use the elapsed time to calculate the actual interval. John
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now