International Journal of Engineering Trends and Technology (IJETT) – Volume 11 Number 3 - May 2014 Implementation of Fuzzy Logic Controller for Speed Control of Motor using VHDL Shri Om Mishra, Shailendra Kumar, Prof.(Dr.) S.H.Saeed M.Tech Student, Jr.Associate Professor, Professor and Head of Department, ECE , Integral University Lucknow Integral Univesity , Dasauli ,Kursi Road , Lucknow-226026,India Abstract— A DC motor relies on the fact that like magnet poles repel and unlike magnetic poles attract each other. A coil of wire with a current running through it generates an electromagnetic field aligned with the center of the coil. These motors are generally controlled using a three phase power semiconductor bridge. The level of performance can be achieved by suitable speed controllers in the motor. Generally speed control is achieved by using proportional-integral (PI) controller in case of permanent magnet motors. Although conventional PI controllers are widely used in the industry due to their ease of implementation and simple control structure, these controllers pose difficulties where there are some control complexity such as nonlinearity, parametric variations and load disturbances. Moreover PI controllers require precise linear mathematical models. But the fuzzy logic controller (FLC) resolves these problems. In this paper I have worked on Fuzzy logic control (FLC) for DC motor control applications due to its advantage like nonlinearity, handling features and independence of plant modeling. I am simulating and synthesizing the FLC model using Xilinx ISE 12.4 and Modelsim 10.2a respectively using VHDL. Implementation of a Fuzzy Logic Controller (FLC) using VHDL for DC motor speed control is presented in this paper. Keywords— Fuzzy Logic Controller (FLC), VHDL, Model Sim . I. INTRODUCTION In recent years, fuzzy control has emerged as a practical alternative to classical control schemes when one is interested in controlling certain time varying, non-linear, and ill-defined processes. Usually Fuzzy controller involves a mathematical description of the relation among inputs to the process, its state variables, and its output. This description is called the model of the system. Fuzzy controllers are used to control consumer products, such as washing machines, video cameras, and rice cookers, as well as industrial processes, such as cement kilns, underground trains, and robots. Fuzzy control is a control method based on fuzzy logic. Fuzzy logic can be described as computing with words rather than numbers and fuzzy control can be described as control with sentences rather than equations. A fuzzy controller can comprise empirical rules that are particularly useful in operator controlled plants [1]. Fuzzy logic controller (FLC) is capable of improving its performance in the control of a nonlinear system whose dynamics are unknown or uncertain. Fuzzy control is similar to the classic closed-loop control approaches but differs in that it substitutes imprecise, symbolic notions for precise numeric measures. The fuzzy controller takes input values from the real world. These crisp input values are mapped to the linguistic values through the membership functions in the ISSN: 2231-5381 fuzzification step. A set of rules that attempt to match the decision making process of the human expert controlling the system is then applied using certain inference mechanisms to determine the output. Finally, the output is mapped into crisp control actions required in practical applications in the defuzzification step [2]. Usually, linguistic variables hold values that are uniformly distributed between 0 and 1, depending on the relevance of a context dependent linguistic term [3].The collection of rules is called a rules base and the rules are in the familiar if-then format and formally the if-side is called the condition and the then-side is called the conclusion. The computer is able to execute the rules and compute a control signal depending on the measured inputs error and change in error. Therefore the rules reflect the strategy that the control signal should be a combination of the reference error and the change in error. Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. The process of fuzzy inference involves membership functions. There are two types of fuzzy inference systems that can be implemented in the fuzzy logic toolbox which are Mamdani-type and Sugeno-type A. .Fuzzification Which converts controller inputs into information that the inference mechanism can easily uses to activate and apply. B. Rule-Base (A set of If-Then rules) which contains a fuzzy logic quantification of the expert’s linguistic description of how to achieve good control. C. Inference Mechanism (Also called an”inference engine” or “fuzzy inference” module), which attempt to match the decision making in interpreting and applying about how best the control the system. D. Defuzzification For the process, it converts the conclusions of the inference mechanism into actual inputs for the process. II INTRODUCTION OF DC MOTOR Everyone recognizes the vital role played by electrical motors in the development of industrial systems. There are five major http://www.ijettjournal.org Page 118 International Journal of Engineering Trends and Technology (IJETT) – Volume 11 Number 3 - May 2014 types of D.C motors in general use, which are the separately excited D.C motor, the shunt D.C motor, the permanent – magnet D.C motor, the series D.C motor and the compound D.C motor. The D.C. machine is the first practical device to convert electrical power into mechanical power, and vice versa. Inherently straightforward operating characteristics, flexible performance and efficiency encouraged the use of D.C. motors in many types of industrial drive application. Most multi-purpose production machines benefit from adjustable speed control, since frequently their speeds must change to optimize the machine process or adapt it to various tasks for improved product quality, production speed [4]. All D.C. drives use power semiconductor devices to convert and control electrical power. A.C/D.C converters serve to obtain variable D.C voltages from a constant A.C voltage and one application is to use the D.C source to drive a D.C motor in variable speed modes [5]. III PROPORTIONAL INTEGRAL DIFFERENTIAL (PID) CONTROLLER Many industrial controllers employ a proportional, integral plus differential PID regulator arrangement that can be fitted to optimize a particular control system. The PID controller can be used in most control loops in an electrical drive. The control action in a PID controller combines proportional, integral and derivative control modes as shown in Fig 1 Integral Differential Process + Summin g A. Fuzzification The first step in designing a fuzzy controller is to decide which state variables represent the system dynamic performance must be taken as the input signal to the controller. Fuzzy logic uses linguistic variables instead of numerical variables. Fuzzy inference is the process of formulating the mapping from taken input to an output using fuzzy logic. Mainly two types of fuzzy inference systems can be implemented in the Fuzzy Logic Mamdani-type and Sugeno-type. B. Defuzzification The reverse of Fuzzification is called Defuzzification. The use of Fuzzy Logic Controller (FLC) produces, required output in a linguistic variable. According to real world requirements, the linguistic variables have to be transformed to crisp output. Centre of gravity method is the best wellknown defuzzification method. Sugeno type of defuzzification method is adopted in this work. V FUZZY LOGIC CONTROL OF THE DC MOTOR The fuzzy logic controller was applied to the speed loop by replacing the classical polarization index (PI) controller. The fuzzy logic controlled motor drive system block diagram is shown in Fig 2 Proportiona l e (t) Error signal The fuzzy logic controller has three main components: 1. Fuzzification 2. Fuzzy inference 3. Defuzzification u (t ) Power supply Fuzzy Logic Controller DC Motor Fig 1 Proportional, Integral plus Differential Arrangement Controller. The proportional, integral, differential PID controller output equation is given as: u(t) = KP e(t) + Ki A/D Converter Vref Sensor + Kd Fig 2: Overall block diagram of speed control of DC motor IV FUZZY LOGIC CONTROLLER Fuzzy logic does not use mathematical equations, it represented by operational laws in linguistics terms. Many systems are too complex to model accurately even with complex mathematical equations; therefore traditional methods become infeasible in these systems. However fuzzy logics linguistic terms provide a feasible method for defining the operational characteristics of such system. Fuzzy logic controller can be considered as a special class of symbolic controller. ISSN: 2231-5381 Graphical representation of the membership functions of input and output variable are shown in Fig 3. , Fig 4 and Fig 5. Fig 3: Membership function of input variable http://www.ijettjournal.org Page 119 International Journal of Engineering Trends and Technology (IJETT) – Volume 11 Number 3 - May 2014 Fig 4: Membership function of input variable ΔE be the linguistic variable for the change of error Δ e U be the linguistic variable for the control output u. The maximum range of motor is +/- 1500 rpm. The possible error range is -750 to 750.The universe of Discourse of change in error is based on the experiment data from the conventional controller which gives the range of error is +/150.Ouput of the controller ranges from +/- 8.Linguistic variables for E , ΔE , U are defined as LE={Negative Big(-750rpm), Negative(-500rpm), Zero(0), Positive(500rpm). Positive Big(750rpm)} LΔE={Negative Big(-150rpm), Negative(-75rpm). Zero(0), Positive(75), Positive(150)} LU={Negative Very Big(-8), Negative Big(-6), Negative(-4), Negative Small(-2), Zero(0), Positive Small(2), Positive(4), Positive Big(6), Positive Very Big(8)} Fig 5: Membership function of output input VI Fuzzy Rule Set Fig 6 shows a block diagram demonstrating the implementation of the FLC in a Speed control of DC motor .In this application, the input interface converts the output of the speed sensor into error and change of error which are used as the two inputs to the FLC. VR 1. If (X1 is NB) and (X2 is NB) then (U is NVB) (1) 2. If (X1 is NB) and (X2 is N) then (U is NB) (1) 3. If (X1 is NB) and (X2 is Z) then (U is N) (1) 4. If (X1 is NB) and (X2 is P) then (U is Ns) (1) 5. If (X1 is NB) and (X2 is PB) then (U is Z) (1) 6. If (X1 is N) and (X2 is NB) then (U is NB) (1) 7. If (X1 is N) and (X2 is N) then (U is N) (1) 8. If (X1 is N) and (X2 is Z) then (U is Ns) (1) 9. If (X1 is N) and (X2 is P) then (U is Z) (1) 10. If (X1 is N) and (X2 is PB) then (U is PS) (1) 11. If (X1 is Z) and (X2 is NB) then (U is N) (1) 12. If (X1 is Z) and (X2 is N) then (U is Ns) (1) 13. If (X1 is Z) and (X2 is Z) then (U is Z) (1) 14. If (X1 is Z) and (X2 is P) then (U is PS) (1) 15. If (X1 is Z) and (X2 is PB) then (U is P) (1) 16. If (X1 is P) and (X2 is NB) then (U is Ns) (1) 17. If (X1 is P) and (X2 is N) then (U is Z) (1) 18. If (X1 is P) and (X2 is Z) then (U is PS) (1) 19. If (X1 is P) and (X2 is P) then (U is P) (1) 20. If (X1 is P) and (X2 is PB) then (U is PB) (1) 21. If (X1 is PB) and (X2 is NB) then (U is Z) (1) 22. If (X1 is PB) and (X2 is N) then (U is PS) (1) 23. If (X1 is PB) and (X2 is Z) then (U is P) (1) 24. If (X1 is PB) and (X2 is P) then (U is PB) (1) 25. If (X1 is PB) and (X2 is PB) then (U is PVB) (1) VII PI-LIKE FUZZY CONTROL At this stage, the control law in (8) is not in fuzzy terms. In order to design a fuzzy controller based on the PI control structure, the following definitions are made: Let E be the linguistic variable for the error e ISSN: 2231-5381 x1 FLC y x2 EF + - - + Z 1 Δ u D C M oto r V dc Rul e bas e Fig 6: Overall block diagram of FLC based control system with Dc motor Another interface converts output into the required value for the plant. The characteristics of the interfacing blocks can be described by the following equations: Input interface: e = VREF - Vdc ; x1=e; x2= x1 - x1z-1 Output interface: Δu=y VIII SIMULATION RESULTS A. Simulation Results Using VHDL In this paper I have implement fuzzy logic controller for speed control of DC motors Here I have checked the input range of voltage reference to get the desired voltage output. There is some another inputs reset and clock. My project will work on positive edge of clock and low reset. If reset is high all output will be zero. Here for the input range (-8 to 0) volt, I am getting output voltage -8 volt shown in fig 7 volt. http://www.ijettjournal.org Page 120 International Journal of Engineering Trends and Technology (IJETT) – Volume 11 Number 3 - May 2014 Fig 9: Main RTL Fig 7: simulation Result for input range ( -8 to 0) volts. Here for the input range (0 to 8) volt, I am getting output voltage 8 volt shown in fig 8 volt. Fig 10: Internal RTL Fig 8: simulation Result for input range ( -8 to 0) volts. B. Synthesis Result Fig 9 shows the RTL of our code, fig 10 shows the internal RTL and fig 11 shows the devices utilized in my work. Fig 11: Device Utilization ISSN: 2231-5381 http://www.ijettjournal.org Page 121 International Journal of Engineering Trends and Technology (IJETT) – Volume 11 Number 3 - May 2014 IX. CONCLUSION In my project, My focus is to develop a Fuzzy Logic Based Controller so as to achieve precision in control. The controller attempts to attain a certain level of human intelligence by utilizing the linguistic variables instead of numerical ones. Its main advantage is that it completely avoids the mathematical computations, which relieves the designer from using cumbersome techniques. All a fuzzy logic controller needs a set of if-then rules and a knowledge base and which can be easily provided by the programmer. The implementation of the fuzzy logic controller is very straight forward by coding each component of the fuzzy inference system in VHDL according to the design specifications. The design of the FLC is highly flexible as the membership functions and rule base can be easily changed with reduced rule techniques. Because of the reduced rule techniques the computation time of the fuzzy controller is reduced and Speed Controlling can be done for multiple motors of same specification. Hence it becomes simpler to implement fuzzy logic for the design of controllers for higher order systems. In my project, I have designed a Fuzzy Logic Controller to be utilized in the speed control on DC motor. The designing has been done with the help of VHDL. This controller takes in crisp inputs, viz. speed error (e) and change in error (∆e) and gives an output called change in control. The output changes according to the rules. These have been verified with the help of Modelsim Simulation 10.2a and for synthesis we have used Xilinx 12.1. X. ACKNOWLEDGEMENT determination in accomplishing this work. I wish to express my deep sense of gratitude and profound thanks to Mr. Shailendra Kumar (Jr.Associate Professor), Integral University, Lucknow for providing me the opportunity to work on this topic under his guidance. The encouragement and support he provided throughout, despite his busy schedule. His feedback, constructive criticism and encouragement were the driving force behind the successful completion of this dissertation. I would also like to offer my thanks to Head of The Department Prof (Dr.) S.H. Saeed, Department of ECE, Integral University for their throughout guidance and support whenever required. I would also grateful to the author and scholars whose work I have referred as a guiding stone in my dissertation. Finally I would like to express my sincere Gratitude to my friends, seniors, parents, family and well wishers for extending help to carry out the dissertation work. REFERENCES [1] Shepherd, W., 1998, "Power Electronics and Motor Control", Cambridge University press, 1’st edition, Book. [2] Yehliang, H., 2005, "A Fuzzy Proportional-Derivative Controller for Engineering Optimization Problems Using an Optimality Criteria Approach", Engineering optimization, IEEE Trans. on Optimization, Vol. 37, No. 6, pp.45 – 55. [3] Sivanandam,S. and Deepa, S., 2007," Introduction to Fuzzy Logic using MATLAB", Springer - Verlag Berlin Heidelberg . [4] Ahmed R., 2007," Fuzzy Logic in Electric Drives", Lubbock Engineering, Howard University, Washington, D.C., USA. [5] Krishna, R.,1992," Criteria For The Comparison of Motor Drive Systems in Motion Control", Proceedings of International Conference on Intelligent Control and Instrumentation, Vol.1, No. 3,pp.127 – 133. First of all I am grateful to God, The most beneficent and merciful who provides me confidence and ISSN: 2231-5381 http://www.ijettjournal.org Page 122