Design of DSP-based engine controller using fuzzy logic

Publisher:温暖微风Latest update time:2010-01-24 Source: 慧聪网Keywords:DSP Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

More and more companies are using variable speed drive engines to reduce energy consumption. This requires simplifying the design, shortening development time, and eliminating complex mathematical formulas by moving from differential (PID) controllers to systems based on fuzzy logic algorithms.

However, this presents new challenges for the motor. Controlling the speed of a brushless DC (BLDC) motor is complex when using traditional integral and differential (PID) controllers because they rely on complex mathematical models and are computationally intensive. Using fuzzy logic (FL) algorithms can eliminate the design process's reliance on complex mathematical formulas and provide an easy-to-understand solution. Another advantage of fuzzy logic (FL) engine control over (PID) differential controllers is that the development cycle is shorter. This article discusses the process of using fuzzy logic algorithms to control brushless DC motors using the Texas Instruments c28xx fixed-point DSP series.

Development of brushless DC motor control model

Before a fuzzy logic (FL) engine can be built, we must first build a model as a basis for the design. A fuzzy logic controller uses heuristic knowledge and uses a language to describe the model to express its design. Rather than developing a model from scratch, we will use the PID controller model as a starting point. Once developed and implemented, the fuzzy logic controller will be improved by adjusting its parameters.

Generally speaking, there are three design steps to develop a fuzzy logic BLDC controller:

1. Define the operating range of the input and output controllers.

2. Define the functions and rules of fuzzy membership sets.

3. Adjust the engine.

The first step is to define the model-dependent inputs and outputs. The input is the error (E), which is the current error between the set speed (SS) and the current speed (CS); the other input is the change in error (CE), which is the difference between the current error and the previously calculated error (PE). The output is the change in armature voltage (CV), which is the difference between the existing armature voltage (CAV) and the previously stored value of the armature voltage (PAV). The resulting model equation is as follows:

E=SS-CS

CE=E-PE

CV=CAV-PAV

The unit of the engine speed is revolutions per minute (RPM), and E determines the degree of approach to the target speed. Therefore, when E>0, the engine speed is lower than the set speed; when E<0, the motor speed exceeds the set speed. CE determines the adjustment direction of the controller. CE is positive if and only if (iff) the current rotation speed is lower than the set speed; CE is negative if and only if the current rotation speed is greater than the set speed. When approaching the set speed, CE will adjust back and forth between positive and negative values. CV is the supply voltage of the armature. This voltage is expressed as the pulse width modulation (PWM) duty cycle.

The next step is to define the membership functions, variables and rules for the fuzzy sets. In order for this to work, the non-fuzzy (crisp) inputs and outputs must be converted to fuzzy ones. The conversion is done by using linguistic variables to represent the input and output ranges. These are also called fuzzy variables. Fuzzy variables are used to partition the range of membership values ​​for the membership functions. For example, five variables are used to map the inputs and outputs, which are medium negative (NM), small negative (NS), zero (z), small positive (PS), medium positive (PM).

It is not a mathematical formula, fuzzy controller uses fuzzy rules to make a decision and produce an output. Fuzzy rules are described in the form of IF-THEN statements. Fuzzy rules determine the behavior of the system instead of complex mathematical equations. For example, if the error (E) is equal to a medium negative value (NM) and the change in error (CE) is equal to a small positive value (PS), then the change in armature voltage (CV) is equal to a small negative value (NS). The number of rules used is set based on the designer's experience and knowledge of the system. Therefore, the number of rules used in our system is 25.

In order to activate the armature, the CV fuzzy output must be converted back to a sharp output. This process is called defuzzification. A popular defuzzification method is called the centroid method.

The final step of the design is to tune the membership functions and rules. This phase is also called the optimization phase. Optimization is used to improve the performance of the fuzzy controller. Once the design is complete, the controller is ready for implementation.

The implementation of the fuzzy logic controller is composed of three modules. They are fuzzification, rule deployment and defuzzification. The following sections discuss the implementation of the fuzzy logic BLDC motor related modules.

Fuzzification

Fuzzification is the process of converting data with clear numerical values ​​into fuzzy data. The resulting fuzzy data is converted based on the fuzzy membership of the input variables. For this application, the motor control input variables are the rotation error (Error) and the rotation error difference (Cerror). The rotation error (Error) is the absolute rotation speed difference from one sampling time to the next sampling time. Similarly, the rotation error difference (Cerror) is the change in rotation error between one sampling time and the next sampling time. The formula is as follows:

Rotation error (Error) = SetSpeed ​​(set speed) - CurrentSpeed ​​(current speed)

Rotation error difference (Cerror) = rotation error (Error) - Previous Error (previous error)

As mentioned earlier, five member sets are defined for the rotation error (Error) variable and the rotation error difference (Cerror) variable:

1. NM: Medium Negative
2. NS: Slightly Negative
3. ZE: Zero
4. PS: Slightly Positive
5. PM: Medium Positive

Figure 1 shows five sets of members defined for the rotation error (Error) variable and the rotation error difference (Cerror) variable. These sets are triangularly overlapped to provide a good response. Each set has a maximum value of 0×1AAA.

Five member sets [page]

The fuzzification of the input variables produces a vector consisting of five components, which correspond to the medium negative value, small negative value, zero, small positive value, and medium positive value of the fuzzified membership set. The value of the Y axis corresponding to each component represents the membership of the explicit input value. The vector contains the rotation error (Error) and the rotation error difference (Cerror). The fuzzified values ​​are represented as arrays ×1[] and X2[].

Figures 2 and 3 graphically show the rotation error [Error) and the rotation error difference (Cerror) fuzzy values.

Rotation Error

Fuzzy Inference Rules

Fuzzy inference rules operate on fuzzified data to determine the behavior of the system. Specifically, the fuzzified data is applied against the rule table. In terms of language, this is the comparison of the input data Error, Cerror with the rule table. The rule table contains the member sets NM, NS, ZE, PS, and PM, and operates according to the control surface. The output is a valid "inferred" or "given" rule. The description of the inference process is shown in the following pseudo code listing:

Pseudocode listing

Defuzzification

Defuzzification is the process of converting fuzzy data into crisp data. For the purpose of this application, the defuzzified value determines the duty cycle of the PWM signal used to drive the motor. The duty cycle is determined by using a modified centroid calculation function. The defuzzification method used here is to multiply the centroid calculation function by a coefficient. The modified calculation is also called the centroid calculation function. [page]

The calculation formula of the centroid is:

Defuzzified VaLue=∑-Y[i]XmultCoeff[l]/∑Y[i]

The i in Y[i] is the output vector element, which is the coefficient by which the output member set of multCoeff[i] should be multiplied. i can be 1 to 5. The result of the formula calculation is the defuzzified result.

FIG. 4 graphically shows the output member set used by the application with the coefficients [-0x10, -0x8, 0x0, 0x8, 0x10].

The set of output members used by this application

Assume that y[] = [0x0, 0x13F, 0x196A, 0x0, 0x0], then the defuzzified output value is as follows:

Defuz=0×(-16)+319×(-8)+6506×(0)+0×(8)+0×(16)/0+319+6506+0+0=-2552/6825=” -0.37391

FIG5 shows the calculation result of the centroid of the output vector y[].

Hardware Description

The eZDSP2812 board is used in this motor control application. The core of the eZdsp board is the TMS320F2812 digital signal processor. The board uses timer T1, a 20kHz clock, to generate the signals for PWM1-6, and uses timer T2 to execute the interrupt service routine (ISR). In addition, the input capture pins CAP1-3 are used to collect high-speed data from the Hall Effect sensor .

The motor is driven by PWM signals generated by the DSP. These six PWM signals are used as sources for the three-phase power converter. The power converter converts these six signals into three-phase signals and directly uses them as power sources for the motor . The function of the three-phase power converter is handled by an auxiliary motor control board . Spectrum Digital provides two boards that can provide this function: DMC550 and DMC1500. Either of them can be directly plugged into the eZdsp28xx board for use.

Hall effect sensors are used for fuzzy logic control loop feedback. The switching of the three-phase power converter is determined by detecting the signal received from the Hall effect sensor. The signal is fed into the acquisition pin of the TMS320F2812. The actual motor speed is calculated by counting through a software module.

Software Introduction

The motor control software is composed of the Digital Microcircuit (DMC) library modules and the FL motor control program. There are seven modules in the Digital Microcircuit (DMC) library that are used in this application. They are:

·Datalog data logging
·BLDC3PWM
·tall3_Drv
·Mod6_Cnt
·Rmp2Cntl
·Rarnp_Cntl
·Speed_PR

Additionally, fuzzy logic motor control is handled by one main FuzzyCtl() routine; for brushless DC motors this is Fuzzy-BLDC().

The software starts with a first run configuration followed by application specific setup. Specifically, the GPIO pins are configured as CAPture and PWM pins.

The next step is to initialize the timer and module parameters, and set the ISR. When all peripherals are set, the interrupt is activated and the main control system is entered. The main control system calls the fuzzy controller every 8.7 milliseconds.

The error values ​​are converted into fuzzy values ​​through fuzzification and stored in X1[] and X2[]. Once converted, the fuzzy values ​​are applied to the fuzzy inference rules.

The result from the inference module is stored in Y[]. The output from Y[] is converted to a crisp value in the defuzzification module. The resulting crisp value is a PWM offset that is added to the current PWM duty cycle. The updated PWM value is checked to see if the new value is within a certain range, and if not, appropriate action is taken. Finally, the fuzzy controller returns the updated PWM duty cycle to the calling routine.

Figure 6 shows the demo application debugging session.

Demo application debugging session

Channels 1 and 2 (in the upper right display window) show the PWM counter and the captured Hall Effect sensor, respectively. Channels 3 and 4 (below channels 1 and 2) show edge-triggered versions of the PWM counter and Hall Effect sensor display windows. The important variables are shown in the watch window, the most important of which are SetSpeed ​​and CurrentSpeed. These values ​​are close enough that the output of the fuzzy logic controller is zero.


This session shows the engine running under no-load conditions. The behavior may be slightly different than under load. Also, if finer granularity is desired, it may be necessary to tune the controller.

Keywords:DSP Reference address:Design of DSP-based engine controller using fuzzy logic

Previous article:Design of DSP-based engine controller using fuzzy logic
Next article:Software Design of Optical Fiber Pyrometer Based on DSP

Recommended ReadingLatest update time:2024-11-16 21:53

Design of Asynchronous Serial Communication between TMS320C3x DSP and PC
【Abstract】Based on a brief introduction to the TMS320C3x series chips, this paper mainly introduces the software and hardware solutions for asynchronous serial communication between DSP and host PC in digital signal processing systems. Keywords: TMS320C3x Asynchronous serial communication MSComm control
[Embedded]
Design of Asynchronous Serial Communication between TMS320C3x DSP and PC
Design of fully digital UPS inverter based on DSP control
1 Introduction With the continuous development of information processing technology, especially the widespread application of computers and the rapid development of the Internet, the reliability requirements of power supply systems are getting higher and higher, so the requirements for the technical indicators of uni
[Industrial Control]
Design of suspension motion control system based on 32-bit DSP and motor driver chip
  With the popularity of 32-bit DSP, 32-bit processors have become the mainstream products in the control field. Compared with traditional microprocessors, they are faster, more powerful, and more resource-rich, and more in line with the pace of development. TMS320F28027 is a 32-bit DSP with the advantages of fast com
[Embedded]
Design of suspension motion control system based on 32-bit DSP and motor driver chip
DSP Programming Skills 8---Unveiling the Mystery of the Compiler Runtime Model
  When we run some C/C++ programs on PC, if the necessary library files or dll files are missing, the program will crash and pop up a bunch of dialog boxes with various crash sounds, prompting us "run-time error", missing xxxx runtime library files, etc. What does the runtime file do? It mainly contains C/C++ library
[Embedded]
DSP Programming Skills 8---Unveiling the Mystery of the Compiler Runtime Model
Hardware Circuit Design of Video Monitoring System Based on DSP
  At present, video surveillance is widely used in security monitoring, industrial monitoring, traffic monitoring and other fields. Video surveillance systems have roughly gone through three stages: first, the TV monitoring system based on analog signals, which has a single function, is easily interfered with and diff
[Embedded]
Hardware Circuit Design of Video Monitoring System Based on DSP
Design of real-time vibration signal analysis and processing system based on DSP
1 Introduction As an important part of battlefield sensor reconnaissance system, vibration signal analysis mainly detects vibration signals of ground moving targets, analyzes and processes the signals in real time, and gives corresponding identification signals to identify the type and quantity of vibration
[Embedded]
Design of industrial sewing machine control system based on DSP
introduction In traditional industrial sewing machines, the main shaft is mostly driven by a clutch motor, and the actions in the sewing process are completed by mechanical and manual cooperation, which has the characteristics of low efficiency, large size, narrow speed regulation range, difficult position
[Embedded]
Temperature Control System Based on DSP and Digital Temperature Sensor
0 words Since the 1960s, digital signal processors (DSP) have developed rapidly along with computer and communication technology, and their application fields have become more and more extensive. In terms of temperature control, especially the temperature control of solid-state lasers, the temperature accur
[Embedded]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号