Not too long ago, I tried reading data from Thermo Scientific's line of environmental gas analyzers into LabVIEW via TCP/IP; I ran into several issues. After fiddling for a while, I found a solution.

Overview

Thermo Scientific produces some very slick ambient gas monitors that are widely used in the atmospheric chemistry field. Data from the instrument is generally viewed on their software which allows thh user to fairly easily download data for a specific time period. However, I wanted to access data in real-time and plot against other variables in LabVIEW. Since Thermo does not provide a driver for LabVIEW, I came up with my own solution.

How To:

I have written a few vi's that make it real easy to implement. Thermo Gas Conc Read Single Instr.vi reads the data from one instrument. Thermo Gas Conc Read.vi is set up to read three instruments and provides a control that allows the user to switch between the three instruments and plot onto one graph. Lastly, Thermo Analyzers Example 1.vi is an example that uses the base sub vi.

Thermo Gas Conc Read Single Instrument

The diagram below shows there are five inputs and two outputs for the sub vi that reads one Thermo instrument. The remote port for all thermo scientific gas analyzers is 502; this can be confirmed by checking the big manual they come with.

The IP address is variable, and must be known in order to connect via TCP/IP. If you are currently using Thermo's software to grab data from the instrument, you already know the IP! If not, you can scroll through the display on the front of the instrument and find it.

The quantity is the number of holding registers you are trying to read from the instrument. Generally speaking, you need 2*n holding registers, where n is the number of values you are trying to read. Although you can read data other than the gas concentrations from the instrument (voltages, etc), the examples/code I provide only read the concentrations. Thus, if you are using the Thermo Ozone Analyzer (Model 49i), you will need two holding registers to get the ozone concentration.

The MBAP header consists of only two elements for our purposes (Unit ID, Transaction ID). If you want a more in depth description of the MBAP header, feel free to read reference two which explains Modbus for LabVIEW. This was hands down the most difficult part of the Modbus library for me to figure out in terms of communicating effectively with the Thermo machines. Essentially, the Transaction ID is always zero and the Unit ID will be 49. The Thermo Scientific folks seemed to not know this; I think I will chalk figuring this out to magic! The Error In input is your basic LabVIEW error cluster. Likewise, the Error Out is simply an error cluster. If an error is generated within the sub vi, Error 5010 is generated.

Data Out is a one-dimensional array of a cluster of three elements. Each cluster includes the Label, Concentration, and Units. The Label is set in the back-panel of the subVi although it can be easily turned into a control if you so desire. The concentration is given in the units of ppb. If the concentration you are trying to read is not in ppb, you may need to fix some math in the back panel. However, you should just be able to set it to whatever your instrument normally reads out and not change any of the code.

Below is an example of what the front panel would look like if you were trying to read three values from the NOx analyzer (Model 42i). As mentioned above, we need six holding registers because we are reading three values.

Thermo Gas Conc. Read

The following subVi is the one I have created for the three instruments I use: NOx Analyzer (42i), O3 Analyzer (49i), and the SO2 Analyzer (43i). It uses a control flow that allows me to choose between the three instruments so I can easily plug it in any other vi without having to change the settings continuously. As seen in the figure below, there are only two inputs and two outputs, as all of the settings are pre-configured in the VI. Simply select the instrument you would like to read and BOOM! Data!

Like the single instrument subVI, the data comes in the form of a one-dimensional array of clusters of three elements. This makes it easy to separate and either plot or log your data. Below is an example of what the front panel of this subVI looks like when set up for the three Thermo Instruments mentioned above. Notice the instrument control that allows you to choose between which instrument you are trying to read from.

Thermo Analyzers - Example 1

To demonstrate how you can properly use these subVI's, I included the following example which uses the Thermo Gas Conc Read (SubVI) to read from each of the three analyzers I have access to. The subVI is used within a while loop to allow for continuous monitoring at some pre-set frequency. Below is an example of what your plot will look like for the model 42i-TL NO/NO2/NOx Analyzer.

Note: Although nothing terrible will happen, it is probably not wise to set the frequency of your loop to be greater than the frequency at which your Thermo Analyzers are collecting data. I believe they all default to 0.1 Hz, so a frequency of 10 seconds would be sufficient. Otherwise, you will continue to grab the same data point and your graphs will look funky.

References

  1. MODBUS Library for LabVIEW
  2. Introduction to Modbus