Electronic Gearing – TML Programming Details

In the electronic gearing a drive/motor may operate as master or as slave.

When set as master, the drive/motor sends its position via a multi-axis communication channel, like the CANbus. When set as slave, the drive/motor follows the master position with a programmable gear ratio.

Master operation

The master operation can be enabled with the TML command SGM followed by an UPD (update) and can be disabled by the TML command RGM followed by an UPD. In both cases, these operations have no effect on the motion executed by the master.

Once at each slow loop sampling time interval, the master sends either its load position APOS (if OSR.15 = 0) or its position reference TPOS (if OSR.15 = 1) to the axis or the group of axes specified in the TML parameter SLAVEID. The SLAVEID contains either the axis ID of one slave or the value of a group ID+256 i.e. the group of slaves to which the master should send its data.

Remark: The group ID is an 8-bit unsigned value. Each bit set to 1 represents a group: bit 0 – group 1, bit 1 – group 2, etc. In total there are 8 groups. For example, if the master sends its position to group 3, the group ID = 4 (00000100b) and the SLAVEID is 4+256 = 260.

The master operation can be synchronized with that of the slaves. The synchronization process is performed in two steps. First, the master sends a synchronization message to all axes, including to itself. When this message is received, all the axes read their own internal time. Next, the master sends its internal time to all the slaves, which compare it with their own internal time. If there are differences, the slaves correct slightly their sampling periods in order to keep them synchronized with those of the master. As effect, when synchronization procedure is active, the execution of the control loops on the slaves is synchronized with those of the master within a 10μs time interval. Due to this powerful feature, drifts between master and slave axes are eliminated. The synchronization procedure is activated with the TML command SETSYNC value where value represents the time interval in internal units between the synchronization messages sent by the master. Recommended value is 20ms.

If the master is going to be activated with slaves already set in electronic gearing, an initialization is necessary before enabling the master operation: the master must set the TML parameter MPOS0 on all the slaves with a non-zero value, for example 1.

Slave operation

The slaves can get the master position in two ways:

1.Via a communication channel, from a drive/motor set as master
2.Via an external digital reference of type pulse & direction (if ACR.2=1) or quadrature encoder (if ACR.2 = 0). Both options have dedicated inputs. The pulse & direction signals are usually provided by an indexer and must be connected to the pulse & direction inputs of the drive/motor. The quadrature encoder signals are usually provided by an encoder on the master and must be connected to the 2nd encoder inputs.

You can activate the first option with the TML command: EXTREF 0 and the second option with the TML command EXTREF 2. Both become effective at the next UPD command.

In slave mode the drive/motor performs a position control. At each slow loop sampling period, the slave computes the master position increment and multiplies it with its programmed gear ratio. The result is the slave position reference increment, which added to the previous slave position reference gives the new slave position reference.

Remark: The slave executes a relative move, which starts from its actual position

The gear ratio is specified via 3 TML parameters: GEAR, GEARSLAVE and GEARMASTER. GEARSLAVE and GEARMASTER represent the numerator and denominator of the Slave / Master ratio. GEARSLAVE is a signed integer, while GEARMASTER is an unsigned integer. GEARSLAVE sign indicates the direction of movement: positive – same as the master, negative – reversed to the master. GEAR is a fixed value containing the result of the ratio i.e. the result of the division GEARSLAVE / GEARMASTER. GEAR is used to compute the slave reference increment, while GEARSLAVE and GEARMASTER are used by an automatic compensation procedure which eliminates the round off errors which occur when the gear ratio is an irrational number like: 1/3 (Slave = 1, Master = 3).

The TML parameter MASTERRES provides the master resolution which is needed to compute correctly the master position and speed (i.e. the position increment). MASTERRES is a 32-bit long integer value, expressed in the master position units. If master position is not cyclic (i.e. the resolution is equal with the whole 32-bit range of position), set master resolution to 0x80000001.

When master position is provided via the external digital interface, the slave computes the master position by counting the pulse & direction or quadrature encoder signals. The initial value of the master position is set by default to 0. It may be changed to a different value by writing the desired value in the TML variable APOS2.

TML commands REG_ON/REG_OFF enable/disable the superposition of the electronic gearing mode with a second motion mode. When this superposed mode activated, the position reference is computed as the sum of the position references for each of the 2 superposed motions.

You may enable the superposed mode at any moment, independently of the activation/deactivation of the electronic gearing slave. If the superposed mode is activated during an electronic gearing motion, any subsequent motion mode change is treated as a second move to be superposed over the basic electronic gearing move, instead of replacing it. If the superposed mode is activated during another motion mode, a second electronic gearing mode will start using the motion parameters previously set. This move is superposed over the first one. After the first move ends, any other subsequent motion will be added to the electronic gearing.

When you disable the superposed mode, the electronic gearing slave move is stopped and the drive/motor executes only the other motion. If you want to remain in the electronic gearing slave mode, set first the electronic gearing slave move and then disable the superposed mode.

You can smooth the slave coupling with the master, by limiting the maximum acceleration on the slave. This is particularly useful when the slave is must couple with a master running at high speed. The feature is activated by setting UPGRADE.2=1 and the maximum acceleration value in CACC.

Remark: When slave coupling with the master is complete SRH.12 = 1. The same bit is reset to zero if the slave is decoupled from the master. The bit has no significance in other motion modes.  

See also:

Electronic Gearing – Related TML Instructions and Data

TML Description