Inroduction To PLC: Programmable Logic Controllers (PLCS)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

Let start my way…

INRODUCTION TO PLC
Programmable Logic Controllers (PLCs) are small industrial computers
with modular components designed to automate customized control
processes. PLCs are often used in factories and industrial plants to
control motors, pumps, lights, fans, circuit breakers and other
machinery.

Industrial automation began long before PLCs. In the early to mid-1900s,


automation was usually done using complicated electromechanical relay
circuits. However, the number of relays, wires and space needed to create
even simple automation was problematic. Thousands of relays could be
necessary to automate a simple factory process! And if something in the
logical circuit needed to be changed? Oh boy!

NOTE: On a basic level, electromechanical relays function by magnetically


opening or closing their electrical contacts when the coil of the relay is
energized. They are very useful devices and still play a major role in industrial
automation (for a more in-depth lesson on electromechanical relays check out
this post).

In 1968 the first programmable logic controller came along to replace


complicated relay circuitry in industrial plants. The PLC was designed to be
easily programmable by plant engineers and technicians that were already
familiar with relay logic and control schematics. Since the beginning PLCs
have been programmable using ladder logic which was designed to mimic
control circuit schematics. The ladder diagrams look like control circuits
where power is flowing from left to right through closed contacts to
energize a relay coil.
Let start my way…

Ladder Logic Example

As you can see, ladder logic looks like simple control circuit schematics
where input sources like switches, push-buttons, proximity sensors, etc.
are shown on the left and output sources are shown on the right. The
ability to program complicated automated processes with an intuitive
interface like ladder logic made the transition from relay logic to PLCs
much simpler for many in the industry.2e

Although, the first PLCs were very limited in their memory and speed
capabilities, they quickly improved over the years. The presence of PLCs
helped simplify the design and implementation of industrial automation.
For more on the history of PLCs, see this great little article from
Automation Direct here.

How Do PLCs Work?

PLCs can be described as small industrial computers with modular


components designed to automate control processes. PLCs are the
controllers behind almost all modern industrial automation. There are
many components to a PLC, but most of them can be put in the following
three categories:

 Processor (CPU)

 Inputs

 Outputs
Let start my way…

PLCs are complex and powerful computers. But we can describe the
function of a PLC in simple terms. The PLC takes inputs, performs logic on
the inputs in the CPU and then turns on or off outputs based on that logic.
We will get into more detail later but for now, think of it like this:

1. The CPU monitors the status of the inputs (ex. switch on, proximity
sensor off, valve 40% open, etc.)

2. The CPU takes the information that it gets from the inputs, performs
logic on the inputs

3. The CPU operates the outputs logic (ex. turn off motor, open valve,
etc.)

See the flowchart below for a visual representation of the steps


above.

PLC Function Flowchart

Let’s use a familiar example to illustrate how PLCs work. Your dishwasher.
Many dishwashers have microprocessors that function similarly to PLCs.
The dishwasher has inputs, outputs and, of course, a CPU. Some of the
inputs into the dishwasher controller would be the buttons on the front,
the water sensors and the door switch. Some of the dishwasher outputs
would be the water valves, the heat elements and the pumps. Now let’s
think about how the dishwasher uses those different components.
Let start my way…

NOTE: Remember, the CPU is the processor in the dishwasher that is


programmed to make all the decisions we will see below. This is just like a
PLC processor (CPU) which makes logical decisions based on input status.

1. User pushes the cycle mode button (input detected)

2. User pushes the start button (input detected)

3. CPU verifies that the door is closed (input detected)

4. Fill valve opens and the dishwasher begins filling with water (output
activated)

5. CPU waits until proper water level is reached (input detected)

6. Fill valve closes, and water flow stops (output activated/de-activated)

7. Heating element is turned on (output activated)

8. CPU waits until proper water temperature is reached (input


detected)

9. Soap dispenser opens (output activated)

10. Water pump turns on to force water through sprayers (output


activated)

11. CPU begins timing depending on cycle type (logic timer


activated)

12. Water pump turns off (output deactivated)

13. Heating element is turned off (output deactivated)

14. Drain valve opens and the dishwasher begins draining the
dirty water (output activated)
Let start my way…

15. CPU waits until it detects the water level to be low enough
(input activated/de-activated)

16. Drain valve closes (output activated/deactivated)

17. Fill valve opens again to rinse dishes (output activated)

18. Water pump turns on to force water through sprayers (output


activated)

19. CPU begins timing (logic timer activated)

20. Water pump turns off (output deactivated)

21. Drain valve opens and the dishwasher begins draining rinse
water (output activated)

22. CPU waits until it detects the water level to be low enough
(input activated/de-activated)

23. Drain valve closes (output activated/deactivated)

24. Heating element turns on to heat the air inside the dishwasher
and dry the dishes (output activated)

25. CPU waits until proper interior temperature is reached (input


activated)

26. CPU begins timing (logic timer activated)

27. Heating element is turned off (output activated/deactivated)


Let start my way…

Discrete and Analog I/O

Inputs and outputs are often abbreviated with the term “I/O”. In the
dishwasher example above, we treated every input and output as a
discrete or digital signal. Discrete signals are signals that can only be on or
off. These are the simplest and most common type of I/O. In our example
we did not use any analog I/O. Although, there may be some use of analog
I/O within a dishwasher control system, I wanted to keep this example
simple. With analog signals, instead of only on/off or open/closed
possibilities, you may have 0 – 100%, 4 – 20mA, 0 – 100 degrees Celsius, or
whatever it is you measuring as an input or driving as an output.

We will cover this in more detail in part 3 of this series. PLC or PAC?
You may have heard of the Programmable Automation Controller (PAC).
The term was first coined by the market research firm ARC in 2001 to
differentiate the original PLCs from the newer, more powerful, more
flexible controllers that were entering the market. There is disagreement
about the definition differences between PAC and PLC, and often the
terms are used interchangeably in the industry. I often use the terms
interchangeably myself. This article, here, from Control Engineering may
help you understand the differences between PLCs and PACs. In my
opinion PACs are always the better choice unless the system is very
simple and minimizing cost of the project is vital. The modern user
Let start my way…

interface, extra power and memory of most PACs make them easily
superior to most PLCs.

Allen-Bradley, one of the current leaders in industrial automation, is


actually phasing out their PLC lines such as the PLC-5 and instead focusing
on their PAC lines such as ControlLogix and CompactLogix. Personally, I
think this is a great move. Among the many other benefits of the PAC, the
user-friendliness of Rockwell’s RS Logix 5000/Studio 5000 Logix
Designer (programming software for ControlLogix/CompactLogix PACs)
far surpasses the older RS Logix 5/500 software (programming software
for the PLC-5 and SLC500). Having experience with both PLCs and PACs is
important for everyone interested in working with industrial automation.
However, PACs are the future and where you will spend most of your time
as industrial automation engineer/technician.

What is a PLC Processor?


The CPU is the home for PLC logic, memory and communications.

Logic

The CPU is where the PLC program (often programmed with ladder logic) is
stored. This customized program is created by a developer to automate the
machine(s) used in the plant or process facility. In Part 1of the Beginner's Free PLC
Training series, in the dishwasher example, we looked at how the program logic
might look in a dishwasher CPU. The programmed logic detects various input
states and activates/deactivates various output actions.

The programmed logic in a PLC CPU is similar to our dishwasher example, but of
course depends upon the application. The PLC CPU logic can also be compared to
the brain in the way the brain takes input signals (sight, feel, smell, taste, sound)
and produces output actions (stepping, reaching, gripping, talking, etc.) based on
the brain's "programming".

Obviously, the analogy breaks down at some point because the logic or
"programming" in the human brain is not fixed and is constantly adapting to new
Let start my way…

experiences and teaching. We will look at PLC programming with Ladder Logic in
more detail in Part 4 of this series.

NOTE: Traditionally, PLCs have been programmed exclusively with Ladder Logic
(LD). Newer programmable automation controllers (PACs) also allow you to
program with other languages such as Structured Text (ST), Sequential Function
Chart (SFC), Function Block Diagram (FBD) and Instruction List (IL).

If you want to learn more about the five different programming languages that
have been standardized by the International Electrotechnical Commission (IEC)
according to IEC61131-3, check out an article from Bosch Rexroth here.

Memory

The processor memory is usually in the CPU and is where PLC data and programs
are stored temporarily or permanently. This is similar to the memory of a
computer (RAM or ROM). Again, we can compare this to the human brain which
stores data temporarily or permanently and enables us to achieve various tasks,
such as riding a bike, "from memory".

Communications

Every PLC processor handles some type of communication. The communications


done by the PLC CPU usually includes the one or more of the following:

 Communications through a serial or USB port on the CPU module to the


programmer’s computer
 Communications to the input and output (I/O) modules through the chassis
backplane
 Communications to other PLCs and other industrial automation devices
through Ethernet and other network types

Continuing with our human brain analogy, the above PLC communications can be
compared to communication from the "programmer" (God, experience, teachers,
etc.) to the brain, communication from the brain to various body parts (eyes,
nose, hands, legs, etc.) and communication between multiple human brains
(speaking with other people).

Let's use an example. Our brain's logic might look something like this:
Let start my way…

1. The brain receives input from the eyes that a box is on the floor and in the
way
2. The brain makes logical decisions as to why the box should be picked up
3. The brain tells the legs to bend, the arms to reach, the hands to grasp, etc.
to reach down and pick up the box and move it out of the way

Although the human brain is much more complex, powerful and adaptable than a
PLC, you can see the similarities between the PLC and the human control system.
Specifically, you should be able to see the correlation between the human brain
and the PLC brain; the CPU. Notice how PLCs can be programmed to work with
mechanical equipment to perform many tasks that would otherwise have to be
done manually by humans.

I/O overview
PLC I/O is the part of the PLC that connects the brain of the PLC, the CPU, to the
outside world, the machines. In a PLC system there will usually be dedicated
modules for inputs and dedicated modules for outputs.

An input module detects the status of input signals such as push-buttons,


switches, temperature sensors, etc. An output module controls devices such as
relays, motor starters, lights, etc.

Discrete I/O
The most common type of PLC I/O is discrete I/O. Sometimes discrete I/O is
referred to as digital I/O. The concept is simple, discrete I/O are signals that are
either on or off. Some examples of discrete input devices would be things like light
switches, push-buttons and proximity switches.

Examples of discrete output devices are lights, relays and motor starters. From our
dishwasher example in Part 1, some of the discrete inputs would the start button,
the door switch and the water level switch. Some of the discrete outputs would be
the water fill valve, the water drains valve and the heating element.

Some specific real-world examples of discrete inputs to a PLC would be open or


closed-circuit breakers, running or stopped generators, a conveyor belt position
sensor, or a water tank level sensor. Some specific applications of discrete outputs
Let start my way…

would be closing or opening circuit breakers, starting or stopping generators,


opening or closing water valves, turning on and off alarm lights, starting or stopping
of conveyor belts, etc.

Analog I/O
The other common form of PLC I/O is analog I/O. Analog I/O refers to signals that
have a range of values much greater than just 1 or 0. For instance, an analog signal
could produce a voltage anywhere in the range of 0 - 10 VDC. The signal could be 2
V, 3 V, 8.5 V, etc.

In the PLC world, analog input modules usually measure analog inputs in one of the
following forms: -10 to 10 VDC, 0 - 10 VDC, 1 to 5 VDC, 0 to 1 mA, or 4 - 20 mA.
Basically, the analog input module either measures voltage or current from the
input device.

There are other types of analog signals but these are definitely the most common.
Similarly, the analog output module can supply voltage or current signals in one of
the ranges I mentioned previously.

An analog signal that most of us are familiar with is the light dimmer. As you adjust
the dimmer knob or slider, the light will get either dimmer or brighter depending
on the direction of the adjustment. Similarly, an analog input into the PLC can
increase or decrease in very small increments and the PLC can produce an analog
output that acts the same way.

Some real-world examples of analog inputs in an industrial environment would


include engine temperature sensors (RTDs, thermocouples, etc.), oil pressure
sensors and weight scales. A temperature sensor might report a temperature range
of -50 to 150 degrees C corresponding to 4-20 mA. A weight scale might report a
range of 0 to 1000 lb. corresponding to 0 to 10V. And so on and so forth.

Analog outputs can be used to control the power output on a generator, the
position of a needle on an analog pressure meter, and much more. A 0-3 VDC
analog output might be used to drive a generator from 0 - 2000 kW or a 4-20 mA
analog output could be used to drive temperature gauge from -20 to 200 degrees F.
As you can see there are many possibilities for applications of analog inputs and
outputs!
Let start my way…

Industrial COMMUNICATIONS
Communications and the I/O data that can be transmitted or received to/from
other controllers and devices via industrial communication protocols.

There are many industrial communications protocols: Modbus, DNP, BACnet,


ControlNet, Ethernet/IP and many more.

Modbus is a master-slave type protocol where one device is the master and all
other devices on the Modbus network are slaves. The Modbus master can read
from or write to the device depending on the capabilities of the slave device.

Industrial communications devices read and write analog or discrete values from
and to other PLCs/devices without the need for hardwiring every single input and
output point between the PLCs/devices.

PLC Ladder Logic


What is Ladder Logic?
PLCs are used to automate industrial equipment using a graphical-based
programming language called Ladder Logic.

Ladder Logic Instructions


A) Relay-Type Instructions

The three most commonly used relay instructions in Rockwell PLC Ladder Logic are
the XIC (examine if closed), XIO (examine if open) and OTE (output energized)
instructions. The XIC, XIO and OTE can be compared to a normally-open contact,
normally-closed contact and relay coil respectively.

Let's look at how these instructions might be used in a basic "seal-in" or "latch-in"
circuit. The green bars indicate that portion of the circuit is "energized".
Let start my way…

As you can see, the 'Motor start' coil (OTE) is energized through the N.O. 'Motor
start' contact (XIC) and the N.O. 'Stop Button' contact (XIC).

Stop Buttons are usually wired to the PLC input such that if the PLC input or button
fails the input will fail open. This is for safety reasons, so that if the input fails the
motor doesn't run forever and will immediately stop. Start buttons are usually
wired the opposite.

So, to clarify, the Stop Button physical contact wired to the PLC input would be a
N.C. contact that turns off the PLC input when pressed whereas the physical
contact for the Start Button would be a N.O. contact that turns on the PLC input
when the button is pressed.

To de-energize the motor, the stop button must be pushed which will break the
seal between the N.O. 'Motor start' contact and the 'Motor start' coil. To re-energize
the motor, the 'Start Button' would need to be pressed while the 'Stop Button' was
not being pressed. Energizing the 'Motor start' coil would cause the N.O. 'Motor
start' contact to close, thus sealing the circuit in, again.

Two other relay-type instructions I'll briefly mention are the Output Latch (OTL) and
the Output Unlatch (OTU) which work like a typical set/reset relay. Like their relay
counterparts, the OTL latches its bit when it's rung becomes true/active. The bit
latched by the OTL will stay active until an OTU instruction is activated once.

B) Timers and Counters


Probably the next-most-common instructions used in Ladder Logic are timers and
counters. These instructions do exactly as their names state...time...and count,
respectively.

The most common timer instruction is the Timer On Delay (TON). The TON begins
timing when its rung becomes true/active. It times up to the Preset value (set in
Let start my way…

milliseconds for RS Logix 5000), and then sets the Done bit (DN) which can be used
to trigger other parts of logic. Let's look at an example:

In the logic above we are building on the simple "seal-in" logic we already looked at.
In this case, the timer 'Motor_Run_Timer" will be enabled (EN will be set) and will
begin timing when the 'Motor_Start' output is on. The Preset is set for 300,000
milliseconds, which is 5 minutes.

After the 'Motor_Start' output has been on for 5 minutes, the


'Motor_Run_Timer.DN" will be set (turned on) opening the XIO, which will interrupt
the latched motor start rung. The 'Motor_Start' output will then turn off which
disables 'Motor_Run_Timer' (the EN and DN bits will turn off).

The most common type of counter used is the Count Up counter (CTU). Let's add
one to our logic and see how it works.
Let start my way…

In the logic above we have now added CTU instruction and named it
'Motor_Run_Counter'. We set the Preset value to 1000. That means that the
'Motor_Run_Counter' must be enabled 1000 times before the DN bit will be set.
Whenever the CTU is enabled the CU bit will be set.

The counter will only count when the rung goes from false to true. In our case that
means it will count up (add one to the Accum) every time the 'Motor_Start' output is
turned on. It is programmed to count 1000 motor starts and then to turn on the
'Maintenance Light' output. This could be used to alert the operator that motor
needed to be serviced.

Alright, so what happens after the motor has reached 1000 starts? In the logic
above the maintenance light would stay on forever. To allow the operator to turn
off the maintenance light once the maintenance has been completed, we will
provide a reset push button and we'll call it 'Maintenance_Reset_Button'. Let's see
what that looks like below.
Let start my way…

Now, when the maintenance light is on and the operator has completed the motor
maintenance, he can reset the 'Motor_Run_Counter' and turn off the 'Maintenance
Light' output by pushing the 'Maintenance_Reset_Button'. In the Ladder Logic the
'Motor_Run_Counter' accumulator will be reset to zero when the Reset (RES)
instruction is enabled. The maintenance light will now be off until the motor is
started another 1000 times.
Let start my way…

You might also like