Introduction PLC
Introduction PLC
CONTROLLER
• History
• PLC Overview
• Hardware
• Inputs/Outputs
• Operation
• Programming Software
• Communication
• Specifying a PLC
• Basic instructions
• Programming methods
• Advanced instructions
Introduction
This course provides students the knowledge of Goal description
Goals ELOs
the sensors, actuators, PLC hardware, PLC (This course provides students:)
operation. In addition, students will learn the G1 Basic knowledge of PLC, applications of PLC in industry. 01 (H)
programming languages, PLC instructions, how to G2 An ability to read material in English. 02 (H)
design a flowchart for a control system. G3
An ability to work effectively as a member and leader in
05 (M)
teams.
Finally, the course provides students how to design An ability to identify and solve engineering problems and 06 (M)
the hardware and program the software for an G4 to design an industrial system using tools and methods for
solving problems related to PLC systems. 07 (H)
industrial system.
Description
CLOs Outcome
(After completing this course, students can have:)
G1.1 The ability to present the structure and operation of PLC. 01, 05
G1 G1.2 The ability to draw the wiring diagram of PLC and sensors, actuators. 01, 06
G2 G2.1 The ability to read manual of devices and lectures in English 05, 07
G4.1 The ability to present the control ideal for PLC system. 02, 07
G4
G4.2 The ability to use software to program and simulate for PLC. 07
Software
TIA portal (Siemens)
FX Training (Mitsubishi)
Factory IO
https://factoryio.com/
Assessment
https://drive.google.com/file/d/11GQekwCl8bUzwVoeKbLZ4BZNdNV2Kgpd/view?usp=sharing
- Configuration S7-1200
https://drive.google.com/file/d/1WwyPM0a0AKGzV5vO2SFObm4LaYX2ROEN/view?usp=sharing
- Simulink
https://drive.google.com/file/d/1XSABl1bC4YJjei_0So_LEjX-bbMySxaC/view?usp=sharing
- Simulink in Factory IO
https://drive.google.com/file/d/16qNnjfBQLAnriZDW5lHdCISWLRp7Mk6o/view?usp=sharing
https://docs.factoryio.com/tutorials/siemens/setting-up-s7-plcsim-v13/
- Factory IO software
- https://docs.google.com/document/d/1c0JUKj2qEjHBIar-
7n39u6rI7hodxiHX/edit?usp=sharing&ouid=102953919047853637934&rtpof=true&sd=true
- https://drive.google.com/file/d/1AzmRXykJnzR17iv1iDjYRhuLMYCjP-Iq/view?usp=sharing
History of the PLC
• The first PLC, model 084, was invented by Dick Morley in 1969.
• The first commercial successful PLC, the 184, was introduced in
1973 which was designed by Michael Greenberg.
Leading Brands of PLC
AMERICAN
1. Allen Bradley
2. Gould Modicon
3. Texas Instruments
4. General Electric
5. Westinghouse
6. Cutter Hammer
7. Square D
EUROPEAN
1. Siemens
2. Klockner & Mouller
3. Festo
4. Telemechanique
8
Leading Brands of PLC
JAPANESE
1. Toshiba
2. Omron
3. Fanuc
4. Mitsubishi
9
What is a PLC?
Inputs Outputs
CPU
A PLC is a solid state control system that continuously monitors the status of
devices connected as inputs. Based upon a user written program, stored in
memory, it controls the status of devices connected as outputs.
Major Components of a Common PLC
POWER
SUPPLY
I M O M
N O U O
P D T D
U U PROCESSOR P U
T L U L
From E T E To
SENSORS OUTPUT
Pushbuttons, Solenoids,
contacts, contactors,
limit switches, alarms
etc. etc.
PROGRAMMING
DEVICE
Inside a PLC
Communications
Port
C C
I i O i
r
Central r
n u
p c Processor t c
u u p u
t i Unit u i
t (CPU) t t CR
s s
High High
Voltage Isolation Voltage
Isolation MEMORY Barrier
Barrier
program data
Low Voltage
Amplifier
FROM RELAY
TTL OPTO- TO
PROCESSOR ISOLATOR TRIAC
Circuits OUTPUT
X’SISTO
DEVICE
R
16
Output Module
DC Output. AC Output
With a small PLC, all the outputs might be of one type, e.g. 24 V DC.
Sourcing and Sinking
The terms sourcing and sinking are used to describe the way in which DC
devices are connected to a PLC.
With sourcing, using the conventional current flow direction as from positive to
negative, an input device receives current from the input module (a).
If the current flows from the output module to an output load then the output
module is referred to as sourcing (b)
Sourcing and Sinking
With sinking, using the conventional current flow direction as from positive to
negative, an input device supplies current to the input module, i.e. the input
module is the sink for the current (a).
If the current flows to the output module from an output load then the output
module is referred to as sinking (b).
COMPACTLOGIX MODULES
On state:
Min voltage: 10V, I = 2mA
Max voltage: 30V, I=10mA
OFF state:
Max voltage 5V.
Max current: 1,5mA.
Time to change from ON and OFF
state is 8ms.
COMPACTLLOGIX MODULES
1769-IQ32 Sinking/Sourcing 24V DC Input
Connect sensor to input digital module
• Valves
• Motor Starters
• Solenoids
• Actuators
• Control Relays
• Horns & Alarms
• Stack Lights
• Fans
• Counter/Totalizer
• Pumps
• Printers
PLC systems
There are two common types of mechanical design for PLC systems; a single
box, and the modular/rack types.
The single box type (or, as sometimes termed, brick) is commonly used for
small programmable controllers and is supplied as an integral compact
package complete with power supply, processor, memory, and input/output
units.
PLC systems
Systems with larger numbers of inputs and outputs are likely to be modular
and designed to fit in racks.
The modular type consists of separate modules for power supply,
processor, etc., which are often mounted on rails within a metal cabinet.
PLC systems
The rack type can be used for all sizes of programmable
controllers and has the various functional units packaged in
individual modules which can be plugged into sockets in a base
rack.
It is comparatively easy to expand the number of input/output (I/O)
connections by just adding more input/output modules or to expand
the memory by adding more memory units.
PLC systems
PLC systems S7-400
PLC systems S7-300 expansion
Allen-Bradley PLC
34
Siemens Simatic PLC
Modicon TSX PLC
Other PLC Terminology
38
Programming Device
Programmer (Square D)
39
Programming Device
40
Different types of I/O circuits
Outputs of this type typically are used to drive high-current electromagnetic loads
such as solenoids, relays, valves, and motor starters.
These loads are highly inductive and exhibit a large inrush current.
3. Discrete Inputs
Circuits of this type are used to sense the status of limit switches, push buttons,
and other discrete sensors. Noise suppression is of great importance in preventing
false indication of inputs turning on or off because of noise.
Different types of I/O circuits
4. Analog I/O
Analog inputs come from devices, such as thermocouples, strain gages,
or pressure sensors, that provide a signal voltage or current that is
derived from the process variable.
Standard Analog Input signals: 4-20mA; 0-10V
Analog outputs can be used to drive devices such as voltmeters, X-Y
recorders, servomotor drives, and valves through the use of transducers.
Standard Analog Output signals: 4-20mA; 0-5V; 0-10V
Different types of I/O circuits
5. Special - Purpose I/O
Circuits of this type are used to interface PLCs to very specific types
of circuits such as servomotors, stepping motors, PID (proportional
integral derivative) loops, high-speed pulse counting, resolver and
decoder inputs, multiplexed displays, and keyboards.
OUTPUTS
INPUTS MOTOR
CONTACTOR
LAMP
PUSHBUTTONS
PLC
I/O Circuits
Allen-Bradley 1746-1A16
L1 L2 I= Input
Module
I:2 slot # in rack
P. B SWITCH 0 Module
Terminal #
Address I:2.0/0
LADDER PROGRAM
INPUT
MODULE
WIRING DIAGRAM
I/O Circuits
CONTACTOR
L2 L1 N.
O
MOTOR
L2
C •SOLENOID
L1
•VALVES
FIELD •LAMP
WIRING •BUZZER
OUTPUT MODULE
WIRING
L1 O:4 L2
LADDER PROGRAM
CONTACTOR 0
Discrete Input
IN
OFF PLC
Logic 0
Input
Module
24 V dc
IN
OFF PLC
Logic 1
Input
Module
24 V dc
Analog Input
Level Transmitter IN
PLC
Analog
Tank Input
Module
Digital Output
Ex: The lamp can be turned ON or OFF by the PLC output it is connected to.
OUT
PLC
Lamp
Digital
Output
Module
Analog Output
OUT
E Supply air
PLC 0 to 10V P
Analog
Output
Module
Pneumatic control valve
Memory Operation
While the PLC is running, the scanning process includes the following four
phases, which are repeated continuously as individual cycles of operation:
PHASE 1 – Input Status scan
A PLC scan cycle begins with the CPU reading the status of its inputs.
PHASE 1
Read Inputs PHASE 2– Logic Solve/Program Execution
Scan The application program is executed using the status of the inputs
PHASE 2 PHASE 3– Diagnostics/ Communication
Program
Once the program is executed, the CPU performs diagnostics and
Execution communication tasks
PHASE 3 PHASE 4 - Output Status Scan
Diagnostics/
An output status scan is then performed, whereby the stored output
Comm
values are sent to actuators and other field output devices. The cycle
PHASE 4 ends by updating the outputs.
Output
As soon as Phase 4 are completed, the entire cycle begins again with
Scan Phase 1 input scan.
Memory Operation
Rung Scanning
Example
54
Memory Operation
The scan time composed of the program scan time, which is the time required for
solving the control program, and the I/O update time, or time required to read inputs
and update outputs.
The program scan time generally depends on the amount of memory taken by the
control program and type of instructions used in the program.
The time to make a single scan can vary from 1 ms to 100 ms.
PLC Communications
Linking a PLC into a control hierarchy containing several sizes of PLC and
computer.
Monitoring data and alarms, etc. via printers or Operator Interface Units (OIUs).
PLC Communications
LANs are commonly used in business applications to allow several users to share
costly software packages and peripheral equipment such as printers and hard disk
storage.
RS 422 / RS 485
Used for longer-distance links, often between several PCs in a distributed system.
RS 485 can have a maximum distance of about 1000 meters.
Communication Basics
• Protocols
• A set of rules for data exchange (format and timing of data) in a communications system
• Stack / profile = selected set of protocols for a communication application
• Communication Relationships
• Master / Slave - request / response & response only
• Peer-to-Peer - client / server, publisher / subscriber
• Communication Architectures
• Star (point-to-point)
• Bus, Ring, LAN (multidrop)
Communication Basics
• Ethernet • CAN-Open
• Modbus Plus • ASi
• Modbus • Seriplex
• S908 • FIPIO/FIPway
• LonWorks • RIO
• Interbus • HART
• Profi-bus • DIO
• DeviceNet • ControlNet
• Uni-Telway • ASCII
Criteria
2. Hardware/software selection
• Power On
• Run Mode
• Programming Mode
• Fault
Troubleshooting
Inputs Outputs
|| || |/| ()
|| |/| ()
RSlogix programs
Have one main routine and many subroutines
Have 32 programs in a task
Main routine is executed from program, sub must be
called to run
Subroutine
A Subroutine is called by another routine
Nested Subroutine
Programming language
Ladder Diagram
FB
What you need to know when specifying a PLC
• Communication Requirements
• Protocol/Network used
• Devices to communicate with (HMI, other PLCs, etc)
• Speed of Application
• Response time required (throughput) of the system
• How fast does the process change
What you need to know when specifying a PLC
• Programming Software
• IEC vs. 984
• Installed base / what is currently being used
• User Logic
• Size and complexity of Program
• Feedback control used
• etc.
Basic addressing
• For the Allen-Bradley PLCs and the simulator used, the input and
output image areas (in addition to other data) are held in “data files”
• Each “data file” holds information such as
• – Discrete input values
• – Discrete output values
• – Values associated with timers
• – Values associated with counters – Status information
• – etc.
Basic addressing
”
Most industrial networks transfer bits of information serially.
93
Output latch (OTL)
• The OTU instruction is used only to turn a bit off and latch it off
On/Off
Branches
– Logical AND
– Logical OR
– Logical NOT
• Commonly used ladder logic sequences
Start-stop-seal circuits
– Basic interlocks
• Properly formatted outputs
Boolean logic control programs
Boolean logic control programs examine and control on and off states
– Boolean here is used interchangeably with the word “discrete”
Example
– If (a part is on the conveyor)
AND (there is not a box in the
chute) THEN (turn the conveyor
motor on).
Ladder logic rungs should be formatted so the reader can easily infer the
meaning of the intended logic
One mechanism to help this is the grouping of related signals within an area
on a given rung of logic
For example:
– Group signals together that have some common intent
• Start signals
• Stop signals
• Emergency stop signals (E-stop)
• Interlocks
– Controls that might have greater importance (i.e. E-stop) might be located
on the left hand side of the rung if possible
Formatting considerations
Properly formatted outputs
LOGIC DESIGN
Design ideas can be converted to Boolean equations directly, or with other
techniques discussed later.
The Boolean equation form can then be simplified or rearranges, and then
converted into ladder logic, or a circuit.
Process Description:
A heating oven with two bays can heat one
ingot in each bay. When the heater is on it
provides enough heat for two ingots. But, if
only one ingot is present the oven may
become too hot, so a fan is used to cool the
oven when it passes a set temperature.
Boolean logic design
Control Description:
If the temperature is too high and there is an ingot in only one
bay then turn on fan.
Define Inputs and Outputs:
B1 = bay 1 ingot present
B2 = bay 2 ingot present
F = fan
T = temperature overheat sensor
Boolean logic design
Boolean Equation:
Boolean logic design
Boolean Equation:
Boolean logic design
Boolean Equation:
Boolean logic design
A Burglar Alarm
When activated an alarm and lights will be activated to
encourage the unwanted guest to leave.
This alarm be activated if an unauthorized intruder is
detected by window sensor and a motion detector.
The window sensor is effectively a loop of wire that is a
piece of thin metal foil that encircles the window. If the
window is broken, the foil breaks breaking the conductor.
This behaves like a normally closed switch.
The motion sensor is designed so that when a person is
detected the output will go on. As with any alarm an
activate/deactivate switch is also needed.
Boolean logic design
A Burglar Alarm
The inputs and outputs are chosen to be;
A = Alarm and lights (1 = on)
W = Window/Door sensor (1 = OK)
M = Motion Sensor (0 = OK)
S = Alarm Active switch (1 = on)
A Burglar Alarm
Truth Table for the Alarm
Boolean logic design
A Burglar Alarm
Boolean logic design
Problem:
The rows and columns are chosen from the input variables.
The decision of which variables to use for rows or columns can be arbitrary - the
table will look different, but you will still get a similar solution.
For both the rows and columns the variables are ordered to show the values of
the bits using NOTs.
Karnaugh maps
The sequence is not binary, but it is organized so that only one of the bits changes at
a time, so the sequence of bits is 00, 01, 11, 10 - this step is very important.
Next the values from the truth table that are true are entered into the Karnaugh map.
Given
A = Alarm and lights switch (1 = on)
W = Window/Door sensor (1 = OK)
M = Motion Sensor (0 = OK)
S = Alarm Active switch (1 = on)
Q = Alarm Quiet (0 = quiet)
Karnaugh maps
Problem:
Steps:
1. The barrier is closed waiting for the closed limit switch.
2. The barrier is idle at the bottom waiting for loop detector.
3. The barrier is open, waiting for the open limit switch.
4. The barrier is idle at the top waiting for the IR signal.
Timer
Objectives
Describe PLC retentive and delay timer functions.
Timer Variables
One major advantage of the PLC timer is that its time may be
a programmable variable time as well as a fixed time.
Non-retentive Timers
• A single-input timer called a non-retentive timer is used in
some PLCs.
– Energizing I:1/0 causes the timer to run for 4 seconds.
– At the end of 4 seconds the output (DN) goes on. When
the input is de-energized, the output goes off and the timer
resets to 0.
– If the input I:1/0 is turned off during the timing interval (for
example, after 2.7 seconds), the timer resets to 0.
– TON is the basic non-retentive timer in Allen-Bradley PLCs
Timer
Non-retentive Timers
Timer
Timer Information
• The timer table contains all information for that timer
Function Applications
• On delay
– Output B comes on at a specific set time after output A is
turned on. When A is turned off, B also goes off.
• Limited on time
– A and B go on at the same time. B goes off after specific
set time period, but A remains on.
Timer
Function Applications
• One-shot operation
– Output B goes on for a specified time after output A is
turned on. Output B will run for its specified time interval
even if A is turned off during the B timing interval.
Write ladder logic that will give the following timing diagram
for B after input A is pushed.
After A is pushed any changes in the state of A will be
ignored.
Timing diagrams
Advanced functions
Timing diagrams
Red : 20s
Green : 15s
Yellow : 5s
0 20 35 40
https://drive.google.com/file/d/1E5HaR77o00fGhUbMof
w8hMHjGWZ6tCXh/view?usp=sharing
Flowchart-based design
Flowchart-based design
https://www.youtube.com/watch?
v=S-JPz8bMFow
Block logic
Block logic
The first step is to name each block in the flowchart. Each of the
numbered steps will then be converted to ladder logic.
To do this we will use the MCR (Master Control Relay) instruction
(it will be discussed in more detail later.)
If the first MCR line is true then the ladder logic on the following
lines will be scanned as normal to the second MCR.
If the first line is false the lines to the next MCR block will all be
forced off. If a normal output is used inside an MCR block, it may
be forced off. Therefore latches will be used in this method.
Block logic
The first part of the ladder logic required will reset the logic
to an initial condition, as shown
Block logic
The line will only be true for the first scan of the PLC, and at
that time it will turn on the flowchart block F1 which is the
reset all values off operation. All other operations will be
turned off.
Block logic
STEP 2: Write ladder logic to force the PLC into the first state
The ladder logic for operation F6 turns the outlet valve on and turns off the inlet
valve.
The general sequence of states might be idle, scan card, get secret
number, select transaction type, ask for amount of cash, count cash,
deliver cash/return card, then idle.
A state based system can be described with system states, and the
transitions between those states.
State based design
If the system is in state 1 and A happens the system will then go into
state 2, otherwise it will remain in State 1.
Likewise if the system is in state 2, and B happens the system will return
to state 1.
State based design
An automatic light controller
When the power is turned on the system will go into the lights off state. If
motion is detected or an on push button is pushed the system will go to
the lights on state. If the system is in the lights on state and 1 hour has
passed, or an off pushbutton is pushed then the system will go to the
lights off state.
The else statements are omitted on the second diagram, but they are
implied.
State based design
Priority Problems
State based design
State based design
State Equations
State diagrams can be converted to Boolean equations and then to Ladder Logic.
The first technique that will be described is state equations. These equations
contain three main parts. To describe them simply - a state will be on if it is
already on, or if it has been turned on by a transition from another state, but it will
be turned off if there was a transition to another state.
Informally,
State X = (State X + just arrived from another state) and has not left for another state
State based design
State Equations
State based design
State Equations
State based design
State Equations
State based design
Draw state-based
Equations
Program
Simulate
State based design
State-Transition Equations
A state diagram may be converted to equations by writing an equation for
each state and each transition.
These are then used to write the equations for the diagram. The transition
equations are written by looking at the each state, and then determining
which transitions will end that state.
State based design
State-Transition Equations
State based design
State-Transition Equations
State based design
State-Transition Equations
State based design
State-Transition Equations
State based design
State-Transition Equations
State based design
State-Transition Equations
3. Given the following state diagram, use equations to implement ladder logic.
State based design
3. Given the following state diagram, use equations to implement ladder logic.
State based design
3. Given the following state diagram, use equations to implement ladder logic.
State based design
Button A is located inside and button B is located outside. When either button is
pushed the motor will be turned on to open the door. The motor is to be kept on for a
total of 15 seconds to allow the person to enter. After the motor is turned off the door
will fall closed. In the event that somebody gets caught in the door the thermal relay
will go off, and the motor should be turned off. After 20,000 cycles the door should
stop working and the light should go on to indicate that maintenance is required.
State based design
b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design
b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design
b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design
b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design
https://drive.google.com/file/d/1kluzvfH8_fnYAdc9WNJn7j
QoPvEk9qPS/view?usp=sharing
Subroutine
0 T1 T2 T3
https://drive.google.com/file/d/12cU0hMS_Etnbb_GHC-
f_Z4VHDe-d3uzz/view?usp=sharing
1769-IF4 Analog Input
Configure range of voltage input
-10V…10V DC
0…10V DC
0 …5V DC
1…5V DC
Configure range of current input
0…20mA
4…20mA
Connecting voltage and current Sensors
Analog Input Module, connecting voltage sensors
Configure range of voltage input
-10V…10V DC
0…10V DC
0 …5V DC
1…5V DC
Analog Input Module, connecting current sensors
https://drive.google.com/file/d/1JVRBTS7DAUuJ6MLH4H_x9taN9dTc4WSv/view
Analog
ENHANCE INSTRUCTIONS
Each device has a EDS (Electronic Data Sheet) file. EDS files
include Class, Instance and Attributes
Class : File
Instance : Structure
Attributes : Element
Software uses EDS information to access data from devices
ENHANCE INSTRUCTIONS
The ladder logic functions are FFL to load the stack, and
FFU to unload it.
Stacks
The first time this FFL is activated (edge triggered) it will grab the word
(16 bits) from the input card I:001 and store them on the stack, at N7:0.
The next value would be stored at N7:1,and so on until the stack length
is reached at N7:4.
Stacks
When the FFU is activated the word at N7:0 will be moved to the output
card O:003. The values on the stack will be shifted up so that the value
previously in N7:1 moves to N7:0, N7:2 moves to N7:1, etc. If the stack is
full or empty, an a load or unload occurs the error bit will be set R6:0/ER.
Stacks
The LIFO stack commands are shown above. As values are loaded on
the stack the will be added sequentially N7:0, N7:1, N7:2, N7:3 then
N7:4. When values are unloaded they will be taken from the last loaded
position, so if the stack is full the value of N7:4 will be removed first
Stacks
When the FFU is activated the word at N7:0 will be moved to the output
card O:003. The values on the stack will be shifted up so that the value
previously in N7:1 moves to N7:0, N7:2 moves to N7:1, etc. If the stack is
full or empty, an a load or unload occurs the error bit will be set R6:0/ER.
Add-ins Instructions
High-speed counter
Applications