<< Click to Display Table of Contents >> Range Checking |
![]() ![]() ![]() |
Determining if a value is 'in-range' (i.e. between an upper and lower limit) in order to e.g. send an email if it is out-of-range.
To do this there is some Strategy that will need to be implemented.
The logic needs to set 2 booleans, e.g. HiBool and LoBool to be able to determine if the value is in-range.
HiBool is set according to whether the value is above or below the HiLimit.
And LoBool is set according to whether the value is above or below the LoLimit.
The in-range value is shown in blue in this diagram. |
Below are the steps for the logic required in the Strategy:
Strategy logic |
Explanation |
Every Second: HiLimit = Setpoint + AmountAbove LoLimit = Setpoint + AmountBelow |
When the computer's time changes, which is every second, update the HiLimit and LoLimit to allow for the ramping of the Setpoint. |
If Value > HiLimit: HiBool = Off InRange = HiBool + LoBool OutOfRange = InRange - InRange |
If the value is greater than the HiLimit: Set HiBool to OFF Set InRange to ON only if both HiBool and LoBool are ON. Set OutOfRange to the opposite of InRange. |
If Value <= HiLimit: HiBool = On InRange = HiBool + LoBool OutOfRange = InRange - InRange |
If the value is less than or equal to the HiLimit: Set HiBool to ON Set InRange to ON only if both HiBool and LoBool are ON. Set OutOfRange to the opposite of InRange. |
If Value >= LoLimit: LoBool = On InRange = HiBool + LoBool OutOfRange = InRange - InRange |
If the value is greater than or equal to the LoLimit: Set LoBool to ON Set InRange to ON only if both HiBool and LoBool are ON. Set OutOfRange to the opposite of InRange. |
If Value < LoLimit: LoBool = Off InRange = HiBool + LoBool OutOfRange = InRange - InRange |
If the value is less than the LoLimit: Set LoBool to OFF Set InRange to ON only if both HiBool and LoBool are ON. Set OutOfRange to the opposite of InRange. |
If OutOfRange = On: Send email |
If OutOfRange is ON: |
For further assistance, or to see an example project, contact your SpecView representative.