Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ladder logic
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Syntax and examples== The language itself can be seen as a set of connections between logical checkers (contacts) and actuators (coils). When a path exists from the left side of the rung to the output through asserted (true or "closed") contacts, the rung is considered true, and the output coil storage bit is set to 1 or (true). If no such path exists, the output is false (0), and the "coil" by analogy to electromechanical [[relay]]s is considered "de-energized". This analogy between logical propositions and relay contact status was established by [[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 switch]]es 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){{bulleted list | <code>β[ ]β</code> Normally open contact, closed whenever its corresponding coil or an input which controls it is energized. (Open contact at rest.) | <code>β[\]β</code> 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){{bulleted list | <code>β( )β</code> Normally inactive coil, energized whenever its rung is closed. (Inactive at rest.) | <code>β(\)β</code> 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=== {| |<pre> -----[ ]-------------[ ]------------------( ) Key switch 1 Key switch 2 Door motor </pre> |} The above realizes the function: Door motor = Key switch 1 [[logical AND|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=== {| |<pre> ------[ ]--------------[\]----------------( ) Close door Obstruction Door motor </pre> |} The above realizes the function: Door motor = Close door [[logical AND|AND]] [[logical NOT|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=== {| |<pre> --+-------[ ]------------+-----------------( ) | Exterior unlock | Unlock | | +-------[ ]------------+ Interior unlock </pre> |} The above realizes the function: Unlock = Interior unlock [[logical OR|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. <!-- This diagram currently matches the description above. Please do NOT alter it unless you can provide a reliable reference that the diagram (and the description above) is wrong. If you change the NC Stop to NO, the arrangement doesn't work. See talk page. ---> {| |<pre> --+----[ ]--+----[\]----( ) | Start | Stop Run | | +----[ ]--+ Run </pre> <pre> -------[ ]--------------( ) Run Motor </pre> |} The above realizes the function: Run = (Start [[logical OR|OR]] Run) [[logical AND|AND]] ([[logical NOT|NOT]] Stop) This [[Latch (electronic)|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 [[programmable logic controller|PLC]], while "Motor" represents the actual output to the real-world [[relay]] that closes the motor's real-world [[electrical circuit|circuit]]. For safety reasons, an emergency stop ("ES") may be hardwired in series with the "Start" switch, and the relay logic should reflect this. {| |<pre> --[\]----[\]----+--[ ]--+---------( ) ES Stop | Start | Run | | +--[ ]--+ Run </pre> <pre> -------[ ]--------------( ) Run Motor </pre> The above realizes the function: Run = ([[logical NOT|NOT]] ES) [[logical AND|AND]] ([[logical NOT|NOT]] Stop) [[logical AND|AND]] (Start [[logical OR|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: {{ordered list | start = 1 | 1= Realising the function: A/C = Switch [[logical AND|AND]] (HiTemp [[logical OR|OR]] Humid). <pre> ----[ ]---------+----[ ]-----+----( ) Switch | HiTemp | A/C | | +----[ ]-----+ Humid </pre> | 2= Realising the function: Cooling = A/C [[logical AND|AND]] ([[logical NOT|NOT]] Heat). <pre> ----[ ]----[\]--------------------( ) A/C Heat Cooling </pre> }} 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. {| |<pre> +-------+ -----[ ]--------------------+ A +---- Remote unlock +-------+ Remote counter </pre> <pre> +-------+ -----[ ]--------------------+ B +---- Interior unlock +-------+ Interior counter </pre> <pre> +--------+ --------------------+ A + B +----------- | into C | +--------+ Adder </pre> |} 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 controller|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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)