You are on page 1of 17

Proces Control Laboratory

Experimental Procedure and Instructions for


Preparing Lab-Report

1 Aim of the experiment


• To develop a steady state and dynamic model of the process using the first principles
and estimate model parameters using experimental data. Validate the model using
dynamic simulation studies.

• Development of transfer function model for the process using open loop step test data.

• Use of the transfer function model for tuning PI controller using method of direct
synthesis.

• Use transfer function/first principles models for performing closed loop simulation stud-
ies in SIMULINK.

• Experimentally evaluate the closed loop performance of the control setup for different
P and PI controller settings and compare with simulation results
These experiments have to be conducted in three parts, as explained below.

2 Part I: Development of Dynamic First Principle Model


Develop a model of the form
dY
= F (Y, U, D, P )
dt
where Y represents measured output (level or temperature), U represents manipulated input
(control valve position input or thyristor power controller input), D represents the distur-
bance input and P represents set of model parameters. The model parameters have to be
estimated using steady state experiments as follows:

1
• Step 1- Steady state data generation: Set the manipulated inputs U and D at a
fixed values (say 12 mA or 50% valve opening) and find the steady state value of level
Y. Repeat the experiment for various values of {(Ui , Di ) : i = 1, 2, ...N} and collect
corresponding steady state output(s) {(Yi ) : i = 1, 2, ...N}.

S. No. Di Ui Yi
1 .... .... ....
2 .... .... ....

Note that all the transient outputs of the process while moving from one steady state
to another steady state have to be recorded.

• Step 2 - Model Parameter estimation: Using the steady state data, we get a over
determined set of equations
F (Yi , Ui , Di , θ) = εi
The model parameters can be found by solving the least square optimization problem(s)
of the form
N
min X
(εi )2
θ i=1

For example, for stirred tank heater experiment, the model for heat input versus current
input to the thyristor power controller is given as

Q(I) = aI + bI 2 + cI 3

where I represents fractional current. The parameters of the model, i.e. (a, b, c), can
be estimated by minimizing

XN
min
(εi )2
(a, b, c) i=1
εi = F Cp (Ti − Tin ) − aI + bI 2 + cI 3

using the linear least square formulation.

2.1 Dynamic simulation of the first principle model


Simulate the dynamic behavior of the first principle model using Differential Equation Editor
(dee) in SIMULINK. Subject the model to identical step changes in inputs as Ui above
at same time instances and compare the model output with the measured process output
collected in Step 1 above.

2
2.2 What do you report?
1. Derivation of the first principle model together with all assumptions

2. Signed data sheet of steady state values recorded during the experiments

3. Parameters of the first principle model estimated from the steady state data and least
square estimation

4. Analysis of parameter estimation results.

5. Analysis of dynamic simulation results.

Figures to be plotted and analyzed:

1. Steady State Plots: Plots of steady state data collected during experiments and
comparison with estimates of the steady state models developed using least square
estimation. Comparison of estimated quantity v/s input and measured v/s input should
be carried out in the same figure.

2. Dynamic Behavior Plots: (a) Comparison of dynamic model predictions v/s time
and measured output v/s time in the same figure (b) Manipulated input v/s time

3 Part II: Development of Transfer Function Model


The first step in development of linear perturbation model (transfer function model) is to
decide the nominal operating point (or operating steady state) for the process. (The operating
steady state for a batch will be fixed by your instructor). Once the operating point is fixed,
a linear transfer function model can be developed as follow

• Taylor Series Approximation: Linearize the nonlinear dynamic first principle


model developed above at the nominal operating point and develop a transfer function
model relating perturbations in controlled variable (CV) to perturbations in manipu-
lated variable (MV).

• Process Reaction Curve Method (determination of transfer functions from step


response data): Keep the process input at the nominal value (say 12 mA) and allow
the process output to reach the steady state value. Note the steady state input (MV)
and controlled variable (CV) (output) values. Give a positive step change to the I-P
converter (say from 12 mA to 15 mA). Record the response of CV till a new steady

3
state is reached. Similarly, the step response of process for the negative step change of
same magnitude (say from 12 mA to 10 mA) should be noted.
Note:

— The process must be at its steady state, before the positive/negative step change
is given to the process and data should be collected till the process reaches its
new steady state.
— The negative step followed by positive step or vise versa is done to get the average
gain of the process. However, it is not necessary to give two steps in sequence
these steps can be given from nominal value in any sequence.

The procedure to be followed for generating transfer function models from noisy step
response data is explained in Appendix B. Develop transfer function models using both
positive and negative step change data and calculate average gain and time constant para-
meters. The model can be identified using function fminunc in the Optimization Toolbox
of MATLAB. Refer to Appendix B.
The simulated step responses of the identified and linearized transfer function models
can be computed using SIMULINK.

3.1 What do you report?


1. Linearization of first principles model and the transfer function obtained using the
linear perturbation model

2. Estimated transfer function model

3. Analysis of figures.

Figures to be plotted and analyzed:

1. Compare the responses of the transfer function models developed using above two
approaches under similar input changes with the experimental data in the same figure.

2. Comparison of dynamic response of the nonlinear first principle model under identical
input changes and the data collected from plant during entire experimental run.
Note: All the figures should be drawn using absolute variables. The responses com-
puted using transfer functions are in terms of deviation variables, which have to be
converted to absolute value by adding appropriate steady state values.

4
4 Part III: Design of PID Controller and Closed loop
Control
The controller design is to be performed by direct synthesis approach (See Appendix C for
details). This procedure will give controller gain (kc ) and integral time τ I for PI controller.
Use these values to generate following controllers

• P- Controllers

— P-1: kc1 = kc
— P-2: kc1 = a × kc where a is between say 3 and 5

• PI - Controllers

— PI-1: kc1 = kc , τ I1 = τ I
τI
— PI-2: kc1 = a × kc , τ I1 = where a is between say 3 and 5
a
Investigate the closed loop behavior of the process for following cases

• Responses of the above P controllers for identical step changes in the setpoint.

• Responses of the above PI controllers for identical step changes in the setpoint.

• Responses of the PI-1 controller for step changes in the disturbance


the above two P and two PI controllers for step change in the set point and disturbance

Perform closed loop studies using

• Simulation using SIMULINK: Construct a closed loop simulation program using


standard blocks of SIMULINK in Matlab. A typical SIMULINK program for closed
loop control is shown below
The simulation experiment should carried out using the nonlinear first principles model
for process simulation.
Note: Standard PID block is available in SIMULINK, which has to be configured
for your set of parameter. Also, replace process transfer function block above by the
SIMULINK block created using dee for nonlinear process simulation. Note that the
block created by dee works with absolute variables while the PID block works with
deviation variables. Thus, steady state input value(s) have to be added to controller
output while feeding it to process. Also, the steady state output value has to be
subtracted at the process output to generate deviation measurements.

5
Figure 1:

• Experimental studies: Conduct the simulation experiment for identical changes as


given in case of experimental runs

Note: The value of a will be specified by the instructor.. This parameter should be chosen
such that the closed loop is expected to exhibit underdamped behavior from simulation
studies.

4.1 What do you report?


• Table 1: Report the controller gain Kc and integral time Ti for PI controller designed
using direct synthesis procedure given in appendix.
Table 2: For P controller experiments, compare theoretically expected offset, offset
observed in a simulation and experimentally observed offset when identical step changes
are made in the setpoint.
Table3: For PI controller experiments, compare theoretically expected figures of merit
(damping coefficient, damping ratio and settling time) with values figures of merit
generated through experimental studies and nonlinear dynamic simulation

• Analysis of the closed loop transfer function (in term and poles and zero and expected
behavior) obtained in each case (i.e for all the cases of P and PI controllers and using
process transfer functions obtained by both the approaches). Comment upon expected
offset and observer offset, expected overdamped / under damped behavior and observed
responses etc.

• Analysis of experimentally observed and simulated closed loop behavior.

6
Figures to be plotted and analyzed:

(a) Comparison of servo closed loop behavior (input v/s time and output v/s time) of both
the P controllers in same figure

(b) Comparison of servo closed loop behavior (input v/s time and output v/s time) of both
the PI controllers in same figure

(c) Comparison of regulatory closed loop behavior (input v/s time and output v/s time)
of PI-1 controller in same figure
Prepare separate figures for simulation results and experimental results.

5 Instructions for preparing report


• Report for each part should be prepared and submitted one week after conducting the
experiment

• Each group should file report in a cardboard file only. Loose sheets bound
together with plastic holder or stapled sheets will not be accepted. On the
cardboard file, write names and roll numbers of all students in group and title of the
experiment (Level Control / Temperature Control).

• All figure should be prepared using ’plot’ command in MATLAB. The x and y axes
should be labeled and units should be specified for each variable plotted. Each figure
should have (a) Title (b) labels for x and y axes with proper units (MATLAB com-
mands, ’axis’, ’xlabel’, ’ylabel’ and ’title’ can be used for this purpose). When multiple
plots have to be plotted in same figure commands ’hold on’ and ’hold off’ come handy.
When multiple plots appear in same figure, different line styles should be used and
legend for different lines should be included on the figure or in the title.

• Include listing of MATLAB programs you have developed

7
Appendix A: Data Acquisition System
The computer controlled systems fundamentally differ from the conventional continuous
control systems, as computers can only deal with numbers. The continuous analog signals are
sampled through a sampler and converted into a sequence of numbers (Analog to Digital
Conversion or ADC ) and the output of the computer, which is another sequence of numbers, is
converted into a continuous signal (Digital to Analog Conversion or DAC).
ADC or sampler generates and amplitude modulated pulse train through periodic
detection of the continuous time signal y(t) with a switch that closes with a sampling period T for
duration h. If the switch duration `h’ is very small compared to the sampling period T, then we
can think of the sampled signal as a sequence of numbers.
y T (t ) = y ( kT ) for t = kT
y T (t ) = 0 for kT < t < ( k + 1)T
(k = ...., - 2, -1, 0, 1, 2, ... )
Thus, introduction of a sampler simply means replacing the continuous signal by its
values at discrete points. Mathematically, we are approximating a continuous function by a
sequence of number. In the case of equi-spaced sampling instants, the time between any two
sampling instants, i.e. T, is called as sampling period and the corresponding frequency (ωs = 1/T
Hz) is called sampling frequency.
In a computer controlled system, it is also necessary to convert the control actions
calculated by the computer to a continuous time signal (DAC) that can be applied to a process.
This inversion of sampling operation, i.e., the conversion of sequence of number, say {u(kT) :
k=0, 1, 2,.... }, to a continuous function is called signal reconstruction. A simple reconstruction is
carried out using a Zero Order Hold (ZOH), which operates as follows
u (t )=u (kT );during interval kT ≤ t < (k + 1)T
where k = 0, 1, 2, .....
This implies that the reconstructed signal is piecewise constant staircase like function.
Because of its simplicity, ZOH is commonly used in computer controlled systems.

In the experimental setups, ADAM-5000 module is used for performing ADC and DAC
function. ADAM-5000 is Data Acquisition Module (5000 series) used for collecting data from
process and giving controller output signal to actuator. This module has built-in microprocessor

1
and analog to digital converters (ADCs) and digital to analog converters (DACs). Hence, it
converts the analog signal received from the process into digital format and the controller output,
which is digital data is converted to analog signal which can be directly applied to actuator. The
data is transmitted and received from PC through serial communication port (COM1/2) using
RS232 protocol. The module can also use RS485 protocol to enable multi-dropping.
ADCs and DACs are specified by the number of bits used for conversion. Number of bits
specifies the resolution in the conversion. For example, for a three bit ADC can differentiate 8
discrete values. Hence, for the analog input of 0 to 1 V, ADC output will change in steps of
multiples of 1/8 V. As shown in the figure, the discrete output will remain same between 0 to 1/8
V. Thus, as we increase number of bits, the resolution will increase and ADC can differentiate
between finer voltage (analog signal) changes. The ADC output for n bit ADC when input is Vi
will be:
Vi (Voltage range)
decimal output =
2n

The module has several slots where we can attach different cards, i.e. Analog input card
(5017H), which has eight input channels and Analog output card (5024), which has four output
channels. These IO cards can support various standard voltage and current ranges. The data
communicated to the PC can be directly read from MATLAB and used in the program. Hence
the controller now may be a simple MATLAB routine.

• To start using ADAM-5000 through MATLAB, first we need to initialize it with the
routine init_adams_rt.m file.

2
• To read the data from ADAM-5000, following command is issued in the MATLAB
command window: AD_conversion(Ch_no). Ch_no is the channel number from which
the data is to be collected. E.g. if you want to read the data at channel 3, then issue
following command: AD_conversion(3). AD_conversion is actually a MATLAB routine,
which communicates with ADAM-5000 through serial port.
• To give controller output to the actuator from ADAM-5000, following command is
issued in the MATLAB command window: DA_conversion(ch_no, data). Ch_no is the
channel number to which the actuator is connected and data is the command signal you
want to send to the actuator. E.g. to give 12 mA to actuator connected with channel 2 of
Analog output card, issue following command: DA_conversion(2,12).DA_conversion is
also a MATLAB routine.

Appendix B: Development of Transfer Function Models


For the purpose of developing control relevant dynamic model of the system, we can
propose a first order Transfer Function (TF) model relating perturbations in outputs to
perturbations in inputs as
δy (s ) kp
= G (s ) =
δu (s ) τs + 1
δy = y − y ; δu = u − u
where the perturbations are defined with respect to operating steady state. In principle, the
process transfer function can be obtained through graphical procedure by plotting the process
step response with respect to time. In this procedure the gain is calculated using the steady state
change in the output per unit change in the input. The time constant is taken as time taken for the
process to reach 63.2% of its final value. However, given noisy step response data collected from
a plant, it is difficult to use the conventional approach of finding 63.3 % of the final value
become difficult to use. A better approach in presence of measurement errors is to use
regression. We can formulate the parameter estimation problem as a least square estimation
problem as follows:
Let us propose a simple first order transfer function model relating deviation input and
deviation output (deviations are defined from the steady state operating point)

3
δy (s ) kp
= G (s ) =
δu (s ) τs + 1
which is equivalent to the following differential equation
d δy
τ + δy = k p δu ; δy (0) = 0
dt
For step change in input (of magnitude Δu ), the output response can be expressed as
δyˆ(t ) = kp Δu [1 − exp( −t / τ )]

Here, δyˆ(t ) represents estimated value of the process output, given estimates of kp and τ . Let us
introduce notation
tk = kT ; δy (k ) = δy (tk )

where tk = kT represents k’th sampling instant and T represents sampling interval.

Since there are errors in measurement of y (tk ) = y (k ) , we can define measurement error e (k )
as
e (k ) = δy (k ) − δyˆ(k )
The unknown parameters kp and τ cab estimated by solving following costrained nonlinear
optimization problem
Min Min
∑ [δy (k ) − δyˆ(k )]
N N

∑ [e (k )]
2 2
=
K p ,τ k=1 K p ,τ k=1

Subject To Constraint
τ >0
This is a nonlinear optimization problem and can be solved using function fmincon from
Optimization Toolbox of MATLAB. Note that the process gain kp can be either positive or
negative.
• k =1 in the above summation expression indicates the time instant at which the step
change was introduced. The data before introduction of the step change has to be
neglected while formulating the optimization problem. Also, N in the above summation
indicates the sampling instant where the output reaches a new steady state after the step
change has been introduced.
• In order to compute deviation outputs δy (k ) = y (k ) − y from measurements y(k)

we need to estimate the steady state y at the current operating point. This can be done

4
by finding mean of the 100 or 200 output measurements obtained just before the step
change is introduced. (It is assumed that the output is at a steady state before the step
change is introduced.) Use function mean in MATLAB to estimate the mean value.
• All the calculations can be performed in terms of mA signals. As a consequence, the
process gain and later the controller gain has units of (mA / mA). There is no need to
convert the signals into engineering units.
• In order to solve nonlinear optimization problem stated above, it is important to give
good initial guesses. These guesses can be easily generated by graphical process
reaction curve method.
• One difficulty while developing linear TF model is that the real processes are
nonlinear and do not exhibit symmetric step response behavior. One remedy to this
problem is to give positive and negative step inputs around the operating point and
develop transfer function models for each case separately. An average TF model can be
developed by averaging the gain and time constant of these models.
• In the proposed input-output model is of the form
δy (s ) kp
= G (s ) =
δu (s ) (τ 1s + 1)(τ 2s + 1)
then, the estimated output can be expressed as
⎡ τ 1 exp( −t / τ 1 ) − τ 2 exp( −t / τ 2 ) ⎤
δyˆ(t ) = kp Δu ⎢1 − ⎥
⎣ τ1 −τ2 ⎦
and the corresponding optimization problem can be formulated as
Min Min
∑ [δy (k ) − δyˆ(k )]
N N

∑ [e (k )] = K
2 2

K p ,τ k =1 p , τ 1,τ 2 k=1

Subject To Constraints
τ1 > 0 ; τ2 > 0
Alternatively, a second order system can be approximated as a first order system
with time delay.
δy (s ) kp e −θs
= G (s ) =
δu (s ) (τs + 1)
The corresponding time domain expression for step response is

5
⎡ ⎛ − (t − θ ) ⎞⎤
δyˆ(t ) = kp Δu ⎢1 − exp⎜ ⎟⎥
⎣ ⎝ τ ⎠⎦
The optimization problem can be formulated as
Min Min
∑ [δy (k ) − δyˆ(k )]
N N

∑ [e (k )] = K
2 2

K p ,τ k =1 p , τ 1,τ 2 k=1

Subject To Constraints
τ >0 ; θ >0
• Using MATLAB constrained optimization subroutine:
Suppose we want to solve
Min Min 2
f (x ) = x + 3x 1x 2 − 5x 22 − 7x 2
x1 , x2 x1 , x2 1
Subject To Constraints
x1 ≥ 0 ;
− 5 ≤ x2 ≤ 2

In order to solve the above constrained optimization problem, we have to first write a
function which computes f(x) given a guess of vector x.
function fx = myfun( x )
fx = x (1)^2 + 3 * x (1)x (2) − 5 * x (2)^2 − 7 * x (2) ;
The above function should be saved in a separate file named as myfun.m. This function
should be passed to MATLAB subroutine fmincon as follows
UB = [ inf 2 ] ; % This vector defines upper bounds on x

LB = [ 0 –5 ] ; % This vector defines lower bounds on x

x0 = [ 1 1 ] ; % This vector defines initial guess solution

xopt = fmincon( ‘myfun’, x0, [], [], []. [], LB, UB) ;

The above set of commands can be saved in a script file (say tf_fit.m). To run this file

from MATLAB, just type tf_fit at the MATLAB command prompt and enter. To learn
more about function fmincon, type help fmincon at the MATLAB prompt.

6
Appendix C: Design of PI controller by Direct Synthesis
The closed loop transfer function relating the setpoint and the measured output is given as
follows
δy (s ) Gc (s )G (s )
=
δr (s ) 1 + Gc (s )G (s )
By direct synthesis approach, the designer is required to specify the desired closed loop behavior,
say V(s), between output and the setpoint. The controller that realizes the desired closed loop
behavior can be computed as follows
1 ⎡ V (s ) ⎤
Gc (s ) =
G (s ) ⎢⎣1 −V (s ) ⎥⎦
This is also called as pole placement scheme as the controller is designed such that the closed
loop has poles at the desired location. For example, let the transfer function obtained from the
process be of the form
kp
G (s ) =
τs + 1
where kp is process gain and τ is process time constant. Let the desired transfer function will be
of the form

[V (s )] = 1
τ cl s + 1

where τ cl is typically chosen equal to τ / 2 or τ / 3 . Substituting in the design equation, we


obtain a PI controller
⎛ 1 ⎞
Gc = Kc ⎜⎜1 + ⎟
⎝ τ I s ⎟⎠
where

1 ⎛ τ ⎞
Kc = ⎜ ⎟ and τ i = τ
kp ⎜⎝ τ cl ⎟

For a first order plus dead time model of the form
kp exp( −θs )
G (s ) =
τs + 1
the PI tuning rules (obtained using Pade approximation of time delay term) are as follows

7
1 ⎛ τ ⎞
Kc = ⎜ ⎟ and τ i = τ
kp ⎜⎝ τ cl + θ ⎟⎠

For a second order model of the form


δy (s ) kp
= G (s ) =
δu (s ) (τ 1s + 1)(τ 2s + 1)
the PID tuning parameters are

1 ⎛τ1 + τ2 ⎞ τ 1τ 2
Kc = ⎜ ⎟ ; τi = τ1 + τ2 ; τd =
kp ⎜⎝ τ cl ⎟⎠ τ1 + τ2

Note: If your model is second order, you can perform experiments with PID controller instead of
PI. However, if you start getting too much oscillations in the input due to measurement noise,
then you can neglect the derivative term and use only K c , τ i values computed for PI controller

tuning.

Appendix D: Digital Implementation of PID Controller

The standard PID controller equation can be written as:


⎡ 1 ⎤
δu (s ) = K c ⎢1 + + τ d s ⎥e (s )
⎣ τI s ⎦
which is equivalent to time domain integro-differential equation
t
⎛ 1 de ⎞
u (t ) = u + K c ⎜⎜ e + ∫ edt + τ d dt ⎟⎟⎠
⎝ τI 0

e (t ) = r (t ) − y (t )
where u(t) : controller output
r(t) : Setpoint
y(t) : Measured output
u : controller bias (steady state controller output at the design conditions)
KC : Proportional gain
τI : Integral time
τd : Derivative time

8
When the above controller is implemented using a digital computer, the above continuous
domain equation has to be converted to an equivalent discrete domain equation (or difference
equation). In a computer controlled system, the measurements are available at every T sec
interval and the output is also update after every T sec. Between the two sampling instants, the
values of manipulated inputs are held constant (zero order hold reconstruction). In discrete form
this can be written as :
k
⎛ e (k ) − e (k − 1) ⎞
u (k ) = u + KC e (k ) + K I ∑ e (i ) + KD ⎜ ⎟
i =0 ⎝ T ⎠
where KC : Proportional gain
KI = (KC / τI) : Integral gain
KD = (KC * τd): Derivative gain
T : Sampling time
The above discrete form is called as position form of PID controller. The difficulty with this
form is that the steady state input bias has to be specified by the user. This difficulty can be
eliminated, if we develop velocity form of PID controller as follows
k −1
⎛ e (k − 1) − e (k − 2) ⎞
u (k − 1) = u + KC e (k − 1) + K I ∑ e (i ) + KD ⎜ ⎟
i =0 ⎝ T ⎠
Subtracting from the expression for u k −1 , we have

u (k ) = u (k − 1) + [KC + K I + KD ]e (k ) − [KC + 2KD ]e (k − 1) − +[KD ]e (k − 2)


The advantage of this form is that the steady state bias term is eliminated. The steps involved in
software implementation of PID controller at any sampling instant k are as follows
• Step 1: Obtain measurement y (k ) from plant using analog to digital converter.

• Step 2: Error computation


Set e (k − 2) = e (k − 1) and e (k − 1) = e (k )
e (k ) = r (k ) − y (k )

Here r(k) represents the set point.


• Step 3: Compute Controller Output
Set u (k − 1) = u (k )
u (k ) = u (k − 1) + [KC + K I + KD ]e (k ) − [KC + 2KD ]e (k − 1) + [KD ]e (k − 2)

9
• Step 4: Checking limits
If uk ≥ uHIGH Then Set uk = uHIGH
If uk ≤ u LOW Then Set uk = u LOW

• Step 5: Implement computed u k through Digital to Analog converter

• Step 6: If sampling interval is over go to Step 1


MATLAB code for PID implementation
p = [ kc + kI + kD , -kc-2*kD, kD];
% get measurement from A/D converter
yk = AD_conversion(AD_Ch_no)
err(3) = err(2);
err(2) = err(1) ;
err(1) = setpoint - yk;
uk2 = uk1 ;
uk1 = uk2 + p(1) * err(1) + p(2) * err(2)+p(3)*err(3) ;
if (uk1 <= uk_low)
uk1 = uk_low ;
else if((uk1 >= uk_high)
uk1 = uk_high ;
end
% Communicate uk1 to D/A converter
DA_conversion(DA_ch_no, uk1)

Note that both y (k ) and u(k) are expressed in term of mA signal. Thus, the controller
gain MUST be expressed in term of mA / mA to make the above algorithm work. Also, notice
that the velocity form of PID implementation does not require computation of deviation inputs or
deviation outputs. All calculation can be performed using absolute values of the measurements.

10

You might also like