LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to test multiple UUT without causing DAQmx tasks resource error

Hi there. I am trying to test 4 UUT's on 1 computer.

I am using the following devices:

cDAQ-9174 CompactDAQ chassis (4 slot USB)

NI9205 32-Channel Analog Input Module

 

 

Each of my UUT are outputting analog voltages to a different channel on my NI9205.

I have 4 VI's (one of for each of my UUT's) which reads from those channels at the same time and write

their corresponding voltages to a text file.

Since I am calling "DAQmx read" 4 seperate times on different channels but on the same device, I get a task resource reserved errors.

The only way I know of fixing this is having 4 global variables that read all the channels at the same time and then having all the SubVI (i.e. the UUT's) use the global variable to write to file. This seems very inefficient.There has to be a better way?

Any advice or tips on how to do this would be greatly appreciated! 

Thanks!

 

Don't think twice.
0 Kudos
Message 1 of 8
(3,183 Views)

I'm not familiar with the NI9205 exactly, but using a few of the other DAQ device you should be able to use a single DAQmx read and read all 4 of the channels from that single read.  I don't have the development environment in front of me to test it, but I think you can set it up from the polymorphic selector and output to an array based on channel #.

 

Check the example finder and I'm sure they will have an example to show you multiple channel reads.

0 Kudos
Message 2 of 8
(3,181 Views)

Hi

 

since the 9205 does not have simultaneous sampling, you cannot have 4 tasks to read from 4 channels.

 

instead, create a single task, select the 4 channels as physical channels and use one DAQmx read function  (N channels N samples). You will get a 1D array of waveform data. write this data to the file orp lot on graph

 

the NI examples has a 'Acq&Graph Voltage-Int Clk.vi' and 'Cont Acq&Graph Voltage-Int Clk.vi' for a start.

 

if you need more help, please post your code so that we can give you specific inputs

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 3 of 8
(3,172 Views)

Yes, I didn't specify in my last response this was NOT for simultaneous sampling.

 

Example finder --> Hardware Input and Output\DAQmx\Analog Measurements\Voltage(or whatever physical measurement you want here)...  All kinds of triggering and clocks to choose from.  I opened the Acq&Graph voltage - Int clk-Sw trig Restarts to verify my statement.  You can change the polymorphic selector from a waveform to DBL in desired.

0 Kudos
Message 4 of 8
(3,159 Views)

Oh wait!

 

I just read your first post again, and are you using 4 VIs? I mean, you are calling the Acq&Graph vi 4 times in parallel?

 

---------------------------

Each of my UUT are outputting analog voltages to a different channel on my NI9205.

I have 4 VI's (one of for each of my UUT's) which reads from those channels at the same time and write

their corresponding voltages to a text file.

Since I am calling "DAQmx read" 4 seperate times on different channels but on the same device, I get a task resource reserved errors.

The only way I know of fixing this is having 4 global variables that read all the channels at the same time and then having all the SubVI (i.e. the UUT's) use the global variable to write to file. This seems very inefficient.There has to be a better way?

Any advice or tips on how to do this would be greatly appreciated! 

Thanks!

-----------------

 

when you have 4 vis trying to access the same device, in parallel, you will get the error. if you want to read all the 4 channels and log to a file, using one SINGLE vi, wire all the 4 channel names to the Physical channels input. you can do that by selecting 'Browse' option of the physical channel input control.

 

you will get all the 4 channel data on the graph. you can log them to the file.

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 5 of 8
(3,136 Views)

Thank you for all your feedback.

 

Yes, I have 4 VIs running in parallel.

 

Readings from all channels at once would work but my sample rate for each channel is different. Also, implementing this at the top level would not be convenient for me because it would require changing too much of my code.

I decided to add a semaphore which would only allow access to the device by 1 UUT at a time. Since the code is executing quite fast, it doesn't seem to affect my sample rate. I haven't done enough testing yet to make it my permanent solution but it looks promising. Any negative feedback to this approach would be appreciated!

Thanks.

Don't think twice.
0 Kudos
Message 6 of 8
(3,113 Views)

Hi

 

you cannot sample each channel at a different sampling rate, when the DAQ card has only one ADC. you will have to acquire each channel one after another, in a sequence, as you are doing by putting a semaphore into action..

 

however, it would be a better design, to acquire all the 4 channels together at the highest sample rate required, in a single task, then decimate the data to the required sample rate and perform your analysis. you will have to open one task, perform cont acquisition and close the task when exiting the applicaiton.

 

with the design you are using, you will have to open a new task for every channel and close it before acquiring the second channel. if you are going to perform a continuous acquisition, this is not the best way to do. you will end up opening and closing 4 tasks in each iteration. even if one task does not close properly, you will end up with errors in the sequence and cannot perform acquisition.

 

also, if you want to increase the number of channels acquired in the future, it could be a challenge for you to manage the sequence without issues. In terms of scalability, you will have to use a single task that can acquire from multiple channels.

 

it is good to spend time and improve your design now than end up with unwanted issues at a later stage.

Regards
Freelance_LV
TestAutomation Consultant
Message 7 of 8
(3,100 Views)

That makes sense. Thanks for the advice!

I will give it a try because it would be useful to have that scalability.

Don't think twice.
0 Kudos
Message 8 of 8
(3,087 Views)