Skip to end of metadata
Go to start of metadata

Performing Analysis over a long period of time can result in performance issues or timeouts due to the complex calculations and large amounts of data.

This KB describes a strategy for long-term analysis.

Using the Historical Cache Key and Cache Expiration Analysis Settings Setting, we can cache historical calculations and recall them at a later time by accessing the cached value.

You must have a cache key per calculation and no changes can be made to the filter properties after it is saved or recalculation will occur.

See Analysis Data Points and Settings#SettingValues for information on Historical Cache Key and Cache Expiration

Example code:

Analysis Caching
def calculate():
	#Equipment to filter by
	eqPath = 'Enterprise\\Site 1\\OEE Area\\Packaging Line 1'

	#Name of your Analysis
	sasName = 'OEE'
	obj = system.mes.analysis.getMESAnalysisSettings(sasName)
	startDates = [, 2, 1),, 3, 1),, 4, 1)]
	endDates = [, 2, 31),, 3, 30),, 4, 31)]
	cacheKeys = ['OEEMarch2020','OEEApril2020','OEEMay2020']
	for i in range(len(cacheKeys)):
		params = {'Path':eqPath}
		obj.setSettingValues('Include Children=True,Historical Cache Key =' + cacheKeys[i] +',Cache Expiration=43200')
		results = system.mes.analysis.executeAnalysis(startDates[i], endDates[i], obj, params)
		print results.getDataset()

import datetime
startTime =
print 'runtime', - startTime

Viewing the output, we can see the first calculation was 24 seconds. Subsequent executions using the same keys and settings are performed sub-second.

Using this example, you would then populate tables or charts with historical data while calculating current data. 

Dataset manipulation would be necessary to achieve a successful historical report.

other method:

Augmenting Standard Analysis with Historical Caching

  • No labels