- Messages
- 1,749
- Country

I am having an issue trying to create a method to reverse the "GPS WP DISTANCE" variable. I can create a negative number but the code reads smaller as you get closer. I need higher as you get closer.
I thought we could use a sliding scale from 99.9Nmile 0 Nmile. The VNAV digits max is 99.9.
I need help to create a variable that will give 0% Radians at 99.9 Nmiles and 100% radians at 0 Nmiles.
P.S. This variable is just to add to my working tracking error code. This way I have a custom VSR. The default will not work when i tried using it with my changeable VNAV options.
This first code needs help for distance tracking.
This is my working altitude tracking. Please feel free to use it I created it from samples here on FS Developer. I have the display codes at the bottom for tracking distance and they only show the upper code for testing although both codes are one single code. Any help on errors here would be appreciated.
I thought we could use a sliding scale from 99.9Nmile 0 Nmile. The VNAV digits max is 99.9.
I need help to create a variable that will give 0% Radians at 99.9 Nmiles and 100% radians at 0 Nmiles.
P.S. This variable is just to add to my working tracking error code. This way I have a custom VSR. The default will not work when i tried using it with my changeable VNAV options.
This first code needs help for distance tracking.
Code:
(A:GPS IS ACTIVE WAY POINT,bool) 1 == if{
(A:GPS WP NEXT ALT,feet) (A:GPS WP DISTANCE,feet) /
(>L:Valueholder1,feet)
(>L:Valueholder1,feet) atg (>L:AngleToWPT1,radians)
(L:AngleToWPT1,radians) cos (>L:AngleholderCos1,radians)
(L:DISToWpt,feet) (A:GPS WP DISTANCE,feet) + (>L:TriangleHypotenuseAsqrd,feet)
(L:TriangleHypotenuseAsqrd,feet) sqrt (>L:TriangleHypotenuseA,feet)
(L:TriangleHypotenuseA,feet) (L:TriangleHypotenuseA,feet) * 1 * (L:AngleholderCos1,radians) * (>L:equationholder,number)
(L:TriangleHypotenuseAsqrd,feet) (L:TriangleHypotenuseAsqrd,feet) + (L:equationholder,number) - (>L:DISTrackError1Sqr,feet)
(L:DISTrackError1Sqr,feet) sqrt (>L:DISTrackError1,feet)
Code:
(A:GPS WP NEXT ALT,feet) (A:INDICATED ALTITUDE,feet) - (>L:HeightToWpt,feet)
(L:HeightToWpt,feet) (A:GPS WP NEXT ALT,feet) / (>L:Valueholder2,feet)
(L:Valueholder2,feet) atg (>L:AngleToWPT2,radians)
(L:AngleToWPT2,radians) cos (>L:AngleholderCos2,radians)
(L:HeightToWpt,feet) sqr (A:GPS WP NEXT ALT,feet) sqr + (>L:TriangleHypotenuseBsqrd,feet)
(L:TriangleHypotenuseBsqrd,feet) sqrt (>L:TriangleHypotenuseB,feet)
(L:TriangleHypotenuseB,feet) (L:TriangleHypotenuseB,feet) * 2 * (L:AngleholderCos2,radians) * (>L:equationholder,number)
(L:TriangleHypotenuseBsqrd,feet) (L:TriangleHypotenuseBsqrd,feet) + (L:equationholder,number) - (>L:VertTrackError1Sqr,feet)
(L:VertTrackError1Sqr,feet) sqrt - (>L:VertTrackError1,feet)
(L:TriangleHypotenuseB,feet) (L:TriangleHypotenuseB,feet) * 2 * (L:AngleholderCos2,radians) * (>L:equationholder,number)
(L:TriangleHypotenuseBsqrd,feet) (L:TriangleHypotenuseBsqrd,feet) + (L:equationholder,number) - (>L:VertTrackError2Sqr,feet)
(L:VertTrackError2Sqr,feet) sqrt (>L:VertTrackError2,feet)
(L:DISTrackError1,feet) (>L:VSR DISPLAY1,feet)
(L:DISTrackError2,feet) (>L:VSR DISPLAY2,feet)
}
Last edited:


but the distance rate is not correct. I am looking for the correct rate tonight. The direction for the distance is working correct. Reversing the distance reader seems to work when I add minus to the equation section since I have created one for each axis. I noticed in the changeover Hypotenuse section the distance is over board and so instead of sqr divided by sqrt, i used a common denominator and multiplied then divided.
If anyone needs a good sample let me know.