Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using...
Transcript of Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using...
![Page 1: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/1.jpg)
Spinning Brushless Motors with SimulinkPresenter Name
![Page 2: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/2.jpg)
We will spin a brushless motor using Simulink and Model-Based
Design
2
![Page 3: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/3.jpg)
Brushless motors are everywhere
3
![Page 4: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/4.jpg)
Developing embedded motor control software has its challenges
![Page 5: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/5.jpg)
Developing embedded motor control software has its challenges
▪ Design work needed to be started before
motor hardware was available and needed
extensive testing to comply with standards
▪ Team needed to rapidly implement control
software on embedded processor once more
hardware became available
▪ Complex algorithms running at high sample
rates were difficult to implement in short
amount of time
![Page 6: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/6.jpg)
Why Simulink for motor control?
6
Customers routinely
report 50% faster
time to market
▪ Verify control algorithm with desktop
simulation
▪ Generate compact and fast code from models
▪ Minimize development time using reference
examples
![Page 7: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/7.jpg)
Motor Control Blockset simplifies the workflow
▪ Control blocks optimized for code
generation
▪ Sensor decoders and observers
▪ Motor parameter estimation
▪ Controller autotuning
▪ Reference examples
7
![Page 8: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/8.jpg)
Brushless motors require complex algorithms – field-oriented
control
8
Speed
Controller
Current
Reference
Generator
Current
Controller
Space
Vector
Generator
Power
Inverter
Voltage
Supply
PMSMPark, Clarke Transforms
Sensor
decoders or
observers
Control algorithm
Physical system
𝑖𝑎
𝑖𝑏
𝑖𝑑
𝑖𝑞
𝜔𝑟𝑒𝑓 𝑇𝑟𝑒𝑓
𝜔
𝑣𝐷𝐶
𝜃𝑒
𝑖𝑑_𝑟𝑒𝑓
𝑖𝑞_𝑟𝑒𝑓
𝑣𝑑_𝑟𝑒𝑓
𝑣𝑞_𝑟𝑒𝑓
𝑣𝛼_𝑟𝑒𝑓
𝑣𝛽_𝑟𝑒𝑓
d,q
a,b
Inverse Park Transform
d,q
α,β
𝑑𝑢𝑡𝑦𝑐𝑦𝑐𝑙𝑒𝑠
![Page 9: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/9.jpg)
Workflow for implementing field-oriented control
Calibrate
Sensors
Estimate
Motor Parameters
Model
Motor & Inverter
Design
Control Algorithm
Deploy &
Validate
![Page 10: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/10.jpg)
We will use Texas Instruments motor control kit
10
Teknic 2310P
surface-mount PMSM
TMS320F28379D
MCU
DRV8305 3-phase
inverter
![Page 11: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/11.jpg)
Sensor calibration
▪ Calibrate ADC offsets
11
![Page 12: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/12.jpg)
Sensor calibration
▪ Calibrate ADC offsets
▪ Calibrate position sensor
offset
12
![Page 13: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/13.jpg)
Parameter estimation
▪ Instrumented tests running
on the target
▪ Host model to start and
control parameter estimation
13
![Page 14: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/14.jpg)
Bonus: you can use other techniques to parameterize motor models
14
From datasheet From ANSYS Maxwell,
JMAG, Motor-CAD FEA tools
From dyno data
Simscape Electrical Simscape Electrical Powertrain Blockset
![Page 15: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/15.jpg)
Modeling motor and inverter
▪ Use linear lumped-parameter
motor model
▪ Model inverter as an
average-value inverter or
model switching with
Simscape Electrical
15
![Page 16: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/16.jpg)
Bonus: you can model at needed level of fidelity
16
Motor Control Blockset
Simscape Electrical
Simscape Electrical Simscape Electrical
![Page 17: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/17.jpg)
Control algorithm design
▪ Model field-oriented control
algorithm
▪ Model sensor decoders or
sensorless observers
▪ Tune loop gains
▪ Verify in closed-loop
simulation
17
![Page 18: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/18.jpg)
Control algorithm design
▪ Model field-oriented control
algorithm
▪ Model sensor decoders or
sensorless observers
▪ Tune loop gains
▪ Verify in closed-loop
simulation
18
Control System Toolbox
![Page 19: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/19.jpg)
Bonus: you can use several techniques to tune loop gains
19
Empirical Computation FOC Autotuner Classic Control Theory
Motor Control Blockset Motor Control Blockset and
Simulink Control Design
Simulink Control Design
![Page 20: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/20.jpg)
Control algorithm design
▪ Model field-oriented control
algorithm
▪ Model sensor decoders or
sensorless observers
▪ Tune loop gains
▪ Verify in closed-loop
simulation
20
![Page 21: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/21.jpg)
Deployment
▪ Target any processor with
ANSI C code
▪ Use provided example to
partition the model into
algorithmic and
hardware-specific parts
▪ Generate algorithmic
code for integration into
embedded application
21
Algorithmic Code
![Page 22: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/22.jpg)
Deployment
▪ Generate code (floating and
fixed-point)
▪ Use host model to control and
debug
▪ Validate on hardware
22
![Page 23: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/23.jpg)
You can verify and profile code using Processor-In-the-Loop testing
23
![Page 24: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/24.jpg)
Bonus: you can target FPGAs as well
24
HDL Code Generation
![Page 25: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/25.jpg)
Workflow for implementing field-oriented control
Calibrate
Sensors
Estimate
Motor Parameters
Model
Motor & Inverter
Design
Control Algorithm
Deploy &
Validate
![Page 26: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/26.jpg)
Challenge
Develop control software to maximize the efficiency
and performance of a permanent magnet
synchronous motor
Solution
Use MathWorks tools for Model-Based Design to
model, simulate, and implement the control system
on a target processor
Results
▪ Development time cut in half
▪ Design reviews simplified
▪ Target verification and deployment accelerated
“MathWorks tools enabled us to verify the quality of our design at
multiple stages of development, and to produce a high-quality
component within a short time frame.”
- Markus Schertler, ATB Technologies
Link to user story
ATB Technologies permanent magnet
synchronous motor.
ATB Technologies cuts electric motor controller development time
by 50% using code generation for TI’s C2000 MCU
![Page 27: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/27.jpg)
Use Model-Based Design for your next motor control project!
27
▪ Verify control algorithm with desktop
simulation
▪ Generate compact and fast code from models
▪ Minimize development time using reference
examples, built-in algorithmic blocks,
automated parameter estimation, and gain-
tuning
![Page 28: Spinning Brushless Motors with Simulink - MATLAB EXPO...We will spin a brushless motor using Simulink and Model-Based Design 2 Brushless motors are everywhere 3 Developing embedded](https://reader033.fdocuments.in/reader033/viewer/2022060921/60ad5674bb7ca83a0b029af8/html5/thumbnails/28.jpg)
Learn More
▪ Visit mathworks.com/products/motor-control
and mathworks.com/solutions/power-
electronics-control
▪ Attend other talks in Power Electronics track
▪ Get power electronics control design trial
package with necessary tools for desktop
modeling, simulation, control design, and
production code generation of your next
motor control project