A Flexible MATLAB Tool for Optimal Fractional-order PID Controller Design Subject to Specifications TEPLJAKOV Aleksei1 , PETLENKOV Eduard1, BELIKOV Juri1,2 1. Department of Computer Control, Tallinn University of Technology, Tallinn, Estonia E-mail:
[email protected],
[email protected] 2. Institute of Cybernetics, Tallinn University of Technology, Tallinn, Estonia E-mail:
[email protected] Abstract: In this paper, we present a flexible optimization tool suitable for fractional-order PID controller design with respect to given design specifications. Fractional-order controllers are based on the rapidly evolving scientific field called fractional-order calculus. Its concepts are applicable in solving many scientific and engineering problems, including robust control system design. The fractional PID is a natural evolution of the conventional PID controller and as such new tuning strategies are now possible due to enhanced accuracy of the fractional-order models. The presented tool, which is a part of FOMCON — a MATLAB fractional-order calculus oriented toolbox, — uses numerical optimization methods to carry out the tuning and obtain a controller for a chosen plant to be controlled, which can either be a fractional-order plant or an integer-order plant. Key Words: fractional calculus, fractional pid, pid control, matlab toolbox
1
Introduction
Fractional-order calculus, being a topic of moderately active discussion for some 300 years, presents novel mathematical tools that are applicable, in particular, in the area of system modeling and control, where new opportunities arise that allow to enhance the system description accuracy and to design robust controllers to improve the quality of the control loops. Presently in the field of control system design there exist several tools for working with fractional models and controllers. Since issues exist in fractional models due to their inherent complexity, these tools utilize the computational power and flexibility of contemporary computing environments such as MATLAB to overcome these problems. Notable examples include CRONE [1] and Ninteger [2] MATLAB toolboxes. A new MATLAB toolbox FOMCON [3] (“Fractionalorder Modeling and Control”) developed by the authors of this paper and based on a mini toolbox FOTF [4–6] currently aims at extending classical control schemes with concepts derived from fractional-order calculus. In particular, a lot of attention was given to developing a versatile fractional PID design tool, based on numerical optimization algorithms. In this paper, we present the resulting tool with relevant comments on several implementation issues. The paper is organized as follows. A brief introduction to fractional modeling is provided in Section 2. The fractional PID controller is also introduced in this section. Further, in Section 3 the theoretical background forming the basis for implementing the fractional PID controller optimization tool is given. Toolbox description with additional implementation details follows in Section 4. An example of using the tool for developing a controller for a linear plant is also provided. Some of the limitations of the current fractional PID This work was partially supported by the Governmental funding project no. SF0140113As08, the Estonian Science Foundation Grant no. 8738, and the Estonian Doctoral School in Information and Communication Technology.
tuning facility realization are given in Section 5. Finally, in Section 6 conclusions are drawn.
2
Brief Introduction to Fractional Control
In the following, a brief introduction to fractional calculus in the context of modeling and control is provided. 2.1 Mathematical Background Fractional-order calculus is a generalization of integration and differentiation operations to the non-integer order operator a D α t , where the lower and upper terminals of the operation are denoted by a and t respectively and α is the fractional order such that dα ℜ(α) > 0, dtα α (1) 1 ℜ(α) = 0, a Dt = R t (dt)−α ℜ(α) < 0, a
where α ∈ R, but it can also be a complex number [5]. There exist several definitions of the fractional differintegral. Consider the Riemann-Liouville definition first [6]: α a Dt f
(t) = 1 Γ (m − α)
d dt
m Zt a
f (τ ) (t − τ )
α−m+1
dτ, (2)
for m − 1 < α < m, m ∈ N, where Γ(·) is Euler’s gamma function. Consider also the Gr¨unwald-Letnikov definition, which is important due to its applications in numerical evaluation of fractional derivatives: t−a [X h ] 1 j α α f (t − jh) , (−1) a Dt f (t) = lim α h→0 h j j=0
where [·] denotes the integer part.
(3)
The Laplace transform of an α-th derivative with α ∈ R+ of a signal f (t), relaxed at t = 0, and assuming zero initial conditions is given by L D α x (t) = sα F (s) , (4) where F (s) is obtained via the usual Laplace transform integral. Thus, a fractional-order differential equation an D αn y(t) + an−1 D αn−1 y(t) + · · · + a0 D α0 y(t) = bm D βm u(t) + bm−1 D βm−1 u(t) + · · · + b0 D β0 u(t), (5) where ak , bk ∈ R can be expressed as a fractional-order transfer function in form G (s) =
bm sβm + bm−1 sβm−1 + · · · + b0 sβ0 . an sαn + an−1 sαn−1 + · · · + a0 sα0
(6)
A system given by (6) is said to be of commenusrate order if all the orders of the fractional operator s are integer multiples of some base order γ such that αk , βk = kγ, where γ ∈ R+ , 0 < γ < 1. It should be noted, that the analysis of commensurate order systems is facilitated. For more information on fractional-order calculus the reader is referred to the books [6–9]. 2.2 Fractional-order PID Controller PID controllers are ubiquitous in the industry [5]. In process control more than 95% of the control loops are of PI/PID type [10]. Thus the motivation for using the fractional PID in industrial process control is evident. With a more sophisticated controller, new design strategies are possible with respect to more flexible control loop design specifications governing the controlled plant performance limitations. The fractional-order PID controller was first introduced by Podlubny in [11,12]. This generalized controller is called the PIλ Dµ controller. It has a fractional integrator of order λ and a fractional differentiator of order µ, i.e. it can be described by the following form: Gc (s) = Kp +
Ki + K d sµ . sλ
(7)
Taking λ = µ = 1 a conventional integer-order PID controller is obtained. With more freedom in tuning the fractional-order controller the usual four-point PID diagram can now be viewed as a PID controller plane, as illustrated in Fig. 1.
In the following we discuss fractional-order PID controller tuning and optimization and present the corresponding MATLAB tool which is a part of the FOMCON toolbox.
3
Tuning and Optimization of the Fractionalorder PID controller
Over the years, several methods for tuning the fractional PID controller have been proposed, e.g. [13, 14]. A comprehensive overview of tuning methods can be found in [15]. Due to an abundance of different types of plants, a general tuning algorithm is desired. Since the fractional PID controller has two more parameters to tune then given a suitable cost function, which describes the performance of the control loop, the problem of finding a suitable set of PIλ Dµ controller parameters is now five-dimensional. Clearly, this makes analytic derivation of tuning rules more difficult. A numerical optimization approach can be used, however. Because design specifications are to be considered, the problem can be solved by constrained optimization. There are several aspects to the problem of designing a fractional-order PID controller using constrained optimization: •
• • • •
The type of plant to be controlled (integer-order or fractional-order); Optimization criterion; Fractional PID design specifications; Specific parameters to optimize; Selecting initial parameters from the parameter space.
We consider time-domain simulation for the purpose of optimization criterion evaluation. This implies that the simulation can either rely on fractional-order methods or integerorder methods. Because fractional-order simulation may be slow and/or inefficient, it is more convenient to use welldeveloped integer-order differential equation solving algorithms instead. This, in turn, requires us to approximate the fractional-order system and/or controller by an integer-order system. In terms of efficiency and accuracy, an appropriate approximation technique, based on frequency-domain fitting, is the Oustaloup recursive filter approximation method [4, 16]. We briefly summarize it below. The method is based on approximating a fractional-order operator sγ , where 0 < γ < 1, in a specified frequency range ω = (ωb , ωh ) and of order N by a rational transfer function obtained in the following manner: sγ = K
N Y s + ωk′ , s + ωk
(8)
k=−N
where the gain, respective poles and zeros are obtained by using ωk′ = ωb (ωr ) ωk = ωb (ωr ) Fig. 1: Fractional PID controller plane
K=
ωhγ ,
k+N + 1 (1−γ) 2 2N +1 k+N + 1 (1+γ) 2 2N +1
ωh ωr = . ωb
, ,
A modified Oustaloup method was proposed in [4, 6]. It provides a better approximation result in the frequency range of interest: N Y s + ωk′ , (9) sγ = Gω s + ωk
•
k=−N
where
High-frequency noise rejection: the constraint is applied to the complementary sensitivity function T (jω) in the following way: T (jω) = Gc (jω)G(jω) ≤ A dB, (12) 1 + Gc (jω)G(jω) dB ∀ω ≥ ωt rad/s ⇒ |T (jωt )|dB = A dB,
dωh b
γ
2
ds + bωh s d(1 − γ)s2 + bωh s + dγ) γ+2k γ−2k bωh 2N +1 dωb 2N +1 ′ ωk = , ωk = , d b
Gω =
!
, •
and b > 0, d > 0. Good results can be achieved with b = 10, d = 9, so the parameters are fixed at those values [4]. Due to the commutative property of the fractional operator sα , an order α ≥ 1 can be approximated by sα = sn sγ ,
Gcs (s) =
Gc (s)G(s) , 1 + Gc (s)G(s)
∀ω ≥ ωs rad/s ⇒ |S(jωs )|dB = B dB,
(10)
where n = α − γ denotes the integer part of α and sγ is obtained by the Oustaloup approximation using either (8) or (9). It should be noted, that while the order of the obtained filter in both cases is 2N + 1, due to system interconnection the resulting order of approximation can be very high. This restricts the usage of the method to computer-based solutions. Thus, by using the above approximations, the problem of simulating fractional-order and integer-order systems mixed structure is solved. For fractional PID optimization one can simulate the response of the typical negative feedback based control system described by
•
where B is the desired value of sensitivity function for frequencies ω ≤ ωs rad/s. Robustness to plant gain variations: a constraint is formed such that d arg(F (s)) = 0, (14) dω ω=ωcg
where F (s) = Gc (s)G(s) is the open-loop system, ωcg is the critical frequency around which the phase of the system must be flat. Finally, a constraint on the fractional PID control effort u(t) may also be considered. The parameters to be optimized are obviously the PIλ Dµ controller gains and non-integer integrator/differentiator orders. So the optimized parameter set may be such that
(11)
where Gc (s) corresponds to the fractional PID controller in (7) and G(s) is the plant to be controlled, which can be either an integer-order approximation of a fractional-order plant, or an integer-order plant, e.g. a first-order plus dead time model. Since time-domain analysis is utilized, it is natural to choose a suitable performance index for optimization. Commonly used indicies are the following: Rt 2 • integral square error ISE = e (t) dt, 0R t • integral absolute error IAE = e(t) dt, 0 Rt 2 • integral time-square error IT SE = te (t) dt, 0R t • integral time-absolute error IT AE = t e(t) dt, 0 where e(t) = 1 − y(t), y(t) is the tuned fractional control system closed-loop step response. Design specifications can be considered as optimization constraints. Typical specifications include the gain margin Gm and phase margin ϕm which can be both derived from the frequency-domain evaluation of the open-loop system in the frequency range where the approximation is valid. Following the lines of [6] one can additionally choose the design specifications listed below, taking advantage of the flexibility of the fractional controller achieved by considering the frequency domain:
where A is the desired noise attenuation for frequencies ω > ωt rad/s. Output disturbance rejection: the constraint on the sensitivity function S(jω) may be defined: 1 S(jω) = ≤ B dB, (13) 1 + Gc (jω)G(jω) dB
θ = θg θǫ , θg = K p K i K d ,
(15) θǫ = λ
µ .
Therefore, three different possibilities exist in general: • Optimize all parameters; • Optimize gains only; • Optimize orders only. This also leads us to a possible way of obtaining the initial parameters for optimization. It is possible, given sufficient knowledge about the plant, to use classical integer-order PID tuning methods to tune the gains, and then fine-tune the controller by obtaining the integrator/differentiator orders.
4
Toolset Implementation in MATLAB
Based on all previous considerations, a toolset was developed for • Obtaining parameters for an integer-order PID using classical methods; • Optimizing a set of fractional PID parameters subject to given design specifications. 4.1 Tool Description In FOMCON toolbox, the tools required to carry out the aforementioned tasks are grouped inside a control module as shown in Fig. 2.
Fig. 2: Fractional PID tuning tool hierarchy in FOMCON toolbox (corresponding GUI name is given in parentheses) The graphical user interface corresponding to the integerorder PID tuning tool is depicted in Fig. 3. The workflow is comprised of the following steps. First, a fractional-order model, given by a fractional-order transfer function in (6) is approximated by a classical, integer-order model (FOPDT, IOPDT or IPDT) using optimization functions found in the MATLAB Optimization toolbox. Next, a tuning rule is used to compute the corresponding PID parameters. If these parameters are suitable, which can be immediately tested by conducting a closed-loop simulation of the resulting control system, they can be used as initial gain values for generalized PID controller tuning via optimization. The optimization tool GUI is depicted in Fig. 4. Hereafter, we describe the features of the tool that were not previously covered. The Plant model panel determines the parameters used to approximate a fractional-order plant. The same parameters will be used for obtaining an approximation of the fractional controller, also in case of an integer-order plant. The Enable zero cancellation for non-proper LTI systems option invokes the isproper() function which ensures that a proper system is obtained as a result of approximation and system interconnection. Currently, the function will add a pole s = −ωh , where ωh is the higher frequency bound of approximation. This, obviously, is equivalent to adding a low-pass filter in series with the control system, with a time constant τ = ω1h . As a consequence, the accuracy of simulation will be reduced in that frequency region. The Fractional PID controller parameters panel allows to choose the optimized parameter set and change the initial PIλ Dµ controller parameters as well as parameter ranges. It is important to note that by setting equal bounds of a parameter range will result in the removal of that parameter from the optimization set. This applies to the optimize() function method. Thus, different types of controller (P, PIλ , PDµ , PIλ Dµ ) can be designed. Optimization-specific parameters are found in the Optimization and performance settings panel. Here, one can choose the optimization algorithm. Currently two function choices and four algorithms are provided: • optimize(): Nelder-Mead algorithm. This uses a special function [17] for optimization allowing for constrained optimization problems to be solved. • fmincon(): interior-point algorithm, SQP algorithm or active-set algorithm.
Fig. 3: Fractional-order model approximation based integerorder PID tuning facility Next, design specifications can be individually set. If enabled, the corresponding specifications will be evaluated and constraints will be used for determining the feasibility of the tuning parameter selection. For the gain and phase margin specifications it is possible either to request a minimum value to be preserved throughout the optimization process or to obtain a parameter set where these specifications are fulfilled exactly. Setting system simulation type and corresponding options is possible in the Simulation parameters panel. Using Simulink for simulation is also possible. This allows, in particular, to use the control effort saturation specification. In order to use Simulink, one needs to check the Use Simulink for system simulation option. Additionally, a different model structure may be selected. This may be achieved by creating a new model from the default one and editing it to suit a particular task. This feature allows to obtain controller parameters for nonlinear systems. Obviously, when a custom, nonlinear plant is used, the frequency-domain specifications no longer provide meaningful information about the plant (unless the user provides a reliable linear approximation) so only performance index optimization should be considered. Strict constraints can be requested when using the optimize() algorithm. This will ensure that design specifications are always met, but will also require the feasibility of the initial solution. Otherwise, an error will be issued. When the Optimize button is pressed, the optimization process begins. The optimization log will also be displayed in the MATLAB console. It is possible to limit the number of optimization iterations so one could for example assess the effectiveness of the current optimization problem based on convergence speed. After the optimization has finished, a report will be generated if the corresponding option was set, and if the optimization result is satisfactory, the parameters of the controller can be copied into the fractional PID design tool by pressing the Take values button. Further, an example illustrating the use of the fractional PID optimization tool is provided.
Fig. 4: Fractional PID optimization tool graphical user interface 4.2 Example Consider a fractional-order system of a heating furnace discussed in [11, 14]. It is described by the following fractional-order transfer function: G(s) =
Fig. 5 and Fig. 6, respectively. It can be observed, that by only tuning the orders of the PID controller integrating and differentiating components, a better result was achieved compared to the integer-order tuning.
1 . 14494s1.31 + 6009.5s0.97 + 1.69
1.4 1.2 1 Amplitude
We shall design a fractional-order controller for this plant using the method described above. First, a FOPDT model for this plant is obtained using the iopid tune tool. The obtained model has the following transfer function:
0.8 0.6 0.4
GF OP DT (s) =
0.58813 e−25.1528s . 1 + 4766.83s
0.2 0
0
2000
4000
6000
8000
10000
t [s]
Fig. 5: Control system step response comparison
Bode Diagram 100
Magnitude (dB)
50 0 −50 −100 −150 0 Initial frequency reponse Phase (deg)
Using the Ziegler-Nichols PID tuning formula, the integer-order PID parameters are then obtained as Kp = 386.676, Ki = 50.3056, Kd = 12.5764. These gains were then copied into the optimization tool and fixed, so that tuning of only the orders of the fractional integrator and differentiator could be performed. The refined Oustaloup filter was used for approximation with ω = [0.0001, 10000] rad/s, and order N = 5. Simulink was used for simulation and the optimize() function was used for optimization. The specifications were set for the gain and phase margins, such that Gm ≥ 10 dB, ϕm = 75◦ . Also, the control signal value was limited to range ulim = [0; 750]. A maximum of 100 iterations was considered. The results of controller parameter optimizations using different performance metrics can be found in Table 1. Here, N denotes the number of iterations until optimization termination, ϕm denotes the phase margin, τ denotes the settling time and σ denotes the overshoot. The best results were obtained with the ITSE index and the corresponding control system step response and open-loop frequency characteristics can be observed in
Initial response Post−optimization response
Post−optimization frequency response −45
−90
−135 −4
10
−2
10
0
10 Frequency (rad/sec)
2
10
4
10
Fig. 6: Control system open-loop frequency characteristics comparison
Table 1: Fractional PID controller optimization results
5
Index
λ
µ
N
ϕm , ◦
τ, s
σ, %
ISE
0.18751
0.43779
36
76.00
1203
12.3
IAE
0.10399
0.45757
50
77.86
1079
10.4
ITSE
0.01000
0.35526
45
79.32
1003
9.1
ITAE
0.11860
0.01071
100
77.36
1118
11.0
Discussion
The tools presented in this paper were developed in MATLAB v. 7.10. The tools were previously tested in earlier releases, i.e. 7.4-7.6 but not all current features may be supported in those versions. FOMCON requires Control System toolbox for general functionality. Several features, also described in this paper, require the Optimization toolbox. In the current implementation of the presented toolset there exist some limitations, a list of which can be found below. • Not all simulation options can be changed; • When using Simulink with a custom nonlinear model, frequency-domain specifications cannot, in general, be applied; • Approximating complex fractional-order systems may lead to either a poor approximation or an error, thus model simplification may need to be employed; • The toproper() function may need a more sophisticated algorithm to resolve the improper system problem; • Analysis of the closed loop under noise and disturbances is not implemented. These limitations will be dealt with in the upcoming versions of the toolbox.
6
Conclusions and Further Perspectives
In this paper, we presented a flexible MATLAB toolset for fractional PID controller optimization. It is expected that fractional modeling will soon be a standard practice, due to benefits, stemming from the use of fractional calculus. Thus, developing new techniques for fractional controller design is essential, especially since the new fractional-order PID controller can be considered as a natural evolution of the conventional PID controller. Further development of the proposed toolset can take several directions, among which are: • Developing a more general fractional controller design tool, similar to sisotool of the Control System toolbox; • Implementing more optimization algorithms (e.g. genetic algorithms based). In the paper, we have shown that it is possible to use classic methods for integer-order PID design to obtain an initial set of PID gains and then a huge improvement is introduced by tuning the orders of the PID integral and differential components. Usually it is possible to achieve a much better result by optimizing all parameters of the controller. However, a globally optimal solution is hard to guarantee. These issues will also be the topic of further research.
References [1] A. Oustaloup, P. Melchior, P. Lanusse, O. Cois, and F. Dancla, “The CRONE toolbox for Matlab,” in Proc. IEEE Int. Symp. Computer-Aided Control System Design CACSD 2000, 2000, pp. 190–195. [2] D. Val´erio. (2005) Toolbox ninteger for MatLab, v. 2.3. [Online]. Available: http://web.ist.utl.pt/duarte.valerio/ninteger/ninteger.htm [3] A. Tepljakov, E. Petlenkov, and J. Belikov, “FOMCON: Fractional-order modeling and control toolbox for MATLAB,” in Proc. 18th Int Mixed Design of Integrated Circuits and Systems (MIXDES) Conference, 2011, pp. 684–689. [4] D. Xue, Y. Chen, and D. P. Atherton, Linear Feedback Control: Analysis and Design with MATLAB (Advances in Design and Control), 1st ed. Philadelphia, PA, USA: Society for Industrial and Applied Mathematics, 2008. [5] Y. Q. Chen, I. Petras, and D. Xue, “Fractional order control a tutorial,” in Proc. ACC ’09. American Control Conference, 2009, pp. 1397–1411. [6] C. A. Monje, Y. Chen, B. Vinagre, D. Xue, and V. Feliu, Fractional-order Systems and Controls: Fundamentals and Applications, ser. Advances in Industrial Control. Springer Verlag, 2010. [7] K. Miller and B. Ross, An introduction to the fractional calculus and fractional differential equations. Wiley, 1993. [8] I. Podlubny, Fractional differential equations, ser. Mathematics in science and engineering. Academic Press, 1999. [9] A. A. Kilbas, H. M. Srivastava, and J. J. Trujillo, Theory and Applications of Fractional Differential Equations, Volume 204 (North-Holland Mathematics Studies). New York, NY, USA: Elsevier Science Inc., 2006. ˚ om and T. H¨agglund, Advanced PID control. The [10] K. Astr¨ Instrumentation, Systems, and Automation Society (ISA), 2006. [11] I. Podlubny, L. Dorcak, and I. Kostial, “On fractional derivatives, fractional-order dynamic systems and PIλ Dµ controllers,” in Proc. 36th IEEE Conf. Decision and Control, vol. 5, 1997, pp. 4985–4990. [12] I. Podlubny, “Fractional-order systems and PIλ Dµ controllers,” IEEE Trans. Autom. Control, vol. 44, no. 1, pp. 208–214, 1999. [13] D. Xue and Y. Chen, “A comparative introduction of four fractional order controllers,” in Proceedings of the 4th World Congress on Intelligent Control and Automation, 2002, pp. 3228–3235. [14] C. Zhao, D. Xue, and Y. Chen, “A fractional order pid tuning algorithm for a class of fractional order plants,” in Proc. IEEE Int Mechatronics and Automation Conf, vol. 1, 2005, pp. 216–221. [15] C. Monje, B. Vinagre, V. Feliu, and Y. Chen, “Tuning and auto-tuning of fractional order controllers for industry applications,” Control Engineering Practice, vol. 16, no. 7, pp. 798–812, 2008. [16] A. Oustaloup, F. Levron, B. Mathieu, and F. M. Nanot, “Frequency-band complex noninteger differentiator: characterization and synthesis,” IEEE Trans. Circuits Syst. I, vol. 47, no. 1, pp. 25–39, 2000. [17] R. Oldenhuis. (2009) Optimize. MathWorks File Exchange. [Online]. Available: http://www.mathworks.com/matlabcentral/fileexchange/24298optimize