CurveLin

PLCopen motion icon

 Function Block - Linear interpolation on a curve.

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.

YVal

REAL[ ]

 

 

 

Y coordinate of the points defined on the X axis.

Outputs

Output

Data Type

Range

Unit

Description

ERR

DINT

 

 

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

OK

BOOL

 

 

TRUE if successful.

Y

REAL

 

 

Interpolated Y value corresponding to the X input.

Remarks

  • This function performs linear interpolation in between a list of points defined in the XAxis single dimension array.
    • The output Y value is an interpolation of the Y values of the two rounding points defined in the X axis.
    • Y values of defined points are passed in the YVal single dimension array.
  • Values in XAxis must be sorted from the smallest to the biggest.
    • There must be at least two points defined in the X axis.
      • YVal and XAxis input arrays must have the same dimension.
  • If the X input is less than the smallest defined X point:
    • The Y output takes the first value defined in YVal.
    • An error is reported.
  • If the X input is greater than the biggest defined X point:
    • The Y output takes the last value defined in YVal.
    • 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

4

X is out of the defined X axis

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

Not available.