Precision Requirements for Circular Move Input Parameters
The input parameters to MC_MoveCircAbs and MC_MoveCircRel are validated when constructing a circle.
- The distance of the center point from the start and end points is checked.
- Ideally, the two distances are the same but calculation errors or input data precision can cause the two distances to be slightly different.
- If the validation fails, PLCopen error 50 (Cannot construct a circle with specified parameters) is returned from the function block.
Parameter Validation
Input parameters are validated using these methods:
See PLCopen Function Block ErrorIDs.
Here is a circle we want to create.
The distances from the center to the start and end point are measured as r1 and r2 respectively.
|
The methods for validating the circle parameters are:
-
-
If MC_GRP_PARAM_CIRCLE_TOLERANCE is set to zero (0), the default validation method will be used.
Default Validation Method
- The difference between the two measurements must not be larger than one part in 100,000.
- If all positions are specified to six significant digits, this requirement is met.
- Assuming that r2 is greater than r1, we can write r2 in terms of r1 and a small deviation value named ε:
r2= r1(1+ε)
- If ε exceeds a value of 10-5, the validation fails.
- A PLCopen error 50 is returned from the function block.
Examples of Default Validation
If the desired circle has a radius of:
- 50 user units, the center must be specified with a precision of 0.0005 user units.
- 2,000 user units, the center must be specified with a precision of 0.02 user units.
- 500,000 user units, the center must be specified with a precision of 5 user units.
Validation with Custom Tolerance
A custom tolerance can be specified via the group parameter MC_GRP_PARAM_CIRCLE_TOLERANCE.
- See Axes Group Parameters.
- This parameter represents the amount of error allowed, measured in user units.
- The parameter can be set by using MC_GrpWriteParam and can be read via MC_GrpReadParam.
- Assuming that r2 is greater than r1, we can write r2 in terms of r1 and a deviation value named ∆:
r2= r1 + ∆
- The validation fails if ∆ exceeds the value of the group parameter MC_GRP_PARAM_CIRCLE_TOLERANCE.
- A PLCopen error 50 is returned from the function block.
Examples of Validation using a Custom Tolerance
- If r1 has a value of 50 user units and the circle tolerance parameter is .1 user units, then r2 must be in the range of 49.9 to 50.1 user units.
- If r1 has a value of 2000 user units and the circle tolerance parameter is 1 user units, then r2 must be in the range of 1999 to 2001 user units.
-
-
Use LREAL variables and LREAL versions of math functions when calculating the desired circle parameters inside a KAS application.
The LREAL versions of functions usually have an ‘l’ at the end of their name.
Example: The LREAL version of cos is cosl.
This helps avoid errors.