Topic 5 - Programmable Logic Controller (PLC)
Topic 5 - Programmable Logic Controller (PLC)
➢ Most industrial control hardware e.g. motor start-stop systems were controlled using hardwired systems,
no microprocessor.
➢ If Switch (A) is pressed by the operator, low voltage (24 VDC) is obtained.
➢ When switched the relay controls larger current through the motor (or any other device).
➢ Small voltage is used to control larger current going through an electrical device.
➢ The motor can be used to control crane heist or a conveyor belt.
➢ The problem with this circuit when a change has to be made, e.g. putting E-Stop into the circuit the circuit
has to be physically broken either on the low voltage or before the Switch, sometimes this may be
impossible or costly to do.
➢ On the other hand, the PLC device has a microprocessor, all the inputs are wired into it; and can add
more devices for future upgrades.
➢ PLC is flexible enough to make modifications to the circuit and logic. For instance, to add the emergency
E-Stop, it is wired on the PLC and the logic is done inside the PLC and with that logic a motor can be
stopped in an event of an emergency; stop is pressed.
Washing Machine Illustration
➢ The washing machine uses a microprocessor system.
Inputs to it are used to select the required wash cycle:
• A switch to determine that the machine door is closed,
• A temperature sensor to determine the temperature of the water,
• A switch to detect the level of the water.
Page | 1
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
On the basis of these inputs the microprocessor is programmed to give outputs that:
➢ Switch on the drum motor and control its speed,
➢ Open or close cold and hot water valves,
➢ Switch on the drain pump,
➢ Control the water heater,
➢ Control the door lock so that the machine cannot be opened until the washing cycle is completed
Input 𝝁𝑷 Output
PLC: A programmable logic controller (PLC) is a special form of microprocessor-based controller that uses
programmable memory to store instructions and to implement functions such as logic, sequencing,
timing, counting, and arithmetic in order to control machines and processes.
The term Logic is used because programming is primarily concerned with implementing logic and
switching operations; for example, if A or B occurs, switch on C; if A and B occurs, switch on D. Input
devices (that is, sensors such as switches) and output devices (motors, valves, etc.) in the system
controlled are connected to the PLC. The operator then enters a sequence of instructions, a program,
into the memory of the PLC
1. The Processor Unit or Central Processing Unit (CPU) is the unit containing the microprocessor. This unit
interprets the input signals and carries out the control actions according to the program stored in its
memory, communicating the decisions as action signals to the outputs.
2. The Power Supply Unit is needed to convert the mains AC voltage to the low DC voltage (5 V) necessary
for the processor and for the circuits in the input and output interface modules.
3. The Programming Device is used to enter the required program into the memory of the processor. The
program is developed in the device and then transferred to the memory unit of the PLC.
4. The Memory Unit is where the program containing the control actions to be exercised by the
microprocessor is stored and where the data is stored from the input for processing and from the output
5. The Input and Output Sections are where the processor receives information from external devices and
communicates information to external devices. The inputs might thus be from switches, temperature
Page | 2
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
sensors, flow sensors etc. The outputs might be to motor starter coils, solenoid valves, or similar things.
Input and output devices can be classified as giving signals that are discrete, digital or analog.
6. The Communications Interface is used to receive and transmit data on communication networks from
or to other remote PLCs. It is concerned with actions such as device verification, data acquisition,
synchronization between user applications, and connection management.
The primary function of a communication interface is to provide communication between the PLC
and another peripheral device such as another PLC or variable speed drive.
The communication can be achieved using serial bus system to send in data from one device to
another device.
The reason there is communication interface, it is for example when there is PLC operating in a
packaging plant, and another operating in a manufacturing section or blending section and
information has to be sent there has to be communication innovative device, this is very proprietary
to the PLC manufacturer for SIEMENS there is Profibus, Profinet, which is their own proprietary
network standard, Ellen Bradley has ControlNet and Netmore.
➢ PLC is flexible and robust to industrial environment, it can with stand high humidity, vibration and a lot
of dust.
➢ Micro PLC has power supply and CPU built into brick unit where all the inputs are connected to it and
has outputs.
Page | 3
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
INTERNAL ARCHITECTURE OF A PLC
➢ This is generic, does not apply to any specific PLC; there is a CPU with clock, the clock is relatively for
large PLC’s because it has a number of I/O’s.
1. CPUs: The internal structure of the CPU depends on the microprocessor concerned. In general, CPUs
have the following:
An Arithmetic and Logic Unit (ALU) that is responsible for data manipulation and carrying out
arithmetic operations of addition and subtraction and logic operations of AND, OR, NOT, and
EXCLUSIVE-OR.
Memory, termed registers, located within the microprocessor and used to store information involved
in program execution.
A Control Unit that is used to control the timing of operations
2. The Buses: The buses are the paths used for communication within the PLC. The information is
transmitted in binary form, that is, as a group of bits, with a bit being a binary digit of 1 or 0, indicating
on/off states:
The Data Bus carries the data used in the processing done by the CPU.
The Address Bus is used to carry the addresses of memory locations. So that each word can be located
in memory, every memory location is given a unique address
The Control Bus carries the signals used by the CPU for control, such as to inform memory devices
whether they are to receive data from an input or output and to carry timing signals used to synchronize
actions.
The System Bus is used for communications between the input/output ports and the input/ output unit.
3. The Memory: To operate, a PLC system needs access to data and program instructions stored in its
memory, which guide the data processing. The system includes various memory elements.
System Read-Only-Memory (ROM) gives permanent storage for the operating system and fixed data
used by the CPU.
Page | 4
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Random-Access Memory (RAM) is used for the user’s program. RAM stores data such as input/output
device statuses, timer and counter values, with sections allocated for inputs, outputs, preset data, and
other internal devices. This memory is often called a data or register table.
Possibly, as a bolt-on extra module, Erasable and Programmable Read Only-Memory (EPROM) is used
to store programs permanently.
4. Input / Output Unit: The input/output unit interfaces the system with external devices like sensors and
motors, and also allows program entry from a panel.
With regards to inputs channels there is Opto-Coupler Buffer Circuit to protect the internal
architecture of the PLC, any high voltage or currents will not enter the sensitive electronics.
For output channels latching system drives on the output, either on or off and the drive interface
section with an actual driver e.g. relay, Triac or a transistor.
1. Designated Section is what the PLC will use to store and read specific parts from the PLC memory. Any
outputs that need to be written are stored in this register or a set of registers e.g. set of inputs, status, bits,
timers, counters, control integers and reserved section for any information the manufacturer may deem to
have. Designated section is used by the PLC architecture.
2. Network Register is for saving data coming through the network
3. User Defined Section – this is where specific bits, timers, counters in the program are found. Whatever is
chosen to be used in the program is allocated in the user defined memory space.
4. Program Files/Structures – if subroutines are to be implemented knowing how to structure the program
is important.
Page | 5
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
PLC RUN CYCLE
S1 S2 Lamp
Page | 6
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
1. Input Scan - the current status of every input module is stored in the input image (memory) table,
bringing it up to date.
2. Program Scan - the CPU enters its user program execution, or program scan. The execution involves
starting at the program's first instruction, then moving on to the second instruction and carrying out its
execution sequence. The CPU continually keeps its output image (memory) table up to-date.
3. Output Scan - the entire output image table is transferred to the output modules during the output scan
after the program execution.
▪ PLC scan in every 1 ms, Switch A is switching fast within one 1 ms.
▪ PLC scans the input (at every X) it looks at the program and updates the outputs, since it is switching
quickly it does not see the input, Switch A does not pick up anything hence the (?), another input is
missed at X2; in total there are 3 missed inputs.
▪ At X3 it picks up the input, and there is a delay.
▪ Between X4 & X5 there is a delay input represented by D1.
▪ Scan rates are in equidistance.
Page | 7
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Variable Scans
▪ Delays in communication with external devices or networks also cause variable scan rate.
▪ The scan rates are not in equidistance, they are in variable distance, this creates problems with missed
inputs and time delays.
▪ Input signal must always be longer than the shortest scan time e.g. input 4, must be larger than the scan
time 6 in order for the PLC to detect the input properly.
Incremental Shaft Encoder
Page | 8
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
INPUT AND OUTPUT CARDS
▪ Purchased according to user needs, may be Discrete or Analogue depending on what the user needs.
▪ Specialized I/O cards, high speed, load cell card, thermocouple card, etc.
▪ There are 2 categories of I/O cards Digital and Analog.
▪ Types of digital cards are Current Sinking and Current Sourcing.
▪ Current Sinking or Current Sourcing: The terms sourcing and sinking are used to describe the way in
which DC devices are connected to a PLC.
Current Sourcing
➢ With Current Sourcing, using the conventional current flow direction as from positive to negative, an
Input Device receives current from the Input Module, the Input Module is the source of the current.
➢ If the current flows from the Output Module to an Output Load, the Output Module is referred to as
Current Sourcing.
Positive signals is going into the PLC, the Input Device is switching Negative to the PLC.
One power supply located out near the PLC Negative switching is implemented here; Negative to the
field.
Current Sinking
➢ With Current Sinking, using the conventional current flow direction, an Input Device supplies current to
the Input Module, the Input Module is the sink for the current.
➢ If the current flows to the Output Module from an Output Load, the Output Module is referred to as
Current Sinking.
Page | 9
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
DIGITAL INPUT AND OUTPUT CARDS
Digital DC Input Card
➢ PLC’s offer the user 3 types of outputs methods, one of them is a Relay.
Page | 10
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
➢ One advantage is that it can pass a huge amount of current and drive much bigger loads.
➢ Signal comes in from the PLC to drive the output, the Opto-isolator provides protection, and the LED
tells the user the output is on.
➢ To protect the power supply all the outputs are fused, be it internal or external power supply.
With the Relay Type, the signal from the PLC output is used to operate a relay and can switch currents
of the order of a few amperes in an external circuit.
The relay not only allows small currents to switch much larger currents but also isolates the PLC from the
external circuit
Digital Transistor Output Card
➢ Uses PNP transistor configuration for driving the output.
➢ This also has an Opto-Coupler.
The Transistor Type of output uses a transistor to switch current through the external circuit. This gives
a considerably faster switching action. This is for DC switching and is destroyed by overcurrent and high
reverse voltage.
Digital Triac Output Card
➢ Triac is used to switch output driven with an AC; the AC has a Live and a Neutral.
➢ 5 VDC is the signal from the PLC CPU.
Triac Outputs, with opto-isolators for isolation, can be used to control external loads that are connected
to the AC power supply.
It is strictly for AC operation and is very easily destroyed by overcurrent.
Fuses are virtually always included to protect such outputs.
Page | 11
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
ANALOGUE INPUT AND OUTPUT CARDS
Analogue Input Card (ADC)
𝑹𝒂𝒏𝒈𝒆
𝑹𝒆𝒔𝒐𝒍𝒖𝒕𝒊𝒐𝒏 =
𝟐𝒏 − 𝟏
1. Resolution - is the smallest value that the PLC input/output can recognize.
0 – 10 V signal goes in from the field (e.g. level transmitter, pressure transmitter) or some form of device
pushing analogue signal into the PLC.
The resolution is 8 bits, the 10 V is divided by 8 bits, and the 8 bits is 28 which is 256.
The smallest voltage the PLC can read is 40 mV.
When it goes from 0 voltage to the next high bit level e.g. [ 0 0 0 0 0 0 0 1], the 1 indicate 40 mV.
All 1’s will be 10 volts; analogue signal can be represented using 8 bits.
There can be inputs cards with higher resolution such as 12 bits, which is 10 V/4095 = 2.5 mV.
2. Range – is the input range, e.g. 0 – 10 V, level transmitter with 0 – 100%, pressure transmitter (0 -50
kPa).
3. Rate – is how the AC to DC convertor is sampling, the faster the sample the better the approximation.
Analogue Output Card (DAC)
This is an 8-bit DAC; PLC sends a signal out to some device controlled e.g. a valve or speed controller.
If all the 8 bits are 0’s, then the output will be 0 volts; if all the inputs are 1’s the output will be 10 volts.
Page | 12
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Remote Terminal Units (RTU’s)
➢ This is used because of the large distance on the actual PLC device to the field connections, these
depending on the number of inputs and outputs leads to a lot of wires being connected to the PLC.
Page | 13
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
1. PLC LADDER PROGRAMMING (LAD – LADDER LOGIC) – 5.1.1 pg. 116
➢ Why It Is Used - It provides a straightforward way to create and understand control logic without needing
extensive programming knowledge. The graphical nature allows for easy visualization of the control
process, which aids in troubleshooting and maintenance.
➢ Functions - It performs basic logic operations such as AND, OR, and NOT, which are essential for decision-
making in control processes. It automates repetitive tasks and sequences in industrial applications, such
as conveyor systems, packaging, and bottling.
Example 1
PLC Types of Programming include Ladder Logic, Statement List, Function Blocks and Structured Texts.
In Ladder logic there are 2 rails, left and right rails; they are power rails.
If there is a Normally Open Contact (Input) and the coil which is the output; if the input is active power
will flow through and activate the Output (Coil), power is flowing from positive to negative.
If normal closed is connected to an Output, nothing will happen to the Input, but power will still flow
because this is a normally closed contact, and the output will be active.
If normally closed contact is activated out in the field the coil will be off.
The Input is Switch and the Output is the Lamb (L) (the input is addressed as X0, and the output is Y0).
If the Switch is activated, the normally open contact in the PLC becomes active, and Output (Y0) will turn
on.
If the switch/input addressed as X1 and the switch is not active, since the power is positive to negative
normally closed contact will be on.
If the switch is normally OFF in the field the output will be ON.
When the switch is closed X1/normally closed contact will change state, it will open, and the Output will
be off; this is inverse logic.
Example 2
▪ In field the stop button is normally closed, and the start button is normally open.
▪ On this example there are 3 outputs, the motor, which is addressed to Y430, Lamp 1 (L1) which is for
power not applied and Lamp 2 (L2) is for power applied; L1 and L2 are addressed to Y431 and Y432
respectively.
▪ PLC does not know that M, L1 and L2 are connected to it, it knows the addresses only.
X401 is closed when the program is started.
When X400 is momentarily Closed, Y430 is energized, and its contacts Close.
This results in latching as well as the switching OFF of Y431 and the switching ON of Y432.
Page | 14
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
To switch the Motor OFF, X401 is pressed and Opens.
Y430 contacts Open in the top rung and third rung but close in the second rung.
Thus, Y431 comes On and Y432 goes OFF
Page | 15
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
SAFE STOP SWITCH - 5.7.1 pg. 139
The stop is a normally open contact in the software, and it normally closed contact out in the field.
When the start push button is pressed (24 V), the stop button contact becomes activated, and the motor
will start.
If there is a fault with the stop button, the motor will not start, this is a fail-safe mechanism.
E -Stop is a type of fail-safe switch or mechanism, it is wired as normally closed.
Page | 16
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Statement list is a low-level programming method, words describe the logic that the machine needs to
operate with.
Mnemonics are used to design a program (IEC).
There are 3 different types of manufacturers each manufacturer has its own unique way in which they
program the PLC using statement lists.
LD – Load, LDN – Load Negative/Load Inverted, ANDN – AND NOT, ORN OR Negative, ST – Output.
➢ Why It Is Used - STL provides a high degree of control over the PLC’s operations, allowing for precise and
efficient programming. It can be more efficient in terms of execution speed and memory usage compared
to higher-level languages.
➢ Functions - STL executes instructions sequentially, similar to how assembly language operates. It
performs logical operations, arithmetic calculations, and data manipulation at a low level.
Example 1 – AND Function
Ladder Program
Statement Lists
When it is started and develops some pressure; if the pressure is not developed the lamp will start up or
turn on.
The test function enables the testing of the lamp if it is working or not.
Valve Operation Program – 6.1.4 pg. 158
There is a State 0 and State 1, in State 0 the Red Light is ON and after a period of 1 minute (transition
state) the Green Light will turn ON.
After another minute, transition will be initiated, and it will go to the initial State 0
Page | 19
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Washing Machine Example
STRUCTURE OF SFC
Page | 20
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
5. PLC LADDER PROGRAMMING (ST – STRUCTURED TEXT) – 6.3 pg. 164
➢ Why It Is Used – It provides a clear and concise way to write complex control algorithms, which can be
easier to read and maintain compared to graphical languages like Ladder Logic. ST is used to write
detailed control algorithms that can handle complex logic and calculations.
➢ Functions - It supports modular programming, where code can be organized into reusable functions and
procedures. ST can handle complex mathematical operations and data manipulations efficiently, making
it suitable for advanced control tasks.
If the temperature of the furnace is between 0 and 40, furnace switch element is switched ON.
Between 40 and 100 it is switched OFF.
In any other case the furnace heat is OFF.
Page | 21
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
IMPORTANCE OF INTERNAL RELAYS (FLAGS/STATUS BITS) – 7.1 pg. 183
Internal relay is a memory bit, that the PLC has or holds in its internal structure to turn on a physical
output.
Internal Relay (IR 1) is not connected to any physical output, but it is used in the program to control
other aspects of the code.
There are 2 conditions Input for Output 3 and Input for Output 3 which are conditions to turn on physical
Output 2 and physical Output 3.
This only occurs when the internal relay is active.
Page | 22
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
On the next scan the normally closed Cycle Control will be open because of the Cycle Control in the coil
for the Cycle Control contact.
On the next cycle, Trigger Output will be switched OFF.
This is achieved by using Positive Edge, which is when you trigger going up when the input signal
transitions from low to high and Negative Edge is when you trigger going down when the input signal
transitions from high to low.
❖ This is a latching circuit, Input X400 is the Start push button and the Input X401 is a Stop push button,
this eliminates the writing of the latch.
When the Start is pressed (X400), the Output will switch on which is Y430.
The Output Y430 will be out until Stop (X401) is pressed.
In this situation the output has to be used twice, in order to fast set and reset it.
Example - Alarm System – 7.5.1 pg. 194
This is another way of calling special part of the code, when Input 1 is initialised, it will call the subroutine
and carry instruction code.
Page | 24
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
6. Timers – 9.1 pg. 221, 9.2 pg. 222, 9.3 pg. 227, 9.4 pg. 229
➢ There are 3 ways in which timers are used; On-delay Timer, Off-delay Timer and Pulse Timer.
➢ Timers are also relays.
Preset Time = 5 s
When power is put on T1 (Input) after a Preset Time of 5 seconds the the output T1a will switch state.
Unlike in relay when power is applied onto the coil the contacts T1a and T1b would change state
immediately, in timers it takes whatever preset time then it can close the contacts or open.
On-Delay Timer it takes some time for when power is put to turn on the output.
Off-Delay Timer – the input is on all the time; the timer has power all the time and when power is
removed after 5 seconds then the output switch state.
Pulse Timer when power is put on a pulse timer the output will come on, as soon as the power is put on
the output will switch state and it will remain in that state for 5 seconds.
Example - Timers Used to Create a Flashing Sequence (Pulsing Sequence on The Output) -
▪ These are On-Delay Timers, when power is put on the contacts of the timers will not come on
immediately only after the preset time has elapse then only the output will come on.
▪ The preset time is K5 (K means decimal value and 5 is 5 seconds).
▪ Input 1 is ON all the time, T1 is active, T2 is a normally closed contact, if everything is OFF power will go
through.
▪ If T1 has power, it waits for 5 seconds as soon as 5 seconds has elapsed the output will be high, then T1
will close.
▪ At the same time T2 starts to time, T2 times for 5 seconds as well, when the 5 seconds has elapsed the
normally closed contact is unlatched and the circuit breaks.
▪ The timer is reset, and the output switches off, this continues causing a pulsing effect on the output.
Page | 25
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Example 2
Switch 1
On a counter there must be a pulse on the input, Switch 1 is switching ON and OFF.
There is a preset value of 5 seconds.
When counting 5 pulses, Switch 1 is going ON and OFF, once it reaches a preset of 5 seconds the contacts
C1a and C1b change state.
If it goes beyond the preset value it is reset to zero using the reset accumulation, then Switch 1 can count
up to 5 again.
Page | 26
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
8. Shift Registers – 11.1 pg. 262
▪ Shift registers are used to keep tract of items moving along a
conveyor belt. See Example on ‘PLC Application Examples’
▪ Example: 1 to 8 means there are 8 items moving along
▪ Shift registers operate on principle of First In, First Out
▪ This is shifted to the right; the last digit will be the first one IN
Shifted to the Right
and the first one OUT.
▪ This occurs depending on the condition written on the
program
M140 0 0 1 1 1
M140 is a pointer index, that means that is where the shift register will start, it will use up to 5 spaces
from M140. M is a flag or memory bit.
This will go from M140 to M141, M142, M143, M144, M145, the equivalent ladder diagram is shown
above for the function block.
X400 is the activator for the output, if it is OFF there will be a bit 0 on square 2, if ON there will be a 1.
X401 tells the program to shift the register to the right.
X402 is the reset is the reset, once it reaches a particular point it resets the shift register and it starts
from M140.
If X400 is active, M140 is active, then output Y430 will be active then it is shifted.
If X400 is not active, M141 will be OFF, there will be a 0 on the 3rd bit space on the register.
Page | 27
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Shift Register Example 2 – Keeping Tract of Faulty Items See Example on ‘PLC Application Examples’
Each time a faulty item is detected, a pulse signal occurs at input X400. This enters a 1 into the shift
register at internal relay M140.
When items move, whether faulty or not, there is a pulse input at X401. This shifts the 1 along the
register.
When the 1 reaches internal relay M144, it activates the output Y430, and the rejection mechanism
removes the faulty item from the conveyor.
When an item is removed, it is sensed and an input to X403 occurs.
This is used to reset the mechanism so that no further items are rejected until the rejection signal reaches
M144. It does this by giving an output to internal relay M100, which latches the X403 input and switches
the rejection output Y430 OFF.
The shift register has 4 possible bits, as a faulty item gets detected once shifted at X403 there will be a
mechanism which will reset the output.
There is also an output to activate rejection mechanism, which may be a blower or a piston to push the
output out.
If there is a zero at space bit 4, the rejection mechanism will not be activated.
M100 is the resetting after it rejects, then it resets the output activation.
9. MOVE And COMPARE Instructions
➢ These instructions are used when dealing with analogue values inside the PLC.
MOVE Instruction – 12.2.1 pg. 274
X0 K2048 Heater
< D100 D150
Y0
Page | 29
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
The data manipulated in the data registers for D0 to D200 is converted from BCD to Binary and Decimal
and it can be stored to different registers.
For example, the output of encoder measuring a shaft or a rotating a machinery, the output of that is
usually binary.
That BCD is taken and converted to something useful, such as position.
Depending on the code, the BCD can be converted to binary or an actual decimal value then it can be
used to do angular position control.
There is arithmetic maximum and minimum values e.g. ADD/SUBTRACT/MULTIPLY/DIVIDE are also
some of the arithmetic instructions.
11. PID Instruction
For the PID function block to work, there must be an analogue input card to read the measurement signal
coming from the field device.
There must be an analogue output as well or the PLC with a digital output card can be used.
Pulse Width Modulation function is used to switch ON the output depending on how fast or slow the
output has to be switched.
This is a closed loop control, the setpoint value is set either internally or externally depending on how
the PID program is set up.
To set it up externally another analogue input can be used (coming from a potentiometer device or some
user input that the PLC needs to recognize).
Internally it could come from a register or Human Machine Interface (HMI) device operating in the plant,
which is used to write to a register.
PID algorithm is running inside the PLC, which relies upon the Proportional Gain, Integral Gain, And the
Derivative Gain, these values are user defined.
Output of the PLC goes to an Actuator e.g. VSD or valve to manipulate the Process, then the output will
be measured and fed back to the input.
Example 1 – Tank Level Control
Page | 30
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
➢ The level controller is the PID control block
➢ The measurement is the Level Transmitter (LT).
The user sets the value inside the Controller (LC) which is 50%.
The value of 50% is read into ADC or register holding the set value.
The level measurement signal goes to another register which will be the measured value or process
value.
Signal coming from the controller is the output, coming from DAC.
Assuming the tank is going from 0 to 100%, the DAC and ADC have 12 bits ( 0 – 4095)
If the set point is 50%, then it will be 2047 which is approximately 2048.
PID will work the algorithm, then give a calculated output depending on the set point and the measured
value.
If the level rises, LCV will close, if level drops below 50% LCV will open.
Things to Consider When shifting the PID block inside the PLC.
➢ Forward acting when the error drops, the output will also drop.
➢ Reverse acting when the error is increasing, the output decreases, when the error decreases the output
increases.
Reverse Acting
1. The action of the controller has to be considered (Forward Action and Reverse Action) – In a field acting
controller if the error is increasing the output also increases; if the set point is at 50% and if the level goes
above 50%, the measured error is increasing and the controller is set up on Forward , it would not work since
the output has to decrease.
The liquid is rising, it is positive error, the output decrease by closing the valve.
If error decreases (below 50%) the valve must open to bring the level back to 50%, reverse acting works
perfectly on this example
Forward Acting
If the error increase, the valve opens up so that the level drops, if error decreases the level is going below
the set point, the valve must cut back to increase the level to 50%.
2. PID has to be considered – the settings are user defined, the values Kp, Ki and Kd are tuned to get good
response closed loop control system.
3. Sampling has to be considered - the sampling rate of the controller has to be considered, 100 ms is
sufficient for most controller, however for very fast processes it can be 10 ms or 1 ms.
Page | 31
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Sampling rate relates to the time constant of the process, once step changed the process rises according
to some time constant and if the time constant is slow then sampling too fast is not desired.
4. Anti- Wind Up and Derivative Kick has to be considered – These are set inside the PID algorithm, the user
can set up how much anti-wind up is wanted or have the derivative to look at the error or the process value
to reduce the derivative kick. Noise filter can be used on the derivative action
PID Instruction/Block on PLC
▪ AUTO – is a Boolean value either Input or Output tells the PID whether to be in auto mode or manual
mode. In auto mode is when PID algorithm is working in closed loop and manual mode is when there is
no feedback, the user can drive the actuator to whatever value desired manually.
▪ Process Value – it is a real value coming from the measurement/sensor.
▪ X0 – is also a real value and it may be an enable for the PID block.
▪ PID Parameters (Kp, Tr & Td) – these are the values for proportional, integral and the reset rate and the
derivative.
▪ Cycle is given in time; this has the scan rate.
▪ XOUT – is the output going to the actuator, which is also a real value.
▪ Error Output – when some of the values are out of range or out of limits, that is sent to a function like
interrupt, interlock or any safety mechanism.
Page | 32
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
This is the stage where once the function specification
of the project has been achieved, the flow chart can
then be developed.
The ladder program logic can be developed from the
flowchart.
➢ With inputs the specifications of the output devices have to be known, e.g. the current consumptions,
whether they need to be switched ON and OFF quickly and the voltages needed to be applied onto the
outputs to turn them on.
Page | 35
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
When designing a system how much current will be drawn has to be known.
Each column represents different section of the PLC.
Base of the slot is the backing rack of the PLC.
The amount of current drawn by each card or module has to be known.
Column 3 represents the internal power of the rack, as well as the internal power of the cards, this is the
current each of the devices, represented by Column 2 will draw.
Operator Interface is connected to the PLC, which is also taking up some current
The PLC will have its own internal power supply in some cases.
There’s an HMI or Operator Panel taking power from the internal power supply.
PSu
External Internal
PSu CPU
I/O Cards
Lamp
HMI
The HMI is consuming 90 mA. When designing a system, the internal power supply of the PLC system
has to be known.
The external power supply is connected in such a way that there is a current sink system.
Slot 4 is taking power from the external power supply.
All the currents are added up, the maximum current drawn from the external power supply is 80 mA.
If there are input and output devices connected to the PLC e.g. a lamp or light taking 100 mA, to the
external power supply, that current drawn is added to Column 4.
All the currents are added up and the remaining available current that the power supply is rated, these
added currents are subtracted from that rated current e.g. 300 – 80 = 220 mA which is the remaining
current.
If added currents are above the rated current e.g. 300 mA, the external power supply has to be upped
or connected devices to loosen the burden on the power supply.
Power budget analysis is important so to know the power supply to be purchased.
When designing the system, there must be an extra current.
Page | 36
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Page | 37
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
IMPORTANT CONSIDERATIONS WHEN POWERING THE PLC SYSTEM FOR THE FIRST TIME
Commissioning Of A PLC System Involves:
1. Checking all the cable connections between PLC and plant being controlled are complete, safe to the
required specification and meet local standards.
Ensure all the connections are safe, there’s enough grounding, no loose wires.
2. Checking that all the incoming power supply matches the voltage setting for which the PLC is set.
3. Checking that all the protective devices are set to their appropriate trip settings, like alarms, trip wires
and proximity sensors.
4. Checking that emergency stop buttons work.
5. Checking all inputs/outputs devices are connected to the correct input/output points and giving the
correct signals.
6. Loading and testing the software.
Simulation And Online Monitoring
Forcing Outputs
➢ This is commissioning, this is done to test outputs to make sure they are working properly, overriding the
main code.
➢ Outputs on the PLC can be forced.
PLC ▪ If the output is forced on the PLC LED will show that some output is forced.
▪ If for example, there’s an output Y0 and Y0 will only switch when all the conditions
LED (X1, X2, & X3) are met.
▪ When Y0 is put in force mode, all the conditions are overridden or by passed.
F ▪ This is done to check if the output is working.
Y0
X1 X2 X3 Y0
F
Fault Detection Techniques
1. Timing Checks
Watchdog Timer
Page | 38
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
2. Last Output Test
➢ This technique involves the use of status lamps to indicate the last output that has been set during a
process that has come to a halt. Such lamps are built into the program so that as each output occurs, a
lamp comes on.
➢ The lamps that are on thus indicate which outputs are occurring. The program has to be designed to turn
off previous status lamps and turn on a new status lamp as each new output is turned on. See pg. 302
3. Replication
➢ Where there is concern regarding safety in the case of a fault developing, checks may be constantly used
to detect faults. One technique is replication checks, which involve duplicating, that is, replicating, the
PLC system.
➢ This could mean that the system repeats every operation twice and, if it gets the same result, it is
assumed that there is no fault.
➢ This procedure can detect transient faults. A more expensive alternative is to have duplicate PLC systems
and compare the results given by the two systems. In the absence of a fault, the two results should be
the same. See pg. 305
4. Expected Value Checks
➢ Software errors can be detected by checking whether an expected value is obtained when a specific input
occurs. If the expected value is not obtained, a fault is assumed to be occurring. See pg. 305
Buttons
Safety curtains have sensors to pick if anyone or anything crosses it and the machine will then turn off;
these can be programmed on the PLC to make the operation safe.
3. Hazardous risk assessment – this is done before designing the program, possible risks in the system are
discussed.
4. Use of a safety PLC – if there’s a PLC operating with a specific scan time, in the safety PLC there’s another
code running in conjunction with the main operating code.
Page | 39
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
In between the scan cycles there are safety cycles.
If the E-Stop is connected to safety interlock, the E-Stop is recognized at the safety cycles.
Example Programs (Refer to Chapter 14)
PLC Arrangement and Program with The Bimetallic Thermostat.
➢ A bimetallic strip consists of two different metals strips of the same length bonded together. Because
the metals have different coefficients of expansion, when the temperature increases the composite strip
bends into a curve with the higher coefficient metal on the outside of the curve.
➢ The movement may be used to open or close electrical contacts and so operate as a temperature-
dependent switch.
If the actual temperature is above the required temperature, the bimetallic strip is in an off position and
there is no circuit voltage output.
If the actual temperature is below the required temperature, the bimetallic strip moves into the on
position and the voltage is switched on, so there is an output. The thermostat output is thus just off or
on and the input to the PLC is no voltage or a voltage
When the RUN button is pressed power is sent through and the Bimetallic slip strip and heater will start.
The heater heats up the process, when it heats up to a sufficient level the Bimetallic Thermostat will be
OFF, and the heater will go OFF.
Page | 40
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Cyclic Movement of a Piston – pg. 339
Consider both timers set for 10 s. When the Start contacts X400 are closed, timer T450 starts. There is
also an Output of Y431. Output Y431 is one of the solenoids used to actuate the valve.
When it is energized it causes pressure supply P to be applied to the right-hand end of the cylinder and
the left-hand side to be connected to the vent to the atmosphere.
The piston thus moves to the left. After 10 s, the normally open T450 contacts close and the normally
closed T450 contacts open. This stops output Y431, starts timer T451, and energizes output Y430.
As a result, pressure supply P is applied to the left-hand side of the piston and the right-hand side is
connected to the vent to the atmosphere.
The piston now moves to the right. After 10 s, the normally closed T451 contacts are opened. This causes
the normally closed T450 contacts to close, and so Y431 is energized.
Thus, the sequence repeats itself.
Page | 41
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
3 Phase Motor Control Circuit
Page | 42
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
FAULTY ITEM TRACKING USING SHIFT REGISTERS
X2(D0) D10(Pointer)
0 D11
1 D12
0 D13
0 D14
0 D15
0 D16
1 D17
0 D18
➢ Bottles are moving along conveyor belt, this has 3 sensors (Bottle Detect Entry Detect Sensor, which is
a proximity sensor picking up the bottle as it is entering the fault detection section; Bottle Detect Exit
Sensor if a faulty bottle is detected by this sensor The Blower Or Fan Ejector Blower is activated which
blows out the faulty bottle; the third sensor is A Fault Sensor which has a binary input sent to the PLC
written to a data register D0.
PLC Application Examples
1. Peanut butter filler.
2. Cooling fan ON/OFF control.
3. PID control
▪ SCADA – Supervisory Control and Data Acquisition, is a software residing on a computer and the purpose
of SCADA is to obtain information from the PLC hardware and present that information in a usable and
useful way to the operator.
▪ It provides a medium for supervision of the plant and for acquiring data from the plant for the operator
to control devices.
▪ The field devices are connected to the PLC (valve, level transmitters cells, Thermocouples etc).
▪ Operator panel is the HMI.
Page | 43
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Manufacturers of SCADA Software
1. WinCC
2. Adrioit
3. Wonderware, etc.
SCADA doesn’t perform online control but that is done by the PLC
SCADA Allows for visualization of process variables, changing of setpoints, alarms, trends and reports.
Process calculations (reliability, speed and complexity) Example: a complex recipe going in the tank AC3,
the SCADA can be programmed to change recipe or the dynamics of the valves in the tank AC3 which
opens and closes.
▪ Any related reliability, speed or complexity is put into the PLC because if a recipe is stored in a SCADA
system; if the Profibus link or network is broken the PLC will not be getting the information from the
SCADA software.
▪ On SCADA software only things like report generalisations, calculating how much of liquid or product is
pumped, a totalized flowrate, how much flow of the product went through in a day or week.
Security is an important aspect of SCADA, some level of firewall is needed when the PLC is connected to
the internet instead of the industrial ethernet because people outside the company can access the
information as well, as they can gain access to the PLC and PLC code.
Virtual Reality is used where there are process operators walking around with virtual reality gear, when
looking at a specific aspect the information pops up inside the virtual reality gear.
A network link to the SCADA is attached to the PLC. The network link can be a Profibus, Modbus,
foundation field bus etc.
Dynamic Database is an excel spreadsheet, where there are tags, PLC address (PLC 3), registers, update
rates (how fast the SCADA system reads the values from the PLC) and the dynamic value (which is
changing), High (HAL) and Low (LAL) alarms can be set up.
LT401 is the level transmitter, SP401 is the setpoint in which the user defines and FCV401 is the flow
control valve.
The level is at 61% when an operator sets the level at 75%, the register value (2001) inside the PLC is
updated.
Since the PLC has a PID algorithm running it, it will update the setpoint value and open value for FCV401
and the level will rise.
Page | 44
PROGRAMMABLE LOGIC CONTROLLERS (PLC)
History Database is used to store data e.g. trends which are useful to the operator as they can see the
level trends.
Alarm Manager is for setting up alarms, for example if the level goes above 80% or below 20% the SCADA
section of the alarm will flash. The operator can see on the SCADA mimic if there’s a fault on either the
valve or tank.
Math block is used to work out values like totalized flowrate, calculations for a report.
LAN (Local Area Network) is connected to the internet; production managers can log onto the SCADA
system and check production data or pull-out reports from the SCADA system.
Device Control System – this is where all the equipment like PLC work cells, SCADA are found.
Execution is the higher-level system, this goes into the LAN, and whatever information is in the mimic is
sent to execution. This has order tracking, asset management, and quality assurance. If for example there
is a PLC process in car manufacturing industry (device control system) manufacturing a vehicle which
requires certain parts (fender, bolts) that information is sent to order tracking, execution knows how
much equipment is used, so that there is no down time.
ERP (Enterprise Resource Planning) this is tailoring the system so that it runs efficiently, it reduces
operational costs, increases profits, improve ease of use with process automation; this looks after the
entire operational aspect of the plant, tells the system when it needs to shut down.
Page | 45
PROGRAMMABLE LOGIC CONTROLLERS (PLC)