ComputeMasterPositions
Finds the master position(s) for a given slave position.
Returns 0 on success or a non-zero error code.
Syntax
Definition:
METHOD ComputeMasterPositions : UDINT
VAR_INPUT
SlavePosition : LREAL;
SlavePositionPrecision : LREAL;
MasterMinPosition : LREAL;
MasterMaxPosition : LREAL;
MasterPositionTolerance : LREAL;
DestinationAddress : Pointer To LREAL;
NumberOfMasterPositions : UDINT;
END_VAR
VAR_OUTPUT
NumberOfMasterPositionsFound : UDINT;
END_VAR
Inputs
Name | Type | Description |
|---|---|---|
SlavePosition | LREAL | Position of the slave axis for which the master positions are to be determined. |
SlavePositionPrecision | LREAL | Absolute precision for which a slave position at a certain master position is considered equal to the SlavePosition input (must be larger than 0, e.g. 1E-3). |
MasterMinPosition | LREAL | Leftmost limit of the cam profile range to be evaluated. |
MasterMaxPosition | LREAL | Rightmost limit of the cam profile range to be evaluated. |
MasterPositionTolerance | LREAL | Minimum distance between distinct master positions found (must be larger than 0, e.g. 1E-3). |
DestinationAddress | Pointer To LREAL | Pointer to the destination array for found master positions. |
NumberOfMasterPositions | UDINT | Capacity of the DestinationAddress array. |
Outputs
Name | Type | Description |
|---|---|---|
NumberOfMasterPositionsFound | UDINT | Number of master positions found matching the given slave position and master position range. |
Return value
UDINT
Possible error codes
For this function block, the following values, among others, are possible for the ErrorId output:
Error(Hex) | Error(Dec) | Error type | Description |
|---|---|---|---|
0x8120 | 33056 | Environment | Invalid configuration for object (e.g., in TwinCAT 3 Engineering (XAE)). The static configuration of the object (parameters, init values, linked symbols) is incomplete or invalid, so the object cannot reach the target state. |
An overview of all NC error codes can be found here: