Introduction

I have a need to test an application using GNSS data using NMEA protocol.
It was connected with the fact that he worked on the project of the aircraft navigation program, it is naturally expensive to test in the air, it’s not particularly convenient to drive a car with a GNSS receiver on the ground, so I wanted to have NMEA data from the allegedly moving equipment on a virtual parallel port. At first I looked for different software, I thought I would find something suitable, but most of them are paid and control of data emulation is not very convenient, although they emulate almost all the parameters of the NMEA standard. But I needed something simple, emulating coordinates, speed, in principle no more than that, and quite convenient and logical control was required. So I had to write an application of this kind in C #.
Fly_nmea

NMEA ("National Marine Electronics Association") - the full name "NMEA 0183" is a text-based communication protocol for marine (usually navigation) equipment between them.
Data is transmitted in the form of sentences. The format of the sentences is as follows:
$ AAAAA [, <data>] * hh , where:
$ - the symbol of the beginning of the sentence (code 24h);
AAAAA - Five-character address (name) of the proposal;
[, <data>] - a list of data fields separated by commas (code 2h);
* - the sign of the checksum (code 2Ah);
hh - checksum.
Example sentences:
GGA - GPS Location Data
Time place and data related to the observation.
$ GPGGA, hhmmss.sss, llll.ll, a, yyyy.yy, a, x, xx, xx, xx, M, xx, M, xx, xxx * hh')
I needed to emulate four lines:
- GLL - Place Coordinates
- GSV - Visible Satellites
- RMC - Recommended Minimum GPS and GLONASS Dataset
- GSA - Accuracy Degradation Factor Used for Satellites Navigation
The emulation is organized in the following order:
- we set the initial coordinates in the WGS-84 system
- then go to a flat projection, for example, Mercator (to convert coordinates used the ready-made library in C # GeoUtility.dll )
- knowing the flat coordinates x, y, h we realize the physics of the movement of the aircraft by changing parameters through a graphical interface, such as: roll, pitch, speed
- convert flat coordinates to B, L, H coordinates of WGS-84 system
- we form a package of NMEA messages of the required four lines
- send them to the virtual parallel port
Fly_nmea + Android Sensor
For more convenient testing, I also adjusted data reception from Android sensors (angles of inclination). Android over UDP sends two lines of type:
- "Angle: \ t236.04152 \ t-1.0 \ t-3.0"
- "Acc: \ t-0.46309182 \ t-0.14982383 \ t-10.56939"
On the emulation application, I accept them and, based on the angles of inclination, I change the parameters:
In the emulation application, you can switch from control through the program interface to the Android Sensor.
Connect Fly_nmea
To emulate COM ports, Virtual Serial Ports Emulator is also useful. You will need to configure the connection of two virtual COM ports, for example: COM1 <-> COM6, and the Fly_nmea program will send data to COM6, and to COM1, the program using the NMEA protocol will take them.
Conclusion
In general, I spent more time searching for such software, and not finding what would have completely satisfied me would have written it myself faster. In addition to the project I was working on, it was also possible to quite successfully connect the emulator to programs that understand the NMEA protocol such as: 2Gis and SAS planet.


FlyNMEA and android sensor (project to transfer data from sensors via UDP)
hereVSPE to emulate ports
hereupd: 5 Hz emulated data frequency