Compensation Table

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

Introduction

Groups allow you to control multiple axes as a single mechanism. With groups, the position command and feedback signals are no longer single values, but instead, are vectors with two or three elements. Velocity and acceleration no longer apply to a motor, but instead, apply to the combination of two or three motors moving in concert.

Some applications require high accuracy in position, so compensate for mechanical inaccuracies in the system is required. The softMC allows you to define a table of corrections for one or more axes. This table defines a correction to the positioned command given to the axes, depending on its location or other axes locations. This correction is achieved every cycle. The compensation table is usually created by high accuracy tools and is then used by the softMC to correct small inaccuracies. The correction can also take affect when the target axis is part of a group.

Specification

The compensation table is constructed from N axes, for which compensation is defined. The number of rows in the table will be:
k1*k2*….*kn
where k1 through kn are the number of correction points defined for the axes A1 through An, respectively. The “source” positions (in source axis position units) must be equally spaced and monotonously increasing, while the “compensations” (in target user position units) are the corrections added to the “target" axes.

A compensation table of 3 axes source on 3 axes target is shown below.

The Header
3 10 2
Source - axis location Target - axis compensation
1 3.1 4.5 0 0.5 0.9
2 3.1 4.5 0.9 0.51 0.2
6 3.1 4.5 2.0 0.5 0.9
1 3.2 4.5 0 0.1 0.9
2 3.2 4.5 0.65 0.01 0.9
6 3.2 4.5 3.0 0.22 0.9
6 4 4.5 2.0 0.2 0.9
1 3.1 5.0 0 0.1 0.87
6 4 5.0 1 1 1.2

The value in the table is locked and calculated according to the source axis PCMD and is linearly transformed. The source axes determine the correction value, depending on location. The target axes are corrected.

The table has a header which consists of the number of axes in the table followed by the number of compensation points defined for each axis.

The table can be created by the softMC using TargetData , SourceData, and CreateComp, or can be loaded from a binary file with a .CMP extension.

The correction takes affect when all source axis position feedback reach the first (i.e., the minimal) value in the table. The target axes are added and the value calculated in the table to its current PCMD and PFB.

The values in the source columns are in absolute units, while the target values are in relative units (i.e., the value specified in the table is added to the current position of the axis, whether it is a geared, cammed or a regular axis). A value different from 0 at the beginning of the table causes a jump at the target axes whenever the source axes get to the minimum value specified in the table.

The difference between the corrected position (COMPPCMD) and the actual position feedback determines the position error of the target axes. PCMD returns the position of the generator before correction. The source PFB (for example, source1.pcmd=1, source2.pcmd=3.2, source3.pcmd=4.5) is searched in the table and linearly transformed from the previous points in the table to give the correction for the target positions.

While the source axis continues its movement along the specified zone, the target axes change their positions according to the table. When one of the sources goes beyond the max value there are no more correction added for any of the axes in the table (correction=0). A jump may occur. Correction values are assumed very small and will not cause a large jump in the target axis. VOSPD and PEMAX are affected by the corrected position. Change these values accordingly to avoid exceeding the maximum values. While the compensation table is active, the values of the table cannot be changed. After the table is created, only the “target” values can be change.

Access Data

The compensation table data is arranged in the form of following target data for the points for each individual axis. If there are three axes (A1, A3, A3), there are three (N1, N2, N3) compensation points defined. To calculate the index to access the table with the indexes i, j, k for A1,A2,A3, use:
index = i + j*N1 + k*N1*N2

Definition

The compensation table is defined as a global variable.

Common shared comp1 as comp
CreateComp Comp1 3 ,4, 8
Creates a table with 3*4*8 number of rows and 
6 number of columns – 3 for the source & 3 for the target.
CompSet Comp1 A1 ,A3, A4 on A2, A6, A5
Sources A1 A3 A4 and targets A2 A6 A5 respectively.

The maximum and minimum positions of the table are set for every axis in the compensation table as well as a multiplier:

Comp1.minposition[2] = 1.32
Comp1.maxposition[2] = 4.5
Set the maximum value for the second axis in the table

Load/Save From a File

Another way to create a compensation table is to directly load it from a binary file stored on the Flash disk. The structure of the compensation file is:

  • Header – <number of axes> <number of points axis1> ….<number of points axisn> (integer 4 bytes)
  • Source data – <min axis1> <max axis1>…..<min axisn><max axisn> (double 8 bytes)
  • Target data – target values for axis1,…….target values for axisn. (double 8 bytes)

The file can be created directly from Basic Moves by loading a list of values (arranged as described above) in a .CSV format into the MC's Flash as a binary file with the CMP extension (refer to LoadCompData and StoreCompData).

Set and Query Values

While the compensation table is not active, you can change a specific target value.

Comp1.targetdata[1][23] = 3
Set a new compensation value of index 23 of Axis1
?Comp1.sourcedata[2][24]
Read the source value index 23 of Axis1

Activate Table

After defining the correction table turn it ON/OFF with CompActive. Before activating, a check is performed to insure that the table is valid (the points are evenly spaced and increasing). After validation and enabling the target axis, positions of the target axes are corrected using the value calculated from the compensation table. If a target axis is disabled, the correction takes effect only after the axis is enabled.

NOTE-Info.svgNOTE
A jump may occur when the compensation procedure starts

from a point other than the start point of the table. A jump may also occur if the compensation process is disabled before reaching the end of the table.

Query the Actual Positions

The actual positions are return by CompPcmd and CompPfb. These properties can be operated as the master source for a slave – geared or cammed. PCMD and PFB return the command and feedback positions without compensation.

Multi-Dimensional Correction

In the following example, the correction is performed on several axes. In the described system, there are three axes (X, Y, Z). The X, Y, Z position corrections are determined according to the location of the X, Y, and Z axes.

The table is composed from 4, 9, 3 entries for X, Y, Z axes, respectively.

Common shared comp1 as comp ‘This declares a table in the system.
CreateComp comp1 4 ,9, 3
Comp1.minposition[1] = 0.1 ‘Setting min for the X
Comp1.maxposition[1] = 9 ‘Setting max for the X
Comp1.minposition[2] = 1.1 ‘Setting min for the Y
Comp1.maxposition[2] = 2 ‘Setting max for the Y
Comp1.minposition[3] = 3 ‘Setting min for the Z
Comp1.maxposition[3] = 3.12 ‘Setting max for the Z
CompSet comp1 ax1 ,ax2, ax3 on ax1 ,ax2, ax3 ‘Declare before target data definition
Comp1.TargetData[1][1] = 0.01 ‘Setting the target
Comp1.TargetData[3][3*9*4] = 0.02 ‘Setting the target
Comp1.CompActive=1

From now on, any movement on any of the axes in the table generates compensation.

Example

See: Application_Note_Compensation_Example.PDF