Jump to content
The simFlight Network Forums
MikeKP61

Distance Traveled Over Ground

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.