Progress finally on the Foster RNAV
After a lot of painful experimentation and work arounds of XML I think I have the RNAV math worked out and have it coupled to the HSI. I've tried several different waypoints and calculated the numbers using a terminal area chart for Phoenix and the numbers agree and the HSI points to the waypoint and the distance to go seems correct. The Century AP using the heading bug seems to have a problem but once established on course works OK. So what remains now is the buttons and switches for power and the display. I will have to figure out how to do a LED display that will show the VOR/DME data as well as the waypoint data.
I have included the math code below: The VOR_OFFSET value was inserted after the A:NAV1 OBS variable in the HSI (HSI from FSX Beech Baron gauge CAB) code with the exception of the OBS know INC/DEC element.
If anyone sees a problem with my code please speak up. I will appreciate any comments on the code and implementation method.
David
After a lot of painful experimentation and work arounds of XML I think I have the RNAV math worked out and have it coupled to the HSI. I've tried several different waypoints and calculated the numbers using a terminal area chart for Phoenix and the numbers agree and the HSI points to the waypoint and the distance to go seems correct. The Century AP using the heading bug seems to have a problem but once established on course works OK. So what remains now is the buttons and switches for power and the display. I will have to figure out how to do a LED display that will show the VOR/DME data as well as the waypoint data.
I have included the math code below: The VOR_OFFSET value was inserted after the A:NAV1 OBS variable in the HSI (HSI from FSX Beech Baron gauge CAB) code with the exception of the OBS know INC/DEC element.
If anyone sees a problem with my code please speak up. I will appreciate any comments on the code and implementation method.
David
Code:
<!--convert VOR radial to 0-359 degrees-->
<!--calc angle between nav radial and wp radial -->
(A:NAV1 RADIAL,degrees) dnor (L:WP1_BEARING,degrees) - s0 abs dgrd (>L:VOR_WP_ANGLE,radians)
<!-- calc distance from WP to plane = sqrt of (a^2 + b^2 - 2*a*b*cosC)
a = wp dist from vor L:WP1_DISTANCE
b = dme dist VOR to plane A:NAV1 DME
C = angle between nav radial and wp radial L:NAV1_WP -->
<!-- postfix a^2 b^2 2 a b C cos * * * - + sqrt -->
(L:WP1_DISTANCE,nmiles) sqr
(A:NAV1 DME,nmiles) sqr
2 (L:WP1_DISTANCE,nmiles)
(A:NAV1 DME,nmiles)
(L:VOR_WP_ANGLE,radians) cos * * * - + sqrt
(>L:DIST_PLANE_TO_WP,nmiles)
<!--calc VOR radial from WP in degrees
a = wp dist from vor L:WP1_DISTANCE
b = dme dist VOR to plane A:NAV1 DME
c =dist from plane to WP DIST_PLANE_TO_WP -->
<!--postfix BAC = b^2 c^2 a^2 - + 2 b c * * / acos -->
(A:NAV1 DME,nmiles) sqr
(L:DIST_PLANE_TO_WP,nmiles) sqr
(L:WP1_DISTANCE,nmiles) sqr - + 2
(A:NAV1 DME,nmiles)
(L:DIST_PLANE_TO_WP,nmiles) * * / acos rddg
(>L:VOR_OFFSET,degrees)
<!-- Calculate course to fly
if WP radial > VOR radial subtract VOR_OFFSET from NAV1 OBS
If WP radial < than VOR radial add VOR_OFFSET from NAV1 OBS-->
l0 0 <
if{ (L:VOR_OFFSET,degrees) /-/ }
els{ (L:VOR_OFFSET,degrees) (>L:VOR_OFFSET,degrees)}
Last edited: