This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scripts two pumps alternate
#4
You will need 3 scripts.
Scheduled script that run once each hour:
Code:
1234567891011121314151617181920212223242526272829303132
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:
1234567891011121314151617181920
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:
1234567891011121314151617181920
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
Reply


Messages In This Thread
Scripts two pumps alternate - by streilkx - 29.07.2021, 13:37
RE: Scripts two pumps alternate - by admin - 29.07.2021, 13:47
RE: Scripts two pumps alternate - by streilkx - 30.07.2021, 08:11
RE: Scripts two pumps alternate - by admin - 04.08.2021, 06:25
RE: Scripts two pumps alternate - by streilkx - 06.08.2021, 11:25
RE: Scripts two pumps alternate - by admin - 06.08.2021, 11:39
RE: Scripts two pumps alternate - by streilkx - 16.08.2021, 15:47
RE: Scripts two pumps alternate - by admin - 18.08.2021, 06:57

Forum Jump: