Programming Application - Functional Alarms with Allen Bradley
At some point in your PLC career you probably have been exposed to writing alarms for a machine. There are several alarms that I normally include when I write logic for a machine from scratch. Some of those alarms might be "cycle time out" alarms, or "part not detected" alarms. I think the most important alarm to me is what I call the "functional" alarm.
When designing a machine's electrical package, typically I use a prox switch for each motion of an air cylinder. This would generally include an extended and a retracted PLC input from each cylinder that causes motion in either direction of the cylinder. A lot of times prox switches fail, or even during your normal machine cycle you could have part jam that would cause a prox switch not to be made or create a valid input condition. So in essence, I created a "functional" alarm.
Functional alarms defined by me are generally two conditions:
Neither prox switches extended or retracted is made while the machine is in a normal air on state.
Both prox switches extended and retracted are made while the machine is in a normal air on state.
Condition number one above is generally caused by four scenarios:
A prox switch failed.
A prox wire is cut.
A prox position has loosened and no longer can sense the direction of the cylinder.
During a normal cycle, a cylinder moved but could not complete the move because of a jam.
More often enough, scenario number three is the most common, but stops your machine if a prox switch has been moved to the wrong place and can no longer sense the direction of the cylinder. These kinds of problems can earn yourself a phone call at to come look at a machine if your maintenance guy can't figure out why the machine won't start.
Condition number two above is generally caused by two scenarios:
A bad prox switch that is stuck "ON".
A prox wire is cut and grounded "ON" (NPN) or shorted "ON" to positive voltage (PNP)
Any of the two scenarios above are not good because now you're not sure if the switch is made because of motion or if you have a true failure.
So generally to write a simple two rung alarm in Allen Bradley would look something like this:
If the machine AIR SWITCH is ok, indicating that the cylinder should be fired one way or another because air is on and theoretically the cylinder should be pushed to one end of the stroke or the other and not either prox switch nor both prox switches are on at the same time, you can then time these conditions with a timer. The timer should be just longer than the time it takes your cylinder to fire and change directions from one end of the stroke to the other. If the cylinder takes too long, then this alarm will set a bit which you can then send an alarm to your HMI to alert your operator or maintenance personal of the problem on your machine. Obviously if a prox switch has moved out of adjustment, you can direct your maintenance personal with an alarm to the exact prox switches or at least exact cylinder that caused the alarm. Hopefully then allowing you to sleep better at night knowing your staff can handle any easy prox adjustment problems. Just remember our motto, "The Program Never Fails".
Download a whole machine example with alarms here.
Nope, using a fill command unlatches all the latches to speedy up ladder logic. Chris Elston
I notice you turn on your alarm bits using an OTL. But nowhere do you unlatch the bit for those alarms. Instead you fill the B files with zeros on a reset. Wouldn't your OTLs still be latched? Patrick Allen
Answering Brian's Question
From my point of view, it doesn't matter what state the machine is in. If the air is ON and OK, then there should be an input ON from one switch or the other. Typically I write a cycle stop and I have a "tool return" or when an operator hits the "reset" button to home double air valves. But again, this code just checks the switches for failure. It doesn't matter if the machine is in motion, in cycle, tool returned or not. I simply want to know if I have a switch failure, and the air is ok, that I will get an alarm and not allow the machine to function anymore until the broken, mis-adjusted switch is repaired.
To see an example of my cycle stop code you can read about it at the below link and download a whole machine code that might help answer your question even further.
http://www.mrplc.com/kb/index.php?page=index_v2&id=38&c=12 Chris Elston
How would you isolate a cycle stop and an immediate stop with this format?
How would you initiate a tool return with this code? brian ahern