Process Control Laboratory-Student's Manual
Process Control Laboratory-Student's Manual
Process Control Laboratory-Student's Manual
+ =
t
I
c
c
dt t e
K
e K u
0
' '
where:
I
is the integral or reset time constant
5.4 Procedure-Furnace
5.4.1 Proportional Control
1. To start the furnace with control, click once on the Furnace with Control button on
the Furnace Menu (Figure 5.2). Double-click on the concentration controller block
and set the controller parameters to the following values (see Figure 5.4):
Gain of the controller (
c
K ) = 4.0 m
6
/mol min
Reset time or the integral time constant (
I
) = 1 min
Rate time or the derivative time constant (
D
) = 0
Integral Action On = 0
Derivative Action On = 0
2005 by PCS UTM
58
Figure 5.4: SIMULINK Flowsheet of the Furnace with Control
Exercise 1 Enter the initial values of the process variables in Table 1.
2. Double-click on the concentration loop switch and change its value to 1. Change the
setpoint of Oxygen Exit Concentration to 1.5 mol/m
3
. When the steady state value is
reached, record the final values in Table 1. Note the closed-loop behaviour under
proportional control.
3. From the data recorded in the table, it can be seen that the final steady state value is
not equal to the setpoint. There is a steady state error which is called an offset. This
is the principle drawback of the proportional controller. From the plots on the
Process Monitor, one can observe that the Hydrogen Outlet Temperature is also
affected by the manipulation of the Air Flow Rate. This issue will be addressed later
in this module with the use of PI control.
4. Disconnect the controller by turning off the concentration loop switch. Bring the
setpoint back to 0.922 mol/m
3
. Allow the system to return to its initial steady state.
2005 by PCS UTM
59
5. Change the controller setting to K
c
= 8.45, turn on the concentration loop, and repeat
the exercise from Step 2 through Step 4. Then, try K
c
= 13.5 and repeat again. Be
sure to record the values in Table 1 after each run.
Exercise 2 Discuss the shortcomings of proportional control observed in this
exercise.
Exercise 3 What effect did increasing the proportional gain have on the performance
of the proportional controller (in terms of offset or oscillatory response)?
5.4.2 Proportional Control for a Disturbance
6. Disconnect the controller by turning off the concentration loop. Bring the furnace
back to its initial steady state and change the Oxygen Exit Concentration Setpoint
back to 0.922 mol/m
3
. Set the tuning parameters of the controller to the following
values:
Gain of the controller (
c
K ) = 4.0 m
6
/mol min
Reset time or the integral time constant (
I
) = 1 min
Rate time or the derivative time constant (
D
) = 0
Integral Action On = 0
Derivative Action On = 0
7. Double-click on the concentration loop switch and change its value to 1. Change the
Fuel Gas Purity from 1.0 mol CH
4
/mol to 0.9 mol CH
4
/mol.
Exercise 4 Record the final steady state values of the Oxygen Exit Concentration in
Table 2.
8. Again disconnect the controller by turning off the concentration loop switch. Change
the Fuel Gas Purity to 1.0 mol CH
4
/mol.
9. Once the furnace has returned to steady state, set the gain K
c
= 8.45 and turn on the
concentration loop switch. Repeat the exercise from Step 7. Change the gain K
c
=
13.5. Repeat Step 7 again. Be sure to enter all of the data in Table 2.
5.4.3 Proportional-Integral (PI) Control
10. Bring the system to its initial steady state condition.
11. Change the controller setting to the following values:
Gain of the controller (
c
K ) = 6.45 m
6
/mol min
2005 by PCS UTM
60
Reset time or the integral time constant (
I
) = 2 min
Rate time or the derivative time constant (
D
) = 0
Integral Action On = 1
Derivative Action On = 0
12. Introduce a step change in the setpoint from 0.922mol/m
3
to 1.5 mol/m
3
.
13. When steady state is reached note the final value of the Oxygen Exit Concentration.
It should be equal to the setpoint indicating the absence of offset when the integral
action is present in the controller. Also note the overshoot (if any) and the settling
time of the system.
Exercise 5 Record your data in Table 3.
14. Change the Oxygen Exit Concentration Setpoint back to 0.922 mol/m
3
and let the
system return to its initial steady state.
15. Repeat Steps 12, 13, and 14 for the following values of the integral reset time:
I
=
5.0, 10.0, 20.0 (min). Be sure to record your data in Table 3.3.
Exercise 6 Describe the difference between closed-loop responses obtained for the
proportional (only) versus proportional-integral controllers.
5.4.4 Proportional-Integral (PI) Control for a Disturbance
16. Bring the system to its initial steady state.
17. Change the controller settings to the following values:
Gain of the controller (
c
K ) = 6.45 m
6
/mol min
Reset time or the integral time constant (
I
) = 2 min
Rate time or the derivative time constant (
D
) = 0
Integral Action On = 1
Derivative Action On = 0
18. Keep the Oxygen Exit Concentration Setpoint at 0.922 mol/m
3
. Introduce a step
change in the Fuel Gas Purity from 1.0 mol CH
4
/mol to 0.9 mol CH
4
/mol.
19. When steady state is reached note the final value of the Oxygen Exit Concentration.
It should be equal to the setpoint indicating the absence of offset when integral action
is present in the controller. Also note the overshoot (if any) and the settling time of
the system.
Exercise 7 Record your data in Table 4
2005 by PCS UTM
61
20. Change the Fuel Gas Purity back to 1.0 mol CH
4
/mol and let the system return to its
initial steady state.
21. Repeat Steps 18, 19, and 20 for the following values of the integral reset time:
I
=
5.0, 10.0, 20.0 (min). Be sure to record your data in Table 3.4.
Exercise 8 Describe the difference between closed-loop responses obtained for the
proportional (only) versus proportional-integral controllers.
5.5 Summary
In this unit you have developed proportional and proportional-integral feedback controllers
which automatically adjust the output variables by making changes in the manipulated
variables. You have also seen that the feedback control system exhibits oscillatory behaviour for
certain control settings. As the controller gain is increased to eliminate steady state offset, such
oscillatory behaviour can become pronounced and for certain controller settings the closed-loop
system can become unstable. In order to adjust or tune the controller settings, one must have
information not only about the steady state behaviour of the process, but also about its dynamic
characteristics.
2005 by PCS UTM
62
5.6 Appendix
Section: Approved by: _____________
Group:
Date:
____________________________________________________________________________
Exercise 1
Table 1 Oxygen Exit Concentration P Control Servo Response
c
K m
6
/mol min
Steady State Value Setpoint Value
0 (initial)
4
8.45
13.5
Exercise 2
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Exercise 3
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2005 by PCS UTM
63
Exercise 4
Table 2 Oxygen Exit Concentration P Control Load Response
c
K m
6
/mol min
Steady State Value Setpoint Value
0 (initial)
4
8.45
13.5
Exercise 5
Table 3 Oxygen Exit Concentration PI Control Servo Response
I
(min)
Steady State Value Setpoint Value
2 (initial)
5
10
20
Exercise 6
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Exercise 7
Table 4 Oxygen Exit Concentration PI Control Load Response
I
(min)
Steady State Value Setpoint Value
2 (initial)
5
10
20
Exercise 8
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2005 by PCS UTM
64
6
Distillation Controller Tuning
6.1 Introduction to the Virtual Process Control Lab
(VPCL)
Objective What is MATLAB? Simulink Overview of
VPCL Ending Session Summary
6.2 Objective
6.3 First-Order-Plus-Time-Delay (FOTD) Transfer
Function
Introduction Procedure - Column
6.4 Cohen-Coon Tuning Method
Introduction Procedure - Column
6.5 Summary
6.6 Appendix
6.1 Introduction to the Virtual Process Control Lab (VPCL)
6.1.1 Objective
The purpose of this module is to introduce MATLAB and SIMULINK, as well as explain the
basic operation of the Virtual Process Control Lab (VPCL).
6.1.2 What Is MATLAB?
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment where problems and solutions
are expressed in familiar mathematical notation. Typical uses include:
Math and computation
Algorithm development
Modelling, simulation, and prototyping
Data analysis, exploration, and visualisation
Scientific and engineering graphics
Application development, including graphical user interface building
2005 by PCS UTM
65
MATLAB is an interactive system whose basic data element is an array that does not
require dimensioning. This allows you to solve many technical computing problems, especially
those with matrix and vector formulations, in a fraction of the time it would take to write a
programming a scalar noninteractive language such as C or Fortran.
MATLAB has evolved over a period of years with input from many users. In university
environments, it is the standard instructional tool for introductory and advanced courses in
mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high-
productivity research, development, and analysis.
MATLAB features a family of application-specific solutions called toolboxes. Very
important to most users of MATLAB, toolboxes allow you to learn and apply specialised
technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that
extend the MATLAB environment to solve particular classes of problems. Areas in which
toolboxes are available include signal processing, control systems, neural networks, fuzzy logic,
wavelets, simulation, and many others.
6.1.3 Simulink
Simulink is a software package for modelling, simulating, and analyzing dynamic systems. It
supports linear and nonlinear systems, modelled in continuous time, sampled time, or a hybrid
of the two. Systems can also be multirate, i.e., have different parts that are sampled or updated
at different rates.
For modelling, Simulink provides a graphical user interface (GUI) for building models as
block diagrams, using click-and-drag mouse operations. With the interface, you can draw the
models just as you would with pencil and paper (or as most textbooks depict them). This is a far
cry from the previous simulation packages that require you to formulate differential equations
and difference equations in a language or program. Simulink includes a comprehensive block
library of sinks, sources, linear and nonlinear components, and connectors. You can also
customise and create your own blocks.
Models are hierarchical, so you can build models using top-down and bottom-up
approaches. You can view the system at high level, then double-click blocks to go down
through the levels to see increasing levels of model detail. This approach provides insight into
how a model is organised and how its parts interact.
After you define a model, you can simulate it, using a choice of integration methods, either
from the Simulink menus or by entering commands in the MATLAB Command Window. The
menus are particularly convenient for interactive work, while the command-line approach is
very useful for running a batch of simulations. Using scopes and other display blocks, you can
see the simulation results while the simulation is running. In addition, you can change
parameters and immediately see what happen. Because MATLAB and Simulink are integrated,
you can simulate, analyse, and revise your models in either environment at any point.
2005 by PCS UTM
66
6.1.4 Overview of VPCL
The units of VPCL are organized around the following three elements:
1. Process modelling
2. PID Controller Design and Tuning
3. Analysis and Advanced Control Design
Throughout the course, experiments involving each of these elements will be performed on
the furnace or binary distillation column. Since all of these elements interact, the final design
may involve several iterations.
The Virtual Process Control Lab (VPCL) use programs that were developed to be used with
SIMULINK and MATLAB. To start the Modules, type mainmenu. The display in Figure 6.1
will appear on the screen. From this menu you can access the various programs that will be used
in the Virtual Process Control Lab. In the next Modules, we will use the Furnace and the
Distillation Column models to demonstrate basic principles in process behaviour. If one selects
the Furnace button, then the furnace menu shown in Figure 6.2 will appear on the screen.
Clicking on the Distillation Column button will cause Figure 6.3 to appear on the screen.
Figure 6.1: Main Menu for Virtual Process Control Lab
The various modules for the control lab can
be accessed from this menu by clicking once
on the appropriate button.
2005 by PCS UTM
67
Figure 6.2: Furnace Menu
6.1.5 Ending Session
To end the session select Yes under the Quit menu from the Main Menu. This will take you back
to the MATLAB prompt. At this prompt, type quit to exit MATLAB.
6.1.6 Summary
By the end of this Module, you should have learned how to log in at the computer. You have
been introduced to MATLAB and should be able to start MATLAB and know how to run the
demonstration. You should also be able to start the Virtual Process Control Lab.
2005 by PCS UTM
68
Figure 6.3: Distillation Column Menu
6.2 Objective
In this module, transient response data will be collected which will be used to obtain a first-
order-plus-time-delay transfer function model of the Column. This model will later serve as the
basis for several types of feedback and feedforward controller design. The performance of a
feedback control system depends on the values of the controller tuning constants. The
Proportional-Integral-Derivative (PID) controller will be used in this module for the Column. A
trial and error selection process for PID controller tuning constants requires a lengthy iterative
procedure. In this module, you will be introduced to standard algorithms which produce good
initial estimates of
c
K ,
I
, and
D
.
2005 by PCS UTM
69
6.3 First-Order-Plus-Time-Delay (FOTD) Transfer
Function
6.3.1 Introduction
Typically, the transient response of a plant (even a nonlinear process such as the column) can be
approximately modelled with a first-order-plus-time-delay (FOTD) transfer function. The
mathematical description of a FOTD transfer function is as follows:
( )
1 +
=
s
e K
s G
p
s
p
p
where:
p
K is the system gain, is the time delay of the system, and
p
is the system time
constant.
Once a step change has been made in one of the inputs, the system gain, time constant. And
the time delay may be calculated from the system response. The method for obtaining these
parameters is described in most undergraduate chemical process dynamics and control
textbooks such as 28%-63% method.
6.3.2 Procedure - Column
Data Collection
In this section, the data required for obtaining a FOTD transfer function model of the column
will be collected. Open Distillation Column at Distillation Column Menu. Two runs will be
conducted. Each run will consist of:
1. Changing one of the input variables
2. Recording the time at which the input was changed
3. Allowing the column to reach a new steady state
4. Saving the four outputs to a data file
5. Returning the input variables to their initial values
6. Allowing the column to return to its initial steady state.
The first input variable that will be changed is the Vapour Flow Rate (from 0.033 to 0.05
mol/sec). A detailed explanation of the data collection procedure will be given for this run.
2005 by PCS UTM
70
(a) Open the clock display. Make sure to arrange the windows such that the clock
display is completely visible.
(b) Choose a file name for the data from this run to be saved by typing a filename in the
box located in the lower right corner of the process monitor (example: vapourflow),
see Figure 6.4.
Figure 6.4: Column Process Monitor
(c) Record the filename for the current data run.
(d) Double-click on the Vapour Flow Rate box with the left mouse button.
(e) Double-click in the white box to highlight the value to be changed.
(f) Record the time at which the Vapour Flow Rate change is implemented. Be careful:
the Vapour Flow Rate change is not implemented until you hit apply or close
with the mouse. You should notice a slight pause in the simulation at the time in
which the Vapour Flow Rate change is implemented.
(g) Once the column has reached steady state, click on the Save button located in the
lower right corner of the process monitor, see Figure 6.4, to save the data to a data
file. Be careful not to wait too long because any data that is lost when the axes
rescale is not recoverable.
Type the file name here. Click here to save data to a file.
2005 by PCS UTM
71
(h) Return the Vapour Flow Rate to its original value (0.033 mol/sec) and allow the
column to return to its original steady state before making the next input change.
You must allow the column to return to its original steady state before making
any further changes in the input variables.
Repeat Steps (b) (h) for the next run.
CAUTION: Choose a different filename for each run. Otherwise, the data from the
previous runs will be lost.
1. Increase the value of the Vapour Flow Rate (from 0.033 to 0.05 mol/sec). The
column should reach a new steady state in approximately 6000 seconds.
Exercise 1
Name of data file for this run __________________ (example: vapourflow).
Time at which the Vapour Flow Rate change is introduced _____________ sec
(from clock display).
2. Increase the value of the Reflux Ratio (from 1.75 to 2.5). The column should reach a
new steady state in approximately 6000 simulation seconds.
Exercise 2
Name of data file for this run __________________ (example: reflux).
Time at which the Reflux Ratio change is introduced _____________ sec (from
clock display).
Modelling the Column
The data files collected in the previous portion of this module will be loaded into a specially
designed graphical utility, called PCMplot to obtain transient plots of the output variables.
To start PCMplot, return to main menu and click on the Graphical Analysis button in the
lower right corner. A new menu, the Graphical Analysis Menu, will appear in the centre of
your screen. Click on the PCMplot Column button to open PCMplot. A graph similar to
the one shown in Figure 6.5 will appear.
The procedure for loading a data file will be summarised below.
3. Click on the Data option on the graphics window, see Figure 6.5, and hold down the
left mouse button. By moving the mouse downward, a menu with the following
options will appear: Load, Print, and Quit. To load a file, continue holding the left
mouse button and pull the mouse down to highlight the Load option. Release the
mouse button.
(a) A window title Load Data File should appear. Click on the data file you wish to
load.
(b) If the file loaded successfully, the following text will be displayed in your
MATLAB window:
Load selected filename
2005 by PCS UTM
72
Figure 6.5: PCMplot Graphics Window
(c) Once the data has been loaded, one can plot one of the output variables by
clicking on the Plot option at the top of the graphics window with your left
mouse button. Hold the left mouse button down and pull the mouse down to
obtain the following options: (i) Plot Var 1, (ii) Plot Var 2, (iii) Plot Var 3, and
(iv) Plot Var 4. These options are responsible for plotting the four outputs as
follows:
i. Plot Var 1 = Plot Overhead Flow Rate
ii. Plot Var 2 = Plot Overhead MeOH Composition
iii. Plot Var 3 = Plot Bottom Flow Rate
iv. Plot Var 4 = Plot Bottom MeOH Composition
(d) To plot the change in the Overhead MeOH Composition for the feedflow data
file, hold the left mouse down and highlight Plot Var 1. Release the mouse
button. A graph of the transient response of the Overhead MeOH Composition
should appear.
(e) It may be necessary to rescale the axes on the plot. This can be done using the
Trim Axes option on the View menu of the graphics window (Hold your left
mouse button on View and pull down as you have previously done to see this
menu). You will be prompted to enter new values for the upper and lower limits
for both the x-axis and the y-axis. Hint: it may be helpful to set the x-axis
lower limit equal to the time at which the change in the given input was
introduced.
(f) Once a plot of the desired output is obtained with the axes scaled as desired, a
hard copy of the plot can be obtained using the Print option under the File
menu (hold down the left mouse button and pull down underneath File on the
graphics window. Highlight the Print option and release the left mouse button).
Pull-down menus
containing PCMplot
functions.
2005 by PCS UTM
73
This will open the print options window. Selecting OK will print the current
figure to the default printer.
4. Plot the Overhead MeOH Composition and the Bottom MeOH Composition for the
Vapour Flow Rate change using PCMplot and the procedure described above. Fit a
first-order-plus-time-delay transfer function model to each of the responses. Fill in
your parameters below.
Exercise 3 Overhead MeOH Composition, G
12
Gain:
Time Constant:
Time Delay:
Exercise 4 Bottom MeOH Composition, G
22
Gain:
Time Constant:
Time Delay:
5. Plot the Overhead MeOH Composition and the Bottom MeOH Composition for the
Reflux Ratio change using PCMplot and the procedure described above. Fit a first-
order-plus-time-delay transfer function model to each of the responses. Fill in your
parameters below.
Exercise 5 Overhead MeOH Composition, G
11
Gain:
Time Constant:
Time Delay:
Exercise 6 Bottom MeOH Composition, G
21
Gain:
Time Constant:
Time Delay:
6.4 Cohen-Coon Tuning Method
6.4.1 Introduction
Cohen-Coon method is a classical algorithm for PID controller tuning. This method yields
controllers with the most a 0.25 value of the decay ratio (ratio of second peak to first peak in an
2005 by PCS UTM
74
oscillatory response). While this leads, in principle, to an attenuation of oscillations, this
technique typically leads to controllers with an aggressive response.
The Cohen-Coon tuning method requires an open-loop first-order-plus-time-delay transfer
function model of the process. This can be obtained from a process reaction curve, generated
from a step input. From the identified effective gain, time constant and dead time (
p
K ,
p
, ),
one can tune the controller using the rules which are summarized below:
Controller
Type
Controller Gain Reset Time Derivative
Time Constant
P
=
p
p
p
c
K
K
3
1
1
PI
=
p
p
p
c
K
K
12 10
9 1
+
+
=
p
p
I
20 9
3 30
PID
=
p
p
p
c
K
K
4 3
4 1
+
+
=
p
p
I
8 13
6 32
P
D
2 11
4
+
=
Before you start the procedure, perform the following sequence of steps:
1. From the Distillation Menu click on the Column with Control button.
2. Make sure that both of the feedback loops are in manual by setting the loop switch
blocks to the off position.
3. Start the simulation.
4. Make sure that the controller is properly tuned.
5. Allow the simulation to reach steady state before changing either of the feedback loops
to automatic.
6.4.2 Procedure - Column
1. Tune the Bottom MeOH Composition controller with the proportional-integral (PI)
controller tuning constants that you calculated from the Cohen-Coon tuning rules. Make
sure that the integral action is On and the derivative action is Off. Introduce a new
setpoint on the Bottom MeOH Composition of 0.1 mol MeOH/mol total.
Exercise 7 Sketch the response.
2. Reset the Bottom MeOH Composition to its initial value, 0.15 mol MeOH/mol total.
Once the system has returned to steady state, change the controller parameters to the
PID settings obtained with the Cohen-Coon tuning rules for the Bottom MeOH
2005 by PCS UTM
75
Composition. Make sure that integral action and derivative action are both On.
Introduce a new setpoint on the Bottom MeOH Composition of 0.1 mol MeOH/mol
total.
Exercise 8 Sketch the response.
Exercise 9 How does the PID-controlled response differ from the PI-controlled
response?
3. Return the system to steady state by setting the Bottom MeOH Composition Setpoint to
0.15 mol MeOH/mol total. Tune the Overhead MeOH Composition controller with the
proportional-integral (PI) controller tuning constants that you calculated from the
Cohen-Coon tuning rules. Make sure that the integral action is On and the derivative
action is Off. Introduce a new setpoint on the Overhead MeOH Composition of 0.9 mol
MeOH/mol total.
Exercise 10 Sketch the response.
4. Reset the Overhead MeOH Composition to its initial value, 0.85 mol MeOH/mol total.
Once the system has returned to steady state, change the controller parameters to the
PID settings obtained with the Cohen-Coon tuning rules for the Overhead MeOH
Composition. Make sure that integral action and derivative action are both On.
Introduce a new setpoint on the Overhead MeOH Composition of 0.9 mol MeOH/mol
total.
Exercise 11 Sketch the response.
Exercise 12 How does the PID-controlled response differ from the PI-controlled
response.
6.5 Summary
Closed-loop performance of control systems is greatly affected by the selection of controller
tuning parameters. Trial and error methods to obtain controller tuning constants require many
iterations. One of the methods is presented in this unit which provide good initial values for
controller tuning.
2005 by PCS UTM
76
Appendix
Section: Approved by : _____________
Group:
Date:
____________________________________________________________________________
Exercise 1
Name of data file for this run __________________ (example: vapourflow).
Time at which the Vapour Flow Rate change is introduced _____________ sec (from clock
display).
Exercise 2
Name of data file for this run __________________ (example: reflux).
Time at which the Reflux Ratio change is introduced _____________ sec (from clock display).
Exercise 3 Overhead MeOH Composition, G
12
Gain:
Time Constant:
Time Delay:
Exercise 4 Bottom MeOH Composition, G
22
Gain:
Time Constant:
Time Delay:
Exercise 5 Overhead MeOH Composition, G
11
Gain:
Time Constant:
Time Delay:
Exercise 6 Bottom MeOH Composition, G
21
Gain:
Time Constant:
Time Delay:
2005 by PCS UTM
77
Exercise 7 Sketch the response.
Exercise 8 Sketch the response.
Exercise 9 How does the PID-controlled response differ from the PI-controlled response?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2005 by PCS UTM
78
Exercise 10 Sketch the response.
Exercise 11 Sketch the response.
Exercise 12 How does the PID-controlled response differ from the PI-controlled response?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2005 by PCS UTM
79
7
Programmable Logic Controller
7.1 Objective
7.2 Definition of PLC
7.3 Classes of PLCs
Compact Modular
7.4 Elements and Description
Power supply Processor unit Inputs Outputs
Communication interface
7.5 Sensor and Actuators
Sensors Actuators User Interface
7.6 Uses of the PLC
7.7 Software: Recall of Digital Electronics
7.1 Objective
Introduce the student to one of the most used Tools in control systems in the industry: the
programmable logic controller.
7.2 Definition of PLC
1) An electronic device which receives inputs in form of digital or analog data and process
them via a programmed sequence using timers, counters and mathematical elements to
generate outputs to control a determined process or processes.
2) A class of industrial devices that perform logic functions that replace Electro-
mechanical and solid state logic and other control functions.
7.3 Classes of PLCs
There are two classes of PLCs: modular and compact.
2005 by PCS UTM
80
3.1-Compact: It is the one that contains all the components of the PLC in one box. This
type or class of PLCs are used in systems that do not have many inputs and outputs and
can be seen in machinery automation and small processes.
3.2-Modular: It is the one that has all the elements (power supply, processor, inputs,
outputs, etc) separated by functions and are interconnected via a rack or base. This is
the most widely used class in the industry and the one we will use.
7.4 Elements and Description
4.1-Power supply(A): It is the source of power to all the elements of the PLC. There are
different types of power supplies and they are used depending on the requirements of
the application.
4.2-Processor unit: this unit is where all the processing is done. This unit receives all
the information from the inputs, processes them and sends information to the outputs.
4.3- Inputs: They are the elements that receive information from the field or process and
transfer them to the processor. That information can be analog or digital data.
4.4-Outputs: These are the blocks that establish the interface between the processor and
the variables to be controlled in the process. Also they can be analog or digital.
4.5-Communication interface: There are many networks for the SLC (we will focus on
the Controlnet) and so are interfaces. We will use the dh-485 interface.
2005 by PCS UTM
81
Communication card: The communication card of the PLC can be connected to a network or a
computer. That makes the job easier in terms of programming and debugging the system. The
protocol to use is the dh-485 in a controlnet network.
There are two types of cards: the personal computer interface and the dh-485 interface.
1746-PIC: The personal computer interface is used to connect one PLC to the computer
via the serial port. This configuration is widely used in on site programming and
debugging with a laptop.
1747-AIC: The dh-485 interface is connected between the PLC and the computer
interface. This converter is used to connect various PLC in a network and to a
computer, so now the computer can interact with more than one PLC via the same port.
7.5 Sensor and actuators:
5.1-Sensors: They are used to get information from the process. These elements are
connected to the inputs of the PLC. There are different types of sensors:
1) Proximity (a) (capacitive and inductive).
2005 by PCS UTM
82
2) Temperature (thermoresistor (b), temperature gauge(c), pyrometer,
thermocouple (d)).
3) Pressure (pressure Gauge, piezoelectric valve).
4) Photoelectric sensors
All these elements are used to receive information from the controlled process. Some of
them generate digital signals (a) and are connected to the digital inputs of the PLC,
other generate analog signals (b, c, d) and are connected to the analog inputs.
5.2-Actuators: They are connected to the outputs of the PLC that control the
components of the system to adjust them to the set point.
5.3-User interface: It is used to monitor the process through information given in the
PLC.
7.6 Uses of the PLC:
Robotics, industrial automation, hazard environment control, mining, etc
2005 by PCS UTM
83
7.7 Software: Recall of digital electronics:
The bases of the digital world are the gates. The systems are composed of them in different
arrangements and quantities. Here the goal is to compare the gate circuits with the ladder circuit
or ladder logic.
Comparing gates and ladder logic: The gate system is used in digital electronics and the ladder
logic is used more in electrical systems, this is a simple relation in a one by one basis. Assume
three digital variables A, B and C. A and B are the inputs and C is the output. The table below
shows the response of the different types of gates and ladder circuits.
And gate:
Or gate
2005 by PCS UTM
84
Not gate
Xor gate
Xnor gate
2005 by PCS UTM
85
Think about the ladder logic as a group of switches, ones normally open and other normally
closed. Vertical parallel lines represent the switches. Generally they are normally open; the
normally closed have a diagonal line between the parallel lines.
The normal position of the switch is the one that they will get when not active, when activated
that position changes to open or close depending on the type of switch. The PLC recognizes
logic by ladder so the systems have to be converted to that type of representation.
Tips: When simplifying logic circuits, use normal logic and then transfer the result to ladder.
Example #1:
Example #2:
Let the process be the level of a water tank. There are two sensors: one at low level and the
other at high level. The variable to control is the level of the tank. There is a faucet at the top of
the tank that fills it up and other pipe where the water goes out. The quantity of water flowing
through the exit pipe is random and is not controlled by the process. The control system has to
maintain the water level between the low and high level presetted.
The logic for this problem is like this:
There are (2) inverters and (2) AND gates in the circuit. The ladder is seen like this:
2005 by PCS UTM
86
8
Dynamic Simulation in Simulink
8.1 Objective
8.2 Introduction
8.3 Transfer Function-Based Simulation
8.4 Summary
8.5 Appendix
8.1 Objective
The purpose of this module is to introduce SIMULINK, a block diagram environment for
simulation. After studying this module, you should be able to construct a block diagram for
simulation and set proper simulation parameters.
8.2 Introduction
There are limitations to using the standard MATLAB environment for simulation. Engineers
(and particularly control engineers) tend to think in terms of block diagrams. Although
MATLAB functions such as parallel, series, and feedback allow the simulation of block
diagrams, these functions are not visually pleasing. SIMULINK provides a much more natural
environment (a graphical user interface, GUI) for simulating systems that are described by
block diagrams. SIMULINK also provides integration methods that can handle systems with
time-delays (rather than making a Pad approximation for deadtime).
2005 by PCS UTM
87
Figure 8.1: SIMULINK library browser
We will illustrate the use of SIMULINK by way of example.
In the MATLAB command window, enter simulink (small letters):
>>simulink
The SIMULINK block library window appears, as shown in Figure 8.1.
There are many possible SIMULINK functions (icons) available. Double-clicking on the
Simulink Extras, you will find some additional blocks you may use in your simulation. The
resulting window is shown in Figure 8.2.
Figure 8.2: SIMULINK Extras block
2005 by PCS UTM
88
8.3 Transfer Function-Based Simulation
Here we provide an example simulation of a first-order process. The first step is to create a new
model by clicking File New Model in the SIMULINK library browser. An untitled
SIMULINK model will appear as shown in Figure 8.3.
Figure 8.3: Untitled SIMULINK model
Construct a SIMULINK simulation with the following elements:
(a) Clock
(b) Step input
(c) Transfer function
(d) To Workspace (2 unit)
Drag icons from the SIMULINK library browser to the Untitled SIMULINK model. The clock
is used to create a time vector. The To workspace icons allow the vectors to be written to the
MATLAB workspace for later manipulation or plotting.
Notice that each of the variable names, as well as the icon names, can be changed by the user, as
shown in Figure 8.4. The variable names are changed by double-clicking on the icon and
changing the name in the variable space.
2005 by PCS UTM
89
Notice that the default transfer function has a pole at zero, that is, as simple integrator. This is
changed by double-clicking on the icon and entering numerator and denominator coefficients.
An example of a system with a gain of 2 and a time constant of 5 is shown in Figure 8.5.
The default step input is to step the input from 0 to 1 at t =1. This can easily be changed by
double-clicking on the Step icon and changing the specifications.
Figure 8.4: Blocks for transfer function
simulation (top) and blocks for transfer
function simulation variables and icons
renamed.
2005 by PCS UTM
90
Figure 8.5: Transfer function simulation first-order process
The simulation parameters (start time, stop time, integration method, etc.) are changed by using
the simulation pulldown menu and selecting Simulation Parameters. Change the Stop Time to
25 and Max Step Size to 1. The default integration method is ODE45 (Runge-Kutta). You may
wish to try several different integration methods, depending on the type of system you are
attempting to simulate.
Before start the simulation, make sure to change Save Format in the To Workspace from
Structure to Array. This is to make the vectors to be written to the MATLAB workspace in
array form. To begin the simulation, simply select Start from the simulation pulldown menu.
The t and y variables are stored in the MATLAB workspace. The resulting response is shown in
Figure 8.6. Notice that the input was stepped from 0 to 1 at t =1, that is, the default values were
used.
A major advantage of SIMULINK over the standard MATLAB integration routines is the
ability to handle systems with time delays. This is done using the Transport Delay block shown
in Figure 8.7. Here we use a time-delay of 5, obtained by modifying the default value of 1. It
should also be noted that the user must apply an initial input value for the transport delay block.
2005 by PCS UTM
91
Figure 8.6: Simulation result for first-order example with a step input at t =1
The resulting simulation is shown in Figure 8.8. Notice that the output changes after 5 time
from the previous simulation. This is because the step input changing after 5 unit time delay.
Figure 8.7: Transfer function simulation first-order +time delay process
2005 by PCS UTM
92
Figure 8.8: Simulation result. Step input for first-order system with time delay of 5
Although the block diagram feature of SIMULINK is very handy, it would be time consuming
(and tiring) if every time you wanted to change a set of parameters you had to double-click on
the related icons. You can place variable names, such as k, tau, theta, for a first-order +time
delay system directly in the blocks, the simply change the values (k, tau, theta) in the MATLAB
command window before performing a new simulation. This block diagram is shown in Figure
8.9.
Figure 8.9: Transfer function simulation. The values of k, tau, and theta can be entered in the MATLAB
command window before beginning the simulation
2005 by PCS UTM
93
Use SIMULINK to perform the following. Show the SIMULINK diagram used for your
simulations. Set Stop Time to 100 and Max Step Size to 1.
Exercise 1 Plot the step response of the following underdamped system
( )
1 5 25
3
2
+ +
=
s s
s g
when a step input of magnitude 2 is made at t =1. Comment the response.
Exercise 2 Plot the step response of the following underdamped system
( )
( )
1 5 25
1 3 3
2
+ +
+
=
s s
s
s g
when a step input of magnitude 2 is made at t =1. Comment the response.
Exercise 3 Plot the step response of the following underdamped system
( )
( )
1 5 25
1 3 3
2
5
+ +
+
=
s s
e
s g
s
when a step input of magnitude 2 is made at t =1. Comment the response.
8.4 SUMMARY
The purpose if this module was to provide a brief introduction to the use of SIMULINK for
block diagram programming. SIMULINK provides a much more natural environment (a
graphical user interface, GUI) for simulating systems that are described by block diagrams. It
also provides methods that can handle system with time-delays.
2005 by PCS UTM
94
8.5 APPENDIX
Section: Approved by: _____________
Group:
Date:
____________________________________________________________________________
Exercise 1
SIMULINK Block diagram
Response
2005 by PCS UTM
95
Comment:
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Exercise 2
SIMULINK Block diagram
Response
Comment:
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2005 by PCS UTM
96
Exercise 3
SIMULINK Block diagram
Response
Comment:
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________