Sei sulla pagina 1di 12

PLC Ladder Logic

PLC ladder logic is a graphical programming language. It was originally


designed to replace the use of wired “Relay Logic” circuits for machine
control. The ladder logic program is stored in an industrial microprocessor
called a PLC Programmable Logic Controller.

The actual PLC ladder logic programming code looks like a relay logic
electrical schematic drawing. There are various PLC programming languages
used in industrial automation, but the most popular is PLC ladder logic.

This type of program contains lines of graphical code called rungs, or


sometimes called networks.

In it’s most basic form the rungs of code contain one or more logic conditions
and an output.

Multiple rungs of code end up looking like a ladder….. Hence the name
“Ladder Logic”.

Industrial PLC shapes and sizes are varied and extensive.

The memory size, functionality, communication options, number of inputs and


output and expansion capability are all factors that determine the size of PLC.

Different industrial PLC manufacturers have many types of PLC and use
varying terminology for sizing of a PLC.

Some examples used to describe the various sizes are…

 Nano PLC
 Micro PLC
 Mini PLC
 Compact PLC
 Small PLC
 Brick PLC
 Medium PLC
 Large PLC
 Modular PLC
Another factor to consider when determine the size of the PLC required is the
complexity of your application. Determining the exact requirements of your
application will put you in good stead for selecting the right PLC.

It’s always a good idea to size your PLC a little bigger than is actually required
on paper because the application requirement may change during the design
and commissioning phases and it will also allow for potential future upgrades
or expansion.

Programmable Logic Controller – PLC


The popularity of a PLC to control machine processes in industrial
environments has skyrocketed and it seems like every man and his dog is
manufacturing a PLC as part of their electronics product suite. Some of the
more popular PLC manufacturers include Allen
Bradley, Siemens, Omron, Unitronics, Idec, Koyo and Mitsubishi.
As you would imagine with a large range of manufacturers, functionality and
sizes comes large cost variation. More and more low cost PLC’s come on to
the market every year but be careful. A cheap PLC comes with constraints in
memory, input/output, communication, expansion and flexibility.

The old saying “You pay for what you get” applies here.

So, before you buy PLC be sure to get the right one for your applications
present and future requirements.

PLC Hardware
The internal structure of a PLC (Programmable Logic Controller) is based on
the same principles of that used in standard computer architecture.

There is a Central Processing Unit (CPU), memory, a program and real world
inputs and outputs.

The data flow is controlled by the CPU and organized using memory and
input/output addressing.

How Does a PLC Work?


PLC’s have programmable internal memory in which the ladder logic program
and application data are stored.

They also have the facility to input external signals from devices such as
switches and sensors and output to external devices such as motors and
valves.

In simple terms a PLC is split into 4 main areas shown in the diagram below….
Programmable Logic Controller Block Diagram
Inputs are field devices such as button, switches and instrumentation which
are used to decide when and how the machine will operate. Inputs are wired
directly into to the PLC or via option cards.
Outputs are field devices such as relays, motor contactors, solenoid
valves, lamps and sirens which cause the machine to operate and provide
feedback to the machine operator. Outputs are wired directly out of the PLC or
via option cards.
Data Memory is where inputs and outputs are declared and allocated to
memory locations.
Program Memory is where the ladder logic is stored and processed.
The PLC process, in very basic terms, has been specifically designed to perform
3 main tasks….

 Evaluates the state of external input devices.


 Processes the pre-defined program.
 Activate external output devices based on the results of the pre-defined
program.
These tasks are strictly performed in that order in an endless cyclical manner.
The completion of one PLC task cycle is called a PLC scan.
The time it takes to complete a scan is called the PLC scan time and is
expressed in milliseconds (ms).
During a program scan the ladder logic rungs are processed from left to right
and top to bottom. The output result of each rung is executed at the very end
of the scan. These two concepts are very important to remember because they
can affect the way you write your program!

PLC Scan
In simple terms it means that the PLC monitors the status of the machine and
process. It then make decisions bases on the logical functions created by the
PLC ladder logic program that is stored in it’s memory. Lastly it initiate output
signals to control the behavior of the machine or process.

PLC Memory Structure


The PLC memory is just like that of a computer. It is made up of bits, bytes,
words and double words.
Bit – The smallest memory unit. It is either 1 (True) or 0 (Fasle).

Byte – Is made up of 8 bits.

Word – Is made up of 16 bits or 2 Bytes.

Double Word – Is made up of 32 bits, 4 Bytes or 2 Words.

Ladder Logic Programming Memory Structure


Defining Variables
Each symbol in the ladder diagram needs to be allocated to a variable name in
order for the microprocessor to successfully process the PLC ladder logic
rungs.

There are three essential elements and one optional element that must be
defined when declaring a variable….

 Variable Name – The name must be unique and is used to make the
ladder logic easily readable by human beings, such as yourself. There
will be restrictions on the length and sometimes characters that can be
used.
 Data Type – The data type used will depend on the symbol being used
and the programming operation required. Defining a variable as a BOOL
(boolean) means it has a binary value, an INT (integer) means it has a
whole number value and a REAL (floating point) means it has a number
value with a decimal point.
 Address – the address can be either an Input, Output, Internal or
System memory address. The address nomenclature is dependent on
the PLC manufacturer.
 Comment – Adding a comment is optional, but can assist in describing
the variable if the amount of characters in the variable name was
insufficient.
Allocating a variable name to each PLC ladder logic symbol allows the PLC
processor to identify each symbol as a unique individual with a name (variable
name), identity (data type) and place to live (memory address).

Defining variables is done by the PLC ladder logic programmer (that’s you).
Although some PLC programming software does address allocation
automatically.

The table below shows some standard data types, PLC memory allocation and
common uses for each data types….
Ladder Logic Data Types
Different PLC manufacturers use slightly different naming conventions for
variables and memory allocation. It’s just a matter of checking the PLC’s help
file to determine what to use.

Some examples of variable addressing nomenclature for different PLC


manufacturers is shown in the table below….

Ladder Logic Programming Data Table


PLC Inputs and Outputs Explained
PLC inputs and outputs are hard wired to the PLC controller itself and/or PLC
input output modules, depending on what type of PLC it is. The two most
common types of PLC inputs and outputs that are found in a PLC system are
digital and analogue inputs and outputs.
Digital inputs and outputs follow the binary concept and are wired normally
open (NO) or normally closed (NC). They are either ON or OFF. Limit switches,
push buttons, proximity sensors, temperature switches are some examples of
digital inputs. Motor start relays and solenoid valves are some examples of
digital outputs.

Analogue inputs and outputs are signals that are proportional in nature. The
most common types are 0-10V and 4-20mA. They measure or output a signal
that has a range of values. Temperature sensors, pressure sensors, strain
gauges and flow meters are some examples of analogue inputs. Motor speed
control and proportional solenoid valves are examples of analogue outputs.

PLC Control System


A PLC is basically considered to be the brains of the operation.

If we look at the human brain we realize it relies on our five senses of sight,
hearing, smell, taste and touch to understand what our environment is doing.

Also, the human brain controls movement in our body to create actions such
as walking, running and kicking a ball.

So let’s say we sense that our body is getting hot. Then we can roll our sleeves
up a little too cool down.

We can actually roll our sleeves up and down to regulate our body
temperature to what feels comfortable.

If we’ve rolled up our sleeves all the way and we are still too hot and we can’t
tolerate it any more then we can take our sweater off.
Brain Control System
So what would a PLC do?

Well, just like the human brain relies on information provided by our senses. A
PLC requires instrumentation to measure it’s surroundings.

And just like the human brain decides on what actions are required to be
taken and then controls movement in our body. A PLC uses the ladder logic
program stored in it’s microprocessor memory to decide what actions are
required to be taken and then controls movements in a machine by activating
electric, pneumatic and hydraulic devices.

So lets use a PLC to control the temperature of a system.

To accomplish this we will need a temperature sensor to measure the system


temperature and an electric fan to cool the system down if required.

We would connect these two pieces of equipment to the PLC . Then we would
write a PLC ladder logic program to activate the fan when the system
temperature exceeds a certain threshold. If the temperature measured
increases or decreases the PLC can adjust the speed of the fan to regulate the
temperature. When the temperature reduces below a certain threshold, for a
certain period of time, then the fan can be switched off.
PLC Control System
Now, the level of control provided is only as good as the PLC ladder logic
program contained in it’s memory. Therefore a good program with solid logic
expressions will ensure trouble free operation.

The number of machine and process control applications are endless, but here
are a few examples….

 Controlling the temperature of a drying oven by monitoring it’s internal


temperature and varying the burner control valve position.
 Monitoring a process water tank and controlling it’s water level by
varying the speed of an inlet pump.
 Controlling the starting and stopping sequence of a series of material
handling conveyors.
PLC Controls and Automation
Because a PLC is specialized to execute the three tasks mentioned above it
performs with high speed and with extremely high reliability. This is essential
for machine automation and process control. Imagine the consequences of a
PLC crashing (like your home PC operating system) midway through a
machine operation. It can be dangerous to personnel, production and
equipment causing injury, damage, downtime and unnecessary expense.

PLC’s have also been designed, unlike the home PC, to operate under harsh
industrial environments where electrical noise and Electro Magnetic
Interference (EMI) exist.

They generally, but not always, require a separate power supply and have
input and output terminal strips for connection of electrical devices.

Some have extendable and remote mounted input and output modules.
These days PLC based control systems have communication options such as
Ethernet/IP (Allen Bradley), Profinet (Siemens) and Modbus TCP/IP (Modicon).
Thus allowing networking with other PLC’s, remote input/output modules,
instrumentation, motors, actuators and Human Machine Interfaces (HMI) such
as touchscreens and SCADA systems.

A basic block diagram of PLC based control systems is shown below….

PLC Based Control System


In the next section we will jump straight into the most common symbols that
you can’t do without when ladder logic programming. We’ll also examine their
operation and outline some of their most popular uses.

To go to the next section click here.

Potrebbero piacerti anche