Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Five Rung Logic 5

Status
Not open for further replies.

jmayes

Electrical
Feb 21, 2004
2
US
I have been programming PLC's for over three years now. Before I was always taught the KISS (Keep it Simple Stupid) method of including all the safeties and permissives on the output line. I have recently started at a new company, they have a standard of "Five Rung Logic", I was told it was a GM standard. What are the benefits to this structure? The logic seems cluttered and more confusing to me? Could someone explain why one would benefit from this?

Thanks!!


[3eyes]
 
Replies continue below

Recommended for you

5 rung logic is probably one of the best ways I have seen to standardize programming comprehension between programmers.
Everyone understands

Safety
Precondition
Command
Output
Motion complete

Or some variation of these terms. But always 5 terms.

It increases the total programming required in terms of the number of logic rungs but this increased complexity also makes the program easier for everyone to understand and debug.
You don't have "decode" someone else's logic or try to think like them. You don't just have to rely on "one" guy solely to understand the program. The program is layed out in blocks and subroutines that are easy to follow and and in this manner you are more able to understand how your control process works.
You get the idea.
 
So what does "5 rung logic" mean - is it maximum of 5 runs per subroutine ??
 
"5 rung" refers to the number of rungs in the "motion block".
1-Safety
2-Precondition
3-Command
4-Output
5-Motion complete

 
Sorry but I can't show an example of 5 rung logic here for obvious reasons.
Geez, I'm not even a programmer.
A "motion block" is group of commands that complete a particular motion or state on a machine.
For example, a set of clamps holds a part to be welded by a robot.
The 1st rung "safety" has all the machine interlocks or bits that will prevent the machine from operating during a fault of some sort. Say an e-stop is pressed or an operator's gate is opened while the machine is in cycle. The output from the safety rung interlocks and enables/disables the next rung "precondition". The safety rung contains all the bits related to the "safe" motion of the clamps. For example, the safety rung could contain safety limits or sensors that could detect if the clamp is in danger of collision or some other sort of hazard that could present itself because of the propertys of the machine. Say an overtravel limit for that particular clamping arrangement. The "safety output" will be set as long as safe conditions exist.
The 2nd rung "precondition" is interlocked by the "safety" rung and also contains all the bits needed to complete the "precondition" output. The bits are those that say the clamp "is open" and "part present" for example. This rung knows the clamps are ready to close. And so a "precondition output" is set and latched. The "precondition"is latched and is later "reset" by the "motion complete" output.
The 3rd rung "command" is interlocked by the "precondition output". This rung's output strictly "drives" the PLC output and energizes an air valve to close the clamps. This rung is basically a duplicate output of the "precondition". Showing the rung seperately however improves clarity when writing or debugging.
The final rung "motion complete" tells the motion block the clamps are closed and the movement has been performed. In this example I assuming the use of a 2 position detented spool valve for the air to the clamps - when the motion is complete and the electric air solenoid valve is deenergized the clamp will not drop the part because the valve is detented and pressure is maintained. The "motion complete" output from this motion block will simply be a "precondition" for the robot to come in and weld.
The "clamps open" is simply another motion block.

You may think this increases the actual programming but what it reallys does is allow you to cut and paste more readily.
For a motion block you allot a group of bits to it and those bits are unique to that group. The actual bit numbers are grouped and related to each output in the motion block so they are easy to cut/paste/edit into another motion block.
As well, "general safetys" are grouped in a seperate motion block and and their bits are used thru out the program in each "safety" rung of a motion block. Safetys that are grouped in other motion blocks but not in the "general safetys" tell a programmer about the motion or hazards of that particular motion block. We can "decode" more readily what someone else is thinking and thereby fix the problem.

It all comes down to cut and paste. All the programming looks the same.

 
Another thing this 5-rung logic does is allow a logical memory map for internal coils and registers.

Address numbering schemes are setup so that all software coils ending in:
xx01 are the safety outputs,
xx02 are the precondition
xx03 the command
xx04 the motion complete

That's just one way. Many others are used
 
Exactly Dogleg. I did most of my programming before Windows cut/paste capabilitys. I really would have appreciated then.
 
Skiier & Dogleg,

Thankyou - this has been an informative thread. Most of my ladder work is within a turbine DCS, rather than PLC. The concept you both describe seems very sound. It is a shame our turbine logic was written prior to the development of 5 rung logic - it would make parts of it much easier to follow.



-----------------------------------

Start each new day with a smile.

Get it over with.

 
Why not rewrite your program using some generic PLC? Develop the program in 5 rung logic using subroutines and motion blocks? You wouldn't have install the program in the machine until u know that it would work at least in a safe manner. You could teach yourself the logic and maybe even "lab test" the I/O with jumpers and switches and lights and such. Also study the requirements of wiring changes to your control system bearing in mind that some I/O devices may have to be changed to work with your new PLC.
One day your DCS system may become to hard to maintain and operate. Then you will be ready with a new PLC and a program.
If I was you I would study the DCS program and convert it to 5 rung logic. I would also assess the wiring and modify the drawings with CAD to suit your new PLC system.
Then I would source and price the material required and figure out a general cost for labour.
If you do this in your spare time and come up with a solid documented "package" you certainly will look great when it's time to change your control system. Are you with me here? You see the high five? yes!!!!
 
Hi Skiier,

You couldn't begin to imagine how difficult it would be to sell that to the insurers and underwriters. The control system is validated by the turbine manufacturer for use with the engine, and the insurers accept that. This is a big machine, not a little aeroderivative - a huge capital investment which the financial guys have a right to protect.

The program runs to some 40,000 lines of ASCII code across two redundant processor pairs. There are some pretty specialised algorithms in there too, which would have to be built from the standard PLC blocks - not impossible, but time-consuming to build and validate.

'[blue]In my spare time[/blue]'? I have little enough as it is!






-----------------------------------

Start each new day with a smile.

Get it over with.

 
I have not heard of this "5 rung logic", but I use a similar concept, which is simple to follow, but is considerably more than 5 rungs.

The main idea is to standardise your logic for any given project. It is important to have a standard tags and memory allocation that is simple to interface with SCADA.

I have a standard block of code for a motor, each with its own subroutine, divided into the following sections.
1- Interlocks / permissives
Set a bit which is enabled when the motor is safe to run
2- I/O remap
Map all inputs (running, available, fault) and outputs (RUN) to your standard code memory.
3- Alarm and fault logic
Set alarm bits for TOL or failure to start etc.
4- Operation Logic
Set mode (Auto/Manual)
Stop Bit (Set by any stop conditions)
Run Bit (Set if NOT STOP, and any start conditions are true.

Start conditions are either manual start or stop from SCADA if in manual mode, or Auto Start and Stop from the program.

The simplicity of this, is that for the rest of the program, (Sequences or program logic) it only uses a start or stop command. It is not confused by interlocks, and alarms.

In effect, this is KISS, far simpler than jmayes method. The program logic becomes extremely simple, as you don't need to worry about your motor device logic in the sequence logic.

Although your Motor device logic is more complicated, as it is "standard", you only need to understand one, and all the rest are the same.

By standardising with this method, if you are using SCADA or not, makes no difference to your programming method. I think most good programmers use a similar method, however most programmers or hacks.
 
Sorry ScottyUK I don't know what a "DCS" is. Didn't realize it was such a dedicated specialized machine. Some people use the expression "turbine" pretty loosely so I didn't know what exactly was being referred to here.
 
Hi Skiier,


My fault for using abbreviations without expanding them - sorry for the confusion. 'Turbine' in this instance is a 250,000 Shaft HP machine running on natural gas. Quite big, even by today standards.

DCS - Distributed Control System:

DCS is the 'old' way of doing things, with the equivalent of many networked PLCs with some higher-level supervisory processing working above them, all sharing a common point database. Modern PLC's have closed the gap a lot on DCS's, although a high-end DCS is still ahead in outright performance terms. PLCs win hands down on performance/cost ratio.

DCS is probably most common in the power generation and petrochemicals markets, who can afford the extra capital expenditure in order to buy long term support and reliability.

Foxboro and Emerson are the two biggest players in DCS systems, with Yokogawa probably third. All good products. Yer pays yer money...





-----------------------------------

Start each new day with a smile.

Get it over with.

 
I have to write a program using five rung logic. Could you please provide me with some ladder examples? I am new to plc programming. Thanks a lot
 
Our logic standard calls for driving the output directly from logic. We received some jobs where the supplier, un-beknownst to us, used the 5 rung standard. We found the logic takles longer to debug, troubleshoot and it easier for the tool to 'get caught in its own underware' costing us downtime for even minor problems. I think the origination of this standard was when GM generated the logic automatically, that was a fiasco, it worked well if the job had no changes, yeah right. The other theory is the people that came up with the standard got paid by the bit.

I have over 30 years experience programming PLCs, across several platforms, AB, Square D, TI, Siemans and AutomationDirect.

I have worked at my current position for over 10 years. This company always used the simpler standard. You can go to any of our plants and the logic is the same. The logic is ROBUST and I mean robust, you can troubleshoot our tooling without going online. Simple to modify, ECs are a regular routine across a product lifespan.

Under the 'GM' standard I once did a small teststand (3) motions it took 875 rungs of ladder to program to the customer standard, some of the compleity was due to moving data, and math calculations, but it was still overkill for such a small job.

With respect to the 'Safety' rung I find most programmers tend to create a 'safety' for each motion and find most, and I mean most 'safety' rungs contain the IDENTICAL set of instructions. I find some also put 'precondition' logic in the safety rung as well.

As for 'Preconditions' thats not rocket science the previous step being complete is typically all thats required. The 'Command' simply drives the output, so why do I need the rung to the same job as the next rung.

Our standard requires each rung be created with 3 parallel branches, auto, manual and the seal. The auto branch contains 'Cycle On' and the previous motion complete, or in some cases we will drive several outputs from the same condition. The next branch has 'Manual mode' the PB for the respective motion, and if required the same interlock as auto. The last branch has the output address, the not of the opposite motion, and not manual. Outside of the branches we put light screens clear, we or around this with the motion complete, power on, and not retract. (retract goes true when the process is complete).

The light screen in logic only prevents the logic from going true if the motion is not complete the light screen interrupts power.

All in all there is no benefit, you are right the logic is far more cluttered. The KISS principle is a good one. But you have to go by your company standards.

You used to be able to argue this was an inefficent use of memory, memory is cheap and plentiful, but its still inefficent.

Well that's my 2 cents.

For those of you who love this standard I used to preach the same sermon.

 
Clarifications to my previous post.

The auto branch contains 'Cycle On' and the previous motion complete.

The exception here is the retract side of the logic, we drive the auto portion with 'Retract', and a 'Cycle on one shot' clears the advance seals.

My sermons were about the 5 rung standard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top