Hardware-in-the-loop Simulation for Speed Control of Surface-mounted Permanent Magnet Synchronous Motor with Field-weakening Functionality

In this paper, we introduce a hardware-in-the-loop simulation analysis method for controlling the speed of a surface-mounted permanent magnet synchronous motor using the development software Altair Embed 2019. We focused on implementing a comprehensive closed-loop speed control drive using the field-weakening algorithm, encompassing maximum torque per ampere, constant output power, and maximum torque per voltage. Altair Embed 2019 facilitates an intuitive graphical approach for swift control design through real-time embedded controller simulation that is particularly compatible with digital signal processors such as those from Texas Instruments. The effectiveness of the proposed approach is validated through hardware-in-the-loop simulation conducted on a dynamometer system, showcasing promising results. Future endeavors involve the direct implementation of this methodology in practical drive and motor systems to substantiate its efficacy in streamlining programming technical skills.


Introduction
Motors play an indispensable role in powering manufacturing systems, contributing significantly to the efficiency and functionality of various industries.In the competitive landscape of industrial settings, the integration of automation systems emerges as a strategic approach to reducing personnel costs and elevating product quality, thereby bolstering overall competitiveness.Motors, serving crucial functions in positioning and speed control, are pivotal components within this paradigm.Among the diverse array of motors, the permanent magnet synchronous motor (PMSM) stands out as an exemplary type of AC motor.Renowned for its attributes of affordability, robust structure, and ease of maintenance, PMSM has found widespread application.As societal demands for an enhanced quality of life and environmental sustainability grow, the prevalence of motor applications continues to expand.Motors are integral to various sectors ranging from aviation and medical equipment to electric vehicles and complex manufacturing systems.In this context, the field-weakening (FW) control method for PMSM emerges as a valuable technique.This method involves adjusting the d-axis current to counteract the flux linkage introduced by permanent magnets, thereby expanding the motor's speed regulation range.The application of such advanced control methods not only enhances the motor's performance but also aligns with the broader objectives of sustainable technology integration in diverse industrial applications.
In 1888, pioneers ushered in a groundbreaking era with the invention of an AC motor, (1) leveraging Michael Faraday's electromagnetic induction principle.This invention, known as the induction motor, laid the foundation for a broader category of AC motors.Subsequently, in 1902, Danielson, a Swedish engineer, further advanced motor technology by introducing a synchronous motor.This innovation was built upon Nikola Tesla's induction motor, with its rotor utilizing a permanent magnet.Consequently, this novel motor was christened PMSM. (1)PMSM, at its core, encompasses two distinctive designs: surface PMSM (SPMSM) and interior PMSM (IPMSM).Researchers such as Kulkarni and Thosar delved into the fundamental mathematical model of PMSM, employing software simulations based on this model. (2)Their work substantiates the notion that IPMSM outperforms SPMSM, particularly in high-speed applications.This insight not only underscores the versatility of PMSM but also underscores the ongoing evolution and refinement of motor technologies over the years.
In 1922, the Russian-American engineer Nicolas Minorsky introduced a seminal paper outlining the theoretical analysis of proportional-integral-derivative (PID) controller. (3)As highlighted in Refs. 4 and 5, PID controllers have become commonplace in industrial control applications owing to their ease of implementation in microprocessors or single chips.The adjustment rules for the controllers' parameters can be derived through an analysis of the desired dynamic performance, guided by principles established in linear control theory. (6)Consequently, PID controllers find applicability in motor control, where their parameters can be conveniently determined through experimental testing. (7,8)For applications requiring high-speed control, Sudhoff et al. introduced a FW control method specifically tailored for SPMSM in 1995. (9)10)(11)(12)(13) These advancements underscore the versatility and adaptability of control methodologies, showcasing their evolution over time to meet the dynamic requirements of various motor systems.
Given that IPMSM exhibits reluctance torque, the control objective often involves optimizing the maximum torque per ampere (MTPA).As the motor approaches its rated speed, voltage limitations are imposed to prevent further speed escalation.To expand the operational motor speed range, controlling the d-axis current becomes crucial.The control strategy weakens the flux linkage between the permanent magnet and the stator, effectively reducing the back electromotive force (back-EMF).In this study, we leverage the development software Altair Embed 2019 to engineer a comprehensive speed and torque control system for surface-mounted PMSM.The emphasis is on incorporating field-weakening control to enable a broader operational speed range for PMSM.Through the meticulous observation of speed, torque, current, and voltage parameters of PMSM, the tuning of proportional-integral (PI) controller parameters becomes a straightforward task and yields promising and encouraging results.This approach not only showcases the practical application of advanced control strategies but also underscores the efficacy of Altair Embed 2019 in facilitating the design and optimization of motor control systems.

Mathematical Model
Chapman (1) states that the stator voltage equation can be expressed in a d-q axis coordinate system by using the Park transformation: (7,8) where v d , i d , and λ d are the d-axis voltage, current, and flux linkage, and v q , i q , and λ q are the q-axis voltage, current, and flux linkage, respectively; ω r is the electrical angular speed of the rotor magnetic field.The individual magnetic flux linkage in the d-q axis coordinate system is also presented as where   and   respectively denote the d-axis and q-axis inductances.λ' m indicates the equivalent magnetic flux of the permanent magnet.The mechanical power P m in rotational systems can be expressed as the product of the mechanical torque T e (N) and angular velocity ω m (rad/s), as below.
( ) The relationship between electrical and mechanical angular velocities can expressed as where P is the number of poles in the motor.By substituting Eq. ( 6) into Eq.( 5), the electromagnetic torque of PMSM can be obtained as ( ) On the basis of Newton's second law, the mechanical dynamic equation of the motor can be derived as where T e is the electrical torque (N⋅m); ω m is the rotor angular speed (rad/s); J is the moment (kg⋅m 2 ) of inertia of the motor and load; B is the friction coefficient (N⋅m/rad/s) of the motor; and T L is the load torque (N⋅m).

Maximum Torque and FW Method
Upon reaching the peak values of voltage and current, the motor attains its rated speed (ω base), represented as point A1 in Fig. 1.To achieve higher speed operations, the motor employs field-weakening control.This involves adjusting the current of the d-axis stator to be negative, thereby diminishing the magnetic flux and mitigating the back-EMF.Consequently, the inverter sustains a current supply to the motor, facilitating a continued increase in speed.In the realm of FW control methods, three primary strategies are commonly employed for PMSM: constant voltage constant power (CVCP) control, constant current constant power (CCCP) control, and voltage and current limited maximum torque (VCLMT) control.Notably, VCLMT control is prevalent in IPMSM, whereas CVCP control and CCCP control are well-suited for SPMSM.(13) In the analysis of FW operation, an assumption is made that the stator resistance is zero and the motor operates in a   4), forming the foundation for comprehending and discussing the CCCP field-weakening strategy in SPMSM.The insights gained from this analysis contribute to a deeper understanding of the motor's behavior during FW operations, thereby leading to effective control strategies and optimizations for SPMSM in high-speed applications.
Here, L d = L q = L s because SPMSM is used.Consider the stator terminal voltage to be Then, the voltage diagram of SPMSM, which is drawn as a voltage-limit circle, can be constrained in the following equation: ( ) where V sm is the maximum magnitude of the inverter output voltage vector.The stator terminal current shows the relationship I s 2 = i d 2 + d q 2 .It will also be constrained in the circle diagram.
Here, I sm denotes the maximum magnitude of the inverter output current vector.With different steady states of voltage and current, this diagram can be presented as in Fig. 1 for CCCP control.
Before performing FW, we must first know the rated speed of the motor.Only when the motor speed is greater than the rated speed, the FW control can be performed.The electrical angular rated speed of SPMSM can be expressed as below, when the voltage and current reach the rated values.
When the motor is SPMSM, L d = L q =L s .Therefore, the torque, Eq. ( 7), can be expressed as 3 4 Consequently, when the speed is lower than the rated speed (ω base ), the region of operating area can be considered MTPA for SPMSM by simply letting i d = 0. To obtain the maximum torque, it is suggested that i q = I sm and i d = 0.This means that the maximum torque is 3 4 However, when the speed is higher than the rated speed, the field-weakening control of SPMSM should be considered to achieve the demand of higher speed operation within the limitations of inverter output voltage and current.The FW control by CCCP will be adopted for SPMSM.Thus, in the constant-power area shown in Fig. 1, the following can be obtained: From Eqs. ( 13)−(15), we can obtain the following relationship: It indicates that the numerical iterative method will be used as where i d,cccp will be initially zero and ∆i d , which is the design value, is assumed to be small.Note that ω r is now larger than ω base because the motor is operating in the FW mode to obtain the higher speed.For constant current and constant power, the q-axis current can be obtained as By substituting Eqs. ( 18) and ( 19) into Eq.( 11), ω r in steady state can be estimated.

Controller Design
By cancelling the decoupling term, the current control of PMSM can be separately designed as a d-axis current and q-axis current control loop, as shown in Fig. 2. By substituting the flux equations Eqs. ( 3) and ( 4) into the voltage equations Eqs. ( 1) and ( 2), the following transfer function can be obtained by simple rearrangement: For d-axis current control, the closed-loop transfer function can be found as below with the aim of designing the parameters of the PI controller to be k pd /k id = L s /R s and embedding the coupling term of L s ω r i q .
( ) Here, ω bd = (k id /R s ) =2πf d denotes the bandwidth of d-axis current control.f d is its bandwidth in frequency (Hz), which is simply assumed to be 360 Hz.Since f d and R s are known in the design stage, the parameters of the PI controller can be guaranteed.Similarly, the closed-loop transfer function of the q-axis current system can be found as below, by designing the parameters of the PI controller to be k pq /k iq = L s /R s and simply embedding the coupling terms of L s ω r i d and ω r λ′ m .
( ) Here, ω bq = (k iq /R s ) =2πf q denotes the bandwidth of q-axis current control; f q is also assumed to be 360 Hz for the same reason.To control the speed of SPMSM, the PI controller can be cascaded in the outer loop of the q-axis current control with the bandwidth in f q /10.The speed control system is presented in Fig. 3 and described as below, by designing k pf = −k ps and K T = (3P/4)λ′ m : where ξ is the damping ratio and ω n is the undamped natural frequency.Note that the performance of the closed-loop speed control can be determined because the design specifications are known in the initial period.

Simulation Results of Torque and Speed Control
The block diagram illustrating torque control and speed control simulations for SPMSM with an FW mechanism is depicted in Fig. 4. In this study, we employ Altair Embed 2019 to create a hardware-in-the-loop (HIL) simulation control system.This choice is motivated by Altair's ability to offer a graphical control design environment, facilitating the generation of highly efficient ANSI C codes applicable to digital signal processors, such as the TI TMS320F28069M microcontroller.The microcontroller unit plays a pivotal role as it provides reliable and efficient functions for the easy adjustment of the controller parameters through the HIL simulation method, thus enabling the real-time monitoring of actual data.The SPMSM parameters are outlined in Table 1.In our study, we investigate the outcomes, addressing speed and torque control individually for PMSM through real-time embedded system HIL simulations.
Figures 5 and 6 depict the simulation results for speed control in the FW mode, targeting a speed command of 4200 rpm, under 0 and 0.1 N•m loads, respectively.The reference speed is increased gradually within a 0.08 s duration to attain the desired speed.In Fig. 5(a), an overshoot response is evident around the target speed before stabilization at the final speed.The control error between the reference speed and the actual speed approaches zero.Figure 5(b) shows that the maximum power is initially supplied, but it gradually converges to zero in response to the speed error.This overshoot is inherent to feedback control, given the use of a simple PI cascade control in this study.The current response in Fig. 5(c) aligns with those of MTPA, constant current control, and maximum torque per voltage (MTPV).Constant current control, identified as the first FW control, sustains constant power for the motor.MTPV control, the second FW control, is aimed at providing maximum torque with minimum current while considering voltage  Figure 6 shows simulation results for speed control at 4200 rpm with a 0.1 N•m load applied to the motor.Consistent outcomes with those in Fig. 5 are observed.However, Figs. 6(b) and 6(c) highlight final torque and current values in the q-axis.This occurrence is attributed to the control system generating the i q value to produce torque that balances the applied torque load on the motor during the steady-state speed response.Figures 7 and 8 show the results of torque control with a 0.12 N•m load in the FW mode, and under 0 and 0.05 N•m loads, respectively.Generally, a higher torque leads to a faster rise in speed.From Fig. 7, it is seen that torque control initially follows the MTPA curve and becomes  constant.As the stator current values of id and i q align with the constant circle value of PMSM, the torque drops close to zero along the constant circle in a counterclockwise direction owing to the absence of load.Eventually, the highest speed is steadily attained.Figure 8   control with a 0.12 N•m load in the FW mode, coupled with a 0.05 N•m load.The simulation results align consistently with those in Fig. 7, except for a lower final speed.This difference is attributed to the total torque applied to PMSM being smaller owing to the effect of the reduced load.

Conclusions
In the study, the voltage and torque equations of the PMSM were derived using the d-q axis coordinate system.Torque control and speed control in the FW mode were elucidated, and the behavior of SPMSM in high-speed operation under various loads was observed.The analysis of the torque equation revealed that the torque output was proportional to the q-axis current, the flux linkage of the permanent magnet, and the number of motor poles, while it remained independent of the d-axis current.For effective torque control, the maximum torque output was achieved by controlling the q-axis current.Upon reaching the rated speed, voltage limitations hindered further speed increase, necessitating the weakening of the magnetic field through back-EMF to achieve the goal of speed enhancement.In future work, advanced control techniques will be applied to enhance transient performance and bolster the robustness of the control law for SPMSM, particularly under the effect of system uncertainties.
. This assumption allows the derivation of key equations from Eqs. (1)−(

Fig. 3 .
Fig. 3. Block diagram of closed-loop transfer function for speed control.

Fig. 4 .
Fig. 4. (Color online) Block diagram of speed and torque control with FW in Altair Embed 2019.

Fig. 5 .
Fig. 5. (Color online) Simulation results of speed control for the command of 4200 rpm without load: (a) speed, (b) torque, and (c) current responses.

Fig. 6 .
Fig. 6. (Color online) Simulation results of speed control for the command of 4200 rpm with 0.1 N•m load: (a) speed, (b) torque, and (c) current responses.(c)