Y_YA_WindowCheck
This function sets the InWindow output high if the InputValue is within +/- (Window/2) of the TargetValue. This function is useful when making a comparison that only relies on the InputValue to be close to the Target, but an exact match is not required.
Parameters:
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
|
VAR_INPUT
|
||||
| B | EN | BOOL | The function will continue to execute every scan while Enable is held high and there are no errors. | FALSE |
| V | InputValue | LREAL | The data to be tested against the TargetValue | LREAL#0.0 |
| V | TargetValue | LREAL | The desired data to be compared against. | LREAL#0.0 |
| V | Window | LREAL | This amount will be divided in two. The InputValue must fall within half the window distance of the TargetValue for the InWindow output to go high. A negative value is acceptable. The absolute value will be used in the calculation. | LREAL#0.0 |
| VAR_OUTPUT | ||||
| B | ENO | BOOL | Indicates that the function is operating normally and the outputs of the function are valid. | |
Notes:
- Window value of 0 is acceptable.
- Negative value for window gets converted into the equivalent positive value.