FC_GaussAlgorithm

 

FC_GaussAlgorithm - General Information

Overview

Type:

Function

Available as of:

V1.0.3.0

Versions:

Current version

Task

Solution for linear equation systems that are used in the Gauss algorithm with pivoting.

Description

The function calculates the vector SolutionVector so that the equation Matrix * SolutionVector = Vector is fulfilled.

Interface

Input

Data type

Description

i_diDim

DINT

Number of equations of the solving system or lines / columns of the corresponding matrix. Must be >= 2 .

i_lrZeroLimit

LREAL

Numeric zero limit. Matrix elements that are much smaller than this value are considered as zero. Used to limit the rounding error reproduction. The best value depends on the numeric properties of the matrix. Must be > 0.0. A common value is, e.g. 1E-12.

i_plrMatrix

POINTER TO LREAL

Pointer on the beginning of the memory area in which the matrix of the linear equation system is stored. This area has to be connected and provide a minimum memory space for i_diDim * i_diDim LREALs.

i_plrVector

POINTER TO LREAL

Pointer to the beginning of the memory area where the inhomogeneous vector ("right side") of the linear equation system is stored. This area has to be connected and provide a minimum storage space for i_diDim LREALs.

i_plrSolutionVector

POINTER TO LREAL

Pointer on the beginning of the memory area where the solution vector of the linear equation system has to be copied. This area has to be connected and provide a minimum storage space for i_diDim LREALs.

Output

Data type

Description

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic.

A value not equal to ET_Diag.Ok corresponds to an diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = ET_Diag.Ok -> Status message

q_etDiag <> ET_Diag.Ok -> Diagnostic message

Notes

oThis POU requires (i_diDim + 1) * i_diDim * SIZEOF(LREAL) bytes of dynamic memory. Therefore, it must be ensured that the parameter LMCx00C\C\Configuration\Program\DynIECDataSize (total available dynamic memory) is set to an adequate value.

oThe correct size of the storage area that the pointers i_plrMatrix, i_plrVector and i_plrSolutionVector are pointing to must be carefully checked. Otherwise, the POU causes memory access errors.

oThe functions FC_GetMatrixElement(), FC_GetVectorElement(), FC_SetMatrixElement() and FC_SetVectorElement() are available for allocating and reading the elements of the matrix and the vectors involved.

oIf the matrix and the inhomogeneity vector of the equation system are give by the arrays then these can be allocated directly (without using the previously specified help function). The first index of A is then the line index of the matrix and the second the gap index.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

ControllerConditionInvalid

DynIecDataSizeTooSmall

75

There is not enough dynamic memory reserved.

InputParameterInvalid

DimRange

72

Dim is outside the valid range.

InputParameterInvalid

MatrixSingular

77

The matrix is singular.

InputParameterInvalid

PointerMatrixInvalid

69

The pointer Matrix is invalid.

InputParameterInvalid

PointerSolutionVectorInvalid

71

The pointer SolutionVector is invalid.

InputParameterInvalid

PointerVectorInvalid

70

The pointer Vector is invalid.

InputParameterInvalid

ZeroLimitRange

74

ZeroLimit is outside the valid range.

UnexpectedProgramBehavior

UnexpectedFeedback

1

An unintended detected error occurred during execution.

DimRange

Enumeration name:

DimRange

Enumeration value:

72

Description:

Dim is outside the valid range.

Issue

Cause

Solution

-

At the input i_diDim, an invalid value has been transferred.

The following must hold: i_diDim > 1

DynIecDataSizeTooSmall

Enumeration name:

DynIecDataSizeTooSmall

Enumeration value:

75

Description:

There is not enough dynamic memory reserved.

Issue

Cause

Solution

-

There is no or not enough dynamic memory available.

Increase the available dynamic memory Controller > Configuration > Program > DynIECDataSize.

MatrixSingular

Enumeration name:

MatrixSingular

Enumeration value:

77

Description:

The matrix is singular.

Issue

Cause

Solution

-

The matrix at the input i_plrMatrix is singular.

At the input i_plrMatrix, a regular matrix has to be transferred.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The equation system has been successfully solved.

PointerMatrixInvalid

Enumeration name:

PointerMatrixInvalid

Enumeration value:

69

Description:

The pointer Matrix is invalid.

Issue

Cause

Solution

-

At the input i_plrXMatrix, a null pointer has been transferred.

At the input i_plrXMatrix, the address of the memory containing the matrix must be transferred.

PointerSolutionVectorInvalid

Enumeration name:

PointerSolutionVectorInvalid

Enumeration value:

71

Description:

The pointer SolutionVector is invalid.

Issue

Cause

Solution

-

At the input i_plrSolutionVector, a null pointer has been transferred.

At the input i_plrSolutionVector, the address of the memory containing the solution vector must be transferred.

PointerVectorInvalid

Enumeration name:

PointerVectorInvalid

Enumeration value:

70

Description:

The pointer Vector is invalid.

Issue

Cause

Solution

-

At the input i_plrVector, a null pointer has been transferred.

At the input i_plrVector, the address of the memory containing the vector must be transferred.

UnexpectedFeedback

Enumeration name:

UnexpectedFeedback

Enumeration value:

1

Description:

An unintended detected error occurred during execution.

ZeroLimitRange

Enumeration name:

ZeroLimitRange

Enumeration value:

74

Description:

ZeroLimit is outside the valid range.

Issue

Cause

Solution

-

At the input i_lrZeroLimit, a number <= 0 has been applied.

i_lrZeroLimit must be greater than 0.