Mastering DeltaV Operate > The Scheduler

Scheduler basics

Before you start scheduling entries, you should understand how the Scheduler executes scripts. The Scheduler can run as a foreground or background task. When you run a schedule in the foreground, it runs on the same thread as the scripts in DeltaV Operate, allowing you to quickly test and debug scripts in the run-time environment. When you run a schedule in the background, it runs on a separate thread from the scripts in DeltaV Operate, monitoring the system and triggering scheduled events.

The Scheduler does not loop; it waits for events to occur. When a selected event occurs, the script is triggered from a schedule running in the background, it is added to the queue, and it executes after the scripts in front of it have finished executing. For this reason, when a schedule is run as a background task it is ideal for monitoring tasks. This is exactly the same as scripts triggered from schedules running as foreground tasks in DeltaV Operate.

Generally, schedules created to run in the foreground are used for testing and debugging. Once a schedule created to run in the foreground has been tested and debugged, we suggest that you set it to run in the background. Refer to Running Foreground and Background Schedules for more information.

Note You must copy the schedule file (*.EVS) from the ProfessionalPLUS workstation to those Operator Stations that require that schedule.

Using the Scheduler

Schedules are spreadsheets with separate tabs for event-based entries and time-based entries. Double-clicking an empty row in a schedule displays a dialog box for adding an entry. Once you have created an entry, you can edit individual cells in the spreadsheet without using the dialog box.

Time-based entries create a timer object while event-based entries create an event object. These objects have associated properties, methods, and events that you can use in VBA scripts. They are displayed in the system tree and are the objects to which scheduled scripts are tied.

Securing the Scheduler

DeltaV Operate's schedule protection prevents unauthorized users from accessing or modifying schedules. To configure security for your schedules, enter a security area in the Properties window.

Resolving Schedules

Database information for each data source in a schedule is saved as part of the file on disk. When a schedule executes in the run-time environment, and the database information is not up-to-date, DeltaV Operate queries the database and the tag definitions. This can be a time-consuming process which slows the execution of the schedule.

Resolving schedules removes the need for DeltaV Operate to query the database. Therefore, resolved schedules execute faster in the run-time environment. We recommend resolving your schedules as a final step in the configuration process. The Resolve feature is available for both schedules and pictures.

If the process database is modified after you resolve a schedule, you need to run Resolve again. These modifications include:

  • Loading a different database.

  • Deleting database tags.

Writing VBA Scripts to Access DeltaV Operate

When you write a scheduled script that opens, closes, replaces, or accesses a property of an object in a picture, you must ensure that DeltaV Operate is running and that the picture you need to access is open and active. This differs from writing scripts that run from pictures.

Before you can access any information about the active picture in DeltaV Operate, you must activate DeltaV Operate using the GetObject method as shown in the following example.

Dim AppObj As Object
Set AppObj = GetObject("","Workspace.Application")

You can now check to see if the picture is open:

If UCase(AppObj.ActiveDocument.Name) = UCase("MyPicture") 
Then
<perform a task or open the picture>

You can then check to see which document or picture is open, and replace it if it is not the one you need. Once the proper picture is open, you can access it's objects.

Refer to Writing Scripts for more information on using VBA with DeltaV Operate.

Debugging VBA Scripts

If a scripting error occurs while a schedule is running, the VBE debugger automatically launches to allow you to quickly edit and save the changes made to the script. If the schedule is running in the foreground when the VBE launches, any changes made to the script are automatically saved in the schedule. If the schedule is running in the background when the VBE launches, close the VBE editor, re-open it in DeltaV Operate, and make the necessary changes to the script. Any changes made to the script are automatically saved in the schedule.

Note

In order for scripting changes to be saved in a schedule, the VBE must be started in DeltaV Operate. Any scripting changes made in the VBE launched from the FixBackgroundServer task will not be saved in a schedule.