Real-time and CPU load

For the proper functioning of the CX7293, it is important to keep an eye on CPU load and real-time compliance. Otherwise, the CX7293 will no longer work reliably in the event of an overload. Note that in the event of an overload, the load indicator is also affected and no longer provides current values. For example, a load of 40% can be incorrectly displayed, but the PLCs are no longer working in real time and the system is overloaded. You should therefore gradually approach the load limit with a small controller.

What is meant by real-time in this context? By default, the PLC works in synchronization with the cycle, which means that a task time is always defined and called at a fixed time. The PLC works in synchronization with the cycle if the task time is not exceeded. For example, if you define a task time of 10 ms and the PLC only needs 2 ms for processing, the selected task time is fine and the PLCs work in synchronization with the cycle.

Even if you do not need the real-time, it is recommended to adhere to the real-time, because otherwise negative effects can occur. These could be connection problems or problems with subsystems such as K-bus or EtherCAT. You can perform the following steps to check whether the CX7293 is optimally set or rather overloaded:

Observe the exceed counter

The exceed counter is incremented as soon as the PLC no longer works in synchronization with the cycle and the defined task time is exceeded. Ideally, the counter value should be zero.

Real-time and CPU load 1:
Display of the exceed counter in TwinCAT.

It is possible for the exceed counter to be incremented at the start of the PLC, for example, because the PLC is called for the first time or certain components are initialized. Observe the exceed counter over a period of several hours. One can only speak of a stable state when the exceed counter is no longer incremented over a longer period of time.

Check the CPU load

In TwinCAT, the CPU load is displayed under Realtime and on the Online tab. Check the value to determine whether you can run additional program code or reduce the task time.

Real-time and CPU load 2:
Display of the CPU load in TwinCAT.

The light green line indicates the preset CPU limit. If the load is ≥ 65%, the CX7293 is already very busy and no more code should be executed or the task time shortened. You should not go to the limit and use the CX7293 to full capacity.

Measures in the event of overload

If an overload is detected with the help of the steps shown, the load can be reduced by improving the programming or increasing the task time. To find places in the program code with long processing times, the sample in Measuring processing time in the PLC program can be used.

The selected terminal system also has an influence on the real-time. Depending on the number of terminals, the K-bus, for example, can also take several milliseconds and must be taken into account when choosing the task time. It may well be that, with a set task time of 10 ms, the PLC program only needs 5 ms, but the exceed counter still increments. This is due to the fact that the K-bus requires more than 5 ms for processing and the task time of 10 ms including PLC program and K-bus is exceeded. This problem can be solved by reducing the number of terminals or increasing the task time.

By default, the real-time is set to 80%. This is already the maximum value and an increase to 90% is equivalent to an increase to 100%.

Real-time and CPU load 3:
Setting the real-time load in TwinCAT.

TwinCAT would then consume all the CPU power, and services that the operating system serves would no longer work or would not work adequately. If you increase the real-time load to 90%, you should be aware of the potential consequences for the operating system.