TwoPoint
TwoPoint (FB)
FUNCTION_BLOCK TwoPoint
Short description
Linear conversion of a numeric input value by a characteristic curve defined by two points.
Representation

Interfaces
Inputs
rIn_X
REAL
0
Analog input
Outputs
rOut_Y
REAL
Analog value output
xErr
BOOL
* FALSE: Conversion error-free * TRUE: Error during the conversion process
Setpoints / Parameters
iMinMaxOffset
INTEGER
0
Values of the limits at the analog value output rOut_Y
xMinMaxLimit
BOOL
FALSE
Enable / disable the limit at the analog value output rOut_Y
rY2
REAL
100
Point 2 of the output characteristic curve
rX2
REAL
100
Point 2 of the input range
rY1
REAL
0
Point 1 of the output characteristic curve
rX1
REAL
0
Point 1 of the input range
Functional description
Analog value output rOut_Y
The analog value output rOut_Y is calculated from the analog value input rIn_X depending on the linear characteristic defined by the two points P1(rX1/rY1) and P2(rX2/rY2) is calculated. In the event of a conversion error ( xErr = TRUE ) the analog value output remains rOut_Y unchanged.

Enable / disable the limits xMinMaxLimit
The limits of the analog value output rOut_Y can generally be enabled and disabled with this setpoint / parameter.
xMinMaxLimit
Limits
Notes
FALSE
none
rOut_Y without absolute limits
TRUE
Y_min and Y_max
Limiting the analog value output rOut_Y active
Values of the limits iMinMaxOffset
The limits of the analog value output are only active if the setpoint / parameter xMinMaxLimit is active (= TRUE). The limit values Y_min and Y_max are then calculated as follows:
rY1
rY2
rY2 - rY1
iMinMaxOffset
Y_min
Y_max
Notes
0
100
100
0
0
100
Standard limits
0
100
100
10
-10
110
Positive offset
0
100
100
-10
10
90
Negative offset
Digital output xErr
The digital output xErr signals an error during the conversion process. The following errors are considered:
rX1 AND rX2 = 0
rX1 = rX2
rY1 AND rY2 = 0
rY1 = rY2
Error during the conversion process
xErr
Notes
FALSE
FALSE
Conversion error-free
TRUE
TRUE
Error during the conversion process
Legend: X = any
CODESYS
InOut:
Input
rIn_X
REAL
0
Output
rOut_Y
REAL
Output
xErr
BOOL
Input Const
iMinMaxOffset
INT
0
Input Const
xMinMaxLimit
BOOL
FALSE
Input Const
rY2
REAL
100
Input Const
rX2
REAL
100
Input Const
rY1
REAL
0
Input Const
rX1
REAL
0
Last updated

