hardware and software co-design for motor control applications€¦ · hardware and software...

39
1 © 2015 The MathWorks, Inc. Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer, MathWorks

Upload: others

Post on 22-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

1© 2015 The MathWorks, Inc.

Hardware and Software Co-Design

for Motor Control Applications

GianCarlo Pacitti

Senior Application Engineer, MathWorks

Page 2: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

2

Agenda

▪ Why use Hardware and Software for motor

control?

▪ Why use Model-Based Design for motor control?

▪ How to use Model-Based Design for motor

control?

Page 3: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

3

Load motor

Motor under test

(with encoder)

ZedBoard

FMC module:

control board +

low-voltage board

Mechanical

coupler

Zynq SoC (XC7Z020)

Page 4: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

4

Key trend: Increasing demands from motor drives

▪ Increased performance targets

require advanced algorithms

▪ Advanced algorithms require faster

computing performance.

– Field-Oriented Control

– Sensorless motor control

– Vibration detection and suppression

– Multi-axis control

Page 5: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

5

Where are algorithms being run to gain performance?

▪ Multi-core microprocessors

▪ Multi-processor systems

▪ FPGAs

▪ ASICs

▪ System-on-Chip devices (SoCs)

▪ GPUs*

▪ Hardware and Software algorithms must be designed together

*particularly for vision applications

Page 6: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

6

Punch Powertrain develops complex SoC-based motor

control

▪ Powertrains for hybrid and electric vehicles

▪ Need to increase power density and efficiency at

a reduced cost

– Integrate motor and power electronics in the transmission

▪ New switched reluctance motor

– Fast: 2x the speed of their previous motor

▪ Target to a Xilinx® Zynq® SoC 7045 device

– Complex: 4 different control strategies

▪ Needed to get to market quickly

▪ No experience designing FPGAs!

✓ Designed integrated E-drive: Motor, power electronics

and software

✓ 4 different control strategies implemented

✓ Done in 1.5 years with 2FTE’s

✓ Models reusable for production

✓ Smooth integration and validation due to development

process – thorough validation before electronics are

produced and put in the testbench

Link to video

Page 7: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

7

What’s Inside an FPGA SoC?

Page 8: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

8

Why use Hardware and Software for Motor Control?

▪ In order to meet increased performance

▪ You need more complex algorithms

▪ Running on the right hardware

Page 9: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

9

▪ Why use Hardware and Software for motor

control?

▪ Why use Model-Based Design for motor control?

▪ How to use Model-Based Design for motor

control?

Page 10: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

10

Challenges in Developing Advanced Motor Control Algorithms

▪ Integration requires collaboration

▪ Validation of design specifications with limits on access to test hardware

▪ How to make design decisions?

Page 11: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

11

Why use Model-Based Design to Develop Motor Control

Applications?

▪ Enables early validation of specifications using simulation months before

hardware is available.

▪ Dramatically improves design team collaboration and designer productivity

by using a single design environment.

▪ Reduces hardware testing time by 5x by shifting design from lab to the

desktop

Page 12: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

12

Components of Motor Control Production Applications

ARM

Programmable Logic

Production

System

Code

AXI Bus

IP1AXI

Interface

Algorithm

HDL

Linux

Driver

Algorithm

C

IP2

IP3

SystemMotor

Page 13: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

13

ARM

Programmable Logic

From Simulation to Production

ProductionSimulation

Simulink

Embedded Coder

HDL Coder

Algorithm

Model

Algorithm

Model

System

Code

AXI Bus

IP1AXI

Interface

Algorithm

HDL

Linux

Driver

Algorithm

C

IP2

IP3

Motor

ModelSystemMotor

Page 14: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

14

From Simulation to Prototype to Production

Production

Programmable

Logic

Prototype

ARM core

Simulation

Simulink

Embedded Coder

HDL Coder

AXI

Interface

Algorithm

Model

Algorithm

Model

Linux

Driver

AXI Bus

Motor

ModelSystem

ARM core

System

Code

VivadoAlgorithm

C

Programmable Logic

VivadoAlgorithm

HDL

AXI Bus

IP1AXI

Interface

Algorithm

HDL

Linux

Driver

Algorithm

C

IP2

IP3

MotorMotor

Page 15: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

15

▪ Why use Hardware and Software for motor

control?

▪ Why use Model-Based Design for motor control?

▪ How to use Model-Based Design for motor

control?

Page 16: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

16

Load motor

Motor under test

(with encoder)

ZedBoard

FMC module:

control board +

low-voltage board

Mechanical

coupler

Zynq SoC (XC7Z020)

Page 17: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

17

Embedded System

SoC

Hard Processor

Linux / VxWorks

Reference

Framework

Programmable

Logic

Reference

Framework

System Simulation Test Bench

Conceptual workflow targeting hardware and software

Model of

Motor &

Dyno

Motor &

Dyno

Hardware

SoC

Programmable

Logic

Algorithm

HDL

Code

Algorithm

C

Code

Algorithm

C

Model

Algorithm

HDL

Model

Algorithm

developer

Hardware

designer

Embedded

software

engineer

Page 18: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

18

Page 19: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

19

Building a System Simulation Test Bench

▪ How do I get a good model of the motor?

▪ How can I make sure it matches real-world behaviour?

System Simulation Test Bench

Model of

Motor &

Dyno

Algorithm

C

Model

Algorithm

HDL

Model

Algorithm

developer

Page 20: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

20

What’s Inside a Motor Model?

Page 21: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

21

What’s Inside a Motor Model?

Page 22: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

22

What’s Inside a Motor Model?

Page 23: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

23

What’s Inside a Motor Model?

Page 24: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

24

What’s Inside a Motor Model?

▪ How can we find the parameters we

need for the model?

Page 25: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

25

How to Find the Right Motor Parameters?

▪ Ask the motor designer

▪ From manufacturer’s data sheets

▪ From direct bench-top measurements or test data

Page 26: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

26

Modelling a PMSM with limited supplier data

Tune to measurement data – Step 1

Locked rotor

Step voltage test

R=V/I

L=R*tc

tc

Page 27: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

27

Modelling a PMSM with limited supplier data

Tune to measurement data – Step 2 𝑲𝒕𝝎

Back EMF test

Page 28: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

28

Modelling a PMSM with limited supplier data

Tune to measurement data – Step 3

Friction Damping

coefficient

= gradient

Page 29: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

29

Modelling a PMSM with limited supplier data

Tune to measurement data – Step 4

Speed run-down testInertia =

Torque/gradient

Page 30: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

30

Estimating Parameters from measured data using Simulink

Design Optimization

▪ Use simulation-based

optimisation

– match model parameters to

real-world data

Page 31: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

31

Adding Implementation Detail to Algorithms

▪ Which parts of my algorithm should be implemented in C, and which in HDL?

System Simulation Test Bench

Model of

Motor &

Dyno

Algorithm

C

Model

Algorithm

HDL

Model

Algorithm

developer

Page 32: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

32

Strategies for Partitioning an Algorithm Between Hardware

and Software

▪ Use experience

– some timing requirements are known e.g. current control @25kHz

▪ Put everything on the software core and profile it

– where are the bottlenecks?

– Can these be moved to hardware?

▪ Put algorithms where the data comes in

– minimise data transfer

▪ Monitor resource usage and move things when you are near the limit

Page 33: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

33

Hardware/Software Partitioning

Target to ARM

Target to

Programmable

Logic

Page 34: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

34

Floating-point to fixed-point conversion

▪ Is it always necessary?

▪ Possibly, to meet resource constraints on the

hardware

▪ Fixed-Point Designer™ helps automate the

conversion process

▪ HDL Coder™ native floating-point technology

can generate HDL code from your floating-

point design

Page 35: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

35

Code Generation

Page 36: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

36

Zynq Model-Based Design Workflow

HDL IP Core

Generation

MATLAB® and Simulink®

Algorithm and System Design

Vivado

Integration

SW Interface

Model Generation

Zynq Platform

SW BuildFPGA Bitstream

External Mode

PIL

▪ Real-time Parameter

Tuning and Verification

– External Mode

– Processor-in-the-loop

▪ More probe and debug

capability in the future

Page 37: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

37

ti

Page 38: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

38

▪ Why use Hardware and Software for motor

control?

▪ Why use Model-Based Design for motor control?

▪ How to use Model-Based Design for motor

control?

Page 39: Hardware and Software Co-Design for Motor Control Applications€¦ · Hardware and Software Co-Design for Motor Control Applications GianCarlo Pacitti Senior Application Engineer,

39

Why use Model-Based Design to develop motor control

applications?

▪ Enables early validation of specifications using simulation months before

hardware is available.

▪ Dramatically improves design team collaboration and designer productivity

by using a single design environment.

▪ Reduces hardware testing time by 5x by shifting design from lab to the

desktop