I’ve got a few totalizer tags in my project that are being logged in tag history currently. I want to include these on a report for a given time range to show the total value for a specific time range. 99% of the time, I can just subtract the totalizer value at the start time from the totalizer value at the end time and it will be correct. My problem is that the user has the ability to reset the totalizer, so this will be inaccurate if they have reset the totalizer within the time range that they are pulling up the report.
What I’m thinking is that I can pull the full history of the totalizer and extract the local maxima to calculate the “total” piece-wise. For example: if totalizer value starts at 50, goes to 100, is reset to 0, then goes to 150 – I would find the local maxima of 100, so I could do (100-50)+(150-0) = 200. Thing is, I can’t find a good way to get the local maxima of a dataset in scripting (seems like numpy does not work in Ignition).
Is there a way to find local maxima of a dataset in scripting?
Or is there a better way to track and report totalized value over a variable time range?