AIS3.Encoding payload of AIS
Idea is to use GPS information, to send out a AIS message.there are several items need to be built up:
0b0 000000 001000 011000 011011
Which make the whole payload=
000001001000000110010111010000111101111000010000000001011000010101010100011011001000100111110101110110101000010000000100 1101 00101111111110111100000000001000011000011011
Now, how to convert it into 6 bits??
well, I decided to use the most stupid one, one by one.....
Here I made a bit map to help me understand the correct mapping:
when :
sync state=0, UTC direct
When slot timeout = 1 - Then the sub message is UTC hour and minute
Hour (0-23) should be coded in bits 13 to 9
Here is the git
https://github.com/Ldsrc2008/AIS-encode-arduino
- messge type: plan to use type 1 for position report
- which makes 6 bits 0b000001
- repeat indicator: 0
- which makes 2 bits 0b00
- MMSI: 543543543
- whcih maks 30 bits: 0b100000011001011101000011110111
- Navigation status: 8 , under way sailing
- which makes 4 bits: 0b1000
- rate of turn: 128, not available
- which makes 8 bits:0b01000000
- SOG: 8.8kt
- 8.8knt=88(unit at 0.1kt), which makes 0b0001011000
- position accuracy: 0( GNSS >10m) or 1 (DGPS<10m)
- which makes 0b0
- Longitude
- -149.329461 is presneted with unit = 1/0000min in 28bits, -149.329461degree*60000=-89597676.6, round to -89597677
- 89597677 in 28 bit=0b 0101 0101 0111 0010 0110 1110 1101
- flip bits:1010 1010 1000 1101 1001 0001 0010
- add 1= 1010101010001101100100010011 , this is -89597677 in 28 bits binary
- Latitude
- -17.732161 degrees in unit of 1/10000 min=-10,639,296.6 round to -10639296
- 10639296 in 27 bits= 0b 000 1010 0010 0101 0111 1100 0000
- flip bit: 0b111 0101 1101 1010 1000 0011 1111
- add 1= 0b111010111011010100001000000
- COG
- 123.4 degree, in unit of 0.1 degree=1234
- 1234 in 12 bits=0b0100 1101 0010
- True heading 0 to 359 degrees, 511 = not available.
- 511 in 9 bits=0b111111111
- time stamp seconds
- 30 second
- 30 in 6bits=0b011110
For bit 143~167 no to use. so there is 25 bits I took the last 25 bits from previous example
0b0 000000 001000 011000 011011
Which make the whole payload=
000001001000000110010111010000111101111000010000000001011000010101010100011011001000100111110101110110101000010000000100 1101 00101111111110111100000000001000011000011011
Now, how to convert it into 6 bits??
well, I decided to use the most stupid one, one by one.....
Here I made a bit map to help me understand the correct mapping:
when :
sync state=0, UTC direct
When slot timeout = 1 - Then the sub message is UTC hour and minute
Hour (0-23) should be coded in bits 13 to 9
Here is the git
https://github.com/Ldsrc2008/AIS-encode-arduino
留言
張貼留言