How to modify the control cycle of a single NC axis ?

 Technical background: In Beckhoff control systems, motion control is performed by two tasks, SAF and SVB.The most important task is SAF, which is responsible for trajectory planning, position control, input and output conversion, bus refresh, and other tasks.Even the powerful TwinCAT controller, even with a 36-core server and the latest version of TwinCAT 3, only has one SAF task.The control cycle of all NC axes is equal to the SAF task cycle by default.TwinCAT NC can control up to 255 axes, and by default, the control cycle of these 255 axes is 2ms.

The problem arises: in some applications, there are many axes, and the control cycle of individual NC axes can be as low as 1ms or 500us, while the requirements for the remaining majority of NC axes are not high.In order to meet the stringent requirements of individual axes, users often shorten the SAF cycle of TwinCAT NC, resulting in a doubling of CPU resource consumption for NC control, and even having to upgrade to higher performance controllers.

Solution: In fact, the parameters of TwinCAT NC axis provide an option "Divider" to increase the control cycle of NC axis by multiple times.On the Axis Setting page, you can see:





The value of the divider is the nth power of 2.That is, 1, 2, 4, 8... and so on. This is equivalent to the control period of the axis being 1, 2, 4, 8 times that of the SAF.

In the case of a large number of axes, using a Divider on a large area can significantly reduce CPU utilization.I tested using a CX1020-0112 with 40 NC axes, including 39 virtual axes and one EtherCAT real axis, with a main frequency of 1GHz.The SAF cycle is 2ms, without PLC programs, and the CPU utilization is 22%.After setting the Divider for the 39 virtual axes to 4, the CPU utilization dropped to 15%.

Precautions:

1.After modifying the Divider of the NC axis, the bus communication cycle remains unchanged, but the synchronization cycle will increase by a corresponding multiple.For example, in the above example, if the Divider is set to 4, opening the DC interface of the EtherCAT servo drive, you can see that the value of Sycn Unit Cycle Time automatically changes to 8000us:



2. After modifying the Divider of the NC axis, the corresponding bus cycle will also be modified.

During the test, set the Divider of the 3 NC axes to 1, 2, and 4, respectively, and map them to the 3 servo drives.Observe the number of Frames and Cycles in the EtherCAT interface. You can see that the number of Frames has also increased by 3, while the Cycles are 2ms, 4ms, and 8ms, respectively.


3 .After modifying the Divider of the NC axis, the NC axes of different control cycles can no longer be linked.

Tests have shown that different NC axes of the Divider will report errors when performing GearIn, CamIn, or FIFO movements.The reason for this is that the Setpoint Generator of the NC axis generates different frequencies of position points, and the SetPosition of the NC axes in the linked master-slave axis or FIFO group should be one-to-one.Due to differences in the Divider, this correspondence is broken, so the linkage cannot be achieved.


 I just discovered this feature myself, so please feel free to report any issues you encounter during use.