Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
8:47 Video length is 8:47.
  • Description
  • Full Transcript
  • Related Resources

Field-Oriented Control of PMSMs with Simulink and Motor Control Blockset, Part 1: Field-Oriented Control: Calibrating Sensors, Estimating Parameters, and Modeling

From the series: Field-Oriented Control of PMSMs with Simulink and Motor Control Blockset

This first video in the series shows how to use Motor Control Blockset™ to:

• Calibrate offsets for Hall sensors and quadrature encoders

• Estimate motor parameters

• Model the permanent magnet synchronous motor (PMSM) and inverter

Learn how to use sensor decoder blocks to process signals from the sensors and encoders to compute rotor position and speed. Then run predefined tests using the motor hardware to estimate stator resistance, d-axis and q-axis inductance, back EMF, inertia, and friction. These motor parameter values are incorporated into a motor model that is driven by an inverter model. Discover how to find these models in Motor Control Blockset and Simscape Electrical™.

Hello, everyone. Welcome to this section of Field Oriented Control Made Ease. My name is Shang-Chuan Lee. I'm the application engineer at The MathWorks. I base in Dallas, Texas. Before I joined MathWorks, I worked for my PhD at UW Madison in Wisconsin. My specialty is the motor control and polyelectronics.

So in this talk, we will show you how to spin brushless motors using Model-Based Design in Simulink. To be more specific, we will walk you through how to develop and control everything in Simulink and generate embedded from the model. So let me show you how to develop and implement field-orientation control with signaling and model based design. So during our discussion, we will use this very simplified workflow covered by these key steps.

So for today's presentation, we are going to use TIC200 motor control kits to illustrate the workflow. The kits include a surface mount, motors, F2AX series microcontroller, and DRV8305 three phase inverter. So we will start with the sensor calibration by measuring phase currents using ADC.

Calibrating current offsets is essential to ensure accurate current measurement. In the Motor Control Blockset, we provide the reference example for ADC offset calibration. The reference example include the model that we can generate a code and download to the processor and host model control the target.

As you can see here, we are starting with this connect the motor from the inverter to make sure there are no face current going through the motor. So the model we generate a code from can capture ADC counts and send in over through serial [INAUDIBLE] to the host model. By reading the mean value of the signals, the offset of the phase a and phase b current are shown here around 2,300. Finally, we enter those offset into the manuscript so that we will use them later for closer control.

Next, we will compute the position sensor offset. The kit that we provide can calibrate for both hall sensor and quadrature encoder. But here, we are using Hall sensor as a example. For those of you who are interested in sensors for the orientation control, you could definitely skip this step. So we will start with the model that we will generated a code from by specifying a power supply voltage, which is 20 volts, in this case. The idea of the model runs open the control to compute the position sensor offset, and the whole sensor takes the reading until the position is commanded to be 0 degrees at this moment.

Then, we will generate a code from this model and download to our processor. We then use the host motto to start the calibration. After then, we click this round button and start calibrating. We will see the motor will start spinning, and the offset will be automatically computed. Now, the green LED, here, shows the motor is spinning in the right direction, which is counterclockwise. If not, the motor spinning clockwise direction, the LED turns red, indicating we need to swap the wires between the motor and the inverter.

So our next step is parameter estimation for the brashest motor. As we know, an accurate claim model have a better design for our controller in the possible simulation. In our case, we already have the actual motor, and we can take advantage of that. So with the Motor Control Blockset, it provides instruments

test. We can run out of processor to estimate motor parameters. Another other nice thing is we have a host model to control and monitor the progress of parameter estimation. So let's see how it works.

So we start with a house motto which serve as a user interface. Here, we define all the parameters, nominal voltage, current speed, and input voltage. We also define a host sensor asset based on the previous computed value. Once we have defined all this value, then, we go to a target model and update the value from the instruments to generate a code. We then start parameter estimation from the host model, pass around on the motor to estimate data resistance, inductance, Ld and Lq, Bemf constants, moments of inertia, and friction coefficient.

So it's going to take around 30 seconds to finish the estimation process. And now, we can use a provided scope to examine the signal of our interests. Like here, we are looking at the speed. Now that the parameter has been estimate, we can save them into a file. If we load this file in MATLAB, we will see a structure with [INAUDIBLE] parameter values.

Later, we can use the surroundings for accurate close loop FLC simulation and low tuning. So we have seen more control blocks and parameter estimation capabilities, which are handy if you already have motor. However, sometimes, you have to start development before power is available. In that case, you can import mortar parameters from the datasheet perimeter rise motor front FEA tools, such as JMAG, or ANSYS Maxwell, or even from dyno data. There are plenty of examples and capabilities using Simscape electrical and other products can help you to do that.

So with Simscape Electrical, we are not only can model a physical component, but also, model different level of ability for different purposes. What I mean here is if you are assistant architecture engineer, you probably only focus on system level simulation. So you can use lump parameters to model the entire distributed power plant, for example.

And if you are an electrical engineer, who is only focus on component level, space levels simulation, you can increase the non-linear model to see the situation and harmonics effect. And the trade is for one parameter linear model that allow you to run faster simulation, as for a detailed modeling considering non-linear effect, it will take a longer time but allow you to have realistic simulation retail.

OK. Now, I would like to show you a demo. How do we model inverter in different facility? As we can see from the demo, we have our motor parameters that we just measure from experiments. So we can model motor and motor dynamics. In this motto we have set out three variants for modeling motor and inverter.

In the first variant, we use box from Motor Control Boxset for modeling linear long parameter motor dynamics. We suffix in [INAUDIBLE] value by directly loading estimate motor parameters into a block. So for first simulation, we can model motor. We can model inverter as an average value device.

As for the second [? variant, ?] for those of you who are interested in switching events in the Powertronics, we can use Simscape Electrical to model the key signals for the inverter. Now, we are modeling ideal switch inverter, but we can also model power semiconductors, such as most Fed or IGBTs.

Related Products

  • Motor Control Blockset
  • Embedded Coder
  • Simscape Electrical
  • Simulink Control Design

Learn More

Free Trial Software for Power Electronics Control Design
Learn How to Design and Implement Motor Control Algorithms: Field-Oriented Control of PMSMs with Simulink
Field-Oriented Control of Induction Motors with Simulink and Motor Control Blockset

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Hardware-in-the-Loop Testing for Power Electronics Control Design

Read white paper

Feedback

Featured Product

Motor Control Blockset

  • Request Trial
  • Get Pricing

Up Next:

Learn how to use Motor Control Blockset to develop field-oriented control algorithms, including field weakening.
8:45
Part 2: Field-Oriented Control: Designing the Control...
View full series (4 Videos)

Related Videos:

24:59
AC Motor Control Architecture, Code Generation, and...
17:08
Simulating a Multi-Stage Rolling Mill Process, Part 3:...
14:13
Application of Automatic Code Generation for Rapid and...
46:35
Motor Control with Embedded Coder and TI’s C2000
2:13
What Is Simulink Control Design?

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • MATLAB Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Customer Stories
  • About MathWorks
  • Select a Web Site United States
  • Trust Center
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation