I am working on building an OEE dashboard and I have ran into a common obstacle: How do I sum the cumulative values of tags over a shift? For example, Performance is defined as the (Standard Cycle Time X Cycle Count)/(Run Time). In this case, Cycle Count and Run Time both need to be summed over a shift to output an accurate Performance trend.
My guess is this is a fairly common problem and has been solved in a handful of ways. I am mainly looking for relevant training/help material to send me down the correct path.
The reliable way to do this is to accumulate counts and accumulate runtime in non-resetting odometers in the PLC. Snapshot these values into your database at regular intervals, like at the top of each hour.
Then you can produce any necessary reporting values, at the resolution of the snapshots, using your database's lead() or lag() functions.
I’ll need to spend some time digging into SQL databases in Ignition.. My impression was that using a database may not be the best solution for real-time OEE tracking. Admittedly, I don’t understand this side of the Ignition Architecture much.
For the sake of getting some values to populate for a demo to my team, do you have any thoughts on using this strategy in a tag script? newCount = currentValue.value oldCount = previousValue.value cycleDelta = newCount - oldCount
If you want near-real-time, you'd need to perform the snapshots more often. At the top of the minute, perhaps. (Prune the excess rows later, if you must.)
You can also use a persistent script object to hold a FIFO of measurement tuples, and compute from those, if you don't like databases. (I recommend my system.util.globalVarMap() from my Integration Toolkit, if you go this route.)
I don't recommend the tag change script approach because it will stop updating when the counter stops changing. You need a timer event at least, and probably a gateway scheduled event for best results.