Skip to content
MathWorks - Mobile View
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
MathWorks
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión

Vídeos y webinars

  • MathWorks
  • Vídeos
  • Vídeos-Inicio
  • Buscar
  • Vídeos-Inicio
  • Buscar
  • Comuníquese con ventas
  • Software de prueba
6:34 Video length is 6:34.
  • Description
  • Full Transcript
  • Related Resources

Field-Oriented Control of PMSMs with Simulink, Part 2: Desktop Simulation

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). We will focus on desktop simulation as a way to test and verify your algorithm design. You can then reuse the same models to generate and deploy embedded code.

In this video, we will see how to use Motor Control Blockset to implement field-oriented control for the brushless PMSM motor that we see here. This model is one of the reference applications from Motor Control Blockset. It’s configured with variants so that we can use this model to both simulate and generate code. This essentially lets us use the same model for simulating our field-oriented control algorithm against inverter and motor model and for generating code to program the microcontroller. Also, this model has been set up to use three different ways to model the inverter. In the first option, we’re using the average value inverter block from Motor Control Blockset for low-fidelity simulation. Another option we can use is Simscape Electrical to model ideal switching in the inverter. And choosing the third option lets us use Simscape Electrical to model multilevel converter.

Let’s quickly take a look through different subsystems that we have in our model. In the serial receive, we’re getting the data that’s sent over the serial port from the host model. The data determines the desired motor speed and if the PWM duty cycles are going to be non-zeros to allow the motor to spin. In the speed control subsystem, we have a PIcontroller that controls the rotor speed. It outputs Iq reference. And Id reference is set to zero because we implement field-oriented control for surface mount PMSM. In the current control subsystem, we’re getting the sensor readings and implementing field-oriented control as well as the PWM writes to the driver. Let’s see what we have under this subsystem. Here, we’re processing current and position and speed measurements. In this subsystem, we’re converting the quadrature encoder readings to position and speed using blocks we see here that are provided by Motor Control Blockset.

In the control system subsystem, we implement field-oriented control algorithm using Clarke, Park, Inverse Park and Space Vector Generator and PIcontrollers for the Id and Iq loops. We’re also using the Sine and Cosine lookup block which implements the lookup efficiently for deployment on microcontroller. Here, we have the driver blocks for PWM writes on the microcontroller. Note that these blocks are from Embedded Coder Support Package for C2000 processor.

Finally, to verify our algorithm and simulation, we have inverter and motor plant model. The three variants that we mentioned before provide us with different options for modeling the motor and inverter. This one is the average-value implementation with Motor Control Blockset. Here we use the Average Inverter and Surface Mount PMSM blocks. Let’s also take a look at the implementation with Simscape Electrical. In the inverter subsystem, this time we’ll look under the second variant where we implement ideal switching. Here, we use the PMSM block from Simscape Electrical as well as the converter that takes the switching pulses from PWM. The block dialog lets us choose the switching device. Here, we use ideal switching but other options are available such as using IGBT or MOSFETs for high-fidelity modeling. Finally, in the third option here, we’re modeling the multilevel converter.

Now that we talked about the model, let’s simulate it and look at some results. To do that, we press run. The model is being compiled and simulated. The results are now available. Before we look at them, let’s also run the simulation using low-fidelity plant model from Motor Control Blockset where we use the average-value inverter. We can now open the data inspector and look at simulation results.

Let's compare the speed, Iq, phase-A voltage and phase-A current seen by the motor and space vector modulation signals for these two runs. On the first plot, we see the speed reference which is in red and doesn't change between the runs. The speed feedback signals in yellow and blue look very close between the two runs. The next plot shows Iq reference and Iq feedback. We see the impact of switching on the Iq feedback that’s shown in yellow. In the third and fourth plots, we respectively see phase-A voltage and phase-A current seen by the motor. Here’s a closeup view of these signals. The signals in yellow show us the effect of switching in the inverter that we modeled and simulated using Simscape Electrical. Finally, these are the well-known duty cycle modulation signals with the characteristic shapes we get with space vector modulation. When we zoom in, we see that the results between the two runs look very similar to each other. Note that you can log any signal of interest in your model and run more simulations to check the performance of your controller by running different test cases. Once you're satisfied with the performance, you can move on to implementing your algorithm on embedded microcontroller. This concludes the video.

Related Products

  • Motor Control Blockset
  • Simscape Electrical

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

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

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 use reference examples provided by Motor Control Blockset as a starting point for implementing field-oriented control algorithms. You can use these examples to generate and deploy embedded code.
4:52
Part 3: Deployment
View full series (4 Videos)

Related Videos:

31:50
Large-Scale Wind Farm Modeling and Simulation in MATLAB and...
5:03
Balancing Model Fidelity and Simulation Speed
40:53
Mechatronic Simulation with Simscape Electrical
3:32
Selecting SimPowerSystems Simulation Mode
24:59
AC Motor Control Architecture, Code Generation, and...

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

  • Comuníquese con ventas
  • Software de prueba

MathWorks

Accelerating the pace of engineering and science

MathWorks es el líder en el desarrollo de software de cálculo matemático para ingenieros

Descubra…

Explorar productos

  • MATLAB
  • Simulink
  • Software para estudiantes
  • Soporte para hardware
  • File Exchange

Probar o comprar

  • Descargas
  • Software de prueba
  • Comuníquese con ventas
  • Precios y licencias
  • Cómo comprar

Aprender a utilizar

  • Documentación
  • Tutoriales
  • Ejemplos
  • Vídeos y webinars
  • Formación

Obtener soporte

  • Ayuda para la instalación
  • MATLAB Answers
  • Consultoría
  • Centro de licencias
  • Comuníquese con soporte

Acerca de MathWorks

  • Ofertas de empleo
  • Sala de prensa
  • Misión social
  • Casos prácticos
  • Acerca de MathWorks
  • Select a Web Site United States
  • Centro de confianza
  • Marcas comerciales
  • Política de privacidad
  • Antipiratería
  • Estado de las aplicaciones

© 1994-2022 The MathWorks, Inc.

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

Únase a la conversación