Jump to content

Recommended Posts

Posted

You're missing the big negative sign and "east" symbol on the display. It's showing -116 and so on East. It should be showing a positive number W (west).

 

For a test hot start I was at -116°-2'-54'' East which according to F2 was 115°01'53'' West. When we look closely it's not 1° wrong it's 1 digit wrong in every of the three elements.

 

This is obviously a conversion from a signed longitude number. One logical way to produce D M S integers from a X.X decimal is to do the following:

 

D = X - X mod 1

M = (X - D) x 60 - (X - D) x 60 mod 1

S = (X - D - Mx60) x 60 - (X - D - M*60) x 60 mod 1

 

But every programmer in the room will slap their forehead. That may be right (assuming I didn't make a math mistake) but even if it is, it is an inefficient of the CPU.

 

Instead you can use the floor and mod functions and find the integer value which is no greater than your value. This can be done to be more computationally efficient than what I wrote above and probably my example below isn't the most efficient way either. But it does show that your method can change your outcome.

 

We can try it on X = 1.2345.

D = floor X = floor 1.2345 = 1

M = floor (X mod 1)*60 = floor 0.2345*60 = floor 14.07 = 14

S = floor (X mod 1)*60 mod 1 * 60 = floor (0.2345 * 60 mod 1 *60 = floor ( 14.07 mod 1 * 60 ) = floor ( 0.07 * 60 ) = floor ( 4.2 ) = 4

 

1.2345° is no less than 1°14'04'' and no more than 1°14'05''. Works great! However what happens if you try -1.2345°?

 

D = floor X = floor -1.2345 = -2

M = floor (X mod 1)*60 = floor -0.2345*60 = floor -14.07 = -15

S = floor (X mod 1)*60 mod 1 * 60 = floor (-0.2345 * 60 mod 1 *60 = floor ( -14.07 mod 1 * 60 ) = floor ( -0.07 * 60 ) = floor ( -4.2 ) = -5

 

So you can see a single formula that converts +1.2345 to 1°14'04'' but converts -1.2345 to -2°-15'-05''. I don't know if exactly what I did is how it is coded but something like it must have. Remember that when Ka-50 and ABRIS were first coded DCSW didn't even exist. The need to correctly convert negative Lat. and Long. didn't exist.

 

Obviously now in DCSW they convert from signed lat/long into E and W just fine bu the ABRIS isn't using the same code as the Open Alpha F2/F10 displays.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...