Logic Machine Forum
Simple mathematical question - 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: Simple mathematical question (/showthread.php?tid=1974)



Simple mathematical question - Kai-Roger - 16.03.2019

Hi.

I have a resident script with 2 sec sleep interval. I try to write a simple mathematical calculation to the variable named "D". The group adress behind variable "D" is datatype 05.001 %. How can i make this work i Lua?

A = grp.getvalue ('6/6/1')
B = grp.getvalue ('6/6/2')
C = grp.getvalue ('6/6/4')
D = grp.write ('6/6/10')

D=(B-A/C-A)*100


BR
Kai-Roger


RE: Simple mathematical question - Tokatubs - 16.03.2019

(16.03.2019, 22:01)Kai-Roger Wrote: Hi.

I have a resident script with 2 sec sleep interval. I try to write a simple mathematical calculation to the variable named "D". The group adress behind variable "D" is datatype 05.001 %. How can i make this work i Lua?

A = grp.getvalue ('6/6/1')
B = grp.getvalue ('6/6/2')
C = grp.getvalue ('6/6/4')
D = grp.write ('6/6/10')

D=(B-A/C-A)*100


BR
Kai-Roger
I have no idea, but maybe this will work

A = grp.getvalue('6/6/1')
B = grp.getvalue('6/6/2')
C = grp.getvalue('6/6/4')
D = math.round((B - A) / (C - A) *100, 2)
grp.write('6/6/10', D)


RE: Simple mathematical question - Kai-Roger - 16.03.2019

(16.03.2019, 22:09)Tokatubs Wrote: I have no idea, but maybe this will work

A = grp.getvalue('6/6/1')
B = grp.getvalue('6/6/2')
C = grp.getvalue('6/6/4')
D = math.round((B - A) / (C - A) *100, 2)
grp.write('6/6/10', D)

Hi.
Thanks for the reply. I sort of found it out in the meanwhile (:

A = grp.getvalue ('6/6/1') --Temp before the heat-recovery (outside temp)
B = grp.getvalue ('6/6/2') --Temp after the heat-recovery
C = grp.getvalue ('6/6/4') --Return temp from house (before the heat-recovery)
D = grp.find ('6/6/10') -- Efficiency heat-recovery

D :write(((B-A)/(C-A))*100)

Now i get the efficiency in % of my "rotating heat recovery unit" in my "house ventilation" (: