Siemens S7-1500
I am trying to write some logic I just can't quite wrap my head around the cleanest way to write it, and was hoping for some advice
The short version is I need to see if a number is in range.
I have 4 tags (REAL Values). I want to make sure any value is within 20% of the other values.
The Long version:
I have 4 values that need to be averaged.
I am alarming on the average.
If any value is way off, I want to remove it from the equation.
So if all 4 values are within 20% of each other I add and divide by 4, if there is an outlier, I want to add and divide by 3.
I was going to use a simple IN_RANGE command, but the Tag_Min and Tag_Max are variable based on any of the other 3 values in the equation
I am thinking I can build a function block that does this, since I have multiple places in the program I want to use it.
Any help or insight is greatly appreciated.
I am trying to write some logic I just can't quite wrap my head around the cleanest way to write it, and was hoping for some advice
The short version is I need to see if a number is in range.
I have 4 tags (REAL Values). I want to make sure any value is within 20% of the other values.
The Long version:
I have 4 values that need to be averaged.
I am alarming on the average.
If any value is way off, I want to remove it from the equation.
So if all 4 values are within 20% of each other I add and divide by 4, if there is an outlier, I want to add and divide by 3.
I was going to use a simple IN_RANGE command, but the Tag_Min and Tag_Max are variable based on any of the other 3 values in the equation
I am thinking I can build a function block that does this, since I have multiple places in the program I want to use it.
Any help or insight is greatly appreciated.