TwoPoint (FB)¶
FUNCTION_BLOCK TwoPoint
Short Description¶
Linear conversion of a numerical input value by means of a characteristic curve defined by two points.
Portrayal¶
Interfaces¶
Inputs¶
Name Datatyp
Range
Init-Value
Function
rIn_X REAL 0 Analog input
Outputs¶
Name Datatyp
Range
Init-Value
Function
rOut_Y REAL Analog output
xErr BOOL
FALSE: Conversion successful
TRUE: Conversion error
Setpoints / Parameters¶
Name Datatyp
Range
Init-Value
Function
x1 REAL 0 Point 1 of the input range
y1 REAL 0 Point 1 of the output characteristic curve
x2 REAL 100 Point 2 of the input range
y2 REAL 100 Point 2 of the output charactersitic curve
xMinMaxLimit BOOL FALSE Enable / disable the limitation at the analog value output rOut_Y
iMinMaxOffset INTEGER 0 Analog value output of rOut_Y
Functional Description¶
Analog value output rOut_Y¶
Formula
Constraints
Releasing / blocking of the limits xMinMaxLimit¶
xMinMaxLimit Limits
Notes
FALSE none
rOut_Y without absolute limits
TRUE Y_min and Y_max
Limitation of the analog value output rOut_Y active
Value of the limit iMinMaxOffset¶
Formulas
Y_min = y1 - ((ABS(y2-y1))*iMinMaxOffset)/100Y_max = y2 + ((ABS(y2-y1))*iMinMaxOffset)/100
y1 | y2 | y2 - y1 | iMinMaxOffset | Y_min | Y_max | Notes |
---|---|---|---|---|---|---|
0 | 100 | 100 | 0 | 0 | 100 | Default-Limits |
0 | 100 | 100 | 10 | -10 | 110 | Positive Offset |
0 | 100 | 100 | -10 | 10 | 90 | Negativ Offset |
Digital output xErr¶
- x1 = FALSE UND x2 = FALSE
- x1 = x2
- y1 = TRUE UND y2 = TRUE
- y1 = y2
Conversion error
xErr Notes
FALSE FALSE Conversion successful
TRUE TRUE Conversion error
Visualization¶
Information¶
Element Authors
Date
Version Note
Function
Adam Bartod 04.2016 1.0 Initial version
Programming
Adam Bartod 04.2016 1.0 Initial version
Test Alexander Halter, Jochen Reu 12.2016 1.0 Initial version
Documentation
Jochen Reu 10.2017 1.0 Initial version
Revision Lukas Pfänder 11.2017 0.1.3.0 Documentation
Codesys¶
- InOut:
Scope Name Type Initial Comment Input rIn_X REAL 0 Analog input
Output rOut_Y REAL Analog output
xErr BOOL Error Output: FALSE: conversion successful TRUE: conversion error
Input iMinMaxOffset INT 0 Analog value output of rOut_Y
xMinMaxLimit BOOL FALSE Enable / disable the limitation at the analog value output rOut_Y
y2 REAL 100 Point 2 of the output charactersitic curve
x2 REAL 100 Point 2 of the input range
y1 REAL 0 Point 1 of the output characteristic curve
x1 REAL 0 Point 1 of the input range