Search code examples
twincat

What do the I/O Idle Task and the PlcAux Task do in TwinCAT?


There are two default tasks which always get added to a newly created TwinCAT project: the I/O Idle Task and the PlcAux Task. I wonder what these tasks do and are responsible for? And what are the influences when I for example change their respective cycle times.

There is no information on Beckhoff's InfoSys about these tasks. I also asked Beckhoff support, but only got the following short answers:

  • I/O Idle Task: Will be created when an EtherCAT master is created. Asynchronous communication with the nodes like CoE read/write, file download, etc. The IO Idle manages the EtherCAT state machine (going into PreOp, SafeOp, Op). It does not update directly the IOs.
  • PlcAuxTask: Has a very low priority. Any kind of ADS communication.

On the rest of the internet I only found this explanation in German:

Die IO-Idle Task ist u.a. zuständig für die StateMaschine des EtherCATs... Für die IOs selber (also EtherCAT triggern und Daten transferien) ist sie nicht zuständig. Allgemein würde ich mal sagen: Die Standard-Konfig ist eigentlich OK, viel langsamer als die 1msec würde ich sie nicht machen da du sonst irgendwann Zeit-Probleme bekommst weil timouts der Geräte anschlagen wenn sie hochgefahren werden.. Die Prio kann man manchmal etwas vermindern... aber hier muss das Gesamtbild im Auge haben.

Zur Aux-Task... sie ist eigentlich in einer niedrigen Prio wie du oben geschrieben, kann sich aber bei Onlinechanges in der Prio hochboosten. Davon bekommt der Nutzer aber nichts mit.

Deepl translated:

The IO Idle Task is among other things responsible for the state machine of the EtherCAT... It is not responsible for the IOs themselves (i.e. triggering EtherCAT and transferring data). In general I would say: The standard config is actually OK, I would not make it much slower than the 1msec because otherwise you will get time problems because timouts of the devices hit when they are started... Sometimes you can reduce the prio a little bit... but here you have to have the whole picture in mind.

About the aux task... it is actually in a low prio as you wrote above, but can boot up in prio during online changes. However, the user does not notice this.

Is there anybody who can give a better and more detailed explanation on these mysterious tasks and their purpose?


Solution

  • I've had the same questions previously and spoken with Beckhoff Support about this. I don't think this is the answer to your question and don't have any concrete links to documentation, but I think information sharing this is a good starting point. As I understand it:

    PlcAux and I/O Idle Task Cycle Times (and priorities)

    Beckhoff support strongly advised that you should not adjust the priority of either PlcAux Task (Priority 50) or I/O Idle Task (Priority 10). Additionally they suggested to not adjust the cycle time of I/O Idle Task.

    Instead your other tasks should be scheduled in such a way that allows for the execution of PlcAuxTask and I/O Idle tasks. Tasks are schedule with Priorities and Cycle times. If High Priority tasks are taking close to or exceeding their allotted cycle time, little time will be available for lower priority tasks and they will be interrupted frequently.

    For example, interrupting or preventing Plc Aux Task from running can interrupt ADS communications which are used by things like the Modbus TCP server or OPC Server, etc.

    PlcAux task

    The PlcAux task is responsible for processing ADS read / write requests and it can only execute if all other tasks are not executing anything.

    It is given a priority of 50 by default. This is a much lower priority than the standard PLC tasks. This results in PLC tasks completing first, before the PlcAux task is given processor time.

    I/O Idle Task

    Among other things (not really helpful I know), it is responsible for the state machine of the EtherCAT and for handling all IO processes, such as reading and writing parameters via the asynchronous channel (CoE).

    It is not responsible for cyclic communication and the IOs themselves (i.e., triggering EtherCAT and transferring data).

    My TLDR:

    PlcAux task

    • The "PLC overhead" task
    • handles all the ADS overhead and requires some cycle time to complete. (It can use whatever CPU is not being used by your program).
    • Not allowing time for PlcAux task to complete will result in strange performance issues (e.g slow OPC or Modbus TCP problems), but you do not want this task to be higher priority than your user tasks.

    I/O idle task

    • Deals with getting getting IO into the program, is generally very quick to complete, and shouldn't really be touched.