FC_DistanceTwoBoxes

 

FC_DistanceTwoBoxes - General Information

Overview

Type:

Function

Available as of:

V1.0.3.0

Versions:

Current version

Task

Calculates the distance between two cuboids.

Description

Calculates the distance between the cuboids i_stBox1 and i_stBox2. For this purpose, an iteration process is used.

Interface

Input

Data type

Description

i_stBox1

ST_Box

Cuboid 1

i_stBox2

ST_Box

Cuboid 2

i_lrAccuracy

LREAL

Maximum permissible error for the calculated distance.

The iteration process aborts if the calculated distance of the objects deviates from the exact distance by less than this value. The lower this value is, the more exact is the result and the higher the number of the necessary iteration steps.

Value range: > 0.0

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

q_lrDistance

LREAL

Calculated distance between i_stBox1 and i_stBox2

q_diNumberOfIterations

DINT

Number of iteration steps which were required for the distance calculations.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

ExecutionAborted

MaxNumberOfIterationsExceeded

96

The maximum number of iteration steps has been exceeded.

InputParameterInvalid

AccuracyRange

118

Accuracy is outside the valid range.

InputParameterInvalid

DefinitionBox1

35

The definition of Box1 is not correct.

InputParameterInvalid

DefinitionBox2

36

The definition of Box2 is not correct.

UnexpectedProgramBehavior

UnknownState

2

The POU is in an undefined state.

AccuracyRange

Enumeration name:

AccuracyRange

Enumeration value:

118

Description:

Accuracy is outside the valid range.

Issue

Cause

Solution

-

At the input i_lrAccuracy, a number smaller than Gc_lrZeroTolerance has been applied.

A value greater than zero has to be specified.

DefinitionBox1

Enumeration name:

DefinitionBox1

Enumeration value:

35

Description:

The definition of Box1 is not correct.

Issue

Cause

Solution

-

At the inputs i_stBox1.stSpanPoint1 and i_stBox1.stBasePoint, the same point has been transferred.

The distance between i_stBox1.stSpanPoint1 and i_stBox1.stBasePoint must be at least Gc_lrZeroTolerance.

-

At the inputs i_stBox1.stSpanPoint2 and i_stBox1.stBasePoint, the same point has been transferred.

The distance between i_stBox1.stSpanPoint2 and i_stBox1.stBasePoint must be at least Gc_lrZeroTolerance.

-

At the inputs i_stBox1.stSpanPoint3 and i_stBox1.stBasePoint, the same point has been transferred.

The distance between i_stBox1.stSpanPoint3 and i_stBox1.stBasePoint must be at least Gc_lrZeroTolerance.

DefinitionBox2

Enumeration name:

DefinitionBox2

Enumeration value:

36

Description:

The definition of Box2 is not correct.

Issue

Cause

Solution

-

At the inputs i_stBox2.stSpanPoint1 and i_stBox2.stBasePoint, the same point has been transferred.

The distance between i_stBox2.stSpanPoint1 and i_stBox2.stBasePoint must be at least Gc_lrZeroTolerance.

-

At the inputs i_stBox2.stSpanPoint2 and i_stBox2.stBasePoint, the same point has been transferred.

The distance between i_stBox2.stSpanPoint2 and i_stBox2.stBasePoint must be at least Gc_lrZeroTolerance.

-

At the inputs i_stBox2.stSpanPoint3 and i_stBox2.stBasePoint, the same point has been transferred.

The distance between i_stBox2.stSpanPoint3 and i_stBox2.stBasePoint must be at least Gc_lrZeroTolerance.

MaxNumberOfIterationsExceeded

Enumeration name:

MaxNumberOfIterationsExceeded

Enumeration value:

96

Description:

The maximum number of iteration steps has been exceeded.

Issue

Cause

Solution

-

i_lrAccuracy has been chosen too small. The numerical approximation method converges to such an result in not less than Gc_diMaxNumberOfIterations iteration steps.

A higher value must be chosen for i_lrAccuracy.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The distance has been calculated successfully.

UnknownState

Enumeration name:

UnknownState

Enumeration value:

2

Description:

The POU is in an undefined state.

Issue

Cause

Solution

-

An error occurred in the internal execution.

Please inform the support team about this error.