Boss Mode: Ignition 100-Millisecond Tag History

Our very own Bill Bohn has been moving from one top secret project to another! On one really large machine, he encountered a problem a couple of months ago. After using some Corso Systems ingenuity, he was able to put together a really elegant solution. Remember to give Bill a round of applause so he continues to share his expertise!!

The Problem: Capture 12 Key Process Values Every 100ms

For a recent project, Corso Systems needed to capture the history of twelve key process values for a high precision machine at a rate of 100ms. Ignition’s built-in Tag Historian was fairly adequate in storing history at this rate, but would occasionally miss a scan class execution. Our solution was to leverage the system.tag and system.opc APIs in a gateway timer script to read the values directly from the PLC and write them to the historian database “manually.”

The Traditional Approach: Creating OPC Tags

PLC Code that increases Tag Values at a constant Rate

To illustrate the problem, the above image shows a simple PLC program that increases the tag values at a constant rate. Tag1 increases by 0.1 every scan, Tag2 by 0.2, etc. This should result in a chart with relatively even steps every 100ms when the values are trended.

The traditional approach is to simply create 12 OPC tags, give them 100ms scan classes and enable tag history. As you can see from the chart below, there are occasional gaps of more than 100ms between values and we don’t see the even climbing steps that we would expect.

Chart showing the gaps of more than 100ms between values using the traditional approach to record tag history

The Scripted Approach in Ignition: A Gateway Timer Script

As always, there is more than one way to solve this problem in Ignition. In this case, an Ignition Gateway timer script running at 100ms was the best solution. The key functions in the script are system.opc.readValues to read values directly from the PLC over OPC without relying on internal tags and system.tag.storeTagHistory to store tag history on-demand. 

Ignition Gateway Scripts

Together, these two functions allow us to quickly gather the process values and write them to the historian database. The result is nearly perfectly timed values and the uniform steps that we wanted to see.

Chart showing evenly timed values and uniform steps in the collected data

Additional Notes about storeTagHistory:

A nice feature of storeTagHistory is that it works with “virtual” tags and tag providers, meaning the tags do not need to exist. This means we can delete the OPC tags from the traditional approach, or at least disable tag history and put them on a slower scan class.

Ready to take your whole system to the next level? Check out Corso Systems’ Ultimate MES Guide.

Updated - 6/15/2022

Previous
Previous

5 Quick Performance Enhancements in Ignition

Next
Next

Casino Gaming Conveyor System Upgrades