06-02-2009 12:59 PM - edited 06-02-2009 01:04 PM
Hello, I'm pretty green to Labview. I have read 2 books on the topic, spent hours in the help section, done several related tutorials and cruised the boards for a solution to my problem already. I'm using Labview 8.2 so I can't handle many of the examples that have previously been posted. If you encode something please save it as an 8.2 or lower file.
I have a digital multimeter attached via GPIB and I have used the corresponding labview program to go with the specific multimeter. This part works fine. What I need to do is to take an average (an average over 100 or 1000 measurements, if not more) that exceeds the averaging capability of the multimeter. My thought was to use the data to write a mini labview program. Take the data, put it into an array and then average the array after it gets to a specified size. So far, I can get the data to go into the 1st element of the array, but all my methods for incrementing the data to higher elements isn't working.
I tried a "Signal Compression" function, to no avail. a double isn't a signal, so it refuses to give a mean output.
I tried a time delayed for/while loop, but when the vi runs, the loop iterates until finished before allowing the multimeter to reaquire more data. So I get 100 data points all written to the first element of the array.
I tried the "build array" function incorrectly.
I have attached my vi. When running with no averaging from the multimeter, data is updated approximately every 10ms. I need to be able to take a larger average as well as perhaps have a scalable average.
Thank you for your patience,
Benjamin
Solved! Go to Solution.
06-02-2009 02:00 PM - edited 06-02-2009 02:01 PM
I dont seem to be completely understanding your question.
Do you want an average of the first N points?
Or are you trying to create a moving average?
Here is an example of how to do the former:
You will have your multimeter value wired in place of the 'Data' control I placed.
This will take an average of your first 100 points, and display them in an indicator named 'average'
If you are interested in the latter, let me know and I will show you a quick example.
06-02-2009 02:01 PM - edited 06-02-2009 02:02 PM
A few problems.
1. Your VI only runs once. Thus it is going to only give you one value in your array.
2. You are intializing an empty array an inserting the single value into the beginning of it. Assuming you had a loop happening, you would always be inserting into the beginning which is just not very efficient. Insert Into Array is rarely the VI you want to use. You are better off Auto indexing the tunnel coming out of the loop like shown. Or using Build array and mainting the array in a shift register.
3. No need for that stacked sequence structure that hides too much code. You don't need a sequence structure at all because the data flow in the wires will determine execution order. If you do need an sequence structure, a flat sequence is preferred.
06-02-2009 02:53 PM
Here is the appended vi. I am having difficulty ensuring that my "control" array is of the double type (I put in 0.0 into the numeric constant and it still registers as an integer). I also am having difficulty with the "Build Array" command that you used. It's the first array manipulation that is used inside the while loop. Several manuals have the same symbol, but don't inform where to get it. The "Build Array" command that is in my labview has an (or multiple) array inputs or element inputs, not both to the same vi.
Thank you for your patience and your clarity,
Benjamin
06-02-2009 03:08 PM
Your VI still has problems.
The upper part of your code only runs once returning a single value. You are using that same value continuously in your lower while loop. You did not set up your shift register the same was as Cory shows it as you created an autoindexing tunnel you are using rather than the shift register. Start with my code, then drop in Cory's code for doing the averaging after that.
06-02-2009 10:33 PM
Ravens Fan wrote:Your VI still has problems.
.... Start with my code, then drop in Cory's code for doing the averaging after that.
Go Teamwork!
06-03-2009 08:39 AM - edited 06-03-2009 08:48 AM
Ah, fixed the shift register. Implemented Ravens Fan's code. Ravens code slows the data aquisition process, but not to an unreasonable extent. Now the issue is that the data never leaves the upper while loop. Attached is the current revision of the vi.
we're getting close,
Benjamin.
06-03-2009 08:56 AM
Try this.
06-03-2009 10:43 AM - edited 06-03-2009 10:44 AM
Thank you! that's the solution! Now to fix a few other things and i'm golden. Thank you all for your time and patience.
Any way I can tag 2 people for the solution?
Benjamin
06-03-2009 10:55 AM