The following MATLAB/Octave code allows for users to capture IRIG-B or NMEA/1PPS data (only tested with the GARMIN 19X GPS unit available in our SLICE GPS Accessory Kit) on SLICE Nano/Micro/IP68 channels in SLICEWare and perform post-processing such that they can plot sensor channel data (1 channel at a time) aligned with decoded IRIG-B and/or NMEA/1PPS data on a graph for visualization. NMEA data will only be processed for the $GPRMC and $GPGGA sentence types (same as our SLICE GPS Accessory Kit supports).
This acts as a workaround for the purposes of visualizing events with respect to time and location, as SLICEWare currently cannot process time and/or location from IRIG-B or NMEA/1PPS sources. The user MUST supply at least IRIG-B or NMEA & 1PPS data for this to work. In the event that the user doesn't wish to use actual sensor channel data, this code generates a basic 'sine wave' signal as channel data for visualization. Processed time and/or location data is output to a .CSV file for user review and resulting plots are saved as PNG files.
- This code was written in accordance with the preliminary application note for time synchronization that is attached. The document is not currently up-to-date, but it provides some insight into why this code was created and the intended functionality.
What Is Needed:
- The user MUST have either a copy of MATLAB or a copy of Octave. Octave is a free software that provides most of the functionality of MATLAB without the cost of a license.
- This code was written using Octave version 4.2.1
- Signal Processing Package for Octave/MATLAB.
- Used to process IRIG-B time
- SLICEWare (any version)
- *.CHN Files
- (optional) Sensor Channel Data
- (optional*) IRIG-B Channel Data
- (optional*) NMEA Channel Data & 1PPS Channel Data
- BOTH NMEA and 1PPS channel files must be provided to plot GPS data
*NOTE: In order for code to work, the user must provide at least some time/location channel data. The data can be IRIG-B, NMEA/1PPS, or both but at least one type MUST be provided.
How It Works:
Function Call: plotTimeAndData(dataFile, irigFile, nmeaFile, ppsFile)
- dataFile: full path filename for the SLICEWare sensor channel where data was captured
- OPTION 1: full path filename --> data provided, will plot sensor data captured by SLICE
- OPTION 2: '' --> create an arbitrary sine wave as data
- irigFile (optional*): full path filename for the SLICEWare sensor channel where IRIG-B data was captured
- OPTION 1: full path filename --> data provided, will process and plot IRIG-B data
- OPTION 2: '' --> no IRIG-B data captured, will not process/plot
- nmeaFile (optional*): full path filename for the SLICEWare sensor channel where NMEA data was captured
- OPTION 1: full path filename --> data was provided, will process and plot NMEA/1PPS data
- MUST be accompanied by a 1PPS channel file
- OPTION 2: '' --> no NMEA/1PPS data captured, will not process/plot
- OPTION 1: full path filename --> data was provided, will process and plot NMEA/1PPS data
- ppsFile (optional*): full path filename for the SLICEWare sensor channel where 1PPS data was captured
- OPTION 1: full path filename --> data was provided, will process and plot NMEA/1PPS data
- MUST be accompanied by an NMEA channel file
- OPTION 2: '' --> no NMEA/1PPS data captured, will not process/plot
- OPTION 1: full path filename --> data was provided, will process and plot NMEA/1PPS data
Example Outputs:
NOTE: Sensor data is unavailable at this time, so an arbitrary sine wave will be used for data representation.
- plotTimeAndData('', irigFn, nmeaFn, ppsFn)
- plotTimeAndData('', irigFn, '', '')
- plotTimeAndData('', '', nmeaFn, ppsFn)
More Options/Expansions:
Code is fully commented and can be modified by the user to allow for multiple sensor channel plotting as desired. It can also be paused during Debug mode and additional channel data loaded and plotted accordingly:
- Insert Breakpoints @ plotTimeAndData.m file, line 145 and line 161
- Run to Breakpoint @ line 145
- Run the following code to get other channel data:
[dataAdcX, dataFsX] = parseChnData(dataFileName);- X = arbitrary label number for new dataset --> suggested to start with '2' and index up
- dataFileName = full path filename for new sensor channel *.chn file
- run this code with indexed dataAdcX and dataFsX as desired for each sensor channel to be loaded
- Run the following code to plot other channel data:
plot(dataAdcX, "linestyle", ?, "linewidth", 1, "color", ??);
if (min(dataAdcX) < min(dataAdc))
min_y = min(dataAdcX)*1.1;- dataAdcX = indexed channel data for the given sensor name
- ? --> line style for the desired sensor channel line. See Octave GNU for line style options.
- ?? --> color for the desired sensor channel line. See Octave GNU for color options.
- run this code with indexed dataAdcX for each sensor channel to be plotted
- Run to Breakpoint @ line 161
- Run the following code to update the legend:
- IF BOTH IRIG-B and NMEA/1PPS data was provided:
legend('X1', 'IRIG-B', 'NMEA/1PPS', 'X2', ..., "location", 'eastoutside');- X1, X2, ... = channel number / name for data channel being plotted
- IF ONLY IRIG-B data was provided:
legend('X1', 'IRIG-B', 'X2', ..., "location", 'eastoutside');- X1, X2, ... = channel number / name for data channel being plotted
- IF ONLY NMEA/1PPS data was provided:
legend('X1', 'NMEA/1PPS', 'X2', ..., "location", 'eastoutside');- X1, X2, ... = channel number / name for data channel being plotted
- IF BOTH IRIG-B and NMEA/1PPS data was provided:
- Run to the end of code
Comments
2 comments
Hi Ariel
Last time I was in Seal Beach you also did a demo showing reading NMEA data into DIAdem but I'm not remembering what that was specifically about ? Can you remind me please.
Thank you
Kate
Kate,
I don't have a demo reading NMEA directly into DIADem, as I do not have a copy. However, the utility for the GPS Accessory Kit produces several files capable of being read into a number of applications that can plot that data -- DIADem included.
The presentation I gave at the meeting can be found here. All of the Customer Release Files are here and the User's Manual contains information about file formats and loading produced files into visualization applications. You can take a look at the test examples included in the Customer Release files to get an idea of how each is formatted.
As for this utility, the generated files are not the same as for the GPS Accessory Kit -- they are close, but not exact, as there is additional data being provided (IRIG-B). I can edit this utility to make them very similar, but it will take time. This matlab utility is designed to be a temporary 'work-around' that allows a user to get the information in at least some way that makes sense to them.
Thank you,
Ariel
Article is closed for comments.