newj

Tuesday 1 July 2014

Tutorial - LADDER LOGIC

PLCs are traditionally programmed in a notation known as Ladder Logic or Relay Ladder Logic. This notation is easy for technicians to read and understand. Remember that the first PLC’s were designed to replace large numbers of relays and they were designed to be easy for the electricians responsible for those systems to be able to analyze and troubleshoot.  You might want to note that a background and understanding of basic electrical circuits is helpful if you plan to program or work with PLC’s. 
An example of a simple motor start/stop circuit is shown below:



 Assume that A is the "start" button, B is the "stop" button and C is the output that tells the motor to run. Imagine power flowing through the ladder logic example. In this case when the operator presses the "Start" button (labeled A above) power flows through the contact labeled A. The [/] contact means "not on" or off. So assuming that the "stop" button (labeled B above) is not pressed then power flows through the B contact and powers the output labeled C and turns on the motor.

Note that we have another contact labeled C below the contact labeled A. This is called a "seal" circuit since contact C "seals" in contact A. Remember the power flow analogy. If it was only the top row: A, B, and C then every time the operator took their finger off the "start" button (contact A) then the motor would stop. But contact C is placed in parallel with contact A so that once the output C turns on then the input C is turned on in parallel with contact A. Therefore the only way to stop the motor is to press the "stop" button (contact B).

Relay ladder logic - RLL) is the basic PLC logic that converts inputs into outputs.  There are several other methods for writing PLC code.  Sequential Function Chart (SFC) is excellent for the programming sequential machines -- however most customers hate it.  Therefore we usually provide the same framework in RLL.   Structured text is another available programming language – much more like a standard high-level language.  Function blocks are also available now on many processors.  Seen used more in DCS (Distributed Control Systems – a completely new discussion), function blocks are somewhat like a “black box” in electronics.  They have a defined set of inputs to the block (don’t get them confused with the PLC inputs) and a defined set of outputs (ditto).  The block performs a manipulation of the inputs to elicit appropriate outputs.  This can greatly enhance the computational ability of the PLC and simplify some applications.  Once again – most clients want to stay in the RLL world.  The number 1 rule associated with PLC programming is “keep it simple.”  Most end users of PLC’s do not have PLC programmers on staff, or if they do many times those programmers are not the people that are called at 3 am at night when a machine is down.  Generally it’s somebody off the maintenance staff that gets pulled in to solve the problem.  The simpler the program – the more likely the problem is diagnosed and fixed quickly. 

There is an organization that is working to standardize the logic in all PLCs.  More information on this can be found at The PLCopen (IEC 1131-3)

No comments:

Post a Comment

Followers