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

Application Server

Execute scripts

  • Last UpdatedAug 06, 2024
  • 3 minute read

Execute scripts are called each time the AppEngine performs a scan and the object is OnScan.

The Execute script method is the workhorse of the scripting execution types. Use the Execute method for your run-time scripting to ensure that all attributes and values are available to the script.

If the Quality check-box is checked, the Execute method is similar to InTouch HMI scripts with the following conditional trigger types:

  • Periodic: When going OnScan, a script with a periodic trigger executes immediately (at the next scheduled scan period of the AppEngine). It then executes periodically whenever the elapsed time evaluates as true.

  • Data Change: Executes when a data value or quality changes between scans.

For the following trigger types, data changes between each scan are not evaluated, only the value at the beginning of each script is used for evaluation purposes. For example, if a Boolean attribute changes from True to False to True again during a scan cycle, this change is not evaluated as a data change as the value is True at the beginning of each scan cycle.

  • OnTrue: Executes if the expression validates from a false on one scan to a true on the next scan.

  • OnFalse: Executes if the expression validates from a true on one scan to a false on the next scan.

These scripts also have time-based considerations. A trigger period of 0 means that the script executes every scan.

Time-based scripts, WhileTrue, WhileFalse, and Periodic are evaluated and executed based on the elapsed time from a timestamp generated from the previous execution, not on an elapsed time counter. It is possible that a change in the system clock can change the interval between execution of these scripts.

  • WhileTrue: Executes scan to scan as long as the expression validates as true at the beginning of the scan.

  • WhileFalse: Executes scan to scan as long as the expression validates as false at the beginning of the scan.

For example, a periodic script is set to run every 60 minutes. The script executes at 11:13 AM. We expect it to execute 60 minutes later at 12:13 PM. However, a time synchronization event occurred and the node’s time is adjusted from 11:33 AM to 11:30 AM.

The script still executes when the system time reaches 12:13 PM. But because of the time change, the actual (True) time period that elapsed between executions is 63 minutes.

Execute scripts for redundant AppEngines

This section outlines whether or not the script will run under various scenarios, including including deploy, forced failover, system failure, system startup, and undeploy operations.

The selected redundancy mode, Legacy or Run Warm, does not change the behavior of Execute scripts for redundant engines. For both Legacy and Warm Redundancy modes:

  • The Active engine is triggered on execute.

  • The Standby engine is NOT triggered on execute.

Both redundancy modes

Primary engine (server 1)

Backup engine (server 2)

Execute script

Action

Initial state

End state

Initial state

End state

Script execution

Deploy

Down

Active OnScan

Down

Standby

Execute scripts run after the active engine transitions to onscan, at the next scheduled scan period of the AppEngine.

Force Failover

Active OnScan

Standby

Standby

Active OnScan

Execute scripts run after the standby engine transitions to onscan, at the next scheduled scan period of the AppEngine.

Server 1 Failure (hard shutdown)

Active OnScan

Down

Standby

Active OnScan

Execute scripts run after the standby engine transitions to onscan, at the next scheduled scan period of the AppEngine.

Server 2 Failure (hard shutdown)

Active OnScan

Active OnScan

Standby

Down

Execute scripts run at the next scheduled scan period of the AppEngine.

Graceful shutdown of Server 1 platform or engine using OCMC

Active OnScan

Down

Standby

Active OffScan

Execute scripts do not run when the OCMC shuts down a platform or active engine on server 1. The standby engine on server 2 remains offscan.

Graceful shutdown of Server 2 platform or engine using OCMC

Active OnScan

Active OnScan

Standby

Down

Execute scripts do not run when the OCMC shuts down a platform or standby engine on backup server 2. The active engine on server 1 remains running onscan.

Start Server 1 only

Down

Active OnScan

Down

Down

Execute scripts run after the active engine transitions to onscan, at the next scheduled scan period of the AppEngine.

Start Server 2 (Server 1 running)

Active OnScan

Active OnScan

Down

Standby

Execute scripts run at the next scheduled scan period of the AppEngine.

Undeploy

Active OnScan

Down

Standby

Down

Execute scripts do not run during an undeploy operation.

TitleResults for “How to create a CRG?”Also Available in