MBD Motor Control
MBD Motor Control
MBD Motor Control
MS-2577
.
www.analog.com
Page 1 of 4 ©2013 Analog Devices, Inc. All rights reserved.
MS-2577 Technical Article
from more classical design schemes and move directly from architecture can be setup for deployment of both specific
model creation to simulation, code generation, and HIL test algorithm and functionality of the overall system
in a controlled fashion that allows incremental changes in (see Figure 4).
system behavior without a complete redesign of the system.
Page 2 of 4
Technical Article MS-2577
selection of system parameters, resulting in best-in-class
flexibility where specific optimization is needed. In this way,
a scalable model of a system has been realized that facilitates
use and reuse of code, either based on existing legacy code
or functions, or complete new building blocks based on
standard C or graphical functionality (Simulink/MATLAB
models aligned with the complete simulation and
deployment phase). Not only from the software perspective
is it possible to change the overall setup, but also once the
right device drivers for a system are developed, a designer Figure 7. Sketch of a “Drive System”
can change system resources, hardware elements, and overall Through the MBD design flow, and via MathWorks and
applications software for the end application or system. In IAR, the implementation of an overall model and the
addition, given the ability to control the real-time aspects of compilation of code are now possible. Each of the stages or
the overall system timing, optimization of system scheduling elements in the model of the “Drive System” is now
is possible directly through this environment. represented by a MATLAB and Simulink model that is
scaled at the right level for optimal design criteria. Each of
the elements in the model is based on standard toolboxes
and blocksets from MathWorks and can be reused across any
element in a particular design. These elements also represent
the different domains of the drive system and can be fine-
tuned to fully minimize the model vs. deployment error.
Through real-time deployment methods and compilation in
this mixed environment, it is also possible to combine
existing C code written by hand with ARM Cortex-M4
optimized C code generated by Embedded Coder®, the
production code generation tool for MATLAB and Simulink.
This entire process allows users to reuse existing knowledge
of motor control design at the right level. At this point, the
IAR Embedded Work Bench can take the generated code
and compile the complete project for ARM Cortex-M4,
which closes the MBD implementation phase for this
Figure 6. Deployment Environment system.
Taking a deeper look at the classic sketch of a drive system,
one can now visualize the capability of this architecture. It is
possible to optimize each of the elements in the “Drive” and
focus effort on what element is most critical to the end
system. This means that, for example, if protection
functionality and scale is of key importance, then the focus
can be placed on the mechanical system in combination with
the electrical control and power system. A mix of simulated
results and real-time data can be used for monitoring system
behavior, and together forms a “Live” optimization. On the
other hand, if noise disturbances decrease the overall
Figure 8. Implementation and Compilation
efficiency level of the system, measurements of these can be
used in scalable filters and observers, which minimize the Since its inception, MBD has been questioned on its
hardware’s noise issues to give an optimal state. Once all capability and functionality relative to traditional system
factors have been modeled and gathered, the final step in the development and on its efficient use of overall system
deployment phase can begin and a complete implementation resources. This is where strong efforts from component
phase on the target system becomes a reality. suppliers, simulation and deployment vendors, and tools
complier providers have “merged,” and results today are
comparable to traditional deployment methods. Of course,
Page 3 of 4
MS-2577 Technical Article
any code development written for a real-time system can be simulation results and real-time data can now be evaluated
created in an inefficient way, depending on the and compared with ideal system functionality in relation to
implementation method used. With MBD, profiling, the target specification. This ultimately enables a designer to
crossoptimization options and strong advantages in safety constantly improve system efficiency, functionality, and
critical system development can be combined, so that code performance, and to evaluate how a given element or
development overheads are minimized and highest component in the signal chain is performing against
performance results are achieved. MathWorks offers tool specification.
qualification for use of Embedded Coder with IEC 61508, This paper has described a “new” way of architecting a
ISO 26262, and related functional safety standards. motor control system with the use of MBD. Today’s
This mix of capability is much more difficult to achieve in a embedded processors must have the balance of performance,
standard design flow. In Figure 9, a standard FOC model is cost, and size to allow development and higher level
implemented on Analog Devices’ ADSP-CM40x series. In abstractions of graphical tools, so forming the basis for
this model, position and current loop feedback are executing highly optimized systems embracing time to market, safety,
in 15 µs, supporting real-time profiling of both the current performance, and scalability. For more information on these
scheme and debug facility. It also allows tracking topics and Analog Devices’ capability, please go to
functionality of the overall FOC scheme. Both MBD motorcontrol.analog.com.
Figure 9. Simulation and Run-Time Data from Model-Based Design Build System (Processor Data vs. Simulation)
RESOURCES
Page 4 of 4