06-25-2017 11:02 AM
Hi all
I am using myrion to take readings for temperature and 3 other parameters every 5 seconds with timed loop. How can I take average every 5 second?
I tried to use the statistics functon to get the arithmetic mean, but it seems i am getting only the value of last sample written into the file!!
Thanke
Solved! Go to Solution.
06-25-2017 11:24 AM - edited 06-25-2017 11:26 AM
Hi Yasee,
How can I take average every 5 second?
Average of what???
it seems i am getting only the value of last sample written into the file!!
What have you tried? Mind to attach your VI?
What's the relation with your "file"? I thought you want to average sample read from the myRIO hardware???
You really need to learn to ask better question! 😄
To answer your question at the current state of information provided by you: As your "timed loop" is iterating at 5s interval you can calculate your averages inside of this loop. This way they will be calculated also with the 5s interval! 😉
06-25-2017 12:02 PM
Hi
I am looking to average the readings for the flow rate and the pressure and get one value every 5 seconds to write it in a file.
you could take look at the vi
excuse me English is not my first language
thanks
06-25-2017 12:07 PM
here is a another VI runs using NI-9211 to take temperature from 8 thermocouples
I want to take the average for the temperatures every 5 second and write it to a file.
06-25-2017 12:15 PM
Hi Yasee,
why do people think using (mostly/mainly) ExpressVIs will make their life easier?
All you need is THINK DATAFLOW!
In both your VIs your are reading just one (in numbers: 1) sample (per channel) per iteration. This one sample is fed into an ExpressVI to calculate an average from it. What exactly is the average of a single/scalar value?
Recommendations/suggestions:
- Learn DATAFLOW and get rid of ExpressVIs. This way you will actually learn LabVIEW and understand which data is "flowing" which way…
- use the Pt-by-Pt-Mean function for your analog input. Set the size input as needed…
- for your 8 thermocouples: join those 8 channels into one DDT wire, then convert to a 1D array. Split this array into 8 scalar values (using IndexArray) and use PtByPtMean 8 times… 🙂 (This is not the best solution, but will do what you want to do…)
06-25-2017 02:12 PM
You are only averaging the last point. Try something like "mean ptbypt" for each of the sensors and adjust the history size according to your requirements.