LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Setup Waveform Chart in DAQmx producer/consumer

Hi All, 

 

I am using a USB-6001 to read in the analog inputs from two PX-303 0.5v - 5.5v pressure transducers. I would like to set up a proper producer/consumer setup and have the front panel display a rolling 5-10min of chart data for the user to quickly recognize trends. This is for active calibration of a part so I will not need to log any data. I am still new to the producer/consumer architecture so I am using some code that was posted with slight modifications.  Any help is appreciated. 

DaqMx Prod-Cons.png

 

 

0 Kudos
Message 1 of 7
(1,727 Views)

Bump

0 Kudos
Message 2 of 7
(1,679 Views)

Hi DDuff,

 

what exactly is the question?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(1,665 Views)

Sorry for being unclear. Two main questions:

 

1. Does this producer/consumer setup look correct for continuous acquisition of two AI signals?

 

2. How do I set up a waveform chart (or graph if that is more appropriate) to show a rolling ~5 min worth of data using this prod/consumer loop? 

 

I have a pressure regulator that needs to be calibrated. I am currently measuring the input pressure and output pressure. I would like to graph in, out, and % diff.  It atomically adjust with temp so it takes time to settle once the probe is at a new temp.  I would like to show a live 5 min trend so the tech can see when the probe has settled. I plan on adding a bool that will light when the signal is stable based on math, but a live trend will help the tech notice trends during calibration more quickly. I will not need to log any of the data longterm. 

 

Thanks for the help.

 

 

0 Kudos
Message 4 of 7
(1,661 Views)

Hi DDuff,

 

you are setting a sample rate in the DAQmx task: decimate the samples to a reasonable number of samples to display the last 5min of data. Set the chart history size as needed for this amount of samples...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(1,643 Views)

GerdW, 

 

Thanks for the reply, I guess this is where my knowledge gap is.

 

In the code I posted I have the rate set to 1000 Hz and the number of samples set to 10. From what I understand this setup means that I will be taking 10 samples from the AI every .001 second. I think that I read somewhere the waveform chart defaults to at dt of 0.01. If I have a sample rate of of .001 does it average the 100 samples that it has received before that  next data point and create the .01 data point from them? Does the waveform chart show a set number of data points and it is up to the programmer to adjust their sample rate so the x axis corresponds to a larger period of time?

 

How do I programmatically set the chart history size to show that much data over time? While the VI is running I see that it has a timestamp at the bottom and I can manually change the time, but I am not sure how to adjust that parameter.  

 

Thanks again for the help.

0 Kudos
Message 6 of 7
(1,628 Views)

My comments inline in red.   Then an attached example with additional code comments (I left your own comments and colored mine cyan).

 


In the code I posted I have the rate set to 1000 Hz and the number of samples set to 10. From what I understand this setup means that I will be taking 10 samples from the AI every .001 second.
Nope.  10 samples every 0.01 second.  It takes 0.01 second to build up 10 samples at 1000 Hz.   Note: a better rule of thumb to follow is to retrieve more like 0.1 second worth of samples per call to DAQmx Read, so you iterate the loop at 10 Hz.  See attached.

I think that I read somewhere the waveform chart defaults to at dt of 0.01. If I have a sample rate of of .001 does it average the 100 samples that it has received before that  next data point and create the .01 data point from them?
Nope.  It does *not* do any kind of averaging for you.  It's job is just to try to display all the points you give it.  Note: it won't be meaningful to try to display 300 seconds * 1000 samples/sec = 300000 points on a graph or chart that's only 1000 pixels wide.  Again, see attached.  (My example sets the chart up to store & display 3000 points -- still more than necessary, but not ridiculously so.  And it made some other things more convenient.)
Does the waveform chart show a set number of data points and it is up to the programmer to adjust their sample rate so the x axis corresponds to a larger period of time?   Yep, pretty much.  But there are two parts to it.  There is both a "History Length" that tells how much data is retained in its circular buffer.  And then there are aspects of the X-scale such as range and multiplier that determine how much of that data is displayed.

How do I programmatically set the chart history size to show that much data over time?

You can't.  The history length can only be set at edit time.  But you can change properties like X scale range and multiplier to show a sliding 5 minute window.  See attached.

 

While the VI is running I see that it has a timestamp at the bottom and I can manually change the time, but I am not sure how to adjust that parameter.

You can do this with the chart's X scale properties, after converting the timestamp to floating point seconds.

 

 -Kevin P

 

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 7 of 7
(1,616 Views)