Lecture 3 PLC Programming Language
Lecture 3 PLC Programming Language
Tutor: Masenga, B.
Dept: Mechanical Engineering Department
Contact: +255743021307
Email: [email protected]
Lecture 7: PLC Programming Language
3
Relay logic system
o PLCs are the successors of relay logic systems, which are
control systems that monitor and control low-level devices like
switches, relays, timers, actuators, and motors. In relay logic
systems, relays perform logic operations, known as relay logic,
by activating and deactivating magnetic coils in electric
circuits.
o Relays can connect circuits that use different currents and
voltages so, historically, they were ideal for controlling and
coordinating different industrial automation devices.
o The disadvantage of a relay logic system is that, like a
switchboard, it is hard-wired and difficult to maintain due to
the multiplicity of wires. The development of microcontrollers
solved this problem by enabling relay logic processes to be
coded programmatically and to be stored on a computer.
4
Five PLC components
o A typical PLC is connected to a power supply and consists of a
Central Processing Unit (CPU), Memory [ROM, and RAM],
Input (I) Modules, Output (O) Modules, and a Power Supply
(PS).
5
Five PLC components
1. Power supply: The power supply converts alternating current
(AC) to direct current (DC). DC is used by the CPU and I/O
components.
2. CPU: As with a PC, the CPU is the brain of a PLC. The CPU
has two operational modes: programming mode and run mode.
In programming mode, the CPU downloads logic in the form
of programming instructions created by a user on a PC. In run
mode, the CPU executes the logic.
o The CPU controls all PLC operations according to the
programming instructions stored in memory. A control bus
system transfers information to and from the CPU.
3. Memory and storage: ROM stores operating system data and
drivers. RAM stores the status of, and details about, input and
output data, and application programs.
6
Five PLC components
4. Input (I) modules: These can be named as DI, a combination of a
DI/DO. A PLC receives or senses data from input devices like
proximity and photoelectric sensors, keyboards, level meters,
timers, counters, temperature and pressure switches. The concept
of sensing data refers to the nature of PLC input data which comes
in the form of electronic signals.
⁃ Digital input cards handle discrete signals, for example on/off
signals.
⁃ Analog input cards convert voltage/current into numbers the
CPU can understand.
7
Five PLC components
5. Output (O) modules: These can be named as DO, a combination
of a DI/DO. An Output (O) modules receives information or
commands from a PLC or senses data from a PLC. A PLC outputs
include the console lights, electromechanical valves, starter
motors, drives, actuators, solenoids, alarms, control relays,
printers, and pumps, I/P converter etc. The output modules are
categorized as:
⁃ Digital output cards turn devices on and off, for example a light.
⁃ Analog output cards convert digital numbers to voltage/current,
for example to drive machinery.
8
PLC Installation and programming devices
o Rack: A PLC rack can be compared to a car’s chassis with
which other components are connected. The connected
components in a PLC rack are grouped into three sections: the
CPU, multiple I/O modules, and the power source.
o PLCs can make logical decisions and perform actions based
on the input data they receive, for example processing input
data and sending processed data to an output device. The
processing of input data is executed by a programming device.
o Programming device: Is usually a PC, console, or hand-held
proprietary device. I/O modules direct input signals into a
PLC's CPU where output signals are created.
9
PLC Installation and programming devices
o Communication: I/O modules are responsible for transferring
information between the PLC and communication networks.
o Modbus RTU is a serial communication protocol often used in
industrial communication networks to transmit data over long
distances. Serial communication protocols, however, lack the
performance and speed of Ethernet protocols. Ethernet
protocols used by PLCs include Ethernet TCP/IP, Modbus
TCP/IP, and ProfNet, which are used to connect to plant
networks and to the internet. Proprietary protocols may be
customized for proprietary devices. Universal Serial Bus (USB)
protocols are used to connect to drivers and printers. For
wireless devices, the Bluetooth protocol may be used.
10
PLC Installation and programming devices
o PLC life cycle: A PLC performs four basic operational
functions. First, it scans any connected input devices for their
operational status. Second, it executes a program that
determines what should happen with the input data. Third, it
generates executed output data. Fourth, it uses an operational
housekeeping function to perform internal diagnostics.
o Human machine interface (HMI): PLCs use a range of ports
and communication protocols to connect to control applications
like supervisory control and data acquisition (SCADA) systems.
o Operators at industrial plants and line managers interact with a
PLC in real time using an HMI. An HMI is the operator's
dashboard, that is, the interface between a person and the PLC.
An HMI allows an operator to coordinate, manage, and control
industrial processes and devices.
11
Types of PLC
Compact PLC
oCompact Type PLC comes with all in one package. It means
that the PLC has an inbuilt power supply, processor (CPU),
and a limited number of inputs and outputs integrated.
oThe compact type PLC, can use the expansion modules to
add more number of inputs and outputs to the existing
compact PLC as these have a limited number of I/O’s by
default.
12
Modular PLC
o Modular Type PLC is a rack-based system with individual
Power supply, Processor, Various IO modules, Extension
units, mounted on one or more racks.
o In modular type PLC, each component or module has
independent cards, these may be CPU card, Analog input
card, Digital output card, a communication card, etc.
13
Top 5 PLC Vendors
o Siemens: The company has brands like STEP 7
200/300/400/1200/1500 with a TIA Portal software or
Simatic Manager. Logo PLC with Logo comfort software.
o Rockwell Automation: The company has brands like
Allen-Bradley and Rockwell Software.
o Mitsubishi Electric Corporation
o Schneider Electric
o Omron Corporation
14
Some of Siemens PLC
o These includes STEP 7 or S7_1500CPU, S7_1200CPU,
S7_400CPU, S7_300CPU, and S7_200 CPU in which each
CPU has its Serial number.
Siemens PLC programming Languages
o Ladder Logic Diagram (LAD) is commonly used language.
o Function Block Diagram (FBD),
o Structured Control Language (SCL),
o Structured Text Language (STL),
o Sequential Function Chart (SFC),
o Instruction List Language (ILL).
Ladder logic uses graphical diagrams based on relay
circuit hardware to express and specify the logical structure
of processes in PLC software applications. Ladder logic
code looks like an electrical schematic.
15
I/O Address: PLC this is likely to be just a number,
prefixed by a letter to indicate whether it is an input or an
output. Thus for the Mitsubishi PLC we might have inputs
with addresses X0, X1, X2, etc., and outputs with addresses
Y0, Y1, Y2, etc., the X indicating an input and the Y an
output. For siemens and Allen Brandley PLC we might
have inputs with addresses I0.0, I0.1, I0.2……I0.7, I1.0,
I1.1, I1.2….I1.7, I2.0 etc., and outputs with addresses
Q0.0, Q0.1, Q0.2, Q0.3, Q0.4……Q0.7, Q01.0, Q1.1,
Q1.2……Q1.7, Q2.0 etc., the I indicating an input and the
Q an output.
OB: Organization blocks are the interface between the PLC
operating system and the control program. Main Cyclic OB
is cyclically executed by the operating system.
16
DB: A data block DB is a memory area that is used to save
the values of the parameters that are written during the
execution of the PLC program. Opposite to the code block,
the data block DB contains only variable declarations. It
doesn't have any networks or instructions like an FC or an FB
has.
FC: A Function (FC) is a code block without memory. A
function gives the option to transfer parameters in the user
program.
FB: An function block (FB) is a function that "remembers",
or "keeps score" of its last operations.
Both FCs and FBs can hold parameters (IN, OUT, IN-OUT
and TEMP), it allows the re-use of the blocks with different
calling environments. But FBs have an extra type of
parameter: STATIC not available in FCs.
FB: An function block (FB) is a function that "remembers“. 17
⇒ The main difference is, FC has no instance memory, while FB has
an instance Data Block (DB). This instance data block saves all the
parameters of In, Out, In-Out, and Statics. They can be accessible
even after the execution of FB.
Both FC or FB can be programmed with FBD, LAD, STL, SCL, SFC
and ILL.
FB and FC are two types of subroutines that make STEP 7 a very
flexible and powerful tool. As subroutines, FC and FB can be used to
optimize the programming. Main uses for FC and FB:
‒ Divide and organize the user program. Divided in small parts the
units can be easily understood. This helps specially maintenances
and alterations of the program.
‒ Rationalize and optimize the programming. FC and FB can be
created and used as users’ library. So, an algorithms is programming
just one time, and can be used many times in one our more projects.
‒ Reduce and rationalize resources of the CPU (e.g. memory
occupation).
18
I do look forward to your sustainable interest!
THANK YOU!
19