Start of trail End of trail navigation bar

Table of Contents

GPS NMEA

Reads NMEA-0183 sentences from a GPS receiver and outputs position data.

Beta

This block is currently a beta version because it does not work with all GPS NMEA devices. If you are using this block, we would appreciate any feedback at tech@quanser.com.

Library

QUARC Targets Beta/Devices/Third-Party/NMEA/GPS MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: qc_open_library('quarc_library_beta/Devices/Third-Party/NMEA/GPS')

Description

GPS NMEA

The GPS NMEA block reads NMEA-0183 sentences sent by a GPS receiver over the specified communication channel. GPS position, number of visible satellites, dilution of precision, true/magnetic heading, and ground speed are provided as outputs.

A separate thread is used to read and parse the NMEA sentences sent from the GPS receiver. The most recent GPS data values are then copied when the block executes so that the outputs always represent the most recent data. The data is gathered from the following NMEA-0183 messages: GGA, GLL, GSA, and VTG.

A URI is used to specify the communication protocol and parameters so that data can be received from the GPS.

Input Ports

This block has no input ports.

Output Ports

valid

A Boolean flag that indicates whether the current GPS position data is valid (true) or invalid (false).

UTC time (s)

The Coordinated Universal Time (UTC time) given as a double-precision value in seconds from midnight. This output will have units of seconds.

latitude (deg)

The latitude position of the GPS receiver, given as a double precision value in decimal degrees format (DD.DDDDD). This output will have units of degrees.

north

A Boolean value indicating whether the latitude position is in the northern hemisphere (true) or the southern hemisphere (false).

longitude (deg)

The longitude position of the GPS receiver, given as a double precision value in decimal degrees format (DD.DDDDD). This output will have units of degrees.

east

A Boolean value indicating whether the longitude position is in the eastern hemisphere (true) or western hemisphere (false).

pdop

The position (3-D) dilution of precision (PDOP) value for the current data. The PDOP value provides a measure of the quality of the 3-D position measurement, where a value of 1 is the highest possible confidence level and the confidence level decreases as the PDOP value increases. The table below gives a qualitative assessment of the confidence in the measurement based on the PDOP value.

Range

Description

0 to 1

Extremely high precision

1 to 2

Excellent precision

3 to 5

Good to moderate precision

6 or above

Poor, less reliable, precision

hdop

The horizontal dilution of precision (HDOP) value for the current data. The HDOP value provides a measure of the quality of the horizontal (latitude/longitude) position, where a value of 0 is the highest possible confidence level and the confidence level decreases as the HDOP value increases. See the table for pdop above for details.

vdop

The vertical dilution of precision (VDOP) value for the current data. The VDOP value provides a measure of the quality of the vertical (altitude) position, where a value of 0 is the highest possible confidence level and the confidence level decreases as the VDOP value increases. See the table for pdop above for details.

true heading (deg)

The tracked heading based on true North measured in degrees. This output will have units of degrees.

magnetic heading (deg)

The tracked heading based on magnetic North measured in degrees. This output will have units of degrees.

ground speed (km/h)

The tracked ground speed measured in km/h. This output will have units of km/h.

knots (kn)

The ground speed measured in knots. This output will have units of knots.

altitude (m)

The altitude in meters above mean sea level (MSL) or the ellipsoid. Some GPS receivers can be configured to output the orthometric height (height about the geoid) instead. This output will have units of meters.

geoid separation (m)

The difference between the geoid and the ellipsoid in meters. The geoid is the shape that the oceans would take under the influence of gravity and the Earth's rotation if winds and tides were absent. In other words, it is a gravitation model of the earth. The ellipsoid is a model of the earth which assumes no surface features such as mountains or hills (an oblate spheroid with the bulging of the Earth at the equator due to its rotation). This output will have units of meters.

sat_count

An integer indicating the number of satellites used to determine the GPS position.

channels

A 12-bector of pseudo-random code numbers (PRN), one for each satellite.

position fix

An integer indicating the quality of the GPS position fix. The table below enumerates the different codes that may be output and their meaning.

Value

Description

0

Fix not valid

1

GPS fix

2

Differential GPS fix (DGNSS), SBAS, OmniSTAR VBS, Beacon, RTX in GVBS mode

3

Not applicable

4

RTK Fixed, xFill, RTX

5

RTK Float, OmniSTAR XP/HP, Location RTK, QZSS CLAS

6

INS Dead reckoning

system id

The system identifier. This output will be zero unless the GPS supports NMEA 4.10 or above. A value of 4 indicates BeiDou.

mode

A uint8 character indicating the mode. The table below enumerates the different modes that may be output.

Value

Character

Description

65

A

Autonomous mode

68

D

Differential mode

69

E

Estimated (dead reckoning) mode

77

M

Manual input mode

78

N

Data not valid

83

S

Simulator mode

auto

A Boolean output indicating if mode1 was manual (false) or automatic (true).

fix type

A uint8 output indicate the fix type (mode2). Valid values are enumerated in the table below.

Value

Description

1

Not available

2

2D position fix

3

3D position fix

new

A Boolean output indicating whether any of the outputs are new. Since GPS NMEA data arrives in sentences, not all the outputs will be updated simultaneously, but the new output at least provides an indication that some of the data is new since the last time the block was executed.

Parameters and Dialog Box

GPS NMEA

URI

The Universal Resource Identifier (URI) that specifies the communication protocol and parameters used for the GPS receiver. For example, a GPS receiver connected to serial port 1 with a baud rate of 9600 would be specified with the URI 'serial://gps:1?baud=9600'.

Priority

The priority of the thread. In general, a value of 0 indicates the lowest priority and higher values indicate a higher priority. The number of priority levels available depends on the type of QUARC target for which code is being generated.

Sample Time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time from the input. The block inherits the sample time by default.

To set the sample time to the fundamental sampling time of the model, use the qc_get_step_size function, which is a QUARC function that returns the fundamental sampling time of the model. The fundamental sampling time of the model is the sampling time entered in the Fixed step size field of the Solver pane of the Configuration parameters.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar