From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-15-2009 01:54 PM
Hello! I'm trying to collect a voltage data and average them every 10 seconds then plot the average. I've attached a closed example of the vi I'm working on which is slowing my process. Thanks in advanced!!!!
06-15-2009 04:28 PM
06-15-2009 10:26 PM
You are programming this like text based code, with each frame being a disconnected statement linked via locals. You don't need any local variables at all! Use dataflow!
You are using CPU burner loops that consume all CPU doing basically nothing millions of times /second.
You need to pace your loops to run them at a define rate, easiest is with a small wait statement. Now there is a fixed relation between [i] and time and all you need is count iterations.
Apparently, you don't understand the "built array" node. It does not keep any history, so all you do is converting a scalar to an array with a single element, so the average is the same as the original scalar. You would need to built your array in a shift regsiter or feedback node (or with the accumulator express VI). However, for averaging you don't even need arrays. Simply accumulate the random values in a simple scalar shift register and divide by the number of additions to get the average at each iteration. Reset and chart every X iterations.
Here's a simple rewrite of your VI. The loop runs 10x/second and the avarage is charted every 5 seconds. Modify as needed.
06-16-2009 02:50 AM
I noticed you said you collected voltages. Then I assume you have some DAQ equipment also. A very common mistake by beginners is that they do the data collection in a software timed loop, reading 1 sample in each iteration. That is not the best approach. The best thing is to let the DAQ unit do the timing and buffering. Then you can relax and just pull data from the buffer then you want it. Go to help in the toolbar and then select "find examples" search for the term "continuous acq" I think a good example for you to start with is the "Cont Acq&Chart Samples-Int Clk.vi"
06-16-2009 06:45 AM
Thanks for the quick replies... But here's another question related to my problem.
What if the scenario changed instead of time I need to plot the data using distance, every half inch perhaps.
06-16-2009 07:00 AM
KowdTek wrote:What if the scenario changed instead of time I need to plot the data using distance, every half inch perhaps.
But then you would use a paper not a computer or not ? I am sure you have a reason for asking this question. But could you please elaborate your question.
06-16-2009 07:22 AM
First, I made the example thinking that I'll be able to relate it to my problem. Here it is, I want to measure how fast a moving object travels by using a device that measure distance and dividing it by time. Let say I'm averaging the collected data every 1 inch then plot it. This is the reason why I asked for another scenario instead of time, I'll use distance. Please bare with me, I'm still new to this.
Thanks again.
Coq rouge wrote:
KowdTek wrote:What if the scenario changed instead of time I need to plot the data using distance, every half inch perhaps.
But then you would use a paper not a computer or not ? I am sure you have a reason for asking this question. But could you please elaborate your question.
.
06-16-2009 07:28 AM