QNSYtoNav

Description

QNSYtoNav converts ASCII export files generated by QPS QINSy hydrographic acquisition software into 48-byte OMG binary navigation files (jcu_nav_rec, .nav) or, when -motion is selected, into OMG-HDCS v3 binary attitude files (.orientation).

It supports six distinct QINSy ASCII export layouts:

  • Default (QINSY_GGA_ALL_ATTRIBUTES, format 0): GGA export with DMS coordinates, ellipsoidal height, GPS calculation mode, HDOP, satellite count, and DGPS correction age.
  • Format 2 (-format 2): DMS coordinates before timestamp, with quality thresholding.
  • Format 3 (-format 3): Timestamp, DMS coordinates, Easting/Northing, ellipsoidal height, ROC, SOG, and CalcMode (skips 10 header lines).
  • Speedlog (-speedlog): Timestamp and vessel speed (stored in tide_rec.azi; skips 3 header lines).
  • Draught (-draught): Timestamp and dynamic draught/tide value (stored in tide_rec.azi; skips 1 header line).
  • Motion (-motion): Timestamp, pitch, roll, and heave exported to an OMG-HDCS v3 .orientation file (skips 5 header lines).

Usage

QNSYtoNav [FORMAT_FLAG] [OPTIONS] -comp <output_file> <qinsy_ascii_file(s)>

Common Workflow Examples

1. Convert default QINSy GGA-All-Attributes ASCII export to binary .nav:

QNSYtoNav -comp qinsy_gps.nav qinsy_gga_export.txt

2. Convert QINSy Format 2 or Format 3 ASCII navigation exports:

QNSYtoNav -format 2 -comp qinsy_v2.nav export_v2.txt
QNSYtoNav -format 3 -comp qinsy_v3.nav export_v3.txt

3. Convert QINSy roll/pitch/heave motion export to an OMG .orientation file:

QNSYtoNav -motion -comp vessel.orientation qinsy_motion.txt

4. Convert QINSy speedlog or dynamic draught export to .nav:

QNSYtoNav -speedlog -comp speed.nav qinsy_speed.txt
QNSYtoNav -draught -comp draught.nav qinsy_draught.txt

Arguments

Option Description Default
-comp <filename> Required. Output binary .nav filename (or .orientation if -motion is used). None
<mergefile(s)> Required. One or more QINSy ASCII export files (up to 300 files). None
-format <2\|3> Select QINSy ASCII navigation layout 2 (QINSY_v2, 0 header lines) or 3 (QINSY_v3, 10 header lines). If omitted, defaults to 0 (QINSY_GGA_ALL_ATTRIBUTES, 1 header line). 0
-speedlog Parse QINSy speedlog export (3 header lines; MM/DD/YYYY HH:MM:SS msec speed). Stores speed in tide_rec.azi. Disabled
-draught Parse QINSy draught export (1 header line; DD/MM/YYYY HH:MM:SS.sss draught). Stores draught in tide_rec.azi. Disabled
-motion Parse QINSy motion export (5 header lines; MM/DD/YYYY HH:MM:SS.sss pitch roll heave) and write an OMG-HDCS v3 .orientation attitude file. Disabled
-skip <N> Decimation value parsed on the command line (skip = strtoint(*argv)). 1
-v Enable verbose output (prints parsed timestamps, coordinates, and GPS mode for every line). Disabled

Input & Output Format Details

Delimiter Stripping

Before parsing each line, QNSYtoNav replaces the following characters in-place with spaces: /, ,, N, E, :, ;, the degree symbol (byte -80), and single quotes (' / ASCII 39).

Subformat Column Layouts & Quality Flagging

  1. Default (QINSY_GGA_ALL_ATTRIBUTES, 1 header line skipped):

    <hour> <min> <sec.sss> <day> <month> <YY> <lat_D> <lat_M> <lat_S> <lon_D> <lon_M> <lon_S> <ellipse_h> <CalcMode> <HDOP> <noSats> <CorrAge>
    
    • Adds 2000 to YY.
    • Sets tide_rec.azi = ellipse_height, tide_rec.velocity = CorrAge, tide_rec.depth = HDOP * 100, flag[1] = CalcMode, flag[2] = noSats.
    • Automatic Quality Flagging (flag[3]): Sets flag[3] = 1 (bad fix) if HDOP > 10.0, CalcMode < 2, CalcMode > 4, noSats < 3, or CorrAge > 20.0. Sets flag[3] = 2 if CalcMode == 1.
  2. Format 2 (-format 2, 0 header lines skipped):

    <lat_D> <lat_M> <lat_S> <lon_D> <lon_M> <lon_S> <ellipse_h> <CalcMode> <EWhemi> <NShemi> <hour> <min> <sec.sss> <day> <month> <YY> <HDOP> <fnoSats> <CorrAge>
    
    • Same jcu_nav_rec field mapping and quality flagging (flag[3] = 1) as default mode, plus console warnings when thresholds are exceeded or time jumps (deltime > 500 or < 0) occur.
  3. Format 3 (-format 3, 10 header lines skipped):

    <month> <day> <YYYY> <hour> <min> <sec.sss> <lat_D> <lat_M> <lat_S> <lon_D> <lon_M> <lon_S> <east> <north> <ellipse_h> <ROC> <SOG> <CalcMode>
    
    • Preserves hundredths of a second (tide_rec.centisecs = msec / 10.0).
  4. Motion (-motion, 5 header lines skipped):

    <month> <day> <YYYY> <hour> <min> <sec.sss> <pitch_deg> <roll_deg> <heave_m>
    
    • Writes OMG_HDCS_summary_attitude (sensorNumber = 2, fileVersion = 3, timeScale = 1000, status = 15) followed by OMG_HDCS_attitude records with roll, pitch, and heave scaled by 100.0 (heading = 0.0).

How It Works

  1. Opens the output file (-comp) in "w+" mode and zeroes out the modecount[0..9] histogram array.
  2. For each input file, skips the format-specific number of header lines (1, 0, 10, 3, or 5).
  3. Reads each remaining line via getc_line(), strips punctuation and hemisphere letters (N, E), and unpacks the fields according to subformat.
  4. Converts DMS coordinates (deg + min/60 + sec/3600) and calendar timestamps (stdtime_from_dmy), applies GPS quality checks, and writes binary .nav or .orientation records. Prints a summary of mode 0..9 counts after closing each input file.