# Calibrating Optimal PMSM Torque Control with Field-Weakening Using Model-Based Calibration

By Dakai Hu, MathWorks

Permanent magnet synchronous motor (PMSM) calibration is an indispensable step in the design of high-performance electric traction drive controls. Traditionally, the calibration process involves extensive hardware dynamometer (dyno) testing and data processing, and its accuracy depends largely on the expertise of the calibration engineer.

Model-based calibration standardizes the PMSM calibration process, reduces unnecessary testing, and generates consistent results. It is an industry-proven, automated workflow that uses statistical modeling and numeric optimization to optimally calibrate complex nonlinear systems. It can be used in a wide range of applications and is well known for being adopted in internal combustion engine control calibration. When applied to e-motor control calibration, the model-based calibration workflow can help motor control engineers achieve optimal torque and field-weakening control for PMSMs.

## PMSM Characterization and Calibration: Challenges and Requirements

PMSMs stand out from other types of e-motors because of their high efficiency and torque density. This is because the permanent magnets inside the machine can generate substantial air gap magnetic flux without external excitation. This special trait makes a PMSM an excellent candidate for both non-traction and traction motor drive applications.

Most non-traction PMSM applications only require the machine to operate in the constant torque region, where its control scheme is relatively straightforward. Traction PMSM control, in addition to fast dynamic response, also requires accurate torque output and wide constant power-speed range operation. To achieve these control goals, particularly in an electric or hybrid electric vehicle, the traction PMSM must operate in the *field-weakening* region, where tradeoffs need to be made between torque, speed, and efficiency.

A huge part of designing a high-performance field-weakening control algorithm is calibrating the field-weakening control lookup tables. Before generating the table data, PMSM characterization tests often need to be performed either using a dyno setup or through an FEA tool like ANSYS Maxwell or JSOL JMAG.

After PMSM characterization testing, flux linkage tables and measured torque at different current and speed operating points can be obtained. Here we need to distinguish PMSM *characterization* from *calibration*. PMSM characterization involves performing a series of tests either on a dyno or using an FEA tool, with the goal of extracting important machine information, such as flux linkage and torque. PMSM control calibration involves calculating controller lookup tables that will generate maximum torque or optimal efficiency at different operating points. The control calibration process usually happens after PMSM characterization. Both processes are required for high-performance PMSM control design.

## The Model-Based Calibration Workflow

When applied to PMSM control calibration, the model-based calibration workflow usually involves four steps (Figure 1):

- Design the experiment for characterization.
- Preprocess the PMSM characterization dataset.
- Fit PMSM characterization models.
- Optimize PMSM controller lookup table data.

### 1. Designing the Experiment for Characterization

Full factorial characterization on a physical dyno is wasteful because it increases experiment time, cost, and maintenance. In model-based calibration, statistically spaced operating points are proposed as testing points. Whether the experiment is carried out on a physical dyno or in an FEA environment, the generated testing points of current id and iq will be given as control commands and the PMSM speed will be regulated by the dyno machine or set in the FEA tool. Using a virtual dyno requires a detailed PMSM FEA model. However, once the model is created, it can be tested over a more comprehensive set of operating points without incurring additional cost overhead.

### 2. Preprocessing the PMSM Characterization Dataset

During PMSM characterization, torque and dq-axis flux linkage data is either directly measured on a dyno or derived from an FEA tool for each operating point of id, iq, and speed. After characterization, the dataset is rearranged by torque contours and speed steps, and each variable (for example, torque) is stored in a single-column format, which is then imported into Model-Based Calibration Toolbox™ (Figure 2). If necessary, additional analysis can be performed to remove outlying data. Outliers are common during physical testing due to noise and measurement error.

### 3. Fitting PMSM Characterization Models

Model fitting is a crucial part of the model-based calibration workflow. (Note that the models referred to in this article are not electric motor or controller models; they are *statistical* models in which functions such as Gaussian process regression or radial basis function represent the relationship between variables in the imported dataset.) Specifically, two sets of models are created: iq as a function of id and torque, and voltage margin as a function of id and torque. Each is modeled at a common set of motor speeds. These speeds are used as breakpoints for the final controller lookup table. Figure 3 shows models grouped by two speed operating points:1000 rpm and 5000 rpm.

Both iq and voltage margin models vary based on speed operating points, as speed can directly affect the boundary of operation. It is impossible to exactly represent the operation boundary from a finite number of characterized data points. The actual operation boundaries for the PMSM under calibration are often imposed by external limiting factors such as the thermal limit of the drive system and the DC bus voltage level of the inverter.

In model-based calibration, the operation boundaries of fitted models are approximated by the convex hulls enclosing the dataset, as depicted by the edges of colored surfaces in Figure 3. These boundaries are important for step 4 of the calibration workflow, since they are used as constraints for the optimization problem.

### 4. Optimizing PMSM Controller Lookup Table Data

In model-based calibration, the process of running optimization routines and generating the final calibration lookup tables is performed using CAGE, the calibration generation tool in Model-Based Calibration Toolbox. In CAGE, the models from step 3 are used either for objective function models or as constraints. For example, the voltage margin models are used as voltage constraints at different speeds to guarantee that the overall modulation voltage does not exceed the maximum imposed by the DC bus voltage. In addition to constraints, single or multiple objectives can also be set up based on these fitted models.

A common objective for optimized field-weakening control is to maximize the PMSM’s efficiency while reaching the required torque. This is achieved by setting up torque-per-ampere (TPA) as the target to maximize and simultaneously enforce current and voltage constraints. The result is an optimized operation region that covers maximum torque per ampere (MTPA), maximum torque per volt (MPTV), and operation points in between.

Figure 4 shows how an optimized operation point in the lookup table is obtained through the CAGE process. The light blue and yellow shaded areas represent the corresponding current and voltage constraints at a specific speed operating point, with the green area being the viable region satisfying both constraints. The torque contour in the plot represents a specific torque requirement. To achieve maximum efficiency control for the PMSM, the optimizer in CAGE searches along the torque contour inside the viable region to find a point that maximizes the TPA target. As a result, in the example shown in Figure 4, point A will be chosen as the optimum. The other optimized lookup table points in Figure 4 are calculated by the same routine in CAGE.

You can accelerate the optimization routine described above by running it with Parallel Computing Toolbox™. With parallel computing enabled, the entire workflow converges in under 10 minutes on a typical four-core PC.

After running the optimization routine, you can fill in the final calibration lookup tables by the optimization results through various filling methods, such as interpolation or clipping. In theory, you can choose any torque and speed breakpoints for the lookup table, but a common choice of breakpoints for torque is the percentage of maximum torque. Choosing torque percentage of maximum achievable torque rather than absolute torque values ensures that the entire lookup table can be filled with valid optimization results (Figure 5).

## Extending the Workflow

This article covered the basic model-based calibration workflow for the generation of optimal PMSM torque control lookup tables with field-weakening. The example described in the article is based on field-weakening control tables where torque command, speed, and possibly DC bus voltage are inputs.

For an algorithm that uses torque command and maximum flux linkage as inputs to its lookup tables, the workflow is the same, only with slightly different function models. In addition, if your application requires a more accurate and refined calibration, you can consider more variables, such as inverter voltage drop, core loss, AC resistance, and windage or friction, during the model fitting and CAGE process.

Published 2020