Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

Execute and switch the background task

  • Last UpdatedOct 26, 2026
  • 3 minute read

The Background Task executes scripts from the Script, Math, and Scheduler worksheets (for example, messages from Alarm and Trend worksheets). In addition, the Background Task executes all Recipe and Report commands when the Recipe or Report functions are executed during the runtime.

Although the Alarm, Math, Scheduler, Script, PythonScript, and Trend tasks are not threads, you can specify or change their Period time in the Program Settings.ini file located in the program directory.

The Period default values (in milliseconds) are as follows:

[Period]

Math=100

Sched=50

Alarm=100

Script=100

PythonScript=100

Trend=1000

These values mean that every 100 ms, AVEVA Edge generates a Period message to the Math task. Every 50 ms, it generates a Period message to the Scheduler task, and so on.

Note: We strongly recommend that you do not modify the Background Task default values unless it is absolutely necessary. Configuring any of these parameters incorrectly can cause your entire system to malfunction (for example, CPU usage will go to 100%) and/or cause some tasks to perform poorly.

If you must change the parameter defaults, note the values before making your changes so if a malfunction occurs you can return to the original settings.

Keep in mind that the Background Task thread has the same priority as other threads in (Drivers, Viewer, and so forth), which means that the operating system will not execute this task continuously for more than 20 ms.

The Background Task executes the Recipe and Report worksheets when the Recipe and Report functions are called, respectively. Because the Recipe and Report functions are synchronous, once the Background Task starts executing the functions, it will not switch to another task (Alarm, Math, Scheduler, Script, PythonScript, or Trend) until it completely executes the functions. Executing a Recipe or Report function usually takes a few milliseconds.

The Background Task must switch between the Alarm, Math, Scheduler,Script, PythonScript, and Trend tasks. When Background Task switches to the Scheduler task, it will not switch to another task (Alarm, Math, Script, PythonScript, or Trend) until all Scheduler worksheets are executed. After executing all Scheduler worksheets, the Background Task will not execute the Scheduler again until it receives the next Period message for the Scheduler task.

The Background Task applies the same behavior when executing the Alarm and Trend tasks — when the Background Task switches to the Alarm or Trend task, it will not switch to another task until it handles all pending messages. So, the Background Task will not execute the Alarm or Trend task again, until AVEVA Edge generates the next Period message for each of these tasks.

The Background Task typically executes the Alarm, Scheduler, and Trend tasks in a few milliseconds. Math worksheets run to completion once they are started, and can require more time to execute. Even though the Script and PythonScript tasks are handled by the Background Task, they run to completion in their own threads and don't share time with the other Background Task tasks.

It is important to re-emphasize that this process was created to prevent 100% CPU usage all the time.

Note: We recommend minimizing or eliminating the use of the Math function in a Scheduler worksheet or for a screen object (such as the Command animation).
When the Scheduler task executes a Math function, no other task can be executed by the Background Task until the Scheduler executes the entire Math worksheet called by the Math function. This process can take several milliseconds or even seconds, depending on the script in the Math worksheet (especially when using loops).
If there is a Math function configured for a screen object, the Viewer stops updating the screen until the Viewer executes the entire Math worksheet called by the Math function.
If your project requires the Math function for the Scheduler task or a screen object, we recommend using the following procedure to prevent process delays:
1. Specify one auxiliary tag with the value 1 and the Scheduler or Viewer task will send a message to the Tags database to update this tag value.
2. Configure the tag in the Execution field of the Math worksheet to be executed. When the Background Task scans the Math worksheet, AVEVA Edge will execute the worksheet.
3. Reset the tag in the last line of the Math worksheet (write the value 0 to the auxiliary tag).
As a result, the Background Task will not execute the Math worksheet in the next scan unless the auxiliary tag is set to the value 1 again.

Related Links