Slight change to the planned article. At the end of my analysis in Part 1 I discovered I was missing a number of key messages. It turns out that not all the SeaTalk messages from the integrated instruments were being translated to an NMEA format and therefore not being sent wirelessly from the AIS hub. I didn't really want to introduce another source of data directly from the instruments as it would involve hard wiring the instruments to the laptop and then translating a different format of a message (SeaTalk). I decided to spend on some hardware (any excuse for new toys). I purchased a SeaTalk to NMEA converter from DigitalYachts (discounted at the London boat show I'm glad to say).
This article is about the installation of that hardware and the result (hence Part 1.1), not our usual type of blog. You never know it may be of interest to somebody out there and this is a real-life data issue! Don't worry it will be short and more of an insight into Yacht wiring than anything.
The next blog will be very much back on track. Looking at Kafka in the architecture.
The existing wiring
The following image shows the existing setup, what's behind the panels and how it links to the instrument architecture documented in Part 1. No laughing at the wiring spaghetti - I stripped out half a tonne of cable last year so this is an improvement. Most of the technology lives near the chart table and we have access to the navigation lights, cabin lighting, battery sensors and DSC VHF. The top left image also shows a spare GPS (Garmin) and far left an EPIRB.
I wanted to make sure I wasn't breaking anything by adding the new hardware so followed the approach we use as software engineers. Check before, during and after any changes enabling us to narrow down the point errors are introduced. To help with this I create a little bit of Python that reads the messages and lets me know the unique message types, the total number of messages and the number of messages in error.
import json import sys #DEF Function to test message def is_message_valid (orig_line): ........ [Function same code described in Part 1] #main body f = open("/Development/step_1.log", "r") valid_messages = 0 invalid_messages = 0 total_messages = 0 my_list = [""] #process file main body for line in f: orig_line = line if is_message_valid(orig_line): valid_messages = valid_messages + 1 #look for wind message #print "message valid" if orig_line[0:1] == "$": if len(my_list) == 0: #print "ny list is empty" my_list.insert(0,orig_line[0:6]) else: #print orig_line[0:5] my_list.append(orig_line[0:6]) #print orig_line[20:26] else: invalid_messages = invalid_messages + 1 total_messages = total_messages + 1 new_list = list(set(my_list)) i = 0 while i < len(new_list): print(new_list[i]) i += 1 #Hight tech report print "Summary" print "#######" print "valid messages -> ", valid_messages print "invalid messages -> ", invalid_messages print "total mesages -> ", total_messages f.close()
For each of the steps, I used nc to write the output to a log file and then use the Python to analyse the log. I log about ten minutes of messages each step although I have to confess to shortening the last test as I was getting very cold.
nc -l 192.168.1.1 2000 > step_x.log
While spooling the message I artificially generate some speed data by spinning the wheel of the speedo. The image below shows the speed sensor and where it normally lives (far right image). The water comes in when you take out the sensor as it temporarily leaves a rather large hole in the bottom of the boat, don't be alarmed by the little puddle you can see.
I spool and analyse about ten minutes of data without making any changes to the existing setup.
The existing setup takes data directly from the back of a Raymarine instrument seen below and gets linked into the AIS hub.
$AITXT -> AIS (from AIS hub) $GPRMC -> GPS (form AIS hub) $GPGGA $GPGLL $GPGBS $IIDBT -> Depth sensor $IIMTW -> Sea temperature sensor $IIMWV -> Wind speed Summary ####### valid messages -> 2129 invalid messages -> 298 total mesages -> 2427 12% error
I disconnect the NMEA interface between the AIS hub and the integrated instruments. So in the diagram above I disconnect all four NMEA wires from the back of the instrument.
I observe the Navigation display of the integrated instruments no longer displays any GPS information (this is expected as the only GPS messages I have are coming from the AIS hub).
$AITXT -> AIS (from AIS hub) $GPRMC -> GPS (form AIS hub) $GPGGA $GPGLL $GPGBS No $II messages as expected Summary ####### valid messages -> 3639 invalid messages -> 232 total mesages -> 3871 6% error
I wire in the new hardware both NMEA in and out then directly into the course computer.
$AITXT -> AIS (from AIS hub) $GPGBS -> GPS messages $GPGGA $GPGLL $GPRMC $IIMTW -> Sea temperature sensor $IIMWV -> Wind speed $IIVHW -> Heading & Speed $IIRSA -> Rudder Angle $IIHDG -> Heading $IIVLW -> Distance travelled Summary ####### valid messages -> 1661 invalid messages -> 121 total mesages -> 1782 6.7% error
I get all the messages I am after (for now) the hardware seems to be working.
Now to put all the panels back in place!
In the next article, I will get back to technology and the use of Kafka in the architecture.