Simulation PSY can read files that contain NMEA sentences with NMEA 0183, version 2.1.
The NMEA file is in 7-bit ASCII format (see NMEA 0183 version 2.1). All lines end with the character ’\n’. The NMEA sentences are case sensitive.
Simulation PSY parses position information from the NMEA sentences GGA, RMC, GSA and GSV. Data from other sentences are not parsed. The NMEA sentences GLL, GGA, GSA, and RMC are required to make a location estimate.
Simulation PSY has to understand which sentences constitute the location estimate. When a required NMEA sentence is read for the second time, the parsing of NMEA data stops, and Simulation PSY checks if all required sentences have been read. The location estimation continues if all the required sentences have not been read.
When the end of a file is reached, Simulation PSY starts re-reading again from the beginning of the file. The parser is reset, meaning that all the required sentences need to be read again starting from the beginning of the file before a location estimate is returned.
Satellite time is read from the RMC sentence and stored in the incoming
position class if it is an instance of TPositionSatelliteInfo
or HPositionGenericInfo
.
In the latter case, satellite time is stored only if it is a requested field
in the HPositionGenericInfo
instance. System time is
set in the base class TPositionInfo
at each position
reading.
The following table shows which position data, parsed from an NMEA data
file, each position class supports. Basic info in the table below indicates
that TPositionInfo
supports position data. All read NMEA
sentences are included in HPositionGenericInfo
if EPositionFieldNMEASentences
is
requested.
NMEA Source |
Position data |
LFW class type (Course/ satellite class tree) |
LFW class type (Generic info class tree) |
Comment |
---|---|---|---|---|
GGA |
Latitude |
Basic info |
||
Longitude |
Basic info |
|||
Altitude (WGS 84) |
Basic info |
Calculated as mean sea level altitude plus Geoidal separation. |
||
Geoidal separation |
-- |
Generic info |
||
Altitude (sea level) |
-- |
Generic info |
Taken directly from GGA |
|
RMC |
Satellite time |
Satellite info |
Generic info |
|
True course |
Course info |
Generic info |
||
Speed |
Course info |
Generic info |
||
Magnetic course |
-- |
Generic info |
Calculated as true course + magnetic variation. |
|
GSA |
Number of used satellites |
Satellite info |
Generic info |
Number of satellites that are used in position fix. |
PRN (for each satellite) |
Satellite info |
-- |
||
HDOP |
Satellite info |
Generic info |
||
VDOP |
Satellite info |
Generic info |
||
PDOP |
-- |
Generic info |
If PDOP is not present in the sentence, it is calculated as sqrt(HDOP^2 + VDOP^2). |
|
Horizontal accuracy |
Basic info |
Calculated as HDOP * UERE where UERE is 10m. |
||
Vertical accuracy |
Basic info |
If fix is in 3D mode, it is calculated as 1.5 * HDOP * UERE where UERE is 10m. |
||
GSV |
Number of satellites in view |
Satellite info |
Generic info |
Calculated total number of satellites from GSV sentences. In the satellite info object, this value indicates how many satellites this information is based on, Number of satellites in view cannot be set explicitly. |
Elevation |
Satellite info |
-- |
||
Azimuth |
Satellite info |
-- |
||
Signal strength |
Satellite info |
-- |
||
All |
Raw NMEA data |
-- |
Generic info |
An example of correct NMEA file content:
$GPGSV,3,2,12,24,32,051,,22,21,292,,01,20,315,,14,20,321,*71 $GPGSV,3,3,12,05,19,134,,13,18,348,,17,14,180,,10,10,110,*7F $GPGLL,6459.8757,N,01433.8547,E,091931.375,A*3E $GPGGA,091931.38,6459.8757,N,01433.8547,E,1,04,2.0,-0034,M,,,,*3D $GPRMB,A,0.21,L,SIM003,SIM001,6500.0900,N,01433.8589,E,000.2,00..,000.0,V*18 $GPRMC,091931.38,A,6459.8757,N,01433.8547,E,21.7,177.3,200302,02.,E*6F $GPAPB,A,A,0.2,L,N,,,87.6,M,SIM001,358.1,M,,,*16 $GPGSA,A,3,01,02,03,04,,,,,,,,,1.0,2.0,3.0*34
Position information is obtained after parsing the GLL, GGA, RMC and GSA sentences. Latitude is parsed from “6459.8757,N”, longitude from “01433.8547,E”, altitude from “-0034”, and the value “2.0” is used for calculating horizontal and vertical accuracy. All retrieved from GGA sentence.
$GPGLL,6459.8757,N,01433.8547,E,091931.375,A*3E $GPGSV,3,1,12,06,53,095,,30,52,150,,15,51,090,,25,37,230,*7F $GPGSV,3,2,12,24,32,051,,22,21,292,,01,20,315,,14,20,321,*71 $GPGGA,091931.38,6459.8757,N,01433.8547,E,1,04,2.0,-0034,M,,,,*3D $GPRMB,A,0.21,L,SIM003,SIM001,6500.0900,N,01433.8589,E,000.2,00..,000.0,V*18 $GPRMC,091931.38,A,6459.8757,N,01433.8547,E,21.7,177.3,200302,02.,E*6F $GPAPB,A,A,0.2,L,N,,,87.6,M,SIM001,358.1,M,,,*16 $GPGSA,A,3,01,02,03,04,,,,,,,,,1.0,2.0,3.0*34
The first line in the following textbox starts with a GLL sentence which has already been parsed. The other three sentences required for calculating position information, i.e. GGA, RMC and GSA, have also been parsed. Hence a second position fix is obtained from the parsed sentences.
$GPGLL,6459.8757,N,01433.8547,E,091931.375,A*3E $GPGSV,3,1,12,06,53,095,,30,52,150,,15,51,090,,25,37,230,*7F $GPGSV,3,2,12,24,32,051,,22,21,292,,01,20,315,,14,20,321,*71
Rest of NMEA file.
An example of incorrect NMEA file content..
$GPGSV,3,2,12,24,32,051,,22,21,292,,01,20,315,,14,20,321,*71 $GPGSV,3,3,12,05,19,134,,13,18,348,,17,14,180,,10,10,110,*7F $GPGLL,6459.8757,N,01433.8547,E,091931.375,A*3E $GPGGA,091931.38,6459.8757,N,01433.8547,E,1,04,2.0,-0034,M,,,,*3D $GPRMB,A,0.21,L,SIM003,SIM001,6500.0900,N,01433.8589,E,000.2,00..,000.0,V*18 $GPRMC,091931.38,A,6459.8757,N,01433.8547,E,21.7,177.3,200302,02.,E*6F $GPGGA,091931.38,6434.8744,N,01343.8637,E,1,04,2.0,-0032,M,,,,*3D
GGA sentence exists for the second time before a GSA sentence is read. Location estimation for read NMEA sentences is not used. Simulation PSY will continue reading NMEA sentences trying to read a correct fix.
The Simulation PSY supports the NMEA sentences from the following GPS devices:
Garmin:
eTrex – basic
eTrex – Legend
III plus
12 cx
Magellan:
GPS 315
Meridian Gold
Tracker
Simulation PSY can generate location data from simulated information.
The Simulated Movement file has the following format:
Horizontal accuracy={float}; Vertical accuracy={float}; TimeToFix min={integer}; TimeToFix max={integer}; Powerup time={integer}; Longitude={float}; Latitude={float}; Speed={float}; Course={float}; [Deterministic|Random]={integer};
The Simulated Movement file is in 7-bit ASCII format. All lines end with the character ‘\n‘. The Simulated Movement file words are case insensitive. The Simulated Movement file is read when a sub-session to Simulation PSY is opened.
The Simulation Movement file words before the ’=’ mark must have spaces as shown above. However, it is legal to have spaces before and after the ’=’ mark and before the semicolon (;).
All Simulated Movement sentences end with a semicolon (;).
No comments are allowed in the Simulated Movement file.
The order of different lines does not matter, but it is required that all simulated movement sentences exist in the file.
The float value decimal separator is a period (.).
Parameter |
Parameter type |
Value type |
Value range |
Examples, delimited by ; |
---|---|---|---|---|
|
Meter (m) |
Float |
0 - |
23.56; 56 |
|
Meter (m) |
Float |
0 - |
30.89899; 12 |
|
Seconds (s) |
Integer |
0 - |
0; 2 |
|
Seconds (s) |
Integer |
0 - |
4; 5 |
|
Seconds (s) |
Integer |
0 - |
3; 6 |
|
Longitude |
Float |
-180 - 180 |
-179.686; -180; 180; 0; |
|
Latitude |
Float |
-90 - 90 |
51.568; -90; 90; 0 |
|
Meter per Second (m/s) |
Integer |
0 - |
0; 5 |
|
Degrees |
Integer |
0 - 360 |
78; 0; 360 |
|
Simulation setting |
Integer |
0 - |
0; 3; 5 |
If Speed
is not 0, new locations are calculated
for each location estimate.
The Course
value is the direction of the simulated
movement (0 and 360 = North, 90 = East, 180 = South and 270 = West).
The last row specifies how to simulate errors. If Deterministic
is
used, positioning fails at the specified frequency. Deterministic=3
means
that every third request fails. Random means that positioning fails sporadically,
but at the specified mean frequency. Random=3
means that
after a large amount of requests, one third of the requests have failed. Error
code KPositionQualityLoss
will be returned.
It is also possible not to simulate errors. This is specified by setting Deterministic=0
.
Horizontal and vertical accuracy, are same for all location estimates. For each new location estimate, horizontal accuracy is multiplied with a random generated value. The multiplied value is added as “error” for longitude and latitude to the location.
Altitude always starts at 0 meters over the WGS-84 ellipsoid model. For each new location estimate, vertical accuracy is multiplied with a random generated value. The multiplied value is added to the current altitude.
If the syntax of the file is incorrect or all settings are not present,
the system wide error code KErrCorrupt
is returned. This
error code is returned when opening the positioner, RPositioner::Open()
.
For example, if you want to simulate the locations of a car that drives 20 m/s (72 km/h) straight to the North and every seventh location request fails:
Horizontal accuracy=20; Vertical accuracy=30; TimeToFix min=2; TimeToFix max=7; Powerup time=3; Longitude=11.34; Latitude=57.11; Speed=20; Course=0; Deterministic=7;
Using this example would give locations between 2 and 7 seconds at each location update that is requested, except for the first request when a powerup time of three seconds is added.