Intelligent fuzzy sliding mode controller based on FPGA for the speed control of a BLDC motor

Received Jul 8, 2019 Revised Aug 9, 2019 Accepted Oct 22, 2019 Brushless DC (BLDC) motors are one of the most widely used motors for various industrial applications due to their high efficiency, high torque to weight ratio and elimination of mechanical commutator. These motors operate in wide range of speeds and necessitate precise speed control techniques, for their nonlinear model, insenseitive to parameter variations and external disturbances, when used in various sensitive applications. Conventional PI and other existing controllers produce high overshoot and increased rise time and settling time. The performance of BLDC motor is enhanced using a Fuzzy Sliding Mode Controller (FSMC) whose gain is intelligently varied with the help of a Fuzzy Inference System (FIS). For this purpose, a suitable FSMC is designed, simulated and implemented using FPGA. The simulation results are validated using Hardware in the loop (HIL) simulation as well as actual hardware implementation. Great improvement in the transient performance is achieved when compared to chatter free SMC, Fuzzy PI and conventional PI controller.


INTRODUCTION
Brushless DC (BLDC) motors are increasingly gaining importance in various application fields such as aerospace, automotive, medical, industrial and consumer equipment, machine tool drives, fans in HVAC and refrigeration [1].They are much preferred over conventional induction machines due to their lower inertia allowing for faster dynamic response to reference commands, lower maintenance due to the elimination of mechanical commutator and higher efficiency provided by the use of permanent magnets which results in virtually zero rotor losses [2][3]. The BLDC motors are highly preferred over brushed DC motors in high torque to weight ratio applications due to their high power density [4][5]. The replacement of mechanical commutator in conventional DC motors with electronic devices in BLDC motors provides high reliability, but at the cost of precise electronic control mechanism for its smooth functioning.
Proportional-plus-Integral (PI) control technique is the most commonly used method for the speed control of BLDC motors [6]. This control is not capable enough in dealing with system uncertainties such as parameter variation and external disturbances due to its fixed nature of the controller parametersKp and Ki. In order to overcome the above limitations of conventional PI controller, a Fuzzy PI controller is used in which the Kp and Ki are varied intelligently according to the variation of error signal and its rate of change [7]. An optimal PID controller using Genetic Algorithm (GA) based on ISE error criterion results in improved time response [8]. However PI controllers do not work well with nonlinear and complex systems. Adaptive [9],  [10] and sliding mode techniques [11] are control techniques that finds applications in various electric drives and manufacturing industries where high precision control is required, even though they are complex and expensive. Sliding Mode Control (SMC) can handle uncertain and nonlinear systems and is robust against external disturbances and parameter variations [12]. Conventional SMC has been successfully implemented to control drive systems like DC motor and BLDC motor [13]. However, SMC is highly prone to chattering, a phenomenon of high frequency oscillations in the output due to the high frequency switching of the control action. This limitation is overcome using a boundary layer around the sliding surface, by replacing the discontinuous switching function with a continuous form mostly by a saturation function [14] and has been applied for the control of Active Magnetic Bearing [15]. Fuzzy Logic Controller (FLC) [16][17] is capable of handling imprecise and uncertain descion making problems and has been successfully applied to various industrial control systems like Ball and Beam system [18], DC motors [19] and Induction motors [20]. By combining the intelligence of Fuzzy logic with the SMC, the controller gain of SMC can be suitably varied.
An FPGA is a large-scale integrated circuit, for which the hardware configuration can be changed by programming, whereas the Application Specific Integrated Chip (ASIC) like Digital Signal Processor (DSP) are having a predetermined, unchangeable hardware function [21][22]. FPGA is successfully used for the implementation of aircraft control [23], hybrid power system [24] and many more. The complex computation in the Fuzzy SMC using FPGA is preferred due to the fast computational ability, reconfigurable hardware construction, low power consumption, embedded processor and shorter design cycle. This paper presents a variable gain FSMC for the improved speed control of BLDC motor and its simulation, HIL simulation and the hardware implementation using FPGA. Transient and steady state performance of BLDC motor is compared with that of chatter free SMC, Fuzzy PI controller and conventional PI controller. The transient as well as steady state performance are greatly improved when the gain of the SMC is intelligently varied using Fuzzy Logic.

BRUSHLESS DC MOTOR
A BLDC motor is a permanent magnet motor which uses position detectors and inverters to control the speed and current. The simplified equivalent circuit of a BLDC drive system is given in Figure.1. The stator windings A, B, C are energized in a predefined sequence for a particular direction of rotation and reversed for the opposite direction.
Where is the resistance per phase of the stator winding, is the inductance per phase, is the back EMF, and is the phase current of the "A" phase. T is the torque developed, TL is the load torque, J is the moment of inertia and B is the friction coefficient. The parameters of the selected BLDC motor are given in Table 1.

SPEED CONTROL
The speed control of BLDC motor is similar to a separately excited DC motor where the speed is directly proportional to the voltage applied to the motor terminals. In order to get desired speed, this voltage across the motor terminals is varied by applying proper PWM signals of variable duty cycle. Here we design a FSMC and compare its performance with chatter free SMC, Fuzzy PI and conventional PI controller to find its improvement.

Sliding mode control
A Sliding Mode Control (SMC) is a Variable Structure Controller (VSC) where there are several subsystems and switching between these subsystems are done in order to bring the plant states to a user defined sliding surface. The basic control law of the conventional SMC is given as: Where s is the switching function, k is the controller gain constant and sign (ꞏ) is the signum function [14]. The main drawback of conventional SMC is chattering, a phenomenon of high frequency oscillations in the output. This limitation is overcome by replacing the discontinuous signum function by the continuous saturation function and the modified control law is where  is a constant parameter that denotes the boundary layer thickness around the switching surface.
) / (  s sat is a saturation function defined as: s sat ( 7 ) In order to guarantee the trajectories of the system to move toward and stay on the sliding surface from any initial condition, the following condion is to be satisfied: where η is a strictly positive constant which makes the system trajectories meet the sliding surface within a finite time. The transient response of the system is determined by the sliding surface of the SMC if the sliding mode exists. The error between the reference speed and actual speed is given by ( 9 ) where, ω, ωref and e are the actual speed and the desired reference speed and error in speed respectively. The sliding surface s is taken as a function of the tracking error e, its integral  edt and its rate of change e  and is given by Where λ1 and λ2 are surface parameters whose values determine the slope of the sliding surface and one of the conditions for the existence of sliding surface is that the values of these parameters are strictly positive real constants. The values of λ1and λ2 are obtained using trial and error and selected as 8 and 12 respectively, so that the surface always has a positive slope and the switching surface s obeys equation (8).

Fuzzy sliding mode control (FSMC)
Fuzzy Inference System (FIS) has the property of artificial intelligence with a fuzzification unit, decision making unit and defuzzification unit. The fuzzification unit converts the inputs to corresponding fuzzy values by using input membership functions, decision making units generates the fuzzy outputs based on fuzzy rules and defuzzification unit converts it back to the real value using the output membership functions. The centroid method is one the popular method for defuzzification and it is utilized here.
Both SMC and FLC have specific advantages and mode of operations in achieving control under uncertain and imprecise conditions. However there are highly demanding situations where more accurate and precise control schemes are very essential. To address such demands in BLDC motor control, we propose a suitable combination of SMC and FLC in order to achieve improved performance from the existing techniques. With higher values of gain k of SMC, even though the speed of response of the system improves, the chattering also increases simultaneously with it. Hence it is desirable to have high value of gain k during transient states to improve the speed of response and low value during steady states for reducing the chatter effect. In the proposed mode of combination, the value of the constant k in the control law of modified SMC given by equation (6) is varied appropriately by a Fuzzy Inference System.

PI controller and fuzzy pi controller
The control law of a of a PI controller is given by: where u(t) is the control signal(input to the plant), Kp is the proportional gain constant, e(t) is the error signal i.e. difference between the desired input and actual output and Ti is the integral time constant. The characteristic response of the system is affected by each of these coefficients and hence these are accurately tuned to get the desired system performance. The controller is tuned according to the Zeigler-Nichol's algorithm.
Conventional PI controller is stable, efficient, easy to implement and is highly reliable when used for a linear model. But these controllers cannot perform well under the presence of nonlinearities, parameters variations and external disturbances due to its fixed nature of the controller parameters Kp and Ki. Using a Fuzzy PI controller the Kp and Ti are vlues are varied intelligently according to the variation of error signal and its rate of change. The inputs to the fuzzy inference system are the error e and its rate of change e  and the output is Kp here. The fuzzy rule base is formed in such a way that the controller can adapt to changes in the system parameters. Input and output membership functions are shown in Figure 4

HARDWARE IMPLEMENTATION OF CONTROLLER FOR BLDC MOTOR USING FPGA
Field Programmable Gate Array (FPGA) is a semiconductor device that consists of an array or cluster of configurable logic blocks (CLBs) connected through programmable interconnects. FPGAs are an ideal choice for various applications due to their programmable nature of the hardware configuration. The major application areas of FPGA technology such as video and signal processing, telecommunication, embedded and electrical control systems [26]. The size, speed and the number of inputs and outputs of a modern FPGA is more efficient than that of ASIC like DSP processor or microprocessor.
Xilinx System Generator is a DSP design tool developed by Xilinx for the implementation of the Matlab /Simulink systems. This software allows the use of the Simulink design environment for FPGA based system design. The Xilinx System Generator contains Xilinx specific block sets with adders, registers, memories, multipliers, FFTs , filters and similar other application tools that can be used in Simulink environment. The design steps include the placement and synthesis of these blocks in the Xilinx system generator and Simulink environment to generate programming data file for FPGA.

Hardware in the loop simulation
For the testing and validation of the FPGA algorithms, HIL simulation in which the hardware is included in the simulation loop itself, is carried out. For this the control algorithm of FSMC which is implemented using Matlab /Simulink and Xilinx System Generator, is translated to programming language such as Very high speed Hardware description Language(VHDL), and this program is embedded into the FPGA application board. For conducting the HIL simulation, the FPGA board is connected to the computer through J-tag interface and HIL simulation is selected in the system generator token in the Simulink environment. The simulation is then started and the results are observed. In the HIL simulation, the computation of controller part (System generator part) is carried out by the FPGA board and rest of the simulation is accomplished by the computer.

Hardware implementation
The block diagram for the Hardware implementation of speed control using FPGA of BLDC motor is shown in Figure.6. The BLDC motor is supplied through a three phase power MOSFET inverter circuit. The input to the inverter is 24V DC generated from 230 V, 50 Hz AC supply by using a transformer, rectifier and filter. The signals from the hall effect sensors are used for the measurement of speed and for the electronic commutation. The FPGA board generates the firing pulses corresponding to the control action. The firing pulses are applied to a driver circuit, the function of which is to amplify the firing pulses and to give electrical isolation between the FPGA board and the gate of the MOSFETs. The driver circuit uses the TPL 250 opto-coupler IC for the electrical isolation.

Implementation of fuzzy SMC of BLDC motor on FPGA
The control algorithm of FSMC is translated to VHDL and is embedded into the FPGA application board as in the HIL simulation. The Xilinx Virtex 4 FPGA chip is used for the implementation of the controller. The control algorithms within the Virtex 4 block are designed with Xilinx system generator block sets. The inputs to the FPGA are the signals corresponding to the votage generated according to the rotor position of the motor from the Hall Effect sensors. The controller parts is implemented using FPGA and the output of FPGA is used for firing the Power MOSFETs which in turn control the speed of the motor.

RESULTS AND DISCUSSION
The design of FSMC for the speed control of BLDC motor is carried out and its effectiveness is evaluated. FPGA based FSMC is implemented using Virtex 4 FPGA board of Xilinx and the output is compared with that of HIL Simulation and Simulink simulation. Control algorithm using FSMC, modified SMC, Fuzzy PI and PI controller with tuned values of parameters for a 60 W BLDC motor whose parameters are given in Table.1, is simulated. A load torque of 0.16 Nm is applied at 0.08 seconds after starting. Figure. 7 shows the step response of the system using these four controllers for a reference speed of 3000 rpm. The transient as well as steady state performance comparison is given in table 4. It is observed that FSMC has the lowest rise time, peak overshoot and settling time compared to modified SMC, Fuzzy PI and PI controllers. The peak overshoot is completely eliminated with FSMC and modified SMC. Moreover the steady state error is the minimum with FSMC compared to the other selected controllers. The motor exhibits momentary variation in speed when sudden load is applied and is reduced to minimum with FSMC while for others it is considerable.
The rise time is reduced due to the fast action of sliding mode controller. The peak overshoot and settling time are reduced by varying its controller gain appropriately using a fuzzy inference system. Moreover the speed variation while loading is eliminated and this shows the robustness of the FSMC. Figure  8 shows the current waveform in the three phases of the motor. It is observed that the starting current is slightly higher with fuzzy SMC than that with other controllers, but this has negligible effect on the performance as the staring current lasts only for few milliseconds and there is only negligible variation under running condition. The results clearly indicate that the performance is greatly improved when FSMC is used, compared to other three controllers in terms of rise time, overshoot, settling time, fluctuation in speed with sudden load variation. This improvement in the performance characteristics are obtained due to the intelligent variation of the controller gain using a fuzzy inference system.  Figure 7.
Step response with FSMC and other controllers Figure 8. Currentin the three phases Figure. 9 Step Response with hardware, HIL simulatioand simulation Figure 10. Speed vaiation while loading Figure 9 shows the comparison of step response of the FSMC hardware setup with that of HIL simulation and Simulink simulation and Figure.10 is the corresponding speed variation while loading. Comparison of the results of transient and steady state performance is given in table 5. From the results it is found that the rise time and settling time are slightly increased with HIL simulation and actual hardware compared to respective values of Simulink simulation whereas peak overshoot, steady state error and speed variation while loading are compareable in all the three cases. The slight increase in the actual values from the hardware setup is due to the use of fixed point variable in FPGA whereas Simulink simulation uses floating point varibles. 485 motor with PI controller shows large overshoot, high settling time and comparatively large speed variation under loaded condition. The transient as well as steady state performance are improved with Fuzzy PI controller in which the controller parameters are varied using a Fuzzy inference system. A further improvement in the performance characteristics and speed variation with sudden loading is obtained using modified chatter free SMC. FSMC outperforms modified SMC, Fuzzy PI and PI controllers in terms its steady state and transient performance indices. The peak overshoot is completely eliminated and the rise time and settling time are improved when used for the speed control of BLDC motor. The variation in speed of the motor under loaded condition is also reduced when FSMC is applied. The realization of the controller is carried out using FPGA with high computational ability and high speed. The performance of the controller with FPGA is tested with HIL simulation and the actual hardware implementation. The results of actual hardware setup, HIL Simulation and Simulink simulation of FSMC for the speed control BLDC motor are evaluated to identify the controller with best performance. However, the FSMC algorithm becomes more complex and hence suitable for applications where very precise speed control is necessary.