In this post I will discuss AIS message type 1, which is a position report. Together with message type 2 and 3 it is also called the Common Navigation Block (CNB).
I will explain message type 1 using an example, which I will decode manually only using a calculator, when I become too lazy to do the calculations by hand, because binary operations on large numbers get rather tedious after a while.
Our sample message:
We will focus on the content of this AIVDM message for now:
Message type 1 has a length of 168 bits. If you count the number of characters of the content of the message above, you will get 28 as a result. I know this without counting them, because AIS encodes messages using a 6-bits ASCII mechanism and 168 divided by 6 is 28.
So, how does this work?
The table below lists the characters of the content of the message in the left column:
The first column shows the characters of the message’s content. The second column gives the ASCII code for that character. Now, the next column, labeled Decimal, shows the values of the ASCII code minus 48, but if the result of that operation is larger than 40, you also subtract 8 of that remaining value.
8 has 56 as ASCII code. 56 minus 48 is 8. 8 is smaller than 40, so 8 is the final result.
w has 119 as ASCII code. 119 minus 48 gives you 71. 71 is bigger than 40. So, you subtract 8, which results in 63. Done!
If you repeat this for all characters, the third column above is what you will get. Now, write down the 6-bit binary representation of these numbers (fourth column).
This results in the following bit stream:
000001 000011 000011 110101 010000 110111 101111 100000 000000 000000
100000 010100 001011 001000 001000 011101 010100 000101 011101 100100
010100 111111 111111 010000 000010 010100 000111 110011
We split the message according to the decoding specifications of this message:
The decimal value of 000001 (the binary representation of the field Message Type) is 1, which should not be a surprise. We are dissecting an AIS message of type 1 and that’s exactly what we have here.
The repeat indicator is 0.
The MMSI has a length of 30 bits. It is an unsigned integer, so that is an easy one. We’ll take the Windows calculator and put it in Programmer’s view. We enter the 30 bits in binary mode and when we change it to decimal mode, we get the MMSI of the vessel: 205344990.
The navigation status: 1111, which gives us 15. This field refers to an enumeration of predefined values. 15 means “Not defined”, which is the default value for this field.
The Rate of Turn is a signed integer. To get the decimal representation, you have got to use two’s complement: 10000000 => –128. This means that there is no turn information available (again this is the default value).
Speed over ground is an unsigned integer, 0 in this message. So, the ship is not moving.
Position accuracy is 1. This field is of type boolean, so 1 is true.
The longitude and the latitude values are also unsigned integer, but the decimal values should be divided by 10000 to obtain the longitude and latitude in minutes:
- longitude: 0000001010000101100100000100 => 2644228; divided by 10000 => 264.4228’ => 4° 24.4228’
- latitude: 001110101010000010101110110 => 30737782; divided by 10000 => 3073.7782 => 51° 13.7782’
For the Course over ground field (length in bits: 12): 010001010011, we find a value of 1107. This should be divided by 10, which gives us 110.7°
The rest of the exercise is easy.
True heading has a value of 511, which means that it is not available.
Time stamp is 40.
Maneuver indicator is 0 and the RAIM flag is set to true.
The last 19 bits represent a SOTDMA radio status message. We will talk about that in another post.
So, what does this message tell us? We know from the content that the vessel with MMSI 205344990 is at position: latitude: 51° 13.7782’’ and longitude: 4° 24.4228. Its position is accurate and it is not moving.