I did some Ignition report work recently and probably due to my own incompetence this seems like an extremely awkward thing to do.
Basically I had this question when I was trying to do is to get the kwh generated by some power generating assets (solar, disel generator etc.) over some time. There are onsite devices that tracks the kwh, the value is imported with a tag, and all I need to do is to take the difference at 00:00 at {time A} and 00:00 at {time B}.
Now in the reporting module I have set up a {StartTime} and a {EndTime} parameter. From here I have a few choices:
- Use tag historian query with the Closest Value Aggregation Mode, get all the data in it's natural logging timestamp, and take a good quality one from near the end and one from near the start, and do the calculation myself with a script.
With this approach, calculating YTD data gets progressively memory and computational heavy as the year go by and the historian query tries to get hundreds of thousands of data points out of the database.
- Use the Tag Historian Query with Closes Value Aggregation Mode, sample a fixed size of 2.
This sounds like the way to go but the value it returns is actually one from {StartTime} and another one from {StartTime + (EndTime - StartTime)/2} aka the middle point of {StartTime} and {EndTime}. Now I can just manually set {EndTime} to be twice of what it should be but that just seems silly and gets messy.
- Using Tag Calculation Query with the Range calculation.
Now this works for my purpose of calculating the difference of kwh value. But it would fail in other instances where you have a value that's not monotonically increasing or decreasing but you still only need the difference at two specific time.
So I am just curious to see what other people are doing with this kind of calculation in the reporting module.