barkster Posted March 1, 2016 Share Posted March 1, 2016 what's the best way to cycle my pool pump on/off every certain number of hours. When I have variable PoolHeating to 1 I want the pump/heater to come on for 3 hours then off for 3 hours and repeat till I set variable to 0. I started with this but don't think it is best way or if it would even work. If $PoolHeating is 1 Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off Run Program 'HeatPool' (Then Path) Else - No Actions - (To add one, press 'Action') Link to comment
LeeG Posted March 1, 2016 Share Posted March 1, 2016 The Variable must be a State variable. Also need some cleanup in Else. If $PoolHeating is 1 Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off EDIT: Removed the Off statements in Then. No need for them. Link to comment
barkster Posted March 1, 2016 Author Share Posted March 1, 2016 yeah but if I put that in the else my pump will never turn on when I'm not heating pool right. I have other schedules that run when I'm not heating that look at the Poolheating variable first. Link to comment
LeeG Posted March 1, 2016 Share Posted March 1, 2016 "yeah but if I put that in the else my pump will never turn on when I'm not heating pool right. " The Else runs once when Variable changed to other than 1. How will this interfere? If you only want Program to turn On devices drop the Else statements. That means that something else is required to turn those devices Off when variable changed which is a little unusual. Link to comment
LeeG Posted March 1, 2016 Share Posted March 1, 2016 If the Variable is being set to various values besides 0 & 1 (such as 0, 1, 2, 3), then more data about your operating environment is needed. Link to comment
barkster Posted March 1, 2016 Author Share Posted March 1, 2016 I guess my understanding of how the program works is off. I thought that this thing runs in a loop and it's constantly checking all the programs if statements so if I set the Poolheating variable to 0 then that else statement would fire and since the variable would equal zero then the else would be run. So if had another program that turned the pump on when 0 then this program would turn it right off because the variable is 0. Link to comment
kohai Posted March 1, 2016 Share Posted March 1, 2016 Hot H2O Circ Pump 15 min - [iD 0010][Parent 0001] If From 11:00:00AM To 5:59:00PM (same day) Then Repeat Every 1 hour Set 'Hot H2O Circ Pump On-Off Swit' On Wait 15 minutes Set 'Hot H2O Circ Pump On-Off Swit' Off Else Set 'Hot H2O Circ Pump On-Off Swit' Off I'm not really trying to answer your question but will throw out how I do an interval program. I have a circulation pump in my house for hot water and I turn it on for 15 minutes every hour between 11 am - 5:59 pm. I realize you have one extra complication in tracking whether your heater is on. Link to comment
LeeG Posted March 1, 2016 Share Posted March 1, 2016 That helps. The ISY is event driven. When the State Variable is changed to 0 this Program is triggered (If runs). The If is evaluated, found False so Else is executed. This Program is triggered again (run If) only when Variable value is changed. ISY Programs are triggered to run If by some event occurring or directed to run by some other Program. ISY Programs are not running in a loop check checking the If condition(s). Link to comment
barkster Posted March 1, 2016 Author Share Posted March 1, 2016 ah, has it always been that way? even with the old 99? I guess I'm getting confused with my old Pic programming I did. Thanks that helps a lot Link to comment
LeeG Posted March 1, 2016 Share Posted March 1, 2016 Yes, the ISY has always been event driven. Link to comment
ScottAvery Posted March 2, 2016 Share Posted March 2, 2016 The Variable must be a State variable. Also need some cleanup in Else. If $PoolHeating is 1 Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off EDIT: Removed the Off statements in Then. No need for them. Lee, Could you explain why the off statements are not required in the Then? OP wanted to a 6 hour cycle to repeat, 3 on, 3 off, while the heating variable is on. How does your statement accomplish that? It looks like it just keeps turning on every three hours. Link to comment
LeeG Posted March 2, 2016 Share Posted March 2, 2016 The Off statements in the Then clause turns the Pump and Filter Off. The next statement in Then repeats the Then clause which immediately turns the Pump and Heater back On. Not likely the pump has even stopped spinning but the point is devices are immediately turned On again. That 1-2 second Off cycle does not do either device any good. Much better to have the Else clause turn the devices Off. Link to comment
ScottAvery Posted March 2, 2016 Share Posted March 2, 2016 But how would the else be executed? The state variable is not changing. Doesn't this just loop back on itself staying constantly on? Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Run Program 'HeatPool' (Then Path) Link to comment
LeeG Posted March 2, 2016 Share Posted March 2, 2016 Yes. The Program runs until the State Variable is changed to 0 (per OP). The probably that the State Variable could be changed during the 1-2 second period when the Then turned the devices Off and before the Then turned the devices back On is so low that the devices would remain On. When the State Variable is changed the 3 hour Wait is interrupted. The If would be False driving the Else which turns the devices Off. Link to comment
ScottAvery Posted March 2, 2016 Share Posted March 2, 2016 Sorry to be thick, but I don't see where the Then turns anything off. isn't it calling itself? On, wait 3, on, wait 3, on, wait 3? Link to comment
LeeG Posted March 2, 2016 Share Posted March 2, 2016 I was referring to the original Then. The Off statements in the original post #1 would not accomplish anything constructive and could lead to early device problems. If $PoolHeating is 1 Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off Run Program 'HeatPool' (Then Path) Else - No Actions - (To add one, press 'Action') "When I have variable PoolHeating to 1 I want the pump/heater to come on for 3 hours then off for 3 hours and repeat till I set variable to 0. One approach could look like the following If $PoolHeating is 1 Then Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 3 hours Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off Wait 3 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / PoolHeater' Off Set 'Pool Equipment / FilterPump' Off I really don't like to do this. Part of this forum activity (in my view) is to provide the OP with enough information where they can write the Program themselves. Insteon is DIY. Helping the OP get to that point is important. Link to comment
stusviews Posted March 3, 2016 Share Posted March 3, 2016 Another approach is to put the devices in a scene and control the scene. Fewer statements require less code to process, possibly shaving a nanosecond or two off the execution time Link to comment
ScottAvery Posted March 3, 2016 Share Posted March 3, 2016 I was referring to the original Then. The Off statements in the original post #1 would not accomplish anything constructive and could lead to early device problems. ..... I really don't like to do this. Part of this forum activity (in my view) is to provide the OP with enough information where they can write the Program themselves. Insteon is DIY. Helping the OP get to that point is important. I see. I was asking about post #2 where you have a different solution. I thought you knew some inexplicable state machine quirk that would make it turn off with the program logic you provided there and I wanted to understand how it would work. Link to comment
LeeG Posted March 3, 2016 Share Posted March 3, 2016 No secrets in post #2. The original post #1 would leave the devices running when the State Variable changed to 0. My post #2 example insures the devices are not left running when Variable changes to 0. The If is triggered by the change in Variable value. The If evaluates as False causing Else to run turning the devices Off. ISY has worked this way for all the years I have been using them. Link to comment
barkster Posted March 3, 2016 Author Share Posted March 3, 2016 I ended up doing it like this If $PoolHeating is 1 Then Set 'Pool Equipment / SupplyValve' Off Set 'Pool Equipment / ReturnValve' Off Wait 1 minute Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 2 hours Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Wait 4 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Link to comment
ScottAvery Posted March 3, 2016 Share Posted March 3, 2016 Might you want to return your valve actuators to previous position in the else when heating ends? Link to comment
barkster Posted March 3, 2016 Author Share Posted March 3, 2016 I could but all my other programs set them before to make sure they are right anyway. Thanks Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.