I am trying to build a totalizer I have never built one before.
Engineering only needs 15min resolution so I am summing up the GAL used every 15min then incrementing a counter to trigger ignition to save the value to SQL using a Transaction Group. It was requested I make the datapoints fall on the 15min increments throughout the day. Right now I am using a TON so the intervals I track at might be 2:03 - 2:18 - 2:33. How can I make a totalizer based on the time in the hours so it will track 2:00 - 2:15 - 2:30
Record them on the minute in the PLC and include the timestamp. Hand it off to Ignition with the value and timestamp, and insert the timestamp into the table with the value.
As @amarks mentioned below, you'll want your PLC time to be synced.
On PLC side, you can make an on change logic looking at the internal clock's minute value, and record whenever the value changes to increments of 15.
First, you'll want to sync your PLC time with the Ignition server. I use a gateway script to sync it daily.
Second, I would have a operator setpoint value 0-14 that would signify the "first" log time for the hour and then trigger the transaction group at that value, that value +15, +30, +45, then restart.
There's no need to signal Ignition to read the PLC. Ignition can schedule that itself either using a transaction group or a gateway scheduled event. It would be simpler.
Log the non-resetting total counter value every 15 minutes. You can then easily get the difference between any two timestamps (15 minutes apart or years apart) without having to add up the individual readings. It will also mean that you won't lose data if the gateway or comms fails for a period of time. (You won't be able to know what happened during the breakdown but you'll be able to calculate the total and average for the period.)
Just a note that, for this method to work correctly, you will need to use system.opc.readValues(), if you use system.tag.readBlocking() you are not guaranteed to get the "real" value at that time.