PC Access "OR" programming

edselrt

Active Member
Here are my programming codes:

30. WHEN GARAGE KEYFOB SECURE
AND IF AWAY FLAG ON
AND IF OVERHEAD GARAGE SECURE
OR
AND IF DAY
AND IF OVERHEAD GARAGE SECURE
OR
AND IF NIGHT DELAY FLAG ON
AND IF OVERHEAD GARAGE SECURE
THEN PROGRAM BYPASS OVERHEAD GARAGE

Program will only execute when conditions 1 and 2 are satisfied. Moving conditions 5 and 6 to the top resulted in program execution when conditions 5 and 6 were satisfied. The rest of the conditions did not do anything. What could be the problem? I am using PC Access version 3.2.0.523
 
Here are my programming codes:

30. WHEN GARAGE KEYFOB SECURE
AND IF AWAY FLAG ON
AND IF OVERHEAD GARAGE SECURE
OR
AND IF DAY
AND IF OVERHEAD GARAGE SECURE
OR
AND IF NIGHT DELAY FLAG ON
AND IF OVERHEAD GARAGE SECURE
THEN PROGRAM BYPASS OVERHEAD GARAGE

Program will only execute when conditions 1 and 2 are satisfied. Moving conditions 5 and 6 to the top resulted in program execution when conditions 5 and 6 were satisfied. The rest of the conditions did not do anything. What could be the problem? I am using PC Access version 3.2.0.523
Why fight it? I'd just set it up as three separate events and be done with it. Of course, I've had VERY little sleep in the past few days so I'm not in a "fighting" mood either. In other words, I'd just do what I know works and call it done...
 
Why fight it? I'd just set it up as three separate events and be done with it. Of course, I've had VERY little sleep in the past few days so I'm not in a "fighting" mood either. In other words, I'd just do what I know works and call it done...
[/quote]

thanks for your reply. Setting it up as three separate events will be my last option. For now, I am trying to find out if this kind of programming is doable
 
I've run into the same thing with my OmniPro II and I've figured out something. Consider the following program block:

EVERY MINUTE
AND IF TIME IS GREATER THAN SUNSET
AND IF DAY OF WEEK IS IN --W----
AND IF DAY
OR
AND IF Guests in upstairs bedrooms CURRENT VALUE IS 1
THEN Den table lamp ON FOR 10 SECONDS

This is supposed to turn on the den table lamp for ten seconds under one of two scenarios: (1) it's Wednesday, and the time is between sunset and midnight, and the security is armed to Day mode; (2) a flag called "Guests in upstairs bedroom" is equal to 1. However, what I have found is that, within the first group of conditions preceding the OR, if any condition other than the last one is false, evaluation stops there and the action is never executed. This block works properly only when the first two conditions -- it's Wednesday and the time is between sunset and midnight -- are true. When these are true, then the light will flash if the system is armed to Day mode or the flag is equal to 1.

It occurs to me that there may be a problem with interpretation of the specification for how AND and OR conditions are supposed to work. In formal Boolean logic, and I suspect in the minds of a lot of people who write automation for this system, the AND operator has precedence over the OR operator. So, if we use parentheses to show how we expect this block to work, what we expect is:

(IF TIME IS GREATER THAN SUNSET AND IF DAY OF WEEK IS IN --W---- AND IF DAY)
OR
(IF Guests in upstairs bedrooms CURRENT VALUE IS 1)

However, it appears that what the controller actually implements is:

IF TIME IS GREATER THAN SUNSET AND IF DAY OF WEEK IS IN --W----
AND (IF DAY OR IF Guests in upstairs bedrooms CURRENT VALUE IS 1)

I'm not sure if the problem is in PC Access or in the OmniPro II's firmware (I've got 3.01A), or if that's the way it's intended to work. If the latter, it looks like I have to re-write the whole block in NAND logic to make it work the way I want it to work... which makes my head hurt.
 
I've run into the same thing with my OmniPro II and I've figured out something. Consider the following program block:

EVERY MINUTE
AND IF TIME IS GREATER THAN SUNSET
AND IF DAY OF WEEK IS IN --W----
AND IF DAY
OR
AND IF Guests in upstairs bedrooms CURRENT VALUE IS 1
THEN Den table lamp ON FOR 10 SECONDS

This is supposed to turn on the den table lamp for ten seconds under one of two scenarios: (1) it's Wednesday, and the time is between sunset and midnight, and the security is armed to Day mode; (2) a flag called "Guests in upstairs bedroom" is equal to 1. However, what I have found is that, within the first group of conditions preceding the OR, if any condition other than the last one is false, evaluation stops there and the action is never executed. This block works properly only when the first two conditions -- it's Wednesday and the time is between sunset and midnight -- are true. When these are true, then the light will flash if the system is armed to Day mode or the flag is equal to 1.

It occurs to me that there may be a problem with interpretation of the specification for how AND and OR conditions are supposed to work. In formal Boolean logic, and I suspect in the minds of a lot of people who write automation for this system, the AND operator has precedence over the OR operator. So, if we use parentheses to show how we expect this block to work, what we expect is:

(IF TIME IS GREATER THAN SUNSET AND IF DAY OF WEEK IS IN --W---- AND IF DAY)
OR
(IF Guests in upstairs bedrooms CURRENT VALUE IS 1)

However, it appears that what the controller actually implements is:

IF TIME IS GREATER THAN SUNSET AND IF DAY OF WEEK IS IN --W----
AND (IF DAY OR IF Guests in upstairs bedrooms CURRENT VALUE IS 1)

I'm not sure if the problem is in PC Access or in the OmniPro II's firmware (I've got 3.01A), or if that's the way it's intended to work. If the latter, it looks like I have to re-write the whole block in NAND logic to make it work the way I want it to work... which makes my head hurt.

Maybe HAI people can shed light on this
 
Why not simply write two rules?

Rule Set 1
EVERY MINUTE
AND IF TIME IS GREATER THAN SUNSET
AND IF DAY OF WEEK IS IN --W----
AND IF DAY
THEN Den table lamp ON FOR 10 SECONDS

Rule Set 2
IF Guests in upstairs bedrooms CURRENT VALUE IS 1
THEN Den table lamp ON FOR 10 SECONDS

If you are trying to combine them into one set of rules, then I think you need to write it this way.
EVERY MINUTE
AND IF TIME IS GREATER THAN SUNSET
AND IF DAY OF WEEK IS IN --W----
AND IF DAY
THEN Den table lamp ON FOR 10 SECONDS
OR
IF Guests in upstairs bedrooms CURRENT VALUE IS 1
THEN Den table lamp ON FOR 10 SECONDS
 
cornutt,

Your understanding of the and/or precedance is correct. That is, the blocks of "AND" statements function as if they had parentheses around each block of "AND" statements.

Your analysis has helped us identify a problem in the controller firmware. As you noted, the "OR" is not processed correctly if any but the last "AND" in the "AND" block before the "OR" is false. We have corrected the problem and expect to release a firmware update shortly.

edsel, this should fix the problem you were experiencing also.
 
Your understanding of the and/or precedance is correct. That is, the blocks of "AND" statements function as if they had parentheses around each block of "AND" statements.

Thanks, Brian. I went back and re-read the 3.0 firmware release notes after I posted last night, just to make sure I wasn't crazy. It's great to see a vendor who is responsive to things like this.
 
Back
Top