How to log and graph a variable only on specific conditions (non-periodic Tag Historian)

Hi all,

I’m using Ignition 8.1.48 with the Vision, Tag Historian and SQL Brigde modules, and I need help setting up historical logging for a tag only when a certain condition is true — for example, when a tag is 1..

Here’s what I need to do:

  • Start logging a tag value only while a condition is true.
  • Stop logging when the condition goes false.
  • Plot the logged values later in an Easy Chart.
  • Make sure the data is stored in the database, not just in memory.

I don’t want the tag to be logged continuously. I only want to store values while something is happening, like when a tag is ON, and stop when that tag is OFF.

What’s the best way to approach this in Vision?

Things I’ve considered:

  • Enabling/disabling the historian dynamically (not sure if that’s possible in Vision).
  • Using a memory tag with history enabled and writing to it conditionally.
  • Using system.tag.storeTagHistory() to manually push values into the historian.

Any examples or recommendations would be much appreciated!

Thanks!

The tag historian doesn't directly support this.

The SQL Bridge module is designed to do exactly this, with a suitable trigger and period.

You can also use a gateway timer event script to do this.

What if we toggle the Enabled property for Historian using scripting?

If you're okay with the tag not updating at all when the condition is not met, you could utilize a driven tag group, configured so that the tag only scans (and stores history) based on your condition. Follow the Driven Tag Group Examples, except set the Rate to 0 seconds.

That should work, with some changeover delay. But note that is a tag configuration property, and there is overhead and internal DB churn for doing that.

Seems to me it woud be better to do this at the tag value source level. If it's a PLC, clear the tag that's historized when the condition is false.