Ladder Logic Question

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
Hello,

I am a little on the new side when it comes to ladder logic, so I am seeking a little help.

I am using a DL-06 PLC with Directsoft32 software. I wrote a very basic program that basically says when X-x is turned on, start a timer and if X-x1 hasn't been triggered within a certain amount of seconds to turn my machine off.

The X inputs represent sensors and the problem I am running into is there is some space between each sensor. So if a jam occurs of what is running through this machine but the item is past my first X input and it is no longer activated, the timer will have reset since in my logic X-x isnt on.

Is there a way I can perform my task other than using what I am using now, it looks something like this:

------|X3|---------|/|X4---------------------------------------------TMR 1 K30


------|T1|-------------------------------------------------------------(RST Y1)

With X4 being inside the lines.

Thank you for the help.
 

MaxHeadRoom

Joined Jul 18, 2013
28,681
I am not familiart with that particular PLC but what is X-x, you need to specify the actual input, not just -x?
I assume using the RST, Y1 is some latch has been set by SET command?
Max.
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
X being the input, x being the number. For instance I am using X3, X4, X5, and X6.

Yes earlier in the logic I have |C100|--------------------------------------------------(OUT Y1)
 

MaxHeadRoom

Joined Jul 18, 2013
28,681
I did find something, and it shows that the RST works in conjunction with a SET inst. This may not work with a regular OUT inst? A normal output is set off by its own rung usually, at least in the PLC's I have used.
Max.
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
I can get the logic to do what I want when I keep X3 triggered, which after the 3 seconds it doesnt see X4 my machine turns off and triggers another screen on my touchscreen which gives me the option to reset (different rung). Unfortunately though I need to time the seconds between X3 and X4 and if it goes past a certain time, in my case three seconds, my machine will turn off.
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
Im sorry as I said I am a little new to this. I have been working with our programs for about 1 and half years now, but they have already been written, this is the first crack at developing my own.

The machines I build open mail, they are meant to handle about 4000 envelopes per hour. The machine is driven by multiple motors, 8 emitters and receivers, 4 solenoids, 6 solid state relays, and a whole bunch of mechanical assemblies.

What I am tying into is the sensors, which are 5 VDC. I developed a small PC board to take my 5VDC sensors and have them output 12VDC as my PLC accepts a 12-24 volt input.

Right now the machine will stay running forever unless someone physically flips the toggle switch to turn the machine off.

The hardware I am using is:

http://www.automationdirect.com/adc...andable_Micro_Brick_PLC)/PLC_Units/D0-06DD2-D

http://www.automationdirect.com/adc...eries/C-more_EA7_Series_Touch_Panels/EA7-T6CL

The ladder logic software is Directsoft 32 and the touchscreen software is C-More version 2.60.

I have already taken care of the touchscreen program, now I am working on the ladder.

The very first rung of my logic is when I touch my machine on button on my screen the machine turns on.
Second rung is if there is no activity on the machine within 30 seconds the machine will automatically turn off.

These two rungs work just fine.

Now I am trying to have this type of scenario,

If an envelope passes sensor one, and doesnt reach sensor two within 3 seconds the machine will shut off and my touchscreen will switch screen with text stating clear jam at sensor one. The problem we have with out machines now is some of our clients wont turn the machine off to clear a jam and they will just rip the envelope out sometimes causing mechanical errors on the machine.

I can get my PLC to see the input when an envelope passes all of the sensors, but the problem I am running into is if the jam occurs after it blocks a sensor, for instance in between sensor 1 and sensor 2, the input on the PLC is not triggered so my timer is not accruing, therefore it cannot expire and shut my machine off.

I hope I did a better job at explaining what I am trying to accomplish.

Any additional help on this would be greatly appreciated.

Thank You
 

strantor

Joined Oct 3, 2010
6,787
You promped me to dust off the Automation Direct software and boy do I feel like a fish out of water. I haven't used AD in a couple of years; only Omron and Allen Bradley lately. I'm not 100% confident I've done this properly by automation direct, but here's the general idea anyway:
dl06.png
explanation:
1. x0 contact is to SET C0.
2. Once Co is set, it starts Timer T0 (0.1S timer, "K=constant", preset=30 (30*0.1=3sec)) (the timer automatically resets to zero when C0 goes low)
3. as soon as x1 goes high, it resets C0. So as long as that happens before 3 seconds, all is well.
4. if x1 doesn't go high to reset C0 to reset the timer before 3 sec, and the timer times out, you get C1. You can use C1 however you like; to trigger an alarm in the HMI, to shut down the machine, to sound an alarm and light, whatever.
 

strantor

Joined Oct 3, 2010
6,787
No problem. Note however that this can be fooled by a jam occurring directly in front of sensor #2, if this causes a traffic jam which backs up and blocks sensor #1 also. Both sensor inputs will go high and stay high, and the logic will consider this a "good" condition and not throw an alarm. In that scenario, sensor 1 and sensor2 would only be bailed out by sensor #3, if the same logic were used between sensor #2 and #3. But then if a jam occurred directly in front of sensor #3, ... you see where this is going? You just shuffle the problem on down to the end of the line, and then what?

Is there a gap between the envelopes? Does a good sensor output from a well-running line look like a square wave as envelopes pass the sensor? If so, a more fool-proof method would be to use that pulse train to evaluate whether or not the envelopes are actually MOVING past each sensor
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
Yes there is space in between each sensor. I see what you are talking about.

I was thinking I could have a condition that if sensor one is blocked but sensor 2 is not then don't set off the timer.

There are times when thea chine could be full due to someone doing something at the end of the line.
 

strantor

Joined Oct 3, 2010
6,787
No I'm asking if there is a gap between the envelopes; I already know there is a gap between the sensors. Say you hook up an oscope to the output of sensor #3 when the line is empty; get ready, here come the envelopes, we are about to see the output of sensor #3 on the scope, and bam, there go the envelopes past sensor #3 - what do we see on the scope? a square wave (each upward pulse corresponding to an individual envelope) or a constant ON digital high output?
 

strantor

Joined Oct 3, 2010
6,787
Pictures to illustrate my query:
Are the envelopes nut-to-butt like these bottles?

(the sensor in the pic would output a constant high signal as the bottles parade past it)

Or are they spaced out like these cans:

(the sensor in the pic would output a square wave as cans parade past it)
 

MaxHeadRoom

Joined Jul 18, 2013
28,681
As I mentioned I have not used the A.D. PLC but it did not seem right to me that a RST was used without a accompanying SET command or used on normal output.
Does the A.D. have a monitor function? As this is invaluable for trouble shooting and cuts the time down immensely, especially if you have a PLC at your home/shop to save debugging on site.
Max.
 

strantor

Joined Oct 3, 2010
6,787
As I mentioned I have not used the A.D. PLC but it did not seem right to me that a RST was used without a accompanying SET command or used on normal output.
In my programs you might find RST commands with no accompanying SET, when a bit is set by the HMI or when a WORD has been written and I only want to reset one bit of it. But in OP's case, unless there was a typo, did mention using a RST with an OUT. I don't know how this is handled with AD, but with Omron it effectively holds the bit low as long as it comes after the OUT command. Same as using a NOT coil. See comparison below, both bits 1.00 and 1.01 are held low, despite being energized higher up in the ladder. Note that this is not good form, even if it works. It gives warnings in compile but still works. Not advisable though.
omron.png
Does the A.D. have a monitor function? As this is invaluable for trouble shooting and cuts the time down immensely, especially if you have a PLC at your home/shop to save debugging on site.
Max.
I don't remember; it's been too long. I do not see any evidence of a monitor function in the menus, but it may be something that only appears when you are online with a PLC. Also I cannot find any simulate feature. Remember I am very rusty with this software, but it is not top shelf stuff and would not be surprised if it really doesn't have monitor or simulate.

EDIT: also forgot to mention, I simulated using a SET command with a physical output in Omron and it worked, and compiled with no errors. I suspect it would also work in real life, but I agree that, even if it does work, it should not be done, and bits should be switched within a rung.
 

MaxHeadRoom

Joined Jul 18, 2013
28,681
I agree, it is usually bad form to use an output in two particular places, although it will often compile, most PLC's throw up an alarm or at least a warning.
Max.
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
Pictures to illustrate my query:
Are the envelopes nut-to-butt like these bottles?

(the sensor in the pic would output a constant high signal as the bottles parade past it)

Or are they spaced out like these cans:

(the sensor in the pic would output a square wave as cans parade past it)


Yes there is a gap between envelopes. The logic on my existing board tells the envelopes to wait until the next sensor is clear.
 

strantor

Joined Oct 3, 2010
6,787
Yes there is a gap between envelopes. The logic on my existing board tells the envelopes to wait until the next sensor is clear.
I'm not sure what you mean in the section highlighted red, but assuming each of your PLC inputs goes high when an envelope is present, and low when an envelope is not present, this is how I would handle the jam detection:
dl062.png
Repeat the logic for each sensor.
This way each sensor is an island unto itself and requires no interaction with other sensors. each sensor simply checks to make sure the envelopes are MOVING past it. If they are moving, there is no jam. If a jam occurs and they stop moving, you will get an alarm whether the envelopes stop in a position blocking the sensor, or not blocking the sensor. If the operator needs to do something at the end of the line, he can push a "Line Pause" button which prohibits the alarm occurring.
 

Thread Starter

Stephen Hayden

Joined Dec 19, 2014
9
I'm not sure what you mean in the section highlighted red, but assuming each of your PLC inputs goes high when an envelope is present, and low when an envelope is not present, this is how I would handle the jam detection:
View attachment 77405
Repeat the logic for each sensor.
This way each sensor is an island unto itself and requires no interaction with other sensors. each sensor simply checks to make sure the envelopes are MOVING past it. If they are moving, there is no jam. If a jam occurs and they stop moving, you will get an alarm whether the envelopes stop in a position blocking the sensor, or not blocking the sensor. If the operator needs to do something at the end of the line, he can push a "Line Pause" button which prohibits the alarm occurring.

So this would accomplish if there is a jam in between sensor 1 and 2 and no sensor is being block3d, I would still get my jam triggered?
 
Top