Jump to content

Program Execution ?


Grizzy

Recommended Posts

Posted

I'm new to the ISY world and trying to grasp the functionality of the ISY

 

I  understand the programs are event driven.

 

If I have 4 programs with the exact same "IF" event ... Which one will execute first , Second , etc.

 

Thanks

 

Posted

I don't know correct answer or if you can always predict.  However, depending on circumstances, you might consider a method so you force the order of events.  Example below will provide method of ordering events but will have issues if your four programs have different Else statements.

 

 

Program Overall

 

If Some Condition

   Run Program A (Then)

   Wait X seconds (as desired of not)

   Run Program B (Then)

   Wait X seconds

   Run Program C (Then)

   Wait X seconds

   Run Program D (Then)

 

Else

   As noted if  Else clause for A-D required  then this is probably not right method.

 

Programs A,B,C, and D would not have an If statement. 

Posted

Hi,

 

the else statement could be an issue in some cases. I was hoping being event driven it might have a predictable execution path.

 

I thought by setting a variable(s) I could force execution down a given path, however that requires more resources if there is a  simpler way.

 

thanks for your thoughts, I will keep that in mind as I had not considered that methodology.

Posted

my understanding is that there is no order of program execution when triggered by the same event.  All programs would run simultaneously, at least from a practical standpoint.  There would be no need for one program to finish before the other starting.

 

If you must force one program to stop before the other start, you could try the hart2hart method, or something like:

 

if

event

then

do something

run next program (then path)

else

nothing

 

next program

if

nothing

then

do more

run third program (then path)

else

nothing

 

third program

if

nothing

then

do even more

run.....

Posted

my understanding is that there is no order of program execution when triggered by the same event.  All programs would run simultaneously, at least from a practical standpoint.  There would be no need for one program to finish before the other starting.

 

If you must force one program to stop before the other start, you could try the hart2hart method, or something like:

 

if

event

then

do something

run next program (then path)

else

nothing

 

next program

if

nothing

then

do more

run third program (then path)

else

nothing

 

third program

if

nothing

then

do even more

run.....

 

This is all correct.  I did quite a few tests on this when writing my date programs.  If you want to be certain that programs execute the "then" or "else" clauses in order, then you need the last line of the clause to call the next program.  

 

Even if you do this:

 

If

whatever

Then

Run program a

Run program b

Run program c

 

It could happen that some of program c would execute prior to parts of program a.  You just can't predict it.

Posted

Grizzy

 

Can you share what you are trying to program? You will get feedback on different ways to accomplish what you are programming and maybe some less complex ways to achieve that.

 

Paul

Posted

Thanks everyone for the ideas.

 

my simplified example:

 

I have a gas fired boiler, with a variable firing rate dependent on demand. Fuel and air flow usually change together from 25% to 100%. Fuel and Air usually match to maintain an exit gas oxygen level of 3%. The excess oxygen is monitored and alarm or trip if limits are exceeded.

 

IF Condition = Low Oxygen

 

Actions include all the following:

 

Increase are flow wait for condition to clear

Wait - Decrease fuel flow if condition does not clear

Wait - Master Trip Fuel if condition does not clear Purge boiler

 

The IF condition will initiate each of the programs but must all start in sequence and run concurrently.

Posted (edited)

Any new condition requires another program.

 

Low Oxygen Progam

If Low Oxygen

 

Then

        wait

       run next program

 

Next Program

If Low Oxygen

 

Then

       wait

       run next next program

 

Next next program

If Purge boiler not clear

 

Then

       Master Trip fuel

 

The next and next next programs should be disabled so that they run only if the Low Oxygen program runs.

 

Once a program is started it will run to completion. The program doesn't wait for the next one to start. Add a wait delays starting of the next program. If the first one completes before the next one starts, then they won't run concurrently. Do you mean that the programs should run sequentially? If so, then the wait states are appropriate. If each step takes x and the wait is less than x, then the programs will run sequentially and concurrently.

 

Keep it green in '15

Edited by stusviews
Posted

Good,

 

That seems like good solution.

 

I will keep in mind I have to control the program flow with duplicate IF Conditionals.

 

Quick question. I have seen many program have double IF condition:

 

IF

  X10 A10 = ON

and

  X10 A10 = NOT ON

 

Why use the both , will not just the  X10 A10 = ON suffice ?

Posted

More likely you have seen

 

IF

        X10 A10 = ON

     And X10 A10 = NOT OFF

 

I don't know why, but I've found some instances where the program ran more reliability.

 

Keep it green in '15

Posted

More specifically, one will often see:

 

If

CONTROL device is on

and CONTROL device is not off

then...

else...

 

Such constructs can be used when one wants to take one course of action (then path) if ON is received, and a second course of action if an OFF (else path) is received.

Posted

I am not sure both the ON and OFF conditions need to be tested. My assumption is that whenever there is a state change (ON or OFF) this condition will be tested therefore a simple ON test (to the THEN branch) and the OFF (to the ELSE branch) should be suffice.

 

Please let us know if anyone else has understanding other than this.

 

 

Thanks!

 

Brian

Posted (edited)

Jimbo is, of course, correct. CONTROL conditions respond only to the expected command (on, off). STATUS conditions respond only to changes in state (will not repond to an ON command if state is already on.)

 

This is a key feature, in my mind, of the programming of the ISY. A review of the wiki may be a good thing here, as suggested.

Edited by oberkc
Posted

Right, I was referring to status tests not control, thanks for the clarification. Further, when testing against time or variables I assume the logic follows the same as status tests?

 

For example;

 

If Time is 18:00

then

.....

else

.....

 

 

 

Thanks!

 

Brian

Posted

Hi all I am new to the ISY994i/ir pro and how to program,  So I have a night lite that I would like to do this and don't under stand how to make my program #2 happen with out effecting program #1 ?

 

program #1 (good night)

I will turn on the night light,  I want it to dim to 35%,  stay on for 4 minute's,  than turn off.

 

program #2 (wake-up)   I want it to turn on at 4:20am, I want it to dim to 35%, stay on for 2 minute's than turn off  OR (turn off at4:22am) with out effecting the other program.

 

also one other thing I don't under stand is when you make a program using this night light I loose the ability of just having a night lite with only on and off or am I doing something wrong or missing it.

Any help would be great,

Thanks Perry.

Posted

Perry

 

You'll want to include schedule conditions in your program. The schedule conditions will only allow the logic to work at the times you specify:
 

Goodnight program:

If
        From    10:30:00PM
        For      30 minutes 
    And Control 'Your Nightlight' is switched On
 
Then
   - Your actions
 
Else
   - No Actions - (To add one, press 'Action')

Follow a similar pattern for the programs for other times. If you manually turn on the night light outside of the schedule constraints, nothing will happen to it

 

You could also have another program for when its not bedtime or wake up:

if its between those other times, and the nightlight is switched on...

then (whatever actions you want)

 

Paul

Posted

Iamnot following your desires. When you say "I will turn on the night light", how do you intend to do this? Manually, or by time? Is the device you intend to turn on the same one that powers the night light?

 

The morning program seems simple enough.

 

If

time is 4:20

Then

Turn on night light

Wait 2 minutes

Turn off night light

Posted

Iamnot following your desires. When you say "I will turn on the night light", how do you intend to do this? Manually, or by time? Is the device you intend to turn on the same one that powers the night light?

 

The morning program seems simple enough.

 

If

time is 4:20

Then

Turn on night light

Wait 2 minutes

Turn off night light

yes, the device is a plug in dimmable module that I have the lamp plugged into it. I will manually turn it on using my windows phone app (snap switch)

Also how would I do just a on and off program for same the same light that won't effect the above program (Paulbates) or the above programs won't take over just the on or off at 100%

Need a suggestion on a IPHONE app for my wife's phone just for turning on and off devices,  no programing or fancy features needed she is not in to it .

Again thanks to you and Paul for your help. I'm starting to understand the sense behind all of this.  

Posted

Perry,

 

I'm a fairly new user too. A lot of it comes to getting some experience with the technologies and programs. Its ok to do the programs in pieces, start with something simpler and add to it as you decide what would make it better. This flexibility is an important feature of the ISY.

 

There are a few phone apps but I'm not a user of them, someone else will need to chime in on that question.

 

Here are some things I think will help with what you are wanting to do:

-If you use a phone app to turn the light on and off, no program is needed. Turn the device on from the phone app, and the ISY will see the request  and turn the device on or off.

 

-The program will react to the light being turned on or off if all the conditions of the 'if' are met. If you use the "Control 'Your Nightlight' is switched On" conditional like in my sample program, they won't know or care how the nightlight got turned on. They will simply execute the statements when they see that it was turned on and if the schedule criteria were met.

 

-If you turn the light on, and then your wife turns it on after that, let's say 10 minutes later, the last one changing it wins. The program will restart with the last activation.

 

Its probably best to start with the phone apps and get used to turning things on an off, then with simpler programs, That will generate "requirements" from your better half ;)

 

Paul

Posted

Unfortunately, I am not familiar with snapswitch. Does this simply turn on the lamp module directly, just as with using the admin panel? This lamp module is the same for both evening and morning programs? This will certainly add a few extra considerations.

 

The brute force method would be to bound the evening program to specific times most likely to be good night times such as

 

If

time is from 6pm

To 12am (next day)

And status dimmer module is ON

then

run time program (then path)

Else

Nothing

 

Timer program:

If

Nothing

Then

Wait 30 minutes

Set dimmer module off

Else

Nothing

 

The morning program would be unchanged from my earlier suggestion.

 

There are probably other options if this does not meet your needs for some reason.

Posted

Does snapswitch allows one to run specific program paths? Could one, for example, create a simple program such as:

 

If

Nothing

Then

Turn on lamp module

Wait 30 minutes

Turn off lamp module

Else

Nothing

 

Then, from snap switch, run the THEN path of this program?

Posted

Does snapswitch allows one to run specific program paths? Could one, for example, create a simple program such as:

 

If

Nothing

Then

Turn on lamp module

Wait 30 minutes

Turn off lamp module

Else

Nothing

 

Then, from snap switch, run the THEN path of this program?

yes, it a great app and you can run a path from a program and it works fine, I could pick if-then-else, or just then, or just else. I think when I learn the difference from a scenes, programs, and how they work together I will be better off. As to the program I think I got this figured out but I want to add one more device into the mix, using the same programs I just want to have the program turn on two different lights at the same times,  and same for turning them off.  do I just add another device to the programs I already have or create another program for that that device or is this what scenes are for?

perry

Posted

Perry, you got it. Scenes cause multiple devices to respond to one message as if they are wired together. Add the devices to a scene and turn the scene on and off instead of the devices.

Guest
This topic is now closed to further replies.

×
×
  • Create New...