You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
The Update Script event runs after a project is saved or updated on the Gateway. This enables you to insert a script that will run every time a project is saved.
Since multiple Timer Scripts can be added, there are separate buttons that allow you to manage each Timer Script.
- Add Timer Script - Adds a new Timer Script.
- Remove Timer Script - Will delete the selected Timer Script.
- Modify Timer Script - Will modify the settings for the selected Timer Script.
Timer Script Settings
Below is an overview of the settings for a Timer Script.
- Name: The name of the Timer script. Names must be unique per project, so two timer scripts in the same project cannot have the same name.
- Delay: The delay period in milliseconds. The meaning of this setting is dependent on the Delay Type setting.
- Enabled: Allows you disable the Timer Script when set to false.
- Delay Type: Determines how the Delay setting is utilized.
- A Fixed Delay timer script (the default) waits for the given Delay between each script invocation. This means that the script's rate will actually be the delay plus the amount of time it takes to execute the script. This is the safest option since it prevents a script from mistakenly running continuously because it takes longer to execute the script than the delay.
- Fixed Rate scripts attempt to run the script at a fixed rate relative to the first execution. If the script takes too long, or there is too much background process, this may not be possible. See the documentation for java.util.Timer.scheduleAtFixedRate() for more details.
- Threading: Determines which thread this script should run in. In other words, this setting allows you to specify if you want this timer script to share execution resources or not. The rule of thumb here is that quick-running tasks should run in the shared thread, and long-running tasks should get their own dedicated thread.
- The Shared setting means that all timer scripts will share a thread. This is usually desirable, as it prevents creating lots of unnecessary threads: threads have some overhead, so a small amount of resources are used per thread. However, if your script takes a long time to run, it will block other timer tasks on the shared thread.
- The Dedicated setting will create a separate thread specifically for the timer script to use. This setting is desirable when your scripts executions must be as consistent as possible, as other timer scripts can't slowdown or otherwise impact the execution of a script in a separate thread.
Gateway Scheduled Scripts
Scheduled scripts are events that execute at fixed times of the day, based off of the Gateway's system time. Configuration for the event is split between two tabs: Settings and Script.
The following feature is new in Ignition version 8.1.6
to check out the other new features
The settings tab allows you to give the event a unique name and determine how often it executes. Schedules are driven by cron job scheduling.
The Common Settings dropdown contains several common selections, which can be further modified with the fields and dropdowns under each unit of time.
Each unit of time consists of a field, and corresponding dropdown. The dropdown is filled with suggestions and simple options, but more complex values can be provided in the field on the left. See Crontab Formatting Reference.
The script tab houses the Python script that will execute when the scheduled event executes.
Troubleshooting Gateway Scripts
While they are technically project resources, remember that Gateway Event Scripts technically run on the Gateway. Thus the Status section of the Gateway is useful for diagnosing issues with Gateway Event Scripts.