gnssSatellitesInView (Function)

Top  Previous  Next

Architecture:

NX32 / NX32L

Device support:

MX2 turbo/encore/warp, CX1 warp(-c) mk2, NX-200, NX-400, NX-900, LX2, LX5

Firmware version:

4.00 / 1.40.00


Retrieves information about the satellites in view.

This can be used to help with determining the local signal conditions and position accuracy.

 
 

Input:

type : SINT (Default: 0)

0 = GPS

1 = GLONASS

2 = GALILEO.

 

tracked : BOOL Default TRUE

Retrieve satellites that are being tracked.

 

untracked : BOOL Default FALSE

Retrieve untracked satellites.

 

gnss : BOOL Default TRUE

Retrieve normal positioning satellites.

 

sbas : BOOL Default FALSE

Retrieve SBAS satellites.

 

Output:

satellites :  gnssSatellites

STRUCT_BLOCK with space for information about 30 satellites:

id[n]: SINT

Satellite ID.

 

elevation[n]: SINT

Elevation angle for satellite n.

 

azimuth[n]: INT

Azimuth angle for satellite n.

 

SNR[n]: SINT

Signal to noise ratio for satellite n. If the satellite is untracked, the SNR will be 120.

 

 

 

Returns: INT

Number of found satellites matching the filter

-1

- Not powered or not supported

-2

- Invalid parameter

 

Declaration:

 

STRUCT_BLOCK ALIGN gnssSatellites;

id        : ARRAY [1..30] OF SINT;

elevation : ARRAY [1..30] OF SINT;

azimuth   : ARRAY [1..30] OF INT;

SNR       : ARRAY [1..30] OF SINT;

END_STRUCT_BLOCK;

 

FUNCTION ALIGN gnssSatellitesInView: INT;

VAR_INPUT

  type        : SINT := 0;

  tracked     : BOOL := TRUE;

  untracked   : BOOL := FALSE;

  gnss        : BOOL := TRUE;

  sbas        : BOOL := FALSE;

  satellites : ACCESS gnssSatellites;

END_VAR;

END_FUNCTION;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  sats  : gnssSatellites;
  gnss  : gnssFix;
  count : INT;
  i     : INT;
END_VAR;
 
gpsPower(power := ON);
 
BEGIN
  gnss();
  IF gnss.mode > 1 THEN
    count := gnssSatellitesInView(type:=0, satellites:=sats,
    sbas:=FALSE, untracked:=FALSE);
    DebugFmt(message:="satellites tracked: \1", v1:= count);
    FOR i := 1 TO count DO
        DebugFmt(message:="      SVID=\1, El=\2, Az=\3, SNR=\4",
                v1:=sats.id[i], v2:=sats.elevation[i], v3:=sats.azimuth[i], v4:=sats.SNR[i]);
    END_FOR;
  END_IF;
END;
END_PROGRAM;