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.

Recurrent control
#1
Hi everyone,

I'm looking for a way to control a valve according to user-defined intervals and durations. 
For instance, if the interval is set to 20 minutes and the duration to 5 minutes, the valve should:

1. Turn on
2. Stay on for 5 minutes
3. Turn off
4. Wait for 20 minutes before repeating the cycle

I considered using scheduled scripts, but I believe there might be a more efficient solution. Could anyone suggest the best approach to achieve this functionality?

Thanks in advance,
George
Reply
#2
I would do it in two scripts. One event with os.sleep to turn on and after delay turn off the valve. The delay time can be parameter as object to modify. Make sure to set event script to run first instance only.
Resident script which will check if valve is off and then by use grp.find() and updatetime field to check when the last telegram was sent to this specific object. Then use os.time() to calculate the delta. If delta is bigger then 20 min then you send On to object attached to your event script Again the delta can be as object to be modified by the user.
------------------------------
Ctrl+F5
Reply
#3
Resident script with 0 sleep time. 1/1/1 is valve control, 1/1/2 is on delay and 1/1/3 is off delay. Both delays are specified in minutes.
Code:
grp.write('1/1/1', true)

ondelay = grp.getvalue('1/1/2')
os.sleep(ondelay * 60)

grp.write('1/1/1', false)

offdelay = grp.getvalue('1/1/3')
os.sleep(offdelay * 60)
Reply


Forum Jump: