FB_CSpline - PrepareEqDisX (Method)

Overview

Type:

Method

Available as of:

V1.0.0.0

Versions:

Current version

Task

Generation of a CSpline with equidistant X values.

Description

Based on the transferred list i_plrYList, this method generates a CSpline with equidistant X values, considering the X values i_lrXStart and i_lrXEnd, as well as the slopes i_lrMStart and i_lrMEnd.

NOTE: To generate a CSpline, 112 * (i_diNumberofPoints + 1) bytes dynamic memory are required. Therefore the parameter Programm\DynIecDataSize of the PLC configuration must be selected correctly.

Interface

Input

Data type

Description

i_etCSplineType

ET_CSplineType

CSpline type that must be generated.

i_diNumberOfPoints

DINT

Number of value pairs to be interpolated.

Value range: 3 .. Gc_diMaxNumberOfSplinePoints

i_lrXstart

LREAL

Initial value of the X range

i_lrXend

LREAL

End value of the X range

i_plrYList

POINTER TO LREAL

Pointer to the array containing the Y values. This array must at least contain i_diNumberOfPoints elements to help prevent memory access errors.

i_lrMstart

LREAL

Start point slope. Only relevant for i_etSplineType := ET_CSplineType.Boundary

i_lrMend

LREAL

End point slope. Only relevant for i_etSplineType := ET_CSplineType.Boundary

Output

Data type

Description

q_etDiag

GD.ET_Diag

General, library-independent statement on the diagnostic.

A value unequal GD.ET_Diag.Ok equates an error message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = GD.ET_Diag.Ok -> Status message

q_etDiag <> GD.ET_Diag.Ok -> Error message

q_sMsg

STRING[80]

Event-triggered message which gives more detailed information on the diagnostic state.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

ExecutionAborted

InsufficientDynamicMemory

59

Insufficient dynamic memory

InputParameterInvalid

CSplineTypeUnknown

64

CSplineType is indeterminable

InputParameterInvalid

NumberOfPointsRange

58

NumberOfPoints is outside the valid range.

InputParameterInvalid

PointerYListInvalid

62

The pointer on YList is invalid.

InputParameterInvalid

PoorNumericCondition

63

The spline is numerically ill-conditioned.

InputParameterInvalid

XstartGreaterXend

65

XStart is greater than XEnd.

CSplineTypeUnknown

Enumeration name:

CSplineTypeUnknown

Enumeration value:

64

Description:

CSplineType is indeterminable

Issue

Cause

Solution

-

The value at the i_etCSplineType input is invalid.

i_etCSplineType must be assigned with an element from ET_CSplineType.

InsufficientDynamicMemory

Enumeration name:

InsufficientDynamicMemory

Enumeration value:

59

Description:

Insufficient dynamic memory

Issue

Cause

Solution

-

There is not enough dynamic memory available.

The DynIECDataSize parameter in the PLC Configuration must be increased.

NumberOfPointsRange

Enumeration name:

NumberOfPointsRange

Enumeration value:

58

Description:

NumberOfPoints is outside the valid range.

Issue

Cause

Solution

-

An invalid number of spline points has been transferred at the i_diNumberOfPoints input.

The i_diNumberOfPoints input must be >= 3 and <= Gc_diMaxNumberOfSplinePoints.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The generation of the CSpline with equidistant X values was successful.

PointerYListInvalid

Enumeration name:

PointerYListInvalid

Enumeration value:

62

Description:

The pointer on YList is invalid.

Issue

Cause

Solution

-

An invalid pointer was transferred to input i_plrYList.

Verify the pointer at input i_plrYList.

PoorNumericCondition

Enumeration name:

PoorNumericCondition

Enumeration value:

63

Description:

The spline is numerically ill-conditioned.

Issue

Cause

Solution

-

The distance between two spline points is too small.

Verify the spline point list.

XstartGreaterXend

Enumeration name:

XstartGreaterXend

Enumeration value:

65

Description:

XStart is greater than XEnd.

Issue

Cause

Solution

-

The assigned value of the stCam.lrXStart variable is too high.

The value of the stCam.lrXStart variable must be less than the value of the stCam.lrXEnd variable.