Fractional-order Controller Design and Digital ...

1 downloads 0 Views 698KB Size Report
Abstract—In this paper, we present the suite of tools of the. FOMCON (“Fractional-order Modeling and Control”) toolbox for MATLAB that are used to carry out ...
Fractional-order Controller Design and Digital Implementation using FOMCON Toolbox for MATLAB Aleksei Tepljakov1 , Eduard Petlenkov1 , Juri Belikov2 , and Jevgeni Finajev1 Abstract— In this paper, we present the suite of tools of the FOMCON (“Fractional-order Modeling and Control”) toolbox for MATLAB that are used to carry out fractional-order PID controller design and hardware realization. An overview of the toolbox, its structure and particular modules, is presented with appropriate comments. We use a laboratory object designed to conduct temperature control experiments to illustrate the methods employed in FOMCON to derive suitable parameters for the controller and arrive at a digital implementation thereof on an 8-bit AVR microprocessor. The laboratory object is working under a real-time simulation platform with Simulink, Real-Time Windows Target toolbox and necessary drivers as its software backbone. Experimental results are provided which support the effectiveness of the proposed software solution.

I. I NTRODUCTION Fractional-order calculus is an exciting scientific discipline that has been investigated by various researchers for more than 300 years. The core concept of fractional calculus is the possibility to extend the notion of the order of derivative from integers to real numbers, or fractions. This extension has led to interesting new modeling possibilities. Consequently, the number of applications of fractional-order calculus in physics and neighboring disciplines has been steadily increasing over the past years [1], [2]. Naturally, fractional-order calculus found its way into control system design. New opportunities in modeling provide means to develop novel control strategies. For example, classical controllers, such as the PID controller and leadlag compensator, have been extended to fractional-order differentiation and integration [3], [4], [5] thereby allowing to enhance control loop characteristics. Another important example is CRONE control [6], [7]. Calculations associated with fractional-order modeling and control can be highly computationally intensive. In terms of software solutions for working with fractional-order models and controllers, we restrict our attention to the ones developed to work under the MATLAB/Simulink environment. Notable software packages include CRONE toolbox [6] and Ninteger toolbox [8]. In this paper, we focus on the recently developed FOMCON (“Fractional-order Modeling and Control”) toolbox [9]. The use of the toolbox is facilitated with a set of graphical user interfaces aimed at making 1 Aleksei Tepljakov, Eduard Petlenkov, and Jevgeni Finajev are with the Department of Computer Control, Tallinn University of Technology, Tallinn, 19086, Estonia, {aleksei.tepljakov, eduard.petlenkov} at dcc.ttu.ee and jevfin at gmail.com. 2 Juri Belikov is with the Institute of Cybernetics, Tallinn University of Technology, Akadeemia tee 21, 12618, Tallinn, Estonia, jbelikov at cc.ioc.ee.

the workflow more fluent. Further motivation for developing FOMCON is the desire to obtain a complete solution for efficient controller design and analog/digital implementation. In particular, FOMCON offers a set of tools for working with fractional-order PID controllers. This work complements our earlier contributions [10], [11], [12] by introducing the tools used for digital controller implementation and code generation as well as extending the platform used for real-time closed-loop simulation of the realized controller. The procedure of controller design and implementation, which was previously successfully applied to a coupled fluid tank system [13], is illustrated in this work on a laboratory model of a heating control system. The paper is organized as follows. In Section II the reader is introduced to basic concepts of fractional calculus in modeling and control. The features of the toolbox pertaining to the controller design workflow from model identification to digital controller code generation are described in Section III. Relevant comments with references to theoretical background are provided. The use of the presented toolbox modules is illustrated in Section IV. The heating system and the real-time simulation platform are described. Practical results of heating system control are presented in the last part of the section. Finally, in Section V conclusions are drawn. II. B RIEF I NTRODUCTION TO F RACTIONAL -O RDER M ODELING AND C ONTROL The cornerstone of fractional-order modeling is the generalized non-integer order fundamental operator  α α  α > 0, d /dt α (1) 1 α = 0, a Dt =  ´ t −α (dτ ) α < 0, a where a and t denote the limits of the operation. There exist several definitions of the integro-differential operator. We consider the Grünwald-Letnikov definition [1], [2] due to its immediate applicability to numeric evaluation of fractionalorder derivatives. The definition is as follows:   k 1 X j α α (−1) f (t − jh), (2) a Dt f (t) = lim α h→0 h j j=0 where a = 0, t = kh, k is the number of computation steps and h is step size. If zero initial conditions are assumed, the Laplace transform of the fractional α-order derivative is given by ˆ ∞

e−st 0 Dtα f (t)dt = sα F (s), 0

(3)

where α ∈ R+ and s is the usual Laplace transform variable. A fractional-order transfer function can thence be generally expressed as follows: G (s) =

bm sβm + bm−1 sβm−1 + · · · + b0 sβ0 . an sαn + an−1 sαn−1 + · · · + a0 sα0

(4)

B. Time-domain Identification The time domain identification tool can be started from the MATLAB command line by typing fotfid. The graphical user interface of the tool is depicted in Fig. 2.

The parallel form of the fractional PID controller, called the PIλ Dµ controller with λ and µ being the fractional orders of the integral and differential components, has the following transfer function: Ki (5) C(s) = Kp + λ + Kd · sµ . s It can be seen, that in the frequency domain this controller offers more tuning flexibility since more freedom in changing the shape of the response is achieved. Generally, by varying the order γ of a fractional-order integrator (differentiator) one can achieve a constant decrement (increment) in the slope of the magnitude curve that equals 20γ dB/dec and a constant delay in the phase plot πγ/2 rad, where the values depend on the sign of γ. III. FOMCON TOOLBOX FOR MATLAB In the following, we provide the description of the FOMCON toolbox modules used in this work. We begin the next subsection by providing and overview of all existing modules.

Fig. 2.

Fractional-order time domain identification tool

The tool allows to identify generalized fractional-order process models in the form

A. General Overview The structure of the toolbox is given in Fig. 1. There are currently four main modules: the main system analysis module (toolbox core), system identification module, control design module and fractional-order system implementation module. In this work, we concentrate on the following particular tools: • Time domain identification; • Fractional-order control design based on constrained optimization; • Digital implementation of the resulting controller.

G (s) =

bm sβm + bm−1 sβm−1 + · · · + b0 sβ0 −Ls e , an sαn + an−1 sαn−1 + · · · + a0 sα0

(6)

where L is the transport delay. For practical reasons it makes sense to fix α0 = β0 = 0, so that the ratio K = b0 /a0 becomes the static gain of the identified system. This can be achieved by ticking the “K (static gain)” checkbox in the tool. It will then be possible to explicitly set the static gain and it will also become a search parameter. Identification is done by means of minimizing the error 2 norm ke (t)k2 , where e (t) = y (t) − yid (t) .

(7)

Thus, this tool uses the output-error approach to identification of the fractional transfer function parameters. Once a result is obtained, the identified system can be exported into the MATLAB workspace and manipulated further by functions trunc(), round(), and normalize() which work on the coefficient and exponent vectors corresponding to those of the zero and pole polynomials of the fractionalorder transfer function. The latter function normalize() is used to arrive at a representation of the system in (6), where a0 = 1. C. Fractional-order PID Controller Optimization

Fig. 1.

FOMCON toolbox structure

The fractional-order PID optimization tool was inspired by [2], [14] and thoroughly described in [12]. It is called by the command fpid_optim and has the following graphical user interface presented in Fig. 3.

Fig. 4.

Fig. 3.

Fractional-order PID controller optimization tool

The general procedure of fractional PID controller design may be summarized by the following steps: • Depending on the plant characteristics, determine the correct frequency range for approximation. Oustaloup filters are always used due to their flexibility [2]. • Obtain an initial feasible parameter set for the fractional-order PID controller (this step is optional); • Choose controller gain/exponent constraints by taking the dynamical characteristics of the plant into account; • Choose control system constraints based on frequency domain analysis of the open loop; • Decide whether you want to use Simulink for system simulation (it should always be used if a real plant is to be controlled), and if so, specify the correct control saturation values of the actuator. Next, the choice of an appropriate performance metric is required (four are provided: ISE, IAE, ITSE, and ITAE). The selection of this parameter depends on the desired dynamical properties of the control loop [15]. Limiting the number of iterations can help determine whether the initial parameter selection can ultimately lead to a feasible result. Enabling simulation in Simulink is especially important in practical applications, since it allows to simulate and visualize actuator saturation effects as well as other nonlinear properties of the system. It also helps to overcome some restrictions dictated by particular implementations of fractional-order operators. D. Controller Digital Implementation The fractional-order PID implementation tool impid currently serves as a frontend (Fig. 4) for the c2d() function of the Control System MATLAB toolbox. The tool allows to produce a discrete approximation of a fractional-order PID controller in zero-pole-gain, transfer function, or discrete state-space form. The system is initially approximated by a continuous Oustaloup filter and then converted to the discrete domain by means of the c2d() function with suitable parameters and sampling time.

Fractional-order PID controller implementation tool

In this case the whole controller is approximated by a single discrete LTI system. The choice of approximation parameters is very important and should be carefully tailored for the particular controller. The plotting functions allow to observe the resulting frequency-domain characteristics of the continuous and discrete filter approximations to ensure valid results. The next step after obtaining a discrete approximation of the controller is to choose a suitable filter structure for implementation. A very reasonable choice in the light of possible computational shortcomings of the target hardware is using IIR filters in form of second-order sections, which have several advantages over direct forms regarding computational stability: H(z) = b0

N Y 1 + b1k z −1 + b2k z −2 . 1 + a1k z −1 + a2k z −2

(8)

k=1

A function d2sos() is provided for automatic C code generation producing second-order section arrays with specified coefficient precision for the given MATLAB discrete-time LTI system. IV. C ONTROLLER D ESIGN AND I MPLEMENTATION FOR THE H EATING S YSTEM A. Description of the Laboratory Plant and Experimental Platform The laboratory plant, depicted in Fig. 5, consists of a heater and a fan, actuated by pulse-width modulation through high power MOSFET transistors and controlled from the Simulink environment by means of a virtual serial port established over a USB connection. This prototype has been designed and developed in our laboratory in the context of a Master’s thesis project [16] with the main design goal being related to teaching. As such, various safety features have been considered and implemented. This prototype is configured in such a way, that temperature is directly controlled through managing the power dissipated by the heating element by means of the duty cycle setting. Thus, without regard to the impact of the cooling fan, the basic static characteristic of the plant is given by T (D) = Td (D · P ) + Troom ,

(9)

Fig. 7. Fig. 5.

Experimental platform used for real-time closed loop simulation

The laboratory plant: heating system model with USB interface

B. Model Identification and Controller Design where D is the duty cycle in %, Td (P ) is the function relating the dissipated power to the temperature rise, and Troom is the room temperature. All temperature is measured in ◦ C. In this case, a weak nonlinear relation between T (D) and D results from the corresponding nonlinear relation between Td (P ) and P depicted in Fig. 6. 300

Temperature rise [ ° C]

250

200

150

100

G(s) =

50

0

Fig. 6. rise

We begin by conducting a step response experiment to capture the data necessary to identify a dynamical model of the plant. With the fan turned off, we set a control input value of 50% and register the transient response of the plant for 750 seconds. The model is such that the input signal values are in the interval [0,100] and output can range from Troom to Tmax . In order to identify the heating system by a fractional-order model, we need to remove the output offset, in this case Troom so that the initial temperature is zero. Next, we choose an initial guess model for identification. This is a relatively simple heating process, so using a first-order system would suffice. Using the fotfid tool we successfully arrive at a model. After normalization, the following model is obtained:

0

2

4

6 8 Power [W]

10

12

14

Heating element characteristic: dissipated power vs. temperature

For the experiment, a revised version of our hardware platform from [11] is used. The new DAQ board offers 12 bit sample resolution on all channels while, in theory, maintaining full-duplex 2.5kSPS closed-loop sampling rates and at most single sample input/output delays. The corresponding schematic diagram is given in Fig. 7. Two kinds of real-time control experiments are considered with the physical plant in the loop: • The discrete fractional-order PID controller, implemented as a Simulink block, is used to control the plant; • A digital implementation of the fractional-order PID controller is in the control loop, Simulink is only used for simulation timing and interfacing the DAQ board to the physical plant. Throughout the experiments, a sampling rate Ts = 0.5s is used. In the next subsection we describe the steps required to design and implement a fractional-order controller for the heating system model.

2.8734 . 244.2517s1.0443 + 1

(10)

As expected, it does not possess distinct fractional-order dynamics. It comes quite close to an integer-order model. For comparison, we have identified a simple first-order integerorder model with static gain K = 2.9759 and time constant T = 203.9446. The comparison of the output error of the fractional-order model and the integer-order model is shown in Fig. 8. It can be seen, that overall the output error of the fractional-order system tends to be smaller than that of the integer-order one. The next step is to design a PIλ Dµ controller for this plant. As in our previous work [12] we obtain the initial controller values by means of conventional integer-order PID controller tuning methods. This requires to approximate the fractional-order model by a first-order plus dead time model first. We then apply the AMIGO tuning procedure [15] and arrive at the following parameters: Kp = 5.99235, Ki = 0.739468, Kd = 14.6879. Next we constrain the parameter search space by choosing Kp , Ki , Kd ∈ [0, 100], λ ∈ [0.9, 1], µ ∈ [0.5, 0.9] and additionally moving the inital point by setting Kp = 25, λ = 0.9, µ = 0.5. The refined Oustaloup filter is used for simulation in the frequency range of ω ∈ [10−4 , 104 ] rad/s and the order of approximation is equal to 5. Simulink is used for system simulation, so

ATmega8A microcontroller based controller prototype. We use the impid tool to ensure that we arrive at a proper approximation of the controller. The Oustaloup filter is used to produce the discrete controller in zero-pole-gain form in the frequency range of ω ∈ [10−4 ; 104 ] rad/s and with the order of approximation equal to 5. The “Matched pole-zero” discretization method is used with the sampling time set to 0.5s. The resulting model is saved to MATLAB workspace and the function d2sos() is used to directly generate the C code with the second-order section arrays.

5

Integer−order model Fractional−order model

3

2

1

0

−1

−2

−3

0

100

200

300

400

500

600

700

C. Experimental Results

Time [s]

Fig. 8.

Output error of the identified models

the correct actuator constraints are set. Desired open-loop frequency domain characteristics are such, that a minimum phase margin ϕm = 60◦ is required. The performance metric is IAE. Additionally, in this case we need to account for the temperature offset removed from the output signal earlier in order to identify the fractional-order transfer function. We create a new Simulink diagram, click on the edit button, and add the offset Troom = 25◦ C back to the model output. This is physically meaningful in the sense that the temperature of the heating element cannot in our case fall below room temperature. After 100 iterations the optimized parameters are obtained: Kp = 32.3394,

Ki = 0.019575, λ = 0.90301,

The first experiment is done to confirm the validity of the parameters obtained during PIλ Dµ controller optimization. The temperature set point is 100◦ C. The time domain response of the control system is given in Fig. 10. The dashed line represents the response of the model (10) with the controller (11) obtained by means of continuous time simulation in Simulink without using any external interface. The solid line represents the response of the physical plant to Simulink-based control. It can be seen that the temperature output signals coincide perfectly. The oscillations of the control law occur due to quantization [17]. This behavior can be improved by increasing the sample resolution of the analog/digital interface of the controlled object which is, at present, fixed at 8 bits. Also, it is possible to reduce the amplitude of the limit cycles by considering, for example, a nonlinear realization of the proportional gain of the controller [18].

Kd = 5.5806, µ = 0.55985.

(11)

The comparison of the open loop frequency response of the control system before and after the optimization process is given in Fig. 9. Phase margin achieved is ϕm = 90.9◦ .

110 100 Heater temperature [ °C]

Identified model output error [deg C]

4

Bode Diagram

90 80 70 60

Simulation of model used for PIλDµ controller optimization Closed loop, real−time experiment with the real object Reference temperature signal

50 40 30

100 80

20

Pre−optimization frequency response

60

Post−optimization frequency response

0

20

40

60

80

100

120

140

160

180

0

20

40

60

80

100 Time [s]

120

140

160

180

100

20

Control law [PWM duty cycle, %]

Magnitude (dB)

40

0 −20 −40 −60 −80

Phase (deg)

−100 0

−45

80 60 40 20 0

−90

−135 −5

10

−4

10

−3

10

−2

10

−1

10

0

1

10 10 Frequency (rad/s)

2

10

3

10

4

10

5

10

Fig. 9. Comparison of frequency domain characteristics of the open loop control system before and after fractional PID controller parameter optimization

Finally, we consider the digital implementation of the obtained fractional-order PID controller on the Atmel AVR

Fig. 10.

First experiment: control system transient response

The objective of the second experiment is to compare the performance of the external controller, implemented in hardware, to that of the controller working in Simulink. The complete real-time simulation configuration is used as shown in Fig. 7. The corresponding Simulink diagram is provided in Fig. 11.

LABKIT

Fan

Fan [RPM]

Fan [PWM]

Terminator In1

Temperature set point

Out1

Discrete fractional PID controller [External]

Heater [PWM]

Temp [deg C]

Control saturation

ACKNOWLEDGMENTS Scope

Fig. 11.

Simulink diagram used for the second experiment

Additionally, set point changes and disturbance are considered for this experiment. At the 200th second of the simulation the fan is activated at 75% of its capacity. The result of the real-time simulation can be observed in Fig. 12.

140

Heater temperature [ °C]

120 100 80 60 40 Heating system in loop Heating system and digital controller in loop Reference temperature signal

20

Control law [PWM duty cycle, %]

0

0

100

200

300

400

500

600

700

800

0

100

200

300

400

500

600

700

800

0

100

200

300

400 Time [s]

500

600

700

800

100 80 60 40 20 0

Fan [%]

experiments with the heating system in various configurations. Experimental results confirm the effectiveness of the proposed methods.

100 50 0

Fig. 12. Second experiment: controller working in Simulink vs. external digital controller implemented in hardware

It can be seen, that the system output signals match up perfectly once again. And in both cases, the controller is capable of maintaining the set temperature within ±1◦ C of the reference signal in the presence of a constant disturbance produced by the cooling fan. We can conclude that the digital implementation of the controller works just as well as the simulated one. The limit cycles are again present in the control law. V. C ONCLUSIONS In this paper, we have presented a full suite of tools which can be used to design and implement a suitable fractionalorder PID controller for a particular control task. We have identified a laboratory plant consisting of a heating system by a fractional-order process model and successfully designed a PIλ Dµ controller by means of constrained optimization. Then we have produced a digital implementation of the controller in form of a IIR filter comprised of secondorder sections thereby improving computational stability. We have successfully performed real-time closed-loop control

The work was supported by the European Union through the European Regional Development Fund, the target funding project SF0140113As08 of Estonian Ministry of Education and the ESF grant N8738, and the Estonian Doctoral School in Information and Communication Technology through the interdisciplinary project FOMCON. R EFERENCES [1] Y. Q. Chen, I. Petráš, and D. Xue, “Fractional order control - a tutorial,” in Proc. ACC ’09. American Control Conference, 2009, pp. 1397–1411. [2] C. A. Monje, Y. Chen, B. Vinagre, D. Xue, and V. Feliu, Fractionalorder Systems and Controls: Fundamentals and Applications, ser. Advances in Industrial Control. Springer Verlag, 2010. [3] I. Podlubny, L. Dorˇcák, 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. [4] I. Podlubny, “Fractional-order systems and PIλ Dµ -controllers,” IEEE Transactions on Automatic Control, vol. 44, no. 1, pp. 208–214, 1999. [5] 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. [6] A. Oustaloup, P. Melchior, P. Lanusse, O. Cois, and F. Dancla, “The CRONE toolbox for Matlab,” in Proc. IEEE Int. Symp. ComputerAided Control System Design CACSD 2000, 2000, pp. 190–195. [7] A. Oustaloup, F. Levron, B. Mathieu, and F. M. Nanot, “Frequencyband complex noninteger differentiator: characterization and synthesis,” IEEE Transactions on Circuits and Systems—Part I: Fundamental Theory and Applications, vol. 47, no. 1, pp. 25–39, 2000. [8] D. Valério. (2005) Toolbox ninteger for MatLab, v. 2.3. [Online]. Available: http://web.ist.utl.pt/duarte.valerio/ninteger/ninteger.htm [9] A. Tepljakov, E. Petlenkov, and J. Belikov. (2011) FOMCON toolbox. [Online]. Available: http://www.fomcon.net/ [10] ——, “FOMCON: a MATLAB toolbox for fractional-order system identification and control,” International Journal of Microelectronics and Computer Science, vol. 2, no. 2, pp. 51–62, 2011. [11] ——, “Implementation and real-time simulation of a fractional-order controller using a MATLAB based prototyping platform,” in Proc. 13th Biennial Baltic Electronics Conference, 2012, pp. 145–148. [12] ——, “A flexible MATLAB tool for optimal fractional-order PID controller design subject to specifications,” in Proceedings of the 31st Chinese Control Conference, W. Li and Q. Zhao, Eds., Hefei, Anhui, China, 2012, pp. 4698–4703. [13] A. Tepljakov, E. Petlenkov, J. Belikov, and M. Halás, “Design and implementation of fractional-order PID controllers for a fluid tank system,” in Proc. 2013 American Control Conference (ACC), Washington DC, USA, June 2013, pp. 1780–1785. [14] 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. [15] K. Åström and T. Hägglund, PID Controllers: Theory, Design, and Tuning, 2nd ed. The Instrumentation, Systems, and Automation Society (ISA), 1995. [16] J. Finajev, “MATLAB/Simulink compatible heater lab kit with USB interface,” Master’s thesis, Tallinn University of Technology, Tallinn, Estonia, 2013. [17] S. Kuo and B. Lee, Real-time digital signal processing: implementations, applications, and experiments with the TMS320C55X. Wiley, 2001. [18] V. C. Jaswa, “Quantization noise and limit cycling in digital closedloop systems,” IEEE Transactions on Industrial Electronics, vol. IE31, no. 2, pp. 149–151, 1984.