#17116 - 01/11/07 11:56 AM
Go Home Light
|
1021
junior
Registered: 09/12/06
Posts: 32
Loc: Mississauga, Ontario, Canada
|
Hi
I was wondering if you guys can help me with this
Setup 1. 4 magnetic switches Door 1,2,3,4 2. all 4 switches are connected to 4 SECU16 inputs 0,1,2,3 3. All 4 inputs interconnected with SECU 16 Relay output 7 4. Relay 7 controls additional Relay which controls 2 LED’s Red and Green – Go Home Light
Everything work except the “end sequence” I now where the mistake is but I don’t know how to fix it
If Door A is opened - Red LED ON If Door A is closed – Green LED ON
Problem
If the Door A is opened – Red LED ON And the Door B is opened Red LED ON Than Door A is closed – Green LED ON Door B is still opened
I want to have a Green light only if all doors are closed
0271 - IF Module #5 -SECU16 Input #0 Turns OFF // 0272 - THEN Transmit X10, K - 1 // 0273 - THEN Transmit X10, K - ON (19) // 0274 - THEN Module #5 -SECU16 Relay #14 Turn ON // 0275 - IF Module #5 -SECU16 Input #0 Turns ON // 0276 - THEN Module #5 -SECU16 Relay #14 Turn OFF // 0277 - // 0278 - IF Module #5 -SECU16 Input #1 Turns OFF // 0279 - THEN Transmit X10, K - 1 // 0280 - THEN Transmit X10, K - ON (19) // 0281 - THEN Module #5 -SECU16 Relay #14 Turn ON // 0282 - IF Module #5 -SECU16 Input #1 Turns ON // 0283 - THEN Module #5 -SECU16 Relay #14 Turn OFF // 0284 - // 0285 - IF Module #5 -SECU16 Input #2 Turns OFF // 0286 - THEN Transmit X10, K - 1 // 0287 - THEN Transmit X10, K - ON (19) // 0288 - THEN Module #5 -SECU16 Relay #14 Turn ON // 0289 - IF Module #5 -SECU16 Input #2 Turns ON // 0290 - THEN Module #5 -SECU16 Relay #14 Turn OFF // 0291 - // 0292 - IF Module #5 -SECU16 Input #3 Turns OFF // 0293 - THEN Module #5 -SECU16 Relay #14 Turn ON // 0294 - IF Module #5 -SECU16 Input #3 Turns ON // 0295 - THEN Module #5 -SECU16 Relay #14 Turn OFF // 0296 - // XXXXXXXXXXXXXXXXXXXX 0297 - IF Touch Object #107, Button Leopard is pressed // GARAGE OPENED/CLOSED 0298 - AND Module #5 -SECU16 Input #3 Is ON // MAGNETIC CONTACT SWITCH 0299 - THEN Module #5 -SECU16 Relay #15 Turn ON // RELAY 8 GARAGE OPENER 0300 - THEN Timer #1 = 1 // 0301 - IF Timer #1 becomes > 3 // 0302 - THEN Module #5 -SECU16 Relay #15 Turn OFF // 0303 - THEN Timer #1 = 1 // 0304 - IF Module #5 -SECU16 Input #3 Is OFF // 0305 - THEN Variable #41 = 0 // GARAGE OPENED 0306 - THEN Touch Object #107 displays Icon# Garage opened.bmp // 0307 - IF Variable #41 becomes = 0 // 0308 - AND Module #5 -SECU16 Input #3 Turns OFF // 0309 - THEN Send Module #7 -SPEAK-EZ Audio Message #1 // 0310 - // 0311 - IF Touch Object #107, Button Leopard is pressed // GARAGE OPENED/CLOSED 0312 - AND Module #5 -SECU16 Input #3 Is OFF // MAGNETIC CONTACT SWITCH 0313 - THEN Module #5 -SECU16 Relay #15 Turn ON // RELAY 8 GARAGE OPENER 0314 - THEN Timer #2 = 1 // 0315 - IF Timer #2 becomes > 3 // 0316 - THEN Module #5 -SECU16 Relay #15 Turn OFF // 0317 - THEN Timer #2 = 1 // 0318 - IF Module #5 -SECU16 Input #3 Is ON // 0319 - THEN Variable #41 = 1 // GARAGE CLOSED 0320 - THEN Touch Object #107 displays Icon# Garage closed.bmp // 0321 - IF Variable #41 becomes = 1 // 0322 - AND Module #5 -SECU16 Input #3 Turns ON // 0323 - THEN Send Module #7 -SPEAK-EZ Audio Message #2 //
1021
|
|
Top
|
|
|
|
#17117 - 01/11/07 01:34 PM
Re: Go Home Light
[Re: 1021]
|
Guy Lavoie
Beyond All Hope
   
Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
|
The problem is that you're looking for a dynamic triggering condition (Turns ON) for 4 different inputs to control relay #14. This doesn't work because another input might have changed in the meantime. The best way to do this is with a flag, by testing all 4 inputs statically, with any one of them setting the flag. Finally if the flag is set, then activate the relay. By looking for the flag to "become" a new value, you only set the relay when the flag actually changes.
It is not clear from your code if an open door turns an input on or off so in this example I'm assuming an open door turns on an output. If its the opposite, then change lines 283 to 286 to "Is OFF". Same thing with the red/green LED. I'm assuming that the relay being turned on shows a red LED. If its the opposite then change lines 291 and 293 accordingly. In this example I'm using variable #99 as the flag:
0271 - IF Module #5 -SECU16 Input #0 Turns OFF // 0272 - THEN Transmit X10, K - 1 // 0273 - THEN Transmit X10, K - ON (19) // 0274- // 0275 - IF Module #5 -SECU16 Input #1 Turns OFF // 0276 - THEN Transmit X10, K - 1 // 0277 - THEN Transmit X10, K - ON (19) // 0278 - // 0279 - IF Module #5 -SECU16 Input #2 Turns OFF // 0280 - THEN Transmit X10, K - 1 // 0281 - THEN Transmit X10, K - ON (19) // 0282 - // 0283 - IF Module #5 -SECU16 Input #0 Is ON // if any door is open 0284 - OR Module #5 -SECU16 Input #1 Is ON // 0285 - OR Module #5 -SECU16 Input #2 Is ON // 0286 - OR Module #5 -SECU16 Input #3 Is ON // 0287 - THEN Variable #99 = 1 //then set flag 0288 - ELSE Variable #99 = 0 //else clear flag 0289 - // 0290 - IF Variable #99 becomes = 1 //if flag just got set 0291 - THEN Module #5 -SECU16 Relay #14 Turn ON // then show red LED 0292 - IF Variable #99 becomes = 0 //if flag just got cleared 0293 - THEN Module #5 -SECU16 Relay #14 Turn OFF // then show green LED
0296 - // XXXXXXXXXXXXXXXXXXXX ...
Note that since the first 3 inputs turning off have the same action (turning K1 on) you could furthur reduce lines 271 to 281 to:
0271 - IF Module #5 -SECU16 Input #0 Turns OFF // 0272 - OR Module #5 -SECU16 Input #1 Turns OFF // 0273 - OR Module #5 -SECU16 Input #2 Turns OFF // 0274 - THEN X10, K - 1 Turn ON // use X10 quick on/off instruction
_________________________
"If you don't know what you're doing, do it neatly..."
|
|
Top
|
|
|
|
Moderator: Dan Smith, Monte G, ADI Tech Support, Guy Lavoie
|
1 registered
(kuro)
and 21 anonymous users online.
|
|
2747 Members
19 Forums
3837 Topics
22714 Posts
Max Online: 67 @ 08/16/11 03:08 PM
|
|
|
|
|
|
1
|
2
|
3
|
4
|
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
|
26
|
27
|
28
|
29
|
|
|
|
|
|