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 will be the same but calculation errors or input data precision can cause the two distances to be slightly different. If validation fails then PLCopen A vendor -and product- independent worldwide association active in Industrial Control and aiming at standardizing PLC file formats based on XML error 50 ("Cannot construct a circle with specified parameters", see "PLCopen Function Block ErrorID Output") will be returned from the function block. Input parameters are validated using the methods described below.
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.
|
There are two methods for validating the circle parameters, the default method and a method using a custom tolerance.
-
-
If MC_GRP_PARAM_CIRCLE_TOLERANCE is set to zero (0), the default validation method will be used.
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 then this requirement will be 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, then the validation will fail and PLCopen error 50 will be returned from the function block. will be returned from the function block.
Examples of Default Validation
- If the desired circle has a radius of 50 user units, then the center must be specified with a precision of 0.0005 user units.
- If the desired circle has a radius of 2,000 user units, then the center must be specified with a precision of 0.02 user units.
- If the desired circle has a radius of 500,000 user units, then the center must be specified with a precision of 5 user units.
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 will fail if ∆ exceeds the value of the group parameter MC_GRP_PARAM_CIRCLE_TOLERANCE and PLCopen error 50 will be 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. For example, the LREAL version of cos is cosl. This will help avoid errors.