- Home
- :
- NXP Model-Based Design Tools
- :
- NXP Model-Based Design Tools
- :
- Speed Control Systems for BLDC Motors - MTRDEVKSBN...

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Speed Control Systems for BLDC Motors - MTRDEVKSBNK144

07-30-2019
05:41 PM

2,003 Views

andreicador13

Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Acknowledgement
- Introduction
- Context
- Theoretical Considerations
- 1. Transfer Function - Pole Placement Method
- 2. State-Space - Linear-Quadratic-Integral (LQI) controller
- Architecture
- Control Algorithms
- Closed Loop Requirements
- BLDC Motor Model
- Transfer Function Model
- State-Space Model
- Controller Design
- Discrete Regulator - Second-Order Closed Loop Response - Transfer Function Approach
- PID Regulator - First-Order Closed Loop Response - Transfer Function Approach
- LQI Controller - State-Space Approach
- Implementation
- Discrete Regulator - Second-Order Closed Loop Response - Transfer Function Approach
- PID Regulator - First-Order Closed Loop Response - Transfer Function Approach
- LQI Controller - State-Space Approach
- Experimental Results
- Default Regulator
- Discrete Regulator - Second-Order Closed Loop Response - Transfer Function Approach
- PID Regulator - First-Order Closed Loop Response - Transfer Function Approach
- LQI Controller - State-Space Approach
- Conclusion

I wish to express my sincere gratitude to my mentors, Dumitru-Cristian Tranca, Ph.D, and Monica Patrascu, Ph.D. from the Faculty of Automatic Control and Computers at the Politehnica University of Bucharest, without which the present project would not have been carried out.

Traditional DC Motors, also known as Brushed DC Motors, showed great success in various applications. Thanks to their simplicity, low cost, and precision, they have been part of industrial applications for many years. Unfortunately, they have two major drawbacks, both related to the use of brushes. First, brushes tend to wear out, so the motor needs periodic check-ups and maintenance. Moreover, they are not intended to function in hazardous environments due to the occurrence of sparks, posing a major threat for the overall application.

As a results, Brushless Direct Current (BLDC) Motors replaced traditional motors in numerous projects, providing better performances and higher efficiency. According to an article entitled "How to Power and Control Brushless DC Motors", published on the digikey website, brushless motors show improvements between 20% and 30% for the same speed, with the same mechanical load, over the classical machines. Considering the fact that 40% of the global electric consumption revolves around the electric motor, according to the annual report of the International Energy Agency, this eﬃciency boost is huge. Furthermore, BLDC machines, with an obvious advantage in durability, also become smaller and lighter thanks to the eﬃciency gain. These advantages made them very popular in ﬁelds such as automotive, heating, ventilation and air condition (HVAC), aeronautics, medical sciences and industrial automation. The disadvantages of the brushless motors are related to the increased control cost and higher complexity, requiring electronic commutations and supervisory structures to ensure the accurate timing of phase voltages and to properly estimate the speed of the rotor. Fortunately, the producers are rapidly evolving in this ﬁeld, providing cheaper and smarter solutions, thus lowering the overall cost.

This section will briefly explain two different approaches related to control theory:

- Methods that use the transfer function model of the system.
- Methods that interact with the state-space model.

As it can be found in the Motor Control Class: Lecture 11 - Closed Loop Control, there are certain ways to obtain a Regulator that fulfills the purpose of the application using manual tuning. The advantage of these methods relies in the fact that you do not need an accurate estimation of the motor's mathematical model to have a satisfactory response. The downside is that you will obtain very good results only in certain cases and with a lot of Trial and Error work.We will describe analytical methods to determine the transfer function of the Regulator.

First of all, the closed loop system can be described by the following feedback control scheme:

Pole placement method, although it is vastly found as a state-space method, works great with the transfer function approach. Although this strategy may sound complex, it is one of the most natural implementation of a control algorithm.

We build the ideal transfer function (that determines the response we want to obtain) and, using the model of our Plant, we can rapidly determine the transfer function of the **Regulator**.

For instance, if we want to obtain the following **Closed Loop transfer function** (or, more adequately, the response of the following transfer function):

We can easily determine the **Open Loop transfer function**:

Finally, knowing the model of our plant - Hp, we can determine the transfer function of the regulator:

In some fortunate situations, the transfer function of the **Regulator** can be implemented using a Proportiona-lntegral-Derivative **(PID)** Controller:

As it can be seen in the above image that depicts a parallel-form PID Controller, the command generated by this regulator is built using 3 components:

**Proportional****(P)**- deals with the absolute value of the error. For instance, if the speed of the motor is significantly greater than our speed reference, the value of the speed error will be a big negative number. If our**Kp**is 100, the value of our next command will be a lot smaller than the previous command, considering the fact that our speed error will be multiplied by 100. If Kp was 0.01, the next command would be lowered only by a small amount, given the fact that only 1% of our speed error will have an impact on the computed command.**Integral (I)**- takes into account the sum of previous errors. The bigger the**Ki**gets, the bigger the influence of past states will be. Simply said, if the previous commands did not bring the system in the desired state, future commands will get stronger and stronger.**Derivative (D)**- this term follows the evolution of error. If the Speed Error is getting smaller, the command will be lower because the system is approaching the desired state. If the**Kd**coefficient is too big, the system will perform poorly because minor measurement errors will lead to wrongfully generated commands.

The PID controller is a very powerful tool in automatic control thanks to its simplicity and versatility. If correctly tuned, the closed loop performances are suitable for the vast majority of industrial applications.

The State-Space approach is generally linked with the Optimal Control concept. As the name suggests, **Optimal Control** is a control strategy that depends on minimizing a **performance criterion**, also known as **cost function**, to generate the proper regulator. Most of the applications revolve around maintaining the stability of a system. For instance, satellites are controlled with this type of strategy the ensure the proper orientation and position. The main purpose is generating a command that keeps the satellite in the initial position with the desired orientation, despite external disturbances.

Unfortunately, **the classical approach does not include the possibility of following a speed reference**. A variation that provides modest results is adding the desired state as an external disturbance. Simply said, if we want the motor to spin at 1000 RPM, we can trick the motor into believing that the actual speed is -1000 RPM so it will generate a command that will bring the rotor at 0 RPM, thus obtaining the desired angular velocity.

Finally, this approach can only guarantee very small steady-state error, but never 0. This can be demonstrated by using a popular principle among control theory projects, **The Internal Model Principle**. While the inputs of our motor will be step signals with different values, the only way we can ensure **null steady-state error** is including an **integrator block in the open loop system.**

A regulator that successfully integrates this concept is called Linear-Quadratic-Integral controller, or LQI Controller. It works with **Linear** Systems and **Quadratic** Cost Functions, considering the fact that the Regulator includes an **Integrator** block.

A Simulink project can be built to demonstrate its functionalities:

- The
**purple box is the plant**of our project, the BLDC Motor. - The
**LQI****Regulator**is made of the**Intregral****Block**and the**optimal gain matrix K.** - Other Gain Blocks are introduced to compensate the difference between system's measurement units and user's interface.

The classical method is built around the following equations:

Unfortunately, these expressions **do not include the notion of "Speed Error" or "Speed Reference"**, so following the desired path is not yet possible. **We update the system's overall state-space model by adding in the state vector x the state variable Epsilon,** which is the **Integral of the difference between Speed Reference**, lastly added as an input, **and the estimated speed**. Considering this, the new state-space model becomes:

where **r is the speed reference and A,B, and C are the matrices that comprise the BLDC model.**

To compute the ideal regulator, we need to minimize the following cost function:

where **z is the new state vector** (built using the initial state vector x and Epsilon), Q is a matrix that penalizes each component of the state vector, e.g. if we do not want the motor to reach high speeds, the first element found in the Q matrix will be very big. When the speed reaches high levels, the value of the cost function will be greatly increased and, considering the fact that we want to minimize the cost function, this instance will be ignored due to its poor performances.

This project is built using the MTRDEVKSBNK144 development kit that includes a BLDC Motor. The setup is made using the instructions provided in the development kit page and in the Motor Control Class: Lecture 12 - Motor Control System course. No further improvements added.

This article is centered on speed control algorithms. It does show improvements only related to the Regulator Block found in the MATLAB project described by Motor Control Class: Lecture 12 - Motor Control System Other blocks such as Speed Estimator and 6-step Commutation are the ones made by dumitru-daniel.popa.

First of all, to build a successful control block we need to establish a set of performance criteria to determine the best control strategy. Considering several online articles that implement BLDC regulators and by analyzing their performances, we can come up with the following list:

**Closed Loop System Stability**- fundamental criterion to ensure the proper functioning of the motor.**Disturbance Rejection**- disturbances can be interpreted as a variable load. If the mechanical load varies, the speed of the rotor varies.**This feature is essential in case of a sudden loss of load. If the load rapidly varies from a significant level to 0, the speed of the rotor will reach very high values. The faster it recovers from these regimes, the better it will be for the overall application.****A settling time that is lower than 4.5 seconds -**a typical criterion that can be found in the vast majority of the projects that aim to control similar motors.**Zero steady-state error**- naturally, we want the motor to follow the imposed trajectory as close as possible.**An overshoot that is less than 5%**- we want to obtain a closed loop response that is similar to a first-order system's response.**The current that flows through the motor must be less than 3.5 A -**as it is described in the Motor Control Class: Lecture 12 - Motor Control System, the safety block included in the Simulink project limits the maximum current to 4 A. To obtain the desired the results in every situation, we need to 'relax' the ideal characteristics of the closed loop system to ensure considerable confidence when implemented on the real motor. Simply said, putting the current limit closer to the mandatory limit may generate a regulator that, when implemented on the real machine, due to parameter variation and model uncertainties, will get past the 4 A limit and will produce a FAULT state.

We provide 2 different models for the same motor, using the transfer function approach and the state-space approach.

Hp is the transfer function of the Plant, i.e. the motor itself. The two poles of the systems are complex conjugated poles:

p1 = - 4.8103 + 396.48i

p2 = - 4.8103 - 396.48i

These two poles are placed on the left side of the complex plane, both showing negative Real Part:

Re(p1) = Re(p2) = - 4.8103 < 0

**Consequently, the Plant of our system is stable.**

** **

The state-space model is comprised by 3 matrices which completely describe the following equations:

where x is the state space vector, taking the form of **x = [ w ; (dw)/(dt) ]**, where w is the angular velocity of the motor,

**y = w, **and u is the input, i.e. the current that flows through the motor.

The numerical values of these matrices can be found below:

The eigenvalues of the matrix A are both found in the left side of the complex plane, so the stability of our Plant is once again demonstrated.

We want to obtain a second-order response considering the following arguments:

- we allow a small overshoot (less than 5%, but bigger than 0%)
- we significantly improve the settling time

We build the ideal response's transfer function, considering the general formula of a second-order system:

Based on the above expression, the performance parameters can be described using the following form:

Using the imposed characteristics that can be found in the Requirements Section, we can determine the ideal closed loop transfer function:

**The stability of the above system can be proved using the Hurwitz criterion.**

Considering that our Regulator's transfer function is determined by the fraction

we can determine the transfer function of our controller:

As it can be seen from the above expression, our regulator cannot be implemented using the traditional PID Controller. Using the same sampling time provided in the Motor Control Class: Lecture 12 - Motor Control System, we obtain the Discrete Transfer Function using the Trapezoidal Method:

The simulation results can be found below:

**As it can be seen, the closed loop system satisfies our needs.**

** **

This approach is very similar to the first approach. Instead of following the principle of reducing the settling time at the cost of the presence of a small overshoot, this method provides a slower response in the absence of the overshoot that can cause problems near the limit regime (high RPM functioning regime).

- we wish to obtain a response that does not show overshoot
- the system will have a slower response

Starting from the ideal closed loop transfer function that resembles a first-order system's response:

To ensure null steady state error, we get to the following condition:

To obtain a satisfactory settling time, we get to the following results:

where tt is the value of the settling time. Considering that we wish to obtain:

we come up with:

We can demonstrate the stability of our closed-loop system in a very natural way. This system has a real negative pole, so all the poles are placed in the left side of the complex plane, thus showing the stability of our final system.

To compute the transfer function of the regulator, we calculate the open-loop transfer function:

Finally, we obtain the transfer function of the regulator that can be implemented using a PID Controller:

Below you can find the simulation results:

As mentioned before, the final system is determined by:

The command that our **regulator should generate is:**

The optimal gain matrix K that solves our problem can be found by minimizing our cost function :

Our choice related to Q and R shows two important points in this approach:

- We want to prioritize the speed of the response, i.e. small settling time => As it can be seen, the Q matrix punishes a lot big deviations from the ideal state. If the error is too big, the value of our cost function will be big thanks to the big number in the last row, so the system will indeed perform poorly.
- To satisfy safety conditions, we cannot generate a command indefinitely big. An enormous command will surely provide a very short settling time, but it will harm the internal structure of the motor. This being said, we need to also punish big commands to ensure the proper functioning of the motor, hence the value for the R that is certainly bigger that the first 2 elements found on the diagonal of the Q matrix.

**By choosing the right values for these matrices we can obtain the desired result.**

The analytical solution of this problem can be determined by solving a Riccati equation that gives us the formula of K:

A commonly used MATLAB function can be used to rapidly generate the optimal controller:

https://www.mathworks.com/help/control/ref/lqi.html

Using the above MATLAB tool, we determine the gains for our LQI Controller:

The stability of our closed-loop system can be demonstrated by calculating the eigenvalues of the system matrix:

**As it can be seen, all eigenvalues are in the left side of the complex plane, so the system is stable.**

After determining the optimal gain matrix K, we can test the performances of the LQI Controller in Simulink:

Thanks to the S32K144EVB, we can rapidly implement our controller using the Simulink Environment. We take the original project built in the Motor Control Class: Lecture 12 - Motor Control System and we modify only the Regulator Block accordingly.

First of all, to evaluate the results of this project, we need to build a starting point. Motor Control Class: Lecture 12 - Motor Control System included a Simulink project that implemented a PI Controller with Kp = 0.2 and Ki = 0.7. The results can be seen in the following images:

As it can be determined using the above images, the performances provided by the default regulator are not satisfactory. The settling time is relatively long and the disturbances are rejected very slowly. Overall, the system does not perform as it is intended.

Performance Index | Observed Value |
---|---|

Settling Time | 7.3 seconds |

Disturbance Rejection | 6.5 seconds |

The results are extraordinary. The settling time is very small and disturbances are rejected very fast. The system successfully adapts to the variable mechanical load and comes back into the desired functioning regime.

The downside of this regulator relies in its implementation: due to the fact that it cannot be implemented using the traditional PID Controller, we need to discretize the continuous transfer function to create a digital filter that is implementable.Finally, due to numerical latency, the system cannot function >850 RPM.

Performance Index | Observed Value |
---|---|

Settling Time | 1.9 seconds |

Disturbance Rejection | 1.5 seconds |

We can further improve the performances of this PID Controller by slightly adjusting its parameters. To decrease the settling time, we can increase the Ki coefficient. The Closed Loop System's response with the freshly tuned PID Controller can be found in the following images:

The performances shown in the above pictures meet the requirements. The settling time is good, not impressive, but not bad. It successfully rejects disturbances in relatively short time. Overall, we must take into account that the response does not include overshoot. This feature makes this controller more suitable for functioning near the limit regime.

Performance Index | Observed Value |
---|---|

Settling Time | 3.6 seconds |

Disturbance Rejection | 2.8 seconds |

The LQI Controller provides amazing performances. In the absence of overshoot, the settling time is very short and the disturbance rejection happens very fast. Minor improvements can be made related to the Q and R matrices, but the results will get better only in certain applications. Overall, the LQI Regulator shows the best results.

Performance Index | Observed Value |
---|---|

Settling Time | 2.8 seconds |

Disturbance Rejection | 2.3 seconds |

While the shortest settling time was obtained using the Discrete Regulator, this type of approach implies a limitation of 850 RPM. This disadvantage makes this controller unsuitable for the vast majority of applications, including the numerical instability determined by the implementation method.

The LQI Controller shows the best results. It responds very fast to both reference variation and disturbance occurrence (interpreted as a variable load). It is suitable for applications that include a precise model of the plant, in our case a BLDC Motor. As it is part of the Optimal Control Strategy concept, the fact that this regulator minimizes a cost function further suggests that this controller provides the optimal response in a given situation. The downside of this method relies in the computational (needed to compute the Optimal Gain Matrix K) and electronic (two different controllers - in our case an I controller and a PD Controller) costs.

Finally, if the application does not need high performances and cannot sustain high costs, the PID Controller provides satisfactory results - a relatively short settling time and decent disturbance rejection time. Thanks to its versatility and simplicity, it is surely suitable for generic applications such as HVAC.

Thank you for reading this article.

2 Replies

08-02-2019
12:15 AM

410 Views

dumitru-daniel_

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Thank you for posting your work here. It's very interesting.

Are you planing to investigate other types of controllers too ? I would like to see something related with Fuzzy Logic Controllers - Mathworks support this as well. It might be a good approach for systems with unknown mathematical forms.

Best regards,

Daniel

08-02-2019
10:44 AM

410 Views

andreicador13

Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi dumitru-daniel.popa,

First, thank you for your work related to the Motor Control Class: Lecture 12 - Motor Control System workshop. It was very helpful.

I'm glad you find this project interesting. Fuzzy Logical Controllers are, indeed, awesome! Especially when, as you said, you try to control unfriendly systems with a poor mathematical model. I do consider involving this type of controller in a future project. As I got more familiar with working on the S32K144EVB, I think that this will be my starting point.

Best regards,

Andrei Cador