Logic Machine Forum
Average value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Average value (/showthread.php?tid=1919)



Average value - Tokatubs - 18.02.2019

Hello

I tried to make a simple script to check the average value on 8 values.

T1 = grp.getvalue('26/0/100')
T2 = grp.getvalue('26/0/101')
T3 = grp.getvalue('26/0/102')
T4 = grp.getvalue('26/0/103')
T5 = grp.getvalue('26/0/104')
T6 = grp.getvalue('26/0/105')
T7 = grp.getvalue('26/0/106')
T8 = grp.getvalue('26/0/107')
AV = math.round((T1 + T2 + T3 + T4 + T5 + T6 + T7 + T8) / 8, 0)
grp.write('27/7/12', AV)

But not getting any value updates on the 27/2/12 GA. 

So is it correct to put this in event-based script or should it be something else. And what is the correct GA/TAG to put in the main window?


RE: Average value - admin - 18.02.2019

Your objects from T1 to T8 should have the same tag and event script should use this tag as well. Also check output address, should it be 27/7/12 or 27/2/12?