Value update in memory tags

Hello everyone. I'm new to ignition and I have a question that I think is very easy for those who have worked with it.
I need to hourly update two tags: m1 and m2. This is in order to calculate the energy consumption per hour of a machine. I have the record of the analyzer device that shows me the accumulated consumption data in KWH in real time.
What I'm trying to do is create the variables m1 and m2 so that at a certain time, for example 00:00, that data is stored in m1 and at 01:00 the data is stored in m2. In such a way that the consumption of that hour will be m2-m1.
When performing the calculation and saving it in a variable, I need to update the new m1 which will now be the data for 01:00 and m2 which will be for 02:00 and so on until completing the 24 hours and obtaining the 24 consumption data per hour to record them in a daily report.
I am currently doing this calculation from a PLC, but it is inefficient due to the number of tags that I am using unnecessarily. Any opinion or guidance I am very grateful.
Jorge.

A quick thought from me: couldn't you use Tag History for that purpose? That is, historize the tag holding the consumption data, and have a tag history query to calculate the consumption data per hour.

1 Like