What is the difference between these two functions.
I believe the main difference is that
system.tag.queryTagHistory() is a method to retrieve raw tag history from the system, where
system.tag.queryTagCalculations() does the same thing but performs aggregates against the retrieved values for you.
For example, you could use
system.tag.queryTagHistory() to retrieve values and then perform an average against the returned dataset with your own function. Or you could use
system.tag.queryTagCalculations() to tailor a call that will return the desired result directly (and do the work for you).
@kcollins is correct.
system.tag.queryTagHistory()will query the tag history results, while
system.tag.queryTagCalculations() will do the same thing, and then aggregate the results to a single value per aggregate.
That being said, queryTagHistory does aggregate the date based on time slice (which is where some of the confusion can come from). Another way to think about it:
queryTagHistorywhen you want multiple values for the same tag over time: i.e., hourly values.
queryTagCalculationswhen you want a single value representing multiple data points over a period of time.
Another key difference: queryTagCalculations allows multiple calculations in one query - so you can get the Minimum, Maximum, and Average in one poll of the tag history system.