LGF_IsValueInTolerance (FC / V3.0.2)


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 set point, as well as a tolerance range, around the set point in percent (%). The function calculates the low limit and high limit of the value range.

Block Interface

LGF_IsValueInTolerance (FC)
LReal  value Ret_Val  Bool
    
LReal  setpoint overHighLimit  Bool
    
LReal  tolerance belowLowLimit  Bool
    
   error  Bool
    
   status  Word
    
   

Input parameter

IdentifierData typeDescription
valueLRealValue to be checked to determine whether it is within the defined value range
setpointLRealSet point
toleranceLRealTolerance range around the set point in percent (%)

Output parameter

IdentifierData typeDescription
Ret_ValBoolReturn: TRUE if the “value” is in the value range (range of the set point)
overHighLimitBoolTRUE if the “value” is greater than the upper limit value
belowLowLimitBoolTRUE, if the “value” is less than the lower limit value
errorBoolFALSE: No error
TRUE: An error occurred during the execution of the FB
statusWord16#0000-16#7FFF: Status of the FB
16#8000-16#FFFF: Error identification (see following Table)

Status & Error codes

Code / ValueIdentifier / Description
16#0000STATUS_NO_ERROR
Status: no error occurred
16#8401ERR_RANGE_LIMIT_VALUES
Error: wrong values during limit calculation for limit values

Functional description

The setpoint and tolerance percentage variables 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

LGF_IsValueInTolerance - Principle of operation

Change log

Version & DateChange description
01.00.00Siemens Industry Support
10.12.2019First released version
Copied from "IsValueInRange"
03.00.00Simatic Systems Support
23.04.2020Set version to V3.0.0, harmonize the version of the whole library
03.00.02Simatic Systems Support
12.11.2020Bug fix - negative setpoint verification
Insert documentation