CHARCURVE (FB)¶
FUNCTION_BLOCK CHARCURVE
Maps an input signal onto a characteristic curve
The characteristic curve is given by an array of POINTs, which include a set of X-values with their corresponding Y-values.
Example in ST:
VAR
CHARACTERISTIC_LINE:CHARCURVE;
KL:ARRAY[0..10] OF POINT := [(X:=0,Y:=0),(X:=250,Y:=50),
(X:=500,Y:=150),(X:=750,Y:=400), 7((X:=1000,Y:=1000))];
COUNTER : INT;
END_VAR
COUNTER := COUNTER+10; supply CHARCURVE with for example a constantly increasing value
CHARACTERISTIC_LINE(IN := COUNTER,N := 5,P := KL);
Illustration of the resulting curve
- InOut:
Scope
Name
Type
Comment
Input
ININTInput signal
NBYTENumber of points defining the characteristic curve : 2 <=
N<= 11Inout
PARRAY [0..10] OF POINT
Array of points to describe the characteristic curve
Output
OUTINTOutput variable, contains the manipulated value
ERRBYTE0 : No error1 : Error inP: wrong sequence (completely tested, only ifINis equal to largest X-value ofP)2 :INoutside of limits ofP4 :Ninvalid, number of points not within the allowed range 2..11