LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speeding Up DAQ and AO VI

Solved!
Go to solution

Hi,

 

I'm new to Labview and NI products and wasn't able to find my answer after browsing through a bunch threads on similar topics.  I have a cDAQ system that pulls from 5 pressure transducer channels (NI 9205), 1 thermocouple channel (NI 9213) and has 3 AO (NI 9264) that need to be triggered by timers and/or (not yet programmed) by data from the thermocouple channel.  I mimicked online examples of multi channel acquisition, but even with my thermo channel on high speed (which should be 75 S/s I think), I can only get ~2 Hz out of the loop.  Would really appreciate your guys' advice!

Jack_Oswald_0-1625009936223.png

Best,

Jack

0 Kudos
Message 1 of 6
(449 Views)

Hi Jack,

 


@Jack_Oswald wrote:

Would really appreciate your guys' advice!


Some advice:

  • Don't use JPG format for LabVIEW code images, use PNG instead! (Less blurry…)
  • When attaching LabVIEW code images you should create them from LabVIEW by creating snippets!
  • When discussing YOUR CODE you should attach YOUR CODE, and not just images of part of your code!

That basic stuff being said:

  • Why do you create 5 AI tasks to read your 5 pressure sensors? Why don't you create just one task containing all 5 channels?
  • Why don't you set a samplerate for those AI task(s)? Why do you choose the slowest option to read "1 sample on demand"?
  • Why do you make things even slower by pipelining your 5 AI tasks to read those 5 samples one after the other?

Once you replace those 5 tasks by just one task your loop will (most probably) immediately run faster!

 

More things to say:

  • Why do you collect all those samples in arrays in all those shift registers? Building up arrays in an umlimited way will greatly slow down your loop (sooner or later)!
  • Why do you think creating 5 plots for 3 graphs from those ever-growing arrays inside your DAQ loop will help to speed up that loop? That's just another data shuffling added…
  • Why do you use DAQAssistents to read thermocouples and output AO data? Why don't you use plain DAQmx function here? Do you even understand how to handle those (evil) DDT wires correctly?
  • It seems the AO task is independent from your AI/TC tasks: why don't you use a parallel running loop for your AO handling? This way the AO will not slow down all the AI and vice-versa…
  • Why are there so many coercion dots?
  • Why are there controls without a label in the block diagram?
  • Why is the block diagram not cleaned up?
Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 2 of 6
(398 Views)

Hi Gerd,

 

Thanks very much for your detailed reply!  I have the code attached.  I had reasons (likely and hopefully inadequate ones) for some of your points:

-I created 5 AI tasks because I couldn't find a way to apply different custom scales to each channel and we are using multiple types of pressure transducers

-I get an Error -50103 thrown when I try to set a sample rate on the pressure AI's I think that is due to having the thermo and AO and pressure channels (will change this) in the same loop but would love your opinion here. 

-I set the read to 1 on demand since I wanted to read once per loop, I must misunderstand the proper use... for this and the shift register comment I copied the format from: https://www.youtube.com/watch?v=fIy6XT3CdPQ&t=1488s&ab_channel=ZacharyNeale

 

That said, I will  implement your advice where I can outside this list: I'll get rid of the express commands, create separate loops, and consolidate those AIs into like sensors.  I'll also switch to using waveforms instead of building a time array and using DBLs if you would recommend doing so.  I'll update once I've gotten this working.  Thank you again!

 

Best,

Jack

0 Kudos
Message 3 of 6
(368 Views)

Hi Jack,

 


@Jack_Oswald wrote:

I have the code attached. 


Nope…

 


@Jack_Oswald wrote:

I created 5 AI tasks because I couldn't find a way to apply different custom scales to each channel and we are using multiple types of pressure transducers


Simply put all of those 5 pressure sensor CreateVirtualChannel function in a row and wire the task reference from one to the next…

(The next improvement would be to put that code into a loop, with providing neccessary inputs from autoindexed arrays.)

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 4 of 6
(361 Views)

Hi Gerd, 

 

Apologies for my delay getting back to you.  I couldn't respond again in my first 24 hrs on the forum and forgot to follow up the next day.  I switched all of the AI and AOs to Express functions and I've gotten the code to execute appropriately.

 

Thanks for your help!

Jack

0 Kudos
Message 5 of 6
(292 Views)
Solution
Accepted by topic author Jack_Oswald

Hi Jack,

 


@Jack_Oswald wrote:

I switched all of the AI and AOs to Express functions and I've gotten the code to execute appropriately.


Be warned: while this may work right now it will surely be no long-term stable solution!

 

(The DAQAssistent has a long history of forum threads about "stability" problems. Your VI(s) may stop to work as expected sooner or later…)

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 6 of 6
(279 Views)