Historical Data Consistency

Hi there,

I have a client expecting automated csv data exports with 20 minute range and 5 minute interval, every 10 minutes. The CSVs include some repeat data from the previous export intentionally.

The issue is that the repeat data is different between exports, even though the timestamps are identical. Using the noInterpolation flag doesn’t fix this issue. I figure this is because the historical data in the database is not taken exactly on that timestamp, so the return will always be interpolated. As it stands, there is significant enough error between two exports to be troubling to a person trying to interpret the data.

What I want is to get the actual values in the database which are closest to the target timestamps (that is, not interpolated, but assumed to be the same as the previous value). Is this possible?

Figured it out. Here’s an example of the old code:

queryData = system.tag.queryTagHistory(
	paths = tagPaths,
	startDate = startDate,
	endDate = endDate,
	intervalHours = 1,
	intervalMinutes = 0,
	ignoreBadQuality = 1,
	noInterpolation = 1
	)

Here’s an example of the new code:

returnSize = math.ceil(system.date.secondsBetween(startDate,endDate) / 3600)
queryData = system.tag.queryTagHistory(
	paths = tagPaths, 
	startDate = startDate, 
	endDate = endDate, 
	returnSize = returnSize, 
	aggregationMode = "LastValue")

The old way would result in values produced by Ignitions undocumented (afaik) interpolation methods. The new way (it would seem) just gives me the closest values to the hour.

2 Likes