Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How is distance flown calculated?

Featured Replies

Sorry for this curious question.

I'm trying to use SPAD to compute the total distance flown and I know Little Navmap already does it so I wonder if it uses Simconnect variables, then I would be able to replicate that with SPAD.

Thanks!

Lu.

  • Author
4 hours ago, albar965 said:

Distance flown is calculated from the flown aircraft trail segments since takeoff. It is summarized while flying and independent of flight plan and loaded aircraft performance file.

Alex

Thanks Alex, May I ask how you get the aircraft position via Simconnect? (I guess).

And if you update the trails every time these vars are being updated? 

My guess is to take the LAT and LON from Simconnect and compute  the geodesic distance every time those change but I'm getting different results than LittleNavMap so I wonder what I'm doing wrong. 

 

9 hours ago, lrargerich said:

Thanks Alex, May I ask how you get the aircraft position via Simconnect? (I guess).

Fetching the SimVars "Plane Latitude" and "Plane Longitude". This fetch time can be set in the connection dialog.

9 hours ago, lrargerich said:

And if you update the trails every time these vars are being updated? 

This depends. The trail is kept as lean as possible to avoid performance problems when painting.
The distance calculation is independent of this but not calculated with every update. Only every 75  to 550 ms. This depends on the update rate set in options on page "Simulator Aircraft".

9 hours ago, lrargerich said:

My guess is to take the LAT and LON from Simconnect and compute  the geodesic distance every time those change but I'm getting different results than LittleNavMap so I wonder what I'm doing wrong. 

The distance is the Great Circle distance between points. This is probably too accurate for such short point distances but it does not hurt.

Alex

  • Author

Thanks for the details. May I wonder which distance formula is being used?

The one I have is:

(Acos((Sin((([PROFILE:A_GPS_PREV_LAT] * 3.1415926535 / 180))) * Sin((([SIMCONNECT:GPS POSITION LAT]  * 3.1415926535 / 180)))) + (Cos((([PROFILE:A_GPS_PREV_LAT] * 3.1415926535 / 180))) * Cos((([SIMCONNECT:GPS POSITION LAT]  * 3.1415926535 / 180)))) * (Cos((([SIMCONNECT:GPS POSITION LON]  * 3.1415926535 / 180)) - (([PROFILE:A_GPS_PREV_LON] * 3.1415926535 / 180))))) * 6378)

But this one is giving me a flown distance greater than LittleNavMap, I know there are other Great circle distances but not sure which one is the one you used.

 

1 hour ago, lrargerich said:

But this one is giving me a flown distance greater than LittleNavMap, I know there are other Great circle distances but not sure which one is the one you used.

Derived from this one: https://www.edwilliams.org/avform147.htm#Dist
This is BTW a great collection for all formulae around aviation. I used this a lot.

Implementation is here: https://github.com/albar965/atools/blob/8249e5a00c6e36397605e9dd6c27c0039dd95d04/src/geo/pos.cpp#L724-L729

Alex

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.