06.08.2021, 11:25
(04.08.2021, 06:25)admin Wrote: You will need 3 scripts.
Scheduled script that run once each hour:
Code:on_1 = grp.getvalue('5/0/1') on_2 = grp.getvalue('5/0/2') -- one of the pumps is on if on_1 or on_2 then pump_time = storage.get('pump_time', 0) pump_time = pump_time + 1 -- try switching to another pump if pump_time > 50 then stop_1 = grp.getvalue('5/0/10') stop_2 = grp.getvalue('5/0/20') -- first is on, second is not in stop state if on_1 and not stop_2 then grp.write('5/0/1', false) grp.write('5/0/2', true) pump_time = 0 -- second is on, first is not in stop state elseif on_2 and not stop_1 then grp.write('5/0/2', false) grp.write('5/0/1', true) pump_time = 0 end end else pump_time = 0 end storage.set('pump_time', pump_time)
Event script for first pump fault (5/0/10):
Code:on_1 = grp.getvalue('5/0/1') on_2 = grp.getvalue('5/0/2') stop_1 = event.getvalue() stop_2 = grp.getvalue('5/0/20') -- switch to the second pump if stop_1 then if not stop_2 and not on_2 then grp.write('5/0/1', false) grp.write('5/0/2', true) storage.set('pump_time', 0) end -- fault is removed and no pump is running elseif not on_1 and not on_2 then grp.write('5/0/1', true) storage.set('pump_time', 0) end
Event script for second pump fault (5/0/20):
Code:on_1 = grp.getvalue('5/0/1') on_2 = grp.getvalue('5/0/2') stop_1 = grp.getvalue('5/0/10') stop_2 = event.getvalue() -- switch to the first pump if it's not in a fault state if stop_2 then if not stop_1 and not on_1 then grp.write('5/0/2', false) grp.write('5/0/1', true) storage.set('pump_time', 0) end -- fault is removed and no pump is running elseif not on_1 and not on_2 then grp.write('5/0/2', true) storage.set('pump_time', 0) end
Thanks for help!
I have been testing the scripts.
I understand that I always give start order to pump 1, and if it is faulty or has more than 50 hours, pump 2 starts.
I have found the following problem, if pump 1 is running, pump 2 is faulty, if pump 1 breaks down and pump 2 is repaired, pump 2 does not start automatically