Modeling and Hardware-in-the-Loop Testing of Permanent Magnet Synchronous Motors for Hybrid Cars

In the rapidly evolving landscape of automotive technology, the development of hybrid cars has become a cornerstone for achieving higher efficiency, reduced emissions, and enhanced performance. As a control systems engineer deeply involved in this field, I have witnessed firsthand the critical role that electric motor drives play in hybrid powertrains. Among these, the permanent magnet synchronous motor (PMSM) stands out due to its high power density, efficiency, and reliability. However, the development of control strategies for PMSMs in hybrid cars presents significant challenges, particularly in terms of real-time verification and testing. Traditional methods relying on physical prototypes are not only costly and time-consuming but also pose safety risks during early development stages. To address these issues, hardware-in-the-loop (HIL) simulation has emerged as an indispensable tool, enabling rigorous testing of motor controllers in a virtual environment. In this article, I will delve into a high-precision HIL simulation modeling method for PMSMs, specifically tailored for dual-motor hybrid systems in hybrid cars. This approach leverages advanced platforms like dSPACE SCALEXIO to achieve microsecond-level real-time performance, thereby accelerating control algorithm iteration and reducing real-world testing risks for hybrid cars.

The integration of electric motors into hybrid cars has necessitated a paradigm shift in development methodologies. HIL simulation allows for the seamless integration of real controller hardware with virtual plant models, such as motors and loads, operating in a closed-loop system. This technology simulates various operating conditions, faults, and extreme scenarios, thereby enhancing testing safety, flexibility, and repeatability. For hybrid cars, where powertrains often involve complex interactions between internal combustion engines and electric motors, HIL testing becomes even more crucial. The motor model serves as the core of the HIL simulation system, and its accuracy and real-time capability directly impact the overall simulation quality. In the context of hybrid cars, PMSMs are frequently used due to their superior performance in traction applications. Thus, developing a robust and real-time capable PMSM model is essential for validating control strategies in hybrid car development.

The evolution of motor modeling for HIL simulation has progressed through several stages, each driven by the increasing demands of hybrid car applications. Initially, motor models focused primarily on precision, utilizing detailed mathematical representations in platforms like MATLAB/Simulink. These early models, while accurate under ideal conditions, often neglected nonlinearities such as magnetic saturation, cogging torque, and thermal effects, limiting their applicability to industrial-grade simulations for hybrid cars. As hybrid car technologies advanced, the need for real-time computation became paramount. Motor controllers in hybrid cars typically operate with update cycles ranging from 10 to 100 microseconds, requiring the motor model to compute responses within these stringent time frames. This led to the real-time modeling phase, where emphasis shifted toward computational efficiency. Techniques such as model simplification, order reduction, discretization of continuous equations, and structural optimization were employed to balance accuracy with performance. For instance, differential equations were replaced with difference equations using methods like Euler or Tustin discretization to align with fixed-step solvers in HIL platforms. Despite these advancements, challenges remain in industrial deployment for hybrid cars, including balancing simulation fidelity with computational load, standardizing nonlinear modeling approaches, and keeping pace with rapid hardware upgrades. In hybrid cars, where dual-motor systems are common, these challenges are exacerbated by the need for synchronized real-time simulation of multiple motors.

The architecture of an HIL simulation system for hybrid cars is designed to replicate the real-world environment in which motor controllers operate. As illustrated in the provided diagram, the system comprises several key components: the test target (the actual controller, such as a motor control unit or MCU), the real-time simulation hardware platform (e.g., dSPACE SCALEXIO), and the real-time simulation models. For hybrid cars, the test target often involves controllers that manage PMSM drives in a dual-motor configuration, receiving inputs like CAN bus signals and sensor feedback and outputting control signals such as PWM commands. The real-time hardware platform handles core computations, signal conversion, and fault injection. It typically includes high-performance multi-core CPUs and field-programmable gate arrays (FPGAs) for running high-fidelity models, along with I/O interface modules for connecting to the device under test. In hybrid car applications, the real-time simulation models are divided into processor models and FPGA models. Processor models simulate the external environment or physical objects, such as the vehicle dynamics, engine, or battery systems, operating with strict real-time constraints (e.g., 1 ms simulation steps). FPGA models, on the other hand, are deployed for running the motor models, enabling closed-loop control with the controller at microsecond-level speeds. This separation allows for efficient parallel processing, which is vital for handling the complex interactions in hybrid cars. For example, in a dual-motor hybrid system, one FPGA might model the traction motor while another models the generator motor, both synchronized to simulate the powertrain behavior accurately.

Building an accurate PMSM model for HIL simulation in hybrid cars requires a thorough understanding of the motor’s electrical and mechanical dynamics. The modeling process begins with defining the model type based on the controller under test. For direct motor control in hybrid cars, a dynamic model that captures both electrical and mechanical responses is essential. The core of PMSM modeling lies in the mathematical equations describing the motor’s behavior in the d-q reference frame, which simplifies the analysis by transforming three-phase quantities into direct and quadrature components. The model inputs typically include PWM control signals from the controller and excitation signals, while the outputs provide resolver feedback (sine and cosine signals) to close the loop. Below, I outline the key mathematical principles, supplemented with formulas and tables to summarize the model parameters and equations.

The first step in PMSM modeling for hybrid cars involves calculating the three-phase voltages from the inverter based on PWM signals. Given the DC bus voltage \(V_{dc}\) and switching states \(S_a, S_b, S_c \in \{0,1\}\) (where 1 indicates the upper switch is on and 0 the lower switch), the phase voltages relative to a virtual neutral point can be derived. The bridge leg outputs are:

$$
\begin{align*}
u_{an} &= \left(2S_a – 1\right) \cdot \frac{V_{dc}}{2} \\
u_{bn} &= \left(2S_b – 1\right) \cdot \frac{V_{dc}}{2} \\
u_{cn} &= \left(2S_c – 1\right) \cdot \frac{V_{dc}}{2}
\end{align*}
$$

For a three-phase symmetric system without a neutral connection, the virtual neutral point voltage \(u_n\) is:

$$
u_n = \frac{u_{an} + u_{bn} + u_{cn}}{3}
$$

The phase voltages \(u_a, u_b, u_c\) are then:

$$
\begin{align*}
u_a &= u_{an} – u_n \\
u_b &= u_{bn} – u_n \\
u_c &= u_{cn} – u_n
\end{align*}
$$

Substituting the earlier equations, we obtain a compact form for the phase voltages, which is crucial for real-time computation in hybrid car simulations:

$$
\begin{align*}
u_a &= \left(2S_a – S_b – S_c\right) \cdot \frac{V_{dc}}{3} \\
u_b &= \left(2S_b – S_a – S_c\right) \cdot \frac{V_{dc}}{3} \\
u_c &= \left(2S_c – S_a – S_b\right) \cdot \frac{V_{dc}}{3}
\end{align*}
$$

Next, the electrical dynamics of the PMSM are modeled in the d-q coordinate system. The voltage equations are:

$$
\begin{align*}
u_d &= R_s i_d + \frac{d\psi_d}{dt} – \omega_e \psi_q \\
u_q &= R_s i_q + \frac{d\psi_q}{dt} + \omega_e \psi_d
\end{align*}
$$

where \(u_d\) and \(u_q\) are the d- and q-axis voltages, \(R_s\) is the stator resistance, \(i_d\) and \(i_q\) are the d- and q-axis currents, \(\psi_d\) and \(\psi_q\) are the d- and q-axis flux linkages, and \(\omega_e\) is the electrical angular speed related to the mechanical speed \(\omega_r\) by \(\omega_e = p \omega_r\), with \(p\) being the number of pole pairs. The flux linkages are given by:

$$
\begin{align*}
\psi_d &= L_d i_d + \psi_f \\
\psi_q &= L_q i_q
\end{align*}
$$

where \(L_d\) and \(L_q\) are the d- and q-axis inductances, and \(\psi_f\) is the permanent magnet flux linkage. From these, the electromagnetic torque \(T_e\) can be derived. The general torque equation is:

$$
T_e = \frac{3}{2} p \left( \psi_d i_q – \psi_q i_d \right)
$$

Substituting the flux linkages yields a more specific form commonly used in hybrid car motor control:

$$
T_e = \frac{3}{2} p \left[ \psi_f i_q + \left( L_d – L_q \right) i_d i_q \right]
$$

The mechanical dynamics are governed by Newton’s second law for rotation:

$$
\frac{d\omega_r}{dt} = \frac{T_e – T_L – B \omega_r}{J}
$$

where \(T_L\) is the load torque, \(B\) is the viscous friction coefficient, and \(J\) is the combined inertia of the rotor and load. For real-time simulation in hybrid cars, these continuous differential equations must be discretized. Using a fixed simulation time step \(\Delta t\), the mechanical speed update can be approximated with the forward Euler method:

$$
\omega_r(t + \Delta t) = \omega_r(t) + \frac{d\omega_r}{dt} \cdot \Delta t
$$

The rotor mechanical angle \(\theta_r\) is obtained by integration:

$$
\theta_r(t) = \int_0^t \omega_r(t) \, dt + \theta_{r0}
$$

where \(\theta_{r0}\) is the initial angle. Finally, the resolver output signals, which provide feedback to the controller in hybrid cars, are simulated as:

$$
\begin{align*}
V_{\sin}(t) &= A \cdot \sin(\omega_{\text{exc}} t) \cdot \sin\left( \theta_r(t) \right) \\
V_{\cos}(t) &= A \cdot \sin(\omega_{\text{exc}} t) \cdot \cos\left( \theta_r(t) \right)
\end{align*}
$$

where \(A\) is the amplitude and \(\omega_{\text{exc}}\) is the excitation frequency. To summarize the model parameters, Table 1 lists typical values for a PMSM used in hybrid cars, which are essential for configuring the HIL simulation.

Table 1: Typical PMSM Parameters for Hybrid Car Applications
Parameter Symbol Typical Value Unit
Stator Resistance \(R_s\) 0.05 Ω
d-axis Inductance \(L_d\) 0.0002 H
q-axis Inductance \(L_q\) 0.0003 H
Permanent Magnet Flux \(\psi_f\) 0.1 Wb
Number of Pole Pairs \(p\) 4
Rotor Inertia \(J\) 0.01 kg·m²
Viscous Friction \(B\) 0.001 N·m·s/rad

Implementing this model in a real-time HIL system for hybrid cars involves deploying it on an FPGA platform to achieve microsecond-level computation. Using tools like dSPACE SCALEXIO, the model is compiled and loaded onto the FPGA, which executes the equations at a fixed step size, typically on the order of 1 microsecond. This allows for precise synchronization with the motor controller’s PWM signals. In hybrid cars, where dual-motor systems require simultaneous simulation, multiple FPGA cores can be utilized to model each motor independently, ensuring real-time performance. The model’s outputs, such as resolver signals, are then fed back to the controller via I/O interfaces, closing the loop. To validate the model, both open-loop and closed-loop tests are conducted. Open-loop tests verify the model’s response to predefined inputs, while closed-loop tests integrate the actual controller to assess control strategy performance. For hybrid cars, these tests often include torque control and speed control modes under various operating conditions, such as different speeds and load torques.

In torque control mode, the controller commands a torque reference while the motor model operates at a fixed speed. For example, at a speed of 5000 r/min, the torque is ramped from 0 to 360 N·m. The results, as shown in simulated data, demonstrate that the model accurately tracks the torque command with minimal error. The d- and q-axis currents, \(i_d\) and \(i_q\), respond appropriately, aligning with the theoretical expectations for PMSM control in hybrid cars. Table 2 summarizes the performance metrics from such a test, highlighting the model’s accuracy in torque control for hybrid car applications.

Table 2: Torque Control Performance at 5000 r/min for Hybrid Car PMSM
Torque Command (N·m) Torque Response (N·m) Error (%) \(i_q\) (A) \(i_d\) (A)
0 0.01 0.1 0.5 -0.2
100 99.8 0.2 150.3 -1.5
200 199.5 0.25 300.1 -2.0
300 299.2 0.27 450.0 -2.5
360 359.0 0.28 540.2 -3.0

Furthermore, the model’s capability to simulate the entire torque-speed characteristic curve is vital for hybrid cars, where motors operate across a wide range. Positive and negative torque commands at various speeds generate characteristic curves that match experimental data. For instance, in the positive torque region, the model exhibits the typical constant torque and constant power regions, while in the negative torque region (regenerative braking), it accurately reflects the motor’s behavior. These curves are essential for optimizing control algorithms in hybrid cars, ensuring efficient energy recovery and propulsion. In speed control mode, the controller commands a speed reference, and the model responds by adjusting the torque to achieve the desired speed. Tests from -10,000 to 10,000 r/min show that the model reaches the target speeds smoothly, both under no-load and loaded conditions. This is critical for hybrid cars, where speed regulation is necessary for seamless mode transitions, such as switching between electric and hybrid modes. Table 3 provides a snapshot of speed control performance, demonstrating the model’s responsiveness in hybrid car scenarios.

Table 3: Speed Control Performance for Hybrid Car PMSM
Speed Command (r/min) Actual Speed (r/min) Settling Time (s) Overshoot (%) Load Torque (N·m)
0 to 10,000 10,000 2.5 1.2 0
10,000 to 0 0 2.8 0.8 0
-10,000 to 0 0 3.0 1.0 50
0 to 5,000 with load 5,000 1.5 0.5 100

The success of these tests validates the modeling approach for hybrid cars. By leveraging FPGA-based real-time simulation, the model achieves the necessary computational speed without sacrificing accuracy. This is particularly important for hybrid cars, where control strategies must be verified under dynamic and often unpredictable driving conditions. The HIL system allows for extensive testing of fault scenarios, such as sensor failures or inverter faults, which are difficult to replicate safely in physical tests. For example, injecting faults into the resolver signals can test the controller’s fault detection and recovery mechanisms, enhancing the reliability of hybrid cars. Moreover, the model’s modularity enables easy integration with other vehicle models, such as battery or transmission models, creating a comprehensive HIL environment for hybrid car development. This holistic approach accelerates the design cycle, reduces costs, and mitigates risks associated with real-world testing.

In conclusion, the development of a high-precision PMSM model for HIL simulation represents a significant advancement in the field of hybrid car technology. From my perspective as an engineer, this modeling method provides an effective solution for signal-level HIL testing of motor controllers in hybrid cars. By establishing a complete mathematical framework that includes inverter voltage calculation, d-q axis electromagnetic equations, and mechanical motion equations, the model accurately simulates the dynamic characteristics of PMSMs. Deploying this model on FPGA platforms breaks through the microsecond-level computational bottleneck, enabling real-time verification of control strategies. The successful open-loop and closed-loop validations demonstrate the model’s effectiveness in replicating motor behavior under various operating conditions relevant to hybrid cars. This approach not only reduces the risks and costs associated with physical testing but also accelerates the iteration of control algorithms, ultimately contributing to the faster development of efficient and reliable hybrid cars. As hybrid cars continue to evolve toward greater electrification, HIL simulation with accurate motor models will remain a cornerstone of powertrain development, ensuring that these vehicles meet the demanding performance and safety standards of the future.

Looking ahead, the integration of more advanced features, such as thermal modeling or nonlinear magnetic effects, could further enhance the model’s fidelity for hybrid car applications. Additionally, with the rise of connected and autonomous hybrid cars, HIL systems may need to incorporate vehicle-to-everything (V2X) communications and artificial intelligence-based controls. The flexibility of FPGA-based platforms allows for such expansions, making this modeling method a scalable solution for the next generation of hybrid cars. In summary, the synergy between precise mathematical modeling and cutting-edge real-time hardware is key to unlocking the full potential of hybrid cars, paving the way for a sustainable automotive future.

Scroll to Top