Recent Changes - Search:

Past operations & data


Scientific equipment


Communications / Navigation / Tracking


Weather


Ship contact info


VHF Radio Call Sign:
WDE4414
Iridium phone cockpit:
00 - 88 1677 72 7018
Iridium spare 1:
00 - 88 1621 41 8079
Iridium spare 2:
00 - 88 1621 44 3804
Emergency Beacon:
ID: ADE90 05931 C34D
Handheld Emergency Beacon:
ID: LC 4652
Hovercraft registered in Delaware, US:
DL 1519 AB

Maintenance



edit SideBar

GPS- AND ECHO SOUNDER LOGGING


1.  INTRODUCTION


Capture of data from echo sounder is achieved by a combined GPS- and echo sounder logging program, running in terminal window under Windows. We searched without success for commercial software that could accomplish this task, so we wrote a small Python script instead. Please notify us if you are aware of similar commercial software.

The program features:

  • Auto-detection of serial ports.
  • Auto-detection of serial speed.
  • Auto-detection of GPS and Echo Sounder data transmission.
  • Logging to file with automatic file name.
  • Courtesy printing of LATITUDE / LONGITUDE / TIME every minute, easily visible.
  • Echo Sounder data logged continuously, including position- and timestamp.
    Logging resumed silently if data transmission interrupted for a period.
  • GPS data logged at user specified interval.
  • Sound indications:
    • Normal logging of GPS data accompanied by tiny pleasant beep.
    • Alarm sound: Loss of GPS fix, data from GPS.
  • Extensive alarm reporting - but not interrupting logging process:
    • Loss of GPS fix
    • Loss of GPS data
    • Echo Sounder: Loss of data these will not generate alarm - it is seen as normal part of data acquisition from this unit. Instead, the ordinary logging audio indication is changed slightly when Echo Sounder data is present.

Screenshot of logging program during normal operation is shown below:

Combined logging of GPS and Echo Sounder data
Screenshot of combined GPS and Echo sounder logging software.

Ideally, software should be written as a proper Windows program with a Graphical User Interface (GUI). Due to time and personnel constraints this Python program was, however, what we were able to achieve. It might be sufficient for the task at hand.

2.  INSTALLATION


2.1  GPS


  • $GPRMC NMEA telegram must be present in data stream from GPS. If necessary, configure GPS to output this telegram. Other telegrams may be present - they are simply ignored.
  • GPS can have USB-interface, or old-fashioned 9-pin D-Sub connector.
  • Auto-detecting serial speed: The program attempts to identify GPS telegram at three speed settings: 4800, 9600 and 19200 bits/s (range of valid speeds set in Constants section in top of program).

2.2  Python


Software is written in Python language. This language is interpreted - not compiled. Changes can be made in any text editor.

It's possible to make stand-alone executable Python program, alleviating the need to install Python and library modules. Perhaps we have time to look into this later. The drawback is, of course, that you loose the possibility of making changes (fixing bugs) using a simple editor.

In addition to the Python interpreter, two library modules are needed.

  1. Download and install Python from http://www.python.org/download/
  2. Download and install Python "win32all" extensions
  3. Download and install PySerial

If you want to edit the program source code, there is a nice Windows editor called Programmer's Notepad.

2.3  USB COM-port assignment


If you use a GPS with USB interface, it will appear as a COM-port in the operating system. You might experience problems during this COM-port assignment.

  1. If the GPS is attached to the computer upon power-on, it might be interpreted as a serial mouse, wreaking havoc in the Windows user interface. This is a well-known problem; it may, however, be solved in Vista or WIN7.
  2. If your computer has no 9-pin serial port, you must use two USB-ports. One is assigned to the GPS, the other to the Echo Sounder RS-422 interface. In that case you may see an attempt by the operating system to assign both USB devices to the same COM port. Obviously, one must yield and is rendered inoperable. To solve this problem, you must modify advanced settings in one of the COM port properties. See screenshots below.

2.4  Setting PATH to the Python interpreter


It is most convenient to execute the program within terminal window that has already been opened. Otherwise the terminal window is closed immediately when you hit the <ENTER> key, and log file summary cannot be seen.

It's also convenient to add the directory containing the Python interpreter to the PATH environment variable. Follow these steps:

Open

  Control Panel -> System -> Advanced system settings

Then click

  Environment variables

Select Path, then click Edit, and enter path to Python interpreter as shown. As of May 2010 it has version 2.6, reflected in path name - so this will change with later versions.

3.  OPERATION


3.1  Normal mode


Start program by writing, in terminal window

   logger.py

The program will first make an inventory of available COM ports. Next it will try to locate GPS data among these port. It will attempt to read data at three different speeds (4800, 9600 and 19200 bits/s). If valid GPS data is found it makes a similar seach for Echo Sounder serial data.

Screenshot below shows successful detection of both GPS and Echo Sounder COM ports:

Starting the program - identifying GPS and Echo Sounder serial ports.
Starting the program - identifying GPS and Echo Sounder serial ports.

In the next stage the user has to enter GPS data logging interval. Echo Sounder data is stored continuously (max rate 1 Hz), so there is no need to specify log interval here. User input is vetted and hopefully accepted; the program then needs to capture one valid GPS telegram in order to perform automatic file naming (file name contains year, month, day and time). After that, it enters an eternal logging loop.

Every minute, on the minute, LATITUDE, LONGITUDE and UTC TIME is printed to screen. This provides crew with a convenient method of reading current vessel position and time.

Exit program by hitting <ENTER> key. At program closure a file summary is displayed, as shown below:

Logging halted by hitting the <ENTER> key.
Logging halted by hitting the <ENTER> key.

3.2  Errors


Receiving and merging data from two serial sources that transmits asynchronously is a challenge. There is a plethoria of error scenarios that can be encountered. Errors should of cource be handled according to the degree of severity they represent. They should never cause the program to crash. However, it can be difficult to foresee every possible error condition. Despite being subjected to extensive testing, the software might have vulnerabilities lurking in the shadows. Please send bug reports to ole.meyer at geo.uib.no.

4.  ERROR HANDLING


4.1  No GPS fix initially


As mentioned in section Normal operation above, the program depends on initially receiving at least one valid GPS telegram in order to determine file name, which will indicate year, month, day and time. If the GPS do not have fix at this stage, the program simply loops until fix is achieved, or you press <ENTER>. That situation is shown in screenshot below.

No initial GPS fix - cannot determine file name - cannot proceed ...
No initial GPS fix - cannot determine file name - cannot proceed ....

4.2  No Echo Sounder data initially


This is actually not an error condition. The Echo Sounder will normally be used on rare occasions. So there will be a COM port available, but it will be quit. If this is the initial situation, program simply monitors port for activity and automatically starts logging of Echo Sounder data, when they appear. If more then one COM port is available for the Echo Sounder, user is asked to specify which one to monitor.

No Echo Sounder data (but free COM port, assumed to belong to Echo Sounder, is present).
No Echo Sounder data (but free COM port, assumed to belong to Echo Sounder, is present).

4.3  GPS fix lost during logging


If GPS fix is lost when logging has started, logging will continue. Both error messages on screen and audio alarm will seek to draw the crews attention.

Screenshot below shows error messages during loss of GPS fix.

GPS fix lost during logging.
GPS fix lost during logging.

5.  DATA STORAGE


5.1  File format


Here's an excerpt from log file:

$SDDPT,  12.34,  0.00*63 @ $GPRMC,120159.000,A,6023.0521,N,00519.8125,E,0.58,115.23,160510,,*05
$SDDPT,  12.46,  0.00*66 @ $GPRMC,120200.000,A,6023.0519,N,00519.8130,E,0.46,82.79,160510,,*3A
$SDDPT,  18.43,  0.00*69 @ $GPRMC,120202.000,A,6023.0520,N,00519.8130,E,0.15,76.80,160510,,*39
$GPRMC,120202.000,A,6023.0520,N,00519.8130,E,0.15,76.80,160510,,*39
$SDDPT,  16.75,  0.00*62 @ $GPRMC,120203.000,A,6023.0520,N,00519.8126,E,0.16,146.10,160510,,*07
$SDDPT,  15.07,  0.00*64 @ $GPRMC,120204.000,A,6023.0523,N,00519.8121,E,0.25,89.69,160510,,*38

Echo sounder data contains depth reading with time- and position stamping added. E.g.:

  $SDDPT,  12.34,  0.00*63 @ $GPRMC,120159.000,A,6023.0521,N,00519.8125,E,0.58,115.23,160510,,*05

indicates a depth reading of 12.34 meter, with time and position yielded by the $GPRMC GPS telegram:

  $GPRMC,120159.000,A,6023.0521,N,00519.8125,E,0.58,115.23,160510,,*05

The $GPRMS telegram is decoded according to description provided here.

5.2  Extracting data from log file


GPS track log data and Echo Sounder data can be separated by either AWK (on Linux/Unix platform) or a simple Python script.

6.  SOFTWARE


It's possible to merge two serial input data streams (this is what we are trying to achieve) using software like [[ | GpsGate}} from Franson. Setup for this scenario is given further down on this page.

The essential idea behind our program is to read GPS data telegrams in an eternal main loop. Reading of Echo Sounder telegrams is performed in a separate thread. Time- and position stamping of Echo Sounder telegrams is achieved by sending them through a "Last-In-First-Out" (LIFO) queue to the main loop. Main loop executes once every second, and Echo Sounder has a repetition rate of 2 seconds, so in theory there should not be any bottlenecks in consuming Echo Sounder data packets. Even so, the programs features mechanisms for handling such a case.

This merging of two asynchronous data streams, and time- and position stamping one of them with data from the other, is a challenging task. The program is designed to handle different error scenarios. It has been subject to long-term testing. If you spot any bugs in the program please notify us.

Click to see software listing:

Click to download Python script logger.py.

7.  SAMPLE LOG FILE


8.  ECHO SOUNDER SIMULATOR


9.  BACKGROUND


For reference: Python program that merges three serial data flows, used for logging of EM data:

From Python thread programming discussion with C.H.:

...If you still want to look into threading there is a need for syncronization: Upon reception of EM data you want to fetch Sonic and GPS data immediately, but you have to ensure that any update of Sonic and GPS data is complete before they are used. In addition, the age of data must be checked, as mentioned.
To achieve syncronization, you can investigate:
In general, searching for "python thread syncronization" get a lot of interesting hits.

10.  TEST 18 JUNE 2010



Two USB-Serial devices connected: RS422 adapter (to Echo Sounder). and USB-GPS.

Notes on Laptop:

  • Lenovo mod X300 with Solid State HD.
  • OS = MS Vista 32 bit
  • Last software update: 18 June 2010
  • 22 Watt power consumption (53 power factor)
  • Screen resolution 1440 x 900

11.  SHARING GPS DATA BETWEEN SEVERAL APPLICATIONS


It's assumed that you have already connected GPS to the PC, and that you have verified its proper operation by reading data in terminal program, like TeraTerm

We will use an excellent piece of software for this purpose: GpsGate made by Franson.

First download and install GpsGate. The first time it's started, it enters Wizard mode:

Franson GpsGate, Wizard Mode
Franson GpsGate, entering Wizard Mode.
Serial port found
GPS Serial port identified.
Select output
Select output.
Summary of output COM ports
Summary of GPS output to virtual COM ports.
Running Nav data + Echo Sounder logging program
Running Nav data + Echo Sounder logging program with GPS on several virtual COM ports.

Normal view of GpsGate - Input, Output and Advanced tabs:

Normal view of GpsGate Normal view of GpsGate Normal view of GpsGate

Enter licence key by first identifying the GpsGate icon in the task bar. Right-click the icon. A new menu appears; select "Licence key":

Enter licence key
Edit - History - Print - Recent Changes - Search
Page last modified on October 24, 2011, at 11:04 AM
Department of Earth Science
University of Bergen
N O R W A Y