Professional Documents
Culture Documents
This paper deals with design of PID controller with the use of methods of global optimization implemented in Matlab
environment and Optimization Toolbox. It is based on minimization of a chosen integral criterion with respect to additional
requirements on control quality such as overshoot, phase margin and limits for manipulated value. The objective function
also respects user-defined weigh coefficients for its particular terms for a different penalization of individual requirements that
often clash each other such as for example overshoot and phase margin. The described solution is designated for continuous
linear time-invariant static systems up to 4th order and thus efficient for the most of real control processes in practice.
K e y w o r d s: PID, control design, control system, global optimization, Matlab
∗ VSB-Technical University of Ostrava, Department of Cybernetics and Biomedical Engineering, 17. listopadu 15/2172, Ostrava-Poruba,
708 33, Czech Republic, stepan.ozana@vsb.cz
uub
wub w+ e u ulb y
Controller Plant
wlb -
The main objectives set up by the authors can be – three real poles:
summed up as follows (see also subsection 3.1). a) three different single poles, b) one double-pole +
• Achievement of method of PID design with effective one different single pole, c) triple-pole.
application of integral criteria (ISE, IAE, ITAE, ITSE) • 4th order system
and a numerical approach instead of analytical computa-
tion techniques
k
• Possibility to consider, specify and weigh additional G(s) = , k ∈ R,
(s − p1 )(s − p2 )(s − p3 )(s − p4 )
requirements on the controller.
So far, the solution has been designed for a certain pn = Re{pn } + j Im{pn } ,
class of the systems as described in subsequent subsec- Re pn < 0 for n = 1, . . . , 4 .
tion.
Distinguishing in terms of position of the poles:
2.2 Classification – two pairs of complex poles,
The proposed solution has been designed for continu- – one pair of complex poles + two single real poles,
ous linear time-invariant static systems up to 4 th order. a) double-pole, b) two different single poles,
The classification of the systems in terms of mathematical – four real poles, a) all different single poles,
description with the use of Laplace transform for partic- b) two double-pole + different double-pole,
ular cases including classification according types of the c) triple-pole+single pole, d) quadruple-pole.
poles of the systems is as follows:
• 1st order system 2.3 Typical Example of Application
The proposed algorithm is effective when looking for
controller working for the plant in a given operating point
k with known possible technological bound values for the
G(s) = , k ∈ R , p1 ∈ R , p1 < 0 . setpoint and manipulated value according Fig. 1. Over-
(s − p1 )
shoot of the output signal, phase margin and chosen in-
• 2nd order system tegral criterion are specified by a user.
For example, a speed control of DC motor by duty cy-
cle of PWM signal u ∈ h0, 1i can be considered at the
k setpoint w = 500 rpm. Let us suppose manipulated value
G(s) = , k ∈ R, (duty cycle) u = 0.5 in a steady-state operating point
(s − p1 )(s − p2 )
corresponding to 500 rpm and time constants T1 = 5 s,
pn = Re{pn } + j Im{pn } ∈ C , T2 = 20 s are experimentally identified. Then it is possi-
Re{pn } < 0 for n = 1, 2 . ble to describe the model of DC motor as the 2nd order
1000
system G(s) = (5s+1)(20s+1) . Let us suppose admissible
Distinguishing in terms of position of the poles: range of the setpoint between 400 and 600 rpm. Apply-
– one pair of complex poles, two different single real ing ITAE criterion and standard requirements on control
poles, one double-pole quality, phase margin 45 %, overshoot 15 % lead to the
• 3rd order system following input parameters of mainGlobal function (see
section 3.2): idx = 4 , peak = 15 , phl = 30 , phh = 60 ,
wlb = 400 , wub = 600 , ulb = 0 , uub = 1 .
k
G(s) = , k ∈ R, 2.4 Reference Solutions
(s − p1 )(s − p2 )(s − p3 )
pn = Re{pn } + j Im{pn } , This section is focused on comparison of three refer-
ence solutions concerning similar topic with the proposed
Re pn < 0 for n = 1, 2, 3 . solution while common features will be pointed out.
The proposed solution complies with the following
Distinguishing in terms of position of the poles: statements in the reference solutions performed by other
– one pair of complex poles + one single real pole, authors regarding motivation of this paper:
162 S. Ozana — T. Docekal: PID CONTROLLER DESIGN BASED ON GLOBAL OPTIMIZATION TECHNIQUE WITH . . .
• in case of nonlinearities in the plant or actuator following significant novelties can be indicated in this
saturation, the existing classical tuning methods can no paper:
longer be used [1], • Use of global optimization methods
• for the time varying plant model, it is extremely dif- There is no need for specification of any range for con-
ficult, if not impossible, to design satisfactory PID con- troller parameters. According [4], this type of problem
trollers with traditional approaches [1]. needs a constrained type of minimization problem. For
The reference [1] mentions that overshoot constraints Matlab-based solutions, fmincon function [4] is a great
can also be used in the interface in case of presence of ac- choice. Together with overshoot limits and manipulated
tuator saturation. However, it only seems to take the sat- value limits the algorithms prevents from finding possible
uration into account but does not offer a remedy action solutions that may lead to unwanted oscillatory behavior.
to avoid occurrence of saturation at all. The algorithm • Weighting functions
proposed in this paper handles saturation in a different
They allows user to prefer one requirement to another.
way: having known the technological limits for manip-
Apart from setting these four coefficients, user can also
ulated value the algorithm takes them into account and
relax the bounding intervals for overshoot, manipulated
designs such a controller that guarantees the manipulated
value and phase margin so that they don’t actually apply
value within a specified interval.
at all. In this case the found solution must be additionally
The reference [7] declares that ISE-based minimiza- and carefully analyzed in terms of following the control
tion often results in a relatively oscillatory step response quality.
since the large errors which must occur for small time
• Phase margin control
contribute significantly to the performance index. A lot
of tests performed during the development of the pro- No reference solutions referred in this paper takes phase
posed method described in section 3 of this paper con- margin into consideration. However, it is an important re-
firm that statement. This is one of the reasons why al- spect for feedback control systems. The proposed solution
gorithms based on minimization of integral performance generally guarantees a good result in this respect.
indices, especially the ones using a global minimization,
should always consider overshoot limit, like the proposed 3.2 Introductory Description
solution in this paper. Optimization algorithm has been implemented in Mat-
The reference [2] is focused on ITAE performance in- lab environment as it includes many useful functions to
dex only. The solution is rather complex, it shows some handle control design problems. Particularly, some func-
common signs that also apply for the proposed solution in tions of Control System toolbox [5] and Optimization
this paper. However, that approach applies a local min- toolbox [4] have been used. The basic idea of the design
ima optimization problem with the use of f minsearch algorithm is finding a global minimum of objective func-
function. Before the case studies described in sections 4.2 tion containing PID controller parameters. The global op-
and 4.4, the authors of this paper also tried to use this timization problem is set up and run according the fol-
approach and carried out tests that proved certain lim- lowing lines of code:
itations. The most crucial issue is the initial point rep- J=@function;
resenting an initial guess of a controller. Convergence of problem =
the solution and solution itself is very sensitive to this createOptimProblem(’fmincon’,’x0’,x0,
initial value. Algorithm then performs searching for a lo- ’objective’,J,’lb’,lb,’ub’,ub);
cal minimum around this point. Usually, the first guess is gs = GlobalSearch;
done through some generally-usable method like Ziegler- [x,fval,flag,outpt,allmins] = run(gs,problem);
Nichols for example. However, generally there can be a
lot of other minimum (following a given performance in- The search is carried out with the use of f mincon
dex better) in different part of the searched interval that function which is generally determined for finding mini-
may not be found. The reference [2] introduces a piece of mum of constrained nonlinear multivariable function. Ini-
code with a given x0 that seems to restrict more universal tial point is compulsory, but unlike local optimization,
usage of this solution. this value does not affect the process of finding the min-
ima or the result, because it is a global optimization prob-
lem. Base on type of the controller (I, PI, PID) the initial
3 IMPLEMENTATION OF values of all its components are set as 0.1. Function named
THE PROPOSED SOLUTION J=@function calculates the value of objective function
for a given vector x. Values lb and ub represent lower
3.1 Novelty of the Solution bound a upper bound of the interval where the search is
Although there are known referenced similar solutions performed, in this case lb = 0 and ub = ∞. According
regarding the use of optimization tuning techniques for GlobalSearch function documentation, this setting means
PID controllers, there is no solution implemented at such that the values of the components of optimized solution
comparable extent. The solutions referred in this paper are limited to 10 4 + 1 . It can be supposed that this lim-
mentioned in previous section 2.4 and the newly proposed itation does not degrade the usability of the proposed
solution have a lot of common features. However, the method in case of all various industrial processes.
Journal of ELECTRICAL ENGINEERING 67, NO3, 2016 163
Table 1. Syntax of trapz function for different integral criteria of 1.7977 ×10308 is assigned (maximum for double data
type handled by Matlab).
Criterion Syntax
ISE trapz(t,e.^2) 3.4 Integral Criterion
IAE trapz(t,abs(e))
ITSE trapz(t,(e.^2).*t)
The basic component that affects the resulting value
ITAE trapz(t,abs(e).*t)
of the objective function is a chosen integral criterion to
be minimized by optimization algorithm. It is the main
Searching for global minimum uses generation of ran-
term that creates the set of possible optimal controllers
dom numbers to create a set of testing points. For this
while the other terms are designed in order to limit this
purpose Matlab uses so called global random number
stream. As the default type of global random num- set while following given limits and requirements.
ber stream in Matlab is mt19937ar, it was changed to The proposed solution offers four different types of
mcg16807 to achieve more robust results of optimization integral criteria. Transfer function of control error GE
procedure. is computed firstly and the step function is applied:
Running the process of controller design is carried out
by calling the mainGlobal function with a given set of
input parameters: e=step(Ge,t);
mainGlobal(G, type, idx, peak, phl, phh, wlb,
wub, ulb, uub, k1, k2, k3, k4)
G – regulated linear static system of the 1st to the 4th Particular input time vector is based on settling time of
order, the closed-loop step response. Although the upper bound
type – type of the desired controller, possible values: ’I’, for the integral criteria is infinite, adequate precision of
’PI’ , ’PID’, computation can be achieved by proper choice of the finite
idx – type of integral criterion, possible values: ’ISE’, time tf as described and discussed in [1] by formula (4).
’IAE’, ’ITSE’, ’ITAE’, In this case, the finite time is taken as threefold of the
peak – overshoot limit (%), settling and the entire time interval is divided into 30000
phl – lower bound for the phase margin (◦ ), equidistant segments, this is calculated with the use of
phh – higher bound for the phase margin (◦ ), stepinf o function. As the time vector is also used in other
wlb – lower bound for the setpoint, part of the algorithms, it is firstly defined in twofold and
wub – upper bound for the setpoint,
modified consequently.
ulb – lower bound for manipulated value,
uub – upper bound for manipulated value, stpinfo all=stepinfo(Gw);
k1, k2, k3, k4 – weighing coefficients for particular terms st=3*stpinfo all.SettlingTime;
of the objective function, see section 3.8. t=linspace(0,2*st,60000); t=t(1:30000)’;
Calculation of individual integrals by the use of trapz
3.3 Objective Function
function is described by Table 1.
The objective function takes into consideration four
respects: integral criterion value, overshoot, phase mar- The value of integral criterion depends on time course
gin, manipulated value. It tries to minimize overall costs, (character) of control error and its length. Other terms of
while minimizing integral criteria and applying penalties the objective function depend on the shape of this curve.
if: overshoot is higher than its high limit specified by a For example, if there are two same time waveforms of the
user, or phase margin or manipulated values are outside control with different time scale (different duration), then
the interval specified by a user. Generally, it can be ex- the influence of the integral criterion in the entire value of
pressed as the sum of particular components, yet the in- the objective function would be different. Provided that
dividual terms are additionally weighed, see section 3.8. this duration depends on time constant of the system, it
The process is carried out in iterations. Within each is desirable to have the same influence of integral crite-
of iterations the values of particular components of the rion compared to the rest of the terms in the objective
objective functions must be calculated, using open-loop function. One of the ways of handling this issue is normal-
or closed-loop properties. Transfer function of PID con- ization considering the settling time — the integral value
troller is set up with the use of pid function of the Control
would be divided by the settling time value. However, if
System Toolbox with P,I,D elements as the inputs. In case
the duration is affected by parameters of the currently
of PID controller, real PID is considered, being extended
by additional time constant (filter coefficient) calculated tested controller, diversity in the values of the integral
as 1/100 th of the highest system time constant. In case of values is necessary in order to be able to choose the bet-
unstable closed-loop or any other numerical issues (NaN ter controller. Normalization is thus not considered, the
values, INF values) the process of calculation of the ob- problem is handled in a different way - the other terms in
jective function is omitted and the highest possible value the objective function are multiplied by the settling time.
164 S. Ozana — T. Docekal: PID CONTROLLER DESIGN BASED ON GLOBAL OPTIMIZATION TECHNIQUE WITH . . .
k
The design of I-controller will be the subject of the follow- y(∞) = lim sY (s) = lim s = 1,
s→0 s→0 144s4 + 24s3 + s2 + ks
ing subsections that will introduce these two case studies: 1
• manual analytical solution (Section 4.1) based on ISE Y (s) = L{y(t) − y(∞)} = Y (s) − y(∞) ,
s
criterion, being verified by the proposed algorithm in
144s2 + 24s + 1
(Section 4.2), Y (s) = − =
144s3 + 24s2 + s + k
• manual analytical solution (Section 4.3) based on
ITAE criterion, being verified by the proposed algo- b 2 s2 + b 1 s + b 0
,
rithm in (Section 4.4) a3 s3 + a2 s2 + a1 s + a0
b0 = −1 , b1 = −24 , b2 = −144 , a0 = k ,
4.1 Minimization of ISE-based Objective Func- a1 = 1 , a2 = 24 , a3 = 144 .
tion — Manual Solution Using Parseval’s
Theorem
This subsection will introduce manual solution of op- Consequently, Hurwitz matrices Hn (n = 3 ) and H1 are
timization task considering ISE-based objective function defined as
for the design of I-controller GR (s) = ks for a given lin-
ear system. The main idea of this computation is obtain-
a2 a0 0 24 k 0
ing analytical form of the objective function J(k) to be Hn = a 3 a1 0 = 144 1 0 ,
minimized using a basic knowledge of differential calcu- 0 a2 a0 0 24 k
lus. With the use of Parseval’s theorem, it is possible to
simplify the computation of ISE performance index as h11 = (−1)0 b22 = 20736 ,
follows: h12 = (−1)1 (b21 − 2b0 b2 ) = −288 ,
h13 = (−1)2 b20 = 1 ,
Z ∞ Z ∞
1
Jk = [y(t) − y(∞)]2 dt = |E(jω)|2 d(jω) =
0 2πj −∞
20736 −288 1
1 ∞ 1 det H1
Z
H1 = 144 1 0.
|E(jω)|2 dω =
π 0 2an det Hn 0 24 k
166 S. Ozana — T. Docekal: PID CONTROLLER DESIGN BASED ON GLOBAL OPTIMIZATION TECHNIQUE WITH . . .
4
0.8
2
0.4
Fig. 4. Graphical representation of J(k) function Fig. 5. Closed-loop step response (ITAE criterion)
Amplitude (dB)
50 mainGlobal(G,’I’,’ITAE’,100,0,90,0,1,-10,10)
The solution has been found after 2093 iteration. The
0 transfer function of I-controller is
-50
0.0264
GR (s) = .
-100 s
The proposed algorithm is compatible with the latest the proposed algorithm that removes crucial drawbacks
Matlab R2016a and R2015b. It has been tested on two of classical tuning methods. As for ISE performance in-
different configurations for the case study in Section 4.2: dex, it leads to identical result compared to the one using
• Matlab R2014b, PC Intel(R) Core(TM)2 Quad CPU Parseval’s theorem. Regarding ITAE, it shows negligible
Q8300 @ 2.5 GHz 2.5 GHz, 4 GB RAM, Windows 7 differences as described in Table 2.
32b. (Benchmarks: unknown). The typical elapsed The use of analytical solution of optimization prob-
computation time was about 286 seconds (2485 it- lems either for ISE (Parseval’s theorem) or ITAE (use
erations). of predefined optimum coefficients) is very limited and
• Matlab R2015b, PC Intel(R) Core(TM)i5-4210U CPU applicable for a very narrow set of systems. Starting al-
@ 1.70 GHz 2.40 Ghz, 4 GB RAM, Windows 7 64b. ready with the design of two-parameters controllers (PI,
(Benchmarks: 3DMark06: 4759 pts, PCMark 7 (Over- PD) for the second order system the analytical solution
all): 4194 pts). The typical elapsed computation time with the use of Symbolic Toolbox [6] may end up with
was about 182 seconds (2492 iterations). “Warning: Explicit solution could not be found” despite
There are some possible measures to be taken into con- the existence of such solution.
sideration to speed up the next generation of the algo-
rithm and the usability in general scale: Acknowledgment
• computation of initial states for a given setpoint w = This work was supported by project SP2016/162, De-
wlb before running the algorithm core, velopment of algorithms and systems for control, mea-
• adjustment of finding global minimum regarding ne- surement and safety applications II of Student Grant Sys-
cessity of the recursion add-on, possible different way tem, VSB-TU Ostrava.
of initial guess of the controller (based on plant roots
in case of linear systems)
• possible replacing GlobalSearch by MultiStart , pos- References
sibility of the use of multiprocessor cores, parallel
[1] DINGYU, X.—YANGQUAN, C. : OptimPID: A MATLAB In-
computing techniques, different generation of testing
terface for Optimum PID Controller Design, 2005, http://
points (different global random number stream), www.mathworks.com/matlabcentral/fileexchange/
• consideration of particle swarm optimization (PSO) 34505-optimpid–an-optimal-pid-controller-design-interface.
techniques, [2] MARTINS, F. G. : Tuning PID Controllers using the ITAE
• extension of the categories of the systems suitable for Criterion, International Journal of Engineering Education 21
(2005), 867–873.
the use of the proposed algorithm (transport delays,
[3] LEVINE, S. : The Control Handbook, Second Edition, CRC
nonlinearities, astatic systems) Press, 2010.
[4] MathWorks Inc (2014b). Global Optimization Toolbox User’s
Manual.
6 CONCLUSION AND SUMMARY
[5] MathWorks Inc (2014b). Control System Toolbox User’s Man-
ual.
The proposed algorithm showed that the use of the [6] MathWorks Inc (2014b). Symbolic Toolbox User’s Manual.
integral criterion as the solely component of the objective [7] ZHUANG, M.—ATHERION, D. P. : Tuning PID Controllers
function may not be a general solution; therefore other with Integral Performance Criteria, In Proceedings of IEE
respects are applied as described in Section 3. International Conference Control’91, Edinburgh, UK, 1991,
pp. 481–486.
Performance indices used in this paper can affectively
apply for a certain class of the systems. The choice of Received 25 January 2016
performance index is always up to an expert, just like the
bounds for overshoot, manipulated value, type of con- Stepan Ozana was born in 1977 in Bı́lovec, Czech Re-
troller, phase margin interval, and the weighing coeffi- public. He studied electrical engineering at VSB — Technical
cient. The algorithm can be easily extended by IT2 SE or university of Ostrava where he has got MSc degree in Control
IT2 AE if needed. and Measurement Engineering, PhD degree and Assoc Prof
The algorithm can also be adapted to nonlinear plants, degree in Technical Cybernetics. He works as an Associate
replacing command line of the control system toolbox Professor at the Department of Cybernetics and Biomedical
(stepinfo, series, feedback , . . . ) by nonlinear Simulink Engineering, Faculty of Electrical Engineering and Computer
model. In this case this algorithm would apply for such a Science. At present he gives lectures on Cybernetics and Con-
trol systems. Professional orientation: modeling and simula-
nonlinear system in an operating point without necessity
tion of dynamic systems, control theory, automation, design
of performing linearization.
and implementation of control algorithms ( µPC/PC/sofPLC
Case studies documented in this paper focus on ISE systems).
and ITAE performance indices. Unlike the reference solu- Tomas Docekal was born in 1992. He studied electrical
tion [1, 2, 7], the obtained results from case studies are not engineering at VŠB — Technical university of Ostrava where
confronted with the ones based on different method, but he got the bachelor degree and MSc degree in control and mea-
they are compared to the same method with the use of surement engineering. His professional orientation is mainly to
different way of computation. This verifies correctness of robotics, embedded systems, and low-level programming.