Published on March 5, 2014
The World Leader in High Performance Signal Processing Solutions Model-Based Design For Motor Control Development Paul Crook – Analog Devices
Topics Developing motor control applications using modelbased design and automatic code generation Hardware platform Model-Based Design overview Modeling of motor control systems Simulation and automatic code generation Running generic C-code on embedded platform When to use MBD and when to use “traditional” design methods 2
ADI Demo Platforms Motor Drive hardware 3 phase PM motor PC with MATLAB®, Simulink®, and IAR Embedded Workbench 3
HW Platform 100V-250V AC input with PFC, 5A Isolated current, position, voltage and diagnostic feedback 3-phase, 0.55kW, permanent magnet synchronous motor 4
ADSP-CM40x Embedded Target Key Points ARM CORTEX M4F 240MHz Two 16-bit ADCs 380ns conversion time SINC filter 384kB SRAM 2MB Flash 20 DMA channels Peripherals for motor control Communication interfaces 5
MODEL-BASED DESIGN 6
Why Model-Based Design? • • • • 7 Requirements Development System Simulation Automatic Code Generation Continuous Verification
The Traditional Design Process Requirements Phase Design Phase Realization Phase Testing Phase 8
Traditional Design of a Multi-Domain System Research & Requirements Hardware Software Mechanical Requirements Requirements Requirements Design Design Design Realization Realization Realization Testing Testing Testing Integration, Test & Certification 9
The Cost of a Traditional Design Process Source: ROI for IV&V, NASA 10
Model-Based Design RESEARCH • Model multi-domain systems REQUIREMENTS • Explore and optimize system behavior in floating point and fixed point DESIGN Environment Models Algorithms IMPLEMENTATION TEST & VERIFICATION Physical Components • Collaborate across teams and continents • Generate efficient code • Explore and optimize implementation tradeoffs C, C++ ARM • Automate regression testing • Detect design errors • Parameter tuning INTEGRATION 11 • Support certification and standards
Model-Based Design for Embedded System Development Executable models - Unambiguous -“One Truth” Executable Specifications Simulation - Reduces “real” prototypes - Iterative “what-if” analysis Design with Simulation Models Continuous Test and Verification Automatic Code Generation Automatic code generation 12 - Minimizes coding errors Test with Design - Detects errors earlier
Steps in MBD approach 1. Plant modeling - Motor, load, power electronics etc. 2. Interface modeling - Sensors, device drivers 3. Controller modeling - Field oriented control of 3 phase PM motor 4. Analysis and synthesis - The models created in step 1-3 are used to identify dynamic characteristics of the plant model. - Tuning and configuration of system 5. Validation and test - Offline simulation and/or real-time simulation - Time response of the dynamic system is investigated 6. Deployment to embedded target - Automatic code generation - Test and verification 13
Steps in MBD approach System Model Test Signals Controller Model Motor/inverter Model Verify PC Code Generation System Embedded Controller Motor/inverter Target HW Motor Drive System Simulation of Controller and Plant model Off-line development of algorithms without access to HW Code generation and deployment to embedded controller Comparison between simulation and actual implementation 14
Model complexity What is a good model? Represent the states of interest Supports automatic code generation Execute fast Use existing (trusted) libraries Reusable across platforms Right balance Too little 5 15 ? Too much
Model complexity Understanding strengths and weaknesses of tools is critical when defining model scope Strength Weakness 16 - Solving differential equation - Time domain modeling - Visualization - Target specific setup - Managing system resources - Time scheduling - Register setup and control - Managing System resources - Time scheduling - Real time control systems - Debugging and test - Visualization
Interfacing to Embedded Target SW architecture C-code needs to be tied to embedded platform Utilizing strength of multiple environments Graphical environment for application code development “Classic” C-code for target specific control Platform independent Generic Control Algorithm Platform dependent HW interface layer Embedded Platform 17
Interfacing Embedded Target Two platforms – one implementation Common control algorithm for Simulation and Embedded system Platform specific device drivers or behavioral models Debug algorithm using simulation and test on embedded platform 18
Drive system feedback and control Feedback 19
Motor Control Application Program Power Inverter and Motor Device Driver Auto code MC Algorithm MC Application Firmware 20 MC „C‟ code CC & Link Device drivers Application code Sensors, interfaces and Device Drivers
AC Motor Algorithm (Field Oriented Control) 21 Shaft position sensor measures rotor magnet (flux) position – velocity is calculated. Two/three motor currents measured (two is enough). Clarke-Park transfer calculate Torque (Iq) and Flux (Id) components of current. Speed loop generates Iq reference; Id reference set to zero for PMSM. Current loops and Field alignment generates a,b,c voltage commands.
Field oriented control 22
Simulation Simulink scopes Code debugging Data analysis in MATLAB Magnitude [dB] 0 -50 -100 -150 -200 -250 0 1000 2000 3000 Frequency [kHz] 4000 5000 0 1000 2000 3000 Frequency [kHz] 4000 5000 Phase [Degrees] 0 -1000 -2000 -3000 23
Generating C-code 24
Building and Linking – IAR EWB 25
Building and Linking ARM Library Motor Control - M3/M4 support - FOC functions Matlab/Simulink Legacy code Device Drivers - Existing code - Functional model C-code Device drivers System resources - SW enablement package - Allocation & setup C-code Workbench Application code - State machines Scheduling Executable CM40x 26 C-code - IRQs/RTOS
Running target MATLAB GUI + embedded engine Streaming data back to MATLAB Captured runtime data Duty-cycle 1000 500 0 -500 -1000 Phase current 4 0 20 40 60 80 100 120 140 160 180 200 0 20 40 60 80 100 120 140 160 180 200 0 20 40 60 80 100 120 Sample number 140 160 180 200 x 10 4 3.5 3 2.5 Rotor angle 8 6 4 2 0 27
Sampling domains 10 kHz 1 kHz 28
Summary Model-Based Design System modeling and simulation Automatic code generation Modeling of motor control systems Electronics/mechanical Interfaces Control algorithm Interfacing generic C-code to embedded target Use of different environments Device drivers Debugging Off-line In 29 real-time and test
-Based Design of Advanced Motor Control ... engineers to use standard model -based design with ... o Development of models of motor, ...
Join | Tweet | Connect. Model-Based Design Streamlines Embedded Motor Control System Development. by Dara O’Sullivan, Jens Sorensen, Aengus Murray, A
Welcome to the Model Based Software Design Tools community area. ... Motor Control Development Toolbox: Example Models Items tagged with ...
Lecture 3 - Model-based Control ... Development steps • Model-based design ... System development cycle Ford Motor Company.
Model-Based Design for Embedded System Development 12 Design Continuous with Test and Simulation Verification ExecutableExecutable SpecificationsSpecifications
Kevin J. Rzemien is a principal technical consultant with over 25 years’ experience using Model-Based Design to develop embedded control systems for use ...
Beyond Bits Motor Control Edition Model-based design ... motor controller algorithms with ... Model-Based Development Steps Motor Control Development Toolbox
Model-Based Design is an efficient and ... their design and development efficiency. Model-Based Design ... Model-Based Design of Control ...
Model-Based Design of control systems: Simulate ... motor and/or machine itself. Model-Based Design benefits in control systems. Model-Based Design ...