This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Advice on hanging Resident script (suspect storage get/set)
#1
Hi, i'm experiencing some kind of hang/blocking/locking when this script runs for a few days.
 
The script runs as a Resident script every minute, but suddenly it stops. I try to disable, re- enable but without any success. 
Then, when I alter the storage key ('3_3_15_vent_effect') to e.g. '3_3_15_vent_effect_1' it runs fine for some time (days?).
 
Should I safeguard the storage get/set in some way? I'm I missing something obvious here?
 
Code:
deltaThreshold = 0.015
t1 = grp.getvalue('3/3/10')
t2 = grp.getvalue('3/3/11')
t3 = grp.getvalue('3/3/14')

-- Calc. effect
effect = (t1 - t3) / (t2 - t3)

prev_effect = storage.get('3_3_15_vent_effect', 0)

effectDelta = math.abs(prev_effect - effect)

-- Write to KNX buss if Delta > Treshold
if effectDelta > deltaThreshold then
 grp.write('3/3/15', effect)
 
 -- Store Calculated effect
 storage.set('3_3_15_vent_effect', effect)  
 log("New reading - Effect prev.=" .. prev_effect .. " New = " .. effect)
end

About the script: Calculate the effect of a heat recovery unit. Input values are collected from ModBus interface on LM (no need to do a grp.read()). I don't want to flood the KNX buss by writing every calculation, therefore the delta calculation. 

Alternative approaches are welcome...


_
Ole A.
Reply


Messages In This Thread
Advice on hanging Resident script (suspect storage get/set) - by oab_nor - 04.11.2015, 10:35

Forum Jump: