Saturday, August 09, 2008

Mac chartplotter: adding AIS


A few posts back, I described how I had added chartplotting capability to my MacBook Pro with PassagePlus software. As I mentioned then, the plan was to take advantage, at some later point, of the AIS functionality in PassagePlus. Recently, I was able to move the project forward, and I tested it for the first time today. Here’s how I got on.



ABOUT AIS

If you’re reading this, you probably already know what the Automatic Identification System is. However, if you’d appreciate a primer, then THIS SITE is a good place to start.

The key takeaway is that AIS signals broadcast by commercial shipping, and some navigational aids, can be picked up by a receiver with a standard VHF antenna. These signals, which go out at intervals of every 2 to 10 seconds, contain basic – but very useful - information about the broadcasting vessel, including:

• the name, description and MMSI of the vessel
• its navigational status – for example whether it is at anchor, under way, etc
• its position, speed, heading and course over ground (COG)

Once received via a normal VHF antenna and processed by an AIS receiver, this information can be fed to a chartplotter via NMEA and plotted on a chartplotter screen, where it can be combined with the chart image (and the radar image, if radar is available). As a result, AIS constitutes a valuable aid to navigation and collision avoidance.

There is some debate over just how valuable an aid it is. AIS is most certainly not a substitute for radar, not least because not all vessels broadcast AIS signals: the legal requirement, under SOLAS, is for vessels with gross tonnage of 300 or more tons, and all passenger ships regardless of size, to have AIS transmitters fitted. That leaves quite a large number of smaller vessels, as well as fishing and leisure craft, that are not obligated to – and mostly don't – carry AIS transmitters. Moreover, even those vessels that do have transmitters may for a variety of reasons not broadcast at all times.

My personal belief is that, at some future time, most if not all craft will be required to carry and use AIS transmitters of at least a rudimentary variety. It's the logical approach to take for the kind of Nanny State we live in. Until Big Brother arrives, though, anything that helps to alert a small craft to large traffic approaching is a Good Thing in my view, and – not possessing radar - I am all in favour of taking advantage of AIS, even if it isn’t foolproof.

AIS HARDWARE

AIS transmitters – strictly, transponders - come in two flavours:

• Class A: legally required for use on SOLAS Chapter V vessels.
• Class B: lower cost transponders for leisure and non-SOLAS vessels.

If you were going to fit a transponder to your average yacht, therefore, it would be Class B and such models are, at the time of writing, filtering through to the leisure market. There is some disagreement over whether doing so is desirable, however. It has been pointed out by more than a few people that a Solent full of yachts, all feverishly broadcasting their AIS details on a sunny Sunday, would so clutter the receiving chartplotter image as to make the exercise worthless, and indeed encourage the watch officer on a large vessel simply to switch on the filter that excludes all Class B signals. That said, out to sea, where traffic is less dense, there is much more of a case for a small boat having a Class B transponder, perhaps as an adjunct to a Sea-Me active radar reflector.

To add to the confusion, there are two AIS channels, also called "A" and "B". (In fact that's sufficiently confusing that I had to rewrite this blog entry after someone was kind enough to point out that in my first effort, I'd mixed my channels up with my classes). The two frequencies used are Marine ch 87 and ch 88. Using two channels doubles the available bandwidth. Vessels transmit their AIS messages quite frequently, and a complex management system allocates the bandwidth between them. Regularly scheduled AIS messages are transmitted alternately between the two channels - each AIS station can only transmit on one channel at a time.

The assertion made by people who understand AIS better than I do is that it’s worth shopping around for a receiver that can monitor both channel A and channel B without undue difficulty. The reason for that appears to be that a unit that only monitors one channel effectively "misses" half the signals. That doesn't mean that monitoring a single channel alone will result in half the surrounding vessels being completely missed. It means that only around half of their signals will be received - in practice, the AIS data appearing on the linked display will be updating somewhat less frequently than would be the case if both channels were monitored simultaneously. This is possibly not such a big deal for much of the time, but it could be vital in a close quarters situation and/or where vessels are moving at high speed.

Arabella rarely strays outside the Solent, so my own search for equipment focused on what, I imagine, most leisure sailors would opt for at this stage – a receiver rather than a transponder.

A receiver by itself is of little use without some way of displaying the information that it processes. One option is to have a self-contained unit that includes a small, basic display, like the (rather misleadingly named) NASA AIS “Radar” pictured below.


I already have one of these fitted to Arabella but I have my doubts about it. First, its tiny little screen isn’t the easiest to read, and it takes awhile to interpret the symbols in such a way as to figure out the bearing and position of each threatening behemoth as it bears down on your own fragile little boat - not something I'd like to put to the test in real life. Second, if you want to monitor transmissions on both channel A and channel B, you need to set the unit to read each channel on an alternating basis. That's a compromise that may to some extent impact on the unit's effectiveness, as hinted above - and I return to that topic later in this post. For all that, speaking strictly personally I do think it’s good to have the NASA unit on board in the absence of anything else. Whether or not it "misses" half the signals and updates less frequently that it should, it ought to at least alert you if there's something big out there. But there are better ways of displaying the data to an unskilled user like me.

Above: screenshot (taken from NASA's website) of a typical scene viewed on the AIS "Radar" display.

The best way, of course, is to have a chartplotter screen on which the AIS data is displayed as an overlay on top of the chart. That way, you can see at a glance where the broadcasting vessel is relative to your own boat. For this reason, AIS “engines” have become popular – small ‘black boxes’ that receive the AIS signal via the VHF antenna, then process the signal into NMEA data and feed it to a chartplotter. Quite a variety of these engines are available on the market, including one by NASA, another by EasyAIS, a hideously expensive one by Raymarine, and so on.

MY AIS CHOICE

Arabella doesn’t possess a dedicated chartplotter. Instead I rely on a laptop – my MacBook Pro – loaded with PassagePlus software and a plug-in BU-353 Cable GPS which connects (and is powered) via a USB cable to the computer’s USB port. A key feature of this set-up is that the laptop/chartplotter/GPS constitute a self-contained unit, neither interfaced with the rest of Arabella’s electronics nor powered directly from the ship's battery. This creates a degree of redundancy; if Arabella’s onboard system fails, the laptop system can operate as normal, and vice versa. (And being an inveterate coward, I have a handheld GPS chartplotter stuffed in my pocket as a backup, too. It wouldn’t do to get lost in Southampton Water, now would it?).

Ideally what I wanted therefore, in the interest of consistency with these principles, was:

• an AIS engine;
• that plugged into the side of my MacBook Pro;
• worked on a Mac without undue drama; and
• received its signal from the same (dedicated) VHF antenna as the existing NASA unit;
• but wasn’t interfaced with the onboard electronics; and
• didn’t need to rely on the ship’s battery for power, but instead drew it from the laptop’s battery.

My research revealed only one unit that met all of these criteria: the Comar AIS-2-USB. Quite a few units, with the help of a USB-to-serial cable and proprietary software drivers, could be made to work with a Mac. But only the Comar AIS-2-USB plugged straight into the USB port and drew its power the same way, making it truly portable and truly plug-and-play in the same way as the BU-353 GPS.

Above: Comar AIS-2-USB

Another attractive feature of the Comar unit was the fact that it could genuinely monitor both A and B channels at once. Rather than 'cheating' by having a single receiver switching alternately back and forth between channels, the Comar contained two AIS receivers - monitoring and decoding both AIS channels simultaneously.

PUTTING IT ALL TOGETHER

My biggest concern was whether the Comar unit was Mac-compatible. An enquiry with Comar themselves revealed that they were not really geared to deal with Mac users. They felt pretty sure everything would work fine and kindly sent me a link from which to download the requisite FTDI driver. When I did download it, however, it came out as gobbledegook - actually an IT professional would have known what to do with it, but it was no good expecting me to make any sense of it.

At that point, Jonathan Fewtrell, the author of PassagePlus, came riding to the rescue. Understandably curious to see for himself whether the Comar unit was compatible with his software, Jonathan did some digging around and discovered that FTDI in fact produced two categories of driver - one called VCP and the other D2XX. The one to which I had been referred to by Comar was the D2XX one. Like me, Jonathan found this was not user-friendly, and recognised that was because it was designed to run as a dynamic library. The VCP driver, he suspected, was more likely to work. It was designed to run as a virtual COM port, which even I knew made sense for USB plug-in hardware. The link for downloading it was HERE.

The VCP driver installed itself without drama on my MacBook. However, even Jonathan couldn't be sure that the unit would be compatible with his software until someone had a go with it. Deciding to chance it, I ordered the Comar AIS-2-USB unit.

Above: Assuming it all worked, this was what AIS would look like, running PassagePlus on my MacBook. (Image taken from PassagePlus website, click HERE for an explanation).


Meanwhile, I still needed to sort out the VHF antenna, whatever AIS unit I ended up buying. Arabella already had a VHF antenna - a Metz Manta 6 mounted on her pushpit - that was dedicated to the existing NASA AIS Radar. It therefore made sense, in my particular case, to exploit that capability.


Sharing a VHF antenna between certain items of hardware - a VHF transceiver and an AIS receiver, say - can be problematic and the use of electronic splitters is necessary in such cases, but controversial. I didn't have to get involved in that argument, fortunately. All I wanted to do was have two receivers share the antenna. Everyone I spoke to agreed that this simply required a classic VHF cable connector/splitter, much like the one you use to run aerial cable to more than one TV or video at home, so that the main antenna cable could be divided, with one spur running to the existing NASA unit to port and the other running to the laptop mounting position to starboard of Arabella's companionway. That was a straightforward job, at least, and quickly done.

CONNECTIONS

Once the Comar AIS-2-USB unit arrived, all I had to do was connect the VHF antenna cable to one socket, and the (supplied) USB cable to the other, then plug the other end of the USB cable into the port on my MacBook. The unit immediately switched on (drawing its power from the laptop), as indicated by a green LCD on the side of the unit. Within a few seconds, two red LCDs on the side of the unit also began to flash, indicating that the unit was receiving signals on both channel A and channel B.

DID IT WORK?

Yes, first time - and very impressively, too.

The plan had been to try out the system for the first time while out sailing, but the English climate conjured up October's weather in August, so the AIS was put to an unfair test while I sheltered below decks from driving rain and high winds, and Arabella stayed safely at her marina berth.

I say "unfair" because the pushpit-mounted Metz antenna reaches barely 2 metres above Arabella's waterline and, in the marina, is surrounded by a forest of masts. The situation is helped not at all by fact that at low water - as at the time of this test - the top of the antenna is well below the top of the marina's banked sides. To all intents and purposes, the antenna has zero line of sight. All of which made the outcome of the test, to my inexperienced eye, that much more impressive.

The large scale screenshot below shows, more or less, the extent of the range at which the system picked up AIS transmissions. (Note: you can view larger versions of all of these images by clicking on them).



Arabella's position at the time of the test is shown by the red symbol, with the pop-up information box, at the top of the chart. As you can see, AIS transmissions were detected all the way down Southampton Water and across the Solent - even picking up the Red Funnel ferry at its berth in Cowes some 8 nautical miles distant. In addition, the system showed a vessel entering Portsmouth Harbour, to the east, and a Bahamian cargo vessel making its way down the Western Solent, off the Beaulieu River.

The next two screen caps are even more extraordinary. AIS transmissions were detected from the Needles base station - nearly 17 nautical miles distant, while the Bahamian vessel was tracked succesfully as it proceeded further down the Western Solent...

...and here is the system really showing-off by capturing the signal from a Coastguard SAR helicopter flying south-east just off Ryde in the Eastern Solent.


Meanwhile, it was a busy day in Southampton Docks. To emphasise, none of what is shown here was within line of sight of the AIS antenna. Yet PassagePlus was faithfully plotting the tracks of moving vessels (blue lines) and predicting their courses and positions for the next 5 minutes (grey dotted lines) without difficulty.

While I sat there playing with the software, a class B signal suddenly appeared, moving up river towards Arabella's marina. I popped my head out of the hatch just in time to see a yacht motoring past and continuing upriver. Back on screen, I watched it turn into a neighbouring marina and moor up, as shown below. (The designation "AIS Type 36" indicates that this is a sailing vessel).


An interesting feature of this (class B) signal was that it updated less frequently than the class A signals - about once every minute or so. Class B transponders transmit less frequently than Class A transponders, and in addition they are programmed to wait for sufficient available bandwith (after the nearby Class A transmissions have taken their share) before transmitting - in other words, if a Class B unit is about to transmit and detects that there is insufficient bandwidth, it aborts the attempt and tries again after a predetermined interval.

Not being an expert in marine electronics, I can't be sure, but it seemed to me that this had significant implications for the NASA AIS "Radar", which I was watching side by side with the laptop for comparative purposes. As I mentioned earlier, I have the NASA unit set up in such a way that it monitors channel A and channel B alternately. The accompanying product literature does not state at what intervals the unit alternates between the two channels. But - from the fact that the NASA unit failed to detect this yacht's signal at all over a period of approximately 10 minutes - my pet theory was that the unit wasn't scanning the relevant channel at any time when the yacht's transponder was transmitting. It therefore appears possible for an alternating unit, like the NASA, to "miss" the less frequent class B signals altogether because they are not transmitted on either channel at a time when it's scanning that channel. If that's correct, the problem is not likely to extend to class A signals simply because they are transmitted far more frequently.

The Comar/PassagePlus combo also whipped the NASA unit in another significant respect - range. You'd think that range was a function of the height and efficiency of the antenna, but it seems to me that the quality of the AIS "engine" may also play a role. At no point during this test did the NASA unit display any signals outside a range of 2 nautical miles - regardless of how much I adjusted its threshold level - whereas the Comar/PassagePlus system displayed signals as far away as 16 NM, the bulk of them falling in a radius of 8 NM.

Previously, I had tended to excuse the NASA's modest range as the inevitable result of fitting a good antenna at a very low height, but the Comar unit demonstrated with some certainty that that was a fallacy. It would have been interesting to see how much additional range could be obtained by connecting the Comar unit to a masthead antenna - I suspected the result would be pretty awesome - but I was more than satisfied with things as they were, on the basis of this initial test.

Friday, August 08, 2008

How the other half lives

Not in my wildest dreams could I describe myself as an obvious denizen of "Britain's Premier Yachting Regatta". But I can sail, sort of, and I ended up crewing on a yacht entered at Cowes Week anyway, as a guest of those awfully nice people at Lloyds TSB Commercial Finance, who had chartered three boats for the occasion.


Better still, it was the final day, the one with the fireworks display in the evening, and hospitality in Cowes was thrown in. And I'd never been before. So I was prepared to cast my principles aside - never difficult for a lawyer - and indulge myself in some serious corporate entertainment.

The only thing that slightly worried me was the exaggerated impression that Lloyds TSB had formed of my credentials as racing crew, based on the fact that somebody had told someone else that I'd once come 30th overall in the RTIR. Which conveniently overlooked my ignominious retirement this year - the only other time I'd entered Arabella in the race.

Ah well, it was too late now. I would just have to bluff it. A hurried review of some yacht racing textbooks left me none the wiser, but gave me a large vocabulary of racing slang and terms. I understood paying tack, lift, pressure and left shift. I wasn't too sure what some of other phrases were on about, and I suspected I'd unwittingly picked up some inappropriate Americanisms from the US-centric racing books I'd managed to get hold of.

I needn't have worried. I had a wonderful time.

We were delivered by high-speed rib from Southampton to Cowes Yacht Haven, which was a wicked experience. It got better: I had no idea what sort of boats we were going to be racing until the rib pulled up alongside the entire Clipper fleet and deposited us aboard.


These are the 68-footers that competed in the Clipper Round The World Race 2007-08. I'd never been on anything as big or as fast as this before, and it was an extraordinary experience to crew on one of these wonderful yachts as the entire fleet competed in a genuine race.


Even better, I got to be the staysail trimmer onboard Western Australia, working in the snake pit under the watchful eye of Austin, one of the fleet's three engineers, and picked up a load of helpful tips on sail trim that I'll be able to put to good use on Arabella.


The result? Ahem, moving swiftly on, after the race ended we got the full VIP treatment at the tented village before strolling through a packed, vibrant Cowes to the Royal London Yacht Club for dinner and the best view that money can buy of the Red Arrows display and the fireworks.



A really fantastic day out. I'm already plotting what I have to do to get invited back for next year!