Lantron Electronic Logo

Designing DSP-Based Motor Control Using Fuzzy Logic

2023-07-31 10:25:31
Variable speed drive (VSD) motors hold promise for drastically reducing energy consumption and dependence on fuel. One approach is to use a digital signal processor (DSP) to create a new generation of VSD-based controllers for motors such as brushless DC (BLDC) motors.

However, these motors also face challenges. Controlling the motor speed of BLDC motors is complex when using traditional proportional, integral, and derivative (PID) controllers because they rely on complex mathematical models and are computationally intensive. Another approach is to use fuzzy logic (FL) algorithms to eliminate the need for complex mathematical formulas and provide an easy-to-understand solution. FL motor controls also have shorter development cycles compared to PID controllers, resulting in faster time to market. This article discusses the process of controlling a BLDC motor with the Texas INStruments c28xx fixed-point DSP family using the FL algorithm.

BLDC Control Model Development

Before constructing the FL engine, we had to first develop a model as the basis for the design. The FL controller uses heuristic knowledge and expresses the design using a language description of the model. Instead of developing the model from scratch, we will use the PID controller model as a starting point. Once developed and implemented, the FL controller can be improved by tuning its parameters.

In general, there are three design steps to develop a FL BLDC controller:

  1. Define the input, output, and operating range of the controller.
  2. Define fuzzy membership set functions and rules.
  3. Adjust the engine.

The first step is to define the relevant inputs and outputs of the model. The input is the error (E), the current error between the set speed (SS) and the current speed (CS). Another input is the error change (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 current armature voltage (CAV) and the stored value of the previous armature voltage (PAV). The resulting model equations are as follows:

E = SS – CS
CE = E - PE

Motor speed is measured in revolutions per minute (RPM), and E determines how close we are to our target speed. Therefore, when E > 0, the motor speed is lower than the set speed. Alternatively, E < 0 means the motor is spinning faster than the set speed. CE determines the direction of adjustment of the controller. CE is positive if and only if (iff) the current speed is less than the set speed. Alternatively, CE is negative if and only if the current speed is greater than the set speed. CE alternates between positive and negative values as the set speed is approached. CV is the excitation voltage applied to the armature. This voltage is represented in the implementation as a pulse width modulation (PWM) duty cycle.

The next step is to define the fuzzy membership set functions, variables and rules. In order to work, non-blurred (sharp) input and output must be converted to blurred. Conversion is performed by using language variables to represent input and output ranges. These are also called fuzzy variables. Fuzzy variables are used to divide the value range of the membership function. For example, use five variables to map inputs and outputs. They are Negative Medium (NM), Negative Small (NS), Zero (Z), Positive Small (PS) and Positive Medium (PM). The input and output of the model are membership set functions described by five fuzzy variables in the operating range.

Instead of using mathematical formulas, the FL controller uses fuzzy rules to make decisions and generate outputs; how cool is that? FL rules take the form of IF-THEN statements. Fuzzy rules determine system behavior rather than complex mathematical equations. For example, if the error (E) is equal to NM and the change in error (CE) is equal to PS, then the change in armature voltage (CV) is equal to NS. The number of rules used is based on the designer's experience and knowledge of the system. Therefore, for our system, the number of rules used is 25, which is based on a basic PID controller model using a PID control surface.

In order to energize the armature, the CV fuzzy output must be converted back to a crisp output. This process is called defuzzification. Use a popular deblurring method called the centroid method; I'll discuss it in more detail later.

The design step is to adjust membership functions and rules. This phase is also known as tuning. Tuning used to improve the performance of the FL controller. Once the design is complete, the controller can be implemented.