In working with system.tag.queryTagCalculations results, calculations of "Average" and "Maximum" appear to work, whereas several others do not. I am most in need of "Minimum".
In my experience it's not delivering all of the items that the documentation says it should. Rather, it's delivering values, but some of them are not plausible.
I'd love it to return the Minimum. Would also take MinMax (so I can get the minimum). Would also take the Range so I could calculate the Minimum as (Maximum - Range).
Alas, It delivers none of those, at least not with my historian and tag provider. My historian setup is pretty vanilla, meaning I am using MySQL as the DB for ignition historian, and I enabled tag history on several tags and left the options at default. I'll be the first to admit I am new to working with the historian.
The tags of interest in my default tag provider are OPC tags coming from an Omron C2J cpu via the Omron FINS driver. The default tag group is setup to sample at 500ms.
For test data, I added logic to the Omron CPU. A D memory area channel that is a BCD value created from clock data hours and minutes… hhmm. So at midnight it rolls over to #0000 from #2359.
I shoved this into some locations that igntion is using, and the tag historian is dutifully logging the data.
I setup the trend viewer and saved the data for (2) of the tags, over a 30 minute period 6:01am to 6:31am this morning. This should have a ~30 unique tag values for each tag over the course of the 30 minutes. With the smallest values being at 06:01am, and the largest being at 06:31am.
In excel I did Min, Ave, and Max. I should be able to get numbers similar to these out of the queries.
The tags in ignition are linear scaled
0-6000 BCD is 0-200 EU for D2100 Gas 1 Monitor
0-6000 BCD is 0-50 EU for D2101 Gas 2 Monitor
I am using preformatted text below because the math symbols were being treated as formatting....
Starting value should be near to: D2100 Gas 1: 0601/6000*200 = 20.03 (Excel has the first sample at 20.034) D2101 Gas 2: 0601/6000*50 = 5.008 (Excel has the first sample at 5.0085) Ending value should be near to: D2100 Gas 1: 0631/6000*200 = 21.03 (Excel has the last sample at 21.064) D2101 Gas 2: 0631/6000*50 = 5.258 (Excel has the last sample at 5.266)
So, the data is clearly in the historian ?, and correlates well with what I’d expect over this 30 minute test period (i.e. the end points as calculated above). But it seems as though only query results for "Average" and "Maximum" are plausible given the historian's contents.
Excel Average: 20.0549
Query Average: 20.5306
Excel Maximum: 21.0639
Query Average: 21.0306