HAI timer programming

bjr72

Member
Can anyone show me how to accomplish the following code in HAI OmniProII?
I want to setup a timer so that the light in the bedroom goes off after 10 minutes of no motion
Thanks, I would appreciate it.

IF bedroom_motion NOT SECURE THEN
idle_time = 0
ENDIF

IF bedroom_light EQUAL TO ON AND bedroom_motion SECURE THEN
idle_time = idle_time + 1 second
ENDIF

IF idle_time > 600 seconds THEN
bedroom_light = OFF
idle_time = 0
ENDIF


The second IF/ENDIF state might have to change to this:

TIMED EVERY 1 MINUTE
IF bedroom_light EQUAL TO ON AND bedroom_motion SECURE THEN
idle_time = idle_time + 60 seconds
ENDIF
 
You want something like this, use a flag as a timer.

Code:
WHEN Bedroom Motion SECURE
  THEN Bedroom Light Timer ON FOR 10 Minutes
 
WHEN Bedroom Light Timer OFF
  THEN Bedroom Light OFF
 
WHEN Bedroom Motion NOT READY
  THEN SET Bedroom Light Timer to 0

That last block cancels the timer without triggering an "Off" event.


Or use the built in UPB timer if it's just one unit.
Code:
WHEN Bedroom Motion NOT READY
  THEN Bedroom Light ON
 
WHEN Bedroom Motion SECURE
  THEN Bedroom Light ON FOR 10 Minutes

At the end of 10 minutes the light will go to the opposite condition commanded, in this case "Off"
The top block cancels the timer, otherwise the light will go out 10 minutes after the first motion ceases, even if there is new motion inside the 10 minutes.

You may need a few tweaks to get the exact behavior you want.
 
Thank you... so clear when someone shows you how the flags behave. I figured out the difference between 0 and end of timer OFF for a flag the hard way - uploading test programs 10 times before I realized the difference. That was 2 years ago, and I since forgot!

I always wished HAI had just implemented a standard programming language, trimmed down, of course. It would have been so much easier.

I also hate that in order to monitor let's say, the heating status, you have to setup a timed trigger for, let's say, every 2 minutes. It slows down the system when you have a lot of things you need to check every minute, every 5 minutes, every 2 minutes, you know what I mean. That should have been implemented another way, as an interrupt, perhaps. Timed polling can only do so much.

In my system in the winter, when the SYSTEM is HEATING, I set the humidify setpoint to 100% which forces the humidifier in the furnace to ON. Then, when the SYSTEM is NOT HEATING, I force the humidify setpoint to 0% to turn off the humidifier. I found that is the best way to control the humidifier.

Why do I do it this way?

Depending on the setpoint, there were times when the humidifier would turn ON, but the SYSTEM was NOT HEATING and I found that it wasted ALOT of water. In order for the humidifier to be humidifiying the air, the air must be hot (furnace ON) and the fan must be running for it to be effective, otherwise you're just running water down the drain pipe.

Another big joke for new homes is the HRV (Heat Recovery Ventilator). But that's another topic.

Thanks for your help, I appreciate it.

Brian
 
Back
Top