Schedule
A Schedule event trigger executes when a
schedule frequency (type of schedule) and occurrence
criteria are met.
The schedule frequency options include: Periodic,
Hourly, Day of Month and Weekdays.
The occurrence criteria is specific to the schedule
frequency.
The trigger component handles the calculation of the
schedule frequency and occurrence criteria. If the
occurrence criteria is met, the schedule event trigger is
scheduled to execute.
This alleviates the trigger's application logic from
determining the frequency and occurrence criteria since the
last instance of the trigger's execution before deciding to
execute the application logic in the trigger's actions.
A Schedule event trigger can also be manually executed
using the Workbench and the trigger's pop-up menu
(right-click the trigger) and the Fire
Trigger option.
Using the Workbench to manually execute a Schedule event
trigger does not impact the trigger's schedule for being
executed (Periodic, Hourly, etc.).
Defining a schedule event trigger
To define a schedule event trigger, follow these steps:
- From the Workbench left pane, expand the node where
you want to define the schedule event trigger.
- Select the Project icon to display
the Projects window, right click a
specific project tab to display its pop-up menu, and
then click New.
You also can select the New button at the bottom of the Projects window when a specific project tab has already been selected. - The new Trigger window
appears.
Name the trigger. The trigger name can be up to 64 characters and include letters, numbers, and the underscore character. Spaces are allowed. - From the Event tab, select the
Trigger Event Type down-arrow, and
then select Schedule.
The Event tab becomes active with parameters that accommodate the schedule event. - Use the Frequency down-arrow to
display a list of options, then select the frequency
option you want to use.
Each frequency option has specific occurrence parameters.
The following describes each frequency option and its occurrence parameters:
Option | Description |
---|---|
Periodic | The Periodic option
is used to specify a millisecond
interval.
|
Hourly | The Hourly option
is used to specify the number of
minutes after the hour and the days of
the week.
|
Day of Month | The Day of Month
option is used to specify a time and
day of the month, for one or more
months.
|
Weekdays | The Weekdays option
is used to specify a time, the day, the
week, and the month.
|
Schedule event type trigger event variables
The input event variable available to a schedule event trigger is:
Event variable | Data type | Description |
---|---|---|
Scheduled Time | TIMESTAMP | The date and time that the trigger was scheduled to execute. This is usually the same as the $EVENT_TIME macro. |
Complete the trigger definition
Complete the definition of the trigger, including the follow trigger components:
- The trigger's actions
- The trigger's local variables, static variables, macros and event variables
- The trigger's settings.
Use the Validate button to check the
parameters and then the Save button to
save the trigger's definition.
The trigger will be listed in the Project's tab list of
triggers in the Stopped state.
Schedule event trigger frequency and occurrence criteria considerations
The Frequency option and Occurrence criteria parameters control how frequently a schedule event trigger executes.
The requirements of the application, the characteristics of any device variables' updates and the capability of the system need to be understood when designing the application solution. Considerations include:
- If the event requirement for when a trigger
executes naturally aligns with one of the available
trigger event types, then use that trigger event type
instead of using a schedule event trigger.
For example, if a trigger needs to execute when a device variable's value meets a certain condition, then use a data event trigger.
If a schedule event trigger was used instead, then every time it was executed, it would need to determine if the device variable's value current value meets the condition before continuing with the application logic. This is an inefficient use of system resources. - If you have a requirement to execute a trigger for
a shift-based configuration (for example, 3 times a
day, at 8 hour intervals, beginning at 8:30 AM) that
has a frequency that can not be directly satisfied with
the frequency and occurrence options, you will have to
use the options available to satisfy the
requirement.
For this example, you could create three separate schedule event triggers that use the Weekdays option. One trigger could be called shift1 with a trigger time of 8:30 AM. A second trigger called shift2 with a trigger time of 4:30 PM, and a third trigger called shift3 with a trigger time of 12:30 AM. You further can use the schedule event triggers along with a subtrigger event trigger to organize common trigger logic. The three schedule event triggers could all call a single subtrigger event trigger where the common application logic was defined.