LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running multiple VIs at once using the same modules

Hello,

 

So in my lab we would like to run two VIs at once (used for basic temperature monitoring/control and pressure monitoring for 2 separate experiments). They use the same analog input and relay modules, but obviously different channels. The AI has 2 pressure transducers and 2 thermocouples hooked to it while the relay controls 2 sets of heating tape.

 

When we try to run a second VI we get the "Error 50103 occurred at DAQmx Start Task.vi:1" message. I read about this error on the NI site but due to my lack of LabView experience I didn't quite understand all of the terminology. Is it simply not possible to run two VIs calling the same module? Any advice would be much appreciated.

 

Thanks,

Brian

0 Kudos
Message 1 of 15
(6,813 Views)

You should be creating two separate tasks.  One with a set of channels for use by one VI, and another with the second set of channels for the second VI.  They should be able to be called without interference or errors.

Please attach your code and tell us what DAQ and switch devices you are using.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 15
(6,809 Views)

Attached is the VI I'm using. The other one being used is basically the same, it just has different channels assigned in the DAQ Assistants.

 

I'm using NI cDAQ-9172, NI-DAQmx version 8.9.5, and the NI 9219 and NI 9481 modules. Thanks again for your input.

 

Brian

0 Kudos
Message 3 of 15
(6,797 Views)

I don't use assitants so your options may vary...

 

I create a sepearte loop to acquire from all channels and either push the updates via queues to the appropriate subscribers, or use an action engine to share the readings.

 

On the output side an AE is aslo helpful.

 

You can read about Action Engines here.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 15
(6,774 Views)

I don't use DAQ Assistants either.  Try learning to use DAQ discrete functions, like DAQmx Create Virtual Channel and DAQmx Write.  You can then create two separate tasks using the Create Virtual Channel function.  As long as the channel list is different for both tasks, you should be able to call upon the same DAQ card with two VIs.  Use Help-Find Examples to search for DAQmx.  There are many examples on how to create tasks and how to read and write using discrete functions.  You will have much more control and versatitilty using discrete functions rather than using express vi's such as DAQ Assistant.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 15
(6,768 Views)

Sorry, but that is not correct. When you have a DAQ device with a single clock, you simply cannot have mulltiple tasks on that hardware. Different channel lists make no difference.

 

I'm sure all of the posts you saw on the resource reservered error said the same thing - combine all channels into a single task. Ben's answer is the route you need to take if you really want to run multiple VIs at the same time.

 

p.s. The latest cDAQ chassis has muliple clocks. Don't know if you can assign different clocks to the same module, though.

Message 6 of 15
(6,739 Views)

I think it also depends on the type of acquisition as well. Single point acq I THINK will work but ...

 

Spoiler

 I never get projects like that. Mine are always.. more interesting. Smiley Wink

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 15
(6,716 Views)

@Dennis Knutson wrote:

Sorry, but that is not correct. When you have a DAQ device with a single clock, you simply cannot have mulltiple tasks on that hardware. Different channel lists make no difference.

 


I have used the PXI-6551 (HSDIO) and have set one task to use channels 0-7 for output and another task on the same device to use channels 10-17 for input.  Of course all at the same clock speed.  One VI created two tasks on the same device.  Many other VIs used the tasks to read and write.  It all worked.  I did the same thing with the PXI-6255 multifunction DAQ.  Am I missing something here?  Is the 9000 series different?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 15
(6,692 Views)

When you have a task for input and a task for output, you are using separate sample clocks on the board even when you set them for the same speed. There is no resource conflict then. As Ben mentioned, if you have a 'on demand' task, that does not use the hardware clock so you can have multiple tasks without a resource conflict. The op's VI shows a task with continuous sampling with a sample rate of 1Hz. This is hardware timed and thus the source of the resource reserved error that he is getting. I have not used cDAQ much but that older chassis is even more restrictive if I remember correctly since the sample clock is provided by the chassis itself.

0 Kudos
Message 9 of 15
(6,682 Views)

Thanks a lot guys for your input. Though I'm still a LabView newbie, NI's engineers were able to build on this conversation and direct me to a solution that should work for our lab. At first I thought we would need to either buy a new DAQ and modules or start from scratch with advanced programming that I am not really capable of, but it turns out that I think we are simply going to put both of our experiments' VIs into one VI and essentially create On/Off switches for the separate experiments' case structures so that we're not collecting data for both all of the time.

 

Thanks again and have a good weekend!

Message 10 of 15
(6,671 Views)