07-28-2011 05:25 PM
I would like to do some moving averaging on my FPGA based on building the sum of the values to around 200 data points and then removing the oldest value and adding the newest value and averaging them all that way I'm only needing to acquiring one new point once the data point have reached the 200 limit but I have 16 channels and FPGA does not support 2-D arrays and I can do it with 16 1-d arrays but I don't think there will be enough resources on the FPGA. Any one have any ideas how i can do this. I guess the main challenge is having a way to coninuously store the last 200 or N points so that I can subtract the oldest value other than a two d array or multiple 1-d arrays. I am trying to do it this way as well so that I don't need to wait each time and acquire 200 or N samples and then avaerge them each time for a new averaged value.
I've already done this on the real time side but it seems to use quite a few resources and slow down my code. Maybe there is a better way to do it on real tiem if it can't be done on the FPGA?
07-29-2011 06:51 AM
Hi,
Use the "Mean, Variance, and Standard Deviation.vi" 16 times parallel. You can configure the number of samples used to create the mean value.
Then you place the VI inside a Loop and use the "Output Valid" flag to check for the first valid average.
Christian
07-29-2011 12:16 PM
"Mean, Variance, and Standard Deviation.vi"
Where is this vi located? Is it and express vi or from some add on toolkit? Perhaps the express "Configure Statistics.vi"? Why not use the Signal Processing>>Point by Point>>Prob & Stat>>Mean.vi and set the sample length to 200? Is this not available for RT or FPGA?
07-29-2011 12:27 PM
@GovBob
With LabVIEW FPGA you don't have floating point operations, so the VIs you are talking about are not available with FPGA.
I was talking about the following:
Christian
07-29-2011 12:41 PM
Thanks for clearing that up Christian as to why we can't use the vi I mentioned. I forgot that we can't use floating point. Can you tell me what pallette the Mean, Variance and Standard Deviation.vi is located? I do have the FPGA and Real time.
07-29-2011 02:14 PM
I found the vi! I forgot that you have to have a FPGA project target to expose all of the FPGA pallette functions. Thanks again. Hopefully this answers the OP's question.
07-30-2011 08:08 PM
@Christian_M wrote:
Hi,
Use the "Mean, Variance, and Standard Deviation.vi" 16 times parallel. You can configure the number of samples used to create the mean value.
Then you place the VI inside a Loop and use the "Output Valid" flag to check for the first valid average.
Christian
the algorithm you are refering to does not implement the algorithm the original post describes. these routines gather n points and produce a result every n points instead of every point.
you can implement a routine using memory and keeping track of your pointers to implement a n channel average routine that acts as originally described.
07-30-2011 09:22 PM
Stu McFarlane
Viewpoint Systems, Inc.
Yes sir you are correct this is what I am doing currently, producing a result every point instead of every n point. Do u think this is a good method? It appears to provide a consistent and real time result even with dynamic data at reasonable speed versus waiting until i can receive n samples each time to average the data. I would consider an array using memory already. What methods are there to use memory instead of an array as I currently am?
Thanks,
Craig
07-31-2011 06:26 AM
using the algorithm that produces a new measurement for every new data point has a much better response than one that waits every n points.
using memory, you have to code it more like you would in C. keeping track of offsets to channel data and offsets to point within channel data.
08-01-2011 02:43 AM
Hi All,
Stu is right, the VI I posted doesn't fullfill the original needs.
I build a 9-Point running average once, like this:
You should be able to change it running for 200 elements, however, the array will take some space at the FPGA then.
Christian