Please login or register.

Login with username, password and session length

Author Topic: Simple alternating devices, non-conditional loop  (Read 8073 times)

betascreen

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
Simple alternating devices, non-conditional loop
« on: January 26, 2008, 12:03:00 AM »

I purchased the CM15A and Advanced Macros with assurance from the sales department that the function I need could be easily implemented.

I need to run two heaters on the same branch circuit.  If they are both ON simultaneously the circuit breaker will trip.  I want to:

 - energize one heater through an Appliance Module 1 for 5 minutes,
 - then turn it off,
 - then energize the other heater through Appliance Module 2 for 5 minutes
 - then turn it off
Return to start of sequence

Each area to be heated requires less than 50% duty cycle on the heater at the desired thermostat setting.  The user interface on the whole system seems quirky and counter-intuitive in places.  Lots of decoration but little clearly defined function.

Can someone provide a link to a posted macro, or provide some sample code to achieve the desired result?  Searching "alternating" or "load shedding" produced no useful results.

Thanks,
Larry
Logged

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Simple alternating devices, non-conditional loop
« Reply #1 on: January 26, 2008, 02:13:42 AM »

Ok here's one possibility.

For the sake of the example, I'm going to use "H1" and "H2" for heaters 1 and 2 respectively. Also "M1" and "M2" for the macros to trigger them.

You also will need to define two dummy appliance modules as "M1" and "M2".

Macro M1 - Triggers on M1 ON and Flag 3 clear
Set Flag 3
H2 off
delay 2 sec
H2 off
delay 2 sec
H1 on
delay 5 min
Clear Flag 3
M2 on - Turns on dummy module M2 which triggers Macro M2

Macro M2 - Triggers on M2 ON and Flag 3 clear
Set Flag 3
H1 off
delay 2 sec
H1 off
delay 2 sec
H2 on
delay 5 min
Clear Flag 3
M1 on - Turns on dummy module M1 which triggers Macro M1

Starting either macro will start an alternating pair of loops. Use of flag 3 reduces the possibility of an over lapping set of loops occurring should you accidentally try start it again while one pair is already running.

The redundant off commands are to make sure one heater is off before the next is turned on. I'd probably add a 3rd off if it was my setup. Plan for the possibility should one heater not turn off and the breaker trip. A power failure alarm might be a good idea.
i.e. Never trust your life or your water pipes to X10.
« Last Edit: January 26, 2008, 02:30:52 AM by steven r »
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Simple alternating devices, non-conditional loop
« Reply #2 on: January 26, 2008, 02:53:24 AM »

...or this idea if you want to combine it all into one loop.

Uses:
  • 3 macros "M1 ON", "M1 OFF", & "M3 ON"
  • Appliance modules "H1" & "H2" for the heaters
  • 1 dummy appliance module in AHP defined as M3
  • Flags 3 & 4


Macro M1 ON - starts loop
Clear flags 3 and 4
M3 on

Macro M1 OFF - stops loop
Set flag 4

Macro M3 - Triggers on M3 ON and Flags 3 and 4 clear
Set Flag 3
H2 off
delay 2 sec
H2 off
delay 2 sec
H1 on
delay 5 min
H1 off
delay 2 sec
H1 off
delay 2 sec
H2 on
delay 5 min
Clear Flag 3
M3 on - Turns on dummy module M3 which triggers Macro M3

The advantage of this approach over my last post is that you have a way to stop the loop. i.e. Sending an "M1 OFF" will stop the loop within about 10 min.
« Last Edit: January 26, 2008, 03:03:12 AM by steven r »
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

betascreen

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
Re: Simple alternating devices, non-conditional loop
« Reply #3 on: January 26, 2008, 04:08:58 PM »

Hello Steven,

Thanks for the quick reply and useful information :
(Never trust your life or your water pipes to X10. )

I created a simple macro (image attached)

House code is G
Appliance Module 8

1.) Do I understand correctly that the MACRO is called when I press the #8 ON button on a controller?
Or optionally when #8 OFF is pressed, depending on the selector  ON/OFF button next to the Trigger name in Macro Designer?

2.) Shouldn't this macro execute immediately when I click on the Macro from the Room view?  The icon of the device changes state, but not the module plugged into the house receptacle.  The USB device is listed correctly, module works from a wired and wireless controller.

3.) Does "Run From PC" mean that I DON'T have to download it to the CM15A? Just "Save" from the icon in extreme lower right?  Dowmnloading is extraordinarily slow, is this normal?

4.) In the ROOM view of Heater1 Macro1, what do the On/Off buttons (labeled "Send this macros (sic) trigger to an "On" command) do?  Same thing as the On/Off selector next to the Trigger in Macro Designer?

Sorry for the long questions.  I'm trying to set this up and then send the hardware and software to someone else. I paid for, and downloaded and registered the software.  Will I be able to transfer it and the registration codes to them? I don't want THEM to be stumped, and me not able to help them.

Thanks,

Larry
Logged

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Simple alternating devices, non-conditional loop
« Reply #4 on: January 26, 2008, 07:08:16 PM »

...3.) Does "Run From PC" mean that I DON'T have to download it to the CM15A? Just "Save" from the icon in extreme lower right?  Dowmnloading is extraordinarily slow, is this normal?...
I'm not exactly sure what you've created but you only have it turning on for 5 sec. Furthermore if you have any modules defined as G8, the macro will start calling itself multiple times. Look over your logic and if it's not clear look back at my example.

Choice save it in interface. If you you choose "run from PC", the computer will have to be on 24/7.
« Last Edit: January 26, 2008, 08:10:10 PM by steven r »
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

betascreen

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
Re: Simple alternating devices, non-conditional loop
« Reply #5 on: January 27, 2008, 12:51:39 PM »

Hello Steven,

Its all becoming clearer.

 - Don't use the NAME of a module for the MACRO
 - My posted sample had 5 second intervals only for testing.  It turns out this short a delay is unreliable.  Putting in 8 second "working" durations allows it to function properly.

Your second post states it is improved because:
  ** Macro M1 OFF - stops loop**
   **Set flag 4                       **

Flag 4 is not referenced inside the loop.  Is it used as a conditional to START the loop, allowing M3 to run, and checked each time before the loop executes?

Thanks,
Larry

Logged

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Simple alternating devices, non-conditional loop
« Reply #6 on: January 27, 2008, 03:30:28 PM »

...Flag 4 is not referenced inside the loop.  Is it used as a conditional to START the loop, allowing M3 to run, and checked each time before the loop executes?...
Checking to see if flag 4 is cleared each time the loop is about to start allows an escape from an endless loop.
i.e. In my example, the "M1 OFF" macro sets flag 4 and stops the loop from restarting.

In addition to not doing what I understand you want to do, the main problem with your macro is the danger that it will call itself endlessly. Even more of a potential problem than that is that the macro will start executing multiple times by a power of 2 every few seconds. i.e. Each time a "G8 ON" is sent, another copy of the macro is started.

« Last Edit: January 27, 2008, 05:23:07 PM by steven r »
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.