Re: Re: how to read AIS data from encapsulated NMEA VDO sentence



"Paul" wrote:
<coderpunk@xxxxxxxxx> wrote in message
news:1150254823.702754.271150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Paul wrote:
<nickw473@xxxxxxxxxxx> wrote in message
news:1149652247.992435.169280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
.



Relevant Pages

  • Re: how to read AIS data from encapsulated NMEA VDO sentence
    ... Convert this byte array to a 6 bit bitstream. ... and how I manipulate the ascii. ... Demodulated bitstream, eg. 168 bits for a message 1. ... it was just as simple to use the VDM message character string ...
    (rec.boats.electronics)
  • Re: Need help with textboxes
    ... character into the input box. ... one of assigning the reference to a variable: ... All forms and their children are stored in an array ... No. Bracket property accessors allow their argument to be any string value. ...
    (comp.lang.javascript)
  • Help in Spanish translation of the description of UDFs
    ... functions of minimum / maximum values among elements of an array column. ... GETALLWORDS- Inserts the words from a string into a global dimensioned ... WORDTRAN- Searches a character string for occurrences of a first word, ... ARRAYSUM- Returns the sum of all or a specified range of numeric (and/or ...
    (microsoft.public.fox.helpwanted)
  • Re: Pointer
    ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it pointing to a "Single byte character" array or is it pointing to something else? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: problem with unhandled exception (acces violation) and undefined array/pointer
    ... If you pass a real array to a ... character dummy the extra arguments won't be there. ... occasional fortran user with limited knowledge, ... with compile and link options, ...
    (comp.lang.fortran)