Average 3 device values and post results to 4th

I can make it so you can specify in the parameters to either use the string or value, so you only need 1 script. This way, you only need one file, you don't even require a INI file (I like writing stuff that doesn't rely on other files in case you haven't noticed). As for excluding extreme values, the only hard part is the 'logic/math', once I figure that out (unless you alread have), it's easy to implement.
 
Thanks! I can see this evolving into a rather useful script.

The logic for determining if a value should be thrown out or not is kinda tricky.

One thing that could be done, is users could specify a range of acceptable variables using parameters. For example, using this script in my part of the country for temperature, the range would probably be 18 to 108, for your part of the country -256 to 94 (hee hee). So that will take care of REALLY wacky numbers.

The next step is much trickier. What standard do you use to figure out what to throw out?
 
If you specify such a large range , then it won't really do much good, I was under the impression you wanted to eliminate extreme measurements i.e. 3 weather stations measuring 82F, 75F and 30F, the 30F would be in your range, but still shouldn't be included in the calculation, or should it ?
 
electron said:
If you specify such a large range , then it won't really do much good, I was under the impression you wanted to eliminate extreme measurements i.e. 3 weather stations measuring 82F, 75F and 30F, the 30F would be in your range, but still shouldn't be included in the calculation, or should it ?
I think in this situation (30F anomaly), another event needs to be triggered. It sounds like quite a front is moving in from (or opposite to) the direction of the anomaly. Warning sirens may be appropriate.
 
E, the range specification is the first of two checks. The second check, which - in your example - would throw out the 30F reading is the one that I don't know how to do.

Also, would it be possible to make the script round the result to a whole number?
 
Rounding is easy, change the following line:
Code:
 z = Round(z / uBound(myArray),1)

to

Code:
 z = Round(z / uBound(myArray))

I will try to do some more work on it tonight.
 
Back
Top