# Calculating VRMS and HRMS from NMEA data?

I am trying to write code to parse the NMEA strings coming from survey-grade RTK/GNSS receivers. The requirements I have are to calculate the 3DRMS (distance RMS at 97.5% probability), VRMS (vertical RMS) and HRMS (horizontal RMS) values (amongst others).

Going by this article, I've been able to find a formula to derive the 3DRMS value from the GST NMEA message:

In pseudocode: `3DRMS = 3 * Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2))`

where `dx` is Latitude error and `dy` is Longitude error.

So, for example, if the GST message string is:

``````\$GPGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*6A
``````

Then:

``````3DRMS = 3 * Math.sqrt(Math.pow(0.023,2) + Math.pow(0.020,2)) = 0.091
``````

However, I'm struggling to find a definition or formula to calculate the VRMS and HRMS values, and therefore which NMEA strings I need to parse to calulate them.

I've found that the companion apps for several of the receivers display these, for example Eos Tools Pro displays them when used with the Arrow 200 receiver.

I've also found a PhD thesis which contains some equations, but I'm having trouble understanding how to abstract them into a generic formula. However, it looks like PDOP is involve, so I would assume I need to parse the GSA message in addition to the GST.

Where can I find the relevant formulas or how to calculate these values?

• OP, please confirm that I've expanded out VRMS, HRMS and 3DRMS correctly. Thanks. – mkennedy Nov 11 '16 at 18:54
• @mkennedy, yes the definitions look correct. – DaveAlden Nov 12 '16 at 16:03

I've arrived at the following solutions based on the formuale in this page: My original calculation of the 3DRMS was wrong because the RMS should take the arithmetic mean of the squares.

My conclusion is that :

• VRMS is actually another term for the 1-sigma altitude error which is already present in the GST message field 8
• HRMS is 2-sigma horizontal RMS, derived from the latitude and longitude sigmas in fields 6 & 7 of the GST message.

In pseudo-code:

``````LatErr = GST
LonErr = GST
AltErr = GST

VRMS = AltErr
HRMS = 2* Math.sqrt(((Math.pow(LatErr, 2) + Math.pow(LonErr, 2))/2));
3DRMS = 3* Math.sqrt(((Math.pow(LatErr, 2) + Math.pow(LonErr, 2))/2));
``````

I think pseudo code should be like below

``````    HRMS = 2* Math.sqrt(0.5*((Math.pow(LatErr, 2) + Math.pow(LonErr, 2))/2));

3DRMS = 3* Math.sqrt(0.5*((Math.pow(LatErr, 2) + Math.pow(LonErr, 2))/2));
``````