EEE4118 Lecture 4 PLC and SCADA 2023
EEE4118 Lecture 4 PLC and SCADA 2023
Manufacturers
ABB/Elsag Bailey/Alfa Laval GE-Fanuc Pilz
Alfa Laval/ABB/Elsag Bailey GE-Fanuc/Eberle (Europe) Pixsys
Allen-Bradley Gefran/SIEI PLC Direct/Koyo/AutomationDirect
ALSTOM/Cegelec Giddings & Lewis Poscon
•
Aromat/Matsushita Gould/Modicon Reliance
Siemens Array Electronics Groupe Schneider Rockwell Automation
• ABB CNI
Control Microsystems
Jetter gmbh
Keyence Corporation
Siemens/Moore Products
Sigmatek
• Omron Delta
Divelbiss
LG Industrial Systems
Liyan Electric
SPLat/Microconsultants
Square D
• Phoenix Contact Eberle/GE-Fanuc (Europe)
Elsag Bailey/ABB/Alfa Laval
Matsushita (Europe)/Aromat
Messung
Teco a. s.
Tele-Denken/SoftPLC
• Yokogawa Elsist
Entertron
Microconsultants/SPLat
Mitsubishi
Telemecanique
Toshiba
Fatek Automation Modicon/Gould Toyoda/Toyopuc
Festo/Beck Electronic Moore Products/Siemens Triangle Research
FF Automation Nyquist/P8 Triconex
Fisher & Paykel Omron Unitronics
Opto22 Yokogawa
PLCs
• Often PLC systems are expensive relative to the component cost of the processor
in them, but consider the Value At Risk in monetary or human terms:
• A motor car production line producing 1 vehicle every 10 minutes, may generate a
profit of say US$100k per hour
• A petroleum refinery may generate a profit of US$1M per day and have strategic
importance to the economy of the country
• A surgical robot, lift automation, manufacturing robot, …
• Traffic lights, lifts, cranes, conveyer belts, …
• PLCs generally have a deterministic cycle time and process inputs, logic,
calculations and outputs.
• Because of the conservative nature of the PLC user industry and manufacturers
not having commercial scale production volumes, PLC’s generally seem to be a
decade out of date.
5
Benefits of PLCs
• Flexibility: Compared to hard-wired relay approach PLCs are enormously flexible.
• Relays physically wired according to a particular control strategy. Strategy change
physical change to wiring.
• E.g. Implementing a delay required electrician to buy a timer, take the plant down
and wire it in.
• PLC solution is simpler. Inputs are wired into input modules. Given a specific set of
inputs and outputs, the programmer can implement and change the control strategy
by downloading a new set of instructions. Connection between inputs and outputs is
soft and is easily changed.
• Maintenance: Programmable controllers allow online monitoring. The status of
contacts (alarms, trips etc.) is readily available to non-engineering users. In places
where skilled people to maintain PLCs are in short supply, because of the
modularity of the units, it is easy to keep them going following a plug and swop
approach.
Benefits of PLCs
• Reliability: Semiconductor technology in PLCs is far more reliable than technology of
relays or other mechanical devices. (Fewer failure modes.)
• Offset by the fact that a single component failure on a PLC can have more widespread
consequences.
• Diagnostics and speed to repair is thus very important
• PLC hardware is industrial grade and reliable.
• PLCs not immune to hardware problems (RF interference caused air compressor PLC to trip)
• Hacking via sophisticated cyberattacks – Stuxnet worm infected PLCs running Siemens Step 7
software and destroyed centrifuges on Iran’s nuclear programme
• Alarming example is a cyber attack against a safety system.
• Environment: The PLC is designed to be rugged, but it isn’t as robust as a relay system.
PLC systems you be mounted in reasonable environments (corrosion, dust, humidity and
temperatures).
• Ensure that you have a good power supply (preferably UPS but spike free as a minimum)
and proper earthing. (Welding, lightning, …)
Siemens S7-2000 Processor
8
Delta UT-12SE-A Starter Kit
9
PLC I/O
10
PLC Architecture Architecture of the PLC
• CPU
• Normally the processor is a standard general CPU
• Memory
• Usually flash memory (used to be battery
backed up RAM or EEPROM). Protection against
unauthorised changes. Start-up state of
memory must be well defined.
16
Programming: IEC 61131
Configuration
Resource Resource
Execution
control path
Access path
17
Configuration (plcopen.org)
• At the highest level, the entire software required to solve a particular control problem
can be formulated as a Configuration.
• A configuration is specific to a particular type of control system, including
• the arrangement of hardware, processing resources,
• memory addresses for I/O channels & system capabilities.
• Within a configuration one can define one or more Resources. A resource is a processing
facility that is able to execute IEC programs.
• Within a resource, one or more Tasks can be defined.
• Tasks control the execution of a set of programs and/or function blocks.
• can either be executed periodically or on a specified trigger, such as the change of a variable.
• Programs are built from a number of different software elements written in any of the
IEC defined languages.
• A program consists of a network of Functions and Function Blocks, which can exchange
data. These are basic building blocks, containing a data structure and a algorithm.
18
Configuration vs PLC (also from
plcopen.org)
• Compare a “Configuration” to a conventional PLC: Latter contains one resource,
running one task, controlling one program, running in a closed loop.
• IEC 61131-3 adds much to this: We now expect multi-processing and event driven
programs, distributed systems and real-time control systems.
19
Programming: IEC 61131
• IEC 61131 standardises common elements:
• configurations, resources, tasks, global variables, access paths, data types.
• IEC 61131 also defines a few programming languages:
• Textual:
Instruction List (IL) Structured Text (ST)
• Instruction List, IL
• Structured Text, ST LD A
• Ladder Diagram, LD ST C
AND
A B C
A C
-| |--|/|----------------( )
B
20
ISP Soft manual – Page 12-2
Ladder Logic
• A graphical programming language for PLCs
• Was originally designed for the construction of relay racks
• Consists of “rungs” where power flows from left to right
• Each rung can have a number of contacts and a single coil
• The contacts and coils represent Boolean states
22
(Relay) Ladder Logic
• Early PLCs were for logic replacement and they emulated relays which had
normally open -| |- and normally closed -|/|- contacts.
• (normally = un-energised condition).
• This allows the implementation of AND and OR functions.
• Relay coils are then represented by -()-.
• There are also timer and latching coils.
• E.g. A motor is energised
• IF ((the start button is pressed)
OR (the motor is already energised))
AND (the stop button is NOT pressed)
I.0
O.1 M1
24
Logic Diagrams
TAG FUNCTION
10062 start
00007 run
• Some PLCs offer this form of representation.
10006 power
• The logic of the example above may be 10010 ~trip
expressed as the following logic statement:
10019 ~stop
00007 is on WHEN (10062 OR 00007) AND
10006 AND 10010 AND NOT(10002) AND • The logic diagram would look as follows:
NOT(10019)
• Alternately OR
10062
AND 00007
run WHEN (start OR run) AND auto AND power
AND NOT(trip) AND NOT(stop) 10006
10010
AND
10002
10019
ISP Soft manual
Function Blocks (plcopen.org)
• Standard functions
ADD, SQRT, SIN, COS, GT, MIN, MAX, AND, OR, etc.
END_VAR
SIMPLE_FUN := A*B/C;
END FUNCTION
Function Block example:
Hysteresis (plcopen.org)
FUNCTION_BLOCK HYSTERISIS
VAR_INPUT
Hysterisis
XIN1, XIN2 : REAL;
REAL XIN1 Q BOOL EPS : REAL; (* Hysterisis band *)
REAL XIN2 END_VAR
VAR_OUTPUT
REAL EPS Q : BOOL := 0
END_VAR
IF Q THEN
Q IF XIN1 < (XIN2-EPS) THEN
Q := 0 (* XIN1 decreasing *)
1 END_IF;
ELSIF XIN1 > (XIN2 + EPS ) THEN
0 Q := 1; (* XIN1 increasing *)
END_IF;
EPS EPS
END_FUNCTION_BLOCK
XIN2
RSLogix 500 Example
2023/02/27 29
PID in Delta
2023/02/27 30
Structured Text
A high-level language that is block structured and syntactically
PROGRAM Monitor_Start_Stop // Actual Program
resembles Pascal, on which it is based
VAR_EXTERNAL
Start_Stop : BOOL;
// PLC configuration
ON_OFF : BOOL;
CONFIGURATION DefaultCfg
END_VAR
VAR_GLOBAL
VAR // Temporary variables for logic handling
b_Start_Stop : BOOL; // Global variable to represent a boolean.
ONS_Trig : BOOL;
b_ON_OFF : BOOL; // Global variable to represent a boolean.
Rising_ONS : BOOL;
Start_Stop AT %IX0.0:BOOL; // Digital input of the PLC (Address 0.0)
END_VAR
ON_OFF AT %QX0.0:BOOL; // Digital output of the PLC (Address 0.0). (Coil)
END_VAR
// Start of Logic
// Schedule the main program to be executed every 20 ms // Catch the Rising Edge One Shot of the Start_Stop input
TASK Tick(INTERVAL := t#20ms); ONS_Trig := Start_Stop AND NOT Rising_ONS;
PROGRAM Main WITH Tick : Monitor_Start_Stop; // Main Logic for Run_Contact -- Toggle ON / Toggle OFF ---
END_CONFIGURATION ON_OFF := (ONS_Trig AND NOT ON_OFF) OR (ON_OFF AND NOT
ONS_Trig);
2023/02/27 31
Advantages/Disadvantages
• Advantages
• Low memory usage
• Straightforward to implement complex algorithms
• Code is portable
• Syntax is familiar for anyone who has programmed in Basic, Pascal, C++, C#, Java,
Python?)
• Version control simple via comments in code
• Disadvantages
• Harder to understand than FBs
• Therefore harder t debug
• Many programs nowadays consist of FBs with code added where necessary
2023/02/27 32
Grafcet (Sequential Function
Chart SFC)
• Grafcet is a higher level programming technique that
uses state and state transition approach. It is an
excellent technique for specifying PLC code, although Step 1 N FILL
there are only a small number of PLC manufacturers
that support it. Nonetheless it is a valuable tool for Transition 1
defining the system specification, even if it is then
manually translated into ladder logic. Step 2 S Empty
Transition 2
• Grafcet essentially consists of two symbols, the step
and the transition, which are joined by directed links. Step 3
The Step
• A step may be either active or
inactive.
Input to step
• If active its associated action
list will be executed.
• The actions may affect
Step 12 12. Action List outputs directly or involve
internal operations (timers,
arithmetic, internal coils
Note: the . next to 12 indicates that the etc.).
Output from step step is active
• At any point in time the set
of active steps defines the
state of all inputs and
outputs of the PLC
The Transition
• Each step has a transition preceding and
following it.
• A transition allows control to pass from one
Input to step to the next when the receptivity for
Transition the transition is satisfied.
• A transition is either enabled or disabled.
• It is enabled when all preceding steps are
Start Button Pressed (Receptivity) active.
Output
• Each transition has an associated receptivity.
• This is a logical proposition than can be true
or false. This logical proposition is a
function of external inputs and or internal
information (counters, the result of a
comparison etc.)
• When the logical proposition for an enabled
transition becomes true i.e. the receptivity is
satisfied, then all immediately preceding
steps are deactivated, and all immediately
following steps are enabled.
• The transition is cleared and becomes
disabled.
ISP Soft manual
SCADA
• Supervisory Control and Data Acquisition – the HMI for PLCs
• On the right we have a mimic – part of a display used by the
plant operators
• All about gathering data from the field, processing it in a
way that makes it easy to act e.g. trends
• Includes the structure to build alarm systems
• Provides data to the historian – for smaller plants can be the
historian
• Includes the tag database – the objects you defined!
2023/02/27 37
ISA 101 HMI Design
2023/02/27 40
Type Device name Number of devices Range
1024(AHCPU500) X0.0~X63.15
2048(AHCPU510) X0.0~X127.15
Input relay X
4096(AHCPU520) X0.0~X255.15
8192(AHCPU530) X0.0~X511.15
1024(AHCPU500) Y0.0~X63.15
2048(AHCPU510) Y0.0~X127.15
Output relay Y
4096(AHCPU520) Y0.0~X255.15
8192(AHCPU530) Y0.0~Y511.15
16384 (AHCPU500) D0.0~D16383.15
Data register D 32768 (AHCPU510) D0.0~D32767.15
Bit device
65536 (AHCPU520/530) D0.0~D65535.15
16384 (AHCPU500) L0.0~ L16383.15
Link register L 32768 (AHCPU510) L0.0~ L32767.15
65536 (AHCPU520/530) L0.0~ L65535.15
Auxiliary relay M 8192 M0~M8191
Special auxiliary relay SM 2048 SM0~SM2047
Stepping relay S 2048 S0~S2047
Timer T 2048 T0~T2047
ISP Soft manual
Counter C 2048 C0~C2047
32-bit counter HC 64 HC0~HC63
Type Device name Number of devices Range
Input relay X 512 X0~X511
Output relay Y 512 Y0~Y511
16384 (AHCPU500) D0~D16383
Data register D 32768 (AHCPU510) D0~D32767
65536 (AHCPU520/530) D0~D65535
Special data register SR 2048 SR0~SR2047
Word device 16384 (AHCPU500) L0~L16383
Link register L 32768 (AHCPU510) L0~L32767
65536 (AHCPU520/530) L0~L65535
Timer T 2048 T0~T2047
Counter C 2048 C0~C2047
32-bit counter HC 64 (128 words) HC0~HC63
Index register E 32 E0~E31
16 bits: -32768~32767
Decimal system K
32 bits: -2147483648~2147483647
16 bits: 16#0~16#FFFF
Hexadecimal system 16#
32 bits: 16#0~16#FFFFFFFF
Constant*
Single-precision floating- 32 bits: ±1.17549435E-38 ~ ISP Soft manual
F
point number ±3.40282347E+38
Non Retentive Coils (Rockwell
Automation notes)
• The referenced bit is reset when processor power is cycled
• Coil -( )-
• Sets a bit when the rung is true(1) and resets the bit when the rung is false (0)
• Negative coil -( / )-
• Sets a bit when the rung is false(0) and resets the bit when the rung is True(1)
• Not commonly supported because of potential for confusion
• Set (Latch) coil -(S)-
• Sets a bit (1) when the rung is true and does nothing when the rung is false
• Reset (Unlatch) Coil -(R)-
• Resets a bit (0) when the rung is true and does nothing when the rung is false
43
Contacts (Rockwell Automation
notes)
• Normally Open Contact -| |-
• Enables the rung to the right of the instruction if the rung to the left is enabled and
underlining bit is set (1)
• Normally Closed Contact -|/|-
• Enables the rung to the right of the instruction if the rung to the left is enabled and
underlining bit is reset (0)
• Positive transition contact -|P|-
• Enables the right side of the rung for one scan when the rung on left side of the
instruction is true
• Negative transition contact -|N|-
• Enables the right side of the rung for one scan when the rung on left side of the
instruction is false
• http://www.ibiblio.org/kuphaldt/electricCircuits/Digital/DIGI_6.html
Love, J., Process Automation Handbook: A guide to
theory and practice ”, Springer, 2007
45
Timers (Rockwell Automation
notes)
• There three timer instructions in IEC1131 Pulse (TP) Timing
• TP - Pulse timer
• TON - Timer On Delay IN
• TOF - Timer Off Delay Q
• Time values PT
• Time base is 1 ms ET |
0
Pump_Tmr
On-Delay (TON) Timing
TON IN
IN Q
Q
T#200ms PT ET 178
• IN = Rung input condition PT
ET |
• Q = Comparison output results 0