Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSe connecter
  • Access your MathWorks Account
    • Mon compte
    • Mon profil
    • Mes licences
    • Se déconnecter
  • Produits
  • Solutions
  • Le monde académique
  • Support
  • Communauté
  • Événements
  • Obtenir MATLAB
MathWorks
  • Produits
  • Solutions
  • Le monde académique
  • Support
  • Communauté
  • Événements
  • Obtenir MATLAB
  • Sign In to Your MathWorks AccountSe connecter
  • Access your MathWorks Account
    • Mon compte
    • Mon profil
    • Mes licences
    • Se déconnecter

Vidéos et webinars

  • MathWorks
  • Vidéos
  • Vidéos
  • Recherche
  • Vidéos
  • Recherche
  • Contacter l'équipe commerciale
  • Version d'essai
4:52 Video length is 4:52.
  • Description
  • Full Transcript
  • Related Resources

Field-Oriented Control of PMSMs with Simulink, Part 3: Deployment

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

Melda Ulusoy, MathWorks

In this video, we demonstrate how to use Motor Control Blockset and reference examples included in the product as a starting point for designing and implementing field-oriented control algorithms for surface-mount and interior permanent magnet synchronous motors (PMSM). Use these example models to test and verify your algorithm design in closed-loop simulation. We focus on using the models to generate and deploy embedded code.

In this video, we’re going to implement the field-oriented control algorithm on the embedded microcontroller. We’ll spin this brushless PMSM motor which we’ll control using the Texas Instruments LaunchPad processor and DRV8305 inverter module. We will use the same model that we used to run simulations. On the right-hand side, we see the different sample rates we have in our model. The current loop is running at 50 microseconds and the speed loop is running ten times slower. Then we also have the serial receive subsystem that gets the data from the host model running at 10 Hz. Now, we’ll go to the hardware tab and click on the settings. We see that we have configured the model to generate code for the Texas Instruments F28379D processor and we’re using Embedded Coder to generate code.

If we look under the current control subsystem, we see that this model contains algorithmic blocks from Motor Control Blockset such as Park and Clarke blocks and also the driver blocks from C2000 support package. When we generate code from this model, Embedded Coder generates both the algorithmic and driver code. All the code is then automatically compiled, and target application is downloaded to the processor. Let’s go ahead and do this by pressing “build, deploy and start” button. This starts the code generation process. We can see the progress in the diagnostic viewer. We see that the code is being generated and a project is automatically created in the Code Composer Studio IDE. By clicking here, we can open the project and debug from the IDE. We can now see that the application has been downloaded to the target and we’re ready to spin our motor.

Now that we programmed the microcontroller, let’s open the host model which runs on my laptop. This model lets us set the desired speed for the motor shaft using this knob where we specify speed reference in rpm. Through this on/off switch, it also lets us specify when the motor should start spinning. The model receives signals such as speed and currents listed here over serial port from the target application and we plot per-unit, normalized values in this scope. To start the execution on the host, we go to the simulation tab and press run. We see the measurements in the scope on the right. Let’s start spinning the motor by turning the switch on. We see how the motor speed starts tracking the reference. Let’s try setting the reference speed to a set of different values and observe the motor response. We go up to 0.8 of the motor baseline speed. And now let’s try a step change from 0.8 of the  baseline speed to a much lower speed value. And here’s another step change to higher speed. After checking the performance of speed tracking, let’s look at the currents. From this menu, we choose Id current. To better see the current waveform, let’s open scope settings and change the time span to 0.1 second. We see that Id current is kept at zero. Next, let’s look at Iq. Finally, we can take a look at the phase-A and phase-B currents.

In this video we showed how you can use Motor Control Blockset and Embedded Coder to generate code that is running at 20 kHz on the target microcontroller and controlling a brushless PMSM motor. This concludes the demo.

Related Products

  • Motor Control Blockset
  • Embedded Coder

Learn More

Get free power electronics control design trial
Understanding BLDC Motor Control Algorithms

3 Ways to Speed Up Model Predictive Controllers

Read white paper

A Practical Guide to Deep Learning: From Data to Deployment

Read ebook

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Deep Learning and Traditional Machine Learning: Choosing the Right Approach

Read ebook

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

Read white paper

Predictive Maintenance with MATLAB

Read ebook

Electric Vehicle Modeling and Simulation - Architecture to Deployment : Webinar Series

Register for Free

How much do you know about power conversion control?

Start quiz

Introduction to Brushless DC Motor Control

Read ebook

Feedback

Featured Product

Motor Control Blockset

  • Request Trial
  • Get Pricing

Up Next:

In this video, we demonstrate how to automatically tune the gains of the current and the speed loops of the PMSM using the Field Oriented Controller Autotuner block in desktop simulation.
6:37
Part 4: Controller Autotuning
View full series (4 Videos)

Related Videos:

14:13
Application of Automatic Code Generation for Rapid and...
46:35
Motor Control with Embedded Coder and TI’s C2000
34:13
Model-Based Design for DO-178C Software Development with...
58:47
Model-Based Design for DO-178C Software Development with...
5:59
NXP Cup: Installing the NXP FRDM-KL25Z Simulink Coder...

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

  • Contacter l'équipe commerciale
  • Version d'essai

MathWorks

Accelerating the pace of engineering and science

MathWorks est le leader mondial des logiciels de calcul mathématique pour les ingénieurs et les scientifiques.

Découvrir…

Découvrir les produits

  • MATLAB
  • Simulink
  • Version étudiante
  • Support Hardware
  • File Exchange

Essayer ou acheter

  • Téléchargements
  • Version d'essai
  • Contacter un commercial
  • Tarifs et licences
  • Comment acheter

Se former

  • Documentation
  • Tutoriels
  • Exemples
  • Vidéos et webinars
  • Formation

Obtenir de l'aide

  • Aide à l'installation
  • MATLAB Answers
  • Services de consulting
  • Centre de gestion des licences
  • Contacter le support technique

La société

  • Offres d'emploi
  • Actualités
  • Mission sociale
  • Témoignages clients
  • La société
  • Select a Web Site United States
  • Trust Center
  • Marques déposées
  • Charte de confidentialité
  • Lutte anti-piratage
  • État des applications

© 1994-2022 The MathWorks, Inc.

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

Rejoignez la conversation