11-09-2018 01:15 AM
the purpose of this vi is to calculate the total average values from voltage inputs (that we generate from the sensors).
we face difficulty to get average value of the voltage. the value of the voltage is change with respect to time (in every seconds).
Solved! Go to Solution.
11-09-2018 01:50 AM - edited 11-09-2018 01:57 AM
Hi submeet,
On your VI:
uh-oh: heavy overuse of local variables! (Why are there 12 local variables of "x/y"?
Also: Cleanup your VI to get a better overview!
(You also forgot to attach the missing subVI.)
Why is "Table Control" a control when it is used as indicator?
Use arrays and polymorphic operations instead of duplicating code 12 times…
What's the purpose of that While loop to calculate "COFP Rate RT"? It's not needed…
Use array and loops instead of those >20 FormatIntoString functions on the right side of your loop!
Why is "FALL LEVEL" an integer when you want to assign float values?
On your question:
Your routine to calculate an average does exactly what you have programmed:
1. Create an array of 5 identical elements (with the very same value!)
2. Calculate the average of that array
Does it really make sense to calculate the average of 5 identical values?
When you need something different you need to program something different.
Sometimes it helps to develop an algorithm using a pen and a sheet of paper!
11-09-2018 01:25 PM - edited 11-09-2018 01:28 PM
A lot of your code is highly flawed. Some has been mentioned, here's more: