资源描述
Single-chip fuzzy logic controller design and an application on a permanent magnet dc motorSinan PravadaliogluI.M.Y.O., Control Sys. Department, Dokuz Eylu University, Menderes cad, Istasyon sok 5, Buca, 35170 Izmir, TurkeyAbstractThis paper describes a low-cost single-chip PI-type fuzzy logic controller design and an application on a permanent magnet dc motor drive. The presented controller application calculates the duty cycle of the PWM chopper drive and can be used to dcdc converters as well. The self-tuning capability makes the controller robust and all the tasks are carried out by a single chip reducing the cost of the system and so program code optimization is achieved. A simple, but effective algorithm is developed to calculate numerical values instead of linguistic rules. In this way, external memory usage is eliminated. The contribution of this paper is to present the feasibility of a high-performance non-linear fuzzy logic controller which can be implemented by using a general purpose microcontroller without modified fuzzy methods. The developed fuzzy logic controller was simulated in MATLAB/SIMULINK. The theoretical and experimental results indicate that the implemented fuzzy logic controller has a high performance for real-time control over a wide range of operating conditions.Keywords: Dc motor drive; Fuzzy logic controller; Microcontroller; Application; Simulation1. IntroductionIn switch-mode power supplies, the transformation of dc voltage from one level to another level is dcdc conversion and accomplished by using dcdc converter circuits, which offers higher efficiency than linear regulators. They have great importance in many practical electronic systems, including home appliances, computers and communication equipment. They are also widely used in industry, especially in switch-mode dc power supplies and in dc motor drive applications. The dcdc converter accepts an unregulated dc input voltage and produces a controlled dc output at desired voltage level. They can step-up, step-down and invert the input dc voltage and transfer energy from input to output in discrete packets. The one disadvantage of dcdc converters is noise. At every period to charge in discrete packets, it creates noise or ripple. The noise can be minimized using specific control techniques and with convenient component selection. There are well-known control techniques including pulse-width modulation(PWM) where the switch frequency is constant and the duty cycle varies with the load.PWM technique affords high efficiency over a wide load range. In addition, because the switching frequency is fixed, the noise spectrum is relatively narrow, allowing simple low-pass filter techniques to reduce the peak-to-peak voltage ripple. For this same reason, PWM is popular with telecom power supply applications where noise interference is of concern.The most important requirement of a control system for the dcdc converter is to maintain the output voltage constant irrespective of variations in the dc input voltage and the load current. However, load changes affect the output transiently and cause significant deviations from the steady-state level of dc output voltage, which must be controlled to equal a desired level by the control systems. The inherent switching of a dcdc converter results in the circuit components being connected periodically changing configurations, each configuration being described by a set of separate equations. Transient analysis and control system design for a converter is therefore difficult since a number of equations must be solved in sequence. Although the state-space averaging is the most commonly used model to obtain linear transfer functions to solve this problem, it neglects significant parts of non-linear behavior of dcdc converters. Development of non-linear controllers for dcdc converters have gained considerable attention in recent years.A fuzzy logic model based controller is chosen as the non-linear controller for this study. Fuzzy logic control (FLC) has been an important research topic. Despite the lack of concrete theoretical basis many successful applications on FLC were reported and various applications for dcdc converters and electrical drives have been published and can be found in the literature (So et al., 1996, 1995; Mattavelli et al., 1997; Brand setter and Sedlak, 1996; Hyo et al., 2001; Gupta et al., 1997; Zakharov, 1996; Vas, 1998, 1999). FLC has a widespread application on the non-linear and complex systems as well as linear systems due to its capability to control the systems that might not have a transfer function between input and output variables. Experiences show that fuzzy control can yield superior results to those obtained by conventional control algorithms.In the meantime, new fuzzy microcontroller chips are available on the market and are able to execute fuzzy rules very fast with their mask programmed algorithms that have some drawbacks such as restriction in implementing any desired algorithm. Digital signal processing (DSP) integrated circuits (IC) are capable of computing and processing the system variables very quickly with high precision. But most of the DSP circuits are expensive and do not contain peripherals such as analog to digital (A/D) and digital to analog (D/A) circuits for conversion and PWM generator on chip, and need to be added externally. A fuzzy controller application among the others on dcdc converters used a TMS320-DSP and fuzzy controller with an evaluation module plus some external chips. They were an A/D converter for feedback signal evaluation, a D/A converter for converting the calculated quantity into a control output and a PWM chip to generate the appropriate duty cycle for the semiconductor switching elements (So et al., 1995; Brandsetter and Sedlak, 1996). An implementation of an FLC with 8-bit conventional microcontroller is presented in Gupta et al. (1997) for dcdc converters and a modified centroid method for defuzzification process is used to reduce the processing time of 8-bit microcontroller. However, this modified defuzzification technique increases the settling time of the system. A detailed simulation and experimental study on the closed-loop control of dc motor drive with FLC is carried out in Zakharov (1996) and a PC computer with an evaluation board is employed for FLC. The transient response of proportional integral (PI)-type current and speed controllers are compared to that of the FLC.The aim of the study presented in this paper is to design and to implement a high-performance fuzzy tuned PI controller for controlling the rotor speed of permanent magnet dc motor (PMDCM).We also provide a way of designing such a controller in a cost effective way by using a general purpose single chip microcontroller. This design is implemented without making the assumptions for the modification of defuzzification process which was presented in Gupta et al. (1997). This leads to an improved performance of the transient and steady state of the closed-loop system.The experimental results are also compared to the simulation result obtained from MATLAB/SIMULINK.2. Permanent magnet dc motor and class C chopperA PMDCM fed via class C chopper can be described by the state-space form in the continuous time as follows:where Ra is armature resistance (Ohm), La is armature inductance (Henry), Ka is back electromotive force and torque constant (V/rad/s or Nm/A), J is total moment of inertia (kgm2) and Bv is viscous friction constant (N m/rad/s). Va(T) represents the voltage applied to armature by a class C type of chopper given in Fig. 1.The average value of armature voltage is a function of ton, period of chopping and the level of dc input voltage as shown in Fig. 2.In analog control systems, the repetitive sawtooth waveform is compared with the control voltage to generate the PWM gate signals to the MOSFETs employed in the chopper. The duty cycle is equal to the ratio between control voltage (Ec) and the peak of sawtooth. The control voltage signal is generally obtained amplifying the difference between the actual output voltage and its desired value. Simple controls can be carried out using analog IC, such as operational amplifier circuits but sophisticated control tasks usually involves the using of digital ICs, microcontrollers or DSPs to support high-performance, repetitive, numerically intensive tasks. Building a closed-loop control system, the actual output voltage can be sensed by a tacho generator which produces an output voltage proportional to armature rotation. Development and application of FLC in electrical drives have drawn greater attention in recent years (Vas, 1998, 1999).3. Fuzzy controller Conventional controllers are derived from control theory techniques based on mathematical models of the process. They are characterized with design procedures and usually have simple structures. They yield satisfying results and are widely used in industry. However, in a number of cases, such as those, when parameter variations take place, or when disturbances are present, or when there is no simple mathematical model, fuzzy logic based control systems have shown superior performance to those obtained by conventional control algorithms.Fuzzy control is a method based on fuzzy logic. L.A. Zadeh s pioneering work in 1965, and his seminal paper in 1973 on fuzzy algorithms introduced the idea of formulating the control algorithm by logical rules. On the basis of the ideas proposed in this paper, Mamdani developed the first fuzzy control model in 1981. This then led to the industrial applications of fuzzy control.Fuzzy control can be described simply as “control with sentences rather than equations” (Jan Jantsen, 1998). It provides an algorithm to convert a linguistic control strategybased on expert knowledgeinto an automatic control strategy. The essential part of a fuzzy controller is a set of linguistic rules which is called rule base,1. If error is Negative and change in error is Negative then output is Negative Big.2. If error is Negative and change in error is Zero then output is Negative Medium.The fuzzy rules are in the familiar ifthen format and the “if side” is called the antecedent and the “then side”is called the consequent. The antecedents and the consequents of these ifthen rules are associated with fuzzy concepts (linguistic terms), and they are often called fuzzy conditional statements. A fuzzy control rule is a fuzzy conditional statement in which the antecedent is a condition and the consequent is a control action.The fuzzy controller should execute the rules and compute a control signal depending on the measured inputs or conditions. There is no design procedure in fuzzy control such as root-locus design, pole placement design, frequency response design, orstability design because the rules are often non-linear and close to the real world. Non-linearity is handled by rules , membership functions and the inference process.Described fuzzy logic model based on non-linear controller is developed and tested on real-time feedback control for the rotor speed of PMDCM. The speed feedback and fuzzy control algorithm block diagram are given in Fig. 3. The tacho-generator measures the actual rotor speed supplying input to the on-chip A/D converter. At the beginning of every kth switching cycle, the reference rotor speed wref is compared with the actual rotor speed wact. The error (e(k) and change of error (ce(k) values of rotor speed are the inputs of the fuzzy control algorithm, which are defined asThe microcontroller calculates these inputs right after conversion from on-chip A/D converter. The fuzzy control algorithm is divided into three modules:(1) fuzzification, (2) decision-making or inference, (3) defuzzification.In the fuzzification module, the error and change of error signals are evaluated by fuzzy singletons and their numerical values are converted into seven linguistic variables or subsets: PB (Positive Big), PM (Positive Medium), PS (Positive Small), ZE (Zero), NB (Negative Big), NM (Negative Medium) and NS (Negative Small). The fuzzification module calculates the degree of membership of every linguistic variable for given real values of error and change of error. The triangular shapes as given in Fig. 4a are used for smooth operation on membership functions.The calculated values of fuzzy variables are used in the decision-making process. Decision-making is inferring from control rules and linguistic variable definitions. There are seven sets for the error and seven sets for the change of error, and thustotal 49 rules taking place for the whole control surface which are given in compact form in Table 1. This rule table can reflect experiences of the human experts. For each error and change of error, there are two overlapping memberships; therefore, all linguistic variables except two has zero membership. Each two overlapping memberships of error and change of error will create four combinations as inference results. The maximum of these four inference results will have two parts, namely, the weighting factor wi and the degree of change of duty cycle yi. The min fuzzy implication rule of Mamdani is used to obtain the weighting factorwhich gives the membership degree of every relation (Lee, 1990). The inferred output ui of each rule isHere, yi represents the centroid of membership function defining the ith rule output variable and can be stored in a look-up table for quick acquisition. Membership functions for change of output of FLC, which is the duty cycle for this application, is shown in Fig. 5.According to the membership functions of the input, the output variables and the rule table, respectively, in Figs. 4a, 5 and Table 1, the control surface representation is shown in Fig. 6.In defuzzification module, a crisp value for output is performed. Although the defuzzification process has many methods, the weighted average method is employed for this application because the operation of this method is computationally quite simple and takes less time in the computation process of microcontroller (Bart Kosko, 1991; Ross, 1995). The output of defuzzification module can be represented byThe inferred output results and the weighing factors from each of the four rules are used in the equation given above to obtain a crisp value for the change of duty cycle. It is obvious that this calculation is the most time-consuming part of FLC and has computational complexity. The microcontroller output is the PWM duty cycle and defined asd(k)=d(k-1)+d(k) (7)5. Hardware and software designsThe hardware setup for the proposed fuzzy logic algorithm was implemented in assembly programming, using 8-bit RISC (Reduced Instruction Set Computing) core microcontroller AT90S8535. A schematic diagram of the FLC with one of the Insulated Gate Bipolar Transistor (IGBT) drive circuits of Class C chopper is shown in Fig. 9. The microcontroller has 8K bytes of programmable flash memory, 512 bytes of internal random access memory, 8 channel 10 bit ADC, 10 bit PWM output, 16 different interrupt sources, an analog comparator, 32 programmable I/O lines, a bi-directional serial interface and has the ability to execute assembler instructions in a single clock cycle. The processing speed is one million instructions per megahertz crystal (Atmel Corporation).Fig9. Schematic diagram of the FLCThe universe of discourse for error and change of error are extended from -1024 to +1024 and the grades of each membership function (01) are also extended from 0 to 1024. In order to classify the fuzzy controller inputs, e(k) and ce(k), into seven fuzzy sets and to determine their memberships, 10 bit mathematical routines are used. Therefore, processing the on-chip 10 bit A/D converter sampling values and setting up the on-chip 10 bit PWM output for semiconductor switches are directly achieved. As a result, the total system resolution is extended to 1/1024 instead of 1/256 and better performance is obtained.The symmetrical and 50% overlapped triangular membership functions of and simplify the calculations and its negative side is a reflection of the positive. The fuzzy subset linguistic rule table given in Table 1 is changed to integer numbers in order to suit assembly programming. A simple but effective algorithm is designed for the appropriate numerical values of converted linguistic rules. This is realized with the following equation according to calculated error values. The most important difference between the present paper and the papers cited in the references, is the developed algorithm for fast calculation.6. ResultsAnother identical machine was coupled to the motor via their shafts and operated as a generator for loading. Two different loading conditions were applied on the motor. In the first loading condition, the generator terminals were closed to the resistive load of 2O and, the rotor speed and armature current variations in time during this loading case were recorded. These results are given in Fig. 11a (Upper trace: 1 V/div., Lower trace: 0.2 V/div. and 100 mV/A. Time base: 200 ms/div.). In the second loading condition, the resistance of 2O was connected to the generator terminals while the rotor is running at reference speed. After the transients were damped out, the resistor was disconnected. The variations of actual rotor speed and generator output current during this case were recorded and are given in Fig. 11b (Upper trace: 1 V/div., Lower trace: 0.2 V/div. and 100 mV/A, Time base: 500 ms/div.). It can be observed from the waveforms that the fuzzy logic controller responds to the step change on the load properly and brings the actual rotor speed back to the reference speed.7. ConclusionFuzzy logic controller is implemented without modified methods by using a general purpose low-cost microcontroller for the speed control of a PMDCM. All the tasks are carried out by a single chip reducing the cost of the system and program code optimization is achieved with developed effective algorithm. In our approach, the software-based decision table is used and only simple computations required in the on-line control of an FLC; therefore, higher sampling rate can be realized more easily when comparing with other type of control schemes. The developed fuzzy logic controller was simulated in MATLAB/SIMULINK. Simulation and experimental results are compared in order to show the response of the FLC under loading conditions. It can be found that the experimental results are very close to the simulation results. The rise and settling times are reasonably smaller and there is no significant overshoot on the experimental results. The effect of saturation is not included into the motor and generator models; therefore, the simulation results deviate from the experimental results within a small percentage during loading transients. The experiments indicate that the implemented fuzzy controller has a high performance for real time control over a wide range of operating conditions.单片机模糊逻辑控制器设计及其在永磁直流电机的应用Sinan PravadaliogluI.M.Y.O., 控制系统学院, Dokuz Eylu大学, Menderes cad, 伊斯坦布尔sok 5, Buca, 35170伊兹密尔, 土耳其摘要论文描述了一种低成本单片机PI型模糊逻辑控制器设计及其在永磁直流电机的应用。该控制器计算脉宽调制断路驱动器的占空因数,也可以用于直流-直流转换器。自调谐能力使该控制器具有活力,所有的任务都是通过一个单片机来实现,这样既缩减了系统的成本,也可以达到程序代码最优化。一个简单却有效的算法被开发用于数值计算来代替语言规则。这样,可以省去外部存储器。论文的贡献在于呈现一种高性能非线性模糊逻辑控制器,使用没有修正的模糊算法的一般用途微控制器来实现的可行性。开发的模糊逻辑控制器在MATLAB/SIMULINK中进行过仿真。理论和实验结果表明,该模糊逻辑控制器在很宽的工作条件范围内的实时控制具有很高的性能。关键字:直流电机驱动;模糊逻辑控制器;微控制器;应用;仿真1 引言在开关电源中,直流电压从一级到另一级的转变就是直流-直流转换,使用直流-直流转换电路来实现要比线性调节器具有更高的效率。它们在许多实际电子系统中有很大的重要性,包括家用器具、电脑和通信设备。它们在工业中也有广泛的应用,尤其在开关直流电源和直流电机应用中。直流-直流转换器可以输入非标准的直流电压,并输出所需电压级别的可控直流电压。它们可以逐步增加和下降,并能以离散包的形式将能量从输入转移到输出。直流-直流转换器的一个缺点是噪声。在生成离散包的每个阶段都会产生噪声或波纹。可以利用特殊的控制技术和便利的部
展开阅读全文