Loading ...
Sorry, an error occurred while loading the content.

Re: Trying to understand the decoding of the aivdm message bytes

Expand Messages
  • Thormod (Tom) Nordahl
    Thanks for the offer, but may I keep it for a rainy day ? I found Id 24 on AisParser.com http://aisparser.com/sdk/structaismsg__24.html Actually - I didn t.
    Message 1 of 16 , Sep 11, 2008
    • 0 Attachment
      Thanks for the offer, but may I keep it "for a rainy day"?
      I found Id 24 on AisParser.com
      http://aisparser.com/sdk/structaismsg__24.html
      Actually - I didn't. Somebody pointed it out to me.

      Tom
      --- In aismon@yahoogroups.com, "lmukis" <lmukis@...> wrote:
      >
      > Hay Tom
      >
      > I considered doing the very same thing, creating a bit stream using
      > the c++ string type, it makes the value extraction simple but
      seemed
      > a little excessive, storage wise, when a simple character array
      would
      > do. At present I have a C++ version of my parser that I'm porting
      to
      > Java (I want a GUI but I don't do `visual' C++) I'll have to take a
      > look at VB to see what that offers
      >
      > Thanks for the ROT info. I'll be happy to pass on the Msg 24
      protocol
      > as soon as I get my hands on 1371-3
      >
      >
      > --- In aismon@yahoogroups.com, "Thormod (Tom) Nordahl"
      > <thormod.nordahl@> wrote:
      > >
      > > Hi AJ
      > > Thanks for the explanation. I'm doing it differently, since I do
      > ues
      > > Basic (VB) I wrote a simple function that converts the data to a
      > > bitstring. VB is excellent at manipulating strings and I use MiD$
      > to
      > > return the spesified number of bits. I then use en other function
      > to
      > > convert that bitstring into its value. More code, but works fine.
      > >
      > > ROT
      > > I get 4 BitStreams 00000000, 10000000,10000001 and 01111111
      > > Representing signed single Byte numbers as I understand it.
      > >
      > > 0 is selfexplanatory (although not in accordance with 1371).
      > > 10000000 Hex 80 -127 Default, not available
      > > 10000001 -127 turning left faster than 720 deg/min
      > > 01111111 127 turning right faster than 720 deg/min
      > >
      > > But,the meaning of:
      > > Coded by ROTAIS=4.733 SQRT(ROTINDICATED) degrees/min
      > > ROTINDICATED is the Rate of Turn (720 degrees per minute), as
      > > indicated by an external sensor.
      > > eludes me.
      > >
      > > Tom
      > >
      > > Please, when you get 1371-3, I'd love to have the protocol for
      Msg
      > ID
      > > 24.
      > >
      > > --- In aismon@yahoogroups.com, "lmukis" <lmukis@> wrote:
      > > >
      > > > Hi Tom
      > > >
      > > > I wanted to use an unsigned character array to handle the data
      > and
      > > > decided to pack the 6 bit bytes into the array. I then have a
      > > simple
      > > > routine to extract the required bits given the first and last
      bit
      > > > positions (i.e. 89-115 for Latitude) I needed to keep the code
      > > basic
      > > > (NOT B.A.S.I.C!) as I suspect I may have to port this to an
      > > embedded
      > > > ADA environment.
      > > > I'm sure others have better methods of doing the bit
      manipulation
      > > and
      > > > I always welcome suggestions.
      > > >
      > > > One area I'm currently stuck on is the rate of turn calculation
      > > (b42-
      > > > b49 deg/min) If anyone can enlighten me I'd be most
      appreciative.
      > > >
      > > > AJ
      > > >
      > > >
      > > > --- In aismon@yahoogroups.com, "Thormod (Tom) Nordahl"
      > > > <thormod.nordahl@> wrote:
      > > > >
      > > > > Interesting, You too have found the error in the BosunMates
      > > parsing
      > > > > example.
      > > > >
      > > > > But I dont understant the need to Quote: Overlay your 6 bit
      > bytes
      > > > > onto 8 bit bytes and you'll get –UnQuote.
      > > > > At this point we are dealing with a bitstream and I dont see
      > the
      > > > > purpose of bunching them into bytes.
      > > > >
      > > > > Tom
      > > > >
      > > > > --- In aismon@yahoogroups.com, "lmukis" <lmukis@> wrote:
      > > > > >
      > > > > > To decode the `data' section of an AIVDM sentence –
      > > > > >
      > > > > > Convert the 8 bit ASCII `data' to the 6 bit ASCII used to
      > > encode
      > > > > the
      > > > > > AIS sentence. Do this by stepping through each character in
      > > turn
      > > > > and
      > > > > > subtracting 48, if the result is greater than 40, subtract
      > > > another
      > > > > 8.
      > > > > >
      > > > > > For Example –
      > > > > >
      > > > > > !AIVDM,1,1,,A,14eG;o@034o8sd<L9i:a;WF>062D,0*7D
      > > > > >
      > > > > > 8bit 6bit
      > > > > > ------------------------
      > > > > > 0 1 0x31 0x01 000001
      > > > > > 1 4 0x34 0x04 000100
      > > > > > 2 e 0x65 0x2d 101101
      > > > > > 3 G 0x47 0x17 010111
      > > > > > 4 ; 0x3b 0x0b 001011
      > > > > > 5 o 0x6f 0x37 110111
      > > > > > 6 @ 0x40 0x10 010000
      > > > > > 7 0 0x30 0x00 000000
      > > > > > 8 3 0x33 0x03 000011
      > > > > > 9 4 0x34 0x04 000100
      > > > > > 10 o 0x6f 0x37 110111
      > > > > > 11 8 0x38 0x08 001000
      > > > > > 12 s 0x73 0x3b 111011
      > > > > > 13 d 0x64 0x2c 101100
      > > > > > 14 < 0x3c 0x0c 001100
      > > > > > 15 L 0x4c 0x1c 011100
      > > > > > 16 9 0x39 0x09 001001
      > > > > > 17 i 0x69 0x31 110001
      > > > > > 18 : 0x3a 0x0a 001010
      > > > > > 19 a 0x61 0x29 101001
      > > > > > 20 ; 0x3b 0x0b 001011
      > > > > > 21 W 0x57 0x27 100111
      > > > > > 22 F 0x46 0x16 010110
      > > > > > 23 > 0x3e 0x0e 001110
      > > > > > 24 0 0x30 0x00 000000
      > > > > > 25 6 0x36 0x06 000110
      > > > > > 26 2 0x32 0x02 000010
      > > > > > 27 D 0x44 0x14 010100
      > > > > >
      > > > > > Overlay your 6 bit bytes onto 8 bit bytes and you'll get –
      > > > > >
      > > > > > 00000100 01001011 01010111 00101111 01110100 00000000
      > 00001100
      > > > > > 01001101 11001000 11101110 11000011 00011100 00100111
      00010010
      > > > > > 10101001 00101110 01110101 10001110 00000000 01100000
      10010100
      > > > > >
      > > > > > Then just pick out the bit patterns to give you the various
      > > > values.
      > > > > >
      > > > > > For example -
      > > > > >
      > > > > > Bits 0 – 5 = The Message ID
      > > > > > Bits 8 – 37 = The MMIS Number
      > > > > > .
      > > > > > .
      > > > > > .
      > > > > > .
      > > > > > Bits 62 – 89 = Longitude
      > > > > > Bits 90 – 116 = Latitude
      > > > > > .
      > > > > > .
      > > > > > .
      > > > > > .
      > > > > > etc.
      > > > > >
      > > > > > Using this process the message above decodes to -
      > > > > >
      > > > > > ------------ NMEA AIS Message -------------
      > > > > >
      > > > > > NMEA Message Header : !AIVDM
      > > > > > Number of Sentences : 1
      > > > > > Sentence Number : 1
      > > > > > Sequential Message ID : 0
      > > > > > AIS Channel : A
      > > > > > Checksum : 0x7d
      > > > > > -------------------------------------------
      > > > > > Message Type : 1
      > > > > > Repeat : 0
      > > > > > MMSI : 316001245
      > > > > > Nav. Status : 0000
      > > > > > Rate of Turn : 0.0
      > > > > > SOG : 19.6
      > > > > > Pos. Accuracy : 1
      > > > > > Longitude : 323 degrees 30 minutes
      > > > > > Latitude : 49 degrees 12 minutes
      > > > > > COG : 235.0
      > > > > > True Heading : 235
      > > > > > Message Time : 7 seconds past the minute
      > > > > > Regional App. : 0000
      > > > > > -------------------------------------------
      > > > > >
      > > > > > AJ
      > > > > >
      > > > > > --- In aismon@yahoogroups.com, "Thormod (Tom) Nordahl"
      > > > > > <thormod.nordahl@> wrote:
      > > > > > >
      > > > > > > Lets just take one 8bit char "E"
      > > > > > >
      > > > > > > E ASCII 69
      > > > > > >
      > > > > > > One approach:
      > > > > > > 69 - 48 = 21
      > > > > > > 53 -8 = 13
      > > > > > > 13 = 001101
      > > > > > >
      > > > > > > Second approach
      > > > > > > 6 bit ASCII
      > > > > > >
      > > > > > > E = 5
      > > > > > > 5 = 000101
      > > > > > >
      > > > > > > Third approach
      > > > > > >
      > > > > > > 69 = 01000101
      > > > > > > Remove 2 MSB = 000101 (Same as second approach)
      > > > > > >
      > > > > > > Can anybody enlighten me?
      > > > > > >
      > > > > > > And thanks and cudos to the creator of aismon.
      > > > > > >
      > > > > > > Tom
      > > > > > >
      > > > > >
      > > > >
      > > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.