Table of Contents

Linear interpolation

Block name

B83_LINEARINTERPOLATION

ST call

PROGRAM TEST B83
   VAR
     FB : LIB.CORE.V1_0.B83_LINEARINTERPOLATION;
 END_VAR
 FB(IN:=REAL1, XVALUES:=POLE,YVALUES:=POLE2,ENABLEVALUES:=POLE3,RECALCULATESLOPES:=BOOL1,
        ENABLEMIN:=TRUE,ENABLEMAX:=TRUE,XMIN:=0,XMAX:=50,OUT=>REAL2);
END_PROGRAM

Library

LIB\CORE

Version

V1.0

Description

The block converts the input signal to the output using interpolation curve consisting of 10 segments.

Inputs

Input Type Description Default value
IN REAL Input signal 0
XVALUES ARRAY[1..10] OF REALArray of X coordinates 1-10 [0,0,…,0]
YVALUES ARRAY[1..10] OF REALArray of Y coordinates 1-10 [0,0,…,0]
ENABLEVALUES ARRAY[1..10] OF BOOLArray of enable values [False,…,False]
ENABLEMIN BOOL Enable of low alarm False
ENABLEMAX BOOL Enable of high alarm False
XMIN REAL Low alarm limit 0
XMAX REAL High alarm limit 0
RECALCULATESLOPESBOOL Rising edge recalculates the block with new XValues/YValues/EnableValues.False

Outputs

Output TypeDescription
OUT REALOutput value
MINALARMBOOLLow alarm
MAXALARMBOOLHigh alarm

Function

The block calculates a transfer function defined by up to 10 points [X1,Y1][X10,Y10], which are linked by lines. The Enable values activate the corresponding (X, Y) point.

Application example