Initial situation

This document describes parameterisation of the CNC controller's axes. The axis parameters and PLC signals needed for commissioning are discussed. It is assumed that the system has already been basically configured (number of axes and channels) and that the controller starts up without warnings or error messages.


Overview

CNC-axes can be divided into axis with drive-internal or CNC-internal position controller. With SERCOS drives both operation modes are possible. The operation mode of an axis is set in the axis parameter P-AXIS-00320 (operation_mode):

Presently the axis parameter P-AXIS-00320 (operation_mode) is used only for SERCOS axes.

Variable name | Type | Permissible range | Axis type | Dimension
operation_mode | ISG_CHAR | See strings at following table | T, R | ----

String | Significance
DRIVE_DEFAULT | Default setting for all drive types. The used operation mode ( position control in the drive, position control in the numerical control, velocity control, etc. ) is determined automatically. It depends e.g. on the drive type P-AXIS-00020 and on the configured telegram.
DRIVE_POSITION_CONTROL | In this operation mode the position or velocity control is performed in the drive.
CNC_POSITION_CONTROL | The position control is performed in the CNC.

If no operation mode is defined for an axis, the control uses the default setting. The following table shows an overview over the possible operation modes in dependency of the drive type. The default setting for each drive type is shown in bold characters.

Drive type | Position control in drive | Position control in CNC
Conventional drive |  | X
SERCOS | X | X
ProfiDrive MC | (X) | X
Drive simulation |  | X
Lightbus |  | X
Terminal (±10V) |  | X
Realtime-Ethernet |  | X
CANopen | X | X
Virtual axis |  | X

In the operation mode position control in drive the calculation of the position lag value of ProfiDrives is performed in the CNC.

The selection of the operation mode for axes with CANopen drives is done in the CNC in dependency of the configured bus telegram. The position control is performed in the drive, if command positions are transmitted. If however only a velocity command is transmitted to the drive, the position control is performed in the CNC.


Drive type specific differences

More:

button SERCOS drives with position control in the CNC


SERCOS drives with position control in the CNC

The position control of SERCOS drives is normally performed in the drive. Alternatively it is possible to use the operation mode velocity control in the drive and to calculate the position control loop in the CNC.

For the position control in the CNC the following requirements must be full-filled:

q The operation mode velocity control is active in the SERCOS-drive.

q The command velocity is transmitted to the drive (S-0-0036 is part of the cyclic telegram)

q Actual position are transmitted from the drive to the CNC (S-0-0051, S-0-0053 or S-0-0386 are part of the cyclic telegram)

q The operation mode (s. P-AXIS-00320) of the axis must be set to CNC-position control (CNC_POSITON_CONTROL)

The following restrictions exist in comparison to the position control in the drive, if the position control is performed in the CNC:

q A drive controlled reference point traverse is not possible. Instead of the drive controlled RPT a CNC-controlled reference point traverse is used.

q A zero pulse search is with the CNC-controlled reference point search for SERCOS drive is presently not supported. The axis parameter P-AXIS-00084 (homing_without_zero_pulse) must therefore be set to one.

q The delay between the command and actual values is not accounted in the calculation of the position lag (s. P-AXIS-00191).


Introduction

More:

button Differences depending on the drive type


Differences depending on the drive type

Depending on the drive type, the actual position controller for the axes is realised in the CNC or in the drive.

In the case of a so-called intelligent drive, the drive performs the task of position control, and the corresponding axis parameters for the position control loop are realised via corresponding drive parameters. In this case, the CNC's position control loop is not active and the CNC performs monitoring tasks only (e.g. following error and collision monitoring) and cyclically supplies the drive with setpoints.

If, by contrast, the CNC's position control is used (e.g. terminal drive type), a correcting variable is cyclically output to the drive. This correcting variable contains the corresponding scaling values based on the set axis parameters.

The following table lists the effects parameters discussed for the various drive types.

 | Position controller in the drive | Position controller in the CNC
Parameter | SERCOS | SERCOS | ProfiDrive MC | Lightbus | Terminal (±10V)
Measuring system resolution wegauf_z, wegauf_n |  | X | X | X | X
Gain factor of the P- position control loop Kv |  | X | X | X | X
Adaptation to D/A multi_gain_z, multi_gain_n |  | X |  | X | X
Sign vz_stellgr, vz_istw |  | X | X | X | X

Before the axes are commissioned, the electrical safety facilities, in particular the Emergency Stop facilities and hardware limit switches of the axes, must have been checked and must be operable.


Units

The following units are fundamentally used in the axis parameter lists:

Quantity | Unit
Linear position | 0.1 μm
Rotatory position | 0.1 x 10-3°
Speed | 1 μm/s or 10-3°/s
Acceleration | 1mm/s2
Time | μs
Position controller gain (Kv) | 0.01 * 1/s


Overview of the control loop parameters

The following graphic shows the position control loop used and the intervention points of the drive parameters, which are explained in the following chapters.

Figure 1: Overview of the position control loop for conventional drives


Resolution of the distance measuring system

For conversion of the increments delivered by the distance measuring system to the metric system (the unit used internally), the conversion factor must be entered in the two entries getriebe[x].wegaufz and getriebe[x].wegaufn. Thereby also eventually available gears have to be considered. The resolution is specified as a fraction, and the dimension is increments/0.1 μm or increments per 0.0001°.

Example 1:

In the case of an incremental encoder with 4096 and a spindle lead of 5 mm, the resolution is 4096 increments per 5 mm. Therefore, the following entry must be made in the axis parameter list:

getriebe[0].wegaufz 4096

getriebe[0].wegaufn 50000

Example 2:

If additional a gear is used with a transmission ratio of i = 10:1, per motor revolution this results in a distance of 5 mm / i. Therefore, the following entry must be made for wegaufz and wegaufn:

getriebe[0].wegaufz 4096

getriebe[0].wegaufn 5000

Variable name | Type | Allowed range | Dimension
wegaufz | SGN32 | MAX(SGN32) ≥ wegaufz ≥ 1 | Incr.

Variable name | Type | Allowed range | Dimension
wegaufn | SGN32 | MAX(SGN32) ≥ wegaufn ≥ 1 | 0.1µm or 0.0001°

This entry does not become directly active when the axis parameter list is updated. The control system must be restarted.

For SERCOS-drives with position controller in the CNC the resolution of the distance measuring system should be accounted in the feed constant S-0-0123 so that the quotient P-AXIS-00234/P-AXIS-00233 results to one.


Actual value and setpoint sign

It is sometimes necessary to invert the signs of the correcting variable and actual position value to adapt the correcting variable to the hardware used.

Example:

The axis is programmed in the positive direction. In actual fact, though, the mechanical system moves in the negative direction.

The two entries lr_hw[ ].vz_stellgr and lr_hw[ ].vz_istw can be used for this purpose.

When vz_stellgr is set to 1, the sign of the correcting variable that is output is inverted. When vz_istw is set to 1, increasing the position of the position sensor leads to a reduction of the axis position used in the CNC kernel.

lr_hw[0].vz_stellgr 0

lr_hw[0].vz_istw 0

Variable name | Type | Allowed range | Dimension
vz_stellgr | BOOLEAN | [0, 1] | ----

Variable name | Type | Allowed range | Dimension
vz_istw | BOOLEAN | [0, 1] | ----

This entry does not become directly active when the axis parameter list is updated. The control system must be restarted.


Position controller gain

The CNC's position controller uses a P controller for position control. The controller's gain is defined by the getriebe[x].kv parameter in the dimension 0.01/s.

In the stationary case, the following applies if the control loop is set correctly:

Where

s: following error

v: axis speed

kv: position controller gain

The following entry is necessary in the axis parameter list to set a position controller gain of 3/s.

getriebe[ ].kv 300

Variable name | Type | Allowed range | Dimension
kv | UNS32 | 0 < kv ≤ MAX(UNS32) | 0.01/s


Adapting the correcting variable to DA converter format

The two entries P-AXIS-00129 (getriebe[x].multi_gain_z) and P-AXIS-00128 (getriebe[x].multi_gain_n) are used to adapt the correcting variable calculated from the following error to the format of the D/A converter. The fraction P-AXIS-00129 / P-AXIS-00128 specifies the factor for conversion of the correcting variable to the D/A converter format and is also called multi_gain factor.

There are two possibilities for the determination of P-AXIS-00129 and P-AXIS-00128:

1. Arithmetical determination: Specify the digital value at the D/A converter input at which the axis moves at a speed of [1m/min] or [1000°/min]. For the arithmetical determination of multi_gain_z/multi_gain_n the gear transmissions, leadscrew pitch and on the driveside the scale factors for the actual velocity value have to be known.

2. Experimental determination from following error and axis velocity.

The P-AXIS-00129 and P-AXIS-00128 entries are intended solely for format adaptation of the correcting variables. The position controller gain factor P-AXIS-00099 (getriebe[].kv) must be used to optimise the control loop.

More:

button Arithmetical determination

button Experimental determination


Arithmetical determination

The multi gain factor is defined as the value of the control variable with which the axis moves with a velocity of 1 m / min bzw. 1000° / min.

In this chapter the arithmetical determination of the multi_gain factor for a lightbus and a terminal drive is shown exemplary. For this calculation the gains of all transmission elements between the velocity command value output of the control and the moved axis are needed. These are:

· Scaling factors, which effect on the velocity command value

· Gear ratios

· Leadscrew pitch

· ...

The procedure to calculate the multi_gain factor always contains the following steps:

1. Calculation of the conversion factor f from motor revolution per minute to the command value transferred in the cyclic telegram.

2. Calculation of the motor revolutions n1m/min to move the axis with a velocity of 1 m/min resp. 1000°/min.

3. The ratio of P-AXIS-00129 to P-AXIS-00128 is equal to the product
f * n1m/min.

For a SERCOS-drive with position controller in the CNC the scaling factor (P-AXIS-00129/P-AXIS-00128) is the velocity command value S-0-0036, which has to be transmitted to the drive, so that the axis moves with the velocity 1 m/min (translatory axis) or 1000 °/min (rotational axis). It depends from:

q the feed constant S-0-0123

q from the velocity data scaling factor S-0-0045 and the velocity data scaling factor exponent S-0-0046 in the drive

q the gear ratio S-0-0121 and S-0-0122

More:

button Example Lightbus drive

button Example Terminal spindle

button Example Terminal spindle with gearbox

button Example: Translatory axis with CNC position controlled SERCOS-drive

button Example: Rotational axis with CNC position controlled SERCOS-drive


Example Lightbus drive

According to the manufacturer specific default definition in the Lightbus drive for the parameter VUNIT the value 1 has to be entered. this means, the default of the rotational speed takes place thereby in revolutions per minute.

Step 1:

The conversion factor between revolutions per minute and the command value transmitted in the cyclic telegram is according to the manufacturer documentation:

So to move the motor with a speed of one revolution per minute the (rounded) output of the value 140 is necessary.

Step2:

To reach a velocity of 1 m/min with a leadscrew pitch of 5 mm and a gear ratio of I =1:1 a motor speed of

is necessary.

Step 3:

Under consideration of the velocity scaling factor f for the velocity command value for 1m/min the result is:

With that the value of [image] .

As an alternative, the multi_gain can be calculated with the following formula:

In this case Iu is the number of encoder increments per motor revolution. In case of a lightbus drive these are 65637 increments per revolution.

With a leadscrew pitch s of 5 mm/revolution and 65536 increments per revolution for wegauf_z=65536 and wegauf_n=50000 the result is:

Possible values of P-AXIS-00129 and P-AXIS-00128 would be:

P-AXIS-00129 | 27962 | 279620 | 2796202 | ...
P-AXIS-00128 | 1 | 10 | 100 | ...


Example Terminal spindle

A spindle is controlled via a DA-converter terminal KL4032, a voltage of 10 V at the input of the drive amplifier results in 9000 motor revolutions per minute. A gearbox is not used. For a terminal KL4032 with default scaling a digital output value of 32767 (0x7FFF) results in an output voltage of 10 V.

Step 1:

The conversion factor from motor revolutions per minute to the transferred setpoint value is:

To move the spindel with a velocity of 1 revolution per minute a value of 3,64 should be output to the DA-converter terminal.

Step 2:

To reach a velocity of 1000 °/min the necessary motor revolutions are:

nötig.

Step 3:

With the scaling factor f the resulting digital value for 1000°/min is:

Therefore the ratio is

Possible values of P-AXIS-00129 and P-AXIS-00128 would be:

P-AXIS-00129 | 10 | 101 | 1011 | ...
P-AXIS-00128 | 1 | 10 | 100 | ...


Example Terminal spindle with gearbox

A spindle is controlled via a DA-converter terminal KL4032, a voltage of 10 V at the input of the drive amplifier results in 9000 motor revolutions per minute. A gearbox with a gearbox ratio of I=5:1 (5 motor revolutions per one revolution at the gearbox output) is used. For a terminal KL4032 with default scaling a digital output value of 32767 (0x7FFF) results in an output voltage of 10 V.

Step 1:

The conversion factor from motor revolutions per minute to the transferred setpoint value is like in the example above:

To move the spindel with a velocity of 1 revolution per minute a value of 3,64 should be output to the DA-converter terminal.

Step 2:

Here the gearbox ratio has to be considered.

To reach a velocity of 1000 °/min ot the gearbox output the necessary motor revolutions are:

Step 3:

With the scaling factor f the resulting digital value for 1000°/min is:

Therefore the ratio is

Possible values of P-AXIS-00129 and P-AXIS-00128 would be:

P-AXIS-00129 | 50 | 506 | 5057 |
P-AXIS-00128 | 1 | 10 | 100 | ...


Example: Translatory axis with CNC position controlled SERCOS-drive

TwinCAT CNC: Overview

Example: Translatory axis with CNC position controlled SERCOS- drive

The axis moves one millimeter per motor revolution. In the drive a linear scaling is used for the position data:

Scaling factor: S-0-0077 = 1

Scaling exponent: S-0-0078 = -7

The path resolution of the measuring system is therefore: = 0,1 µm

The feed constant results from on millimeter movement per motor revolution:

S-0-0123 = [image] = 10000

Also a linear scaling is used for the velocity data:

Scaling factor: S-0-045 = 1

Scaling exponent: S-0-046 = -4

The scaling factor of the velocity data is therefore [image] .

The scaling of the correction variable is:

Extract from axis parameter list:

getriebe[0].wegaufz 1

getriebe[0].wegaufn 1

getriebe[0].multi_gain_z 10000

getriebe[0].multi_gain_n 1


Example: Rotational axis with CNC position controlled SERCOS-drive

TwinCAT CNC: Overview

Example: Rotational axis with CNC position controlled SERCOS- drive

The encoder of the axis supplies 65536 increments per revolution (S-0-0116). The rotational position resolution of the drive is therefore S-0-0079 = 65536.

The resolution of the distance measuring system is:

A rotational scaling of the velocity data is used in the drive:

Scaling factor: S-0-045 = 1

Scaling exponent: S-0-046 = -4

The scaling factor of the velocity data results to:

The necessary scaling of the correction variable is therefore:

Extract from axis parameter list:

getriebe[0].wegaufz 65536

getriebe[0].wegaufn 3600000

getriebe[0].multi_gain_z 10000000

getriebe[0].multi_gain_n 360


Experimental determination

As an alternative, you can experimentally define the ratio multi_gain_z/multi_gain_n by moving the axis at constant speed and by first determining the gain actually active in the position control loop on the basis of the following error and the axis speed.

Now the experimentally determined gain is compared with the kv factor (P-AXIS-00099) defined in the axis parameter list.

After that based on the current parameterized values of multi_gain_z and multi_gain_n the new multi_gain factor is calculated:

After change of the parameters these are to be checked again on the basis of the formula 1. The further optimization of the position control loop now is done exclusively on the basis of the parameter P-AXIS-00099 (getriebe[].kv).

If the factor f is greater than 1, with the adaptation of the multi_gain factor the complete gain of the position control loop also increases. This can lead to an oscillation of the axis.

To hold the complete gain of the position control loop constant, the position control gain P-AXIS-00099 should be set on the value P-AXIS-00099 / f .

Example:

Following error s = 1.9 mm, axis speed v = 200 mm/min, P-AXIS-00099 = 400 * 1/s, multi_gain_z = multi_gain_n = 1.

Actual gain in the position control loop

k = v/s = 200 mm / (60 s * 1.9 mm)

k = 1.75

According to formula 1 the ratio of parameterized gain and really effective gain is:

Accordingly multi_gain factor results in:

Therefore, possible entries in the axis parameter list would be:

P-AXIS-00129: getriebe[ ].multi_gain_z 2286

P-AXIS-00128: getriebe[ ].multi_gain_n 1000

Because with that entries the complete gain of the position control loop increases for the factor f, at the same time P-AXIS-0009 should be multiplicated with the factor 1/f. Because of that the complete gain of the control loop can be hold constant.

After checking of the determined parameters according to equation 1 the position control loop can be further adjusted by changing of P-AXIS-00099.


Drive releases

To move a drive, from the PLC some specific release bits have to be set on the HLI. The required releases can be set by the PLC via the corresponding control units. More detailed informations about the High-Level-Interface (HLI) and the handling with control units can be found in the documentation [HLI].

The release bits of the HLI normally are transferred to the drive amplifier with the cyclic data of the drive. They act directly inside the drive. Additionally inside the NC kernel also plausibility checks during the drive releases are executed.

For example an error messsage is created, if an axis is tried to move by the NC and the necessary release is not set.

The releases are active axis specifically and they are defined in the HLI sector
pAC[Achsindex]^.addr^.McControlLr_Data.

The control units for the drive releases are:

q MCControlBoolUnit_DriveOn: Drive ON (Abbreviation: DriveOn).

q MCControlBoolUnit_TorquePermission: Activation of the drive internal position or velocity controller. The drive creates a torque and turns into control mode (Abbreviation: TorquePermission).

q MCControlBoolUnit_ReleaseFeedhold: Resetting of the drive internal feed hold (Abbreviation: ReleaseFeedhold).

Because not all drive types support the previously described functions, the following table gives an overview about the drive types and their necessary releases. After that in the following chapters the single drive types are described in detail. In the following table an X means, that the assigned function is supported by the drive and that the corresponding release has to be set on the HLI:

Control-Unit | SERCOS | PROFIDRIVE | Terminal | Lightbus | RTEthernet | CANopen
DriveOn | X | X |  |  |  | X
TorquePermission | X | X | X | X | X | X
Release Feedhold | X |  |  |  |  | X


Drive states

Digital drives supply inside the cyclic telegram informations about the internal drive state. This informations are evaluated inside the NC kernel and then they are made available for the PLC on the HLI.

The state signals can be red in the sector:

pAC[achs_index]^.addr^.StateLR_Data

There the signals are:

q X_ReadyPowerOn: The drive is ready for power connection.

q X_ReadyControlLoopOn: The drive turns into control. If the required releases (see chapter 3.1) are set, the drive follows the position commands of ther NC kernel.

Dependend on the drive type not all signals are supported on the HLI: The following table gives an overview about which drive type supports which state signals.

State signal | SERCOS | PROFIDRIVE | Terminal | Lightbus | RTEthernet | CANopen
ReadyPowerOn | X | X |  | X | X | X
ReadyControl-LoopOn | X | X |  |  |  | X


Drive releases/ Drive state of the different drive types

More:

button SERCOS-Drives


SERCOS-Drives

For SERCOS drives the following release and state signals are supported:

q MCControlBoolUnit_DriveOn: Release of power connection inside the drive. (Abbreviation: DriveOn). This release bit is entered directly in bit 15 of the SERCOS control word.

q MCControlBoolUnit_TorquePermission: : Activation of the drive internal position or velocity controller. The drive turns into control mode (Abbreviation: TorquePermission).

q MCControlBoolUnit_ReleaseFeedhold: Resetting of the drive internal feed hold (Abbreviation: ReleaseFeedhold).

q X_ReadyPowerOn: The drive is ready for power connection.

q X_ReadyControlLoopOn: The drive turns into control. If the required releases (see chapter 3.1) are set, the drive follows the position commands of ther NC kernel.


Generals

TwinCAT CNC: Overview

General s

Stepping motors can be connected to the CNC by the terminals KL2521, KL2531 and KL2541. These terminals transform the velocity command values of the CNC into a suitable signal format for the control of stepping motors.

The terminal KL2521 generates a suitable output signal for the control of a stepping motor end phase (e.g. a pulse-direction-signal). The terminals KL2531 and KL2541 already include power end phases for the direct control of 2 phase stepping motors.


Possibilities of configuration

In the process image the number of the current generated steps is supplied by all of the terminals mentioned above. Additional the terminal KL2541 offers the possibility, to connect directly an incremental encoder.

More:

button Operation without encoder

button Operation with encoder


Operation without encoder

During the operation without encoder the generated pulses of the terminal are supplied as actual positions to the CNC internal position controler. The velocity command values, calculated by the position controler, are supplied to the stepping motor terminal and causes the movement of the stepping motor.

Because the drive is operated in a pseudo position control loop, the parameterization of the stepping motor in the axis parameter list is done by analogy with the parameterization of a drive with +/- 10V interface. Also here the use of the velocity pre-control is possible (see also chapter 1.7.1).

The position lag monitoring of the axis is not possible, because no real position feedback of the axis is available.

Since a stepping motor can loose steps or stops moving at dynamic overloading (loosing synchronism of the stepping motor), the dimensioning and parameterization of the dynamic parameters of the motor has to be done with special care.


Operation with encoder

During the operation with encoder the actual position value of the motor is supplied as real actual value to the position controler. This is adjusted during the configuration of the drive. The encoder input of the axis is linked with the encoder terminal and not with the position feedback of the stepping motor terminal.

An incremental encoder can be connected directly to the terminal KL2541. The terminal has to be parameterized in that way, that it insert the encoder signal into the output process image.

Also during the operation with encoder a stepping motor can loose steps or stops moving at dynamic overloading (loosing synchronism of the stepping motor). And also here the dimensioning and parameterization of the dynamic parameters of the motor has to be done with special care.

But in contrast to the operation without encoder the use of position lag monitoring is possible.


Functional restrictions

Because in the cyclic process image of the terminal KL2541 a possibly latched value is not available, the following features

- Homing with zero pulse

- Measuring

also are not available.

If these features still are activated, the values are corrected automatically and an error message is generated.