02-26-2025, 09:46 AM
An updated version that allows for arming delays. In the following _/ is a rising edge on the input, _#_ is a 500ms pulse on the output. I've also changed the notation slightly, instead of using DI n and DO n which can get a bit confusing I've used labels like "Arm" and "Disarm". So for example "Arm _/ -> Armed _#_" means if an input detects a rising edge on the Arm input then output a 500ms pulse on the Armed output.
The ladder logic for the alarm is then:
This arms the alarm with a 10s delay. The logic is a bit more complicated because you could get a disarm (stay arm) in the middle of the arming process. What the Arm does is activate both Try_Arm_1 and Try_Arm_2. After the 10s arming delay it tries both branches, if the arming has been cancelled, so No_Arm is set, the arming is cancelled. If not, the arming occurs. Finally, the disarm continues to Cleanup which, after waiting for the arming delay to expire, cleans up. So the three possible logic flows are:
The alarm process itself is:
These are pretty simple, if smoke is detected activate Siren_On, if motion is detected and the alarm is armed active Siren_On. Siren_On turns on the siren and activates Siren_Delay which waits 5 minutes and turns if off again.
The ladder logic for the alarm is then:
Code:
Arm _/ -> Delay 10s, Try_Arm_1 _#_ + Try_Arm_2 _#_
Disarm _/ -> No_Arm on, Armed off, Cleanup _#_
Try_Arm_1 _/ && !No_Arm -> Armed on
Try_Arm_2 _/ && No_Arm -> Armed off, No_Arm off
Cleanup _/ -> Delay 15s, No_Arm off
Code:
Arm -> Try_Arm_1 Armed = on, No_Arm = off
Arm -> -> Try_Arm_2 Armed = off, No_Arm = off
Disarm -> Cleanup Armed = off, No_Arm = off
Disarm -> Cleanup Armed = off, No_Arm = off
Code:
Smoke _/ -> Siren_On on
Motion _/ && Armed -> Siren_On _#_
Siren_On _/ -> Siren on, Siren_Delay _#_
Siren_Delay _/ -> Delay 300s, Siren_On off, Siren off