Ladder logic

Ladder logic or the Ladder programming language is a method of drawing electrical logic schematics. It is now a graphical language very popular for programming programmable logic controllers. It was originally invented to describe logic made from relays. The name is based on the observation that programs in this language resemble ladders, with two vertical "rails" and a series of "rungs" between them.

A program in ladder logic, also called a ladder diagram, is similar to a schematic for a set of relay circuits. Ladder logic is useful because a wide variety of engineers and technicians can understand and use it without much training.

Ladder logic is widely used to program industrial Programmable logic controllers, where a series of complex logic checks are required before something is turned on. Ladder logic is useful for simple but critical control systems, or for reworking old hardwired relay circuits. As programmable logic controllers became more sophisticated it has also been used in very complex automation systems.

Most providers of programmable logic controllers also provide associated ladder logic programming systems. Typically, the ladder logic languages from two different providers will not be compatible; ladder logic is better thought of as a set of closely related programming languages rather than one language.

Ladder logic can be thought of as a rule-based language, rather than a procedural language. A "rung" in the ladder represents a rule. When implemented with relays and other electromechanical devices, the various rules "execute" simultaneously and immediately. When implemented in a programmable logic controller, the rules are typically executed sequentially by software, in a loop. By executing the loop fast enough, typically many times per second, the effect of simultaneous and immediate execution is obtained.

Example of a simple ladder logic program

The language itself can be seen as a set of connection between logical checkers (relay contacts) and actuators (coils).

Ladder logic has "contacts" that "make" or "break" "circuits" to control "coils."

There are two types of contacts:

--[ ]-- a relay normally open (N/O) contact. This contact turns on if the relay's coil is on.

--[\]-- a relay normally closed (N/C) contact. This contact turns off if the relay's coil is on.

These are switched by a circuit (or more archaically the "coil" of a relay). They in turn switch a circuit. In a ladder programmign language, the circuits are represented by a name or number.

The contacts represent electrical switches. They form logic that can be configured to produce any logical function such as AND, OR, XOR, NAND, NOR, INV.

Here is an example of what one rung in a ladder logic program might look like. In real life, there would typically be hundreds or thousands of rungs.

 ---[ ]-----[ ]---
     X       Y 

Represents X AND Y, because both X and Y must be on for the circuit to be on.


 ----|---[ ]---|------
     |    X    |
     |         |
     |---[ ]---|
          Y          

Represents X OR Y, because the circuit will be on if either X or Y are on.


 ----|---[\]---|------
     |    X    |
     |         |
     |---[\]---|
          Y          

Represents X NAND Y, because the circuit will turn off only if both X and Y are turned on.


Ladder logic is then used to drive output coils, so that when the preceding logical functions have been evaluated - the output coil changes state.


--( )-- an N/O output coil

--(\)-- an N/C output coil

For Example

 ----[ ]---------|--[ ]--|------( )--
      X          |   Y   |       S
                 |       |
                 |--[ ]--|
                     Z

Realises the function S= X.(Y+Z)

Complex ladder logic is 'read' in the same way as a western book (left to right). The first point on the left, is the input signal (or high potential), as each of the lines (or rungs) are evaluated the output coil of a rung may feed into the next stage of the ladder as an input. In a complex system there will be many "rungs" on a ladder, which are numbered in order of evaluation.


 1 ----| |-----------|-| |-----|----( )--
        X            |  Y      |     S
                     |         |
                     |---| |---|
                          Z
 2 ----| |----| |-------------------( )--
        S      X                     T 

T=X.S

This represents a slightly more complex system for rung 2. After the first line has been evaluated, the output coil (S) is fed into rung 2, which is then evaluated and the output coil T could be fed into an output device (buzzer, light etc..) or into rung 3 on the ladder.

This system allows very complex logic designs to be broken down and evaluated fairly easily.

For more practical examples see below (my creations released to wikipedia):

 |                                         |
 |                                         |
 |--][------------][-------------------O---|
    keysw1     keysw2           door motor

This circut shows the two key switches that security guards might use to activate motor on a bank vault door. When the normally open contacts of both switches close, electricity is able to flow to the motor which opens the door. This is a logical AND.

 |                                         |
 |                            +-------+    |
 |----------------------------+       +----|
 |                            +-------+    |  
 |                         Remote receiver |
 |-----][------------------------------O---|
 |   remote unlock   |       lock solenoid |
 |-----][------------+
     interior switch

This circuit shows the two things that can trigger the power door locks in my imaginary car. The remote receiver is always powered. The lock solenoid gets power when either set of contacts is closed. This is a logical OR.

Since electrical engineers already knew how to read ladder logic, PLC makers made their systems programmable in ladder logic. This would allow electrical engineers to read, debug, troubleshoot and write computer programs for the PLCs which replaced their cabinets full of relays.

Additional Functionality

Additional functionality can be added to a ladder logic implementation by the PLC manufacturer as a special block. When the special block is powered, it executes code on predetermined arguments. These arguments may be displayed within the special block.

 |                                         |
 |                            +-------+    |
 |-----][---------------------+  A    +----|
 | remote unlock              +-------+    |  
 |                         Remote counter  |
 |                                         |
 |                            +-------+    |
 |-----][---------------------+  B    +----|
 | interior unlock            +-------+    |  
 |                        Interior counter |
 |                                         |  
 |                    +--------+           |
 |--------------------+ A + B  +-----------|
                      + into C +             
                      +--------+             
                        Adder              

In this example, the system will count the number of times that the interior and remote unlock buttons are pressed. This information will be stored in memory locations A and B. Memory location C will hold the total number of times that the door has been unlocked electronically.

PLCs have been very sophisticated with many types of special blocks. They include timers, arithmetic operators and comparisons, table lookups, and filtering functions. In some cases, users can define their own special blocks, which effectively are subroutines or macros. The large library of special blocks along with high speed execution has allowed use of PLCs to implement very complex automation systems.

See also

is:Ladder (forritunarmál)

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools