I have a tag that receives energy consumption data (where the value is increased over time).
I configured the History Enabled option to have the tag's history.
I'm trying to create a table to show consumption data every 15 mins.
I configured the Tag History option using the options in the attached image.
How could I calculate this difference between the minimum and maximum value and show it in a new column of this table?
Ignition's Tag History does not do a good job for this type of application. It doesn't interpolate / extrapolate to the 15-minute boundaries you're looking for and will miss information at the start and end of the time range in the returned data (if there is no record right at the boundary).
Create a dedicated table for the energy meters. Add columns: timestamp (indexed), meterName (indexed), kW, kWh, etc.
Create a gateway scheduled task - Menu → Project → Scheduled.
On the script tab write a script to,
- Create a [list] of all the tags to be read.
system.tag.readBlocking to read the tag values. It will return a list.
- Write the values into the data table. It will be useful on retrieval if you round the timestamp down to the minute (0, 15, 30, 45 as the case may be).
You will now have a dataset that is synchronised with the utility meter and this can be useful for monitoring maximum demand, etc., and calculating cost on variable tariffs.