Posts

Showing posts with the label Plan13

A Correction For Plan13 in C

The short version of this post is as follows: the 'C' versions of Plan13 all share a bug that make the algorithm unable reliably to track HEO and GEO satellites. To fix this bug find the part of the code that reads something like this: /* Solve M = EA - EC * sin(EA) for EA given M, by Newton's method */ EA = M; /* Initail solution */ do { C = cos(EA); S = sin(EA); DNOM = 1.0 - EC * C; D = (EA - EC * S - M) / DNOM; /* Change EA to better resolution */ EA = EA - D; /* by this amount until converged */ } while (abs(D) > 1.0E-5); and replace abs with fabs . (If you are using the original C port by Edson Pereira this is line 501.) The more in-depth version of the story follows.