Skip to main content

Electric Motor Control Reference Application

Design, prototype, and test your brushless DC motor controls using Simulink and Speedgoat hardware

Learn how to

  • Create accurate motor models and fine tune controller gains by collecting data from hardware 
  • Monitor and control your real-time application directly from Simulink® models or with instrument panel apps 
  • Configure your controller model to generate compact and fast C code for any target microcontroller 
  • Automatically run test-cases and prove that your embedded motor controller meets requirements via Hardware-in-the-Loop testing 

Key Benefits

  • Design and test motor controls with MATLAB® and Simulink®-integrated solutions that enable you to fully adopt Model-Based Design  
  • Test your motor controls early and often. Cut back development costs by exposing design flaws as early as possible 
  • Shorten time-to-market of your motor controls by using automated code generation and automated testing
  • Protect your investment by reusing the same real-time equipment to test both, early control prototypes and final embedded controllers 

Description

Electric motors impact almost every aspect of modern life. Together with the systems they drive, electric motors consume half of the electricity worldwide. Today manufacturers of electric motors are required to comply with energy consumption and efficiency policies, pushing them to steer their focus on delivering more energy-efficient power electronics and electric motors.  
 
This trend led to the massive adoption of brushless DC motors, including Permanent Magnet Synchronous Machines (PMSMs), due to their higher efficiency and power density. Leading engineering companies in the field face the challenge of keeping the pace of innovation. They have to deliver smarter and more power-efficient control software and stay competitive in such a dynamic market.
 
In an attempt to address these challenges, electric motor control engineers have been progressively relying on Model-Based Design and real-time simulation and testing to effectively design, develop, and test their new embedded motor controllers.

The Electric Motor Control reference application by Speedgoat aims to provide you with a starting point for electric motor control development using Model-Based Design. It consists of exercises that show you how to best combine the power of Speedgoat real-time solutions with Simulink®, Simscape Electrical™, and Motor Control Blockset™, among other MathWorks products, for motor control design and testing. Download the reference application and discover the process of developing a digital controller based on field-oriented control (FOC) algorithm, from the initial design stages to prototyping and final deployment and testing. 

 
The reference application leverages the Speedgoat HIL Demo Kit and the Electric Motor Control Kit. The latter features a small 100W Maxon PMSM motor with integrated Hall Sensor and Encoder, and the Speedgoat 1.4 kW Three-phase Inverter  that supports switching frequencies up to 50kHz. These kits seamlessly operate with the cost-effective IO397 FGPA I/O Module, which supports PWM generation and capture, with time resolution as low as 5ns, and quadrature encoding and decoding

Model-Based Design Workflow

The reference application walks you through the following four Model-Based Design workflow stages: 

  1. Start your journey right from your MATLAB® and Simulink® simulation environment. By using Stateflow™ and Simscape Electrical™, you can design a closed-loop and supervisory control algorithm using high-fidelity models of the physical electric motor, three-phase power inverter, and sensors included in the Speedgoat Electric Motor Control Kit

 

  1. After validating your control algorithm via desktop simulation, you will discover Rapid Control Prototyping as a critical enabler for the early and rapid validation and test of your motor controls. You will learn how to prototype your FOC controller on Speedgoat rapid prototyping hardware and quickly spin the Speedgoat Electric Motor Control Kit brushless DC motor using Simulink Real-Time™. 
  1. The journey continues with the production code generation and testing of your digital controller. You learn how to configure early development controller models to generate and deploy efficient embedded code that you can run and efficiently test on an embedded target controller. This stage also gives you hands-on on performing Hardware-in-the-Loop (HIL) simulation with the Speedgoat HIL Demo Kit. You will learn how to expedite the testing and quality of your digital motor controller with test automation and deterministic plant simulator. 

 

  1. The journey ends by deploying the embedded controller and integrating it with the physical electric motor, three-phase power inverter, and sensors included in the Speedgoat Electric Motor Control Kit

Product Focus: Simscape Electrical™

Simscape Electrical™ provides reference examples and component libraries for modeling and simulating electronic, mechatronic, and electrical power systems. It includes models of semiconductors, motors, and components for applications such as electromechanical actuation, smart grids, and renewable energy systems. Simscape Electrical™ helps you design and develop control systems for electrical systems such as the Speedgoat Electric Motor Control Kit right from your Simulink®. The toolbox supports C-code generation enabling fast deployment to Speedgoat HIL simulators. 

 

Product Highlights

 

The Authors

 

Chirag Patel

Chirag Patel
MathWorks Application​ Engineer

Pablo Romero

Pablo Romero
MathWorks Application​ Engineer

Daniel Hediger

Daniel Hediger
Application Engineer

Daniel Fonte

Daniel Fonte
Head of Application Engineering

 

Related Content