Logic Machine Forum
3 state heating systems - 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: 3 state heating systems (/showthread.php?tid=4473)



3 state heating systems - electrokinisi - 01.01.2023

Hello guys, 
I need some help to prepare the code for the following function.
I have 3 heat pumps and 13 thermostats.
I want the first heat pump to start when 1 to 4 thermostats are requested,
 the second pump to start after 5 to 8 thermostats, 
and then the third pump to start when 9 to 13 thermostats are requested.

Thanks in advance .


RE: 3 state heating systems - admin - 02.01.2023

You can use OR gate from this script: https://forum.logicmachine.net/showthread.php?tid=4395&pid=28367#pid28367


RE: 3 state heating systems - electrokinisi - 03.01.2023

Thank you for the answer,
but I didn't explain it exactly.
I want to randomly add the commands of the thermostats and depending on the demand to start the pumps in stages.


RE: 3 state heating systems - admin - 05.01.2023

Attach a common tag to all thermostat on/off objects then attach an event script to this tag. 1/1/1..3 are your heat pump control objects, modify as needed.
Code:
objs = grp.tag('thermostat')
count = 0

for _, obj in ipairs(objs) do
  if obj.value then
    count = count + 1
  end
end

grp.write('1/1/1', count >= 1)
grp.write('1/1/2', count >= 5)
grp.write('1/1/3', count >= 9)



RE: 3 state heating systems - electrokinisi - 21.01.2023

Hi admin thank you very match ...