Synchronous and Asynchronous Operation Modes
Synchronous and Asynchronous Operation Modes
This is a vital setting that determines the working principle of your scripts.
| Mode | Description | When to Use? |
| Synchronous | SCADA waits until the script finishes its operation before continuing with other tasks. | Prefer this if the script is small, executes quickly, and contains no delays. The performance cost is low. |
| Asynchronous | SCADA runs the script in the background and proceeds with other tasks without waiting for it to finish. | Use this mode if the script is large or contains operations that require waiting (e.g., fetching data from the internet, long database queries). |
Control Mechanism in Asynchronous Execution
In asynchronous scripts, monitoring the Done bit is crucial to manage the risk of the script being triggered multiple times simultaneously.
- Start: Before the script starts running, the relevant Done Tag is set to False.
- Completion: When the script execution finishes, the Done Tag is set to True.
- Check: Always check if the Done Tag is True before triggering the script. If it is False, it means the previous execution is still in progress, and a new execution should be avoided.
