Sunday, April 14, 2024

How Model-Based Design And Other Software Toolboxes Can Help You Accelerate EV Motor Control Design

A groundbreaking technology that could revolutionise the renewable energy sector, offering new hope for a sustainable future.

A motor controller is a crucial element of an electric vehicle and is increasingly sought to be indigenously developed or sourced by electric 2W and 3W OEMs in India to comply with localisation norms associated with government regulations and incentive schemes. The motor controller firmware can be a differentiating factor for the rider experience and, as such, offers scope for innovation for startups and established teams alike. This article discusses some key challenges for developers of motor controllers and offers thoughts on mitigating them.

The motor controller is also referred to as a traction ‘inverter’ since it converts between DC and AC to control the motor. Some key functions of the motor controller include:

  • Delivering torque in a smooth and efficient manner
  • Controlling regenerative braking to extend driving range
  • Offering drive modes tailored for different scenarios, such as maximum range and maximum speed

Important considerations for evaluating motor controllers include performance, efficiency, and functional safety. Performance determines the vehicle driving experience, while efficiency has an impact on vehicle range and cost. Additionally, the motor controller is safety-critical since a malfunction with the system could result in a hazard. Thus, the motor controller functions are usually associated with corresponding ASIL-rated safety requirements as per ISO 26262.

If we simplify it, the motor controller fundamentally converts electrical energy to mechanical energy as shown in Fig. 1.

- Advertisement -
Fig. 1: A simple view of a typical electric 2W/3W motor controller

A powerful, safety microcontroller is at the heart of the motor controller. The application-level firmware on the microcontroller implements a control process for motor control. A popular method for controlling BLDC and PMSM motors is field-oriented control (FOC), which offers the ability to deliver smooth torque with high efficiency and at high speeds—key attributes for an EV. FOC requires feedback from current and position sensors, and here, developers need to carefully consider various trade-offs associated with sensor options. Table 1 captures some key considerations for common types of sensors.

Table 1: Top-level comparison of common sensor types used in electric 2W/3W motor controllers
Current SensorPrecisionRobustnessCostIsolation
HallLowerHigherHigherGalvanic isolation
ShuntHigherLower (drift, temperature sensitivity)LowerNo isolation
Position SensorPrecisionRobustnessCostSpace
ResolverHigherLowerHigherBigger
EncoderLowerHigherLowerSmaller
HallLowerHigherLowerSmaller

The control process sends commands to the power inverter stage of the motor controller, based on feedback signals that typically comprise inputs from current sensors and position sensors. Typically, motor controllers for electric 2W and 3W target a switching frequency of 10kHz to 20kHz, and this means the control process for motor control must execute as fast as once every 50µs.

Fig. 2: Model-based design flow that enables rapid prototyping of motor control application

One of the key challenges with developing a motor controller can be the complexity associated with the real-time control process and its associated application-level firmware development. This challenge can be broken down into a few specific problem statements under the overarching constraint of developing an optimised motor controller with very limited R&D resources and a fast time to market:

- Advertisement -
  • Developing a motor control process algorithm
  • Translating the motor control process algorithm into executable firmware on the microcontroller
  • Calibrating and fine-tuning the control process algorithm to suit the target motor.

In this article, we will explore how model-based design (MBD), automotive math, and motor control libraries, along with real-time debug tools, address these challenges and enable a fast time-to-market for startups and established teams alike. The key enabler for this framework is also adopting an automotive microcontroller that supports a modular firmware architecture based on the modern ARM architecture.

Fig. 3: Automotive math and motor control library can be crucial for accelerating time to market

Model-based design

Model-based design (MBD), which supports automatic code generation, enables rapid prototyping from idea incubation through to the final product. Robust support for MBD can be particularly useful for developing advanced features such as hill-hold and park-assist.

Automotive math and motor control libraries

A key step in translating the control process developed using MBD into executable firmware is the availability of automotive-quality math and motor control libraries. These perform best if available as bit-accurate models for the MBD toolbox and C-code for developers who prefer to develop and optimise their control process firmware in the microcontroller IDE. Ideally, the library is available in a hierarchical fashion, providing optimised functions not only for Park/Clark transformations but also for sine/cosine functions so that developers can have granular control over their control process and its optimisation.

Fig. 4: Real-time debug tools are vital for quick tuning of motor control algorithm to specific motor

Real-time debug tools for motor control

Motor controller developers will inevitably find the need to fine-tune their control process to suit specific motor types. It can take days to sometimes even weeks of bench-top effort to iteratively estimate optimised control loop parameters that are perfectly matched for the motor. Debugging can be cumbersome in this stage of development. Here, developers would do well to pay careful attention to the easy availability of real-time debug tools that provide the following key functions:

  • Run-time configuration and tuning of control processes in the application firmware
  • Graphical control panel with the ability to customise the user interface
  • Ability to read and display variables in real time
  • High-speed recorded data to simulate a digital oscilloscope
  • Real-time tuning for control processes such as current loop, speed loop, sensor/sensorless, etc
  • Support for expert modes such as the pole placement method for control parameter estimation
Fig. 5: A top-level view into a modern microcontroller software architecture in the context of electric 2W/3W motor control

Modern firmware architecture

Developers of motor controllers will benefit from adopting a modern firmware architecture that relies on automotive-quality, production-ready device drivers for the microcontroller. These drivers should be compatible with AUTOSAR and non-AUTOSAR, keeping both current and future needs in mind.

Overall development flow

Stitching it all together, Fig. 6 shows an overall development flow that is focused on maximising developer efficiency—providing the fastest path to market on the most optimised motor controller solution.

Fig. 6: An example of a seamless overall development flow for electric 2W/3W motor control

Development of motor controller firmware can be a daunting task at first. However, adopting a modern architecture and development framework that incorporates model-based design, automotive math, and motor control libraries, along with real-time debug tools, can ease the journey and significantly accelerate time to market for startups and established teams alike.

Fig. 7: A benchtop setup for 48V motor control that supports the model-based design

Narsimh Kamath is Business Development Manager – Electrification for India, Southeast Asia, and ANZ regions at NXP Semiconductors. He has previously served as Lead Systems Architect on a semiconductor system solution for EVs and holds multiple US patents

Mayur Bansal is Customer Application Engineer at NXP Semiconductors. He holds more than 8 years of experience in embedded systems and specialises in motor control application across industrial and EV segments

SHARE YOUR THOUGHTS & COMMENTS

Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators

×