Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 27-02-2011, 16:34   #1
Registered User

Join Date: Feb 2011
Location: Virginia
Boat: Shopping for a 30-ish cat
Posts: 418
AIS 'Encoder' Info ?

Any software techs happen to know where I might find info on how to -encode- an AIS NMEA stream from standard text data? I need to generate a simulated stream of AIS for a course I'll be teaching. From what I've found so far (AIS decoding only, not how to encode), looks to be a fairly sophisticated bit of code. A simple example bit of code would be perfect. Thanks in advance.
prof_mariner is offline   Reply With Quote
Old 27-02-2011, 20:21   #2
Marine Service Provider

Join Date: Feb 2010
Posts: 279
Re: AIS "encoder" info?

I write books on Electronic Navigation and I use Nema Studio in the trial version to generate AIS data. In the trial version the output is limited to only a set number of sentences. However you can monitor the output in the I/O panel. When the limit has been reached Copy and paste into notebook and copy and paste to extend the ais text data. The txt document can be used as a log file to input to another nav program or to Franson Gate that will then output to a com port. There is also a live AIS stream from San Francisco at hd-sf.com

hope this helps

regards

Richard Fairman JP BA Author SeaClear Unleashed
r.fairman is offline   Reply With Quote
Old 27-02-2011, 21:36   #3
Moderator Emeritus
 
Paul Elliott's Avatar

Cruisers Forum Supporter

Join Date: Sep 2006
Posts: 4,663
Images: 4
Re: AIS "encoder" info?

Quote:
Originally Posted by prof_mariner View Post
Any software techs happen to know where I might find info on how to -encode- an AIS NMEA stream from standard text data? I need to generate a simulated stream of AIS for a course I'll be teaching. From what I've found so far (AIS decoding only, not how to encode), looks to be a fairly sophisticated bit of code. A simple example bit of code would be perfect. Thanks in advance.
Can you explain what you mean by "standard text data"?

The AIS messages (there are several types you are likely to see) are comprised of multiple, various-length bit-fields. Each bit field can be from one to 30 bits long, as I recall. These fields can represent numbers or text (using a non-ascii text encoding).

These bitfields are then concatenated, encoded, and inserted into NMEA-0183 sentences using a 6-bit/char coding.

So what are you looking for? I would be happy to throw together a demonstration of how to encode (for example) the AIS "Type 5" static vessel data message, and point you to definitions for the other messages.

The inputs would be numbers (ship identification, dimensions, vessel-type code, etc) and text (name, callsign, destination), as defined in the message format. The output would be a formatted NMEA sentence.

Another complication is that the AIS data sometimes has to be split into two NMEA sentences, due to limitations on NMEA message length. Perhaps a better sample would be the "Type 3" dynamic message, which is short enough to fit into one NMEA sentence. This one doesn't contain any encoded text though.

PM me if you like, or we can continue right here.

It's not difficult to build the AIS NMEA messages, just a bit tedious.

(I do some of this in my NavMonPc program, but the AIS stuff remains hidden inside.)
__________________
Paul Elliott, S/V VALIS - Pacific Seacraft 44 #16 - Friday Harbor, WA
www.sailvalis.com
Paul Elliott is offline   Reply With Quote
Old 28-02-2011, 02:56   #4
Registered User

Join Date: Feb 2011
Location: Virginia
Boat: Shopping for a 30-ish cat
Posts: 418
Re: AIS "encoder" info?

Quote:
Can you explain what you mean by "standard text data"?
I'm developing a simulator for training purposes. I've already implemented NMEA out so it can talk (via serial coms) to external instruments and chart plotters (like OpenCPN). In basic terms, what I want to do is convert: vessel name, position, course, speed into an AIS string. Ideally, I'd prefer not to have to encode anything, so if AIS "type 3" allows me to do that, then that would be perfect. Where might I find more info on this?
prof_mariner is offline   Reply With Quote
Old 28-02-2011, 09:21   #5
Moderator Emeritus
 
Paul Elliott's Avatar

Cruisers Forum Supporter

Join Date: Sep 2006
Posts: 4,663
Images: 4
Re: AIS "encoder" info?

Quote:
Originally Posted by prof_mariner View Post
I'm developing a simulator for training purposes. I've already implemented NMEA out so it can talk (via serial coms) to external instruments and chart plotters (like OpenCPN). In basic terms, what I want to do is convert: vessel name, position, course, speed into an AIS string. Ideally, I'd prefer not to have to encode anything, so if AIS "type 3" allows me to do that, then that would be perfect. Where might I find more info on this?
There are two messages you will be interested in: First is the "Dynamic" report (Type 3), which contains position, course, and speed, but not name, callsign, etc. Then there is the "Static" report (Type 5), which has name, callsign, destination port, ETA, dimensions, etc, but not position, course, or speed. You will need to encode either of these.

The specs are not generally free, but there are some back-rev versions available on the web. Here's a link to a collection of these: DownloadLibrary. Document #1 (the ITU spec) is quite useful, but it doesn't reflect the current "Class-B" messages, and a few others. The Class-A stuff is good. A caveat: I design to the "official" specs, but I am not allowed to distribute these. The "escaped" documents may not be completely accurate.

Download the ITU document and look at Table 13. This lists the AIS message types. You probably want Types 3 and 5.

Table 14 shows the Message 3 format, and table 16 shows Message 5.

Figure 15 shows how the ship's dimensions are measured.

Table 17 shows how the ship type and cargo are encoded. There have been changes since this document was published

Document #3 (IEC Draft) has more info, including the encoding you will need to convert all the AIS message bits into the ascii subset is used in the NMEA sentence. Look at "Annex G", especially Table 7.

You still need to know how to encode text (ship name, etc) to bits. I know this is available in an escaped document somewhere , but here it is in a nutshell:

"Char" (ASCII decimal): 6-bit (decimal)
"@" (64) : 0
"A" (65) : 1
"B" (66) : 2
...
"Y" (89) : 25
"Z" (90) : 26
"[ "(91) : 27
...
"_" (95) : 31
--- note the gap here ---
"space" (32) : 32
"!" (33) : 33
...
"/" (47) 47
"0" (48) : 48
...
">" (62) : 62
"?" (63) : 63

Note that only upper-case characters are valid.

To practice your coding and decoding, here is a Type-5 message carried in a NMEA !AIVDM sentence (note that for some reason this hasn't been split into two halves):
!AIVDM,1,1,,,53ncF`0284nth54cB204l8E:2222222222222 217<PFA24`o0=Qi6CR@H88888888888880,2*7F

The AIS message portion is:
53ncF`0284nth54cB204l8E:2222222222222217<PFA24`o0= Qi6CR@H88888888888880

This decodes as follows:
ID: 5
Repeat: 0
MMSI: 258660000
Version: 0
IMO: 8917871
Call: LAQJ4
Name: AMBER
Type: Cargo, carrying DG or pollutant cat A
Dimensions: 209806402
PosFixer: 1
ETA: 167360
Draft: 54
Destination: GDYNIA
DTE: 0
Spare: 0

Note that bitfields such as dimensions and ETA need to be broken into sub-fields.

It's all kind of messy, designed to cram the most information into a small space without breaking the legacy definitions.
__________________
Paul Elliott, S/V VALIS - Pacific Seacraft 44 #16 - Friday Harbor, WA
www.sailvalis.com
Paul Elliott is offline   Reply With Quote
Old 28-02-2011, 09:30   #6
Moderator Emeritus
 
David M's Avatar

Cruisers Forum Supporter

Join Date: Sep 2007
Location: Eastern Tennessee
Boat: Research vessel for a university, retired now.
Posts: 10,406
Re: AIS "encoder" info?

Wow Paul...good stuff!
__________________
David

Life begins where land ends.
David M is offline   Reply With Quote
Old 28-02-2011, 10:55   #7
Registered User

Join Date: Feb 2011
Location: Virginia
Boat: Shopping for a 30-ish cat
Posts: 418
Re: AIS "encoder" info?

Wow, thanks Paul. I can see that this is well above my head. I'll look through everything you posted and hopefully some of it will sink in. Thanks again!
prof_mariner is offline   Reply With Quote
Old 28-02-2011, 16:07   #8
Moderator Emeritus
 
Paul Elliott's Avatar

Cruisers Forum Supporter

Join Date: Sep 2006
Posts: 4,663
Images: 4
Re: AIS "encoder" info?

Happy to help! If you end up digging into this and things just aren't working the way you think they should, it's probably a bit-order or word-alignment issue. You will find, for example, that the encoded text (ship name, etc) while encoded into 6-bit chunks, doesn't fall neatly into place when you have to encode the resulting bitfield. Instead, because the number of previous bits in the bitfield isn't a multiple of six, the top few bits of each character code end up in one word, and the bottom few bits in the next word.

As I interpreted the specs they seemed somewhat ambiguous on a few of these points, and I had to make a few guesses before I stumbled across the correct arrangement. Let me know if you need some hints.
__________________
Paul Elliott, S/V VALIS - Pacific Seacraft 44 #16 - Friday Harbor, WA
www.sailvalis.com
Paul Elliott is offline   Reply With Quote
Old 28-02-2011, 16:30   #9
Nearly an old salt
 
goboatingnow's Avatar

Join Date: Jun 2009
Location: Lefkas Marina ,Greece
Boat: Bavaria 36
Posts: 22,801
Images: 3
Re: AIS "encoder" info?

its really a crap protocol, shoehorned into NMEA, a complete dog of an implementation. The NMEA2K standardshould be better and more orthogonal in design.

Dave
__________________
Interested in smart boat technology, networking and all things tech
goboatingnow is offline   Reply With Quote
Old 28-02-2011, 17:37   #10
Moderator Emeritus
 
Paul Elliott's Avatar

Cruisers Forum Supporter

Join Date: Sep 2006
Posts: 4,663
Images: 4
Re: AIS "encoder" info?

Quote:
Originally Posted by goboatingnow View Post
its really a crap protocol, shoehorned into NMEA, a complete dog of an implementation. The NMEA2K standardshould be better and more orthogonal in design.
Dave
No argument there, but given the dominance of NMEA0183 at the time AIS was being introduced, what did you expect then to do? For that matter, I would be amazed if even now N2K AIS was more than 10% of the current installed AIS base.

I used to design telecom gear and systems for a living -- a perfect place to be if you want to see the death-grip of legacy protocols, up-close and personal. While we were pushing the "convergence" and "next-gen" aspects of our gear, what probably was our biggest competitive advantage was our ability to hook up to legacy networks (wire and optical). I used to tell my team: "The great thing about legacy systems is that they keep installing more of them." I suppose you had to be there...
__________________
Paul Elliott, S/V VALIS - Pacific Seacraft 44 #16 - Friday Harbor, WA
www.sailvalis.com
Paul Elliott is offline   Reply With Quote
Old 01-03-2011, 01:58   #11
Registered User

Join Date: Feb 2011
Location: Virginia
Boat: Shopping for a 30-ish cat
Posts: 418
Re: AIS 'Encoder' Info ?

I think I might have to put off writing my own AIS encoder for now. Does anyone know of any free or open source AIS simulators? I found several that have demo versions available but didn't find anything for free.
prof_mariner is offline   Reply With Quote
Old 02-03-2011, 03:13   #12
Registered User

Join Date: Feb 2011
Location: Virginia
Boat: Shopping for a 30-ish cat
Posts: 418
Re: AIS 'Encoder' Info ?

Quote:
Originally Posted by prof_mariner View Post
I think I might have to put off writing my own AIS encoder for now. Does anyone know of any free or open source AIS simulators? I found several that have demo versions available but didn't find anything for free.
Or a cheap windows app that will send AIS NMEA? I'm just looking for something that will send AIS data to OpenCPN that I can monitor.
prof_mariner is offline   Reply With Quote
Old 02-03-2011, 03:41   #13
Nearly an old salt
 
goboatingnow's Avatar

Join Date: Jun 2009
Location: Lefkas Marina ,Greece
Boat: Bavaria 36
Posts: 22,801
Images: 3
Re: AIS 'Encoder' Info ?

Quote:
I used to tell my team: "The great thing about legacy systems is that they keep installing more of them." I suppose you had to be there...
oh i know, spent some time in telecoms design myself. ( billing systems and hardware!!).

DAve
__________________
Interested in smart boat technology, networking and all things tech
goboatingnow is offline   Reply With Quote
Old 02-03-2011, 09:13   #14
Moderator Emeritus
 
Paul Elliott's Avatar

Cruisers Forum Supporter

Join Date: Sep 2006
Posts: 4,663
Images: 4
Re: AIS 'Encoder' Info ?

Quote:
Originally Posted by prof_mariner View Post
Or a cheap windows app that will send AIS NMEA? I'm just looking for something that will send AIS data to OpenCPN that I can monitor.
When do you need this? I'm in the middle of a project right now, but when I have a day free I could whip up a (closed-source, freeware, windows) AIS ship simulator / generator.

I do recall already seeing something like this though.
__________________
Paul Elliott, S/V VALIS - Pacific Seacraft 44 #16 - Friday Harbor, WA
www.sailvalis.com
Paul Elliott is offline   Reply With Quote
Old 02-03-2011, 09:33   #15
Registered User

Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
Re: AIS 'Encoder' Info ?

I use "phiggins" ais simulator quite often to test OpenCPN.
It used to be available at "dacust's" site but has been moved to Pauls own site GDAYII.com - Super Slogan.
This site seems to be down for the moment though.
I think "manimaul" whipped together something similar, but I can't find it at this moment. For pictures of Phiggins simulator in action just check AIS | Official OpenCPN Homepage.

Thomas
cagney is offline   Reply With Quote
Reply

Tags
ais

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can You Get Radar & AIS Overlay on Laptop ? AIS Transceiver Recommendations ? lunasea.ds Marine Electronics 22 27-12-2010 13:06
AIS VHF Antenna Info Scrimshaw4 Navigation 14 12-06-2009 15:40
AIS Info S/V Antares Marine Electronics 11 05-11-2008 22:58
Info on London, UK live aboard info capcook Liveaboard's Forum 3 29-08-2008 17:58
AIS 2xtreme Navigation 2 06-04-2007 16:49

Advertise Here


All times are GMT -7. The time now is 21:14.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.