|
NMEA to OPC. How to get GPS data through the OPC interface?
Problem scenario:
Does your NMEA software support an OPC Interface (www.opcfoundation.org)?
Sample NMEA data from GPS and Sounder:
$SDDBT,28.8,f,8.8,M,4.8,F
$GPGLL,5839.022,N,00314.315,W,150935.39,A,A*7C
$GPGGA,150936.17,5839.022,N,00314.315,W,1,09,1.9,0,M,49,M,,*7A
$GPVTG,000,T,004,M,0.0,N,0.0,K,A*27
$GPRMC,150936.17,A,5839.022,N,00314.315,W,0.0,000,300511,4.0,W,A*21
$GPRMB,,,,,,,,,,,,,,N*04
$GPZDA,150936,30,05,2011,00,00*44
$GPAPB,V,A,,,N,,,,,,,,,,N*7F
$YCMTW,,C
$SDDBT,30.8,f,9.4,M,5.1,F
$GPGLL,5839.022,N,00314.315,W,150936.96,A,A*7A
$GPGGA,150936.96,5839.022,N,00314.315,W,1,09,1.9,0,M,49,M,,*73
$GPVTG,000,T,004,M,0.0,N,0.0,K,A*27
$GPRMC,150936.96,A,5839.022,N,00314.315,W,0.0,000,300511,4.0,W,A*28
$GPRMB,,,,,,,,,,,,,,N*04
$GPZDA,150937,30,05,2011,00,00*45
$GPAPB,V,A,,,N,,,,,,,,,,N*7F
$YCMTW,,C
$SDDBT,30.1,f,9.2,M,5.0,F
Requirements:
- Advanced NMEA Data Logger Professional, Enterprise or a trial version;
It is assumed that:
You've created a configuration (using the "Green Plus" button) in the main window and configured communication parameters (baud rate, number of data bits, flow control, etc.) in the NMEA data logger and can receive any data without communication errors.
Solution:
Selecting NMEA sentences of GPS and the sounder
GPS devices output several sentences that begin with GPGLL, GPGGA, GPVTG, or GPRMC. "GP" means that this is data from a GPS device. "SD" - sounder. GLL, GGA, RMC, DBT - NMEA sentence names. We may process and extract only the following NMEA sentences because these sentences contain all necessary data
- GGA (GPS fix data) contains GPS coordinates: latitude, longitude, altitude;
- VTG (Vector track speed over the ground) contains speed in km/h;
- DBT (Depth below transducer) provides sounder data (depth below keel) in meters.
You may easily find a detailed description of all NMEA sentences on Google.
Configuring the NMEA parser
Now, we are ready for configuring modules. First, we should configure the NMEA parser (fig. 1, 2). Now, please, open a configuration window of the NMEA parser plugin (click the "Setup" button near a drop-down box fig. 1, pos.1). The dialog window will appear on the desktop (fig. 2).
Fig.1. NMEA data parser
Fig.2. NMEA data parser. Common settings
You may use the default settings here because our NMEA devices output standard NMEA sentences. On the next page (fig. 3), you should unselect all sentences except three sentences: DBT, GGA, and VTG (fig. 3, pos. 1).
Fig.3. NMEA data parser. NMEA sentences
Please, click the "OK" button and close the configuration window of the parser.
Activating OPC server
We are going to the next stage.
1. Activate the OPC server, using the checkbox before the plugin name (fig. 4);
2. Open the configuration window of the OPC Server plugin (fig. 5) by selecting the module in the list and clicking the "Setup" button on the "Data Export" tab.
Fig.4. Activating the OPC server
Fig.5. OPC server. Connection parameters
Here you can see the OPC server name and GUID. Using these parameters, you can connect from an OPC client to the OPC server. Go to the "Predeclared items" tab and click the "Import all" button (fig. 6, pos. 1). The OPC server will import all OPC tag names from the parser. If you select other NMEA sentences in the parser later, click the "Import all" button again.
Fig.6. OPC server. OPC tag names
Getting variable names for NMEA data: GPS latitude, longitude, altitude, speed, and sounder data
Click the "OK" button twice and close all configuration windows. All plugins will be activated. Now, the NMEA parser and the OPC server are ready, and we can test it. Connect your device and power it on and try to receive data packets with NMEA data. When data appear in the main window, you can open a configuration window of the OPC server and watch all available OPC tags (fig. 7). Each NMEA sentence will be split into several parser items. All parser items will be automatically converted to OPC tags. You may select necessary data in the OPC client by selecting corresponding OPC tags.
Fig.7. OPC server. Active OPC tags
We've configured the NMEA parser, and it prepares several parser items. Their names you may see on the fig.7. You can simultaneously export these parser items to any database (MS SQL, MySQL or Access) or Excel.
|