Efficiency Map-Based PMSM Parameters Estimation Using Power-Oriented Modeling

This paper deals with two subjects. The first one is the presentation of a Matlab App created for PMSMs (Permanent Magnet Synchronous Motors) parameters estimation, both in the electrical and in the mechanical energetic domains. The second one is the presentation of a generalized PMSM Simulink superblock equipped with a user-friendly interface allowing to select options and to input the model parameters. The Matlab App and the PMSM superblock can be easily interfaced with each other. Finally, two simulation case studies are reported for the PMSM superblock.


I. INTRODUCTION
PMSMs are employed in a very large variety of industrial fields, including robotics, aerospace, road and rail electric vehicles [1] and renewable energy applications such as solar water pumping [2]. Out of all the advantages PMSMs provide, good dynamic performances, high power density and high efficiency are surely among the most interesting ones [3]- [5]. The PMSM has to be chosen in order to satisfy the requirements of the given application, e.g. desired speed and torque range [5] etc. Once the most suitable PMSM has been identified, the modeling step has to be addressed, which is essential to effectively describe the machine behavior. Different modeling approaches can be found in the literature. As an example, the PMSMs modeling is addressed in a d-q discretetime reference frame in [6]. A modeling in the d-q frame is also employed in [7]- [10], whereas a fault diagnosis model based on a Siamese network is proposed in [11]. A fundamental advantage of model-based methods is the knowledge of the mathematical model of the system under consideration. This is not only important for an engineer to really understand the dynamics of the analyzed physical system, but it also allows to develop more effective control strategies which are based on the model knowledge. The PMSM models employed in all these works are very useful but lack of flexibility, i.e. they do not allow the user to select options, meaning whether to simulate in the three-phase static frame or the d-q frame or whether to account for the system mechanical dynamics or not, in order to perform lighter or heavier simulations. In [12] and [13], the Simulink blocks for interior and surface PMSM are presented. They allow a larger flexibility, but the inner structure of the model and the power flowing The associate editor coordinating the review of this manuscript and approving it for publication was Claudia Raibulet. between the electrical and mechanical parts of the machine cannot be easily understood, since the power sections are not highlighted. The physical systems modeling can also be effectively addressed using suitable energy-based graphical formalisms such as Power-Oriented Graphs (POG) [14], Bond-Graph (BG) [15] and Energetic Macroscopic Representation (EMR) [15]. In this work, the POG modeling technique is used [14]. The latter is a graphical formalism which is very useful for describing systems dynamic models, as it allows to build block schemes which are directly implementable in Simulink and it also allows to effectively control the system power flows [16]. In this paper, a PMSM Simulink superblock is proposed [17]\PMSM_Superblock, offering the following interesting functionalities: 1) straightforward compatibility with the PMSM parameters estimation Matlab App [17]\Estimation_Matlab_App proposed in this paper; 2) both speed and torque control are incorporated in the model; 3) the user can choose whether to compute the three-phase voltages and currents or not, leading to heavier or lighter simulations; 4) the user can choose if the rotor mechanical dynamics has to be included or not; 5) easy control and understanding of the power flows within the system. The next important step to be addressed is PMSM parameters estimation, for which several approaches have been proposed in the literature. For example, a model reference adaptive system is proposed in [18], whereas a deterministic learning approach for identifying the system dynamics is addressed in [19]. A genetic algorithm for the search of the minimal point is studied in [20], whereas two offline and online estimation methods involving different system parameters are shown in [21] and [22]. Some other studies focus instead on the temperature estimation of PMSM, as shown in [23] where a Feedforward Neural Network is employed. In order to overcome the problem of parameters estimation, efforts have been made to develop model-free control approaches for PMSMs, like the model-free predictive current control proposed in [24]. In this case, the concern is related to the current difference updating frequency in order to obtain a good performance. A compensated stator flux predictor is instead proposed in [25] in order to improve the prediction accuracy of the stator flux linkage vector. An exhaustive review of the current state of the art for PMSM offline and online estimation techniques is proposed in [5]. As far as online numerical methods are concerned, two examples are Recursive Least Square (RLS) and Extended Kalman Filter (EKF). Using RLS [26], a current injectionbased method is proposed in [27], [28], whereas EKF is employed in [29].
In this paper, a Matlab App for PMSM parameters estimation [17]\Estimation_Matlab_App, both in the electrical and in the mechanical energetic domains, is proposed. This can be potentially suitable for self-commissioning applications, and can also be potentially extended to be used online. Furthermore, the Matlab App and the PMSM superblock can be easily interfaced with each other.
The remainder of this paper is organized as follows. Sec. II addresses the PMSM modeling and efficiency analysis. Sec. III presents the user interface and parameters definition of the Matlab App for PMSM parameters estimation, whereas Sec. IV describes its operation and working principles. Sec. V introduces the PMSM Simulink superblock together with two simulation examples, while the conclusions are finally reported in Sec. VI.

II. PMSM MODELING AND EFFICIENCY
The state-space model of the PMSM in the d-q frame ω can be written as follows: where L and A are the system energy and power matrices and x and u are the system state and input vectors. Terms ω K d , ω K q , ω K s3 are the three components of the PMSM torque vector ω K τ (θ), where θ is the electric angle, whereas ω I d , ω I q , ω I s3 and ω V d , ω V q , ω V s3 are the three components of the PMSM current and voltage vectors ω I s and ω V s . The meaning  (1), (2) and (3).
of all the other parameters is reported in Table 1. The last component ω I s3 of the current vector ω I s is proportional to the sum of currents I sh , for h = {1, 2, 3}, circulating in the three stator phases. In order for the components of the torque vector ω K τ (θ ) to be constant, that is in order for the PMSM to be able to generate a constant torque if the current vector ω I s is constant, the rotor flux has to be sinusoidal. In this way, only the in-quadrature component ω K q of the torque vector ω K τ (θ ) is different from zero. Furthermore, under the hypothesis of star connected phases, a static constraint between the stator currents originates 3 h=1 I sh = 0. This causes the third component ω I s3 of the current vector ω I s to be equal to zero, which in turn implies that the electric part of the PMSM is described by a system having dynamic dimension equal to two. Therefore, under the hypothesis of sinusoidal rotor flux and star-connected stator phases, the state-space model of the PMSM in the d-q frame in (1) can be rewritten as: In steady-state conditions, the PMSM steady-state model (2) becomes [30]: where the parameters meaning is described in Table 1. Because the term highlighted in red in (3) is zero, it is convenient to enforce ω I d = 0 since this is the condition maximizing the motor efficiency, as proven in [30]. Under this condition and doing some algebra, system (3) is reduced to: If ω I d = 0 the PMSM behaves, in first approximation, as a linear system and its maximum efficiency E * [30]- [31] is given by [30]-Eq. (30). At steady-state, the PMSM efficiency E when working as a motor, i.e. with a power flow oriented from section (y 1 , u 1 ) = ( ω I q , ω V q ) to section (y 2 , u 2 ) = (ω m , τ e ), is: In order for the considered model to reproduce an actual PMSM efficiency map, the linear approximation is not sufficient, and some nonlinear dissipative terms have to be added. A graphical representation of the PMSM dynamics including the needed nonlinear dissipative terms is given by the POG block scheme reported in Fig. 1. The power variables ω V s and τ e in (4) must be replaced by ω V s and τ e , defined as: Since ω I d = 0, the first equation in (6) becomes: The nonlinear friction terms in (6) and (7) are: the Coulomb friction b c sgn(ω m ), the air friction b mq sgn(ω m ) ω m 2 and the Joule dissipation R sq sgn ω I q ω I 2 q . By rewriting (4) as a function of τ e and ω m and replacing τ e and ω V q with τ e and ω V q in (6) and (7), one obtains:

III. ESTIMATION ROUTINE APP: INTERFACE
The main user interface of the PMSM parameters estimation Matlab App is shown in Fig. 2, where the reported parameters and results refer to a fictitious machine. The installation file for the proposed Matlab App, created with Matlab R2018b, is named PMSM_parameters_ estimation.mlappinstall and can be found in the supplementary material in the dataset [17] \Estimation_ Matlab_App. The operations the user needs to perform before the estimation begins are summarized in the flowchart of Fig. 3 and detailed in the next subsection. Fig. 2 clearly shows the parameters to be estimated in the enlarged magenta window, which can be subdivided into two groups: known and unknown. If a dissipative parameter is known, its selection in the ''Estimate?'' window must be set to ''No'' and the corresponding input value will be interpreted as the exact one. If a dissipative parameter is unknown, its selection in the ''Estimate?'' window must be set to ''Yes'', the parameter will be estimated and the given value will be used as initial condition. The torque constant ω K q is treated as a special case, as it allows one more choice for the user:

A. TO BE DEFINED BEFORE THE ESTIMATION BEGINS
• if the ω K q knob is set to ''Yes'', ω K q is unknown and will be estimated as in Sec. IV-A; • if ''No'' is selected, ω K q is unknown and will be computed as in Sec. IV-B; • if ''User Defined'' is selected, ω K q is known and the provided value will be interpreted as the exact final one. In the ''Define the following parameters:'' window, some information has to be user-defined. Among this, note that ''Speed at Drop Torque: W_jump'' is the machine speed at which the motor  [17]\Estimation_Matlab_App, such as the distribution of vectors ω V s and ω I s vs (ω m , τ e ), the E map error on plane (ω m , τ e ) defined in (10), the resistive voltage due to R s and to R s and R sq together, and the resistive torque due to b m and to b m , b mq and b coul together.

IV. ESTIMATION ROUTINE: THEORY
In this section, the theory and the implementation of the PMSM parameters estimation routine are analyzed and commented.

A. ESTIMATION OF DISSIPATIVE TERMS AND ω K q
Out of b m , R s , b c , b mq , R sq and ω K q , the user can select the unknown ones to be estimated, see Sec. III-A. The estimation makes use of the actual efficiency map E map act of the considered PMSM. The actual efficiency map E map act is, in general, a rectangular matrix E map act ∈ R (n×m) , where n is the number of elements in the torque vector τ e and m is the number of elements in the speed vector ω m : τ e ∈ R (n×1) , ω m ∈ R (m×1) . Using the user defined values of the parameters, representing the initial value for the unknown ones and the exact final value for the known ones, the routine loops over the set of operating points in the output plane (y 2 , u 2 ) = (ω m , τ e ) ∈ S, where the set S is defined as: with P max being the maximum motor power. For simplicity of notation, let S h denote the generic couple (ω m i , τ e j ), for i and j in (9). The routine exploits (6) and (8) to compute the couple (y 1 , u 1 ) = ( ω I q S h , ω V q S h ), associated with the considered operating point on the output plane S h ∈ S. By using (5), the estimated efficiency E map est S h of the PMSM in S h ∈ S can be computed. By looping over all the output plane points S h ∈ S, the estimation routine builds the estimated efficiency map

E map est . The remaining empty elements E map est S h
, for S h / ∈ S, are set to zero. The efficiency error map is then computed: The fminsearch Matlab function is then employed in order to perform a defined number of iterations allowing to identify the values of the parameters that the user has selected to estimate, in order to minimize the function:

B. COMPUTATION OF THE TORQUE CONSTANT ω K q
In the '' ω K q knob → No'' special case in Sec. III-A, ω K q is computed as follows. Reference is made to the case of maximum torque generation τ e i = τ e max , i.e. | ω I s | = | ω I s max |.
Assuming ω I d = 0 and star-connected phases, | ω I s | = | ω I q | holds. From (3) and τ m = ω K q ω I q (see Fig. 1), and neglecting the dissipative terms affecting the mechanical part b m , b c and b mq (for the computation of ω K q only) introduced in Fig. 1, (6) and (7), it follows ω K q = τ e max /| ω I q | = τ e max /| ω I s max |.

C. COMPUTATION OF THE DYNAMIC TERM L se
Let us assume τ e j = τ e max , for which | ω I s | = | ω I s max | holds. Let operating point P on the output plane: be the one giving the maximum motor torque and power: τ e = τ e max and P m = P max . Point P is shown on the maximum torque vs speed characteristic τ e max (ω m ) of the motor reported in Fig. 4. Assuming ω I d = 0 and star-connected phases, | ω I s | = | ω I q | holds. From (3), τ m = ω K q ω I q , (6), (7), (8), and using point P in (12), it is: From (3), (6), (7) and (8), one can notice that: By assuming | ω V s | = | ω V s max | in the considered operating point (ω m j , τ e max ) ∈ S, and assuming star-connected stator phases, one obtains: From the first equation in (3), it follows: From (13), parameter L se is computed.
After the estimation, Eqs. (6), (7) and (8) are once again exploited to compute the couple ( ω I q S h , ω V q S h ) associated with all the operating points on the output plane S h ∈ S in (9).
Since ω I d = 0 is enforced, | ω I s |(ω m , τ e ) = | ω I q |(ω m , τ e ) holds. The latter is provided as output in the top-right figure of the ''Figures_1'' results screen. As for the voltage vector ω V s , 45958 VOLUME 10, 2022 From τ m = ω K ω q I q and ω I d = 0, it follows that the maximum motive torque is achieved when | ω I q | = | ω I s max |. Additionally, from the third equation of (3) and from the second equation of (6) it is known that, at steady-state, the motive torque τ m = ω K q ω I q and the external torque τ e are related to each other through b m , b c and b mq . Since ω I d = 0, let us define a new in-quadrature current component vector | ω I q vect | covering the whole range from 0 to | ω I s max | with steps of 1A, and let us call i the index looping over this vector covering the whole range of torque τ e from zero up to τ e max thanks to the relation between the motive torque τ m and the external torque τ e highlighted above. The computation of the different torque versus speed characteristics τ e (ω m ) up to τ e max (ω m ) for all current values within | ω I q vect | can then be performed. When compared with other simulation tools, such as the models made available by the Matlab/Simulink [12]- [13] for example, the proposed PMSM superblock offers some advantages. As far as the mechanical part of the motor is concerned, the proposed PMSM superblock accounts for one more friction effect, namely the air friction, exhibiting a square dependence on the motor speed. As far as the electrical part of the motor is concerned, the proposed PMSM superblock accounts for one more dissipative effect, namely the Joule losses, exhibiting a square dependence on the current vector components. These two dissipative effects are important when reproducing the efficiency map VOLUME 10, 2022  of an actual PMSM in the different operating points. Furthermore, an important advantage of the proposed PMSM superblock is the fact that it can be directly used in conjunction with the proposed PMSM parameters estimation Matlab App [17]\Estimation_Matlab_App. The user can first use the PMSM parameters estimation Matlab App to estimate the motor parameters from the efficiency map and then directly feed the estimated parameters to the PMSM superblock.

A. SIMULATIONS
The supplementary material in the dataset [17]\PMSM_ Superblock reports two scripts EM_Speed_Control.m and EM_Torque_Control.m, simulating the Simulink models EM_Speed_Control_slx.slx and EM_Torque _Control_slx.slx, respectively. The two scripts contain two simulation examples applying a speed and a torque control to the PMSM, respectively. The PMSM parameters employed in this case are those of the fictitious machine reported in My_Motor_Estimated_Parameters. mat, estimated in [17]\Estimation_Matlab_App. Both in EM_Speed_Control.m and in EM_Torque _Control.m, the tunable popup options chosen in the two cases are set from line 10 to line 15 of the scripts, but can also be manually set from the PMSM superblock user interface itself. The remaining simulation parameters are set in the remaining part of the two scripts. Note that the tunable popup options set in EM_Speed_Control.m are such that the PMSM superblock external view in EM_Speed_Control_slx.slx is exactly the one illustrated in Fig. 6. Some results for the two simulation case studies in EM_Speed_Control.m and EM_Torque_Control.m are reported in Fig. 7 and Fig. 8. The upper subplot of Fig. 7 shows the desired and actual motor speeds ω m des and ω m in red dashed and blue lines, respectively. The middle subplot of Fig. 7 shows the three components of the voltage vector t V s in the original threephase frame. The lower subplot of Fig. 7 shows the three components of the current vector t I s in the original three-phase frame for a single motor, as three PMSMs are working in parallel in the considered simulation examples, see parameter Nr_mot in EM_Speed_Control.m and EM_Torque_Control.m. The upper subplot of Fig. 8 shows the desired and actual motors torques τ m des and τ m (the latter also accounting for the mechanical friction contributions) in red dashed and blue lines, respectively. The middle and lower subplots of Fig. 8 report the same information as those of Fig. 7 but for the torque control case. From the upper subplots of Fig. 7 and Fig. 8, it is possible to see the good superposition between the desired and actual characteristics, highlighting the effectiveness of the control.

VI. CONCLUSION
In this paper, a Matlab App created for PMSM parameters estimation has been presented. The App allows to estimate electrical and mechanical parameters and can be potentially implemented online. Next, a generalized PMSM Simulink superblock with a user-friendly interface has been introduced. The PMSM superblock is compatible with the parameters estimation Matlab App, allows both speed and torque control, and lets the user choose whether to compute the three-phase currents and voltages and if the rotor mechanical dynamics has to be included in the simulation or not. The results of two simulations performed on the PMSM superblock are finally reported, applying a speed and a torque control, respectively.