# LGF_IsValueInToleranceByTime (FB / 1.0.0)

Overview

Author: Siemens Digital Industries

## Short description

Checks if a given value is within a specified tolerance in percent of a given set point.
The block has a configurable timing for set point change hiding, lower limit and as well for upper limit violation hiding.

### Block Interface

| LGF_IsValueInToleranceByTime (FB) |
--- | --- | ---
Real |  |  | value |  | overHighLimit |  |  | Bool
Real |  |  | setpoint |  | belowLowLimit |  |  | Bool
Real |  |  | lowerMinimum |  | inLimits |  |  | Bool
Real |  |  | upperMaximum |  | setpointChange |  |  | Bool
Bool |  |  | reset |  | error |  |  | Bool
LGF_typeIsValueInToleranceByTimeConfiguration |  |  | configuration |  | status |  |  | Word

### Input parameter

Identifier | Data type | Default value | Description
--- | --- | --- | ---
value | Real | 0.0 | Value to check if in range of setpoint
setpoint | Real | 0.0 | Setpoint
lowerMinimum | Real | 0.0 | [% or ABS] Lower limit/tolerance of the setpoint in percent or absolut
upperMaximum | Real | 0.0 | [% or ABS] Upper limit/tolerance of the setpoint in percent or absolut
reset | Bool | FALSE | Reset Block
configuration | LGF_typeIsValueInToleranceByTimeConfiguration | --- | Module related configuration parameters

### Output parameter

Identifier | Data type | Description
--- | --- | ---
overHighLimit | Bool | TRUE: if value is above high limit
belowLowLimit | Bool | TRUE: if value is below low limit
inLimits | Bool | TRUE: if value is in between the limits
setpointChange | Bool | TRUE: when a setpoint change has been detected
error | Bool | Error occured
status | Word | Status of the function

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_NO_ERROR Status: No error
16#8401 | ERR_RANGE_LIMIT_VALUE_CALC Error: Wrong result during limit calculation for limit values
16#8402 | ERR_SETPOINT_ABOVE_HIGH_LIMIT Error: Setpoint above absolut high limit
16#8403 | ERR_SETPOINT_BELOW_LOW_LIMIT Error: Setpoint below absolut low limit

## User defined datatype(s)

### LGF_typeIsValueInToleranceByTimeConfiguration (UDT / V1.0.0)

Module related configuration parameters

Identifier | Data type | Default value | Description
--- | --- | --- | ---
disableLimits | Bool | FALSE | TRUE: Disable the monitoring timer. Leaving the tolerance triggers immediately
limitsAsAbsolutValues | Bool | FALSE | TRUE: Limit given as absolut value / FALSE: Limits given as tolerance from setpoint - absolut or perecent value
toleranzAsAbsoluteValues | Bool | FALSE | TRUE: Toleranze given as absolut value / FALSE: Toleranze in percent from Setpoint
upperLimitMonitoringTime | Time | T#10S | Monitoring time for the upper limit violation
lowerLimitMonitoringTime | Time | T#10S | Monitoring time for the lower limit violation
setpointChangeMonitingTime | Time | T#20S | Monitoring time for setpoint changes

## Functional description

The `setpoint`, `lowerMinimum` and `upperMaximum` variables define a value range.
The function checks whether the `value` is below, in or above the value range. The outputs `belowLowLimit`, `inLimits`, or `overHighLimit` show where the `value` is located.

By the configuration it is possible to define whether the borders are given as absolute values or in percentage from set point.
The timing could be adjusted for set point changes and as well for hiding the violating of the lower or upper limit in case of peaks.

Figure: Principle of operation

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Support
| 21.12.2023 | First released version Copied snd extended from "IsValueInRange"