Executing Asynchronous Methods - Overview
Methods that perform reading or writing operations of device parameters via SERCOS service channel might take an especially long time. An execution as an asynchronous method in the currently operating program is advisable in this case.
Up to now, it was required to increase the cycle time for executing this method so that the task accessing these device parameters is stopped until the parameter value has been called up. By means of the CmpAsyncMgr library from PD_PacDriveLib V.1.2.9.0 onwards, you have the opportunity to execute these methods in an additional task, which is created (async mechanism).
The CmpAsnycMgr library contains function blocks and structures necessary to create an additional task. In this task, the asynchronous method can be executed.
In the PD_PacDriveLib V.1.2.9.0 the, following elements were added which can be used for executing asynchronous methods:
oIF_Async interface containing Job() method and xDone property that are required to use the async mechanism.
oIF_AsyncManager interface containing the methods Init() and Start() used for generating additional tasks.
When optimizing parts of an application, time critical tasks are relieved by swapping suitable tasks to async tasks. By this optimization maybe the runtime behavior of the application will change. Therefore, the consideration of optimization must always include the whole application.
NOTICE |
ASYNCMECHANISM CHANGES THE TIME BEHAVIOR OF THE APPLICATION. |
On critical time cases, no change to the runtime behavior of the tasks which are not interacting between asynchronous and cyclic tasks must occur. |
Failure to follow these instructions can result in equipment damage. |
In order to use the asynch mechanism, you can
oimplement a function block implementing the IF_Async interface (see also Program example) or
ouse the following five function blocks of the PD_PacDriveLib without the cycle time being increased:
For the mentioned POU you can use the AsyncMechanism. The cycle time monitoring does not have to be switched off. If you want to use the function blocks of the PD_PacDriveLib without increasing the cycle time, you have to
oset Gc_udiNumOf AsyncTasks to a value ≠ 0,
oset G_xEnableAsyncCalls to TRUE and
ocall up the Init() method according to the displayed Program example.
NOTE: There is no timeout monitoring of the Async jobs in the aforementioned POUs. A timeout with regard to the successful execution of the POU functionality must therefore be identified and implemented in the application. For the timeout condition the feedback signals q_etDiag and q_etDiagExt can be used.