I want to be able to log the amp draw of a motor during startup during the last 5 starts, and then display these trends overlapping on the same time-base chart (0-90sec). This is an edge panel, so I can't query the historical database (as there isn't one).
My first thought was to use parallel arrays of REALs inside the PLC to store this historical data and then bring them into Ignition to show them on an overlapping chart. However, I'm worried about the sheer volume of tags that this would require. The PLC would log the value every 60ms, up to 1500 samples (90 seconds total). 5 arrays would be used to hold the last 5 instances of previously logged values. So, we're talking 7500 tags (per motor) coming into Ignition. To limit the on-change tag reads to one array of values, I would use an integer that holds the "latest data index" so that only one array of values is updating at a time.
Is that many tags a bad idea? Is something like this really doable for an Edge panel, or is this something that just needs to be left to the supervisory system that has a full Ignition install?
What if the arrays of data just exist in the PLC and are not Ignition tags.
Would it be just (or almost just) as bad to use system.opc.readValues() to get only the arrays that are needed, when they are needed (i.e. when the window is opened), instead of subscribing to 7500 tags per motor?
And maybe 1500 is overkill. Might be able to get by with 900 at a 100ms rate.
Ugly. PLCs don't like vomiting up large amounts of data like databases can. You definitely don't want to subscribe to those tags. Using system.opc.readValues() on demand would be a lesser evil, but not great.
This is a job for history, plus a transform to align timestamps.
I was thinking I could use a short periodic sample mode and log the time of the last 5 starts to use in the query. Then I don't have to do much work to align the timestamps.
There was actually a pretty easy and straightforward solution here.
"Log" the date/time of the last 5 starts in a memory array as part of the UDT that is logging the current and voltage using a change script on the call/running status.
Use custom properties to get the last 5 starts into a window and sort the dataset to get them in order (indirect).
Use a predefined "span" after the start time to calculate the end time.
Create a tag history binding, this is available on edge.
Bind tag history for each start to a sparkline chart.
Overlap sparkline charts with different colors.
Looks great, easy to follow and no transformations needed to stretch/compress datasets to get the timestamps to match up.