Jump to content

Help understanding how programs are triggered


to_lighter

Recommended Posts

Posted

Hi gang,

 

I am having difficulty understanding how programs are triggered in the 99i.

 

1) If I put no conditions in a program, does it only run when called programatically (i.e. as an action in another program)?

 

2) If I put a condition in to check the status of a switch, does this program only run and check the switch's status when called programatically, or does it also run when the status of one of the elements of the condition statement change. For example, if I have a condition which is true if all of three different switches are off, will this program only run when one of the devices are switched on or off?

 

3) Do programs run concurrently, or one after another? How is the order of events determined? For example, if a program has multiple actions, the first of which changes the status of a switch, does that action trigger any programs which are monitoring the status of that switch before moving on to the next action in the original program, or does the original program finish, and then any programs whose condition statement referenced that switch run?

 

I ask because I have a series of nested programs, which if enabled seem to set of a storm of running programs. They keep looping one after another without end. I've checked the program logic, and this shouldn't be happening, so it makes me think that I don't understand how programs get triggered to run.

 

Cheers!

Posted

I am fairly new to all this and I am sure someone will jump in to correct me if I am wrong, but I have studied this quite a bit and this is what I know.

 

Programs get triggered when one of the conditions "changes" state. If the conditions are TRUE it will execute the THEN statements if the conditions are FALSE then it executes the ELSE statements. Critical to remember is that the program will only process the TRUE statements as long as the condition remains TRUE. So, for example if you have a wait in your THEN statements and one of the conditions changes such that overall the condition is no longer TRUE, it will immediately jump and execute the ELSE statements.

 

So:

 

1) Without conditions the program will only run when called since there is nothing there to change. However, I am not sure what happens on power up...it may run once, but I have not verified that. My guess is that it will not run at all.

 

2) It runs when the state of any of the conditions changes. So, yes it will run when one of the devices are switched on or off. Key to remember is what I said above though. Let's say two of your switches are ON and one is OFF. If you have all 3 in your conditions set to STATUS = OFF then you go and turn one of them (making it two off and one on) then the program with run the ELSE statements. I reiterate this because it has caught me several times.

 

3) They all run concurrently. The order of events sequential from top to bottom in the THEN and ELSE sections. In your example, when the first action changes the status of a switch that action will trigger the other program that is watching for it IMMEDIATELY. Key to note here is that you can not CALL another program...if you trigger a program from within a program, the second program just runs and the first ones just continues on the next line. If you have nested programs that are not acting as you expect, I suspect this is the reason.

 

I am an experienced PLC programmer as well as a basic VB programmer. My PLC thoughts get in the way sometimes with ISY...but after I got my head wrapped around it I have found it to be very simplistic and yet very powerful. Many people do some cool stuff with it...and yet it is simple enough for most to understand.

 

Eric

Posted

One other thing that I forgot to mention that caught me as well (I finally found the answer here on the forum somewhere) is that using STATUS for Dimmers does not always give you what you think.

 

Status Is On is not a true statement for a dimmer that is on.

 

If you use this to trigger the THEN statements, it will not work because the dimmer status is a percentage of brightness not ON or OFF. In order to get around this use Control instead.

 

For example:

 

Status LIGHT1 Is On (this will not work, it will run the ELSE statements

 

Control LIGHT1 Is Switched On (this will work when the light is turned on)

 

If you want to check to see if the light is already on (control only works when it is switched on or off), then you have to use the > with the Status like this:

 

Status LIGHT1 > 1%

 

Sorry so long winded...but I wished I had learned this stuff quicker in the beginning myself so I figured I would pass along what I know.

 

Eric

Posted

Hey Eric -

 

Good observation. Dimmer devices are not considered ON unless they are 100% ON. Using > than 1% should work, but keep in mind you can also do a NOT OFF.

 

So, instead of saying:

 

IF SWITCH1 STATUS IS ON

 

say

 

IF SWITCH1 STATUS IS NOT OFF

Posted

Thanks for the quick replies, everyone. It has helped out of looping program hell. Now I need to spend more time figuring out the logic for some of my programs with this new knowledge in mind.

 

Extremely helpful posts!

 

Thanks!

Posted

Status triggers an enabled program whenever the Status changes. For example, If Status of Light 1 is NOT OFF starts a program, and the program then turns Light 1 OFF, the program will restart and run the Else clause if it encounters a Wait.

 

Control triggers an enabled program at the instant the specified Control event occurs. Control does NOT restart the program when the "opposite" Control event occurs. For example, If Control Switch 1 is switched ON starts a program, and the program turns OFF the light controlled by Switch 1, the program will continue to completion through any Waits. Even manually switching Switch 1 OFF will not restart the program! Only switching Switch 1 OFF and then back ON will restart the program.

Posted

One problem that I am having relates to timing when the 99i assessing the condition. For example, if a switch triggers a fade to off, and also triggers a program, a status check of that light will not reveal it to be off if it is still fading. There doesn't seem to be a way to delay the assessment of the light status (for example, if Ceiling Light is switched off, wait 2.5 seconds, check status of Ceiling Light).

 

This came up in a program which checks if all of the lights are off in a room if any of the light switches in the room turn off or fade down their light.

 

Cheers!

Posted
One problem that I am having relates to timing when the 99i assessing the condition. For example, if a switch triggers a fade to off, and also triggers a program, a status check of that light will not reveal it to be off if it is still fading. There doesn't seem to be a way to delay the assessment of the light status (for example, if Ceiling Light is switched off, wait 2.5 seconds, check status of Ceiling Light).

 

This came up in a program which checks if all of the lights are off in a room if any of the light switches in the room turn off or fade down their light.

 

Cheers!

 

I'm not sure what you mean by this. Can you post the program and we can take a look? To be honest, I have never posted a program in here but many people do so I assume cut and paste works somehow...but I can't easily see how to do it right now??

 

Hey Eric -

 

Good observation. Dimmer devices are not considered ON unless they are 100% ON. Using > than 1% should work, but keep in mind you can also do a NOT OFF.

 

So, instead of saying:

 

IF SWITCH1 STATUS IS ON

 

say

 

IF SWITCH1 STATUS IS NOT OFF

 

Good point Mike, actually this is something I have done in some cases and if memory serves me right, you pointed this out to me when I was starting out!

Posted

Hi Ulrick65,

 

Actually, using the info posted earlier, I figured out my premise for the program was wrong. I keep thinking I have to tell the system to check for status changes, but I am trying to remind myself that the programs will run by themselves when status changes.

 

I've discovered a new problem, which I will search for some answers for next. One of my switches doesn't report status changes most of the time. Since this was one of the switches I used most often when learning to use the 99i, you can imagine that this led to much confusion!

 

Cheers!

Guest
This topic is now closed to further replies.

×
×
  • Create New...