Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11   Report Post  
posted to rec.boats.electronics
 
Posts: n/a
Default how to read AIS data from encapsulated NMEA VDO sentence


Paul wrote:
wrote in message
oups.com...
Actually, I re-read what I posted and it didn't really make sense.

1. Start with the array of ascii characters
2. Convert to the 6 bit binary value.
3. Convert this byte array to a 6 bit bitstream.
4. Then just pull out the bits yuo want using the various bit
operators. I tried to use a bit-field, but it didn't seem to work in
Windows.

As I said, it all works until I get to character arrays (call sign etc)


Here is a portion of the code i wrote to handle message type 5 (I'm only
handling the "Ship Static and Voyage Related Data
" variant for now). My comments follow the code. Pay attention to my
function H6StrToAsc, and how I manipulate the ascii.


I'll assume Paul's code is right He's skipping the intermediate step
which may be where the confusion lies. There are several layers of
things happening here.

0. Bits over the air: 9600bps GMSK data.
1. Demodulated bitstream, eg. 168 bits for a message 1.
2. Actual message content like Message ID, MMSI, Ship Name.
3. Serial output of bitstream using 6-bit encoding.

The data you see in the VDM sentence is a 6-bit encoded representation
of the raw bitstream, first bit on the left, last bit on the right (as
God intended things!).

To get the ship name you need to either skip ahead like Paul did, or
convert the 6-bit back to its bitstream. Then you grab the bits in the
name position and apply the m.1371 ASCII encoding rules to those bits.
BUT! That conversion is DIFFERENT from the 6-bit encode/decode. That is
probably what was tripping you up.

..cp

  #12   Report Post  
posted to rec.boats.electronics
Paul
 
Posts: n/a
Default how to read AIS data from encapsulated NMEA VDO sentence


wrote in message
oups.com...

Paul wrote:
wrote in message
oups.com...
Actually, I re-read what I posted and it didn't really make sense.

1. Start with the array of ascii characters
2. Convert to the 6 bit binary value.
3. Convert this byte array to a 6 bit bitstream.
4. Then just pull out the bits yuo want using the various bit
operators. I tried to use a bit-field, but it didn't seem to work in
Windows.

As I said, it all works until I get to character arrays (call sign
etc)


Here is a portion of the code i wrote to handle message type 5 (I'm only
handling the "Ship Static and Voyage Related Data
" variant for now). My comments follow the code. Pay attention to my
function H6StrToAsc, and how I manipulate the ascii.


I'll assume Paul's code is right He's skipping the intermediate step
which may be where the confusion lies. There are several layers of
things happening here.

0. Bits over the air: 9600bps GMSK data.
1. Demodulated bitstream, eg. 168 bits for a message 1.
2. Actual message content like Message ID, MMSI, Ship Name.
3. Serial output of bitstream using 6-bit encoding.

The data you see in the VDM sentence is a 6-bit encoded representation
of the raw bitstream, first bit on the left, last bit on the right (as
God intended things!).

To get the ship name you need to either skip ahead like Paul did, or
convert the 6-bit back to its bitstream. Then you grab the bits in the
name position and apply the m.1371 ASCII encoding rules to those bits.
BUT! That conversion is DIFFERENT from the 6-bit encode/decode. That is
probably what was tripping you up.

.cp


I hereby give you a full money-back guarantee that my code is correct. At
least it seems to usually kind of work. The only trouble I've seen is that
I get a spurious (or incorrectly encoded?) rate-of-turn value sometimes,
positive or negative full-scale, if I recall correctly. I haven't posted
that code, though.

As for the intermediate step of converting to a serial bitstream, there is
certainly nothing wrong with doing so, and it may indeed simplify some
operations. I found that with the lack of easy bit-field operators in
Visual Basic, it was just as simple to use the VDM message character string
directly. All the data is there, and I found no good reason to do an
additional conversion. If I were dong this in c, I probably would have gone
to the bitstream. And yes, the ASCII conversion is different than the 6-bit
encode/decode, which is why I directed the original poster to the H6StrToAsc
function in my code.

I was about to ask for help with my ROT problem, and in researching my
sources I just found a later spec than I had been using which shows that
+/-127 values have been taken over to indicate a heading-derived ROT, rather
than a turn-indicator-derived ROT (which uses the values between -126 and
+126). Problem solved! Now, I guarantee double your money back!

Regards,
Paul


  #13   Report Post  
posted to rec.boats.electronics
external usenet poster
 
First recorded activity by BoatBanter: Jul 2006
Posts: 1
Default how to read AIS data from encapsulated NMEA VDO sentence

"Paul" wrote:
wrote in message
oups.com...

Paul wrote:
wrote in message
oups.com...
Actually, I re-read what I posted and it didn't really

make sense.

1. Start with the array of ascii characters
2. Convert to the 6 bit binary value.
3. Convert this byte array to a 6 bit bitstream.
4. Then just pull out the bits yuo want using the various

bit
operators. I tried to use a bit-field, but it didn't seem

to work in
Windows.

As I said, it all works until I get to character arrays

(call sign
etc)


Here is a portion of the code i wrote to handle message

type 5 (I'm only
handling the "Ship Static and Voyage Related Data
" variant for now). My comments follow the code. Pay

attention to my
function H6StrToAsc, and how I manipulate the ascii.


I'll assume Paul's code is right He's skipping the

intermediate step
which may be where the confusion lies. There are several

layers of
things happening here.

0. Bits over the air: 9600bps GMSK data.
1. Demodulated bitstream, eg. 168 bits for a message 1.
2. Actual message content like Message ID, MMSI, Ship Name.
3. Serial output of bitstream using 6-bit encoding.

The data you see in the VDM sentence is a 6-bit encoded

representation
of the raw bitstream, first bit on the left, last bit on the

right (as
God intended things!).

To get the ship name you need to either skip ahead like Paul

did, or
convert the 6-bit back to its bitstream. Then you grab the

bits in the
name position and apply the m.1371 ASCII encoding rules to

those bits.
BUT! That conversion is DIFFERENT from the 6-bit

encode/decode. That is
probably what was tripping you up.

.cp


I hereby give you a full money-back guarantee that my code is
correct. At
least it seems to usually kind of work. The only trouble I've
seen is that
I get a spurious (or incorrectly encoded?) rate-of-turn value
sometimes,
positive or negative full-scale, if I recall correctly. I
haven't posted
that code, though.

As for the intermediate step of converting to a serial
bitstream, there is
certainly nothing wrong with doing so, and it may indeed
simplify some
operations. I found that with the lack of easy bit-field
operators in
Visual Basic, it was just as simple to use the VDM message
character string
directly. All the data is there, and I found no good reason
to do an
additional conversion. If I were dong this in c, I probably
would have gone
to the bitstream. And yes, the ASCII conversion is different
than the 6-bit
encode/decode, which is why I directed the original poster to
the H6StrToAsc
function in my code.

I was about to ask for help with my ROT problem, and in
researching my
sources I just found a later spec than I had been using which
shows that
+/-127 values have been taken over to indicate a
heading-derived ROT, rather
than a turn-indicator-derived ROT (which uses the values
between -126 and
+126). Problem solved! Now, I guarantee double your money
back!

Regards,
Paul


Dear
I am development any software of navigation in Peru for present data
AIS in Chart electronic. I have the frame AIVDM decode, the ais SR162
only receive frame !AIVDM wich have info the MMSI, position, course,
speed, others.. but i want get the name of ship, and more data related
of voyage,... how program the receptor for get the name of ship ???
and how this encode, is equal to AIVDM (6 bits)..? Thanks..

Regards
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 BoatBanter.com.
The comments are property of their posters.
 

About Us

"It's about Boats"

 

Copyright © 2017