Using External Control (TC1701)
The "External Control" interface allows external applications to control the cycle tick. The advantage of specifying the cycle tick here is that the program can be simulated more quickly if the complexity of the model allows it. Conversely, the TwinCAT application can also be executed more slowly if the calculation of a model in the external application takes longer than the set cycle time.
On the other hand, this also means that the overall system does not execute - and therefore does not process - any code if no corresponding instruction has been issued.
The application can automatically switch back to normal cyclic execution in the code.
Use
The TwinCAT 3 Usermode Runtime must be called with the command line parameter "-f 0x4". The easiest way to achieve this is to extend the corresponding Start.bat in the ProgramData: start "%TC_INST_NAME%" /min "%TWINCAT3DIR%Runtimes\bin\TcSystemServiceUm.exe" -t bin -i path -n %TC_INST_NAME% -c .\3.1 -f 0x4
This enables the functionality of switching between the modes described below.
If this mode is set to the value RtMode_Externaltick
in a real-time program by the PLC or a C++ module using the ITcRTimeSimulation interface, the execution of the code is stopped.
In the following, the ADS interface External Control can be used to control the execution by specifying 1..n cycle steps.