Plc
Plc
A Programmable Logic Controller, or PLC, is more or less a tiny computer with a built-in
operating system (OS).
This OS is highly specialized to handle incoming events in real time, i.e. at the time of their
occurrence. The PLC has input lines where sensors are connected to notify upon events (e.g.
temperature above/below a certain level, liquid level reached, etc.), and it has output lines to
signal any reaction to the incoming events (e.g. start an engine, open/close a valve, etc.) The
system is user programmable. It uses a language called "Relay Ladder" or "Relay Ladder Logic".
The name of this language implies the fact that the control logic of the earlier days, which was
built from relays, is being simulated.
What is a PLC?
A Programmable Logic Controller, or PLC, is more or less a tiny computer with a built-in
operating system (OS).
This OS is highly specialized to handle incoming events in real time, i.e. at the time of their
occurrence. The PLC has input lines where sensors are connected to notify upon events (e.g.
temperature above/below a certain level, liquid level reached, etc.), and it has output lines to
signal any reaction to the incoming events (e.g. start an engine, open/close a valve, etc.) The
system is user programmable. It uses a language called "Relay Ladder" or "Relay Ladder Logic".
The name of this language implies the fact that the control logic of the earlier days, which was
built from relays, is being simulated.
History of PLCs
When the first electronic machine controls were designed, they used relays to control the
machine logic (i.e. press "Start" to start the machine and press "Stop" to stop the machine). A
basic machine might need a wall covered in relays to control all of its functions. There are a few
limitations to this type of control.
Relays fail.
The delay when the relay turns on/off.
There is an entire wall of relays to design/wire/troubleshoot.
The PLC is a purpose-built machine control computer designed to read digital and analog inputs
from various sensors, execute a user defined logic program, and write the resulting digital and
analog output values to various output elements like hydraulic and pneumatic actuators,
indication lamps, solenoid coils etc.
[edit] Scan cycle
Exact details vary between manufacturers, but most PLCs follow a 'scan-cycle' format.
Overhead
Overhead includes testing I/O module integrity, verifying the user program logic hasn't changed,
that the computer itself hasn't locked up (via a watchdog timer), and any necessary
communications. Communications may include traffic over the PLC programmer port, remote
I/O racks, and other external devices such as HMIs (Human Machine Interfaces).
Input scan
A 'snapshot' of the digital and analog values present at the input cards is saved to an input
memory table.
Logic execution
The user program is scanned element by element, then rung by rung until the end of the
program, and resulting values written to an output memory table.
Output scan
Values from the resulting output memory table are written to the output modules.
Once the output scan is complete the process repeats itself until the PLC is powered down.
The time it takes to complete a scan cycle is, appropriately enough, the "scan cycle time", and
ranges from hundreds of milliseconds (on older PLCs, and/or PLCs with very complex
programs) to only a few milliseconds on newer PLCs, and/or PLCs executing short, simple code.
Be aware that specific nomenclature and operational details vary widely between PLC
manufacturers, and often implementation details evolve from generation to generation.
Often the hardest part, especially for a beginning PLC programmer, is practicing the mental ju-
jitsu necessary to keep the nomenclature straight from manufacturer to manufacturer.
Negative Logic
True = logic 0 = input NOT energized
Normally Open
This instruction is true (logic 1) when the hardware input (or internal relay equivalent) is
energized.
Normally Closed
This instruction is true (logic 1) when the hardware input (or internal relay equivalent) is NOT
energized.
Output Enable
On Timer
Generally, ON timers begin timing when the input (enable) line goes true, and reset if the enable
line goes false before setpoint has been reached. If enabled until setpoint is reached then the
timer output goes true, and stays true until the input (enable) line goes false.
Off Timer
Generally, OFF timers begin timing on a true-to-false transition, and continue timing as long as
the preceding logic remains false. When the accumulated time equals setpoint the TOF output
goes on, and stays on until the rung goes true.
Retentive Timer
This type of timer does NOT reset the accumulated time when the input condition goes false.
Rather, it keeps the last accumulated time in memory, and (if/when the input goes true again)
continues timing from that point. In the Allen-Bradley construction this instruction goes true
once setpoint (preset) time has been reached, and stays true until a RES (RESet) instruction is
made true to clear it.
Latching Relays
Generally, the unlatch operator takes precedence. That is, if the unlatch instruction is true then
the relay output is false even though the latch instruction may also be true. In Allen-Bradley
ladder logic (and others) latch and unlatch relays are separate operators.
However, other ladder dialects opt for a single operator modeled after RS (Reset-Set) flip-flop
integrated circuit chip logic.
Jump to Subroutine
For jumping from one rung to another the JSR (Jump to Subroutine) command is used.
LADDER LOGIC
Ladder logic is a programming language that represents a program by a graphical diagram based
on the circuit diagrams of relay-based logic hardware. It is primarily 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.
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.
--[ ]-- A regular contact, closed whenever its corresponding coil is energized
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.
[edit] Examples
Here is an example of what one rung in a ladder logic program might look like. In real life, there
may be hundreds or thousands of rungs.
For example:
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.
This system allows very complex logic designs to be broken down and evaluated.
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. This is a logical AND.
+-------+
----------------------------+ +----
+-------+
Remote Receiver
--|-------[ ]-------+-----------------( )
| Remote Unlock | Lock Solenoid
| |
|-------[ ]-------|
Interior Unlock
This circuit shows the two things that can trigger a car's power door locks. The remote receiver is
always powered. The lock solenoid gets power when either set of contacts is closed. This is a
logical OR.
Often we have a little green "start" button to turn on a motor, and we want to turn it off with a
big red "Stop" button. The stop button itself is wired as a normally closed switch, the PLC input
is read as normally open. When the stop button is pushed, the input will go false. Making the
rung false, stopping the "run" output.
-------[ ]--------------( )
run motor
This latch configuration is a common idiom in ladder logic. In ladder logic it is referred to as
seal-in logic.
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.
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. Since execution of
rungs is sequential within a program and may be undefined or obscure within a rung, some 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, e.g. Omron, 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. Very large
programmable controllers may have all or part of the programming carried out in a dialect that
resembles BASIC or C or other programming language with bindings appropriate for a real-time
application environment.
Applications of PLC:
Water Treatment & Waste Water Treatment Plants
Recovery Boiler & Boiler Combustion Control & Flame Safety Systems
Paper Machines & Wetlap Machines
Digesters and Pulpers
On Machine and Off Machine Coaters/Treaters
Batch Process Chemical Makeup Systems & Continuous Process Chemical Makeup
Systems
Evaporators
Distillation Columns
Plastics Presses and Conveying Systems
Reactors
Extruders and Spinning Lines
Bottling and Packaging Lines
Building Alarm and Access Control Systems
Hydro Power Generation Plants