Documentation

LIMIT

Function name

LIMIT

ST call

PROGRAM LIMIT_DEMO
VAR
REAL1,REAL2: REAL;
END_VAR
REAL2:= LIMIT(IN:=REAL1, MN:= 0, MX:=10); //LZE VOLAT I JAKO REAL2:= LIMIT(REAL1, 0, 10)
END_PROGRAM

Description

Limits the output value in the ranges from MN (minimum) to MX (maximum). The function can be also described as MIN(MAX(IN,MN),MX).

Inputs

Input Type Description
IN ANY_ELEMENTARY Input value
MN ANY_ELEMENTARY Minimum value
MX ANY_ELEMENTARY Maximum value

Outputs

Output Type Description
=> ANY_ELEMENTARY Output value

Application example