|
|
Topic: P249 |
Understanding Maximum Position Cycle and Minimum Position Accuracy |
|
Unit scaling is a feature in both the HSO and HSI configurations that allows the user to define actual real world machine units in the CPU program to make programming easier to understand. Programming an axis to move 36 inches instead of 20,000 counts may make more sense. Unit scaling, however, comes with a price (which may or may not affect the application) since there is a finite Maximum Position Cycle (MPC) that resides in the motion modules. The MPC is the range, defined in the units specified, in which the current position of a given channel will reside and will not exceed . If no user scaling is used, the MPC is ±231 or ±2,147,483,647 counts (Int32 range); or ±223 or ±8, 338,608 counts (Float32 range). Scaling usually increases the number of counts or pulses per unit which forces the MPC to become smaller. For instance, if 100 counts equal an inch of movement on the machine, then the MPC will be ±21,474,836 (assuming Integer Datatwwype) inches. The motion module configuration allows the user to adjust the accuracy of the position versus the size of the MPC to what makes the most sense for the application.
There are two position datatype choices available: Integer and Float. Selecting the Integer Position Datatype (default) allows for the largest possible MPC since there are 31 bits available for position storage. Selecting the Float Position Datatype restricts the MPC since there are 23 bits (single-precision floating point) available for position storage which has a range of ±223 or ±8, 338,608. Selecting the Float datatype also enables the Minimum Position Accuracy (MPA) selection. The MPA allows the user to choose the minimum amount of accuracy the floating point position data should have. The selections are 0.1, 0.01, 0.001, and 0.0001. Again, the size of the MPC is usually affected by this selection but not always: the higher accuracy selections usually makes the MPC size decrease.
Note: The position value in all tags dealing with motion instructions and configurations will be accurate to the MPA selected.
The MPC is found by dividing the maximum possible value (231 for Integer or 223 for Float) by the number of counts per unit. If the number of counts per unit has a fractional component, then that too affects the outcome. For instance, if the fractional part is two digits to the right of the decimal point then the MPC will be divided again by 100.
If an Integer datatype is selected and 100.0 counts per unit is configured, then the MPC is calculated to be ±21,474,836 counts. However, if 100.25 counts per unit is configured, the MPC will be ±214,212 (roughly 100 times less) because of the fractional part being two places to the right of the decimal point. This is to allow room for partial counts to be passed to and from the module. If a SMOV instruction was to move 4 units, with the 100.25 counts per unit configured, then the actual number of pulses out would be 401. As you can see, even with the Integer datatype the 0.25 counts per unit is preserved.
If a Float datatype is selected and 100.0 counts per unit is configured, then the MPC is calculated to be ±83886.1 counts. However, if 100.25 counts per unit is configured, the MPC will be ±83.7 (roughly 1000 times less) because of the fractional part being two places to the right of the decimal point as well as the accuracy selected. As you can see, fractional encoder counts combined with higher accuracy results in a greatly reduced MPC.
There are also instances when the accuracy level that is selected does not affect the MPC. This normally happens as the number of pulses per unit becomes larger. For instance, if the pulses per unit is set to 100 then the MPC range has the same magnitude when the MPA is set to either 0.1 or 0.01. This is normal and in this case, a command of one unit in an instruction will result in 100 pulses on the output. Once the position feedback tag is updated it will be accurate to a minimum of one pulse or 0.01 units. If 1000 pulses per unit is configured, the 0.1, 0.01, or 0.001 MPA settings will have the same magnitude MPC.
It is recommended that the most accurate MPA setting available be selected that has minimal loss of MPC and in most cases the MPC will be sufficient for the application. Below are a few guidelines to help you understand the interaction between these two entries.
If fractional unit commands are not needed, use the Integer Position Datatype. This will result in a larger available Maximum Position Cycle. The range of the MPC is generally only a concern in applications where absolute positioning is used or where extremely long with high accuracy lengths are measured.
Use a compatible tag for the Position Datatype selected. If Integer is selected, use Int32 tags (especially for feedback). If Float is selected, use Float32 tags. Mixing the two may result in undesired results. For instance, if the Integer Position Datatype, with a range of ±2,147,483,647 counts, is selected and a Float32 tag, with a range of ±8, 338,608, is used for the position feedback, then the returned position value could exceed the range of the float tag yielding an inaccurate value.
Partial or an uncommon value of counts (or pulses) per unit will lower the Maximum Position Cycle range. In general, non-partial encoder counts with common values will have the highest available MPC. For instance, 1000 counts per unit using Float Datatype will result in ±2,147,483 MPC. Changing it to 1000.1, will lower the MPC further by a factor of 10 to ±214,726.
Note: The MPC has the greatest range if multiplying the counts per unit by Minimum Position Accuracy (for Integer Datatype =1) results in an integer value. Any fractional products will result in a smaller available MPC where the more places to the right of the decimal point, the smaller the possible range.
Use the highest possible MPA available for a given MPC using Float Position Datatype. This will give you the greatest accuracy without further sacrificing the size of the MPC.