How to script the control logic of air conditioner? - 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: How to script the control logic of air conditioner? (/showthread.php?tid=2562) |
How to script the control logic of air conditioner? - liangming011 - 02.04.2020 The KNX address returns an outdoor temperature value,If I want to set a scene at 0-10℃, set a scene at 10-25℃, set a scene above 25℃, how do I set it? RE: How to script the control logic of air conditioner? - Joep - 02.04.2020 value = event.getvalue() if value > 0 and value < 10 then --do something elseif value > 10 and < 25 then --do something elseif value < 25 then --do something end You can also use >= 10 instead of > 10 for example. In the first example also the value 10 itself is included in the second example only every value higher then 10. RE: How to script the control logic of air conditioner? - liangming011 - 04.04.2020 local temp=knxdatatype.decode(event.datahex,dt.float16) local heat=knxobject.get('address','1/3/5') local ac=knxobject.get('address','3/5/37') local heat_on=toboolean(heat.data) local ac_on=toboolean(ac.data) --heating off if not heat_on then --制冷 if temp>24 and not ac_on then alert('BR temp:%f,A/C ON',temp) ac:write (1) end --过度季节制冷 if temp>15 and temp<24 and not ac_on then alert('BR temp:%f,A/C ON',temp) ac:write (2) end --过度季节制暖 if temp>10 and temp<15 and not ac_on then alert('BR temp:%f,A/C ON',temp) ac:write (3) end --制暖 if temp<10 and not ac_on then alert('BR temp:%f,A/C OFF',temp) ac:write(4) end end Like this, would it work 1 value is refrigeration;2 value is Overmode refrigeration;3 value is Excessive mode heating;4 value is Making the model。 RE: How to script the control logic of air conditioner? - admin - 07.04.2020 3/5/37 will only change when current value of 3/5/37 is 0 and 1/3/5 is 0. Is there some external logic that sets 3/5/37 to 0? If not then you need to change your script. Can you write an algorithm of how the system should work? Then we can help you with a script. RE: How to script the control logic of air conditioner? - liangming011 - 08.04.2020 I'm just beginning to learn how to write.3/5/37 will only change to Turn off air conditioning when current value of 3/5/37 is 0.1/3/5 is Temperature detection module.The program written above, is to imitate the example of the official website to rewrite, so I would like to ask, if I achieve this function, where do I need to modify to use? local temp=knxdatatype.decode(event.datahex,dt.float16) local heat=knxobject.get('address','1/3/5') local ac=knxobject.get('address','3/5/37') local heat_on=toboolean(heat.data) local ac_on=toboolean(ac.data) --heating off if not a_on then --制冷 temp>24 then grp.write('3/5/37', 1) --过度季节制冷 elseif temp>15 and temp<24 then grp.write('3/5/37', 2) --过度季节制暖 elseif temp>10 and temp<15 then grp.write('3/5/37', 3) --制暖 elseif temp<10 and not ac_on then grp.write('3/5/37', 4) end -- object mapped to this event must have its data type set temp = event.getvalue('1/3/5') if not a_on==0 then --制冷 temp>24 then grp.write('3/5/37', 1) --过度季节制冷 elseif temp>15 and temp<24 then grp.write('3/5/37', 2) --过度季节制暖 elseif temp>10 and temp<15 then grp.write('3/5/37', 3) --制暖 elseif temp<10 and not ac_on then grp.write('3/5/37', 4) end -- object mapped to this event must have its data type set temp = event.getvalue('1/3/5') if not a_on==0 then --制冷 temp>24 then grp.write('3/5/37', 1) --过度季节制冷 elseif temp>15 and temp<24 then grp.write('3/5/37', 2) --过度季节制暖 elseif temp>10 and temp<15 then grp.write('3/5/37', 3) --制暖 elseif temp<10 and not ac_on then grp.write('3/5/37', 4) end Two writes, that works? RE: How to script the control logic of air conditioner? - admin - 09.04.2020 This example will set out_value depending on input temperature. This should be an event script attached to temperature sensor object so it executes each time temperature value changes. Code: value = event.getvalue() RE: How to script the control logic of air conditioner? - liangming011 - 13.04.2020 temp ,How to read the value 1/3/5? temp = event.getvalue('1/3/5')? RE: How to script the control logic of air conditioner? - admin - 13.04.2020 event.getvalue() returns the value of an object that triggered the event. If your event script is attached to 1/3/5 then value variable will contain current temperature sensor value. |