# LGF_IsValueInLimits (FC / 3.0.1)

Overview

Author: Siemens Digital Industries

## Short description

The function checks whether a value is within a defined value range. The value range is defined with a lower and an upper limit.

### Block Interface

| LGF_IsValueInLimits (FC) |
--- | --- | ---
LReal |  |  | value |  | Ret_Val |  |  | Bool
LReal |  |  | lowLimit |  | overHighLimit |  |  | Bool
LReal |  |  | highLimit |  | belowLowLimit |  |  | Bool
|  |  |  |  | error |  |  | Bool
|  |  |  |  | status |  |  | Word

### Input parameter

Identifier | Data type | Description
--- | --- | ---
value | LReal | Value to be checked to determine whether it is within the defined value range
lowLimit | LReal | Low limit where the value is checked against to be greater
highLimit | LReal | High limit where the value is checked against to to be less

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Bool | Return: TRUE if the “value” is in the value range (range of the set point)
overHighLimit | Bool | TRUE if the “value” is greater than the upper limit value
belowLowLimit | Bool | TRUE, if the “value” is less than the lower limit value
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_NO_ERROR Status: no error occurred
16#8401 | ERR_RANGE_HIGH_BELOW_LOW_LIMIT Error:High limit less then low limit

## Functional description

The variables `lowLimit` and `highLimit` define a value range.
The function checks whether the `value` is below, in or above the value range. The outputs `belowLowLimit`, `Ret_Val`, or `overHighLimit` show where the `value` is located.

Figure: Principle of operation

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Support
| 10.12.2019 | First released version Copied from "IsValueInRange"
| 3.0.0 | Siemens Industry Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 12.11.2020 | Insert documentation