SurfLin

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Linear interpolation on a surface.

Inputs

Input

Data Type

Range

Unit

Default

Description

X

REAL

 

 

 

X coordinate of the point to be interpolated.

XAxis

REAL[ ]

 

 

 

X coordinates of the known points of the X axis.

Y

REAL

 

 

 

Y coordinate of the point to be interpolated.

YAxis

REAL[ ]

 

 

 

Y coordinates of the known points of the Y axis.

ZVal

REAL[ ]

 

 

 

Z coordinate of the points defined by the axis.

Outputs

Output

Data Type

Range

Unit

Description

ERR

DINT

 

 

  • Error code if failed.
  • 0 (zero) if OK.

OK

BOOL

 

 

TRUE if successful.

Z

REAL

 

 

Interpolated Z value corresponding to the X,Y input point.

Remarks

This functionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. performs linear surface interpolation in between a list of points defined in XAxis and YAxis single dimension arrays.

  • The output Z value is an interpolation of the Z values of the four rounding points defined in the axis.
    • Z values of defined points are passed in the ZVal matrix (two dimension array).
    • ZVal dimensions must be understood as: ZVal [ iX , iY ]
  • Values in X and Y axis must be sorted from the smallest to the biggest.
    • There must be at least two points defined in each axis.
    • ZVal must fit the dimension of XAxis and YAxis arrays.
      • For instance:
        • XAxis : ARRAY [0..2] of REAL;
        • YAxis : ARRAY [0.3] of REAL;
        • ZVal : ARRAY [0..2,0..3] of REAL;
  • If the input point is outside the rectangle defined by XAxis and YAxis limits, the Z output is bound to the corresponding value and an error is reported.

If the function fails, the ERR output gives the cause of the error:

Error Code

Meaning

0

OK

1

Invalid dimension of input arrays.

2

Invalid points for the X axis.

3

Invalid points for the Y axis.

4

X,Y point is out of the defined axis.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

Not available.