Transactions Template JOURNAL OF ENGINEERING RESEARCH AND TECHNOLOGY, VOLUME 1, ISSUE 2, JUNE 2014 FPGA Based Generalized Switched Reluctance Motor Controller Yassen Gorbounov Abstract— this paper presents an approach towards building a dedicated fully digital embedded switched reluctance motor (SRM) controller based on a field programmable gate array (FPGA) circuit. The essentials of the switched reluctance motor operation and control principles are briefly introduced and the hardware implementation of the digital FPGA controller is discussed. Prior to build the controller a precise mathematical model based on artificial neural network has been built that solves the problems related with the high nonlinearity of the magnetic circuit of the motor. The coefficients obtained with the aid of this model are included as parameters in the Verilog HDL description of the main algorithms. The paper highlights some advantages of FPGA devices outlining their power and flexibility when it is about running of parallel processing algorithms. Index Terms— Switched reluctance motor, parallel algorithms, motor control, embedded controller, artificial neural network. I INTRODUCTION Switched reluctance motors (SRM) are doubly salient electric machines which have neither windings nor magnets on the rotor. The torque is produced by the tendency of the rotor to move to a position with lowest reluctance, i.e. where the inductance of the excited phase is maximized [1, 2]. Although known from 1830s and having one of the simplest constructions their usage was restrained to around 1960s due to the specifics of their control. With the burst development of digital control logic and with the great achievements in power electronics the SR motors gain continuing popularity nowadays in areas such as the coal mines [3], aircraft and aerospace industries [4], electric vehicles [5], home and office appliances [6] and renewable energy sources in form of switched reluctance generators (SRG) in wind turbines [7] etc. One of the major peculiarities of these motors is related to the high nonlinearity of the stator inductance that is a function of both the angular position and the current flowing through the active phase winding. That is why fast running parallel algorithms are required that disqualify most of the CPUs and make FPGAs extremely suitable. This paper deals with a dedicated digital SRM controller built around Xilinx Spartan 3 Starter Kit [17, 18] that demonstrates the ability of the FPGA circuits for running parallel algorithms. In the article the basic control principle of this motor type is outlined as well as specific implementa- tion of the controller for SRM12-8 is proposed. Verilog HDL has been used as a basis for creating the digital hardware description. II OPERATION PRINCIPLES OF THE SRM The switched reluctance motor has very simple and robust construction. There have been discussed some of the main concepts that characterize this type of motor and the related power converter is given below. A Structure of the SRM The cross-section of a typical 3-phase SRM of type 12-8 is given in Figure 1. Figure 1 Cross-section of SRM12-8 Each stator winding is independent from the others and the torque produced is insensitive to the current polarity which simplifies the power converter topology. To move the rotor in a desired direction of rotation the motor phases are switched sequentially by applying DC voltage pulses. The ————————————————  Y. Gorbounov is with the Department of Electrical Drives Automation, Technical University of Sofia, Bulgaria FPGA Based Generalized Switched Reluctance Motor Controller, Yassen Gorbounov (2014) 46 rotation is produced by the strive of the rotor to move to a position where the reluctance in the air gap between the rotor and the stator is minimized [2] and not because of the induced magnetic field in the rotor as is the case with the other motor types. For the sake of increasing the static torque the rotor poles number is reduced [15]. This however causes the specific audible noise of this motor type that is due to the change of the stator geometry which is produced by the torque ripples. Physically the motor is made of lami- nated steel, has no impregnating resins in the coils and has no sparkling mechanical collector. These properties make this motor ecologic, highly reliable and durable. It is ex- tremely suitable to be used in harsh environments. In addi- tion SR motors are fault tolerant because they are operable even if one of the stator phases is shorted or interrupted. B Topology of the power converter Since the stress in the paper is on the digital control princi- ple, only the main features of the power converter are ref- ered here. The most widely spread topology of the power inverter used in SR drives is shown in Figure 2. This is an asymmetric converter with freewheeling and regeneration capability. As it can be seen this inverter lacks one of the major drawbacks of the ordinary classical inverters – there is no possibility for shooting-through as the upper and the lower power switch legs are connected through the motor coil. There exist also three-phase topologies with only 4 power switches in total with a common lower leg consisting of just one transistor [1], and other topologies are possible as well. These features of the inverter contribute to the overall fault tolerance of the SR drive. Figure 2 SRM power inverter C The problem of nonlinearity As it has been mentioned earlier the main drawback of the switched reluctance motor control is related with the high nonlinearity of flux linkage, torque and stator inductance which all varies with both the angular rotor position and the current flowing through the phase coil. The specific shape of the stator inductance as a function of two variables, namely the angular position θ, and the phase current I, is shown in Figure 3. This inductance is of major interest when it is about the control of the SRM as its precise identification gives the most direct picture of the motor state and the most important parameters can be derived on its base. Figure 3 Stator inductance as a function of the angular position θ, and the phase current I The self-inductance is described with equation (1):     i i iLL    , ,   (1) , where θ is the angular position, i is the phase current and ψ is the magnetic flux through the active phase. Linear modeling of the inductance is frequently being discussed in the literature but it is not precise enough and its usage can compromise the quality of the control. A thorough comparative analysis involving some known methods is presented in [8]. The problem of the mathematical modeling of the nonlinearity is most usually solved with the aid of the finite element method analysis (FEM) [9] which is a numer- ical technique for finding approximate solutions of partial differential equations and requires extensive computational efforts. That is why other intelligent methods exist that em- ploys the interpolation approach. A method of this kind is the function decomposition using the fast Fourier transform (FFT) [12, 14]. It is an advanced and fast numerical approx- imation algorithm that is being commonly used nowadays in digital signal processing. In the proposed controller the arti- ficial neural network modeling (ANN) approach has been adopted [10, 11, 13] which proved to be quite precise. Artifi- cial neural networks are often used for applications where formal analysis would be difficult or impossible, such as pattern recognition, function approximation and nonlinear system identification and control. Using ANN the equation (1) can be also expressed as (2) [19]: 𝐿 = 𝐿(𝐼). 𝐴(𝜃) (2) First A. Author, Second B. Author., and Third C. Author / Research Name (2013) 47 , where I is the phase stator current, θ is the rotor angle, L(I) is the inductance in the align position of the rotor that depends only on the phase current and A(θ) is the normal- ized inductance of the phase in zero current conditions or when the motor is not loaded. Next, the partial derivatives of the phase inductance can be obtained after differentiating the expression (2) thus obtaining the form (3) [19].       d dА IL IL dI IdL А I IL )( ).( ),( )( ).( ),(       (3) The partial derivatives can be presented by ordinary ones. The curves for A(θ) and L(I) can be taken experimentally. Having the experimental values, it is easy to describe them by artificial neural networks which is very useful in avoiding the complex problem of solving the differential equations. The need of the very precise approximation when modeling of the inductance with ANN is justified by the fact that each phase have to be energized from some given moment to an exact moment just before the inductance reaches its maxi- mum, otherwise a negative torque will be generated and this will deteriorate significantly the power characteristics of the drive. III DIGITAL CONTROLLER The aforementioned specifics of the SRM hindered the de- velopment of their control and more widely usage until around 1960s because of the very high demands to the con- trol hardware. Nowadays FPGAs offer unbeatable perfor- mance characteristics. A fully digital FPGA based controller is being proposed here that represents an embedded system on a chip. It is the lower level controller and the outer con- trol loops such as current and speed control loops are not discussed here. The proposed device transforms the control of the SR motor into a DC-like one. The phase switching frequency depends on the voltage assignment and deter- mines the motor speed while the current limitation that is embedded in the power supply module controls the motor torque and hence the power. In the ideal case the commutation of each phase happens in the time frame between the minimum inductance of the coil to its maximum. Because of the self inductance, if the phase switching is made this way, after powering off the coil for a given time the magnetic field will still not be fully dissipated and a negative torque will be generated. This torque is a breaking one and will act when the phase that follows is being powered. To avoid this problem the so called advance angle α is introduced which forces the com- mutation to complete in an earlier time, when the maximum inductance is still not reached. This angle is obtained from the mathematical model built at its core around the equations (1) to (3). The general control principle is illustrated in Fig- ure 4. Figure 4 General overview of the control principle using movement intervals The inductance shape in this figure is idealized and has trapezoid form. It is adopted in the positive direction of rotation the phases to be switched consecutively in the order C-B-A-C and in the negative direction in the order B-C-A-B which can be seen in the shaded areas. With the Δ symbol it is shown the angle of phase overlapping which permits to influence the torque ripples in the direction of decreasing them and thus to reduce the harmful audible noise. With L1m, L2m and L3m are marked the maximum values of the inductance of each phase. They appear as upper limits for each range of rotation. Given some advance angle α these maximum values are being shifted left or right depending on the direction of rotation so that the new values become L1, L2 and L3. All quantities (L1m, L2m, L3m, α and Δ) are transferred to the control algorithm as parameters and give opportunity in some future work they to be adjusted in dy- namic and adaptive fashion. This can be done by the aid of a new external parallel running algorithm without changing the existing controller structure. The generalized block diagram of the digital controller including all the major interconnections between its modules is given in Figure 5. Further in more details will be dis- cussed some of the specifics of the main modules. Figure 5 Generalized block diagram of the controller A The starting algorithm The starting algorithm is a very important module as the A or B B or C C or A L1m range 2 range 3 range 1 L1CW L2CW L3CWL1CCW L2CCW L3CCW L2m L3m Up-Down counter starting algorithm CLK RST pos dev L1 L2 L3 startF startB stop As Bs Cs en normal algorithm CLK RST pos alpha L1 L2 L3 dir en A B Cdelta advance angle control CLK RST dir iL1 iL2 iL3 oL1 oL2 oL3 12 12 12 12 12 param param param 12 A B C m o to r D RST Q D RST Q RST dir fA fB A B RST +/- Q CLK RST pos 12 dir dir dir Quad. decoder en en debounce debounce debounce btn Start Fwd btn Start Bwd btn Stop 12param alpha 12param 12param encoder display FPGA Based Generalized Switched Reluctance Motor Controller, Yassen Gorbounov (2014) 48 starting conditions for running the motor depends entirely on it. In the same time its implementation is not very simple as it works in the most unstable region – that of the lowest speeds and it does not have any prior information about the absolute rotor position. There exist several methods to start the motor. The current implementation solves the task in the following manner: 1. Energizes phase A to hold it in a locked position. 2. Cycles the switching of each phase depending on the signal for the direction of rotation – button “startF” for clockwise or “startB” for counterclockwise direction. 3. Issues an enabling signal for the normal running re- gime algorithm. This happens in such a position when the motor has succeeded to develop sufficient torque and before the desired position for switching off the phase has been reached the control is being transferred to the normal control algorithm which is based on comparing the ranges of rota- tion. This algorithm uses only two of the encoder channels – A and B and does not consider the single pulse C. After issuing the enabling signal (en) the starting algorithm stays in the a3 state and waits to be reset or to receive the stopping signal (stop) after which it can be started again. The control graph of the Moore state machine is shown in Figure 6. Figure 6 Control graph of the staring algorithm If using D-type flip-flops the input equations are shown in (4):       stopaaLposdevposa resetstartBaD stopadevlposLposa aresetstartFaD .. .. ... .. 321.1 01 3322 100     (4) B The normal running mode algorithm Since the advance angle control algorithm is too simple (it just subtracts or adds the advance angle to the limiting val- ues) it will not be discussed here. The normal running mode algorithm is presented in Figure 7. Figure 7 General view of the normal running mode algorithm As is it seen from the figure it consists of three parallel run- ning algorithms namely A1, A2 and A3. Each of them fol- lows strictly the control principle depicted in Figure 4 where A1 is responsible for the “Range 1”, A2 for “Range 2” and A3 for “Range 3” respectively. These algorithms are com- pletely independent one from each other which makes the controller flexible and easily extendable both in terms of phase control – advance angle and overlapping, and phase count – having a proper mathematical model it is not very hard to add another rotational range for a 4-phase SRM for instance. The functioning of A1-A3 algorithms is explained clearly in Figure 8, Figure 9 and Figure 10. Figure 8 Normal running mode algorithm – A1 Figure 9 Normal running mode algorithm – A2 a0 a2 a1 a3 As Bs Cs en  startBstartFreset  resetstartB  resetstartF  stop stop devlposLpos  32 devlposLpos  32 1 Lposdevpos  1 Lposdevpos  A1 A2 A3 advance angle control Limit1 12 12 12 L2 L3 L3 L1 L1 L2 L1 L2 L3 Limit2 Limit3 A B C start en BA, A 0 1 0 1 dir 1 0 B            posposdir pospos LposLposLpos 0 0 00 332 start en AC, C 0 1 0 1 dir 1 0 A            331 133 0 LposLposdirLposposdir LposposdirLposLpos First A. Author, Second B. Author., and Third C. Author / Research Name (2013) 49 Figure 10 Normal running mode algorithm – A3 IV SIMULATION RESULTS AND EXPERIMENTAL WORK To prove the effectiveness of the algorithm and the con- troller there have been conducted thorough tests and analyz- es both via software simulation and practical experiments with a 400W SRM12-8 motor. Due to space constraints only the starting algorithm simulation results will be given. The Verilog code of the starting algorithm is shown in Table 1. It follows strictly the control graph given in Figure 6 and the derived equations (4). TABLE 1 Dataflow Verilog description of the starting algorithm `timescale 1ns / 100ps module Starter(input clk, reset, input [11:0] pos, //the relative current rotor position input [11:0] dev, //deviation - exit position for this algorithm input [11:0] L1, //upper limit of the 'Range2' input [11:0] L2, //upper limit of the 'Range3' input [11:0] L3, //upper limit of the 'Range1' input startF, startB, stop, output As, output Bs, output Cs, output en); // internal wires wire a0, a1, a2, a3; wire q0, q1; wire d0, d1; // states assign a0 = ~q0 & ~q1; assign a1 = q0 & ~q1; assign a2 = ~q0 & q1; assign a3 = q0 & q1; // input equations assign d0 = a0 & startF & ~reset | a1 | a2 & (pos > L2 & pos < L3 - dev) | a3 & ~stop; assign d1 = a0 & startB & ~reset | a1 & (pos > dev & pos < L1) | a2 | a3 & ~stop; // output equations assign As = a0; assign Bs = a2; assign Cs = a1; assign en = a3; // flip-flops D_FF dff0 (.q(q0), .d(d0), .clk(clk), .rst(reset)); D_FF dff1 (.q(q1), .d(d1), .clk(clk), .rst(reset)); endmodule // D-type flip-flop module D_FF (input clk, rst, d, output reg q); always @(posedge clk) if(rst) q <= 1'b0; else q <= d; endmodule The simulation waveforms when running in clockwise and counterclockwise directions are shown in Figure 11 and Figure 12 respectively. The exact position when the enabling signal (en) is issued can be clearly seen in the figures. Figure 11 Starting in forward direction Figure 12 Starting in backward direction Finally the three phase currents waveforms together with the control signal for one phase have been obtained from the real working system. These are shown on the oscillogram in Figure 13 where the motor is running at average speed and in steady state running mode in forward direction. As it can be seen phase C is switched on immediately after phase A is switched off. The asymmetry in the current shape is due to the nonlinear phase inductance. start en  21 LposLpos CB, B 0 1 0 1 dir 1 0 C FPGA Based Generalized Switched Reluctance Motor Controller, Yassen Gorbounov (2014) 50 Figure 13 Running at low speed V CONCLUSION To meet the increasing demands of the contemporary indus- trial applications the electrical drives are required to own qualities such as high speed, low torque ripples, precise positioning, and good dynamics and be ecological and high- ly reliable. These specifics require cutting edge performance of the control electronics especially when it is about the nonlinear control. The operational principles of the switched reluctance motors have been briefly discussed in the paper and a dedicated fully digital embedded SRM controller im- plementation was proposed. Built around the Spartan 3 FPGA it was shown that it is capable of performing fast running parallel algorithms that disqualify most of the CPUs available on the market. Some of the main algorithms of the controller have been discussed making a proposal for highly adaptive architecture that is possible only if using fast digital logic capable of parallelism. The presented approach is suit- able for any kind of 3-phase SRM motors with central geo- metrical symmetry of the phases and it can be easily ex- panded to similar SR motors with greater number of phases. The simulation results of the starting algorithm that proved to be a critically important part of the controller were pre- sented. Finally an extensive experimental work has been done and the oscillogram of the phase currents has been given in the article that proved the efficiency of the pro- posed controller. REFERENCES [1] T. J. E. Miller, Electronic Control of Switched Reluc- tance Machines. Reed Educational and Professional Publishing Ltd, 2001, ISBN 0 7506 50737 [2] R. Krishnan, Switched Reluctance Motor Drives: Mod- eling, Simulation, Analysis, Design, and Applications. Virginia Tech, 2001, CRC Press [3] H. Chen, C. Pavlitov, Large power analysis of switched reluctance machine system for coal mine. Mining Sci- ence and Technology Journal, Vol. 19 No. 5, Elsevier, 2009, ISSN 1674-5264 [4] C. Cossar, L. Kelly, T. J. E. Miller, C. Whitley, C. Max- well, D. Moorhouse, The Design of a Switched Reluc- tance Drive for Aircraft Flight Control Surface Actua- tion. IEE Colloquium on Electric Machines and Sys- tems for the More Electric Aircraft, 1999, London [5] A. Nishimiya, H. Goto, H. Guo, O. Ichinokura, Control of SR motor EV by instantaneous torque control using flux based commutation and phase torque distribution technique. EPE-PEMC 2008, Poznan, Poland [6] B. Shino, G. Dinesh, Design of a Switched Reluctance Motor for Mixer-Grinder Application. ICTT 2010, Col- lege of Engineering, Trivandrum, India [7] P. Lobato, A. Cruz, J. Silva, A. Pires, The Switched Reluctance Generator for Wind Power Conversion. 9th Spanish Portuguese Congress on Electrical Engineering, 2005, Marbella, Spain [8] S. Song, W. Liu, A Comparative Study on Modeling Methods for Switched Reluctance Machines. Computer and Information Science, 2010, Vol. 3, No. 2, ISSN 1913-8989 [9] K. Ohyama, M. N. F. Nashed, K. Aso, H. Fujii, H. Uehara, Design using Finite Element Analysis of Switched Reluctance Motor for Electric Vehicle, Infor- mation and Communication Technologies, ICTTA 2006, Damascus, Syria, ISBN 0-7803-9521-2 [10] C. Pavlitov, Y. Gorbounov, R. Rusinov, A. Alexandrov, K. Hadjov, D. Dontchev, An Approach to Identification of a Class of Switched Reluctance Motors. SPEEDAM 2008, Ischia, Italy, ISBN 978-1-4244-1663-9 [11] V. Trifa, O. Rabulea, Switched reluctance motor phase inductivity approximation using artificial neural net- works. Workshop on variable reluctance electrical ma- chines, 2002, Technical University of Cluj-Napoca [12] F. Kucuk, H. Goto, H. Guo, O. Ichinokura, Fourier series based characterization of switched reluctance motor using runtime data. ICEM 2010, ISBN 978-1- 4244-4174-7 [13] C. Pavlitov, Y. Gorbounov, Tz. Georgiev, Application of artificial neural networks for identification of variable reluctance motors, 16th International Conference on Electrical Drives and Power Electronics, 2007, The High Tatras, Slovak Republic, ISBN 978-80-8073-868- 6 [14] S. Misawa, I. Miki, A Rotor Position Estimation Using Fourier Series of Phase Inductance for Switched Reluc- tance Motor. SPEEDAM 2010, Pisa, Italy, ISBN 978-1- 4244-4986-6 [15] M. Mikhov, A. Avramov, R. Ognyanov, (in Bulgarian) Prospects for application of drives with switched reluc- tance motors, Proceedings of the Union of the Bulgari- an Scientists, 2001, Sofia, Bulgaria, ISSN 1311-2864 [16] D. Silage, Embedded Design Using Programmable Gate Arrays. 2008, ISBN 978-1-58909-486-4, Bookstand First A. Author, Second B. Author., and Third C. Author / Research Name (2013) 51 Publishing [17] www.xilinx.com [18] www.digilentinc.com [19] C. Pavlitov, Electrical Drives with Switched Reluctance Motors, 2005, Technical report, Project no. IF-02- 66/13.12.2005 [20] K. Asghar, Analysis of Switched Reluctance Motor Drives for Reduced Torque Ripple using FPGA based Simulation Technique. Vol.6 No.2 2013, ISSN 2568- 5171, American Journal of Information Sciences [21] A. Krishnamurthy, FPGA Baser Control with High Temperature Switched Reluctance Motor for Improving the Input Power Quality. 2004, University of Kentucky Master's Theses, Paper 246 [22] Y. Gorbounov, Identification and control of a class of switched reluctance motors, 2013, PhD thesis, Faculty of Automation, Technical University of Sofia Yassen Gorbounov. The author received a PhD degree from the Faculty of Automation at Technical University of Sofia, Depart- ment of Electrical Drives Automation in 2013. He is a member of the IEEE, Region 8, the Federation of the Scientific and Engineer- ing Unions in Bulgaria (FNTS) and John Atanasoff Union of Au- tomation and Informatics (UAI). He is an author or co-author of over 20 journal and conference papers and is a co-author of 1 book. His research interests include automatic control of electrical drives, switched reluctance motor and generator control, application of neural networks and fuzzy logic for motor control, parallel pro- cessing algorithms with programmable logic devices.