Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
samplestream:adaptable_example [2024/04/25 23:06]
optrix
samplestream:adaptable_example [2024/04/25 23:15]
optrix
Line 3: Line 3:
 In the [[example|previous example]], we hard-coded the [[distance|distance]] between each of our assets when requesting a lag-corrected query. In the [[example|previous example]], we hard-coded the [[distance|distance]] between each of our assets when requesting a lag-corrected query.
  
-This would mean the code wouldn't be able to adapt to changes or move between various different lines, or deal with flexible systems that adjust for specific products.+This would mean the code wouldn't be able to adapt to changesmove between various different lines, or deal with flexible systems that adjust for specific products.
  
-Using ARDI, it's also possible to use relationships and static properties to load these //distance// values dynamically.+Using ARDI, it's also possible to load these //distance// values dynamically - although it is still limited to [[simple lag|only working on simple forms of lag]].
  
 <code python> <code python>
Line 16: Line 16:
  
 #Go through each asset and write its lag value to a dictionary #Go through each asset and write its lag value to a dictionary
-lags = {}+distances = {}
 for value in resp['response'][0]['value']: for value in resp['response'][0]['value']:
-    lags[value['name']] = value['rawvalue']+    distances[value['name']] = value['rawvalue']
  
 #Same as the previous query, but replaces the fixed lag value with a dictionary lookup #Same as the previous query, but replaces the fixed lag value with a dictionary lookup
Line 24: Line 24:
 lcq.RateLagQuery('Meters',"'Conveyor' ASSET 'Speed' PROPERTY VALUES") lcq.RateLagQuery('Meters',"'Conveyor' ASSET 'Speed' PROPERTY VALUES")
 lcq.AddQuery("'Inspection Station' ASSET 'Brownness' PROPERTY VALUES") lcq.AddQuery("'Inspection Station' ASSET 'Brownness' PROPERTY VALUES")
-lcq.AddQuery("'Oven' ASSET 'Temperature' PROPERTY VALUES",lag=lags['Oven'])+lcq.AddQuery("'Oven' ASSET 'Temperature' PROPERTY VALUES",lag=distances['Oven'])
 lcq.multiplier = 0.0166 lcq.multiplier = 0.0166
 lcq.shavems = True lcq.shavems = True