Ladder logic

Ladder logic was originally a written method to document the design and construction of relay racks as used in manufacturing and process control.[1] Each device in the relay rack would be represented by a symbol on the ladder diagram with connections between those devices shown. In addition, other items external to the relay rack such as pumps, heaters, and so forth would also be shown on the ladder diagram.

Ladder logic has evolved into a programming language that represents a program by a graphical diagram based on the circuit diagrams of relay logic hardware. Ladder logic is used to develop software for programmable logic controllers (PLCs) used in industrial control applications. The name is based on the observation that programs in this language resemble ladders, with two vertical rails and a series of horizontal rungs between them. While ladder diagrams were once the only available notation for recording programmable controller programs, today other forms are standardized in IEC 61131-3 (For example, as an alternative to the graphical ladder logic form, there is also a more assembly language like format called Instruction list within the IEC 61131-3 standard.).

Overview

Ladder diagram
Part of a ladder diagram, including contacts and coils, compares, timers and monostable multivibrators

Ladder logic is widely used to program PLCs, where sequential control of a process or manufacturing operation is required. 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. Often the ladder logic program is used in conjunction with an HMI program operating on a computer workstation.

The motivation for representing sequential control logic in a ladder diagram was to allow factory engineers and technicians to develop software without additional training to learn a language such as FORTRAN or other general purpose computer language. Development and maintenance were simplified because of the resemblance to familiar relay hardware systems.[2] Implementations of ladder logic may have characteristics, such as sequential execution and support for control flow features, that make the analogy to hardware somewhat inaccurate.

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 continuous loop, or "scan". By executing the loop fast enough, typically many times per second, the effect of simultaneous and immediate execution is achieved. Proper use of programmable controllers requires an understanding of the limitations of the execution order of rungs.

Syntax & Examples

The language itself can be seen as a set of connections between logical checkers (contacts) and actuators (coils). If a path can be traced between the left side of the rung and the output, through asserted (true or "closed") contacts, the rung is true and the output coil storage bit is asserted (1) or true. If no path can be traced, then the output is false (0) and the "coil" by analogy to electromechanical relays is considered "de-energized". The analogy between logical propositions and relay contact status is due to Claude Shannon.

Ladder logic has contacts that make or break circuits to control coils. Each coil or contact corresponds to the status of a single bit in the programmable controller's memory. Unlike electromechanical relays, a ladder program can refer any number of times to the status of a single bit, equivalent to a relay with an indefinitely large number of contacts.

So-called "contacts" may refer to physical ("hard") inputs to the programmable controller from physical devices such as pushbuttons and limit switches via an integrated or external input module, or may represent the status of internal storage bits which may be generated elsewhere in the program.

Each rung of ladder language typically has one coil at the far right. Some manufacturers may allow more than one output coil on a rung.

  • Rung input : checkers (contacts)
    • —[ ]— Normally open contact, closed whenever its corresponding coil or an input which controls it is energized. (Open contact at rest)
    • —[\]— Normally closed ("not") contact, closed whenever its corresponding coil or an input which controls it is not energized. (Closed contact at rest)
  • Rung output: actuators (coils)
    • —( )— Normally inactive coil, energized whenever its rung is closed. (Inactive at rest)
    • —(\)— Normally active ("not") coil, energized whenever its rung is open. (Active at rest)

The "coil" (output of a rung) may represent a physical output which operates some device connected to the programmable controller, or may represent an internal storage bit for use elsewhere in the program.

A way to recall these is to imagine the checkers (contacts) as a push button input, and the actuators (coils) as a light bulb output. The presence of a slash within the checkers or actuators would indicate the default state of the device at rest.

Logical AND

 ------[ ]--------------[ ]----------------( )
   Key switch 1      Key switch 2       Door motor

The above realizes the function: Door motor = Key switch 1 AND Key switch 2

This circuit shows two key switches that security guards might use to activate an electric 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.

Logical AND with NOT

 ------[ ]--------------[\]----------------( )
   Close door      Obstruction         Door motor

The above realizes the function: Door motor = Close door AND NOT(Obstruction).

This circuit shows a push button that closes a door, and an obstruction detector that senses if something is in the way of the closing door. When the normally open push button contact closes and the normally closed obstruction detector is closed (no obstruction detected), electricity is able to flow to the motor which closes the door.

Logical OR

 --+-------[ ]-------+-----------------( )
   | Exterior unlock |                 Unlock
   |                 |
   +-------[ ]-------+
     Interior unlock

The above realizes the function: Unlock = Interior unlock OR Exterior unlock

This circuit shows the two things that can trigger a car's power door locks. The remote receiver is always powered. The unlock solenoid gets power when either set of contacts is closed.

Industrial STOP/START

In common industrial latching start/stop logic we have a "Start" button to turn on a motor contactor, and a "Stop" button to turn off the contactor.

When the "Start" button is pushed the input goes true, via the "Stop" button NC contact. When the "Run" input becomes true the seal-in "Run" NO contact in parallel with the "Start" NO contact will close maintaining the input logic true (latched or sealed-in). After the circuit is latched the "Stop" button may be pushed causing its NC contact to open and consequently the input to go false. The "Run" NO contact then opens and the circuit logic returns to its inactive state.

 --+----[ ]--+----[\]----( )
   |   Start |   Stop    Run
   |         |
   +----[ ]--+
        Run
 -------[ ]--------------( )
        Run             Motor

The above realizes the function: Run = (Start OR Run) AND (NOT Stop)

This latch configuration is a common idiom in ladder logic. It may also be referred to as "seal-in logic". The key to understanding the latch is in recognizing that the "Start" switch is a momentary switch (once the user releases the button, the switch is open again). As soon as the "Run" solenoid engages, it closes the "Run" NO contact, which latches the solenoid on. The "Start" switch opening up then has no effect.

Note: In this example, "Run" represents the status of a bit in the PLC, while "Motor" represents the actual output to the real-world relay that closes the motor's real-world circuit.

For safety reasons, an Emergency-Stop may be hardwired in series with the Start switch, and the relay logic should reflect this.

 --[\]----[\]----+--[ ]--+---------( )
   ES    Stop    | Start |        Run
                 |       |
                 +--[ ]--+
                    Run
 -------[ ]--------------( )
        Run             Motor

The above realizes the function: Run = (NOT Emergency Stop) AND (NOT Stop) AND (Start OR Run)

Complex logic

Here is an example of what two rungs in a ladder logic program might look like. In real world applications, there may be hundreds or thousands of rungs.

Typically, complex ladder logic is 'read' left to right and top to bottom. 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. ----[ ]---------+----[ ]-----+----( )
      Switch        |   HiTemp   |    A/C
                    |            |
                    +----[ ]-----+
                        Humid
 2. ----[ ]----[\]--------------------( )
        A/C    Heat                 Cooling

Line 1 realizes the function: A/C = Switch AND (HiTemp OR Humid)

Line 2 realizes the function: Cooling = A/C AND (NOT Heat)

This represents a slightly more complex system for rung 2. After the first line has been evaluated, the output coil "A/C" is fed into rung 2, which is then evaluated and the output coil "Cooling" could be fed into an output device "Compressor" or into rung 3 on the ladder. This system allows very complex logic designs to be broken down and evaluated.

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 many types of special blocks. They include timers, arithmetic operators and comparisons, table lookups, text processing, PID control, and filtering functions. More powerful PLCs can operate on a group of internal memory locations and execute an operation on a range of addresses, for example, to simulate a physical sequential drum controller or a finite state machine. 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.

Limitations and successor languages

Ladder notation is best suited to control problems where only binary variables are required and where interlocking and sequencing of binary is the primary control problem. Like all parallel programming languages, the sequential order of operations may be undefined or obscure; logic race conditions are possible which may produce unexpected results. Complex rungs are best broken into several simpler steps to avoid this problem. Some manufacturers avoid this problem by explicitly and completely defining the execution order of a rung, however programmers may still have problems fully grasping the resulting complex semantics.

Analog quantities and arithmetical operations are clumsy to express in ladder logic and each manufacturer has different ways of extending the notation for these problems. There is usually limited support for arrays and loops, often resulting in duplication of code to express cases which in other languages would call for use of indexed variables.

As microprocessors have become more powerful, notations such as sequential function charts and function block diagrams can replace ladder logic for some limited applications. Some newer PLCs may have all or part of the programming carried out in a dialect that resembles BASIC, C, or other programming language with bindings appropriate for a real-time application environment.

See also

References

  1. ^ http://ecmweb.com/archive/basics-ladder-logic "Ladder logic uses switch or relay contacts to implement Boolean expressions. In years past, ladder logic was made possible with discrete relays and was sometimes termed “relay logic."
  2. ^ Edward W. Kamen Industrial Controls and Manufacturing, (Academic Press, 1999) ISBN 0123948509, Chapter 8 Ladder Logic Diagrams and PLC Implementations

Further reading

External links

1-bit architecture

A 1-bit computer architecture is an instruction set architecture for a processor that has datapath widths and data register widths of 1 bit (1/8 octet) wide.

An example of a 1-bit computer built from discrete logic SSI chips were the Wang 700 (1968/1970) and Wang 500 (1970/1971) calculator as well as the Wang 1200 (1971/1972) word processor series of Wang Laboratories.

An example of a 1-bit architecture that was marketed as a CPU is the Motorola MC14500B Industrial Control Unit (ICU), introduced in 1977 and manufactured at least up into the mid 1990s. One of the computers known to be based on this CPU was the WDR 1-bit computer. A typical sequence of instructions from a program for a 1-bit architecture might be:

load digital input 1 into a 1-bit register;

OR the value in the 1-bit register with input 2, leaving the result in the register;

write the value in the 1-bit register to output 1.This architecture was considered superior for programs making decisions rather than performing arithmetic computations, for ladder logic as well as for serial data processing.There are also several design studies for 1-bit architectures in academia, and corresponding 1-bit logic can also be found in programming.

Other examples of 1-bit architectures are programmable logic controllers (PLCs), programmed in instruction list (IL).

Several early massively parallel computers used 1-bit architectures for the processors as well. Examples include the Goodyear MPP and the Connection Machine. By using a 1-bit architecture for the individual processors a very large array (e.g.: the Connection Machine had 65,536 processors) could be constructed with the chip technology available at the time. In this case the slow computation of a 1-bit processor was traded off against the large number of processors.

1-bit CPUs can meanwhile be considered obsolete, not many kinds have been produced and none are known to be available in the major computer component stores (as of 2019, a few MC14500B chips are still available from brokers for obsolete parts.).

Control system

A control system manages, commands, directs, or regulates the behavior of other devices or systems using control loops. It can range from a single home heating controller using a thermostat controlling a domestic boiler to large Industrial control systems which are used for controlling processes or machines.

For continuously modulated control, a feedback controller is used to automatically control a process or operation. The control system compares the value or status of the process variable (PV) being controlled with the desired value or setpoint (SP), and applies the difference as a control signal to bring the process variable output of the plant to the same value as the setpoint.

For sequential and combinational logic, software logic, such as in a programmable logic controller, is used.

Double Trouble (FIRST)

Double Trouble was the 1999 game for the FIRST Robotics Competition, and the first game to feature alliances.

Emulation for Logic Validation

Emulation for Logic Validation also referred to as virtual commissioning. This process involves replicating the behavior of one or more pieces of hardware with a software environment (typically for a system under design). The goal of the emulation engineer is to create an environment that mimics the real automation hardware. The ultimate goal of emulation is to provide an environment for the manufacturing automation controls engineer to validate their PLC (Programmable Logic Controller) ladder logic and HMI (Human-Machine Interface) files prior to system debug in the plant environment therefore improving quality and enabling a seamless transition from the virtual to physical environment. Another benefit is to deliver plant maintenance operators and machine conductors with realistic virtual environments for training themselves in safe and optimum conditions.

Function block diagram

The Function Block Diagram (FBD) is a graphical language for programmable logic controller design, that can describe the function between input variables and output variables. A function is described as a set of elementary blocks. Input and output variables are connected to blocks by connection lines.

Inputs and outputs of the blocks are wired together with connection lines, or links. Single lines may be used to connect two logical points of the diagram:

An input variable and an input of a block

An output of a block and an input of another block

An output of a block and an output variableThe connection is oriented, meaning that the line carries associated data from the left end to the right end. The left and right ends of the connection line must be of the same type.

Multiple right connection, also called divergence can be used to broadcast information from its left end to each of its right ends. All ends of the connection must be of the same type.

Function Block Diagram is one of five languages for logic or control configuration supported by standard IEC 61131-3 for a control system such as a Programmable Logic Controller (PLC) or a Distributed Control System (DCS). The other supported languages are ladder logic, sequential function chart, structured text, and instruction list.

HVAC control system

HVAC (Heating, Ventilation and Air Conditioning) equipment needs a control system to regulate the operation of a heating and/or air conditioning system. Usually a sensing device is used to compare the actual state (e.g. temperature) with a target state. Then the control system draws a conclusion what action has to be taken (e.g. start the blower).

Ladder diagram

Ladder diagram may refer to:

Message Sequence Chart, in Unified Modeling Language (UML)

Ladder logic, a method of drawing electrical logic schematics. A ladder diagram represents a program in ladder logic.

A method of juggling notation

Ladder scheme

Ladder scheme may refer to:

Relay Ladder Logic, a ladder logic flow chart

Matrix scheme, a controversial (and in some places illegal) business model

Modbus

Modbus is a serial communications protocol originally published by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs). Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices. The main reasons for the use of Modbus in the industrial environment are:

developed with industrial applications in mind,

openly published and royalty-free,

easy to deploy and maintain,

moves raw bits or words without placing many restrictions on vendors.Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from industry usage of Ladder logic and its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.

The development and update of Modbus protocols has been managed by the Modbus Organization since April 2004, when Schneider Electric transferred rights to that organization. The Modbus Organization is an association of users and suppliers of Modbus-compliant devices that advocates for the continued use of the technology.

Motorola MC14500B

The MC14500B Industrial Control Unit (ICU) is a CMOS one-bit microprocessor designed by Motorola for simple control applications in 1977. It is well-suited to the implementation of ladder logic, and thus could be used to replace relay systems and programmable logic controllers, also intended for serial data manipulation. The processor supports 16 commands, operating at a frequency of 1 MHz. The MC14500B unit does not include a program counter (PC); instead, a clock signal drives a separate PC chip; therefore the size of supported memory is dependent on the implementation of that chip. It was still in production in 1995.The ICU was conceived by Vern Gregory in the mid-1970s while working as an engineer in a Marketing / Applications group of Motorola Semiconductor Products Sector in Phoenix, AZ; Brian Dellande originated circuit and sub-routine designs, and co-wrote the Manual; Ray DiSilvestro was the bench technician; Terry Malarkey provided management support.

In the CMOS Logic Division in Austin, TX (where it was made) Phil Smith was the chip designer; Mike Hadley provided Product Applications support.

The ICU was a steady seller for 20+ years. As of 2019, at least this 1-bit architecture chip is still available on the aftermarket (on eBay).

A form of the design served as an embedded controller in a custom automotive chip made for NipponDenso by Motorola—Japan.

One of the computers known to be based on this processor is the educational WDR 1-bit computer (512 bits of RAM, LED, I/O, keyboard).The ICU architecture is similar to that of the DEC PDP-14 computer.

Opto 22

Opto 22 is a manufacturing company specializing in hardware and software products for industrial automation, remote monitoring, and data acquisition. The company is based in Southern California and sells solid state relays and Ethernet-based input/output systems and controllers. It is based in Temecula, California.

PLCopen

PLCopen is an independent organisation providing efficiency in industrial automation based on the needs of users. PLCopen members have concentrated on technical specifications around IEC 61131-3, creating specifications and implementations in order to reduce cost in industrial engineering. The outcome for example is standardized libraries for different application fields, harmonized language conformity levels and engineering interfaces for exchange. Experts of the PLCopen members are organized in technical committees and together with end users define such open standards.

PLCopen was founded in 1992 just after the world wide programming standard IEC 61131-3 was published. The controls market at that time was a very heterogeneous market with different types of programming methods for many different PLCs. The IEC 61131-3 is a standard defining the programming languages for PLCs, embedded controls, and industrial PCs, harmonizing applications independent from specific dialects, but still based on known methods such as the textual programming languages Instruction List, and Structured Text, the graphical programming languages Function Block Diagram and Ladder Diagram (a.k.a. Ladder logic), and the structuring tool Sequential Function Chart.

Today, IEC 61131-3 is a highly accepted programming standard and many industrial software and hardware companies offer products based on this standard, which in the end are used in many different machinery and other application fields.

Current topics are:

Motion control and

Safety functionality

XML data exchange format standardizing the base data of IEC projects in software systems, as used for instance by AutomationML

Benchmarking projects in order to have a good sophisticated benchmark standard.

And in the field of communication PLCopen has developed together with OPC Foundation the mapping of the IEC 61131-3 software model to the OPC Unified Architecture information model.

Programmable logic controller

A programmable logic controller (PLC) or programmable controller is an industrial digital computer which has been ruggedized and adapted for the control of manufacturing processes, such as assembly lines, or robotic devices, or any activity that requires high reliability control and ease of programming and process fault diagnosis.

PLCs were first developed in the automobile manufacturing industry to provide flexible, ruggedized and easily programmable controllers to replace hard-wired relays, timers and sequencers. Since then, they have been widely adopted as high-reliability automation controllers suitable for harsh environments. A PLC is an example of a "hard" real-time system since output results must be produced in response to input conditions within a limited time, otherwise unintended operation will result.

RLL

RLL may refer to:

Run Length Limited, an encoding scheme for disk drives

Relay Ladder Logic, a programming language for industrial control

Radio Local Loop, same as Wireless Local Loop (WLL)

Rahal Letterman Lanigan Racing, an auto racing team in the WeatherTech SportsCar Championship

right lower lobe, see List of medical abbreviations: R

Relay logic

Relay logic is a method of implementing combinational logic in electrical control circuits by using several electrical relays wired in a particular configuration.

Show control

Show control is the use of automation technology to link together and operate multiple entertainment control systems in a coordinated manner. It is distinguished from an entertainment control system, which is specific to a single theatrical department, system or effect, one which coordinates elements within a single entertainment discipline such as lighting, sound, video, rigging or pyrotechnics. A typical entertainment control system would be lighting control. An example of show control would be linking a video segment with a number of lighting cues, or having a sound track trigger animatronic movements -- or all of these combined. Shows with or without live actors can almost invariably incorporate entertainment control technology and usually benefit from show control to operate these subsystems independently, simultaneously, or in rapid succession.

Simulation software

Simulation software is based on the process of modeling a real phenomenon with a set of mathematical formulas. It is, essentially, a program that allows the user to observe an operation through simulation without actually performing that operation. Simulation software is used widely to design equipment so that the final product will be as close to design specs as possible without expensive in process modification. Simulation software with real-time response is often used in gaming, but it also has important industrial applications. When the penalty for improper operation is costly, such as airplane pilots, nuclear power plant operators, or chemical plant operators, a mock up of the actual control panel is connected to a real-time simulation of the physical response, giving valuable training experience without fear of a disastrous outcome.

Advanced computer programs can simulate power system behavior , weather conditions, electronic circuits, chemical reactions, mechatronics , heat pumps, feedback control systems, atomic reactions, even complex biological processes. In theory, any phenomena that can be reduced to mathematical data and equations can be simulated on a computer. Simulation can be difficult because most natural phenomena are subject to an almost infinite number of influences. One of the tricks to developing useful simulations is to determine which are the most important factors that affect the goals of the simulation.

In addition to imitating processes to see how they behave under different conditions, simulations are also used to test new theories. After creating a theory of causal relationships, the theorist can codify the relationships in the form of a computer program. If the program then behaves in the same way as the real process, there is a good chance that the proposed relationships are correct.

Toroid Terror

Toroid Terror was the 1997 game for the FIRST Robotics Competition. This was the first year that FRC had a regional event outside its origins in New Hampshire; in addition to Manchester, regionals were held in Chicago and New Brunswick, New Jersey, as well as the championship event at a complex set up in the Epcot parking lot. It was also the first year in which the scoring object was not a ball.

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.