Tuesday 31 March 2020

SaiLog YDVR NMEA-2000 Traffic Analysis

Hi everyone,
Another technical post today.  We're continuing to keep ourselves busy under lockdown at Gosport Premier Marina.  In the preceding post we described how we plot passage data from our YDVR Voyage Recorder.  In this post we describe a Python script to analyse recorded NMEA-2000 traffic.  The objective is to better understand the traffic on our network.

Total Traffic Pie Charts
To view each pie charts plot in more detail click on it!

Our new python script SaiLog_Stat presents statistics calculated from the YDVR log file.  For our 40 hour recording the log file is 830MB in size.  The following paragraphs walk through the results produced by the script.

Basics

Initially SaiLog_Stat lists some basic characteristics of the traffic...

############################################################
#                       SaiLog_Stat                        #
############################################################
#         !!! All Statistics Are Approximate !!!           #
############################################################
#
# Loaded file ../n2k/ZenAgainN2K_London-Gosport.log
#
# Processing 9695591 NMEA2000 messages
#
############################################################
# Basics
############################################################
#
#   Start Time        = 2020-03-18 06:45:11
#   Stop Time         = 2020-03-19 21:44:57
#   Duration          = 140386 seconds
#   Message Count     = 9695591
#   Message Frequency = 69.1Hz (average)
#   Bit Rate          = ~8333bps (approx)
#   Bus Utilisation   = ~3.3 percent (approx)

The bus utilisation is reassuring!

Devices

The script then interprets Product Information messages in which each device describes itself on the network.  On our network we have:
  • SPx5 = Raymarine Autopilot
  • GPSmap451 = Garmin GPS ChartPlotter
  • VHF300iAIS = Garmin VHF Transceiver (with its AIS receiver disabled)
  • XB8000 = Vesper AIS transceiver (with GPS)
  • WiFi Replicator = NMEA-2000 to WiFi Bridge
  • DST200 = Airmar DST800 Speed/Depth Sensor
  • WX Series = Airmar 220WX Weather Station
############################################################
# Devices
############################################################
#
# Device Address 0
#   Model             = SPx5  E12197
#   Software Version  = Raymarine SPxx v
#   Model Version     = E12197ne SPxx v
#   Model Serial Code = 0000000e SPxx v
#
# Device Address 1
#   Model             = GPSmap 451 AUS
#   Software Version  = 4.60
#   Model Version     = 1.0
#   Model Serial Code = 3820961182
#
# Device Address 2
#   Model             = VHF 300i AIS
#   Software Version  = 2.10
#   Model Version     = 2.00
#   Model Serial Code = 1MN000235
#
# Device Address 21
#   Model             = XB8000F
#   Software Version  = 5.20.17443
#   Model Version     = F,ECN2,HW3,BB467
#   Model Serial Code = KW75348
#
# Device Address 32
#   Model             = WiFi REPLICATOR
#   Software Version  = 1.5 (2018-09-09)
#   Model Version     = 1.1 (2018-09-09)
#   Model Serial Code = 238243780
#
# Device Address 35
#   Model             = DST200
#   Software Version  = 3.004,3.050
#   Model Version     = 44-196-1-01,HW2:
#   Model Serial Code = 3822649
#
# Device Address 36
#   Model             = WX Series Weathe
#   Software Version  = 2.006,2.300,2.00
#   Model Version     = 44-854-1-02,HW11
#   Model Serial Code = 60111222

It's interesting how poorly some manufacturers encode the Model field.  Some include non-printable characters which SaiLog_Stat removes.

Messages

Next the script counts occurrences of each message type and accumulates their sizes, for each device.  Count, percentage, frequency, bitrate and name are tabulated for each message type...

############################################################
# Messages
############################################################
#
# Device "SPx5  E12197" (2254435 messages, 18038000 bytes, ~1124.3bps)
#      Count     %    Freq   Bitrate   Name
#         33   0.0   0.0Hz    0.0bps   ISO Address Claim                       
#         20   0.0   0.0Hz    0.2bps   Product Information                     
#     749613  33.3   5.3Hz  373.8bps   Rudder                                  
#         51   0.0   0.0Hz    0.0bps   Vessel Heading                          
#
# Device "GPSmap 451 AUS" (2310529 messages, 46443426 bytes, ~2745.4bps)
#      Count     %    Freq   Bitrate   Name
#      20908   0.9   0.1Hz    4.5bps   ISO Request                             
#         29   0.0   0.0Hz    0.0bps   ISO Address Claim                       
#          4   0.0   0.0Hz    0.0bps   ISO Manufacturer Proprietary A          
#     409044  17.7   2.9Hz  437.1bps   NMEA Group Function                     
#     245373  10.6   1.7Hz  518.5bps   Manufacturer Proprietary C              
#         17   0.0   0.0Hz    0.1bps   Product Information                     
#      81758   3.5   0.6Hz   40.8bps   Magnetic Variation                      
#     817517  35.4   5.8Hz  407.6bps   Position, Rapid Update                  
#     326996  14.2   2.3Hz  163.0bps   COG & SOG, Rapid Update                 
#      81741   3.5   0.6Hz  222.4bps   GNSS Position Data                      
#      81790   3.5   0.6Hz   40.8bps   Cross Track Error                       
#      81791   3.5   0.6Hz  162.0bps   Navigation Data                         
#      81781   3.5   0.6Hz   40.8bps   GNSS DOPs                               
#      81780   3.5   0.6Hz  707.8bps   GNSS Sats in View                       
#
# Device "VHF 300i AIS" (7359 messages, 61638 bytes, ~3.8bps)
#      Count     %    Freq   Bitrate   Name
#       7323  99.5   0.1Hz    3.7bps   ISO Address Claim                       
#          1   0.0   0.0Hz    0.0bps   Manufacturer Proprietary C              
#         20   0.3   0.0Hz    0.2bps   Product Information                     
#         14   0.2   0.0Hz    0.0bps   Radio Frequency/Mode/Power              
#          1   0.0   0.0Hz    0.0bps   DSC Call Information                    
#
# Device "XB8000F" (601452 messages, 21430313 bytes, ~1246.9bps)
#      Count     %    Freq   Bitrate   Name
#         32   0.0   0.0Hz    0.0bps   ISO Address Claim                       
#         19   0.0   0.0Hz    0.1bps   Product Information                     
#     164856  27.4   1.2Hz   82.2bps   Position, Rapid Update                  
#     164828  27.4   1.2Hz   82.2bps   COG & SOG, Rapid Update                 
#      81127  13.5   0.6Hz  220.8bps   GNSS Position Data                      
#      80414  13.4   0.6Hz  131.7bps   AIS Class A Position Report             
#      27877   4.6   0.2Hz   44.1bps   AIS Class B Position Report             
#          6   0.0   0.0Hz    0.0bps   Cross Track Error                       
#          6   0.0   0.0Hz    0.0bps   Navigation Data                         
#      78678  13.1   0.6Hz  672.5bps   GNSS Sats in View                       
#       2452   0.4   0.0Hz   10.7bps   AIS Class A Static and Voyage Related Data
#         72   0.0   0.0Hz    0.1bps   AIS SAR Aircraft Position Report        
#        319   0.1   0.0Hz    0.5bps   AIS Class B static Part A)              
#        319   0.1   0.0Hz    0.6bps   AIS Class B static Part B)              
#
# Device "WiFi REPLICATOR" (8224 messages, 71840 bytes, ~4.4bps)
#      Count     %    Freq   Bitrate   Name
#       6794  82.6   0.0Hz    3.4bps   ISO Address Claim                       
#         48   0.6   0.0Hz    0.4bps   Product Information                     
#
# Device "DST200" (455886 messages, 4146880 bytes, ~255.8bps)
#      Count     %    Freq   Bitrate   Name
#         33   0.0   0.0Hz    0.0bps   ISO Address Claim                       
#          1   0.0   0.0Hz    0.0bps   NMEA Group Function                     
#          1   0.0   0.0Hz    0.0bps   Manufacturer Proprietary C              
#         20   0.0   0.0Hz    0.2bps   Product Information                     
#      82881  18.2   0.6Hz   41.3bps   Speed                                   
#      82879  18.2   0.6Hz   41.3bps   Water Depth                             
#      82879  18.2   0.6Hz   69.7bps   Distance Log                            
#     165751  36.4   1.2Hz   82.6bps   Environmental Parameters 1              
#          3   0.0   0.0Hz    0.0bps   Airmar POST                             
#
# Device "WX Series Weathe" (4057706 messages, 48765699 bytes, ~2952.4bps)
#      Count     %    Freq   Bitrate   Name
#         33   0.0   0.0Hz    0.0bps   ISO Address Claim                       
#     320194   7.9   2.3Hz  159.7bps   NMEA Group Function                     
#      82868   2.0   0.6Hz   41.3bps   System Time                             
#         19   0.0   0.0Hz    0.1bps   Product Information                     
#     828619  20.4   5.9Hz  413.2bps   Vessel Heading                          
#     828618  20.4   5.9Hz  413.2bps   Rate of Turn                            
#      82869   2.0   0.6Hz   41.3bps   Attitude                                
#      82868   2.0   0.6Hz   41.3bps   Magnetic Variation                      
#     414308  10.2   3.0Hz  206.6bps   Position, Rapid Update                  
#     414307  10.2   3.0Hz  206.6bps   COG & SOG, Rapid Update                 
#      82850   2.0   0.6Hz  206.6bps   GNSS Position Data                      
#      82867   2.0   0.6Hz   41.3bps   Time & Date                             
#       8290   0.2   0.1Hz    9.8bps   Datum                                   
#      82869   2.0   0.6Hz   41.3bps   GNSS DOPs                               
#      82797   2.0   0.6Hz  695.5bps   GNSS Sats in View                       
#     331451   8.2   2.4Hz  165.3bps   Wind Data                               
#     165729   4.1   1.2Hz   82.6bps   Environmental Parameters 1              
#      41434   1.0   0.3Hz   20.7bps   Temperature                             
#      41435   1.0   0.3Hz   20.7bps   Actual Pressure                         
#      82852   2.0   0.6Hz  145.2bps   Meteorological Station Data             
#          6   0.0   0.0Hz    0.0bps   Airmar POST                             

Many message frequencies seem lower than expected.  This could be due to messages being "stomped on" by other devices.  Action for further investigation.

Plots

Finally the script generates a set of plots.  Each plot presents two pie charts - one of message counts and the other of message bytes.  The first plot shows the relative contribution of the devices.  The rest show the messages of each device individually...

############################################################
# Plots
############################################################
#
# Total
# Device "SPx5  E12197"
# Device "GPSmap 451 AUS"
# Device "VHF 300i AIS"
# Device "XB8000F"
# Device "WiFi REPLICATOR"
# Device "DST200"
# Device "WX Series Weathe"
#
############################################################
#                    SaiLog_Stat done                      #
############################################################

Here are the plots, with each followed by comments...

Total Traffic Plot
The first surprise above is the volume of messages from the SPx5 autopilot.  Checking the text output shows these are Rudder messages.  The second pie chart shows that these messages are thankfully short.  The Rudder information isn't used so an action is to investigate disabling these messages.

The second surprise above is the volume of messages from the GPS ChartPlotter.  The second pie chart shows that these messages are long.  The device needs to receive AIS data from the network but its transmitted messages aren't used.  Action is to try to disable its transmissions.

The large message number and data volume from the Weather Station is expected due to the wide variety of data it provides.

Autopilot Traffic Plot
The Autopilot transmits frequent Rudder messages!

GPS ChartPlotter Traffic Plot

The GPS ChartPlotter transmits an unexpectedly varied set of data.  An interesting message type is Sats In View.  The pie charts show they produce high data volume despite being transmitted at a low rate.  ie Each message is long.  Also interesting is the volume of proprietary messages.

VHF Traffic Plot

The VHF transmits rarely.  Its traffic is dominated by ISO Address Claim messages.  Interestingly a single DSC Call Information message occurred.

AIS Traffic Plot

The AIS transmits a variety of information including GPS and AIS data.  Again, the Sats In View message data volume is high.  Contrary to expectation the volume of AIS messages was modest, despite our passage being in the English Channel - one of the busiest seaways in the world.

WiFi Bridge Traffic Plot

The WiFi Bridge transmits rarely.  Its traffic is dominated by ISO Address Claim messages.

Speed/Depth Sensor Traffic Plot

The Speed/Depth Sensor transmits speed, depth, log and temperature data.  Interestingly the water temperature data is transmitted at twice the rate of the other data.

Weather Station Traffic Plot

The Weather Station transmits a wide variety of data including GPS, attitude, attitude rate, wind, temperature and pressure.  Once again the Sats In View message data volume is high.


Overall SaiLog_Stat has provided lots of useful information about our NMEA-2000 network.  It has made plain exactly what is on the bus, how often, and its volume.  Plenty to think about!

Keep well everyone!

No comments:

Post a Comment