comprehensive Navigational Equipments Repair procedures

AIS

Here is a typical AIS NMEA message:

!AIVDM,1,1,,A,14eG;o@034o8sd062D,0*7D

In Order:


!AIVDM:        The NMEA message type
1              Number of Sentences (some messages need more then one)
1              Sentence Number (1 unless it's a multi-sentence message)
               The blank is the Sequential Message ID (for multi-sentence messages)
A              The AIS Channel (A or B)
14eG;...       The Encoded AIS Data (more on this later)
0*             End of Data
7D             NMEA Checksum (more on this later)


For most programmers that part was the easy part - it's just a comma delimited list of data elements. Not the tricky bit - the encoded AIS data...

in NMEA encoding for AIS - each ASCII characters corresponds to 6 binary bits (unlike normal ASCII which uses 8 bits) so you need to step through each character and subtract 48 from the ASCII - then if it's still a decimal number > 40 subtract another 8 - then convert to binary: this guarantees a 6 bit number. Looking at our data (just the first few characters)

14eG

1 = 000001
4 = 000100
e = 101101
G = 010111
and so on...

The complete data string decoded looks like this when strung Back together.
000001 000100 101101 010111 011100 001010 010000 000000 000000 000000 110111 001000 110111 100001 101000 011100 011101 110010 011111 101011 110000 110101 010111 010000 000000 001000 011000 011011

Now you start grabbing sets of bits from this and converting to decimal. Here are the key pieces of information assuming the first character is a '1' (the message type):

MMSI Number - Starting from bit 8 for 30 bits
            = 010010110101011101110000101001 = 316005417

HDG - bit 128 for 9 bits
COG - bit 116 for 12 bits (and divide by 10)
SOG - bit 50 for 10 bits (and divide by 10)

Lat - bit 89 for 27 bits (a signed binary number, divide by 600000)
Lon - bit 61 for 28 bits (a signed binary number, divide by 600000)

That's the key info. I plan to write a complete article on this for the benefit of the net community - but this is a quick summary for those that have been looking for a long time now.