Piecewise Afﬁne Magnetic Modeling of Permanent-Magnet Synchronous Machines for Virtual-Flux Control

: Accurate ﬂux linkage magnetic models are essential for virtual-ﬂux controllers in PMSMs. Flux linkage exhibits saturation and cross-saturation at high currents, introducing nonlinearities into the machine model. Virtual-ﬂux controllers regulate the ﬂux of a machine by using ﬁeld-oriented control, such as model predictive control. In this study, a methodology for creating a piecewise afﬁne ﬂux linkage magnetic model is proposed which locally linearizes the inductance and ﬂux offset of the machine. This method keeps the magnetic model and thus the state-space model of the system linear while capturing the saturation effects, enabling robust controls and efﬁcient operation. The model is created using FEA-simulated data points and veriﬁed with experimental datapoints. An algorithm to optimize the model in MTPA and derated operation is presented with an average ﬂux error less than 1% and maximum error less than 3% using only 40 points. This represents a ≈ 1–3% and ≈ 5–8% reduction in the average and maximum ﬂux errors compared with a regularly gridded model, respectively.


Introduction
Permanent magnet synchronous machines (PMSMs) are the machine of choice for high energy density applications due to their high efficiency and mechanical simplicity. The PMSM has seen widespread adoption in the automotive space [1,2], and is a promising candidate for more-electric and all-electric air propulsion drives [3,4].
The controller performance for a PMSM depends on the accuracy of the machine parameters, such as the stator inductances, stator resistance, and permanent magnet (PM) flux. These parameters can change in real time and have dependencies on the temperature, position, and current. The stator resistance increases nonlinearly with the temperature [5], the PM flux can decrease (demagnetize) at high temperatures [6], and the stator inductance saturates in high currents [7]. These variations are typically accounted for using online parameter estimation, offline parameter look-up tables (LUTs), or a combination of the two.
Online parameter estimation uses real-time feedback of the drive system to estimate the parameters. The feedback can include the current, voltage, speed, and position. Online parameter estimation methods include receding horizon estimation [8], recursive least squares [9], neural networks [10], and extended kalman filters [11].
The offline parameter LUTs use the data of the machine from analytical calculations [12], FEA analysis [6,13], and experimentation [14,15] (or any combination) to approximate the parameters given various operating points of the machine. The datapoints are interpolated in various ways to produce various desirable properties depending on the parameter and application.
Online parameter estimation requires more computation time than offline LUTs but is more accurate over the lifetime of the vehicle by detecting degradation and partial faults in the machine [9,11]. Online parameter estimation also requires either more sensors or sensorless techniques [16] than offline LUTs.
The focus of this study is the flux linkage magnetic model (MM) of the PMSM and the modeling of the stator inductance parameters. To build an offline MM, the current and flux values are processed offline, and continuous inductance functions are created using linear interpolation, Hermite spline interpolation [15,17,18], polynomials [13,19], piecewise nonlinear functions [14], nonlinear functions [12,20], or piecewise affine functions [21]. The results of these methods vary greatly in their properties, as summarized in Table 1 (the MM accuracy for the linearized inductance, spline-interpolated LUT, and piecewise linear methods is shown in Section 5). Model predictive control (MPC) is desirable for the PMSM for its stability and robustness properties [22,23]. A virtual-flux MPC (VF-MPC) is a type of VF control that requires a linear flux linkage MM to operate effectively. For this reason, typically, VF-MPC for the PMSM uses linearized stator inductances, which have the effect of linearizing the statespace equation. This greatly simplifies the model, reducing the control error and decreasing the computation time. However, this leads to a flux error of up to 30% in full saturation and 5-20% flux error due to cross-saturation [14,15,19,21].
In this study, we propose using piecewise affine (PWA) functions to build the MM of a PMSM machine. This MM allows for the use of VF-MPC while also taking into account the saturation and cross-saturation effects in the MM. The PWA MM is optimized for current operation, derated operation, and MTPA operation. The experimental flux is compared with the FEA-simulated flux to show the accuracy of the MM. This paper is organized as follows. The PMSM machine model is described in Section 2, and the construction of the PWA MM is shown in Section 3. The optimization of the PWA MM to the full current range, derated range, and MTPA range is presented in Section 4. Analysis via simulated and experimental results is presented in Section 5, and the paper is concluded in Section 6.

PMSM Model
The PMSM is a three-phase synchronous machine that can be dynamically described by the state-space model where λ d and λ q are the q-axis and d-axis stator flux linkages, respectively, u d and u q are the terminal voltages, i d and i q are the stator currents, ω is the electrical speed of the machine, R s is the stator resistance, and (·) is the d dt operator. This formulation makes use of the Parke-Clarke transformation, which is a linear transformation from a three-phase (three-dimensional) to a direct-quadrature (two-dimensional) space. The power-invariant Clark transform is used, and the magnetic axis of the PM is the reference angle for the d-axis in the Park transformation.
The compensated terminal voltagesū d andū q are the terminal voltages without the resistive voltage drop. The compensated terminal voltages are capable of including the inverter non-idealities, such as the switch's on-voltage drops and dead times [13,23]. The PWA formulation, presented later, is capable of including parameters not present, such as damper windings and zero-sequence currents, but they are omitted for simplicity. Additionally, position-dependent effects can be added to the PWA model as third, fourth, ...n th dimensions of the existing two-dimensional dq PWA model. This formulation is compatible with any PMSM machine, regardless of the salience ratio (IPMSM, SPMSM, etc.).
The torque of a PMSM is modelled as follows: where the number of pole pairs is p, i = [i d i q ] ∈ I is the current vector, λ = [λ d λ q ] ∈ Λ is the flux vector, and J is which is the cross-coupling matrix. The sets I and Λ describe the full operating current and flux range of the machine.
The relationship between the current i and flux λ is nonlinear. Cross-saturation makes the d-axis flux dependent on the d-axis current and q-axis current. The same holds for the q-axis flux. The functions f (i) and g(λ) model this relationship: The function f (i) is useful for calculating or estimating the flux of the machine λ given the feedback currents, while g(λ) is useful when estimating i using an observer instead of direct measurement [8,10]. Typically, g(λ) is more computationally difficult to obtain than f (i).
An example motor drive controller set-up is shown in Figure 1, where a three-phase inverter is supplied by u dc and supplies the PMSM with three-phase voltages u ph and currents i ph . The input to the controller is a reference torque T * , which is translated to a set of reference dq phase currents i * dq by an MTPA function. This reference current i * dq and the fedback and transformed current i dq are independently converted to flux using the f PWA flux linkage map. The resulting reference flux λ * dq , feedback flux λ dq , and feedback angle θ go into a virtual flux (VF) controller, such as a VF-MPC. The output is a set of reference dq voltages u * dq which are transformed to phase voltages u * abc and modulated into duty cycles D abc fed to the inverter. This controller demonstrates the order of operations that a DSP can use to implement VF control and the importance of the MM, as it is the only control block used twice in the diagram.
The map f (·) is typically a LUT that is built using measured or Finite Element Analysis (FEA) points that are sampled and interpolated by some method. The map f (·) and torque, created using spline-interpolated FEA datapoints, for a machine with parameters in Table 2 is shown in Figure 2. The FEA method uses a simulated machine model which includes the machine's geometry and magnetic properties to approximate the (nonlinear) inductance throughout the machine for a wide range of operating points using the Finite Element Method (FEM). This inductance map is then sampled at high resolution and spline interpolated to create a high fidelity reference MM, f S (i) (capital S denoting reference), which is the reference for error calculations in Section 5.   The compensated terminal voltages can be described by the vectorū = [ū dūq ] ∈ U , where U is the voltage operating range of the machine. Thus, the machine can be described as a standard linear state-space system in the forṁ where the A and B matrices are The flux λ is the state, the compensated voltagesū are the input, and the current i is the output. This state-space model can be used in an MPC controller. The state λ will be linearized using a piecewise affine map f pwa (i) according to the machine's operating point.

Piecewise Affine Magnetic Model
This research proposes using a PWA map to represent the PMSM magnetic model. PWA maps take a nonlinear map and divide it into M domains. In each domain, the function is linearized [24]. The PWA current to flux map can be described as where λ = L j i + ψ j maps the currents i ∈ I j onto fluxes λ ∈ Λ j as an affine function and the image of the domain I j is Λ j . The affine map is defined by a set of equations with a specific inductance matrix L j and a flux offset vector ψ j for each region.
The inverse of f (·) is The process to create this PWA MM can be divided into four steps: (1) choose I P , (2) Delaunay triangulation of I P , (3) compute all L j and ψ j values, and (4) assign all L j and ψ j values to I j . This process is shown in Figure 3. The following subsections describe each step.
3.1. Choosing I P I P ⊆ I is the set of measured [12][13][14][15][17][18][19][20], simulated [12,13,17], or estimated [8-10] current points that will be used to create the PWA MM. The corresponding flux set Λ p must also be known. In general, there are too many points to all be used to create the MM as, at some point, the PWA function becomes too large for a DSP with finite memory.
I P can be regularly gridded (i.e., i d and i q datapoints are evenly separated). The corresponding flux points Λ p will not necessarily be regularly gridded. This can be seen in the vertices of the triangles in Figure 4. The particular shape of I p and Λ p will depend on the machine's operating points or regions. In this case, I p is bounded by the box constraint I p = {i ∈ I|i ≤ i max }. The shape of the flux image is found using Equation (7) and depends on the inductance throughout the machine. In this case, Λ M becomes an irregular shape resembling a bulged rectangle. Other bounds may be a continuous (or derated) current, the MTPA region, etc. These are explored in more detail in Section 5.
An irregularly gridded I P can yield a higher-accuracy MM for the same number of points as the regularly gridded value because the flux error is not evenly distributed (explored in Section 4). Irregularly gridded current points can also target areas in I and Λ that may be more frequently used, such as derated operation and MTPA. The method for obtaining these sets will be shown in Section 4.

Subdomains and the Delaunay Triangulation
Building the PWA function requires the domain and image to be split up into M non-overlapping regions or subdomains and subimages, denoted by I j and Λ j , respectively.
A point i ∈ I can only be in two (or more) subdomains if it is on the border i ∈ ∂I j of two (or more) subdomains. Points on the borders of two (or more) subdomains guarantee continuity and will also be on the border of the corresponding flux subimages λ ∈ ∂Λ. Otherwise, points that are not on the border of subdomains are only part of one subdomain and subimage.
The Delaunay triangulation DT(I P ) [25] of the set of points I P creates a set of unique, connected simplices I M . The Delaunay triangulation is the dual version of the more familiar Voronoi diagram. The Voronoi diagram of a set of points I P ∈ I splits the space I into |I P | "Voronoi cells", where the points in each cell are closer to some point i ∈ I P than any of the other points i ∈ I P . An example of the Delaunay triangulation in the current and flux space is shown in Figure 5, and a Voronoi diagram in the current domain with the corresponding Delaunay triangulation for an example set I P is shown in Figure 4. Each subdomain and subimage is a simplex, which is a triangle in the two dimensions (dq) of this problem. (In general, a simplex is the simplest possible polytope given the dimension of the problem.) A simplex can be defined by the convex hull H of D + 1 vertices or as a set of D + 1 affine inequalities (where D is the dimensionality of the problem). These definitions are called V-notation and H-notation, respectively [26]. A simplex in the current domain comprising the vertices i j 0 , . . . , i j D ∈ I P is Each current simplex I j forms a domain of an affine map that maps onto a flux simplex comprising the vertices λ j 0 , . . . , λ j D ∈ Λ P , and the flux simplex is The definition of the Delaunay triangulation (via the Voronoi diagram) implies that the vertices of each simplex are not degenerate (full dimensions) and are linearly independent (in both I and Λ spaces).

Subdomain Coefficients
As previously explained, a current simplex for the PMSM I j is defined by D + 1 (three) vertices as shown in Equaiton (9). A shifted dimension is defined by letting (any) of the vertices i j 0 become the new reference originī = i − i j 0 . The whole simplex thus shifts and becomesĪ j = H(0,ī j 1 , . . . ,ī j D }), (11) where the set of new current vectorsī j k = i j k − i j 0 spans the simplex. As with the current, we shift the flux space by the corresponding flux vectorλ = λ − λ j 0 , which results in Λ j = H(0,λ j 1 , . . . ,λ j D }), (12) whereλ j k = λ j k − λ j 0 spans the simplex and k = {1, . . . , D}. The shifted simplices are shown in Figure 6. The affine map is an isomorphism, and the vertices form the basis, so the position of a vector in the current space relative to the shifted origin is the same as the position of the flux vector from the origin of the shifted flux simplex: The process of computing the a coefficients is similar to computing the relative on times in space vector modulation (SVM) [24]. We start by projectingī onto the basis vectors ofĪ j : Then, we divide the magnitude of this projection by the magnitude of the shifted basis vectors to obtain the a vector: To calculate the flux, we simply multiply the basis vectors ofΛ j by the a coefficients: Finally, we un-shift the flux to obtain the machine flux at this current point: Equations (13)- (17) can be compressed using matrix notation. We define the bases of the shifted simplicesĪ j andΛ j as In addition, a = [a 1 , . . . , a D ] T . Equations (13) and (16) can be rewritten asī = MĪ j a and λ = MΛ j a, respectively. Because the simplices are nondegenerate, the bases are nonsingular, and we can find a linear relation: This expression is useful because as long as MΛ j and MΛ j exist and are invertible (which they are by the definition of a basis), then the current and flux can be related to each other (in either direction). The flux in terms of the current can be solved by unshifting the basis vectors and rearranging them to obtain with L j = MΛ j M −1 I j and ψ j = λ j 0 − L j i j 0 . Matrix algebra can be employed to solve for the reverse map i = g(λ) from Equation (8) just as easily.

Assign Coefficients to Simplices
The coefficients L j and ψ j are assigned to their simplex I j . Grouping all such functions produces the PWA MM of Equation (7). Examples of differently sized, regularly gridded PWA MM functions are shown in Figure 7.

Magnetic Model Optimization
Choosing which areas to minimize the flux error in f PWA by selectively choosing the points to use I P depends on the application. The metric chosen to measure the flux error of a PWA MM to the reference (FEA spline) MM at any given point is the 2-Norm flux error. An example of the two-norm flux error distribution using a 13 × 13 regularly gridded I P to create f PWA is shown in Figure 8. The flux error is the highest where the flux linkage is the most nonlinear (see Figure 2).
Given an allotted size for I P , where |I P | = N, an algorithm is devised that chooses I P to minimize the maximum two-norm flux error. In this algorithm, first, the minimum number of points (I P and Λ P ) to cover the full current domain I are chosen (step A). In the dq current space, this is a square and thus has four points. Then, steps 2-4 of building f PWA (see Figure 3) are executed (step B). If the size of I P is less than N, then we compute the two-norm flux error of k random current points in I (step C). The number k should be much larger than N, where k N. Then, we identify the maximum error point (i max , λ max ) (step D). Next, we add the maximum error point to I P and Λ P (step F). This will ensure that the error at this new point in f PWA is 0%, and the error surrounding this point will be significantly reduced. Steps B, C, D, E, and F repeat until |I P | = N. The PWA MM algorithm optimization steps (A-F) and PWA MM creation steps (1)(2)(3)(4) are shown in Figure 9.  The three areas of interest that will be explored are: the full current range (I), the approximate MTPA trajectory region (I MTPA ), and the approximate derated current region (I derated ). I represents all currents within absolute maximum current limits, I = {i ∈ I|i ≤ i max }. I derated represents the typical rated or continuous current limit, I derated = {i ∈ I| ||i dq || ≤ i rated }, where in this case i rated = 0.75pu. I MTPA follow the MTPA trajectory [23], and is an area instead of a region to account for temperature variations in the machine parameters. These three regions are shown in Figure 10.

Experimental Results
The PWA method of building a MM is evaluated primarily by the flux error. In the following section, f PWA functions created using irregular optimized grids are evaluated. The points used to construct the model were taken from a large pool of experimental data points, and the flux points were estimated using least squares approximation. For comparison, an f PWA function using a regularly gridded full current space (I P = I) is used, denoted by I * . I * is constructed using square grids (i.e., 2 × 2, 3 × 3, ... 6 × 6), so N = 4, 9, ...36. All data for this section came from an IPMSM with the parameters shown in Table 2. The magnetic model was compared against a high-fidelity, spline-interpolated MM built using many FEA data points, denoted by f S .

Flux Error Analysis
The flux error in an MM will propagate to an error in the state-space model of the system from Equation (5) and the torque from Equation (2). The two-norm flux error between f PWA using the irregular optimization algorithm of Section 4 and f S (high-fidelity model) can be evaluated by sampling many random current points i ∈ I. The average and maximum of this error within the optimized regions for various values of N are shown in Figure 11. The linear inductance magnetic model (L and ψ constant throughout all of I) are also shown, as well as a spline-interpolated magnetic model (lowercase 's', indicating it is not a high-fidelity model) f s focusing on the MTPA region. Among the irregular optimized PWA functions, the error was the smallest for the MTPA region as this was the smallest region by area, and the error was the largest for I as this was the largest area. It can be seen that the average and maximum errors of I * (regularly gridded) were significantly worse by margins of ≈ 1-3% and ≈ 5-8% respectively.
As expected, the linear MM f l (i) had a much higher flux error than the PWA models by ≈ 20-30% on average and ≈ 25-40% maximum. The spline interpolated MM focusing on the MTPA region outperformed the PWA MM by ≈ 1-3% for the average error and ≈ 1-6% for the maximum error. The decreased error is beneficial but does not allow for the linear state-space model (Equation (5)). The error distribution in these MMs was not even. As an example, the functions using 36-point (6 × 6) regularly gridded current points (I * ) and 40-point irregularly gridded functions (I, I MTPA , and I derated ) are shown in Figure 12. The simplical mesh I M composed of all simplices I j is shown in the top row, the placement of points in I P by the optimization algorithm for each of these functions is shown in the middle row, and the two-norm flux error distribution is shown in the bottom row. The two-norm flux error was minimized only in the region of interest, which is apparent in the low flux error, especially for I MTPA and I derated .

Conclusions
In this study, a formal method for creating piecewise affine flux linkage maps for a PMSM is presented using a four-step process. This model is linear while also capturing saturation, a useful combination for efficient and robust VF-MPC control. A six-step process for optimizing the magnetic model for a given region is also shown, and the optimization is presented for the MTPA and derated regions of operation. Experimental data points were compared to the FEA-simulated datapoints for a wide range of model resolutions, with an average flux error of less than 1% and a maximum error of less than 3% when using only 40 points. Over the full range of model resolutions, there was a ≈ 1-3% and ≈ 5-8% reduction in the flux error compared with a regularly gridded model.

Acknowledgments:
The authors would like to thank Youssef Fahmy for contributing to some simulation results.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: