International Journal of Advanced Research in Engineering and Technology (IJARET) Volume 7, Issue 3, May–June 2016, pp. 87–95, Article ID: IJARET_07_03_008 Available online at http://www.iaeme.com/IJARET/issues.asp?JType=IJARET&VType=7&IType=3 ISSN Print: 0976-6480 and ISSN Online: 0976-6499 © IAEME Publication
IMPLEMENTATION OF FRACTIONAL ORDER TRANSFER FUNCTION USING LOW COST DSP Sandip A. Mehta Ph.D. Scholar, Dept. of Instrumentation & Control, Nirma University, Ahmedabad, Gujarat, India Dipak M. Adhyaru Professor & Section Head, Dept. of Instrumentation & Control, Nirma University, Ahmedabad, India ABSTRACT In this paper, different fractional order transfer functions are taken first and discretized them using available methods and filters (i.e. Oustaloup or modified Oustaloup). Coefficients of discretized transfer function are calculated and scaled using Q15 number system to get the coefficients in the range between -1 to 1, and converted into equivalent hexadecimal number. These coefficients are entered into the Micro C code that is generated using filter design tool of Micro C for dsPIC microcontroller. Also the simulation results are validated using EasydsPIC4 development board. Key words: Fractional order, IIR Filter, dsPIC, Q15, Oustaloup Cite this article: Sandip A. Mehta and Dipak M. Adhyaru, Implementation of Fractional Order Transfer Function Using Low Cost DSP. International Journal of Advanced Research in Engineering and Technology, 7(3), 2016, pp 87–95. http://www.iaeme.com/IJARET/issues.asp?JType=IJARET&VType=7&IType=3
1. INTRODUCTION Fractional calculus was first founded by Leibniz and L’Hˆopital probably in 1695. Now days, fractional-order dynamics, which are defined based on fractional-order differential equations plays a significant role in different control applications. For example these dynamics have been extensively used in design and practical implementation of controllers in modelling of real-world phenomena and in identification of physical systems [1]. For the fractional order controller implementation part many a uthors have implemented it using hardware in loop simulation methods [2][3][4] where the actual control part is been done by the dedicated high cost software with the help of either a http://www.iaeme.com/IJARET/index.asp
87
[email protected]
Sandip A. Mehta and Dipak M. Adhyaru
laptop or personal computer(PC). However when it comes to standalone PID Control application or other industrial grade PID Controller it is been required to find the embedded solution for implementation of fractional order transfer function or fractional order PID Controller. For that part the microcontroller based implementation method is the best suited method for the implementation. In [5] the author has proposed the PIC18F458 microcontroller method for the implementation of fractional order PID Controller and analog realization method is also proposed. Even some book[6] has suggested the DSP based IIR and FIR realization methods for the implementation of fractional order PID Controller . However since then very little effort[7][8] has been made for the implementation methods for the fractional order PID Controller using low cost microcontroller. The problem with microcontroller implementation is that real time signal processing is not possible where as in DSP real time signal processing task is possible and that’s why the best suitable candidate for implementation fractional order PID Controller is the low cost DSP controller. In this paper dsPIC30F4013 is been used for the implementation of PID algorithm. The dsPIC30F4013 is 16 bit DSP processor and the programming software for this DSP is Mikro C or MPLAB. The cost of this processor is around 5U$. In this paper Mikro C software has been used for the programming the dsPIC30f4013. Different fractional order transfer functions has been simulated using MATLAB. d. In section 1, first it is shown how to simulate the fractional order transfer function using appropriate approximation and discretize it using available methods. In section 2, scaling of the coefficients of discretized transfer function using Q15 number system has been described. In section 3, design of a filter using filter design tool has been described. In section 4, simulations of the different transfer functions are explained. And in section 5, Implementation results of simulations are given.
2. FRACTIONAL ORDER TRANSFER FUNCTION APPROXIMATION There are various methods available for the approximation of fractional order transfer function to integer form or in other words continuous time transfer function form, these methods are described in [6]. Out of these methods the approximation methods Oustaloup or modified Oustaloup approximation method is best suitable method for our purpose and we have used these two methods for the approximation purpose.. Convert the resulting continuous time transfer function into discrete time transfer function using available methods of discretization i.e. Tustin, prewarp etc.[6].
3. SCALING OF COEFFICIENTS AND FILTER DESIGN 3.1. Scaling of Coefficients As the transfer function is discretized, next step is to scale the coefficients of the discretized transfer function as per the binary floating point number system. In this paper Q15 number system has been used since the 16 bit DSP microcontroller that is used for the implementation is supporting only Q15 number system. Scaling of the coefficients is required because the range of the fractional operator is between -1 to 1, so the coefficients of filter must be in same range between -1 to 1. In Q15,15 represents the number of bits reserved for floating part. The complete flow chart for the whole process is as shown in the next section. As it is shown in the flow chart after the approximation of fractional order system in to
http://www.iaeme.com/IJARET/index.asp
88
[email protected]
Implementation of Fractional Order Transfer Function Using Low Cost DSP
integer order domain the stability of the integer order system has been verified. For the stability of integer order system, a MATLAB command has been used.
3.2. IIR and FIR filter After getting the integer order transfer function, the next task is to implement the transfer function using IIR/FIR filter format. IIR filters are digital filters with infinite impulse response. Unlike FIR filters, they have the feedback (a recurs ive part of a filter) and are known as recursive digital filters therefore. For this reason IIR filters have much better frequency response than FIR filters of the same order. Below figure clearly shows the difference between FIR and IIR filter [9].
Figure 1 IIR and FIR filter concept
http://www.iaeme.com/IJARET/index.asp
89
[email protected]
Sandip A. Mehta and Dipak M. Adhyaru
Define transfer function
Discretize the transfer function using the filter (i.e. Oustaloup, modified Oustaloup)
Take the new transfer function
Find the step response of the system
NO
YES Is System is stable?
Calculate the coefficients of transfer function
NO
YES Is it between -1 to 1?
Scale the Coefficients using Q15 number system
Q15 number system means scaling by 1/2 15.
i
< 1
s N
If the coefficient is not in the range of -1 to 1 than divide it to nearest integer number and convert to hexadecimal number
O
1
.I
5
We cant use C function to convert hexadecimal number -1
2
-1
5
2
-1
4
-1
2
3
2
2
0
2
…
… These.coefficients are being used in the code for filter design n
,
-1
1 =
0 http://www.iaeme.com/IJARET/index.asp r .
90
[email protected]
Implementation of Fractional Order Transfer Function Using Low Cost DSP
Give design parameters for the filter
Appropriated C Code is written
Hex file generation from C code and program the dsPIC4013
Observe the output waveforms on DAC M CP4921
One can check the validity of the simulation hex file in Easy dsPIC4 development board. One can check the validity of the simulation hex file in Easy dsPIC4 development board.
End
Flow Chart 1 Illustration of complete process through flow chart
There is one problem known as a potential instability that is typical of IIR filters only. FIR filters do not have such a problem as they do not have the feedback. According to the location of poles in the z plane, it is easy to determine whether it refers to FIR or IIR filter. The poles of the FIR filter transfer function are located at the origin. For IIR filter it is always necessary to check after the design process whether the resulting IIR filter is stable or not. The recursive part of the transfer function is actually a discrete-time system feedback. Unlike the FIR filters, the IIR filters have feedback which enables them to have greater selectivity as well as nonlinearity of phase characteristic than FIR filters. With filter we are using bilinear transformation because it always makes filter stable [10][11]. For the discretization of fractional order transfer function using z-transform of the transfer function is of great importance for IIR filters. The location of poles in the z plane is used for testing stability of designed IIR filter. The poles of the IIR filter transfer function must be located within the unit circle in orde r that filter is stable. Filter Designer Tool of Mikro C allows simple and very fast design of digital filters. User need to define the different specifications like Filter order, Sampling frequency, Pass band cut-off frequency, and Minimum stop band attenuation etc. in filter designer tool and it will generate the C code of the same. In the C code we need to enter the coefficients that we have calculated for our transfer function as described in flowchart-I.
http://www.iaeme.com/IJARET/index.asp
91
[email protected]
Sandip A. Mehta and Dipak M. Adhyaru
3.3. Simulation and Implementation work, results and discussion (1)
Consider the following Transfer function:
Here using the Oustaloup approximation the simulation result is as shown in the figure2. The simulation has been done using MATLAB software.
Figure 2 Simulation of Fractional order transfer function
For the hardware implementation the Easy dsPIC development board has been used. The Easy dsPIC board allows dsPIC microcontrollers to be interfaced with external circuits and a broad range of peripheral devices. It comes with a dsPIC30F4013, 40-pin microcontroller. It has its own on-board USB programmer so user can load the program into the DSP microcontroller via the dsPICflash programming software. The following schematic shows connection diagram of dsPIC30F4013 to DAC MCP4921, Fig.4. The 12 bit DAC is connected to the SPI module of dsPIC30F4013. The DAC is connected to the SPI module of dsPIC30F401.3The C code for the IIR filter program is written and the step response of the filter is as shown in the Figure .3
Figure 3 Step Response of the fractional order transfer function
http://www.iaeme.com/IJARET/index.asp
92
[email protected]
Implementation of Fractional Order Transfer Function Using Low Cost DSP
Similarly fractional order PID is been simulated and implemented as shown in Fig.5 and Fig.6. The PID transfer function is (2)
This transfer function is simulated for the filter order of 5 with sampling time of 0.01 sec. and Tustin’s prewarp approximation.
Figure 4 dsPIC30F4013 connection with the DAC
Figure 5 Simulated step response of fractional PID controller
Figure 6 Step Response of the fractional order PID transfer function.
http://www.iaeme.com/IJARET/index.asp
93
[email protected]
Sandip A. Mehta and Dipak M. Adhyaru
4. CONCLUSION This paper proposed the methodology for the implementation of fractional order transfer function on dsPIC microcontroller. The different fractional order transfer functions and fractional PID controller are simulated first and then successfully implemented using IIR filter approximation method. The fractional order operator range is -1 to 1. The IIR filter order used in the implementation is up to 12. It has been observed the higher the order of the filter more accurate the result. However when filter order is greater than 12 it is difficult to calculate all the filter coefficient accurately. Since the range of input signal is between 0 to 1 volt only, considerable amount of noise output is observed. In future the fractional order PID can be implemented to control the physical system
ACKNOWLEDGEMENT The present work is a part of PhD research work carried out at Nirma University.
REFERENCES [1]
[2]
[3]
[4]
[5] [6]
[7]
[8]
[9] [10] [11]
Podlubny, I, Fractional-order systems and PI/sup /spl lambda//D/sup /spl mu//-controllers, Automatic Control, IEEE Transactions on, 44 (1), pp.208– 214, Jan. 1999 Huang Wenbo, Zhang Qiang(2012, January 1), The Hardware-in-the-loop Simulation on the Control System of a Small Launch Vehicle, Procedia Engineering,[Online].29(0),pp. 1867-1871, Available: http://www.sciencedirect. com /science /article/pii/S187770581200238X ,July 14,2014 Mukhopadhyay, S.; Yan Li; Yang-Quan Chen, Experimental Studies of a Fractional Order Universal Adaptive Stabilizer, Mechtronic and Embedded Systems and Applications, 2008. MESA 2008. IEEE/ASME International Conference on , pp.591–596, 12-15 Oct. 2008 Mukhopadhyay, S.; Yiding Han; Yang-Quan Chen, Fractional order networked control systems and random delay dynamics: A hardware-in-theloop simulation study, American Control Conference, 2009. ACC '09, pp.1418–1423, 10-12 June 2009. Ivo Petras, Fractional order feedback control of dc motor , Journal of electrical engineering, 60(3),pp.117–128, 2009 C A Monge, Y Q Chen, Blas M Vinagre, Dingyu Xue and Vicente FeliuBatlle, Fractional order systems and fractional order controllerl, Springer Science & Businees Media, 2010 Both, R.; Muresan, C.-I; Dulf, E.-H.; Dulf, F.-V, Microcontroller implementation of digital fractional order controllers for time delay processes," Control & Automation (MED), 2013 21st Mediterranean Conference on pp.1445,1450, 25–28 June 2013 A.K Abbes, F. Bouani, M. Ksouri,., A Microcontroller Implementation of Constrained Model Predictive Control, International Journal of Electrical and Electronics Engineering,5:4 2011 Dolecek, G.J. Demo Programme for Teaching the Characteristics of Low Pass IIR Filters, IEEE Conference Publication, Pg T4E1-T4E6,October 2011. Dooren, P. van, Numerical aspects of system and control algorithms, Journal A, pp. 25–32, 1989. Bednar, J, On the approximation of FIR by IIR digital filters. IEEE
http://www.iaeme.com/IJARET/index.asp
94
[email protected]
Implementation of Fractional Order Transfer Function Using Low Cost DSP [12] [13] [14]
[15]
[16] [17]
Transaction on Acoust, Speech, Signal Processing. pp. 28–34. Feb. 1983 MATLAB R2010a. [Online] http://www.mathworks.com Ch. Ravi Kumar and Dr. P.V.Ramana Rao, PSO Based Fractional Order Automatic Generation Controller For Two Area Power System. International Journal of Electrical Engineering and Technology, 5(9), 2014, pp 17–28. Kishore Bingi and Susy Thomas, A New Chaotic Attractor Generated From A 3-D Autonomous System with One Equilibrium And Its Fractional Order Form. International Journal of Electrical Engineering and Technology, 5(2), 2014, pp 51–59. Topalovic, Zoran Ristic Ivan Rajkovic Nikola. mikroElektronica. [Online] http://www.mikroe.com.
http://www.iaeme.com/IJARET/index.asp
95
[email protected]