                     nmea2alm.exe

A utility that converts a NMEA format file to the YUMA format
(if the Almanac is present). It will then call "alm2tle" to
convert the YUMA format to the TLE format that can be used on
your favourite satellite tracking software.

Although many GPS receivers can output a number of the NMEA
sentences, not all can output the almanac "$GPALM" sentence.
Check your manual.

Usage:

N.B. Your GPS unit should have been receiving a good signal for
at least 15 minutes prior to downloading the almanac. It takes
this long for the almanac for all satellites to be transmitted
in the navigation message.

Use your existing software to talk to your GPS unit, request the
NMEA ALMANAC (see your GPS manual for the instructions).  Save
this in a file called NMEA.TXT.  This ASCII file should contain
the ALMANAC (sentences starting with $GPALM) however it can
contain other NMEA sentences as well. Copy NMEA.TXT to the
directory you have NMEA2ALM and ALM2TLE located in, then run:

nmea2alm

If NMEA.TXT contains ALMANAC data, a YUMA file will be produced,
ALM2TLE will be called directly from NMEA2ALM to produce
GPS.TLE. This file contains the Two Line Keplerian info that can
be used in your favourite satellite tracking software.

To test that everything is OK, you can check the YUMAx.TXT
output file against the following file:

ftp://sirius.chinalake.navy.mil/pub/nawc/local_almanac/almanac.yuma

This "sirius.chinalake" file is updated hourly. When comparing
the navy file against the output of nmea2alm, make sure that
the week numbers and the Toa (Time of Applicability) are the
same, otherwise you will be comparing different orbits.

When comparing your locally made YUMA file with the "chinalake"
file, you may notice on fields that have an angular measure,
they can differ after the 5th or 6th significant digit. This
does not occur with the Coast Guard files. It would seem the
"NAWC Receiver" is using a truncated form of PI.  The value used
in nmea2alm is the GPS value of 3.1415926535898, also all the
calculations in nmea2alm use "double" precision. As far as
accuracy is concerned, the Coast Guard Almanac is giving 11
digits of accuracy, the NAWC about 6.
At time of writing anyway ;-)

A NEW almanac is updated to the GPS satellites about once a day.

If a $GPALM sentence fails the XOR checksum, that line is not used.

My thanks to Dave Martindale who used his Garmin GPS-25LP
receiver to produce a file to test NMEA2ALM. The program should
work with other receivers if they can output the NMEA Almanac
format.

One thing I noted with the Garmin NMEA file, is that it seemed
not to output SV orbit data if the "health" was non ZERO. I'm
not sure if this "feature" is in the NMEA spec or not (anyone
know ??). Something to perhaps watch out for when using the NMEA
Almanac files. Alm2tle reports how many satellites it has data
for (last line of its output screen).

Example of "NMEA.TXT" input file (from Dave Martindale's GPS-25LP)

$GPALM,32,1,01,5,00,264A,4E,0A5E,FD3F,A11257,B8E036,536C67,2532C1,069,000*7B
$GPALM,32,2,02,5,00,9EEB,4E,FB56,FD42,A10D70,A7B1BC,A546AB,9AE1F9,F85,FFF*7A

Using the above as input, NMEA2ALM outputs the following (which has
been tested against a "Coast Guard" file with complete agreement).

**nmea2alm**   Week 5 almanac for PRN-01   **nmea2alm**
ID:                         01
Health:                     000
Eccentricity:               4.673957825E-03
Time of Applicability(s):   3.194880000E+05
Orbital Inclination(rad):   9.583808625E-01
Rate of Right Ascen(r/s):  -8.057478483E-09
SQRT(A) (m^1/2):            5.154292480E+03
Right Ascen at TOA(rad):    2.047519431E+00
Argument of Perigee(rad):  -1.745649913E+00
Mean Anom(rad):             9.129825962E-01
Af0(s):                     1.001358032E-04
Af1(s/s):                   0.000000000E+00
week:                       005

**nmea2alm**   Week 5 almanac for PRN-02   **nmea2alm**
ID:                         02
Health:                     000
Eccentricity:               1.939916611E-02
Time of Applicability(s):   3.194880000E+05
Orbital Inclination(rad):   9.353232138E-01
Rate of Right Ascen(r/s):  -8.023191341E-09
SQRT(A) (m^1/2):            5.153679688E+03
Right Ascen at TOA(rad):   -2.226700821E+00
Argument of Perigee(rad):  -2.167348572E+00
Mean Anom(rad):            -2.481791789E+00
Af0(s):                    -1.173019409E-04
Af1(s/s):                  -3.637978807E-12
week:                       005

The above YUMA file becomes GPS.TLE after action from alm2tle.exe


GPS PRN=01
1 22231U 92079A   99272.69762732  .00000000  00000-0  00000-0 0  0001
2 22231  54.9112 121.6200 0046740 259.9816  52.3100  2.00491339 00009
GPS PRN=02
1 20061U 89044A   99272.69762732  .00000000  00000-0  00000-0 0  0008
2 20061  53.5901 236.7253 0193992 235.8201 217.8038  2.00562865 00009


See alm2tle.TXT for further info on the conversion process.

Anyways, have fun and learn with the output TLE.
