Need help with ladder logic problem

RickGilbert

Member
Join Date
May 2005
Posts
7
Hello,

Currently I'm working with WinTRiLogI version 3.5 to devlop the plc ladder logic and have encountered a particular problem I need help with.

Specifically, I need to develop the ladder logic for two Passive Infrared motion detectors that will work as follows:

Scenario #1. Motion detector A is tripped, then B is tripped indicating a person is moving into the room. For his scenario, it is desired to activate a flashing alert light with the plc.

Scenario #2. Motion detector B is tripped first then A is tripped indicating a person is leaving the room. For this scenario, I need to disable the output of my plc to the flashing alert light.

My motion detectors operate off of a N.C. contact as their output (input to the plc) That is to say the relay contacts will open when motion is detected or power is lost.

It is very simple in theory, however I'm at a loss on how to incorporate the differences between scenaraios 1&2 into a ladder logic diagram????.

Any ideas?
Any and all help is greatly appreciated.
 
Scenario #1. Motion detector A is tripped, then B is tripped indicating a person is moving into the room. For his scenario, it is desired to activate a flashing alert light with the plc.

Scenario #2. Motion detector B is tripped first then A is tripped indicating a person is leaving the room. For this scenario, I need to disable the output of my plc to the flashing alert light.


"Be the Computer" and consider what happens...

This assumes that the sensors are close enough so that both might be on.

If "B" goes ON while "A" is ON then latch ON the light.
If "A" goes ON while "B" is ON then Unlatch the Light.

A B
---| |-------|/\|------(SET) Light


A B
---|/\|-------| |------(RST) Light


.
In the case where the sensors are further apart... that takes a little more code.
 
Deja vu

Did you ever read the answers in your other thread?
http://www.plctalk.net/qanda/showthread.php?t=14921&highlight=closed

You need to sit down and write the application out that way YOU and others can get a better understanding of what you are doing.

Will Motion A be on when Motion B comes on? OR are they too far apart to be triggered at same time?

Since someone is walking into an area that requires an alarm light/bit be set...what happens if 2 people walk in and only 1 walks out?

The tri-logic have an up/down counter and compare instructions? May want to consider using the sensors to count up on entry and down on exit...equal to or greater than 2 set alarm, equal to 0 unlatch alarm.
 
Terry Woods said:
Scenario #1. Motion detector A is tripped, then B is tripped indicating a person is moving into the room. For his scenario, it is desired to activate a flashing alert light with the plc.

Scenario #2. Motion detector B is tripped first then A is tripped indicating a person is leaving the room. For this scenario, I need to disable the output of my plc to the flashing alert light.


"Be the Computer" and consider what happens...

This assumes that the sensors are close enough so that both might be on.

That is a realistic assumption. Yes, the sensors are close enough and the assumption is that A is tripped and then B is tripped (with no delay) indicating that someone is entering the room. Basically, I'm not initially accounting for this possible delay between A & B. I just need an initial ladder logic with no initial delay between A & B tripping. That is to say, A trips first then B trips immediately with no accounted time delay indicating a person is entering the room.

Terry Woods said:
If "B" goes ON while "A" is ON then latch ON the light.
If "A" goes ON while "B" is ON then Unlatch the Light.

A B
---| |-------|/\|------(SET) Light


A B
---|/\|-------| |------(RST) Light


Okay, forgive my ignorance, but both sensor inputs are normally closed. That is to say our input actually opens when motion is detected. Given the ladder logic you've given me, how can this match either of the two possibilities I gave? I read your first example as A being normally open and B being normally closed, then when A trips the output light is set. Is this a correct interpretation or no?


Terry Woods said:
.
In the case where the sensors are further apart... that takes a little more code.

Can you elaborate? Yes, I desire ladder logic that isn't time dependant, that is to say A can trip first, then as SOON as B trips (discounting the timing issues), the output is set to on, i.e. my output light will flash. Therefore timing is an issue I'll have to account for later in the ladder logic code. Your help is appreciated.
 
If Normally Open...
A-ON = "Someone seen @ A"
A-OFF = NOT "Someone seen @ A"

If Normally Closed...
A-ON = NOT "Someone seen @ A"
A-OFF = "Someone seen @ A"

Likewise for B

You would do well to convert your negative field logic to positive logic for the process logic.

If A is OFF (Normally ON-Closed)...
then... "Seen @ A"


A
---|/|-----------------( ) Seen @ A

B
---|/|-----------------( ) Seen @ B


.
Then reference whether or not "Seen @ A" or "Seen @ B".
Do not refer to the actual input anymore.

Seen Seen
@A @B
---| |-------|/\|------(SET) Light


Seen Seen
@A @B
---|/\|-------| |------(RST) Light

 
Terry Woods said:
If Normally Open...
A-ON = "Someone seen @ A"
A-OFF = NOT "Someone seen @ A"

If Normally Closed...
A-ON = NOT "Someone seen @ A"
A-OFF = "Someone seen @ A"

Likewise for B

You would do well to convert your negative field logic to positive logic for the process logic.

If A is OFF (Normally ON-Closed)...
then... "Seen @ A"


A
---|/|-----------------( ) Seen @ A

B
---|/|-----------------( ) Seen @ B


.
Then reference whether or not "Seen @ A" or "Seen @ B".
Do not refer to the actual input anymore.

Seen Seen
@A @B
---| |-------|/\|------(SET) Light


Seen Seen
@A @B
---|/\|-------| |------(RST) Light


Thanks Terry,
It works fine except for on slight problem. When A is tripped
and then B is tripped the light sets as described. Yet if A is tripped again the light is set as well????? Any way to disable this in the code?
Thanks so much for all your help.
~Rick
 
Another form of the old "Flip-Flop"

RickGilbert,

Here is a Motion Detector program that I tested and it works. This version assumes that the distance between the A and B Detectors is less than the width of a person. If not, change I:1/1 and I:1/0 in rungs 0 and 2 to XIC contacts.
MOTION_DETECTOR2a.JPG
 
Last edited:
If I understand your problem, it's that the "Set light" will become true as one exits; after B is passed and A is not on the way out. I don't know the specifics of your setup but I wonder if the reset line could not also start a timer that would not allow the set line to become true until the timer timed out. This would require a timer contact in the "set Light" line that would become true when the timer timed out. My thinking is that the timer would give an exiting person time to clear eye A before the Set light output would become true. It's been years since I've messed with programming and that was very little and only on SLC 5/03, and I'm new to this site but what the heck.
 
Rick read the manual closer: http://www.tri-plc.com/trilogihelp.pdf

5. Differentiate Up and Down [d DIFU] and [d DIFD]
When the execution condition for [dDIFU] goes from OFF to ON, the designated output or relay will be turned ON for one scan time only. After that it will be turned OFF. This means that the function generates a single pulse for one scan time in response to the rising-edge of its execution condition. When its execution condition goes from ON to OFF nothing happens to the output orrelay that it controls.

That is a one-shot. It seems that tri-logic also allows you to create a custom function using TBasic. I am not familiar with this but seems you need to study the software in more detail to determine all that is available.
 
Last edited:
Rick,

The Tri-logic calls the One Shot BY different nameS. But if you ARE ever working on a PLC which does not have a One-Shot function, then you can substitute the following "roll-your-own" logic on almost any PLC:
ALTERNATOR2.JPG
 

Similar Topics

I need to know how to take a schematic like this and solve it for let’s say a run time of 5 seconds By solve I mean determine which rungs are...
Replies
33
Views
8,977
The process consists of a parking garage with an entrance and an exit door. The garage has 25 parking spaces. We assume the garage is empty at the...
Replies
8
Views
3,108
Has to be implemented on CX Programmer Under PAHH conditions the logic solver closes the S-ESD inlet valve and keeps the S-ESD outlet valve open...
Replies
4
Views
2,372
Draw the print/ladder diagram of the following pneumatic limit switch circuit: double acting cylinder, 2 position, 4way, double solenoid valve...
Replies
17
Views
4,323
Hi, I'm new to PLC ladder diagrams and I'm stuck in a problem where I'm given a ladder diagram (please refer to the attached file "Problem"). I...
Replies
8
Views
7,481
Back
Top Bottom