Automatic Tuning of PID Controller
Automatic Tuning of PID Controller
no
Availability: Open
Summary:
Proportional Integral and Derivative (PID) controllers are the most frequently used
controllers in the process industry over the years. The performance is a factor of adequate
tuning. The knowledge of the process is critical to the tuning process as well selecting the
right PID form and the tuning algorithm. Since there can be as many as possible PID loop
in an industry, manually performing this task will take a lot of time and cause down time
that can results to poor product quality as well as loss of income. Thus, there is a need for
tuning to be done automatically, and this form the basis of this thesis, automatic tuning of
PID controller.
It’s therefore pertinent to adjudge the right tuning rule as well as selecting the right model
for the process and thereafter if there are any changes in this model, to readjust the
parameters used for the PID algorithms to get the right PID tuning parameter on real time
basis. The standard form of the PID is used in the simulation and the relay feedback
experiment by Åstrom is considered for the parameters adjustment, and the variant of this
method developed by Schei is also investigated and the two methods compared.
Implementation and evaluation of these methods were done with the quadruple tank and
air heater processes. The relay experimentation is an easy process that ensured recursive
parameter calculation based on identified point on the Nyquist plot and this method can
be seamless automated with just a push point from the Operator.
The University College of Southeast Norway takes no responsibility for the results and
conclusions in this student report.
Preface
Preface
This thesis title ‘Automatic Tuning of PID Controller’ is carried out in partial fulfillment of the
requirement for the award of Master of Science degree in Industrial Information Technology
and Automation at the University of Southeast Norway, Porsgrunn Campus.
The task description in appendix A form the basis of the work carried out for the fulfilment of
the thesis objectives. The simulation is performed using MATLAB and Simulink software and
the codes and supporting documentation are described in the appendices.
I will like to express my gratitude to God Almighty for His sufficient grace and favor for the
period of the study. Also, I sincerely appreciate the effort of my supervisor, David Di Ruscio
(Ph.D.) for sharing his knowledge and time in ensuring that the thesis work is successfully
executed. Moreover, the support of my colleagues and lecturers at the department are highly
appreciated.
Finally, I appreciate my wife, children and siblings for their encouragement, contribution and
motivation for the entire period of the study,
3
Contents
Contents
Preface ..................................................................................................................... 3
Contents ................................................................................................................... 4
1 Introduction ......................................................................................................... 8
1.1 Earlier work ................................................................................................................................ 9
1.2 Aim and Objectives ................................................................................................................... 10
Task Description ........................................................................................................... 10
2 System Identification and Parameter Estimation ................................................... 11
2.1 System Identification ............................................................................................................ 11
Model structure ............................................................................................................. 11
Static and Dynamic Models.......................................................................................... 13
Transient and Frequency Response ........................................................................... 13
Step Response .............................................................................................................. 13
2.2 Parameter Estimation ........................................................................................................... 13
Ordinary Least Squares Estimates, OLS .................................................................... 14
Weighted Least Squares Estimation ........................................................................... 14
Recursive least square estimate (RLS) ....................................................................... 15
Kalman Filter.................................................................................................................. 15
Relay Methods ............................................................................................................... 16
3 PID Controllers Tuning Algorithms........................................................................ 18
3.1 PID Controllers Basic ................................................................................................................. 18
PID Algorithms .............................................................................................................. 19
3.2 PID Controllers Tuning Rule ....................................................................................................... 22
Ziegler-Nichols Open loop method ............................................................................. 22
Ziegler-Nichols’ Ultimate Gain and Period ................................................................. 23
Good Gain method ........................................................................................................ 24
Cohen-Coon Method ..................................................................................................... 25
Relaxed Ziegler and Nichols (R-ZN) ............................................................................ 26
Simple Internal Model Controller (SIMC) .................................................................... 26
Tyreus-Luyben Method ................................................................................................. 27
Relative Time Delay Error Method (RTDE) ................................................................. 27
A Semi-Heuristic Process-Reaction Curve PID Controller Tuning Method ............ 28
Åstrom Relay method ................................................................................................... 28
3.3 Stability Analysis ....................................................................................................................... 29
3.4 Performance Criteria ................................................................................................................. 29
Transient and Frequency Response Analysis ........................................................... 30
The sensitivity indexes ................................................................................................. 32
Stability margins and cross-over frequencies ........................................................... 33
Bode Plot and Bode Stability Criterion ....................................................................... 33
Nyquist Plot and Nyquist Stability Criterion .............................................................. 35
Integrated Absolute Error Index .................................................................................. 35
Total Variance Index ..................................................................................................... 36
4 PID Auto-Tuning Methods ................................................................................... 37
4.1 Ultimate Period and Gain from Relay Experimentation .................................................... 38
Limit cycle Oscillation .................................................................................................. 38
Describing function analysis (DF) ............................................................................... 39
4
Contents
4.2 Åstrom Relay Method ........................................................................................................... 40
4.3 Schei Relay Method .............................................................................................................. 41
4.4 Modification of the relay for noisy process and improved performance........................ 43
Symmetrical and Asymmetrical relay ......................................................................... 45
Relay with Hysteresis ................................................................................................... 45
Relay with Integrator ..................................................................................................... 46
Relay with Filters ........................................................................................................... 46
Saturation relay ............................................................................................................. 47
Relay with preload ........................................................................................................ 48
5 Simulation and experimentation study ................................................................. 49
5.1 The Air Heater Process ........................................................................................................ 49
Ultimate Period and Gain analytically. ........................................................................ 50
Åstrom Relay Experiment on simulated Air heater ................................................... 51
Results from Åstrom relay experimentation on simulated process ........................ 53
Schei Relay Experiment on simulated Air heater ...................................................... 55
Comparing the performance of Åstrom and Schei Relay Experiment on simulated
Air heater ................................................................................................................................. 57
Schei Relay Experiment on Real Air heater ............................................................... 60
5.2 The Quadruple tank Process ............................................................................................... 63
Åstrom relay experiment on simulated quadruple tank ............................................ 65
Schei relay experiment on simulated quadruple tank ............................................... 67
Comparing the performance of Åstrom and Schei Relay Experiment on simulated
quadruple tank ........................................................................................................................ 69
6 Discussion and Result .......................................................................................... 71
7 Conclusions ........................................................................................................ 73
7.1 Further Works ....................................................................................................................... 73
8 References....................................................................................................... 74
5
Abbreviation
Abbreviation
A-H Åstrom, Hang and Wang
DF Describing Function
GM Gain Margin
IE Integrated Error
PE Persistence Excitation
PM Phase Margin
6
Abbreviation
TV Total Variance
7
Introduction
1 Introduction
Proportional Integral and Derivative (PID) controllers are widely used in virtually all area of
industrial automation and control. The PID controllers has three terms which are the
proportional term P, integral term I and the derivative term D. The P gives a proportional
control to the input signal, I and D terms gives control that is proportional to the integral and
derivative time of the error respectively.
They provide a good response to process control but may not give optimal performance under
some circumstances. Hence there is a need for PID parameters (the proportional gain, integral
and derivative time) readjustment in case of process offset or the dynamics of the process
changing or varying. The process of adjusting the PID parameters is referredred to as tuning
and this can be done manually or automatically. A large industry may have many PID and to
tune these manually will take time and cause down time and thus the need to develop an
adaptive or a controller with an auto tune capability.
Based on the context of the thesis, PID tuning rules discussed in chapter 3 are general PID auto
tuning and will be referred to as PID tuning algorithms (most of which cannot be easily
automated ) while the PID tuning rules discussed in chapter 4 are easily automated and as such
will be referred to as PID auto tuning.
Auto tuning is the process whereby the PID controllers are tuned automatically by the operators
or users. Other terms like adaptive controllers and gain scheduling will be used to mean almost
the same things but with little variations. Adaptive controllers continuously adjust their
parameters to accommodates for changes in process parameters/dynamics or model because of
disturbances which can be external or internal. Gain scheduling is adjusting the parameters of
PID controllers based on non-linearity’s of the process such as changes in operating conditions.
[1].
In some context, adaptive tuning requires the prior knowledge of time scales for determining
suitable sampling interval whereas automatic tuning is specified on demand by the operator
without a prior information about the process dynamic. Mostly both adaptive tuning and auto
tuning means relatively the same things based on the applied algorithm and principles.
In auto tuning, the process is disturbed on demand, whereas adaptive tuning does not involve
operator intervention before changing the PID parameters as demand by the changes in process
dynamics. The parameters of adaptive controllers are uninterruptedly adjusted to cater for a
disturbance in the process. Adaptive controllers are widely used for controller parameters
adjustment on both model and non-model based auto tuning.
Most common auto tuning procedure is using a relay and gain scheduling, and MRAS and STR
are common used schemes for adaptive controllers. In recent years other techniques are been
employed in fine tuning controllers and among them is predictive controllers, expert system,
and pattern recognition.
The choice of the PID auto tuning for the thesis work is based on the relay auto tuner described
by Åstrom and Hågglung in [2]. This is a non-model based auto tuning in which an operator
initiates the auto tuning process and the relay is used to obtained sustained oscillation in other
to capture the critical point for the parameters estimation as obtained by Ziegler and Nichols
method. An extension of this method presented by Schei in [3] will also be explored.
Irrespective of the name or terms employed, the major objectives are designing a controller
that will be able to
8
Introduction
9
Introduction
Luyben in 1987 introduces the use of relay-feedback to fit a typical transfer function [8] and
Schei in his paper demonstrated auto tuning of PID based on transfer function model with the
use of relay experimentation.
In [9], Finn Haugen demonstrated that the Åstrom relay auto tuning method can also be
archived by turning the PID controller into a relay making the proportion and the integral
constant very high and the derivative part set to zero. And this method can be applied to
processes, like the air heater used for experimentation in this thesis, which does not accept
negative control signal. The results obtained from this is achieved with the anti-windup
function de-activated.
The Ziegler-Nichols approach suffers a deficit in that the system can be thrown out of the
stability limit (the oscillations are produced by gradually increasing the proportional gain in a
closed loop system) but the A-H approaches is safe as the oscillation is bounded within a
bounded limit (control amplitude).
Nyquist, Nichols and Bode plot and charts are essential background in studying system stability
and performance monitoring.
Task Description
Perform a literature research on algorithms for automatic tuning of the PID controller
Perform a literature research on recursive system identification based methods for PID
controller parameters calculation
Perform a simulated experiment of one or a few algorithms for automatic tuning of PID
controllers.
A laboratory experiment of the auto tuning method on quadruple tank process and/or
the air heater
10
System Identification and Parameter Estimation
Model structure
The model structure is an important part of system identification and paramount for correct
parameter estimation. Basically, the following types of model can be identified:
Linear / nonlinear state space model which can be in the continuous or discrete form
Input/output (polynomial) models which can be linear, nonlinear, continuous or discrete
Transfer function model
The above listed types can be classified as shown in the following section.
11
System Identification and Parameter Estimation
o Output-Error Model: the auto regressive and the eXogenous part are the same
as shown in equation (2-5)
( ) = ( ) + ( ) (2-5)
o Box-Jenkins Model: the model structure separates the input and noise path as
shown in equation (2-6).
( ) ( ) = ( ) ( ) + ( ) ( ) (2-6)
State Space Model: The state space model is given in general forms in (2-7)
= + + (2-7)
12
System Identification and Parameter Estimation
= + +
Step Response
In an open loop system, a step input will be applied to the system and the response recorded.
But in a closed loop system, the controller will be in manual mode and the control variable
changed rapidly by increasing or decreasing, (this is done after the system is at rest). The
process variable is recorded and scaled by the change in control variable. In both cases, it’s
advisable to repeat the process for different step changes and at different operating conditions
to capture a wider range of the process dynamics. The a one parameter model
Another model structure is a two-parameter model for which the process gains and the average
residence time (capture the time behavior) can be the parameter of interest. For a better
approximation of the model, the number of parameters can be increased to three to give a
Three-parameter model. This is characterized by three parameters as follow:
the gain K
the time constant, T
the dead time or time delay
Other methods for a more precise model are four parameter and methods of moment as
discussed in [1]. The step response is employed for the air heater model (which is a three
parameters model) validation and the details is contained in section (3-2).
13
System Identification and Parameter Estimation
In offline estimation, already processed input/output data are used to estimate the model
parameters whereas in online parameter estimation parameters of a model are evaluated with
both past and current data that are made available as each time instant during the operation of
the process. It involves the use of recursive algorithms as discussed in section 2.2.3 and 2.2.4.
Recursive computation can be done in the in the least square sense (minimizing the sum of
square errors) for the method for system identification and parameter estimation as well. The
following section will explain the least squares method and also the recursive computation of
some methods.
= =( − ) ( − ) (2-9)
=− + =0 (2-10)
The ordinary least square estimate of B is given in equation (2-11) by solving equation (2-10)
=( ) (2-11)
= =( − ) ( − ) (2-12)
=− + =0 (2-13)
14
System Identification and Parameter Estimation
=( ) (2-14)
This requires that the measurement noise, R be a nonsingular matrix and invertible, which mean
that each of the measurement y, must be noisy. [13].
( )= ( ) ( )= () ()
(2-15)
= () () + ( ) ( )
= ( − 1) + ( ) ( )
( ) = ( − 1) + ( ) ( )− ( ) ( − 1)
( ) = ( ) ( ) = ( − 1) ( ) + ( ) ( − 1) ( )
(2-16)
( ) = ( − 1) − ( − 1) ( ) + ( ) ( − 1) ( )
= − ( ) ( ) ( − 1)
Kalman Filter
The Kalman filter is a great tool for analyzing and solving estimation problems. The linear
standard Kalman filter is used for linear process model whereas Extended Kalman Filter,
Unscented Kalman Filter, etc. are used for the non-linear process model. Its work by
propagating the covariance and mean of the state through time. The Kalman filter for states
estimate is optimal several different senses. The following steps are involving in Kalman filter
algorithm:
A mathematical model of the dynamic system is derived as shown in equation (2-17)
= + + (2-17)
1
X(t) and X(t-1) mean X at present time instant and X at previous time instant respectively. The notation Xt and
Xt-1 also mean the same things as present and previous time instant.
15
System Identification and Parameter Estimation
= + + ,
= [ ],
= [ ]
Describe the propagation of the state mean and covariance of the system with time
Discretization of the state mean and covariance as states above
Update of the discrete form at every time step [13]
W and V are covariance’s matrices which are used to tune the Kalman filter. The discrete time
filter for a linear process can be implemented with the following steps [14]
Initialize the Kalman filter for time k=0, using the initial state or known state of the
system as given in equation (2-18)
= = ( )
(2-18)
= = [( − )( − ) ]
=A +
(2-19)
= ( + )
Compute the predictor, a priori state and output estimate as given in equation (2-20)
= +
(2-20)
= +
Compute the corrector, a posterior state estimate using the output measurement as
given in equation (2-21)
= + ( − ) (2-21)
= − − + (2-22)
Repeat the step all over again for the next time interval, k+1.
If the Kalman filter gain is assumed to be steady then the algorithm reduces to a single equation
as shown in equation (2-23).
= + + ( − + ) (2-23)
Relay Methods
The relay experimentation as discussed in section 4.1 can be employed to determined critical
point for parameter estimates for PID auto tuning. Different configuration and modification
will give different points on the Nyquist curve which will give the point of interest to identify
16
System Identification and Parameter Estimation
the gain and the time delay parameter in equation (3-20) and (3-21). This will only give an
estimate and only valid around the ultimate frequency for an ideal relay and at different
frequencies as given by the modification of the relay during the experimentation. The
experimentation will recursively calculate the critical parameters as discussed in in section 4.
17
PID Controllers Tuning Algorithms
18
PID Controllers Tuning Algorithms
-1
PID Algorithms
The major algorithms used for PID design are in three forms, which are standard, parallel and
classical. These algorithms contain several variation or modification. The major difference
between these three algorithms is the way the controller gain is specified. The parallel form has
a proportional gain that affects only the proportional part while the other two forms have a
controller gain that affects all the three terms. [16]
For better performance, the following are taking into consideration [4]
The derivative part is mostly applied to the process output
Proportional part act only on a fraction of the reference part
The integral action is kept within the saturation action of the control variables (anti
windup)
Bump less or smooth transfer from manual to automatic (or when there are parameter
changes)
( ) 1
ℎ ( )= = 1+ + (3-2)
( )
Where Kp is the proportional constant, Ti is the integral time and Td is the derivative time as
shown in Figure 3-2. The output of the controller is ( ) and the input e(t) in time domain
respectively. And the input and output are u(s) and e(s) in frequency domain respectively. The
Laplace transfer function of the controller is given as ℎ ( ).
19
PID Controllers Tuning Algorithms
Proportional
Set point /Reference +- Error + Process
Integral
1
+
Derivative
Figure 3-2: The ideal or ISA PID algorithm. It’s also called the non-interactive, expanded. In
this form the proportional gain affects all the three parts.
( )= × + . + (3-3)
ℎ ( )= + + (3-4)
Where Kpp is the proportional constant, i is the integral time and is the derivative time for
the parallel form. The superscript ‘p’ is used to indicate the parallel form of the PID.
= ; = ; = (3-5)
Proportional
Set point /Reference +- Error
+ Process
+
Integral
+
Derivative
Figure 3-3: The Parallel form of PID algorithm, the gain affects only the proportional part as
compared to the standard form where the proportional gain is affect both the integral and
derivative parts.
20
PID Controllers Tuning Algorithms
1
ℎ ( )= 1+ × [1 + ] (3-7)
Where Kc is the proportional constant, is the integral time and is the derivative time.
The superscript ‘s’ is used to indicate the series form of the PID.
Proportional
Set point /Reference +- Error + + Process
Integral
1
Derivative
Figure 3-4: Series or interacting PID form. It’s also called the cascade real form. The PID parts
interact with each other, the integral part interacts with the derivative part and vice versa.
The series or cascade form of equation (3-7) is equivalent to the ideal form of equation (3-2)
where the relationship between the controller parameters is as given in equation (3-8).
+
= ; = + ; = (3-8)
+
Given the ideal form of the controllers’ parameters their equivalent series parameters can be
determined if only if the condition given in equation (3-9) holds. [18]
≥4 (3-9)
= 1 + √ 1− ; = 1 + √ 1− ; (3-10)
21
PID Controllers Tuning Algorithms
4
= 1 + √ 1−
2
The derivative time is often much smaller that the integral time and the two forms are then
equivalent as shown in equation (3-11) .
1+ + ≅ 1+ × [1 + ] (3-11)
ℎ ( )= (3-12)
Where 'a and L are derived from step response as shown in Figure 3-5 (a) [4]. The tangent at
the point of maximum slope of the step response is extended to both the vertical and horizontal
axes to gives a and L respectively. The relationship between the maximum slope R, dead time
L, applied step change U (which is usually unity) and a is given by equation (3-13).
22
PID Controllers Tuning Algorithms
Figure 3-5: Process reaction curve: The left figure (A) shows L, the dead time, and R, the
reaction rate, which is the max rate of change of temp with respect to time [9]. The right
figure (B) shows the step response of the air heater.
= ; = ; = − (3-13)
Table 3-1 gives the PID setting for Z-N open loop method where a is equivalent to LR/U as
given in Figure 3-5 where U is the applied step change, L is the dead time and R is the maximum
rate of change of the process output.
Table 3-1: Z-N open loop method.
Controller Type Kp Ti Td
P Controller 1/a
PI Controller 0.9/a 3L
23
PID Controllers Tuning Algorithms
Controller Type Kp Ti Td
P Controller 0.5Ku
Figure 3-6: The plot showing the reading of the gain that cause first significant overshoot and
Tout which is the time between the overshoot and undershoot. [20]. The controller is set in P
only mode and the proportional gain increased to achieve this.
24
PID Controllers Tuning Algorithms
The controller parameter can be found in relation to Good Gain method as given in equation
(3-14).
= 0.5 ; = 0.8 ; ; = 0.125 (3-14)
Where Tout and Kpg are the time interval between the overshoot and undershoot, and the value
of Kp that cause the overshoot as shown in Figure 3-6.
However, the method is not suitable for a process with double integrator, an integrator only
process and time constant without time delay process. [20]
Cohen-Coon Method
Like Z-N method, is based on the loop response of the process as shown in Figure 3-7 . A step
change is applied after the process has reached a steady state under manual mode, the time
constant τ and delay td are evaluated as shown in Figure 3-7 [21]. The tuning formula is
presented in table xxx. The relationship between z, k, B A, is given in equation (3-15).
= ; = (3-15)
Figure 3-7: Process reaction curve for the Cohen-Coon method showing the dead time and
time constant.
Table 3-3: Cohen-Coon method
Controller Type Kp Ti Td
P Controller 1
1+
. 3
PI Controller 1 30 + 3.
0.9 +
. 12 9 + 20.
PID Controller 1 32 + 6. 4
(1.33 + 0.25 )
. 13 + 8. 11 + 2.
25
PID Controllers Tuning Algorithms
2 1+E
= Ku; = Pu (3-17)
(1 + E ) 2
ℎ ( )= (3-18)
1−
ℎ ( )= = (3-20)
1+ 1+
1−
ℎ ( )= = (3-21)
(1 + )(1 + ) (1 + )(1 + )
Generally, if the model does not have a dominant second order dynamic, then it’s can be
approximated with a first order model as given in equation (3-20). Also, a first order time delay
system with a dominant time constant can be approximated with an integrator plus time delay
model of equation (3-18). However, a system with dominant second order dynamics can only
be approximate with second order model as given in equation (3-21). [18]. Given an nth order
system as given in equation (3-22) this can be reduced to the form of equation (3-20) or (3-21)
by setting the time constant and time delay as given in equation (3-23) and (3-24) respectively.
26
PID Controllers Tuning Algorithms
1−
ℎ ( )= (3-22)
(1 + )(1 + ) … … … (1 + )
:= + ; := + …+ (3-23)
:= ; := + ; := + …+ (3-24)
is the time delay and 1 − is the time delay approximation, T1, T2 …. Tn are time constants.
The SIMC PID controller setting for a PID2 is given by equation.
= ( )
; = [ , ( + )] ; = (3-25)
Where the respective terms in equation (3-25) are as defined in section 3.1.1.13 and TC is a user
specified time constant for set-point response. In the original IMC setting the integral time is
set to the dominant time constant, and in SIMC a smaller integral time was suggested to
improve on the disturbance response. The parameter c, determined the value of the integral
time and a value of 4 was suggested by Skogestad. A more conservative value for the parameter
c is suggested in other variant of this method for better disturbance response performance.
Tyreus-Luyben Method
The Tyreus-Luyben method was proposed by Bjorn Tyreus and William Luyben in 1992. [23].
This method provides an improvement on IMC by using classical frequency response analysis.
This method optimally selects a tradeoff between the integral time and proportional gain of a
PI controller. The tradeoff is based on the fact, that there is a minimum reset time for the
integrator time below which reasonable closed loop damping confidents cannot be achieved
and there must be an optimum controller gain for this to occur. The method is similar to Z-N
closed loop method and the experimentation steps are the same for finding the ultimate gain
and period. The setting for PI and PID controller are shown in Table 3-4.
Table 3-4: Tyreus-Luyben method.
Controller Type Kp Ti Td
PI Ku/3.2 2.2Pu
2
A first order approximation will result in a PI controller while a second order will result in a PID controller.
3
The standard or Idea PID algorithms is used.
27
PID Controllers Tuning Algorithms
process. Therefore, it is necessary to examine a typical tuning rule for these processes. David
[24] proposed the RTDE method that gives an improvement on SIMC discussed in section
3.2.6 for time lag dominant systems.
The PI parameters are chosen in such a way as to ensure a maximum delay error, for
stability margin.
̅
= ; ̅= ; = ( + 1); =( )
;
(3-26)
̅
= ; =
The PI parameter are given in term of time delay error ratio parameter
, ℎ ̅, which is equal to 3.28 for the original ZN method [24]
and the integrator gain velocity k’ as shown in equation (3-27).
̅
= = (
; and
)
= = ( + 1) (3-27)
This method was extended in [25] to double integrating plus time delay system where a PD
and PID controller was designed for such a system based on relative time delay error. Consider
a PI controller with an integrating plus time delay system will have a loop transfer function as
given in equation (3-28) also a PD controller for a double integrating plus time delay system
will have a loop transfer function as given in equation (3-29)
ℎ = (1 + ) (3-28)
′ (3-29)
ℎ = (1 + ) ; =
Comparing equations (3-27), (3-28) and (3-29) will give a PD controller tuning formula as
given in equation (3-30).
= ; = (3-30)
28
PID Controllers Tuning Algorithms
In equation (3-32) the s is the Laplace operator A, B and C as given in equation (3-31)
The condition for stability can be study with different tools like Nyquist stability criterion,
Nichols plot, Bode Plot, finding the gain margin and phase margin.
29
PID Controllers Tuning Algorithms
450 a=0.01
a=-0.01
400
350
300
250
200
150
100
50
0
0 50 100 150 200 250 300 350 400 450 500
Time (seconds)
Figure 3-8: Open loop step response for the system in equation (3-33)
30
PID Controllers Tuning Algorithms
a=0
1.8
a=0.01
a= -0.01
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0
0 2 4 6 8 10 12
Time (seconds)
Figure 3-9: Closed loop step response for the system in equation (3-33)
The performance of the control system may be analyzing from the step response of the system
as shown Figure 3-10, with the following criteria as define in [1], [26].
The time for the system to rise from 10% to 90 % of its steady state value as shown in
Figure 3-10.
The overshoot Os is the ratio of the first peak minus the steady value, and the steady
state value.
Steady state error is the value of the control error at steady state
Settling time is the time for the response to reach a specified percentage of the steady
value, usually within 2% of the input step.
Decay ratio is the ratio between two consecutive peaks for a step response
Time to peak which is the time the step response reaches its peak value
31
PID Controllers Tuning Algorithms
Figure 3-10: Closed loop step response showing performance indexes [26].
32
PID Controllers Tuning Algorithms
= = (3-41)
The rule of thumb is that a well tune controller should have GM between 1.7 and 4.0 and PM
range of 30o to 45o. [17]
33
PID Controllers Tuning Algorithms
The bode plot from the air heater process is shown in Figure 3-11.
The following relation also can be obtain from the Bode plot:
A system is stable if the phase cross over frequency is greater than the gain cross over
frequency. Also if both gain and phase margin are positive then the system is stable.
A system is said to be marginally stable if both the gain and phase margins are zero, or
if the phase and the gain cross over frequency are equal.
A system is unstable if phase cross over frequency is less than gain cross over frequency
or if either one/both of the margin is negative.
Table 3-5 gives a summary of the performance indication that can be capture from the
frequencies response analysis.
Table 3-5: Frequency and stability relationship
Poles All negative poles One or more poles are All positive poles
zeros
Figure 3-11: Bode Plot of the air heater (using bode function in MATLAB)
34
PID Controllers Tuning Algorithms
Figure 3-12: Nyquist plot showing margins [27] and the left plot show the Nyquist plot for the
air heater transfer function.
= | | (3-42)
The IAE for set point tracking is designated as IAES and for disturbance response as IAED. The
lower the IAE index the better control performance response of the system. Other index like
Integral error (IE), Sum of prediction error squared (SSEP) and Integrated squared error are
also used and provide almost the same bench mark for comparison.
35
PID Controllers Tuning Algorithms
= | − | (3-43)
36
PID Auto-Tuning Methods
Relay has been in used since the fifties as amplifier but was applied to adaptive control in the
sixties. Relay auto tuning has the following advantages: [6]
It’s easy to automate by switching from the controller to the relay during auto tuning
operation
The method does not introduce loop instability
Little priory knowledge of the process is necessary
With the correct selection of the relay parameter the process error can be minimize
during the tuning.
Åstrom Relay is designed in such a way that whenever the process value (or error) passes a
preset point, the process is actuated by the relay as shown in Figure 4-2 [29]., an oscillation
within the limit cycle of the relay amplitude is generated. Schei relay is connected as shown in
37
PID Auto-Tuning Methods
Figure 4-4, and when the relay is operational the input to the system will varied between the
set point plus relay amplitude and set point minus relay amplitude. The experiment is done in
closed loop to keep the process output within limited bounds.
Åstrom method required that the system is brought to rest before the experiment is performed
whereas Schei make used of established control loop, thus any input during the experimentation
will be sufficient to trigger the relay into action.
The system is automated as shown in the block diagram of the implementation in Appendix C,
where the operator can select through a knob either the PID or relay mode.
= + ; y= (4-1)
Assume the process is oscillating with a limit cycle of period T, and tk is the time for relay to
switches at time k, therefore the time to change from one state to another, ∆ /2 which is
half the limit cycle period as given in equation (4-2)
∆
= + ; ∆ = − = (4-2)
Recall that the output of the relay, d is the input to the process, therefore resolving equation(4-2)
will gives equation (4-3), since the limit cycle is symmetric, the input at time k and k+1 have
the relationship given in equation (4-4)
=ɸ + ɣd
(4-3)
Where ɸ = + and ɣ =
=− (4-4)
38
PID Auto-Tuning Methods
Putting equation (4-4) into equation (4-3) and solve for the output in equation (4-1), will gives
equation (4-5) which must be true for a limit cycle to occurs.
( + ɸ) ɣ = 0 (4-5)
Figure 4-1: A nonlinear element f (.) such as a relay will drive the linear element g(s) into
oscillation.
The Fourier series expansion of the periodic output signal is given by equation (4-7):
= ( ) (4-8)
= ( )cos( ) (4-9)
= ( )sin( ) (4-10)
Since the output of the non-linearity is assumed to be sinusoid, the term a0 and an are equal to
zero because the output is symmetrical about the origin. Equation (4-7) becomes:
( )= sin( ) (4-11)
39
PID Auto-Tuning Methods
2
= ( ) ( ) (4-12)
Solving equation (4-12), gives equation (4-13) for odd harmonics and zeros for even
harmonics:
= (4-13)
( )= sin( ) (4-14)
And the describing function N(a) is given by the ratio of equation (4-14) to (4-6) at the
fundamental component:
( )
( )= = ( )
= (4-15)
The system will be show continues cycling or marginal stability if the open loop transfer
function is zero, (Zeros poles for the feedback system.). This means that the system
input/output amplitude and phase are the same for the closed loop. For this condition equation
(4-16) is established:
1 + ( ) ( ) = 0; ( ) =− (4-16)
The ultimate gain, Ku and ultimate period, and ultimate frequency are as given in equation:
= ; = Tu; = (4-17)
Where Tu is the period of the sustained oscillation at approximately cross over frequency:
40
PID Auto-Tuning Methods
Figure 4-2 Åstrom Relay Auto Tuner showing the Relay and PID controllers’ connection to
the Process in a feedback loop. The operator can perform auto tuning by switching from the
controller to the relay in which case the input into the process will oscillate between the set
point +/- the relay amplitude.
The period of oscillation is determined through zero crossing of the signal during the relay
experimentation as shown in the MATLAB code in Appendix B. Amplitude is measured
through the simple measurement of the maximum and minimum values of the signal during the
relay experimentation. The code for this is presented in Appendix B.
With the ultimate gain and period derived as in equation (4-17), Z-N tuning algorithms as given
in Table 3-2 can be applied. Other tuning algorithms can as well be applied to achieve varying
results but this will not the subject of discussion for this thesis.
Figure 4-3: The plots from the relay experiments using Åstrom method with Air heater. The
upper plot (yellow color) shows the error signal between the reference and output signal, this
is used as the input to the linearizing element to get the switching action for the relay in the
middle plot (blue color). The middle plot shows the output from the relay and this is the control
signal to the process. The Last plot in red color shows the process output.
41
PID Auto-Tuning Methods
experiment and this need to be improved. The reference signal to the PID controller is varies
between positive and negative values of the relay. Therefore, the control signal to the process
is a function of the relay switching and thus a limit cycle will be established as discussed in
section 4.1.1. It’s also employed a filter in the derivative loop to help in noise situation as
discussed in section 4.4. Figure 4-4 shows the block diagram of the implementation of Schei
scheme and the result from simulation will be discussed in section 5.
Figure 4-4: Schei Relay Auto Tuner showing the Relay and PID controllers’ connection to the
Process in a feedback loop. During relay experiment the reference signal varies in step by the
relay output. The relay is made to switch by the error signal by the application of a linearizing
element as shown in equation (4-18).
The principle is based on the near critical point estimation with automatic generated relay test
signal that make the process to oscillate around the ultimate frequency with bounded amplitude.
This estimation point is a function of the linearizing element in the loop.
The relay is designed to change the control effort each time the process output passes the set
point (or the error crosses zero). This will create an oscillation that will becomes stable after
some time as shown in Figure 4-3 and Figure 4-5 for Åstrom and Schei method respectively.
The following steps are taken for both Åstrom and Schei auto tuner
Let the process to a steady state
Implement relay controller
o If process gain is positive,
ℎ ≥0
= (4-18)
−ℎ <0
42
PID Auto-Tuning Methods
Figure 4-5: The plots from the relay experiments using Schei method with Air heater
(simulator). The upper plot (red color) shows the output from the relay which is used to varies
the reference signal thereby changing the error signal. The output from the PID controller is a
function of the error signal and with the right perturbation of the relay, this error signal will
cause a sustained oscillation in the process output which can be used to re-evaluate the process
parameter.
Schei [3] auto tuner improve on the result by optimally trading between robustness and stability
in choosing the PID parameters. This is done by specifying four different mode of the auto
tuner based on the complementary sensitivity function as shown in equation (4-20)
3.0 0.75
1 = ; = , = 1.1
3.0
2 = ; = 0, = 1.1
(4-20)
1.0
3 = ; = 0, = 0.9
3.0
4 = ; = 0, = 1.3
43
PID Auto-Tuning Methods
be use for obtaining the parameters as required. The switching makes it difficult to find the
period and amplitude accurately. Modification of the ideal relay can be used to identified
different point and prevent relay chattering. Several options exist for relay modification and
only five of this option will be discussed in this section.
Figure 4-6: Air heater simulation with a random noise. The upper plot in yellow shows the
process without noise, the middle plot shows the process with measurement noise added and
the lower plot in red show the filtered process with a low pass filter.
44
PID Auto-Tuning Methods
Figure 4-7: The plots from the relay experiments with noisy process using Åstrom method with
Air heater. The upper plot shows the error signal between the reference and output signal, this
is used as the input to the linearizing element to get the switching action for the relay in the
middle plot. The middle plot show that the relay switches too fast because of the noise.
Figure 4-8: Types of relay shown (a) Symmetrical without hysteresis. (b)Asymmetrical without
hysteresis. (c) Symmetrical with hysteresis. (d)Asymmetrical with hysteresis [31].
45
PID Auto-Tuning Methods
+ℎ ≥Ɛ
= (4-21)
−ℎ <Ɛ
4 1
( )=
(4-22)
1− +
The describing function for a relay with hysteresis is as given in equation (4-22) , with different
values of the hysteresis and the relay amplitude, several points of interest can be identified on
the Nyquist curve other than the critical point. [32] . The major problem is that the switching
period may differs from the ultimate period. The switching oscillation period as shown in
equation (4-23) is not the ultimate period.
Figure 4-9: Fig(a) and Fig(b) shows the use of an integrator in conjunction with a relay to
identify the parameters at frequency ω90, and phase shift of -90 deg.
46
PID Auto-Tuning Methods
Figure 4-10: A relay with filtering implementation to prevent chattering for a noisy process.
Saturation relay
The describing function analysis use the ratio of the input and the output of the relay to identify
the critical point. The results from this method is subjected to errors as the two functions being
compare are not of the same dynamic, the input is purely a sine wave and the out a square
wave. To remove this anomalies saturation relay is employed instead of the ideal relay to make
the output as close as possible to the input of the relay that is to be more sine wave and less
square wave. [8]. The saturation relay is characterized by the relay height h, and the slope k,
and the saturation factor, ϱ, as given in equation (4-24).
ϱ= ; (4-24)
The describing function for a saturation relay is as given in equation (4-26), if the values of the
slope are too large; the saturation relay tends to behave like an ideal relay. Figure 4-11 shows
the saturation relay where the relay height h, the slope k, and the factor ϱ are as given in
equation (4-24) [8].
2ℎ 1 ϱ −ϱ
( )= sin + (4-26)
ϱ
47
PID Auto-Tuning Methods
Figure 4-11: The saturation relay is shown in A and the input and output of a saturation relay
is shown in B. The output is more like the input (sine wave) compare to an ideal relay which
is purely square wave.
= k+ ; = Tu; = (4-27)
48
Simulation and experimentation study
Where:
Tout- is the air temperature at the tube outlet in degree Celsius,
Tenv- is the environmental (room) temperature in degree Celsius,
Kh [ oC/V] is the heater gain,
is the time constant,22
[ ] = 2 sec (is the delay due to air transportation and sluggishness in the heater),
[ ] – is the control signal of the heater,
1
( ) = ( ) +[ ∗ ∗ (− +[ ∗ ( − )+ ])] (5-2)
Where:
( ) is the next (future) temperature out of the air heater,
is the present air heater temperature out of the air heater,
is the sampling time.
The air heater Ordinary Differential Equation (ODE) model as given by equation (5-1) need to
be transform to the transfer function model for frequency analysis in MATLAB.
The Laplace transforms of the ODE is given by equation (5-7). Equations (5-3) to (5-6) shows
the steps for the transformation.
1
ʆ ) = ʆ( ∗ (− +[ ∗ ( − )+ ])) (5-3)
4
The D term in the PID controller do amplifies measurement noise thus causing the control signal to changes
randomly.
49
Simulation and experimentation study
1
( )= ∗ (− ( )+[ ( ) ]) (5-4)
( ) ( )
( )+ = (5-5)
( ) ( )
( )+ = (5-6)
Simplifying equation (5-6) will give the transfer function as given in equation (5-7)
( )
= (5-7)
( ) 1+
Where Tout, u, Kh and Tc have their respective definition as given for equation (5-1).
( )= (5-8)
1+
The open loop transfer function of the air heater process with a pure P controller is given by
equation (5-9)
( )= ( ) ( )= (5-9)
1+
( )= ( ) ( )= (5-10)
1+
( )= ( ) ( )= (5-11)
1+
The ultimate gain and frequency can be find at the cross over frequency as given in
equation (5-12)
= = 1+ ; ( + tan )= (5-12)
With the value of the air given as derived from step response discussed in section 2.1.4, Tc is
22 and 2 .
= = 1 + 22 ; (2 + tan 22 )= (5-13)
50
Simulation and experimentation study
Solving equation (5-13) gives Kc and as 17.92 and 0.8133rad/s respectively. Also, the
period of oscillation is calculated to be 7.72s. This is the basis for Z-N method and the gain is
always too much that it can damage some process equipment if used on real process, therefore
Åstrom devised the relay experimentation method that only uses a fractional part of the ultimate
gain to re-evaluate the process parameter.
5
The noise is added to the measurement output as a random noise
51
Simulation and experimentation study
Figure 5-1: Åstrom relay experimentation for a noisy signal of random noise (0.01). The
upper middle and lower plot shows the error signal, relay output and process output
respectively.
Figure 5-2: Åstrom relay experimentation for a noisy signal of random noise (0.01). The
upper middle and lower plot shows the process without noise, noisy and filter output
respectively.
52
Simulation and experimentation study
6
Due to the eractic switching of the relay
53
Simulation and experimentation study
Figure 5-3: The comparison of the PI parameters estimated during Åstrom relay experiment
on simulated air heater
Table 5-2: Stability analysis in frequency domain7
7
The MATLAB function MARGIN was used with the transfer function equivalent of the controller and the
process
54
Simulation and experimentation study
Schei _ noise (0.1) 10.8 0.93 0.1362 9 0.4206 12.45 125.75 0.8593 0.0517
+Relay hysteresis(0.1)
8
For Schei method the relay does not switch with a filter in series with it as the output is filtered out
55
Simulation and experimentation study
Figure 5-4: The upper plot show the relay output and the lower plot shows the control signal
during Schei experimentation for noisy process. The experimentation is initiated around 110
seconds.
Figure 5-5: The upper plot show the control error and the lower plot shows the process output
during Schei experimentation for noisy process. The experimentation is initiated around 110
seconds.
56
Simulation and experimentation study
Figure 5-6: The frequency and period during Schei Relay experimentation.
57
Simulation and experimentation study
Table 5-5: Performance tracking for a process with noise using different PI parameters.
Figure 5-7: The plot of the different PI parameters derived from the relay experiment (Astrom
and Schei with and without noise) to control the simulated process without noise
9
The negative sign means that the process does not converge within the time frame of comparisons
58
Simulation and experimentation study
Figure 5-8: The plot of the different PI parameters derived from the relay experiment
experiment (Astrom and Schei with and without noise) to control the simulated process without
noise with a step change around 100s.
Figure 5-9: The plot of the different PI parameters derived from the relay experiment (Astrom
and Schei with and without noise) to control the simulated noisy process
59
Simulation and experimentation study
Figure 5-10: The plot of the different PI parameters derived from the relay experiment (Astrom
and Schei with and without noise) to control the simulated noisy process with reduced scale
to have a better view of the effect of noise.
Figure 5-11: The plot of the different PI parameters derived from the relay experiment (Astrom
and Schei with and without noise) to control the simulated noisy process noise with a step
change around 100s.
10
Real Time space was used in the Simulink environment and this was set to 10. Therefore all-time dependent
parameter need to be divided by 10.
60
Simulation and experimentation study
environment and the dynamic of the process will still remain as such. Figure 5-13 shows the
relay switching and the control signal. The relay experimentation was started around 350
second, the frequency counter was not effective because of the random noise and as such does
not give an accurate PI parameters. The measurement was average over the period of time as
shown in Appendix D, to get a conservative figure for the controller implementation.
Alternatively, the measurement was done manually to cross check the derived parameters as
shown in Figure 5-14. The derived parameters are Kp 1.8 and Ti is 15s.
The control signal is kept within the bound by the PI controller and such for a good performance
of the auto tuner, a fairly good controller parameters must be the starting point. More plots
from the experimentation are presented in Appendix D.
Figure 5-12: Real air heater; upper plot show the unfiltered output while the lower plot show
the filter output
61
Simulation and experimentation study
Figure 5-13:Real air heater; upper plot show the relay output while the lower plot show the
control signal during the relay experiment
Figure 5-14: Process output from the real air heater used to cross check the calculated
parameter from the auto tuner
62
Simulation and experimentation study
Figure 5-15: Process output and reference plot with the derived PI controller controlling the
real air heater with step changes at interval. Notice the time axis has been cut off from the
plot.
−
ℎ = 2 ℎ + 2 ℎ +
(5-14)
− (1 − )
ℎ = 2 ℎ +
− (1 − )
ℎ = 2 ℎ +
Where ℎ is the rate of change of water level hi for tank i, ai is the cross-section of the outlet
hole in tank i, is the pump voltage. ‘g’ is the acceleration due to gravity, Ai is the cross-
section of tank i. The constant is a valve parameter that measure the diversion of flow from
the valve to the tanks, and the range is from 0 to 1. The model parameters is as given in Table
5-6. The linearized model, linearization point and the derived state space model are given in
Appendix B . The non minimum phase characteristic as presented in [35] and [36] will be used
for the simulation study.
63
Simulation and experimentation study
1
− 0 0 0
1
0 − 0 0
= +
1 (1 − )
0 0 − 0 0
(5-15)
1 (1 − )
0 0 0 − 0
0 0 0
=
0 0 0
2ℎ
=
(5-16)
= 1, … ,4.
parameter Value
A1, A3 28 [cm2]
A2, A4 32 [cm2]
g 981[cm/s2]
64
Simulation and experimentation study
For the experimentation the control is decentralized with two separate controller as shown in
Figure 5-17. This is a case of multiple input and multiple output (MIMO) system as presented
in [7]. The quadruple will be consider as two SISO processses whereby each tank will have an
independent loop without pairing.
Figure 5-17: The block diagram of the two input and two output system with decentralized PI
control, Hc1 and Hc2.
Kp Ti Kp Ti
65
Simulation and experimentation study
Figure 5-18: Process error and relay switching during Åstrom experimentation on quadruple
tank (closed loop control on tank 1 and open loop control on tank 2).
Figure 5-19: Controlling the tank with the PI parameters derived during the experiment (PI on
tank 1 and manual control on tank 2). Step changes for the reference and control input for
both tank 1 and 2 respectively were made at intervals.
66
Simulation and experimentation study
Figure 5-20: Process output and relay switching during Åstrom experimentation on quadruple
tank (closed loop control on both tanks).
Figure 5-21: Controlling the tank as two separate SISO system with PI derived from Åstrom
relay experimentation
67
Simulation and experimentation study
to improve on the relay structure to achieve a better result. Figure 5-22 show the plot of the
error and control signal while Figure 5-23 show the plot of the relay and process output during
the experiment.
Table 5-8: The parameters derived during Schei relay experimentation on the quadruple tank
Figure 5-22: The plot of simulation from the Schei relay experimentation showing the control
signal (u1 and u2) and the error signal (e1 and e2) for both tanks.
68
Simulation and experimentation study
Figure 5-23: Figure 5-24: The plot of simulation from the Schei relay experimentation
showing the process output (y1 and y2) and relay output (R1 and R2) for both tanks.
69
Simulation and experimentation study
Figure 5-25: comparing Åstrom and Schei PI parameter with step changes on both reference-
tank1 and tank2- to show the effect of cross coupling of the tanks on the controllers. (Tank 1
on the upper plot and tank 2 on the lower plot).
70
Discussion and Result
71
Discussion and Result
The implementation of Åstrom is simpler and easier than Schei and take less time to
converge during the experiment.
For a multiple input and output system, the Schei relay experimentation become more
complicated as the correct paring of input and output variables must be determined for
the optimal performance of the controller in the loop. This is the case of the quadruple
tank where the Schei derived parameters performed poorly compared to Åstrom’.
A knowledge of the process dynamic change is required for Åstrom relay
experimentation for the relay to switch accordingly whereas the PID in the loop for
Schei relay experimentation will bring the process to the required steady state.
Åstrom relay experimentation gives a PI performance with less percentage overshoot
Schei relay experimentation gives a PI performance with smaller steady state error
compared to Åstrom.
Both methods are safe as only a very small amplitude of process oscillation occurred
during the experiments.
72
Conclusions
7 Conclusions
The original Åstrom relay feedback auto tuning and the modification of the method by Schei
have been reviewed. Their performance was accessed through simulated air heater and the
quadruple tank processes.
Modification of the relay was carried out to ensure the relay switching was not erratic under
noisy condition. A relay with hysteresis performed adequate for the purpose of a noisy process.
The use of filter in series with the relay was tried but failed for Schei method. The dynamic of
the measurement noise filter and if applicable the filter in the relay loop do affect the tuning
process.
Åstrom method does not work on the real air heater as the process does not accept negative
values from the relay. The Schei method was successful applied to the real air heater. Schei
method perform better for disturbance rejection than Åstrom but the performance is based on
a prior controller parameters before the experiment.
The auto tuning by relay experimentation is simple and easy to implement method of recursive
process parameter estimation and also re-adjusting the parameters of PID controllers. It does
not pose a danger of causing the process instability as well as damage to process equipment
during the tuning operation. It can be used by an inexperienced operator as it does not required
prior knowledge of tuning process as it done by merely pushing a button.
The control algorithm implementation is manufacturer dependent and they used different
names for the same PID algorithm. Notwithstanding as an Engineer, operator or end users of
PID controller, they must be conversant with different form of PID and should know the form
deployed by a specific PID manufacturers. The conversion from one forms of PID to others
was discussed as this is crucial for optimum performance.
The choice of the tuning rule is a subject of the optimal choice of the user and this can be
decided by using Pareto optimality concept which is recommended for future work.
73
References
8 References
[1] K.Åström and T.Hägglund , PID Controllers: Theory, Design ,and Tunning, Instrument
Society of America, 1999.
[2] K.J Åstrom and Hågglund, «Automatic tuning of simple regulators with specification
on phase and amplitude margins,» Automatica, vol. 20, nr. 5, pp. 645-651, 1984.
[3] T. S. Schei, “A method for closed loop automatic tuning of PID controllers,”
Modelling, Identification and Control, vol. 13, no. 3, pp. 155-162, 1992.
[4] K. J.Åstøm and B. Wittenmark, Adaptive Control, United States of America: Addison-
Wesley Publishing Company, 1995.
[5] S. Skogestad, “Simple analytic rules for model reduction and PID controller tuning,”
Modelling,Idebtification and Control, vol. 25, no. 2, pp. 85-120, 2004.
[6] C.C Hang, K.J Aström, Q.G Wang, “Relay feedback auto-tuning of process controllers-
a tutorial review,” Journal of Process Control, no. 12, pp. 143-162, 2001.
[7] B. Josefin, «Automatic Controller Tuning Using Relay -based Model Identification,»
Sweden, 2017.
[8] S. Haur,H-D Den yu and C-C Yu, «Use of sarturation relay feedback for autotune
Identification,» Chemical Engineering Science, vol. 51, nr. 8, pp. 1187-1198, 1996.
[11] D. Ruscio, «Subspace System Identification theory and application ( A lecture notes),»
Telemark Institute of Technology, Porsgrunn, 1994.
[13] D. Simon, Optimal State Estimation, USA: John Wiley & Sons ,Inc, 2006.
[14] S. Roshan, «Lecture notes for the course IIA 4117: Model Predictive Control,»
University of SouthEast, Norway, Porsgrunn, 2017, June.
[15] C Dalen and D. D Riscio, "A Semi-Heuristic Process-Reaction Curve PID Controller
Tuning Method," Modelling, Identification and Control, vol. 39, no. 1, pp. 37-43, 2018.
74
References
[17] Seborg, Edgar,Mellichamp and Doyle, Process Dynamic and Control, United States:
John Wiley & sons, 2011.
[18] D. D. Ruscio, System Theory State Space Analysis and Control Theory, Porsgrunn,
August 1996.
[20] F. Haugen, «The Good Gain Method for Simple Experimental Tuning of PI
Controllers,» Modeling, Identification and Control, vol. 33, nr. 4, pp. 141-152, 2012.
[24] D.D Ruscio and C. Dalen, «On Tunning PI Controllers for Integrating Plus Time
Delays System,» Modelling,Identification and Control, vol. 31, nr. 4, pp. 145-164,
2010.
[25] D.D Ruscio and C. Dalen, «Tuning PD and PID Controllers for Double Integrating Plus
Time Delay Systems,» Modeling, Identification and Control, vol. 38, nr. 2, pp. 95-110,
2017.
[26] B. Goodwine and J. Lucey , «University of Notre Dame,» Aerospace and Mechanical
Engineering, 20 10 2003. [Internett]. Available:
https://controls.ame.nd.edu/ame301/hw7. [Funnet 07 04 2018].
[30] D Debabrata and J.K Bhattacharjee, «Limit Cycle Oscillalations,» Vibration Problems
ICOVP-2007. Springer Proceedings in Physics, vol. 126, 2008.
[32] J Lee, J.S Kim, T. F. Edgar, S. W. Sung, «Relay Feedback Idebtification for Processes
under Drift and Noisy Environment,» American Institute oF Chemical Engineers, vol.
57, nr. 7, pp. 1809-1816, 2010.
75
References
[33] K.K. Tan, T.H. Lee, S.Huang, K.Y.Chua, R.Ferdous, "Improved critical point
estimation using preload relay," Journal of Process Control, no. 16, pp. 445-455, 2006.
[34] F. Haugen, «Lab Station: Air Heater,» Univeristy College of Southeast Norway, 20
September 2016. [Internett]. Available: http://home.hit.no/~finnh/air_heater/. [Funnet
26 March 2018].
[40] S. Nikita and M. Chidambaram, «Improved Relay Auto-Tuning of PID Controllers for
Unstable SOPTD system,» Chemical Engineering Communication, vol. 203, pp. 769-
789, 2016.
[41] T.Liu, Q-G Wang and H-P Huang, «A tutorial review on process identification from
step or relay feedback test,» Journal of Process Control, vol. 23, pp. 1597-1623, 2013.
76
Appendices
Appendices
Appendix A: Thesis’s Task Description
77
Appendices
78
Appendices
% zf=0
% end
Amplititude Calculation
function [p, o, y_tmp, Ymin]= fcn(m, n, y, y_temp, Ymin_hold)
% Y = main data for period calculation
% y_temp = to store three values to check maxima
% k = index to shift from y0 to y1 in Y
o = n;
Ymin = Ymin_hold;
y_tmp = y_temp;
if m>=3
if y_temp(1) > y_temp(2) && y_temp(2) > y
if n == 0
Ymin(1,1) = y_temp(2);
Ymin(2,1) = m - 1;
o = 1;
elseif n == 1
Ymin(1,2) = y_temp(2);
Ymin(2,2) = m - 1;
o = 0;
end
end
end
p = m + 1;
y_tmp(1) = y_temp(2);
y_tmp(2) = y;
AStrom Tuner Block
function [a,pu,Wc,Nr,Kp_n,Ti_n] = fcn(Y,Tsp,Ar)
a=Y(1,1)-Tsp; % amplitude of oscillation
Ts=0.1
A=abs(Ar) %Relay amp
Nr=(4*A)/(pi*a); % Altimate gain
pu= abs((Y(2,2)-Y(2,1)))*Ts %Altimate Period
Kp_n=0.45*Nr; %New Kp using Z-N
Ti_n=pu/1.2; %New Ti
Wc=2*pi/pu
Filter Block
function Toutf = fcn(Tf,Tout,Toutf_1)
Ts=0.1;
79
Appendices
a=Tf*(Tf+Ts);
Toutf=a*Tout +(1-a)*Toutf_1;
Toutf_1=Toutf;
Air Heater
function [ud, U]= delay_fun(u, uk, n) % air heater delay implementation in
ODE form
ud = u(1);
U = u;
for i=1:n-1
U(i) = u(i+1);
end
U(n)=uk;
function Tout_1=airheater_Ode(ud, Ts, Te, T_out, Kh, Tt) % Air heater in
ODE form
Tout_1 = (Ts/Tt)*(-T_out + Kh*ud + Te) + T_out;
Quadruple Tank [36]
% The quadruple tank linearized model state space matrices for minimum
% phase case
% Parameters for the quadruple tank level process
% Modifided from David Di Ruscio
A1=28; A3=28; A2=32; A4=32; % cross section of tank[cm^2]
a1=0.071; a3=0.071; a2=0.057; a4=0.057; % cross section of outlet
hole[cm^2]
kc=0.50; % ratio of voltage and level[V/cm]
g=981; %acceleration due to gravity
%linearised operating point (nominal value for minimul phase case)
h10=12.4; h20=12.7;h30=1.8; h40=1.4;u10=3.0; u20=3.0;
k1=3.33; k2=3.35;
g1=0.7; g2=0.6; %linearised operating point (nominal value for minimul
phase case)
% State space matrix
T1=(A1/a1)*sqrt(2*h10/g); T2=A2*sqrt(2*h20/g)/a2; T3=A3*sqrt(2*h30/g)/a3;
T4=A4*sqrt(2*h40/g)/a4;
A=[-1/T1,0 ,A3/(A1*T3),0;0 ,-1/T2,0 ,A4/(A2*T4);0 ,0 ,-1/T3 ,0;0 ,0 ,0 ,-
1/T4]
B=[g1*k1/A1 ,0;0 ,g2*k2/A2;0 ,(1-g2)*k2/A3;(1-g1)*k1/A4,0]
D=[kc, 0,0,0;0,kc,0,0]
Results
A = [ -0.0159 ,0 ,0.0419 ,0; 0 , -0.0111, 0 , 0.0333; 0, 0, -0.0419, 0; 0,0 , 0, -0.0333]
B=[ 0.0833, 0; 0, 0.0628; 0 ,0.0479; 0.0312 ,0]
D =[ 0.5000, 0; 0, 0; 0, 0.5000; 0, 0]
80
Appendices
81
Appendices
82
Appendices
83
Appendices
84
Appendices
Figure D-1 1 The upper and the lower plots show the calculated Kp and Ti respectively
during the relay experiment on real air heater.
Figure D-1 2: The upper and the lower plots show the frequency and the period of oscillation
respectively during the relay experiment on real air heater.
85
Appendices
Figure D-1 3: The upper and the lower plots show the control voltage and the error signal
respectively during the relay experiment on real air heater
Simulation plots from Åstrom relay experiment on the quadruple tank
Figure D-1 4: The Proportional gain and integral time convergence during Åstrom relay
experimentation on the quadruple tank (PID on tank 1 and manual on tank 2)
Figure D-1 5: The period and frequency of oscillation during Åstrom relay experimentation
on the quadruple tank (as two separate SISO)
86
Appendices
Figure E1 1: Nyquist plot from the result presented in Table 5-1.None of the curve enclosed
the 0-j point, so they are stable.
87
Appendices
Imaginary Axis
Imaginary Axis
88