FC_ProfileInvCompute - General Information
|
Type: |
Function |
|
Available as of: |
V1.0.3.0 |
|
Versions: |
Current version |
Determination of the master position of a cam to a slave position
The function starts with a linear search from i_lrXStart with the step distance i_lrXIncr. If a sign reversal is detected in the difference of i_lrYPos – Y(Xi), the section containing the solution has been found.
A binary iterative procedure is then used in this section in order to find the result q_lrXPos.
The function is ended after either
|i_lrYpos – Y(XPos)| <= i_lrAccuracy or after a maximum of 20 passes.
|
Input |
Data type |
Description |
|---|---|---|
|
i_diProfileId |
DINT |
Id of the underlying profile |
|
i_lrYPos |
LREAL |
Slave position to which a master position is to be found. |
|
i_lrXOffset |
LREAL |
Offset of the master encoder position |
|
i_lrYOffset |
LREAL |
Offset of the slave axis position |
|
i_lrXFactor |
LREAL |
Scaling factor of the master encoder |
|
i_lrYFactor |
LREAL |
Scaling factor of the slave axis |
|
i_lrXStart |
LREAL |
Start value for the search |
|
i_lrXIncr |
LREAL |
Step distance for the search |
|
i_lrAccuracy |
LREAL |
Accuracy of the result at which the iteration is to be canceled. |
|
Output |
Data type |
Description |
|---|---|---|
|
q_etDiag |
General library-independent statement on the diagnostic. A value not equal to ET_Diag.Ok corresponds to an diagnostic message. |
|
|
q_etDiagExt |
POU-specific output on the diagnostic. q_etDiag = ET_Diag.Ok -> Status message q_etDiag <> ET_Diag.Ok -> Diagnostic message |
|
|
q_lrXPos |
LREAL |
Master encoder position relative to the slave axis position i_lrYPos |
Cam with three X positions for one Y position
Example for finding multiple solutions:
lrXStart := lrXOffset;
i := 0;
WHILE lrXStart + lrXIncr < lrXOffset + lrXFactor DO
FC_ProfileInvCompute(i_diProfileId := diProfileId,
i_lrYPos := lrYPos,
i_lrXOffset := lrXOffset,
i_lrYOffset := lrYOffset,
i_lrXFactor := lrXFactor,
i_lrYFactor := lrYFactor,
i_lrXStart := lrXStart,
i_lrXIncr := lrXIncr,
i_lrAccuracy := lrAccuracy,
q_etDiag : etDiag,
q_etDiagExt : etDiagExt,
q_lrXPos := lrXPos);
IF etDiag <> Ok THEN
EXIT;
END_IF
alrXPos[i]:= lrXPos; (* save result *)
i := i + 1; (* number of valid results *)
lrXStart := lrXPos + lrXIncr / 2.0; (*Start of next search *)
END_WHILE
|
q_etDiag |
q_etDiagExt |
Enumeration value |
Description |
|---|---|---|---|
|
OK |
0 |
Ok |
|
|
ExecutionAborted |
96 |
The maximum number of iteration steps has been exceeded. |
|
|
InputParameterInvalid |
118 |
Accuracy is outside the valid range. |
|
|
InputParameterInvalid |
114 |
The ProfileId is invalid. |
|
|
InputParameterInvalid |
115 |
XFactor is outside the valid range. |
|
|
InputParameterInvalid |
117 |
XIncr is outside the valid range. |
|
|
InputParameterInvalid |
119 |
XStart is outside the valid range. |
|
|
InputParameterInvalid |
120 |
YPos is outside the valid range. |
|
|
UnexpectedProgramBehavior |
116 |
The profile is already in use. |
|
|
UnexpectedProgramBehavior |
1 |
An unintended detected error occurred during execution. |
|
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 1E-10 has been applied. |
A value greater than zero has to be specified. |
|
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 a result in not less than Gc_diMaxNumberOfIterations iteration steps. |
A higher value must be chosen for i_lrAccuracy. |
|
Enumeration name: |
Ok |
|
Enumeration value: |
0 |
|
Description: |
Ok |
The master position has been determined successfully.
|
Enumeration name: |
ProfileAlreadyInUse |
|
Enumeration value: |
116 |
|
Description: |
The profile is already in use. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
The motion profile is already in use. |
Verify the motion data. |
|
Enumeration name: |
ProfileIdInvalid |
|
Enumeration value: |
114 |
|
Description: |
The ProfileId is invalid. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
The profile does not exist. |
Verify the value at the input i_diProfileId. |
|
Enumeration name: |
UnexpectedFeedback |
|
Enumeration value: |
1 |
|
Description: |
An unintended detected error occurred during execution. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
An error occurred in the internal execution. |
Please inform the support team about this error. |
|
Enumeration name: |
XFactorRange |
|
Enumeration value: |
115 |
|
Description: |
XFactor is outside the valid range. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
At the input i_lrXFactor, a value 0 has been applied. |
i_lrXFactor must not be 0. |
|
Enumeration name: |
XIncrRange |
|
Enumeration value: |
117 |
|
Description: |
XIncr is outside the valid range. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
At the input i_lrXIncr, a number <= 0 has been applied. |
i_lrXIncr must be greater than 0. |
|
Enumeration name: |
XStartRange |
|
Enumeration value: |
119 |
|
Description: |
XStart is outside the valid range. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
At the input i_lrXStart, a number that lies outside of the cam has been applied. |
Verify i_lrXStart and set it to a value exceeding i_lrXOffset. Verify i_lrXStart and set it to a value smaller than i_lrXOffset + i_lrXFactor - i_lrXIncr. |
|
Enumeration name: |
YPosRange |
|
Enumeration value: |
120 |
|
Description: |
YPos is outside the valid range. |
|
Issue |
Cause |
Solution |
|---|---|---|
|
- |
At the input i_lrYPos, a value has been applied which cannot be reached by the master in the specified section of the cam. |
Verify the definition of the cam. Verify the start position i_lrXStart. |