About This Application scripts. Consequently, the mechanism used to execute the Alarm , Scheduler , and Trend tasks cannot be applied to the Math task. The Background Task executes the Math task for no more than 10ms continuously before switching to other task (such as the Scheduler ). The Background Task cannot execute the Math task again for the next 50ms; however, the Background Task can execute other tasks ( Alarm , Recipe , Report , Scheduler , or Trend ) during this 50ms period. After the Background Task executes all of the Math worksheets, it will not begin a new scan of the Math worksheets until IWS generates a new Period message for the Math task.
It is important to re-emphasize that this process was created to prevent 100% CPU usage all the time. Caution: We recommend caution when using 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 how you configured the script in the Math worksheet (especially for loops).
If you configure a Math() function for a screen object, the Viewer stops updating the screen until the Viewer executes the entire Math worksheet called by the Math() function. If you must use 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, IWS 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. InduSoft Web Studio Page 25