Changing a tag to show time interval data collection

Hi,

I need help formatting an OPC UA PLC tag. Currently the tag reads the total production count however i’m trying to show data for the last 20minutes at all times. How do I go about doing this?

Thankyou

Can you elaborate?

Do you mean that you'd like to display the difference of (count_now - count_20_mins_ago)at all times?

Or, display a trend / table with the rolling history of this tag over the last 20 minutes?

Or…something else?

Further, do you have the ability to modify the PLC logic, or does this need to be an Ignition only solution?

Yes I would like to have another tag that holds the difference.

(count_now - count_20_mins_ago)

so that I can compare it and use it in other expressions etc.

I don’t currently have access to the allen bradley plc program but I can get it. Is there any way to do this in ignition however?

Yes, can be done in Ignition, though PLC is my preferred choice.

Within Ignition… You could historize the tag with 1 minute update times, then periodically query the historian to compare against current value. Or, use a series of additional tags and some scripting to store the last n-counts at 1 minute intervals.

Tag-based solution would be my approach. Options: create a ring buffer or a FIFO array/table. For 1 minute updates, I prefer the FIFO option, whereby row index matches the value from n-minutes ago: Value[1] - Value[0] = difference from 1 minute ago, & Array[20] - Array[0] = 20_min_delta.

I would: create a dataset tag w/ 2 columns (timestamp & value), which would eventually contain 21 rows of historical data. Then create a gateway event script which inserts a new row to the dataset at index 0, and returns/writes a max of n-rows (21) to the tag.

The timestamp column could be ignored (and an array used instead of a dataset), though I'd prefer to keep the timestamp for any rate calcs, & troubleshooting.

Then, I'd create another expression tag to extract and diff both values. Though, some may insist that this expression could live exclusively in a view and calculation performed at runtime.

1 Like