Option 3.2.9. Timer/Counter

A Timer/Counter point records the following data in three array elements:

A count of the number of times the Expression has transitioned from the LOW state to the HIGH state since the project started or since the Timer/Counter point was reset.

The Expression is in its:

LOW state if its value is less than or equal to zero

HIGH state if its value is greater than zero

The accumulated duration of all HIGH states, stored in seconds.

0 or the time of the last transition to HIGH.

While the Expression is in the:

LOW state, this field contains zero

HIGH state, this field contains the time the Expression transitioned to the HIGH state.

Time is stored in the number of seconds since 00:00:00 on January 1, 1970 GMT (Greenwich Mean Time). If you computer's clock is set for another time zone, this value is translated accordingly. For example, if your computer's clock is set for Eastern Standard Time, the base time is 19:00:00 31 December 1969.

General Tab in the Point Properties dialog box.

Virtual Tab in the Point Properties dialog box.

General Tab in the Point Properties dialog box

Selections on the General tab are as follows.

1

Data type

2

Elements

 

1

Data type field (General tab)

Select UDINT.

2

Elements (General tab)

Select 3.

During runtime, the value of the Expression determines how information is stored in the array.

When the Expression transitions from its LOW state to its HIGH state:

The first element of the array is incremented.

The third element of the array is set to the current system time

The Interval timer starts.

While the Expression remains in its HIGH state, the duration time in its second element is increased at every Interval.

When the Expression transitions from its HIGH state to its LOW state, the third array element is set to zero.

While the Expression remains in its LOW state, no elements of the array are updated.

Up

Virtual Tab in the Point Properties dialog box

Selections on the Virtual tab are as follows.

1

Expression

2

Reset point

3

Start time

4

Interval

 

1

Expression

Enter an expression that will serve as the "edge trigger" for the Timer/Counter.

The expression may contain:

One or more Point IDs as well as

Constant values, operations, and functions.

Buttons to help with the equation are as follows.

Opens the Expression Editor.

Displays a Popup menu to:

 

Open:

The Select a Point browser.

The Point Properties dialog box for a selected point.

A New Point dialog box.

The Expression Editor.

Display an extended menu with the associated operations.

Up

2

Reset point

During runtime, when the reset point updates, the elements of the Timer/Counter point are reset to 0.

Example

Three Timer/Counter points are updating every 15 seconds

You can define their start times as follows to distribute system load:

Point ID

Start Time

Point1

00:00:05

Point2

00:00:10

Point3

00:00:15

You want to update the Timer/Counter point every ten minutes while the expression is in the HIGH State.

Enter 00:10:00 in the Interval field to update each Timer/Counter every ten minutes from the time it started.

 
Point ID

While the expression remains high, will update every
10 minutes in the hour beginning at:

Point1

00:00:05

Point2

00:00:10

Point3

00:00:15

When the Expression value goes HIGH, the values in the Timer/Counter point are updated. After that, the updates are done every ten minutes.

Note: Buttons to the right of the Reset Point  field helps with configuration.

Opens the Select a Point browser to select an available point.

Displays a Popup menu to:

 

Open:

A New Point dialog box.

The Point Properties dialog box for a selected point.

The Select a Point browser.

Select a recently selected point.

 

3

Start time

Enter a Start Time that is at least 00:00:01 to be a base start time for the Interval.

The format is hh:mm:ss

Where

hh is the hour,

mm is the minute, and

ss is the second value.

If you have a large number of Timer/Counter points being updated at a high frequency, system performance can be adversely affected. You can use Start Time to distribute their updates to different times and reduce the impact on system performance.

Up

4

Interval

Enter the time Interval between the Timer/Counter point updates while the Expression value remains HIGH.

The format is hh:mm:ss

Where

hh is the number of hours,

mm is the number of minutes, and

ss is the number of seconds.

Up

More information

Step 3.2. Configure virtual calculations.