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.


Flying saw overview

TwinCAT PLC Library: MC library 2 - flying saw

Overview

In many plants workpieces undergo machining operations while being transported. For this purpose it is necessary to synchronise the position and the speed of tool and workpiece, so that the tool can then be applied as if to a stationary workpiece. One example of such an application is a saw that during the transport process cuts through the material that is being transported (flying saw). In order to implement this kind of application, TwinCAT provides the flying saw.

The TwinCAT PLC library TcMC2_FlyingSaw.lib, available as an additional product, provides easy management of the flying saw. An example program using the flying saw makes use of this library.


MC_GearInVelo

The function block MC_GearInVelo activates a linear master-slave coupling (gear coupling). If the master axis is already moving, the slave axis synchronises to the master velocity. The block accepts a fixed gear ratio in numerator/denominator format.

The slave axis can be uncoupled with the function block MC_GearOut. If the slave is decoupled while it is moving, then it retains its velocity and can be halted using MC_Stop.

Inputs

VAR_INPUT
    Execute 		: BOOL;
    RatioNumerator 	: LREAL;
    RatioDenominator 	: UINT;
    SyncMode 		: ST_SyncMode;
    Velocity 		: LREAL;
    Acceleration 	: LREAL;
    Deceleration 	: LREAL;
    Jerk 		: LREAL;
    BufferMode 	: MC_BufferMode;
    Options 		: ST_GearInVeloOptions;
END_VAR
Execute | The command is executed with a rising edge at input Execute.
RatioNumerator | Gear ratio numerator. Alternatively, the gear ratio can be specified in the enumerator as a floating comma value, if the denominator is 1.
RatioDenominator | Gear ratio denominator
SyncMode | In the data structure SyncMode boundary conditions for the synchronisation process are specified via individual flags.
Velocity | Maximum slave velocity in the synchronisation phase. If a velocity is not specified, the maximum velocity of the axis from the system manager data is used. Warning: The velocity given here is only checked if this checking is activated through the SyncMode variable.
Acceleration | Maximum slave acceleration in the synchronisation phase. If an acceleration is not specified, the maximum acceleration of the axis from the system manager data is used. Warning: The acceleration given here is only checked if this checking is activated through the SyncMode variable.
Deceleration | Maximum slave deceleration in the synchronisation phase. If a deceleration is not specified, the maximum deceleration of the axis from the system manager data is used. Warning: The deceleration given here is only checked if this checking is activated through the SyncMode variable.
Jerk | Maximum slave jerk in the synchronisation phase. If a jerk is not specified, the maximum jerk of the axis from the system manager data is used. Warning: The jerk given here is only checked if this checking is activated through the SyncMode variable.
BufferMode | Currently not implemented
Options | Currently not implemented
For a 1:4 ratio the RatioNumerator must be 1, the RatioDenominator must be 4. Alternatively, the RatioDenominator may be 1, and the gear ratio can be specified as floating-point number 0.25 under RatioNumerator. The RatioNumerator may be negative.

Outputs

VAR_OUTPUT
    StartSync 	: BOOL;
    InSync 		: BOOL;
    Busy 		: BOOL;
    Active 		: BOOL;
    CommandAborted 	: BOOL;
    Error 		: BOOL;
    ErrorID 		: UDINT;
END_VAR
StartSync | Becomes TRUE when the synchronisation with the master axis was started.
InSync | Becomes TRUE, if the coupling was successfully completed and the slave axis is synchronised with the master axis.
Busy | The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the command is processed. When Busy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs, InSync, CommandAborted or Error, is set.
Active | Active indicates that the command is executed (currently Active=Busy, see BufferMode)
CommandAborted | Becomes TRUE, if the command could not be fully executed. The axis may have become decoupled during the coupling process (simultaneous command execution).
Error | Becomes TRUE, as soon as an error occurs.
ErrorID | If the error output is set, this parameter supplies the error number.

Inputs/outputs

VAR_IN_OUT
    Master	:	AXIS_REF;
    Slave	: 	AXIS_REF;
END_VAR
Master | Master axis data structure.
Slave | Slave axis data structure.

The axis data structure of type AXIS_REF addresses an axis uniquely within the system. Among other parameters it contains the current axis status, including position, velocity or error status.


MC_GearInPos

The function block MC_GearInPos synchronises a slave axis precisely with a master axis (flying saw). The synchronisation velocity is achieved exactly at the synchronous position of the master and slave.

The master axis must already be moving, otherwise synchronisation is not possible.

The slave axis can be uncoupled with the function block MC_GearOut. If the slave is decoupled while it is moving, then it retains its velocity and can be halted using MC_Stop.

Inputs

VAR_INPUT
    Execute 			: BOOL;
    RatioNumerator 		: LREAL;
    RatioDenominator		: UINT;
    MasterSyncPosition		: LREAL;
    SlaveSyncPosition		: LREAL;
    SyncMode 			: ST_SyncMode;
    MasterStartDistance	: LREAL;
    Velocity 			: LREAL;
    Acceleration 		: LREAL;
    Deceleration 		: LREAL;
    Jerk 			: LREAL;
    BufferMode 		: MC_BufferMode;
    Options 			: ST_GearInPosOptions;
END_VAR
Execute | The command is executed with a rising edge at input Execute.
RatioNumerator | Gear ratio numerator. Alternatively, the gear ratio can be specified in the enumerator as a floating comma value, if the denominator is 1.
RatioDenominator | Gear ratio denominator
MasterSyncPosition | The master's synchronous position
SlaveSyncPosition | The slave's synchronous position
SyncMode | In the data structure SyncMode boundary conditions for the synchronisation process are specified via individual flags.
MasterStartDistance | Currently not implemented
Velocity | Maximum slave velocity in the synchronisation phase. If a velocity is not specified, the maximum velocity of the axis from the system manager data is used. Warning: The velocity given here is only checked if this checking is activated through the SyncMode variable.
Acceleration | Maximum slave acceleration in the synchronisation phase. If an acceleration is not specified, the maximum acceleration of the axis from the system manager data is used. Warning: The acceleration given here is only checked if this checking is activated through the SyncMode variable.
Deceleration | Maximum slave deceleration in the synchronisation phase. If a deceleration is not specified, the maximum deceleration of the axis from the system manager data is used. Warning: The deceleration given here is only checked if this checking is activated through the SyncMode variable.
Jerk | Maximum slave jerk in the synchronisation phase. If a jerk is not specified, the maximum jerk of the axis from the system manager data is used. Warning: The jerk given here is only checked if this checking is activated through the SyncMode variable.
BufferMode | Currently not implemented
Options | Currently not implemented
For a 1:4 ratio the RatioNumerator must be 1, the RatioDenominator must be 4. Alternatively, the RatioDenominator may be 1, and the gear ratio can be specified as floating-point number 0.25 under RatioNumerator. The RatioNumerator may be negative.

Outputs

VAR_OUTPUT
    StartSync 	: BOOL;
    InSync 		: BOOL;
    Busy 		: BOOL;
    Active 		: BOOL;
    CommandAborted	: BOOL;
    Error 		: BOOL;
    ErrorID 		: UDINT;
END_VAR
StartSync | Becomes TRUE when the synchronisation with the master axis was started.
InSync | Becomes TRUE, if the coupling was successfully completed and the slave axis is synchronised with the master axis.
Busy | The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the command is processed. When Busy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs, InSync, CommandAborted or Error, is set.
Active | Active indicates that the command is executed (currently Active=Busy, see BufferMode)
CommandAborted | Becomes TRUE, if the command could not be fully executed. The axis may have become decoupled during the coupling process (simultaneous command execution).
Error | Becomes TRUE, as soon as an error occurs.
ErrorID | If the error output is set, this parameter supplies the error number.

Inputs/outputs

VAR_IN_OUT
    Master	:	AXIS_REF;
    Slave	: 	AXIS_REF;
END_VAR
Master | Master axis data structure.
Slave | Slave axis data structure.

The axis data structure of type AXIS_REF addresses an axis uniquely within the system. Among other parameters it contains the current axis status, including position, velocity or error status.


MC_ReadFlyingSawCharacteristics

The MC_ReadFlyingSawCharacteristics function allows the characteristic figures for the synchronisation phase of the Universal Flying Saw to be read.

Inputs

VAR_INPUT
    Execute : BOOL;
END_VAR
Execute A rising edge initiates reading the characteristic values from the TwinCAT NC.

Note:

The data calculated is not available until the Universal Flying Saw starts.

Outputs

VAR_OUTPUT
    Done    : BOOL;
    Busy    : BOOL;
    Error   : BOOL;
    ErrorID : UDINT;
END_VAR
Done | Is set to TRUE when the data record has been successfully read.
Busy | The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the command is processed. When Busy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs, Done or Error, is set.
Error | Becomes TRUE, as soon as an error occurs.
ErrorID | Supplies the error number when the ERR output is set.

Inputs/outputs

VAR_IN_OUT
    Slave		: AXIS_REF;
    CamTableCharac 	: MC_FlyingSawCharacValues;
END_VAR
Slave | Axis structure of the slave.
CamTableCharac: | Structure containing the characteristic values.


ST_SyncMode

TwinCAT PLC Library: MC library 2 - flying saw

The ST_SyncMode data structure

TYPE ST_SyncMode :
STRUCT
    (* mode *)
    GearInSyncMode : E_GearInSyncMode;

    (* 32 bit check mask ... *)
    GearInSync_CheckMask_MinPos : BOOL;
    GearInSync_CheckMask_MaxPos : BOOL;
    GearInSync_CheckMask_MaxVelo : BOOL;
    GearInSync_CheckMask_MaxAcc : BOOL;
    GearInSync_CheckMask_MaxDec : BOOL;
    GearInSync_CheckMask_MaxJerk : BOOL;
    GearInSync_CheckMask_OvershootPos : BOOL;
    GearInSync_CheckMask_UndershootPos : BOOL;
    GearInSync_CheckMask_OvershootVelo : BOOL;
    GearInSync_CheckMask_UndershootVelo : BOOL;
    GearInSync_CheckMask_OvershootVeloZero : BOOL;
    GearInSync_CheckMask_UndershootVeloZero : BOOL;

    (* operation masks ... *)
    GearInSync_OpMask_RollbackLock : BOOL;
    GearInSync_OpMask_InstantStopOnRollback : BOOL;
    GearInSync_OpMask_PreferConstVelo : BOOL;
    GearInSync_OpMask_IgnoreMasterAcc : BOOL;
END_STRUCT
END_TYPE
TYPE E_GearInSyncMode :
(
    GEARINSYNCMODE_POSITIONBASED,  	(* synchronization based on the master position,
                            slave dynamics depend on master dynamics *)

    GEARINSYNCMODE_TIMEBASED 		(* synchronization based on a standalone slave PTP profile,
                          master independet slave dynamics *)
);
END_TYPE

Note: The time-based motion profile (GEARINSYNCMODE_TIMEBASED) is currently only implemented for the function block MC_GearInVelo.

Operation of the individual bits.


MC_FlyingSawCharacValues

TwinCAT PLC Library: MC library 2 - flying saw

Data type MC_FlyingSawCharacValues

TYPE MC_FlyingSawCharacValues :
STRUCT
(* Master Velocity*)
fMasterVeloNom : LREAL; (* 1. master nominal velocity (normed: => 1.0) *)

(* characteristic slave data *)
(*===========================*)

(* Start of cam table *)
fMasterPosStart : LREAL; (* 2. master start position *)
fSlavePosStart : LREAL; (* 3. slave start position *)
fSlaveVeloStart : LREAL; (* 4. slave start velocity *)
fSlaveAccStart : LREAL; (* 5. slave start acceleration *)
fSlaveJerkStart : LREAL; (* 6. slave start jerk *)

(* End of cam table*)
fMasterPosEnd : LREAL; (* 7. master end position *)
fSlavePosEnd : LREAL; (* 8. slave end position *)
fSlaveVeloEnd : LREAL; (* 9. slave end velocity *)
fSlaveAccEnd : LREAL; (* 10. slave end acceleration *)
fSlaveJerkEnd : LREAL; (* 11. slave end jerk *)

(* minimum slave position *)
fMPosAtSPosMin : LREAL; (* 12. master position AT slave minimum position *)
fSlavePosMin : LREAL; (* 13. slave minimum position *)

(* minimum Slave velocity *)
fMPosAtSVeloMin : LREAL; (* 14. master position AT slave minimum velocity *)
fSlaveVeloMin : LREAL; (* 15. slave minimum velocity *)

(* minimum slave acceleration *)
fMPosAtSAccMin : LREAL; (* 16. master position AT slave minimum acceleration *)
fSlaveAccMin : LREAL; (* 17. slave minimum acceleration *)
fSVeloAtSAccMin : LREAL; (* 18. slave velocity AT slave minimum acceleration *)

(* minimum slave jerk and dynamic momentum *)
fSlaveJerkMin : LREAL; (* 19. slave minimum jerk *)
fSlaveDynMomMin : LREAL; (* 20. slave minimum dynamic momentum (NOT SUPPORTED YET !) *)

(* maximum slave position *)
fMPosAtSPosMax : LREAL; (* 21. master position AT slave maximum position *)
fSlavePosMax : LREAL; (* 22. slave maximum position *)

(* maximum Slave velocity *)
fMPosAtSVeloMax : LREAL; (* 23. master position AT slave maximum velocity *)
fSlaveVeloMax : LREAL; (* 24. slave maximum velocity *)

(* maximum slave acceleration *)
fMPosAtSAccMax : LREAL; (* 25. master position AT slave maximum acceleration *)
fSlaveAccMax : LREAL; (* 26. slave maximum acceleration *)
fSVeloAtSAccMax : LREAL; (* 27. slave velocity AT slave maximum acceleration *)

(* maximum Slave slave jerk and dynamic momentum *)
fSlaveJerkMax : LREAL; (* 28. slave maximum jerk *)
fSlaveDynMomMax : LREAL; (* 29. slave maximum dynamic momentum (NOT SUPPORTED YET !) *)

(* mean and effective values *)
fSlaveVeloMean : LREAL; (* 30. slave mean absolute velocity (NOT SUPPORTED YET !) *)
fSlaveAccEff : LREAL; (* 31. slave effective acceleration (NOT SUPPORTED YET !) *)

(* reserved space for future extension *)
reserved : ARRAY[32..47] OF LREAL;

(* organization structure of the cam table *)
CamTableID : UDINT;
NumberOfRows : UDINT; (* number of cam table entries, e. g. number of points *)
NumberOfColumns : UDINT; (* number of table columns, typically 1 or 2 *)
TableType : UINT; (* MC_TableType *)
Periodic : BOOL;

reserved2 : ARRAY[1..121] OF BYTE;
END_STRUCT
END_TYPE

Type definition for the characteristic parameters of a flying saw synchronisation.


Flying saw sample program

The example program shows a typical cyclic flying saw sequence. The program manages three axes: master, slave and tool. The slave and tool axes are initially in their home position at 0. The master axis is started first. It can be regarded as a transport system that transports continuous material to a cutting unit. The material is to be cut at constant intervals. To this end the slave axis, i.e. the flying saw, is synchronised with the master axis and travels synchronous with the transport system. During this phase the tool axis is activated, which deals with the actual processing. The slave axis is then uncoupled and returns to its home position. During the return travel the next synchronisation process is started, with a point at a constant distance to the last machining position as target.

The example program requires the flying saw library and operates fully in simulation mode. Progress can be monitored in TwinCAT Scope View with the configuration provided.

Click here to save the example program:

TwinCAT NC Sample Flying Saw.zip