01-14-2021 02:10 PM
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.
01-15-2021 09:53 AM
Bump
01-15-2021 11:30 AM
01-15-2021 11:57 AM
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.
01-15-2021 04:05 PM
01-15-2021 08:39 PM
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.
01-16-2021 08:08 AM
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