navFix (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

MX2, AX9, CX1 pro/flex/warp, SX1, MX2 turbo/encore/warp, AX9 turbo, NX-200, NX-400, NX-900

Firmware version:

2.60 / 1.00.00

Nav. API level:

1


The navFix function block is used to query the current position and time from the connected navigation device.

The navFix works similar to the gpsFix function block except for the fact that the information comes from the connected navigation device.

 

This function is especially suited for the AX9 series that does not have an on-board GPS receiver to use for positioning.

All values returned by navFix() are in the WGS-84 datum.

 

Note: this function is not supported on the NMP.

 

Note regarding decimal minutes:

The value returned in Decimal minutes, both latdecmin and londecmin, are assumed to be 4 digits long.

This means that for the position 55 Deg, 51.3 Min North is returned as latdeg=55 latmin=51 and latdecmin=3000, and the position 55 Deg, 52.0076 North is returned as latdeg=55 latmin=52 latdecmin=76.

 

 

Input:

None.

 

 

Output:

mode : SINT;

0 = No info available.

1 = Fix not available.

2 = 2D position fix.

3 = 3D position fix.

4 = 3D position fix with SBAS correction.

 

linsec : DINT

Linsec for timestamps received from the GPS receiver.

This is the same as the separate year, month, day, minute, and second but expressed as a linsec.

Also see clockLinsecToTime().

 

year : INT

Year (absolute).

 

month : SINT

Month (1..12).

 

day : SINT

Date (1..31).

 

hour : SINT

Hour (0..23).

 

minute : SINT

Minute (0..59).

 

second : SINT

Second (0..59).

 

latitude : DINT

Latitude expressed in a DINT.

Negative is South (ddmm.mmmm (multiplied by 10000)).

 

latsouth : BOOL

Direction of latitude (TRUE is South, FALSE is North).

 

latdeg : SINT

Latitude Degress (0..90).

 

latmin : SINT

Latitude Minutes (0..59).

 

latdecmin : INT

Latitude Decimal Minutes (0..9999).

This value is assumed to be 4 digits with the leading zeros removed (see note regarding decimal minutes above).

 

longitude : DINT

Longitude expressed in a DINT.

Negative is West (dddmm.mmmm (multiplied by 10000)).

 

lonwest : BOOL

Direction of longitude (TRUE is West, FALSE is East).

 

londeg : INT

Longitude Degress (0..180).

 

lonmin : SINT

Longitude Minutes (0..59).

 

londecmin : INT

Longitude Decimal Minutes (0..9999).

This value is assumed to be 4 digits with the leading zeros removed (see note regarding decimal minutes above).

 

height : INT

Height in meters over Mean Sea Level.

 

 

Declaration:

FUNCTION_BLOCK navFix;
VAR_OUTPUT
  mode         : SINT;   | 0=No info available, 1=Fix not available, 2=2D position fix, 3=3D position fix, 4=3D pos. with SBAS
  linsec       : DINT;   | Linsec of time-stamp
  year         : INT;     | year (absolute, like 2004)
  month       : SINT;   | month (1..12)
  day         : SINT;   | date (1..31)
  hour         : SINT;   | hour (0..23)
  minute       : SINT;   | minute (0..59)
  second       : SINT;   | second (0..59)
  latitude     : DINT;   | Negative is South (ddmm.mmmm (multiplied by 10000))
  latsouth     : BOOL;   | True = South, False = North
  latdeg       : SINT;   | Degrees (0..90)
  latmin       : SINT;   | minutes (0..59)
  latdecmin   : INT;     | decimal minutes (0..9999)
  longitude   : DINT;   | Negative is West (dddmm.mmmm (multiplied by 10000))
  lonwest     : BOOL;   | True = West, False = East
  londeg       : INT;     | degrees (0..180)
  lonmin       : SINT;   | minutes (0..59)
  londecmin   : INT;     | decimal minutes (0..9999)
  height       : INT;     | Height in meters over Mean Sea Level.
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
FUNCTION ShowDecmin : STRING;
VAR_INPUT
  decmin : INT;
END_VAR;
  ShowDecmin := intToStr(v := decmin);
  WHILE strLen(str := ShowDecmin) < 4 DO
     ShowDecmin := strConcat(str1 := "0", str2 := ShowDecmin);
  END_WHILE;
END_FUNCTION;
 
PROGRAM test;
VAR
pos   : navFix;
END_VAR;
 
navOpen();
 
BEGIN
  pos();
  IF pos.mode > 1 THEN
    DebugFmt(message:="Mode=\1", v1:=pos.mode);
    DebugFmt(message:="   Linsec=\4", v4:=pos.linsec);
    DebugFmt(message:="   Time=\1:\2:\3", v1:=pos.hour, v2:=pos.minute, v3:=pos.second);
    DebugFmt(message:="   Date=\1:\2:\3", v1:=pos.year, v2:=pos.month, v3:=pos.day);
    DebugFmt(message:="   Lat: latitude=\4", v4:=pos.latitude);
    IF pos.latsouth THEN DebugMsg(message:="   Lat: South"); ELSE DebugMsg(message:="   Lat: North"); END_IF;
     str := strConcat(str1 := "   Lat: Deg=\1 Min=\2 Dec=", str2 := ShowDecmin(decmin := pos.latdecmin));
    DebugFmt(message:=str, v1:=pos.latdeg, v2:=pos.latmin);
    DebugFmt(message:="   Lon: longitude=\4", v4:=pos.longitude);
    IF pos.lonwest THEN DebugMsg(message:="   Lon: West"); ELSE DebugMsg(message:="   Lon: East"); END_IF;
     str := strConcat(str1 := "   Lon: Deg=\1 Min=\2 Dec=", str2 := ShowDecmin(decmin := pos.londecmin));
    DebugFmt(message:=str, v1:=pos.londeg, v2:=pos.lonmin);
    DebugFmt(message:="   Height=\1", v1:=pos.height);
  END_IF;
END;
END_PROGRAM;