Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring multiple thermocouple channels simultaneously via 9213 (with 9171 USB)

Solved!
Go to solution

I am just getting back into Labview after a 10 year absence.  My first goal is to measure Type J and T thermocouples with a 9213.  The 9213 has 16 channels, but the example VIs I have found so far only allow one channel to be selected at a time.  Ideally it would be great to have the ability to select which of the 16 channels to read at any given time (i.e. any combination from 1-16 and skipping channels if necessary).

 

Second, will selecting multiple channels for simultaneous reading affect the sample rate?  For example, if 10 samples can be read per second, and I select 16 channels, does it take 1.6 seconds to read all of them?  And what happens if I had set the sampling rate to 1 second in the previous example?  Does it keep track of 'intended' cycles and keep running uncompleted loops after I instruct it to stop?

 

Third, I have not figured out whether it is possible to assign a different thermocouple type to each channel.  Can I combine Type J and T thermocouples on the same card?  Is so, then how to define each channel individually?

 

Fourth, I have encountered error readings when selecting an open channel on the VI for the 9213.  Is this normal?  Ideally I would like to be able to swap thermocouples during continous measurement and am concerned that the program will crash. 

 

Two example VIs I found are: "Thermocouple - Continous Input.vi" from the NI Example Finder.  The other was via the sample project "Continuous Measurement and Logging (NI-DAQmx)".

0 Kudos
Message 1 of 24
(10,606 Views)

I was thinking about this over the weekend and one possible solution is to run multiple VIs, with each VI defining its own channel.  However, I'm not sure if the cDAQ and NI-DAQmx can handle multiple programs running simultaneously and how taxing that would be on the processor and memory.  I will pursue that path unless I get feedback here indicating another approach.

0 Kudos
Message 2 of 24
(10,575 Views)
The examples I look at do enable the selection of multiple channels. When you click on the channel control, simply click on Browse.

For configuring each channel differently, the configure channel function can be placed inside a for loop where you create an array for each configuration value (i.e. Range, type, etc.). Be sure to use a shift register for the task as you must use a single task. You simply cannot use multiple VIs with multiple tasks.
Message 3 of 24
(10,570 Views)

This morning I am focusing on using the Labview built-in example program for measuring thermocouples with 9213.  If I simply create an executable of this program and take it to my monitoring computer I get an error message regarding the naming of the channel.  It doesn't like the Dev1 and suggests using cDAQMod1/ai0 or cDAQMod2/ai0.  I do not understand the difference between Mod1 or or Mod2.  If I select past the error message then I can select a channel on the dropdown list and if I select a channel where a thermocouple is attached I can get a reading.  However, the graph continually overwrites itself, so I will need to make some changes to enable continuous plotting with historical measurements remaining.

 

I have not figured out how to select multiple channels simultaneously, but in the context help with the stock program it mentions using commas or colons to select multiple channels (it isn't clear how I could achieve that with a simple dropdown dialogue box as provided with the stock program).  So I may need to replace the interface for specifying channels.

0 Kudos
Message 4 of 24
(10,565 Views)
As I said, the drop-down for channel selection do allow for multiple channels. Please use the browse option and use shift-click or ctrl-click. To do it manually, the syntax is Devx/ai0:4 for example of continuous channels or Devx/ai0, Devx/ai3 for non-continuous channels.

A graph always gets overwritten. That is by design. Look into using a chart.
0 Kudos
Message 5 of 24
(10,562 Views)

Understood, it behaved as you described.  I'm reading through the DAQmx help section to better understand the inputs before I start coding a variation to the inputs and will replace the graph with a chart.

0 Kudos
Message 6 of 24
(10,559 Views)

I have been working on this the past few hours and making minor progress.  I was successful in creating a chart, but unable to display as intended.  I am almost in a Catch-22 situation.

 

For trial purposes I have only enabled 2 channels on the 9213.

 

If I select DAQmx read as Analog 1D Wfm Nchan 1Samp I can display the measurements from the two channels separately and track them individually.  However, data that is exported shows both measurements in a single column.

 

The only way I have figured out how to correctly export the data from DAQmx read is to select Analog 2D DBL NChan NSamp.  However, in this case and in many other configurations, the chart displays both measurements as a single plot.  In other words, the two channels are treated as two samples of a single measurement by the chart (if one thermocouple is reading 30C and the other 23C, I get a sawtooth plot connecting 23C with 30C alternating rather than a smooth graph at 23C and another at 30C).

 

At this point, I am thinking that I need to go with the DAQmx configuration that works for the chart and figure out some kind of work around for the data presentation.

0 Kudos
Message 7 of 24
(10,548 Views)

Each time I have attempted to add features I quickly exceed my present programming skills and knowledge.

 

Here is my VI, modified slightly from the basic Labview example as well as two data files created.

 

The card can accept 16 thermocouples, but right now I only have 2 working thermocouples connected, at channels 1 and 3.

 

What I would like to improve or change:

  • Prompting with suggested filename starting with today's date in yyyy/m/d format (I was unsuccessful in figuring out how to combine date VI with filename path as input to this Express Write VI)
  • Headers in written data file (I looked at alternatives, such as Write TDMS, but quickly became too complicated with all the other variables to program).
  • Time stamp in written data file doesn't make any sense.  Starts at the beginning and doesn't increment properly (Test Data 3 was sampled 10 per second while Test Data 4 sampled 1 per second).
  • Chart that did not attempt to connect data from each channel.  Currently does not distinguish channels and instead draws lines through each channel at each sample.
  • User selectable thermocouple channels.  I included all 16 here because without headers I don't know which data is being saved if I exclude some of them.

 

0 Kudos
Message 8 of 24
(10,531 Views)

A coworker mentioned a software utility from NI called SignalExpress, which I used to create the basic framework of what I wanted, then I instructed it to create a VI block diagram.  The result didn't include any graphs, although they existed as configued in SignalExpress.  That was quickly remedied by adding them in the block diagram.  I also noticed that it used the DAQ Assistant VI when it constructed the block diagram, this VI allowed me to accomplish everything I wanted with the NI-9213 module.  I then discovered that if I right clicked this and selected Open Front Panel, that it constructed a VI block diagram and replaced the DAQ Assistant.  I then saved this as a sub-VI to my main program and was able to configure as I initially intended.  This program also adds headers to my data file as well as including the proper time stamp.

 

There are still a couple hurdles I have not overcome.  One is that while I would like to select the thermocouple type for each channel, it would be preferable to select the temperature units and other attributes just once.  Moreover, as currently written, if I adjust the scan resolution, the VI crashes unless I adjust all 16 inputs to match.

 

One change I made to the block diagram was creating two loops.  I am using this program as a self-executable on a computer that uses an unpredictable name for the device.  As currently written, the program allows me to find the correct device, see that I am getting data, then switch over to my main data collection and file saving loop.  There are still some features that I do not understand, such as where the channel name and active channel names come from, especially if I change the device name (not sure how they are linked).  Unfortunately this part also does not work exactly as intended, because whatever device name I choose initially gets stuck as the selected data input (I can select other device names, but I still get the original selection as output).  I had wanted to be able to select through each device name to verify which name corresponded to the outputs I wanted before proceeding to the data selection, but right now I must cancel the program entirely and restart through the menu bar to properly check each device.

 

 

 

Download All
0 Kudos
Message 9 of 24
(10,498 Views)

I just discovered that I also have a time lag problem.  At the moment I am reliant on running another Labview program simultaneously with this one.  Both are sampling once per second, and after running for about 10 minutes this program was capturing data about 15 seconds after the fact.  It didn't miss anything, but it seems like maybe a buffer was being created that kept increasing.

 

If this problem can't be solved then a work around would be to use two computers, each one controlling a different cDAQ.

0 Kudos
Message 10 of 24
(10,491 Views)
</