Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


TwinCAT NC: Camming

Overview

Traditionally, non-linear coupling of electrical master and slave axes is referred to as a cam disc. TwinCAT offers different options for this type of axis coupling. One option are classic position tables, where a curve is described by a large number of points, i.e. a master position with corresponding slave position. Interpolation is used between these points. This type of cam has been tried and tested in the past, although it has the disadvantage that it is difficult to modify at run time.

As the next step in this direction, TwinCAT offers so-called motion functions (MF), which describe a cam in a different way. A motion function usually has a small number of reference points, between which a mathematical function, e.g. a polynomial, is used to describe the curve. The slave positions are calculated at run time from the mathematical description of the cam. With motion functions it is much easier to modify the function, because the curve can be modified by manipulating a interpolation point.

TwinCAT offers a cam design editor that can be used for both types of cam plate, i.e. position tables and motion functions. A PLC library facilitates programming of cams.

Cams with motion functions

Cams with position tables

Cam PLC library

Example program for cams with position tables

Example program for cams with motion functions

Cam design editor


Motion Functions - Overview

TwinCAT Slaves: Cams with motion functions

Overview

A motion function (MF) describes a cam disc via mathematical functions. It sub-divides the curve into appropriate segments (sections), for which different motion laws, i.e. special mathematical functions, can be used (for cam examples see: Cam design tool examples) The motion laws for mechanical cams are defined in VDI guideline 2143 and other documents. The electronic cam in TwinCAT use these functions, among others. The motion functions realise these motion functions directly in the real-time driver of the NC. Unlike classic table couplings that only transfer discrete steps (scatter plots) in the form of larger data quantities to the NC, the complete information is stored in the NC in very compact form. Problems originating from data discretisation (position reference points) in the table are thus eliminated.

The realisation of motion laws in the NC has a further crucial advantage: A motion diagram, i.e. the complete description of the motion of a slave axis, can now simply and clearly be defined and modified from the PLC. Associated PLC function blocks make the application of this functionality very convenient. Users can influence not only the complete motion description, but also individual segments or sub-sections.

In order to ensure that the drive system can actually implement a cam in practice, the system calculates characteristic values (such as maximum and minimum position values, velocity and acceleration etc.), which the user has to analyse. The resulting dynamic limit values ultimately depend on the motion of the master and relate to constant master velocity. The characteristic values are thus calculated with the idealised assumption of constant master velocity.
In addition, the mean velocity and the effective acceleration are calculated. These values may be used, for example, for calculating the effective torque or the operating point PA (nm ; Meff) in the torque/speed diagram of the motor. The PLC can access the current characteristic values of the NC via function blocks.

In the cam design tool TwinCAT cam design editor the decision whether to use classic table couplings (scatter plot) or motion functions can be configured via an associated selection. Subsequently, either the position tables or the motion function points are generated when the configuration is activated. If motion functions are used, these points can subsequently be modified individually by the PLC.

It is possible to modify individual values or complete sections of the motion functions online according to associated rules also online, i.e. while the cam is active. Very flexible cams can thus be realised.


Motion functions - Definition of a point

The information contained in the cam design tool table is sufficient for defining the motion in the NC. However, closer inspection of this MF table reveals the presence of redundant data. Because the motion is described in segments (sections), for motion diagrams with simple interrelationships the end point of a section is identical to the starting point of the next segment. The more complex point types offered by the cam design tool, such as slide point, are not yet implemented. In addition, users want to be able to deactivate individual points in a particular motion diagram (MOTIONPOINTTYPE_IGNORE, referred to as IGNORE below) at a later stage. These requirements lead a description that in addition to the starting point of a segment, including the point information (velocity, acceleration, point type), also contains the segment information (function type, symmetry value).

Point structure

PointIndex | UINT32 | Point index
FunctionType | UINT16 | Function type
PointType | UINT16 | Point type
RelIndexNextPoint | INT32 | Relative index of the end point (default: 0, subsequently corresponds to 1)
MasterPos | REAL64 | Master position
SlavePos | REAL64 | Slave position at this reference point
SlaveVelo | REAL64 | Slave velocity at this reference point
SlaveAcc | REAL64 | Slave acceleration at this reference point
SlaveJerk/Symmetry | REAL64 | Slave jerk at this reference point or symmetry value of the segments for rest in rest motion laws

In this structure, a relative index is used to refer to the point index of the end point of this segment. In order to keep the definition simple for motion diagrams with simple interrelationships, the IGNORE points are indeed ignored completely. The relative point index is therefore automatically adjusted internally.

The default value of the relative point index may therefore be zero, although for a standard list with simple link the value should be one. The user therefore does not have to update this information. The possible point types of the cam design tool therefore include the IGNORE point.

Point types

MOTIONPOINTTYPE_IGNORE | 0x0000 | Ignore point | Ignored point
MOTIONPOINTTYPE_REST | 0x0001 | Restpoint | Rest point
MOTIONPOINTTYPE_VELOCITY | 0x0002 | Velocitypoint | Velocity point
MOTIONPOINTTYPE_TURN | 0x0004 | Turnpoint | Reversal point
MOTIONPOINTTYPE_MOTION | 0x0008 | Motionpoint | Movement point

Since no points can be added while the MF is active, the IGNORE point type enables associated points to be included. These can be activated online at a later stage by specifying the associated values (point type not equal IGNORE).

Warning:
The master position has to be either strictly monotonic rising or falling. Otherwise it is rejected with an associated error message.


Motion Functions - Function-Types

TwinCAT Slaves: Cams with motion functions - function types

Function types

So far, only some of the function types offered by the TwinCAT cam design tool have been implemented:

Function type

No

Description

Boundary conditions

POLYNOM1

1

1st order polynomial, straight line or synchronised motion

VV

POLYNOM3

3

3rd order polynomial

RR

POLYNOM5

5

5th order polynomial

RR

POLYNOM8

8

8th order polynomial

RR

SINELINE

10

Sine line

RR

MODSINELINE

11

Modified sine line

RR

BESTEHORN

12

Bestehorn

RR

ACCTRAPEZ

13

Acceleration trapezoid

RR

POLYNOM5_MM

15

5th order polynomial with boundary value adaptation

MM

SINE_LINE_COMBI

16

Sine line combination

RR

HARMONIC_COMBI_RT

17

Harmonic combination

RT

HARMONIC_COMBI_TR

18

Harmonic combination

TR

HARMONIC_COMBI_VT

19

Harmonic combination

VT

HARMONIC_COMBI_TV

20

Harmonic combination

TV

ACCTRAPEZ_RT

21

Acceleration trapezoid

RT

ACCTRAPEZ_TR

22

Acceleration trapezoid

TR

MODSINELINE_VV

23

Modified sine line

VV

STEPFUNCTION

99

Step function

RR

The following abbreviations are used for motion function boundary conditions:

R for rest (velocity = zero, acceleration = zero),

V for velocity (acceleration = zero),

T for turn (velocity = zero), and

M for motion (no conditions for velocity or acceleration).

The boundary condition RT, for example, means that the starting point of the segment meets the condition R for rest (velocity = zero, acceleration = zero) and the end point meets the condition T for turn (velocity = zero).

POLYNOMIAL1 realises a straight line or a synchronised motion. Since in POLYNOMIAL1 the velocity is defined unambiguously by the master and slave values at the segment boundaries, the velocity value does not have to be transferred, or the specified value (e.g. zero) will be overwritten by the value calculated internally. The only motion law without restrictions on boundary conditions is currently POLYNOMIAL5_MM. However, here too appropriate boundary parameters should be provided. If the adjacent segments of a POLYNOMIAL5_MM segment are function type POLYNOMIAL1 segments or meet the boundary condition R for rest, the boundary parameters are overwritten by the internal velocity values of POLYNOMIAL1 or the rest values (velocity = zero, acceleration = zero). The Cam design tool examples illustrate the options and the motion laws to be used for designing cams.

Warning:
Boundary values are required for "non rest in rest" types. One exception is synchronised motion (polynomial1), for which the current velocities are calculated automatically from the current point positions. The internal coefficients of the adjacent segments are updated accordingly for the calculation.

When the motion function is selected in the cam design tool, all function types that are not realised in the NC are highlighted in red in the table. They are made available by the cam design tool as 5th order polynomial with boundary value adaptation.


Motion functions - programming via the PLC

The TwinCAT cam design tool is used for designing a basic cam with the maximum number of points required. This is then automatically available when the TwinCAT system starts up, or it is loaded into the NC at the push of a button (download). Via PLC function blocks, individual points can now be ignored or their values manipulated. The data currently available in the NC can be visualised in cam design tool online mode or loaded into the tool via upload. The data can thus be checked graphically and numerically. An additional option is for the NC to process the data as a table for discrete master positions including their derivatives. These data can then be used by the PLC or relayed to a visualisation software. The visualisation can display the point data including derivatives without having to calculate them.

Warning:
Since the cam data are used exactly as defined in the motion functions, it is important that the functionality to be made available to the end user (operator) is considered during the design phase. Another consideration is how to check the input from the user interface to ensure that only sensible cam can be generated. Calculating characteristic values can aid this process. For graphic control of the motion functions in the user interface, the NC can make the values for position, velocity and acceleration available in the form of a table (scatter plot).

Example for an application:

In a transfer device for a press system, the transfer motion is defined by the lifting angle of the press. A motion coupled with this lifting angle is entered in the user interface of the transfer device. This information is processed by the PLC together with the internally saved mechanical specification. The PLC transfers the cam data to the NC for moving the axes. For the visualisation, the PLC retrieves the cam data (position, velocity and acceleration) in tabular form from the NC and makes it available to the user interface.

For an optimisation calculation, the PLC reads the characteristic values (particularly average speed and effective acceleration) for the current cam and calculates the operating point PA (nm ; MEff) in the torque/speed diagram of the respective motor. The maximum permissible speed of the transfer device can thus be determined iteratively.

Example for a cam :

The above cam is to be realised as a motion function:

Point Index | Function Type | Point Type | RelIndex NextPoint | Master Pos | Slave Pos | Slave Velo | Slave Acc | Slave Jerk
1 | POLYNOM1 | REST | 1 or 0 | 0 | 0 | 0 | 0 | 0
2 | POLYNOM5_MM | REST | 1 or 0 | 30 | 0 | 0 | 0 | 0
3 | POLYNOM1 | VELOCITY | 1 or 0 | 150 | 20 | 0 | 0 | 0
4 | POLYNOM5_MM | VELOCITY | 1 or 0 | 240 | 40 | 0 | 0 | 0
5 | POLYNOM1 | REST | 1 or 0 | 340 | 0 | 0 | 0 | 0
6 | POLYNOM1 | REST | 0 | 360 | 0 | 0 | 0 | 0

In this case, the velocity does not have to be specified, since it is calculated internally (see function types). The relative index can also be set to zero for all values, since the diagram only consists of points with a simple relationship. The index only has to be set unequal zero for complex point definitions such as slide points. The master position must be monotonic rising.

Modification 1:

The complete cam can be changed by writing a single point:

4 POLYNOM5_MM VELOCITY 1 240 60 0 0 0

Modification 2:

or the complete cam can be set to zero by ignoring the two relevant points, i.e. all slave values are zero.

3 | POLYNOM1 | IGNORE | 1 | 150 | 20 | 0 | 0 | 0
4 | POLYNOM5_MM | IGNORE | 1 | 240 | 40 | 0 | 0 | 0

These changes are currently only activated after coupling, although in future activation according to associated rules will be possible online.

Further cam examples can be found in: Cam design tool examples (note that example 4 cannot be realised with motion functions at this stage.)


Motion Functions - Charateristic Values

TwinCAT Slaves: Cam plates with motion functions - characteristic values

Motion functions - characteristic values

Through internal calculation of the characteristic values, the risk of violating certain physical axis limits by false input of values can be eliminated.

The parameters described in the table are calculated by the NC and can be read with a PLC FB or via ADS. The dynamic parameters can only be calculated for a master that moves with constant velocity. The velocity of the master is also included in the structure. By default, the values are calculated for velocity 1.0. These values are also called standardised values. Conversion to a different constant master velocity is implemented in the NC and can be called up via a PLC FB. The re-scaled values are stored in the same structure. The relationship between the master velocity and the characteristic values is identified in the first variable called master velocity.

For a motion function with constant maximum acceleration, the position of the master at maximum acceleration (fMPosAtSAccMax) is ambiguous. The same applies to the other master positions at maximum or minimum values. Therefore, these have to be treated with caution. The same applies to parameters derived from the master positions (fSVeloAtSAccMin, fSVeloAtSAccMax).

Warning: The resulting dynamic limit values ultimately depend on the motion of the master. These calculated values are therefore only accurate for motion with constant master velocity.

No Names Description Data type

Master

1.

fMasterVeloNom

master nominal velocity

(normed = 1.0)

1

REAL64

Start Point

2.

fMasterPosStart

master start position

2

REAL64

3.

fSlavePosStart

slave start position

3

REAL64

4.

fSlaveVeloStart

slave start velocity

4

REAL64

5.

fSlaveAccStart

slave start acceleration

5

REAL64

6.

fSlaveJerkStart

slave start jerk

6

REAL64

End Point

7.

fMasterPosEnd

master end position

7

REAL64

8.

fSlavePosEnd

slave end position

8

REAL64

9.

fSlaveVeloEnd

slave end velocity

9

REAL64

10.

fSlaveAccEnd

slave end acceleration

10

REAL64

11.

fSlaveJerkEnd

slave end jerk

11

REAL64

Minimal Slave Position

12.

fMPosAtSPosMin

master position at slave minimum position

12

REAL64

13.

fSlavePosMin

slave minimum position

13

REAL64

Minimal Slave Velocity

14.

fMPosAtSVeloMin

master position at slave minimum velocity

14

REAL64

15.

fSlaveVeloMin

slave minimum velocity

15

REAL64

Minimal Slave Acceleration

16.

fMPosAtSAccMin

master pos. at slave minimum acceleration

16

REAL64

17.

fSlaveAccMin

slave minimum acceleration

17

REAL64

18.

fSVeloAtSAccMin

slave velocity at slave min. acceleration

18

REAL64

Minimal Slave Jerk/Dyn.Mom

19.

fSlaveJerkMin

slave minimum jerk

19

REAL64

20.

fSlaveDynMomMin

slave minimum dynamic momentum

20

REAL64
NOT SUPPORTED

Maximal Slave Position

21.

fMPosAtSPosMax

master position at slave maximum position

21

REAL64

22.

fSlavePosMax

slave maximum position

22

REAL64

Maximal Slave Velocity

23.

fMPosAtSVeloMax

master position at slave maximum velocity

23

REAL64

24.

fSlaveVeloMax

slave maximum velocity

24

REAL64

Maximal Slave Acceleration

25.

fMPosAtSAccMax

master pos. at slave maximum acceleration

25

REAL64

26.

fSlaveAccMax

slave maximum acceleration

26

REAL64

27.

fSVeloAtSAccMax

slave velocity at slave max. acceleration

27

REAL64

Maximal Slave Jerk/Dyn.Mom

28.

fSlaveJerkMax

slave maximum jerk

28

REAL64

29.

fSlaveDynMomMax

slave maximum dynamic momentum

29

REAL64
NOT SUPPORTED

Mean Effective Values

30.

fSlaveVeloMean

slave mean absolute velocity

30

REAL64

31.

fSlaveAccEff

slave effective acceleration

31

REAL64


Motion Functions - Online Modification

TwinCAT Slaves: Online modification of motion functions

Online modification

The motion functions not only offer the advantage that they can be defined via a function block from the PLC, they can also be modified at run time. Example: modification of the slave values of a turning point for adjusting the lift. More comprehensive modifications for the start-up curve of a complex cyclic motion (without rest or constant velocity) can also be implemented.

The online change of the motion function (MF) follows certain rules. It may be activated from a certain axis position (AtMasterAxisPos), immediately (Instantaneous) or from the next cycle. The current activation rule applies until a new rule is transferred. The command for online changes of MF points can be used to modify single points or coherent ranges of several points. One bit of the cyclic interface is allocated for synchronisation. Within a program, the activation rule has to be defined (via a function block), and the modified values of the motion function points have to be transferred. This transfer is done with the same ADS commands or PLC function blocks that are used to define the motion function on system start-up.

ActivationMode |
Instantaneous (Default) | 0
AtMasterCamPos | 1
AtMasterAxisPos | 2
NextCycle | 3
AsSoonAsPossible (former default) | 5
Off | 6
DeleteQueuedData | 7

The Instantaneous activation mode activates the transferred motion function point values with the next tick. Obviously, this functionality should only be used if the new values have no direct effect on the current slave axis values. A change will thus affect another segment without interacting with the current segment. The option AsSoonAsPossible is used to check which segments were not modified. The change is only realised when the slave is in such a segment. The two modes AtMasterAxisPos and AtMasterCamPos differ in that AtMasterAxisPos uses the axis position as reference, while AtMasterCamPos relates to the position in the motion diagram. In a cyclic motion from 0 to 360, axis position 180 is crossed only once, while in the motion diagram position 180 is crossed during each cycle. If the axis position has already been crossed, an activation command with AtMasterAxisPos mode will lead to an error. In AtMasterCamPos mode, the activation command is executed in the next cycle from the specified position. NextCycle is used to set the activation position to the end or the start of the cycle. In Off mode, modification commands are not executed. DeleteQueuedData deletes point data that have already been transferred but not yet activated. The current cam is, of course, not affected.

A convenient way of implementing changes is the option of setting SlaveScalingMode to AutoOffset . In this case, the slave offset is automatically corrected such that jumps in slave position are avoided, although jumps are possible in the velocity or the acceleration. If, for example, the activation position is in a segment with constant velocity and the modified segment has the same velocity, the change can be implemented without problem.

SlaveScalingMode |
UserDefined (Default) | 0
AutoOffset | 1
Off | 2

The memory management for the motion function points does not permit subsequent addition of points. An option to ignore points (IGNORE) has therefore been implemented. In order to make searching for the current segment efficient, the master positions had to be stored as a monotonic increasing sequence. This means that even points to be activated at a later stage have to be located at the correct master position. When starting the system, the operator should therefore be clear about the maximum number of points required.

Warning!

Online modification offers a wide range of options for implementing changes. The downside is that changes may lead to situations that can cause axis errors or other problems. This powerful tool should therefore be used with caution and only after appropriate simulation tests at the respective machine have been carried out.


Overview

A slave axis whose set position values can be found from the set position values of another axis by means of a pre-calculated table is known as a camshaft axis (table slave axis).

The table contains the slave positions associated with the respective master positions, and is linear interpolated. The master positions in the table can be equidistantly monotonically ascending, or simply monotonically ascending. That tables can be processed linearly or cyclically. It is possible to give an offset to the master position and/or the slave position. These offsets can be changed on-line. The tables can be processed absolutely, or relatively in relation to the coupling position (of master and/or slave).

Interfaces

The interfaces consist of the System Manager, PLC blocks and the cyclic NC-PLC axis interface.

Table types

There are four types of table, differing in the table contents and in the way they are processed.

  • Equidistant tables in which the master position rises in equidistant steps:
    • Equidistant linear tables, i.e. tables that are worked through from the table edge in accordance with the table contents.
    • Equidistant cyclic tables, i.e. tables that are worked through from the table edge and periodically restarted.
  • Non-equidistant tables, in which the master position rises in strictly monotonic steps that are not necessarily equidistant:
    • Non-equidistant linear tables, i.e. tables that are worked through from the edge of the table in accordance with the table contents.
    • Non-equidistant cyclic tables, i.e. tables that are worked through from the edge of the table and are periodically restarted.

Processing Modes

There are master offsets and/or slave offsets, different reference systems (relative/absolute - in reference to the coupling position), and the possibility of linear or cyclic processing.

Procedure

The procedure consists of the coupling preparations (moving the axes to the coupling positions) coupling, starting the master axis, possible on-line changing of the offset(s), braking the slave axis (directly via the master, or indirectly via the table) and the uncoupling.


Interfaces

The user can operate the camshaft axis by means of the System Manager or by PLC blocks. Furthermore, a cyclic NC-PLC interface is available (in the System Manager or via the PLC) that contains the axis process image and enables access to various variables.

System Manager

The System Manager provides access to all the functionalities of the camshaft axis:

  • Logical coupling, stating the master axis and setting the coupling table.
  • Uncoupling.

PLC Blocks

The PLC Library offers access to the complete slave axis functionality

  • Logical coupling, stating the master axis and setting the coupling table.
  • Stop.

NC-PLC-Interface

The cyclic NC-PLC axis interface contains the axis process image and particularly access to the coupling information (coupling flag).


Table types

There are four types of table, differing in the table contents and in the way they are processed.

  • Equidistant tables in which the master position rises in equidistant steps:
    • Equidistant linear tables, i.e. tables that are worked through from the table edge in accordance with the table contents.
    • Equidistant cyclic tables, i.e. tables that are worked through from the table edge and periodically restarted.
  • Non-equidistant tables, in which the master position rises in strictly monotonic steps that are not necessarily equidistant:
    • Non-equidistant linear tables, i.e. tables that are worked through from the edge of the table in accordance with the table contents.
    • Non-equidistant cyclic tables, i.e. tables that are worked through from the edge of the table and are periodically restarted.

The multi-table slaves only operate with non-equidistant tables.

General notes:

Non equidistant tables are based on a linear search algorithm that is started and re-initialised by bisection.

Equidistant tables are, of course, also non-equidistant tables

It is, of course, possible for any table to be processed linearly or cyclically.

General Table Conventions

  • Tables only contain binary data.
  • A table consists of a header (the first line) and the table data (the remaining lines).
  • The header contains two numbers of type unsigned short. The first column contains the number of lines (without header), while the second column contains the number of columns (for table-slave tables this is always 2). There are no separating characters between the data.
  • Apart from the header, the table only contains data of type double.
  • The first column (with the exception of the header line) contains the master positions, while the second column contains the associated slave positions (both in mm). There are no separating characters between the data.

General Comments

Table(s) must be adjusted for the desired dynamics. At dynamically critical locations where the master axis is moving slowly, the table must contain enough data to provide accurate resolution.

Table Notation

The table T contains N lines, each line containing two items of data, the master position T[k][0] and the associated slave position.T[k][1], 0 ≤ k < N. Notation:
T[k,0] master value, 0 ≤ k < N,
T[k,1] slave value, 0 ≤ k < N,
T(y) interpolated slave position value from the interval T[k,1] and T[k+1,1], where T[k,0] < y ≤ T[k+1,0] for non-equidistant tables, and T[k,0] ≤ y < T[k+1,0] for equidistant tables.

Cyclic Tables (Cyclic Processing)

Cyclic tables are characterised by the following additional parameters.

  • A master period: it is understood that the period is not negative, and begins at 0.0. Tables extend as agreed from T[0][0] = 0.0 to T[N-1][0] = periods.
  • A slave difference per master period (which can have any arithmetic sign) that indicates how many mm the slave position changes in each period. If a slave is itself periodic, then this difference is 0.0. The following applies: T[N-1][1] - T[0][1] = slave difference per master period.

Evaluation of Linear Tables

  • In the case of a table overflow/underflow in the master position , the table value at the relevant edge of the table is output as the slave position value.
  • It should particularly be noted that if the master position is outside the range of the table when coupling takes place, the slave axis will jump in the first step to the value at the relevant table edge. In general this will generate a following error.
  • The current slave position is determined by linear interpolation.
  • The current slave velocity is, if possible, calculated from the master's set velocity with the aid of the table and the chain rule (this does assume that the master set velocity is sufficiently smooth). Otherwise, the slave velocity is calculated by numerical differentiation (and is correspondingly coarse when multiple interpolation is needed between a pair of lines).
  • The current slave acceleration is always calculated by numerical differentiation, and is correspondingly coarse.

    • Evaluation of Cyclic Tables

    • The table has a cycle counter that is incremented in the case of table overflow and decremented in the case of table underflow.
    • In the case of table overflow/underflow, the slave difference per master period, multiplied by the cycle counter, is added to the slave position.
    • The current slave position is determined by linear interpolation.
    • The current slave velocity is, if possible, calculated from the master's set velocity with the aid of the table and the chain rule (this does assume that the master set velocity is sufficiently smooth). Otherwise, the slave velocity is calculated by numerical differentiation (and is correspondingly coarse when multiple interpolation is needed between a pair of lines).
    • The current slave acceleration is always calculated by numerical differentiation, and is correspondingly coarse.

    Interfaces

    PLC documentation link->outside

    ASCII->bin link->outside

    Table read link->outside


Processing Modes

Cam plates can be processed linearly or cyclically with coupled master/slave axes. They can be scaled on both the master and slave side and are fitted with a position offset. The reference system of a cam plate can thus be interpreted as absolute or relative to the coupling position of the axes.

Linear processing

Offsets

It is possible to provide a slave offset as well as a master offset:

  • The master offset (MO) is added to the master position before any other operations.
  • The slave offset (SO) is added to the slave position after any other operations.

Scaling

There is a slave scaling, with which all the slave positions are multiplied. Furthermore there is a master scaling, with which all the master positions are divided. The scalings are usually preset with 1.0 through the coupling of the slaves; however you can deviate from these values as you like (master scaling may not be 0.0). It is also possible to change the scaling on-line, but this should only be done moderately, because - even when the axes are dynamically stationary - a following error is created. With cyclic processing (see below) the slave difference (slave stroke) per master period is also multiplied by the slave scaling.

  • The master scaling (MS) is used as a divisor.
  • The slave scaling (SS) is used as a multiplier.

Cyclic processing

The rule for cyclic processing is that the modulo operations are performed at the lowest level, i.e. immediately before the table is evaluated.

  • The table has a cycle counter (Zm), that is incremented in the case of table overflow and decremented in the case of table underflow.
  • The master position is given in absolute terms, not modulo.
  • In the case of table overflow/underflow, the slave difference (slave stroke) per master period (SH), multiplied by the cycle counter, is added to the slave position.

Cyclic processing

Description

  1. Pm Absolute master position
  2. Pmc Master coupling position (master start position), only effective for relative reference system!
  3. MO Master offset
  4. MS Master scaling
  5. Ps Absolute slave position
  6. Psc Slave coupling position (slave start position), only effective for relative reference system!
  7. SO Slave offset
  8. SS Slave scaling
  9. T(•) Table
  10. mod[•] Modulo calculation with master period (example for a master period of 360 deg: mod[ 40 ] = 40, mod[ 400 ] = 40, mod[ -20 ] = 340 )
  11. Zm Master cycle counter
  12. SH Slave difference (slave stroke) per master period

Reference systems:

The position of a slave axis results from a calculation regulations from the data of the cam plate table and the actual master position. If a relative reference system is selected for master or slave, then the associated position column of the table should begin with 0.0. "Relative" always relates to the coupling position of the respective axis. The calculation regulations for combinations of relative and absolute reference are explained below.
Often it is necessary for a real application to change the formulas so that the slave offset (SO) or the master offset (MO) results.

Reference system for linear tables

General case: Offsets not 0.0 and scalings not 1.0

  • Master absolute and slave absolute: Ps = SO + T( (MO + Pm ) / MS ) · SS
  • Master relative and slave absolute: Ps = SO + T( (MO + Pm - Pmc ) / MS ) · SS
  • Master absolute and slave relative: Ps = Psc + SO + T( (MO + Pm ) / MS ) · SS
  • Master relative and slave relative: Ps = Psc + SO + T( (MO + Pm - Pmc ) / MS ) · SS

Simplified special case 1: Offsets not 0.0 and scalings are 1.0

  • Master absolute and slave absolute: Ps = SO + T( (MO + Pm ) )
  • Master relative and slave absolute: Ps = SO + T( (MO + Pm - Pmc ) )
  • Master absolute and slave relative: Ps = Psc + SO + T( (MO + Pm ) )
  • Master relative and slave relative: Ps = Psc + SO + T( (MO + Pm - Pmc ) )

Simplified special case 2: Offsets are 0.0 and scalings not 1.0

  • Master absolute and slave absolute: Ps = T( Pm )
  • Master relative and slave absolute: Ps = T( Pm - Pmc )
  • Master absolute and slave relative: Ps = Psc + T( Pm )
  • Master relative and slave relative: Ps = Psc + T( Pm - Pmc )

Reference system for cyclic tables

In the case of table overflow/underflow, the slave difference (slave stroke) per master period, multiplied by the cycle counter, is added to the slave position.

General case: Offsets and slave stroke not 0.0 and scalings not 1.0

  • Master absolute and slave absolute: Ps = SO + T( mod[ (MO + Pm ) / MS ] ) · SS + SH · ZM
  • Master relative and slave absolute: Ps = SO + T( mod[ (MO + Pm - Pmc ) / MS ] ) · SS + SH · ZM
  • Master absolute and slave relative: Ps = Psc + SO + T( mod[ (MO + Pm ) / MS ] ) · SS + SH · ZM
  • Master relative and slave relative: Ps = Psc + SO + T( mod[ (MO + Pm - Pmc ) / MS ] ) · SS + SH · ZM

Simplified special case 1: Offsets and slave stroke not 0.0, scalings are 1.0

  • Master absolute and slave absolute: Ps = SO + T( mod[ (MO + Pm ) ] )+ SH · ZM
  • Master relative and slave absolute: Ps = SO + T( mod[ (MO + Pm - Pmc ) ] ) + SH · ZM
  • Master absolute and slave relative: Ps = Psc + SO + T( mod[ (MO + Pm ) ] ) + SH · ZM
  • Master relative and slave relative: Ps = Psc + SO + T( mod[ (MO + Pm - Pmc ) ] ) + SH · ZM

Simplified special case 2: Offsets and slave stroke are 0.0, scalings are 1.0

  • Master absolute and slave absolute: Ps = T( mod[ Pm ] )
  • Master relative and slave absolute: Ps = T( mod[ Pm - Pmc ] )
  • Master absolute and slave relative: Ps = Psc + T( mod[ Pm ] )
  • Master relative and slave relative: Ps = Psc + T( mod[ Pm - Pmc ] )

Interfaces


Procedure

The procedure consists of the coupling preparations (moving the axes to the coupling positions) coupling, starting the master axis, possible on-line changing of the offset(s), braking the slave axis (directly via the master, or indirectly via the table) and the uncoupling.

Preparation

  1. The master axis is moved in PTP operation to the coupling position (=start position).
  2. The slave position associated with this master position is found from the table. Reading the table only yields the table value. The user must calculate from this using any offsets and processing modes (relative/absolute) that may have been provided with the coupling.
  3. The slave axis is moved in PTP mode to the coupling position (=start position).

Coupling/Start

The coupling is made off-line (slave and master are stationary).

The slave then starts when the master starts, and when the table contents require it (the slave position is not constant).

Online

The table master-slave coupling is a linear path controller.

The offsets can be changed on-line. Only moderate changes should be made to the offset during motion, because a following error is created.

In the case of table overflow/underflow of cyclic tables, the slave difference per master period, multiplied by the cycle counter, is added to the slave position.

There is no separate stop for the slave axis.

On-line offset changes

Error Handling

There is no explicit error handling if the top or bottom of linear tables is passed. The slave axis remains instantly stationary at the relevant table edge, creating (depending on the dynamic state) a following error.

Stopping/Uncoupling

The slave axis either stops when the master stops (linear path control) or when required by the table contents (the slave position is constant over a wide range of master positions).

Uncoupling can take place off-line (master and slave are stationary) or semi-off-line (only the slave is stationary).

Interfaces

  • Table reading
    1. PLC Blocks
  • Coupling
    1. System Manager
    2. PLC Blocks
  • Uncoupling
    1. System Manager
    2. PLC Blocks


Camming Slave - Online Scaling

TwinCAT Slaves: Online Scaling

Online modification of the scaling or the offset

Online changes of the scaling or the offset of cams (position tables and motion function) follow certain rules. It may be activated from a certain axis position (AtMasterAxisPos), immediately (Instantaneous) or from the next cycle. The activation rule (ActvivationMode, ActivationPosition, MasterScalingMode or SlaveScalingMode) and the parameters MasterOffset, SlaveOffset, MasterScaling and SlaveScaling are transferred with the online change command or the function block (MC_CamScaling).

ActivationMode |
Instantaneous (Default) | 0
AtMasterCamPos | 1
AtMasterAxisPos | 2
NextCycle | 3

The Instantaneous activation mode activates the transferred values with the next tick. The two modes AtMasterAxisPos and AtMasterCamPos differ in that AtMasterAxisPos uses the axis position as reference, while AtMasterCamPos relates to the position in the motion diagram. In a cyclic motion from 0 to 360, axis position 180 is crossed only once, while in the motion diagram position 180 is crossed during each cycle. If the axis position has already been crossed, an activation command with AtMasterAxisPos mode will lead to an error. In AtMasterCamPos mode, the activation command is executed in the next cycle from the specified position. NextCycle is used to set the activation position to the end or the start of the cycle.

A convenient way of implementing changes is the option of setting SlaveScalingMode or the Master ScalingMode to AutoOffset . In this case, the slave or master offset is automatically corrected such that jumps in slave position are avoided, although jumps are possible in the velocity or the acceleration.

MasterScalingMode / SlaveScalingMode |
UserDefined (Default) | 0
AutoOffset | 1
Off | 2

Examples:

At the start of a cycle, the cam is at rest (velocity and acceleration are equal zero). The slave motion can be stopped with the values:

MasterOffset = 0, SlaveOffset =0, MasterScaling=1, SlaveScaling =0 , MasterScalingMode = Off, SlaveScalingMode = UserDefined , ActivationMode = NextCycle

The coupling remains intact. With the associated command with SlaveScaling =1.0, the motion can subsequently be reactivated.

The cam has a constant velocity range between 200 and 250 degrees. With the values:

MasterOffset = 10, SlaveOffset =0, MasterScaling=1, SlaveScaling =1 , MasterScalingMode = UserDefined , SlaveScalingMode = AutoOffset, ActivationMode =AtMasterCamPos, ActivationPosition = 200

changes the MasterOffset by an absolute value of 10. SlaveScalingMode = AutoOffset automatically corrects the slave such that jumps in position are avoided. The result corresponds to instantaneous phasing.

Warning!

Online modification offers a wide range of options for implementing changes. The downside is that changes may lead to situations that can cause axis errors or other problems. This powerful tool should therefore be used with caution and only after appropriate simulation tests at the respective machine have been carried out.


Overview

A slave axis whose set position values can be found from the set position values of another axis by means of a number of pre-calculated tables (serial and/or parallel) is known as a multi-table slave axis.

The tables contain the slave positions corresponding to each particular master position, along with the scaling that consists of the master offset, slave offset, master slope and slave slope, permitting the table to be scaled in any desired way. The usual case involves a normalised start table, a normalised working table and a normalised stop table (profile tables) that are worked through in sequence one after another. On top of this there are correction tables that are used in parallel with the profile tables, and which permit on-line position corrections to be made for the slave axis.

Interfaces and Configuration

The interfaces consist of the System Manager, PLC blocks and the cyclic NC-PLC axis interface.

Table types

There are two types of table, differing in the way they are processed. These are non-equidistant tables, in which the master position rises in strictly monotonic steps that are not necessarily equidistant:

  • Non-equidistant linear tables, i.e. tables that are worked through from the edge of the table in accordance with the table contents.
  • Non-equidistant cyclic tables, i.e. tables that are worked through from the edge of the table and are periodically restarted.

Processing Modes

For every table associated with a multi-table axis there is a scaling consisting of the master offset, master slope, slave offset, slave slope and table weighting, with which the table can be similarly scaled to any desired magnitude in both co-ordinates. This makes it possible to restrict the system to a small number of normalised tables. Processing may take place in a linear or cyclic manner.

Procedure

The sequence of events consists of the coupling preparations (moving the axes to the coupling positions) coupling, starting the master axis, parallel table change, possible serial on-line activation of correction tables, braking the slave axis (directly via the master, or indirectly via the table(s)) and uncoupling.


Interfaces and Configuration

The user can operate the multi-table slave axis by means of the System Manager or by PLC blocks. Furthermore, a cyclic NC-PLC interface is available (in the System Manager or via the PLC) that contains the axis process image and enables access to various variables.

System Manager

The System Manager offers access to all the functionalities of the multi-table slave axes:

  • Logical coupling, stating the master axis and the coupling tables.
  • Stop.

PLC Blocks

The PLC Library offers access to the complete slave axis functionality

  • Logical coupling, stating the master axis and the coupling tables.
  • Stop.

NC-PLC-Interface

The cyclic NC-PLC axis interface contains the axis process image and particularly access to the coupling information (coupling flag).


Processing Modes

For every table associated with a multi-table slave axis there is a scaling consisting of the master offset, master slope, slave offset, slave slope and table weighting, with which the table can be similarly scaled to any desired magnitude in both co-ordinates. This makes it possible to restrict the system to a small number of normalised tables. Processing may take place in a linear or cyclic manner.

Reference System

The scaled axis positions are always stated absolutely.

Cyclic Processing

The rule for cyclic processing is that the modulo operations are performed at the lowest level, i.e. immediately before the table is evaluated.

  • The table has a cycle counter that is incremented in the case of table overflow and decremented in the case of table underflow.
  • The master position is given in absolute terms, not modulo.
  • In the case of table overflow/underflow, the slave difference per master period, multiplied by the cycle counter, is added to the slave position.

Table types

It is usual for the total travel of a multi-table slave axis to be divided into a number of segments. Individual (normalised) tables are assigned to these (profile tables): start table, working table(s), stop table. These tables are worked through in sequence. On top of these there are correction tables, only valid over restricted regions, processed in parallel with the profile tables. The profile tables can be processed in a linear or cyclic mode; the correction tables are always processed in linear mode.

Scaling

Scaling Parameters for a Table

Scaling parameter | Meaning and boundary conditions
RangeLow RL | Lower limit for the table's range of validity (RL < RH)
RangeLow RH | Upper limit for the table's range of validity (RH > RL)
Table weighting W | Weighting with which the table is entered into a parallel convex combination of tables (W > 0.0)
Master-Offset MO | Offset to the master position T[0][0]
Master slope MS | Scaling factor of the table's master position: T[k][0] <- MS × T[k][0]
Slave-Offset SO | Offset to the slave position T[0][1]
Slave slope SS | Scaling factor of the table's slave position: T[k][1] <- SS × T[k][1]

It is not the purpose of on-line setting of the scaling to change the parameters while the table is active, but to set the parameters before the table is made active. Only the correction tables are to be used to correct an active table. (The parameters of these correction tables must also not be changed while the table is active.)

Notes on scaling correction tables:

  • RangeLow = -DBL_MAX is automatically set by the NC.
  • RangeHigh = -DBK_MAX is automatically set by the NC.
  • Table weighting is set by the user (usually 1.0).
  • The master offset is automatically set by the NC.
  • Master slope, slave offset and slave slope are set by the user.

Interfaces


Procedure

The sequence of events consists of the coupling preparations (moving the axes to the coupling positions) coupling, starting the master axis, parallel table change, possible serial on-line activation of correction tables, braking the slave axis (directly via the master, or indirectly via the table(s)) and uncoupling.

Preparation

  1. The master axis is moved in PTP operation to the coupling position (=start position).
  2. The slave position associated with this master position is found from the table(s). Reading the table only yields the table value. The user must calculate from this using any offsets, slopes or weightings that may have been provided with the coupling, along with the planned composition of the table.
  3. The slave axis is moved in PTP mode to the coupling position (=start position).

Coupling/Start

The coupling is made off-line (slave and master are stationary).

The slave then starts when the master starts, and when the table contents require it (the slave position is not constant).

Online: General

The table master-slave coupling is a linear path controller.

In the case of table overflow/underflow of cyclic tables, the slave difference per master period, multiplied by the cycle counter, is added to the slave position.

There is no separate stop for the slave axis.

Online: Table Change and Table Composition

Changing the correction table is prepared by the PLC to the extent that the table scaling for each table is set at an early enough stage by the PLC. The scaling parameters include specification of the validity intervals (in terms of absolute positions) for each table. The actual table change is performed by the NC.

If a number of tables (several profile tables or profile tables and correction tables) are active at the same time, the slave position is calculated as follows (the index i refers in each case to the i-th active table):

P_mi current absolute master position,

SO_i slave offset of the i-th table,

SS_i slave slope of the i-th table,

MO_i master offset of the i-th table,

MS_i master slope of the i-th table,

W_i weighting of the i-th table.

Determination of the slave position using a number of parallel tables

Scaling parameter | Meaning and boundary conditions
one linear table | P_si(P_m) = SO_i + SS_i × T_i(MO_i + MS_i × P_m)
one cyclic table | P_si(P_m) = SO_i + SS_i × T_i([MO_i + MS_i × P_m]mod(•))
all profile tables | P_s = Σ_i W_i × P_si(P_m)

Linear serial processing

Linear/cyclic/linear serial processing

Linear/cyclic/linear serial processing with parallel correction

Online: Deactivating Cyclic Tables

The end of cyclic processing of a table is requested through the PLC by the user, and takes place at the end of the relevant cyclic table.

Online: Activation of Correction Tables

Correction tables are processed in parallel with the profile tables.

There are two possibilities for the activation of correction tables:

  • Instantaneous activation: The user scales and activates the correction tables, they are then instantaneously activated in the NC.
  • Activation by transcending an activation position: the correction tables are scaled and logically activated by the user befrore transcending the activation position. The actvation position is a parameter of the logical activation. After transcending the activation position the correction is automatically activated by the NC.

Correction tables are deactivate themselves automatically when the correction has been worked through.

Notes on scaling correction tables:

  • RangeLow = -DBL_MAX is automatically set by the NC.
  • RangeHigh = DBK_MAX is automatically set by the NC.
  • Table weighting is set by the user (usually 1.0).
  • The master offset is automatically set by the NC.
  • Master slope, slave offset and slave slope are set by the user.

Error Handling

There is no explicit error handling if the top or bottom of linear tables is passed. The slave axis position value remains instantly stationary at the relevant table edge, creating (depending on the dynamic state and the table composition) a following error.

Stopping/Uncoupling

The slave axis either stops when the master stops (linear path control) or when the table contents require it (the slave position is constant over a wide range of master positions).

Uncoupling can take place off-line (master and slave are stationary) or semi-off-line (only the slave is stationary).

Interfaces

  • Table reading
    1. PLC Blocks
  • Set scaling
    1. PLC Blocks
  • Coupling
    1. System Manager
    2. PLC Blocks
  • Uncoupling
    1. System Manager
    2. PLC Blocks