Two-point function

B80_TWOPOINTFUNCTION

Version V1.0
PROGRAM TEST B80
   VAR
 REAL1,REAL2: REAL;    
  END_VAR
 REAL2 := LIB.CORE.V1_0.B80_TWOPOINTFUNCTION(IN:=REAL1, X1:=20,X2:=20,Y1:=0,Y2:=100);
END_PROGRAM
 
Version V1.1
PROGRAM TEST2_B80
    VAR
     FB:LIB.CORE.V1_1.B80_TWOPOINTFUNCTION;
      IN_V:REAL;
      X1_V:REAL:=20;
      X2_V:REAL:=20;
      Y1_V:REAL:=0;
       Y2_V:REAL:=100;
     OUT_V:REAL;
 END_VAR 
FB(IN:=IN_V, X1:=X1_V, X2:=X2_V, Y1:=Y1_V, Y2:=Y2_V);
OUT_V:=FB.OUT;
END_PROGRAM

LIB\CORE

V1.1

Linear function, recalculation of input value to output value defined by two points.

InputTypeDescription Default value
IN REALInput signal 0
X1 REAL1.point, x coordinate20
X2 REAL2.point, x coordinate50
Y1 REAL1.point, y coordinate0
Y2 REAL2.point, y coordinate100
OutputTypeDescription
OUT REALOutput signal
SIGN BOOLSign of the output signal

The block implements a transfer function given by two points, [X1,Y1] and [X2,Y2], see figure below. The points do not have fixed order, both X1<X2 and X1>X2 is possible. If X1=X2 then y=Y1 for x<X1, y=Y2 otherwise, see figure 2 below. The sign output is indicating the sign of the output signal y: When y>= 0 sign=true, otherwise sign=false.

Function may be rising or falling, [X1,Y1], [X2,Y2].

In case that X1=X2: value at x=X1=X2 is given by Y2.

Function with internal parameters x1=20, x2=20, y1=0, y2=100.




Version  V1.0 was defined as a function. V1.1 is defined as a function block, therefore it can bes added to graphs and it can be set tu manual mode. Functionality remains without change.

  • © Energocentrum Plus, s.r.o. 2017 - 2024