01-17-2012 02:04 PM
Hi,
I am very new to the world of LabView and I am looking for some help. I am trying to write a code that I can use in the testing of heat pump water heaters. I have gotten my code to a point where I can read in my temperature and flow rates, and calculate the BTU/hr for my heat pumps, but I want to be able to average my BTU/hr so my data isn't as noise. I would really like to be able to have my code take in say 200 samples of data and create a live average that I can display on a graph. I have tried many different kinds of mean.vi's using different loops and arrays, but I haven't come up with anything that works right. Most likely I am an idiot and doing this all wrong anyways, but some help would be greatly. Please see my attached code.
01-17-2012 03:38 PM
An easy way to create a live average is using the Mean PtByPt.VI. Have you tried it?
01-17-2012 03:46 PM
I have tried using this VI, but with little success. I think it comes from my overall lack of Labview knowledge though. How does this look for a set up of the mean pt by pt.vi?
01-17-2012 05:04 PM
Do not wire a "True" to the initialize terminal of the PtByPt.VI: This clears the history of values that this VI uses to calculate the floating mean value.
Or in other words: As long as you wire a True to the initialize terminal, the VI is out of order and can be replaced by a wire!
01-17-2012 05:18 PM
I have removed the True from the initialize node on the block. I am still getting the same value for the mean as I am for the live data. I have let the system sample the correct number of times for the sample on the mean as well. Does this have to do with the way I am viewing the output of the mean block or am I doing something else wrong? I am testing this out on a simplied code and getting the same results as well. Could you please take a look at the attached code to see if I have everything wired set up correctly? Thanks so much for all the help so far too!
01-17-2012 05:54 PM
I think I figured out what was messing me up. I removed the true from the mean block, but I still had a true tied to the loop condition. So I changed that to a false and it appears to be working for me now! Does this sound like the correct fix? Thanks.
01-17-2012 05:59 PM
You are running this with a while loop that only runs once. The pt by pt VI has a function in it that reinitializes itself on first call, which is what is happening the way you are running it since the VI needs to keep restarting.
Replace the True constant with a control going into the stop terminal of the while loop and try again.