Fuzzy Logic Applied to Motor Control
Authorised By SANTOSH BHARADWAJ REDDY Email: email@example.com Engineeringpapers.blogspot.com
More Papers and Presentations available on above site
AbstractToday, home appliance applications require more and more features such as motor speed adaptations to multipurpose accessories, user-friendly interfaces, and security features. Such new requirements can be achieved through a low-end microcontroller-based electronic control using the fuzzy logic approach. Now a days, most of fuzzy logic-based controls are only limited to a complicated ranking management of user interfaces, sensors, and actuators, corresponding to slow software speed operation. This paper proposes a totally different use of fuzzy logic. In this case, fuzzy logic is implemented in a standard micro controller to regulate the speed of a universal motor by a real time adjustment (every 30ms) of the motor current. This microcontroller directly tunes the motor current by means of a chopper converter. Starting from a basic food processor application, the paper
practically shows how a fuzzy logic approach can be applied to build a closed speed regulation loop from a very low cost tacho-generator. Practical guidelines are successively given from the initial concept analysis phase, up to the final generation of the executable code to be loaded in the microcontroller. The paper also gives the practical procedure to define the input parameters and to build fuzzy logic rules when using the fuzzy logic development tool. Finally, the major benefits of this paper lie in an original approach where fuzzy logic is applied to fast “real-time” regulation loop without requiring any specific expertise in conventional methods of regulation. 1. INTRODUCTION Today in Europe, the trend in home appliance is to have more and more features offering friendly use of and appliances minimizing energy consumption. Low-end micro controller associated to fuzzy logic software are used inside different equipment: for instance to optimize the charge of batteries; to minimize water and energy consumption in washing machines; to regulate temperature in air conditioning systems and refrigerators; and to manage the simple requirements of user interfaces, sensors, and actuators. These fuzzy logicbased controls correspond to slow software speed operation. The block diagram for the fuzzy logic associated with the process is shown in fig.
Fuzzy logic can be used in a very different way: fuzzy logic software associated with a standard low-end micro controller can handle real time application and control the speed of a universal motor by a real-time adjustment of the motor voltage. To perform this speed regulation, we need to get some knowledge about the motor behavior, then, design and optimize the regulation loop by using a fuzzy logic. Finally, we need to test the motor behavior with a food-processor. 2. WHY CONTROL MOTOR SPEED? Most motors used in food-processors are universal motors (brush motors with serial excitation). These motors can operate from alternate current or from direct current.
The stator windings of such a motor are connected in series with the rotor. The flux is proportional to the motor current and the motor torque is proportional to the square of the current. Therefore the motor speed is largely sensitive to torque variations as shown in Fig. 1. To keep the motor speed stable upon load variations, bringing a more comfortable use of the food processor and improving cooking mixture, control of motor speed is now implemented in new generations of food processors. To maintain the motor speed as the load varies, the application must control the voltage applied to the motor by either “phase angle modulation” techniques or “pulse width modulation” (PWM) techniques. 3. PRACTICAL PPLICATION Fig. 2 describes the topology of the motor speed control application. The 400-W universal motor of the food processor is supplied in dc mode. This voltage is
adjusted using PWM techniques through a chopper stage composed of an insulated gate bipolar transistor (IBGT) STGPlONSO and a freewheeling diode STTA806DI. A standard microcontroller, the ST6265.With its on-board PWM timer and A/D converter, measures the speed of the motor and drives the IGBT through a 5/15 V interface. In addition, the microcontroller manages tasks such as minimum mains voltage detection, tachogenerator voltage measurement, fuzzy logic speed control, PWM duty cycle generation, and motor speed selection. A low-cost tachogenerator (made by a disk with teeth running in front of a permanent magnet inside a coil) is available in the food-processor to measure the motor speed. This speed can be measured by means of the following:the tachogenerator frequency and the microcontroller timer; the tachogenerator voltage and the microcontroller Analog to Digital (A/D) converter.
the A/D converter, i.e., 5 V). The tacho generator signal is amplified, filtered and then converted to a dc voltage by means of a simple frequency/voltage converter. This approach avoids timer and prescaler programming changes and motor speed calculation due to the large amplitude of the speed variations. The speed measurement is done periodically and synchronized by an on-chip timer acting as a time base. This time base is defined taking into account the duration of the execution of the fuzzy rules. For the ST6 microcontroller family and for the number of rules and fuzzy variables defined in this application, this duration is in the range of 12 to 15 ms. However, to let the microcontroller concurrently manage other tasks, such as motor speed selection and transmitting the real time motor speed data measurements, the duration of the synchronization time base has been fixed to 30 ms. A. Description of Food-Processor Motor The universal motor used in this application has a speed ranging up to 22000 r/min (i.e., 366 Hz). The gear ratio between motor speed and accessory speed is equal to 7.5. The ratio between tachogenerator frequency and motor frequency is equal to 16. One of the advantages of using fuzzy logic for such an application is to overcome the need for a precise mathematical model of the system. Nevertheless, the system behavior has to be known and this knowledge can be acquired with some simple experimental graphs. Open loop motor speed versus PWM duty cycle and
One simple way to measure speed is to use the A/D converter (the maximum speed of the motor corresponding to the full scale of
tachogenerator voltage versus motor speed are shown in following Figs. 3 and 4. The motor speed versus PWM duty cycle curve gives the system sensitivity: 1% of PWM duty cycle variation gives a speed variation of 10 rotations per second for an unloaded motor at low speed, 2.5 rotations per second for a loaded motor. The tachogenerator voltage versus motor speed curve gives the system resolution. Maximum speed of motor being coded by the 8-bit A/D converter, the speed measurement resolution is 3 rotations per second. B. Input/Output Variables Definition The input variables of the fuzzy logic controller, estimating the motor speed variations, are the speed error € and the speed error variations ∆€: ―The speed error € equals the measured speed minus the targeted speed € = V tacho − V. Its range of variation is defined by the maximum speed of motor, i.e., [-300 Hz, +300 Hz]. ―The speed error variation ∆€, estimating the motor speed evolution, equals, at sampling time (30 ms), measured speed minus previously measured speed, ∆€= V tacho (n) − V tacho (n - 1). The output variable is the PWM duty cycle variation, ∆δ, calculated by the fuzzy inference kernel. The PWM duty cycle is then calculated by the microcontroller: ∆δ %( n) =∆δ %( n - 1) + ∆δ and applied to the IGBT gate each 30ms, fine tuning the motor speed. This PWM output signal, automatically generated by the micro-controller PWM timer, ranges from 0% to 100% with a resolution of 0.4% (full range of the PWM duty cycle is coded from 0 to 255). IV. FUZZYL OGIC A PPROACH The fuzzy logic approach is used to develop this application covers all the steps of a fuzzy logic design from the definition of the project, of the linguistic variables and of the rules. Furthermore, this tool generates the executable code for the ST6 microcontroller. Fig. 6, giving the program flow chart, shows a fuzzy logic development can be divided in two main parts:
The microcontroller environment program and the fuzzy logic application itself. −The environment program consists of microcontroller initialization, motor speed acquisition, calculation of speed error and speed error variation, input variable adaptation to fuzzy logic kernel code values, fuzzy logic kernel calling, PWM duty cycle update, acquisition of new motor speed command, and end of synchronization time base waiting. −The fuzzy logic part consists of ST6 executable code generated by the development tool. This part is made of the fuzzification of the input variables, execution of the activated rules, and defuzzification producing the output variable. A. Project Definition The first step when using the fuzzy logic is to define the structure of the controller. Fig. 7displays the controller structure and allows the designer to directly access linguistic variables and rule definitions. B. Linguistic Variables Definition The next step of the controller design is the definition of linguistic variables. The graphic interface of the development tool allows the designer to easily create the most suitable linguistic variables and the membership functions for the application. The input membership functions shown in Fig. 8 are defined taking into account the speed and the acceleration of the motor and the system resolution. The motor speed
range is well covered with five membership functions. According to the sensibility of the speed measurement line and to the speed sampling rate, (3 rotations/s each 30 ms corresponds to an acceleration of 100 rotations/s), the motor speed variation range is described with three membership functions. The triangular shaped (“PiType”) membership functions “Zero” and “Null” make the PWM duty cycle variations less sensitive to the A/D converter resolution. During the definition of linguistic variables, the development tool allows the user to define two representations for the variables: the “shell value” and the “code value.” The shell values are the real-word value that the variables represent. They are only used to display actual data with the tool. The code values are the 8-bit internal values that the microcontroller uses to calculate results and range from 0 to 255 (8bit representation). Having the same scale for the code value and the shell value gives a better understanding of the control behavior by directly comparing the real fuzzy input/output to the linguistic variables.
Working with variations of input variables, which can have negative values, an adaptation of real variables to fuzzy kernel input has to be done to code the whole range of the input variables within the range [0, 255].The motor speed representation (given by the A/D converter) can vary from 0 to 255, so the speed error and the speed error variation range from -255 to +255. This variation is coded within the range [0,255] by dividing by 2 the input variables and adding 127 (07Fh) to normalize the value. As the PWM duty cycle variation is computed using the centre of gravity method, the output linguistic variable can be represented with lines instead of the triangular shape as shown in Fig. 9. The PWM Var code value has been reduced to the range [0, 24] producing each 30 ms a maximum duty cycle variation of
+ 5% with a resolution of 0.4% directly compatible with the PWM resolution generated by the ST6. This avoids additional calculation when adding the PWM duty cycle variation + ∆δ (%) to the current PWM duty cycle δ (%).
C. Rule Definition Fig. 10 shows the fuzzy controller rules. They have been defined by the understanding of the behavior of the system. One can find rules maintaining speed error near zero (steady state rules), rules that avoid motor speed overshoot and rules that provide rapid response to large error resulting from command change. Fig. 10 shows the fuzzy controller rules. They have been defined by the understanding of the behavior of the system and one can find rules maintaining speed error near zero (steady-state rules); rules avoiding motor speed overshoot and rules providing rapid response to large error due to command change. The fuzzy development tool with its spreadsheet rule editor (Fig. 10) offers an easy way to examine and define the suite of rules. It also permits the definition of rule aggregation (MIN and MAX operators are available) and rule composition (PROD operator with degree of support of 0 or 1). For the food-processor motor, the suite of rules uses the min operator to smooth the
reactions of the output variable when the application executes several rules. The degree of support for all rules has been fixed to 1. D. System Behavior Optimization The fuzzy development tool provides offline mechanisms to debug, test, and optimize the rules and membership function definition in open loop: -The interactive debug mode offers a graphical verification of every design step even while the design is being performed. -The batch mode associated with a pattern generator records the output variables versus each of the input variables for testing and evaluating the design performance. ∆€ −> € down) NB NS ZERO PS PB NS PB PM PM ZERO NM NULL PB PM ZERO NM NB PS PM PM NM NM NB
variations of the output variable are consistent with the system. Optimizing the system behavior is easily and quickly achieved by using the development tool associated with the realtime test: −Changing the regulation algorithm is achieved by changing the set of rules. −Tuning the system behavior is achieved by modifying the membership function definition. Then the executable code for the microcontroller is automatically generated by the tool. V. PRACTICAL RESULTS Recordings of tachogenerator voltage (corresponding to the motor speed) and PWM duty cycles while the motor is running are given in the following figures. Fig. 11 shows the speed step response when the motor is not loaded. (Corresponding to the motor speed) and PW speed in 1.3 s corresponding to the execution of about 40 fuzzy logic loops. No overshoot of the motor speed has been observed. In steady state, we can notice motor speed fluctuations of +3rotations/s. These fast fluctuations (30 ms) are due to the resolution limit of the speed measurement line (tacho generator and A/D converter) and remain inaudible. Fig. 12 shows the load step response of the motor. The motor is permanently loaded with 200-W, 40-W, and 110-W load variations are applied. Upon these load variations, the motor recovered the targeted
Fig 10.Fuzzy inference rule table Using these features, designer can verify that all the defined rules are necessary, that no important rules are missing and that the
speed within less than 1s without any speed overshoot.
logic has avoided needing the knowledge of a precise mathematical model of the regulation loop system. Associated with the fuzzy logic development tool, fuzzy logic allows a designer to develop, test, and optimize a regulation loop quickly: this motor control has been done in few weeks. In addition to a food-processor, this motor control, implemented using a ST6265 microcontroller running a fuzzy logic software, gives good results for home appliances such as drills and washing machines. Improvements can be achieved by increasing the sensitivity of the speed error variation or by adding a 3rd parameter giving an image of the motor load to adapt the PWM variation to the motor speed. Adapting this application to a universal motor driven in ac mode with a triac can be easily done by only changing the fuzzy logic output variable. REFERENCES  George J.klir and Tina A.folger, “Fuzzy Sets, uncertainity, and information”.  John Yen Rezalangari, “Fuzzy logic: Intelligence, control and information”.  H-J.Zimmermann, Fuzzy Set Theoryand it’s Applications, 2nd rev ed.Dordrecht-Boston: Kluwer.
. VI. CONCLUSION Starting from a basic food-processor application, the paper describes how a fuzzy logic approach is especially powerful in a home appliance to help a designer having an analog background or without regulation techniques background to develop a microcontroller-based control. Using fuzzy