Question:
How does a Timer Tag work?
Solution:
There are four different modes a timer tag can operate:
- Single: fires an event once it reaches the date set in StartTime property.
- Continuous: fires an event whenever it reaches the date set in StartTime. This event is updated according to the value in RepeatInterval, which defines the interval between events.
- Daily and Monthly: fires an event one day or one month after the current date.
For Continuous, Daily, and Monthly modes, you can visualize the date/time of the next event in the NextExecTime property.
The timer from a Timer Tag is checked every second. When this happens, OnPreset event can be called if your computer’s date/time is ahead of NextExecTime.
NOTE: There may be some delays when calling OnPreset event in complex or overloaded systems; however, they are expected to last no longer than a split second.
Practical applications:
1. How can I create scripts to be performed daily??
You can set up a timer tag as Daily, and then perform the desired action at the tag’s OnPreset event.
2. How can an event be fired every 12 hours to change the value in an I/O tag?
To do so, use a timer tag set up as follows:
1 – TriggerType = 1-ttContinous
2 – TimeInterval = 12:00:00 (12 hours)
3 – StartTimer = value of the programming’s start time
So, every 12 hours an timer tag’s OnPreset event will be fired with the script created to change the value in the I/O tag.