Skip to main content
Question

Frequency Count

  • March 27, 2026
  • 1 reply
  • 30 views

DHSULLIVAN
Navigator

I would like to create a tag that tracks the hourly frequency that a block valve activates.  For example, The valve opens 20 time an hour.  How can I trend this performance metric? The valve tag is a digital tag.

1 reply

Forum|alt.badge.img
  • Employee
  • March 30, 2026

Hi ​@DHSULLIVAN ,

This is a great use case for Custom Calculations specifically the Event Count example from our custom-calculations GitHub repo. You'll find it under regular_intervals_examples/event_counter.py.

That script does exactly what you're after: it runs a value-based search on your digital tag and counts how many times the condition triggers per time block. You'd adapt it to search for your valve's "Open" state and count activations per hour. The result is a stepped tag that gives you one value per hour e.g., 20 activations between 08:00 and 09:00.

If you'd also like to see the count build up in real time within each hour (1, 2, 3… resetting every hour), check out the Incrementing Counter example (regular_intervals_examples/incrementing_counter.py).

One thing to keep in mind: hourly intervals need a slightly different approach than daily/weekly ones the repo README explains this, but in short you'd use a built-in hour tag (like TM_hour_Europe_Brussels) to define your hourly blocks.

Once saved, you can trend, search on, and add these tags to dashboards like any other tag.

Heads up: Custom Calculations is an advanced feature that requires an MLHub license. If you need a hand with the setup, reach out to your CSM!

Kind regards
Frederik