DriveWorks Pro 16: Start Specification Timer [send feedback...]

Start Specification Timer

The Start Specification Timer Task will start a Specification Timer to periodically run a Macro based on the Interval, Count and Macro Name Properties.

A Specification Timer will trigger a named Specification Macro each interval until one of the following occurs;

  • The Count is reached
  • The Cancel Specification Timer task is used
  • The Specification is Transitioned away from a Running State
Specification Timers only function in Running States.

Properties

Property NameDescription
Timer NameThe name to give to the Timer being started. If left blank, the Timer will be called “Default”.
IntervalThe interval in seconds of how often the Macro should run.
CountThe number of times the Macro should be run. To continually run the timer until it is canceled, set this to 0.
Stay On ScheduleIf TRUE, the timer will not be halted during Macro execution meaning that if execution carries on into the next interval of the Timer, that interval will be skipped. If FALSE, the Timer will be paused during Macro execution and resumed upon completion, meaning every interval is respected.
Macro NameThe name of the Macro in the Project.
Macro Argument

Provides an optional argument to the Macro.

Click here for more information...
Counter ConstantOptional. The name of a Constant which will receive the Counter value of the Timer on each iteration.

Concept

Stay On Schedule

The Stay On Schedule property has the most impact in situations where the time taken to execute the Macro is either longer than or a significant proportion of the Timer Interval.

The following scenarios demonstrate the effect of the Stay On Schedule Property.

Scenario 1

Property NameDescription
Interval2
Count3
Stay On ScheduleFALSE

Execution of the macro takes 4 seconds.

Timer is started at 12:00:00

The first Macro will be triggered at 12:00:02 (Start time + Interval)

The Specification Timer will be paused until completion of the Macro at 12:00:06

The macro will be triggered for a second time after another 2 second Interval, at 12:00:08

As before the Specification Timer will be paused until completion of the Macro at 12:00:12

The Macro will be triggered for a third time after another 2 second interval, at 12:00:14

Third Macro completed at 12:00:18

The Specification Timer has reached the Count Property value and will stop, all Macros have been completed by 12:00:18

In this scenario the macro is triggered three times, and the Specification Timer will be paused whilst each Macro is completed. The Specification Timer will only continue to tick after the Macro is completed, meaning this Specification Timer is NOT on schedule.

Scenario 2

Property NameDescription
Interval2
Count3
Stay On ScheduleTRUE

Execution of the Macro takes 4 seconds.

Timer is started at 12:00:00

The first Macro will be triggered at 12:00:02 (Start time + Interval)

The Specification Timer will continue whilst the Macro is executed.

The Specification Timer will tick at 12:00:04 (Start time + 2 Intervals), but the Macro cannot be triggered as the first Macro is still being completed.

The Specification Timer will tick again at 12:00:06 (Start time + 3 Intervals), the first Macro will now be complete, enabling a second Macro to be triggered.

Second Macro completed at 12:00:10

The Specification Timer has reached the Count Property value and has stopped, two Macro executions have been completed by 12:00:10

In this scenario the Macro is triggered twice, and the Specification Timer will continue to tick every two seconds whilst each Macro is running. A Macro will only be triggered when no Macro is running. In this scenario the Specification Timer is constantly ticking, meaning this Specification Timer IS on schedule.

The effect of the Stay On Schedule Property is summarized in the following table.

SummaryScenario 1Scenario 2
Stay On Schedule PropertyFALSETRUE
Number of Macro Executions32
Timer lifespan (seconds)1810

Restarting Specification Timers

If the Start Specification Timer Task is run while a Specification Timer of the same name is already running, the currently running Specification Timer will be stopped and a new instance of the Specification Timer will start.

To run multiple Specification Timers simultaneously each Specification Timer will need a unique name in the Timer Name Property.

Examples

When this task is added the properties are static by default. See How To: Change A Static Property To A Dynamic Property to enable rules to be built on these properties.

Start a Specification Timer to toggle between images displayed on a Form

The Specification Timer started by this Task will run a Specification Macro every 10 seconds continually. The Specification Macro will toggle between two images displayed on a DriveWorks Form.

Property NameExample RuleExample ResultMeaning
Timer Name"Image Toggle"Image ToggleThe name given to the Specification Timer. This name can be used in the Cancel Specification Timer Task to cancel this Specification Timer.
Interval1010The 'ChangeImage' Macro will be ran every 10 seconds.
Count00The Specification Timer will be run continually.
Stay On ScheduleFALSEFALSEThe Specification Timer will be paused during Macro execution.
Macro Name"ChangeImage"ChangeImageThis is the name of the Specification Macro that will be ran each interval.

Refresh SQL Data periodically during a Specification

If you have multiple users updating SQL data simultaneously you may wish to make sure that any updates are included in all currently running Specifications. Specification Timers can be used to do this.

Repeatedly running large SQL queries can negatively impact Project performance.

Property NameExample RuleExample ResultMeaning
Timer Name"Refresh SQL Data"Refresh SQL DataThe name given to the Specification Timer. This name can be used in the Cancel Specification Timer Task to cancel this Specification Timer.
Interval6060The 'QueryData' Macro will be ran every 60 seconds.
Count00The Specification Timer will be run continually.
Stay On ScheduleTRUETRUEThe Specification Timer will continue during Macro execution.
Macro Name"QueryData"QueryDataThis is the name of the Specification Macro that will be ran each interval.
Counter Constant"DWConstantDataUpdateCount"DWConstantDataUpdateCountThe number of times the Specification Timer has ticked is stored in this Constant. This value can be used elsewhere in the Project.

Table of Contents