Function Development With an Electric-Machine-in-the-Loop Setup: A Case Study

In order to reduce automotive development times and costs, particular development tasks are rescheduled to earlier program phases (frontloading) by applying hardware-in-the-loop (HiL) tests. However, there is a shortage of studies considering HiL tests for function developments considering the thermal behavior of electric drives. This article shall be a first step toward closing this gap. A real-time co-simulation of a battery electric vehicle and a driver model are developed and connected to an electric traction machine at a laboratory test bench. A thermal derating function is designed and calibrated at this test setup. In particular, linear derating functions with different gradients are implemented and tested for high load performances during a track race, and the trade-off between energy demand and the lap time is determined. Larger gradients of thermal derating functions lead to shorter lap times and higher energy demands. Thus, for this case study, an increase of the gradient of the thermal derating function by a factor of two results in a lap time improvement of 2.3% and a higher energy demand of 4.7%. The test results demonstrate how HiL setups offer a favorable testing scenario to calibrate thermal derating functions of electrified powertrains in early development phases.


I. INTRODUCTION
F OR automotive development programs of new electric powertrains, investments in time and costs are required to decrease steadily [3]- [8]. The development programs usually follow the V-cycle with three particular phases. These are system specification and implementation, followed by system integration and thereafter by system test and validation (see Fig. 1). Originally, these phases are conducted sequentially. However, by rescheduling testing and validation tasks to earlier program phases, several development steps can be parallelized. This approach is usually called frontloading [3], [9]. Utilizing frontloading, potential errors can be detected in earlier program phases so that appropriate design changes can be applied in a timely fashion. As a result, development time and costs due to error fixing and design changes can be reduced [3]- [8]. In this contribution, a hardware-in-the-loop (HiL) component test of an electric traction machine (ETM) is presented. This use case is an example of how functional development tasks of prototype vehicles can be rescheduled to early development phases according to the frontloading approach. For HiL tests in general, the test object is connected with a real-time simulation of the remaining system. By applying this connection, the bidirectional interactions between the test object and the remaining system are considered. Thus, instead of studying the test object isolated from the remaining system, the interdependencies of neighboring components and the entire system can be investigated [10].
HiL setups of electric powertrains can be divided into signal, electrical, and mechanical levels [11]- [14]. On the signal level, the control unit is tested as a real component in connection with a real-time simulation of the electric powertrain [15]- [17]. For the electrical level, the power electronics are added to the control unit at the test bench, whereas the ETM is simulated [18], [19]. On the mechanical level, the ETM with power electronics and control units are tested as real components, and the remaining powertrain and the vehicle are simulated.
In this article, a mechanical HiL setup is utilized. Mechanical HiL setups are an established testing environment for conventional powertrains [10], [20]- [22], as well as for electrified powertrains [14], [18], [23]- [31]. For instance, in [27] tested at a HiL setup focusing on the interactions between electric drive and vehicle dynamic behavior. Another contribution focuses on different energy storage systems of a parallel hybrid powertrain [28]. In [30], an electric drive for a BEV is tested on a HiL setup for different driving cycles, and the test results are compared to simulations based on steadystate measurements. It has been determined that the HiL measurements and the simulation results differ, especially during dynamic operations. This highlights the relevance of HiL tests. However, there is a particular shortage of studies considering mechanical HiL tests regarding the thermal behavior of electric drives, especially thermal derating functions of electric drives in interaction with the vehicle dynamics. This contribution shall be a first step toward closing this gap.
In this contribution, thermal derating functions of a BEV are developed and calibrated at a mechanical HiL setup on a high load test track. In general, thermal derating functions protect powertrain components from overheating by limiting the available power of the electric drive in case the component temperatures exceed certain thresholds [32]. The limiting strategy of the electric drive has significant effects on vehicle behavior and performance. A detailed evaluation of these effects is the subject of this contribution. Thereto, the HiL setup, including the laboratory test bench and the real-time co-simulation environment, are described in Section II. In Section III, the results are demonstrated with respect to the effects of different thermal derating functions on torque oscillations, vehicle velocity, and energy demand. Subsequently, this article at hand is concluded in Section IV.

II. METHOD -HiL APPROACH
The HiL setup is divided into two main sections. These sections are the laboratory test bench and the real-time co-simulations. Multiple physical quantities are exchanged between the test bench components and the real-time simulation platforms. An overview of the relevant quantities is provided in Fig. 2.

A. Real-Time Co-Simulations
For the real-time simulations, a co-simulation approach with two dedicated HiL simulators has been chosen. This approach provides multiple processor cores and enables a variable assignment of the simulation tasks to the individual processor cores with respect to the simulation demand. Thus, high computational power is required in order to meet realtime conditions at a sample rate of 1 ms. Further advantages of co-simulations are presented in [33].
The co-simulation setup consists of the HiL simulators A and B shown at the bottom of Fig. 2. HiL simulator A is a dSPACE Scalexio Processing Unit, and HiL simulator B is an IPG Automotive xPACK4. Both HiL simulators are connected via deterministic EtherCAT-Communication, complying with real-time conditions. HiL simulator A performs the simulations of the final drive and the power control unit (PCU) based on the software MATLAB Simulink. HiL simulator B conducts the simulations of the driver behavior and the vehicle dynamics utilizing the software CarMaker [34], [35].
1) Vehicle Dynamics Simulation: For this use case, an A-segment rear-wheel drive (RWD) BEV is investigated. The most relevant vehicle parameters are listed in Table I, and they are constant for all tests. The vehicle dynamics model calculates the 3-D vehicle drive state for each time step considering simulation parameters, as well as position-and time-dependent inputs. Therefore, a multi body system based on the guidelines introduced in [36] is computed, which has been validated in [37] and [38]. The overall structure of the vehicle dynamics model is displayed in Fig. 3.
Position-dependent inputs are provided by the road model. This refers to, e.g., the 3-D alignment of the road expressed in the environment frame Fr e . Time-dependent inputs are transmitted to the vehicle dynamics model by the driver and the final drive model, as shown in Fig. 2. The final drive model provides the actual driveshaft torque M act,Whl of each wheel, which is computed considering the measured torque of the ETM at the test bench. The inputs from the driver model are the steering wheel angle δ StWhl , which determines the vehicle yaw rate ψ act,z and the brake pedal force F BrkPdl . It is used to calculate the mechanical brake force on each wheel, considering the hydraulic ratio and the brake pressure distribution between the front and rear axles.
The dynamics simulation divides the vehicle into five rigid bodies interconnected by five joints. For each body, the motion is described by differential and algebraic equations. The main body is the chassis Fr c . It is connected to each wheel carrier body Fr w,i j via suspension modules, and the environment Fr e as displayed in Fig. 3. Therefore, each wheel carrier moves relative to the chassis as a function of the steering angle and the suspension compression. The effective 3-D vectors for the cutting moments and forces within each wheel carrier's coordinate systems are computed and then transformed into the chassis' coordinate system to calculate the driving resistances.
Due to their high relevance for the thermal behavior of the powertrain components, the calculation of each wheel's speed n act,Whl and the vehicle velocity in longitudinal direction v act,x will be explained. The calculation of the wheel speed is based on a torque balance for each wheel in its Frame Fr w,i j , depicted on the left in Fig. 4. The angular momentum of a rotating mass equals the sum of all acting forces expressed in its axis of rotation. Applied to a wheel, (1) yields the rotational speed n Whl,i j , which depends on the inertia I i j , the actual driveshaft torque M act,Whl , the applied brake force F B and its distance to the centerline r B , as well as on the tire contact force in x-direction multiplied with the tire's dynamic wheel radius r dyn,i j F x,i j is an output of the utilized contact point interface (CPI) tire model, which only describes the tire response forces and torques in its contact point and neglects vertical deformations [35]. Simplified, F x,i j depends on the vertical wheel force F Z and the friction coefficient based on the slip of each tire at the former time step. The vehicle velocity is calculated in the chassis frame Fr c , displayed in Fig. 3, by computing the integration of the force balance of the vehicle. It considers the propelling force in the center of gravity F prop , the rolling resistance F r, the driving resistance caused by lateral dynamics F x,l , as well as the air drag F d and the grade resistance F g as displayed in the following equation: Compared to longitudinal dynamics simulations similar to [31] and [32], the applied 3-D vehicle dynamics simulation also considers the lateral resistance force F x,l . The lateral resistance force is illustrated at the wheel's top view in Fig. 4. The centrifugal force F y acts rectangular to the vehicle velocity, which is compensated by the side force F S . The side force acts rectangular to the wheel's plane. However, the wheel's plane is tilted at an angle ε to v act,x , which results in the resistance force F x,l according to (3). The angle ε depends on the sideslip angle of the vehicle α slip , as well as the steering angle δ StWhl The relevant outputs of the vehicle's dynamics simulation are the position of the vehicle with respect to the road, the actual vehicle velocity, and the acceleration in the direction of travel, as well as the actual yaw rate. These outputs are transmitted to the driver model.
2) Driver Model: The driver model controls the vehicle's multidirectional behavior with respect to the requested driving trajectory and the requested velocity, as well as the vehicle drive state, which is transmitted from the dynamics simulation. As illustrated in Fig. 5, the driver model is divided into the driver simulation and the initialization, which is calculated once at the beginning of a test.
Within the initialization, the requested driving trajectory s req , and the requested velocity profile v req for the entire track are determined. The determination of the requested trajectory utilizes the given road coordinates x R and y R in order to calculate a continuous spline as a function of x and y in the environment coordinates, as well as a radius r (s) for each curve. Thereafter, the radius r (s) is utilized to estimate the requested vehicle velocity v req (s) on the spline s according to The vehicle velocity is further adjusted by considering the set maximum acceleration a x,max and deceleration a x,min of Table II. In addition, smoothing functions are applied to achieve a continuous velocity profile. For this article, a medium aggressive velocity profile has been chosen, whose parameters are presented in Table II [34].
The driver simulation is split into a lateral controller and a longitudinal controller. The former utilizes the deviation of the actual vehicle position to the requested trajectory in lateral position y and the actual yaw rate ψ act,z to set the necessary steering wheel angle δ StWhl . The longitudinal controller uses the difference between the requested and actual velocity to determine the force on the brake pedal F BrkPdl and the position of the drive pedal s DrvPdl , which is transmitted to the PCU.
3) PCU: The PCU computes the torque request, which is sent to the power electronics of the ETM utilizing the drive pedal position and enforcing protection functions. The translation of the drive pedal position s DrvPdl into a driver torque request M req,Driver is conducted by a pedal map, which is derived from a velocity-dependent pedal map of a series production BEV of the A-segment class.
For component protection, the driver torque request M req,Driver is subject to multiple software-based protection functions. The thermal derating is the most relevant function in this context since it affects the ETM operation significantly by protecting it from overheating. The functionality of the thermal derating is based on [32] and illustrated in Fig. 6. The inputs of the thermal derating function are the ETM speed n ETM and the ETM temperature T ETM , which is measured at the winding head of the ETM at the test bench. Based on lookup tables, the maximum torque of the ETM full load curve M full,load and the thermal derating factor f Derating are set. The thermal derating factor equals one, if the ETM temperature T ETM is smaller than a predefined lower temperature threshold. For a T ETM value larger than an upper temperature threshold, the derating factor equals zero. In between these temperature thresholds, the derating factor is linearly interpolated. For the HiL tests presented in Section III, the lower temperature thresholds are varied. Thus, the gradients of the thermal derating function are varied as well, and the effects of the gradient on the vehicle dynamics are investigated.
The maximum torque M fullload and the thermal derating factor f Derating are multiplied and yield to the maximum torque M max,Motor for motor operation. Identically, the minimum torque M min,Generator for generator operation is set. Both quantities are the boundaries that limit the driver torque request M req,Driver if necessary. The output of the thermal derating is the final torque request M req,ETM , which is transmitted to the power electronics at the laboratory test bench via deterministic Gigalink-Communication. In terms of thermal derating, the HV battery could be another critical component. However, in [39], a HV battery for a motorsport application has been presented. The critical time constant of the thermal capacity from the HV battery is 2 h. Compared to this time constant, the test duration of 12.5 min is relatively short. Hence, regarding thermal derating, the battery model is neglected in [39], as well as in the presented work.

B. Laboratory Test Bench Setup With ETM and Power Electronics
The power electronics receive the torque request M req,ETM from the PCU (see Fig. 2). According to this torque request, the power electronics control the ac currents for the ETM at an inverter operation frequency of 10 kHz. The inverter control is based on the algorithms for maximum torque per ampere (MTPA) and flux weakening and maximum torque per voltage (MTPV). These control algorithms are implemented by lookup tables with particular I d and I q current values for each operation point. The investigated ETM is an interior permanent magnet synchronous machine (IPMSM) with a maximum torque of 160 Nm and a maximum mechanical power of 82 kW. It is connected to the load machine via a torque measurement flange, which sends the contactless measured torque M act,ETM to the final drive simulation of HiL simulator A. From the final drive, the measured torque M act,ETM is converted into the wheel torques M act,Whl , which lead to an acceleration and change of velocity of the vehicle model at simulator B. The simulated vehicle velocity is the feedback signal for the driver model in order to control the vehicle velocity by requesting a particular torque considering the protection functions of the PCU. Thus, this HiL setup provides a comprehensive testing environment with a measured torque feedback from the test bench. This feedback enables investigations on the torque functions of the PCU in interaction with the driver behavior and the ETM test bench.
For setting the ETM to the corresponding speed of the vehicle velocity, the ETM speed n ETM is transmitted from   Fig. 2). Here, the ETM speed is adjusted by a proportional-integral-derivative (PID) controller. The control parameters are determined by manual calibration in order to achieve the best possible trade-off between stable and highly dynamic operation. The control parameters are kept constant for all tests.

C. Initial Calibration of Thermal Derating Function
The temperature of the ETM can be described as a function of the thermal capacity C ETM , coolant temperature T cool , thermal resistance W and the ETM losses P loss with time delay Equation (5) is a first-order differential equation, which can be described as a transfer function with time constant (PT1) and time delay according to the Laplace transformation The characteristic parameters are the proportional factor K p , the time constant t s , and the time delay t d . These parameters are approximated based on measurement data. For a continuous operation point of 80 Nm and 5000 r/min, the saturation of the ETM temperature is measured over 20 min (see Fig. 7). For this operation point, the thermal ETM behavior can be approximated by the transfer function (6) with the torque as input and the temperature as output variables. The characteristic parameters are presented in Table III. However, applying the parameters of continuous operation, the simulated ETM temperature is below the measurements for peak operation. This is illustrated in Fig. 8, in which the heating curves for maximum torque at 4000, 10 000, and 14 000 r/min are depicted. Hence, in a second iteration, the parameters of the transfer function for continuous operation are adjusted. The parameters for peak operation are presented in Table III. These parameters are a worst-case approximation in order to meet the maximum measured ETM temperatures.
The ETM model with (6) is combined with the derating function of Fig. 6, and critical torque step responses are evaluated. In Fig. 9, the interaction between the ETM model and the derating function is illustrated. For a maximum driver torque demand of 160 Nm, the ETM temperature increases from 60 • C. At the lower derating threshold, the torque is reduced due to thermal derating. For stable temperature control, the lower derating threshold is calibrated in such a way that the ETM temperature does not exceed the upper derating threshold due to an overshoot of the ETM temperature. For a lower derating threshold of 125 • C, the ETM temperature increases up to 155 • C at 44 s and does not exceed the upper temperature threshold. Thus, 125 • C is selected as an optimum setting, and this derating strategy is called L-125-155.

III. RESULTS
In terms of stability, the thermal derating function L-125-155 has been derived from the simulation in Section II-C. In this section, the interaction between varying thermal derating functions, the virtual vehicle, and the ETM at the test bench are investigated in terms of lap time and the dc energy demand. Similar to the implementation of multiple series production vehicles, linear derating strategies are applied. E.g., for the derating strategy L-125-155, the derating factor decreases linearly from one at the lower derating threshold of 125 • C to zero at the upper derating threshold of 155 • C. For all derating strategies, the upper derating threshold is the same. Considering manufacturer standards, the upper derating threshold of the ETM windings yield to 155 • C. The derating  strategies vary depending on the lower derating threshold, which leads to different gradients of the derating functions (see Fig. 10).
For studying the ETM's thermal behavior, one lap of the Nuerburgring Nordschleife has been chosen as a high load test scenario. This test track has a length of 20.7 km, with severely altering elevations (see Fig. 11).
For all test scenarios, the thermal settings of the test bench conditioning system are the same. The volumetric cooling flow rate of the ETM is set to 8 L/min and 60 • C. The inverter is cooled at 11 L/min and 11 • C. Compared to the ETM setting, the inverter is conditioned at a higher volumetric flow rate and a significantly lower temperature, so that the inverter temperature does not reach its lower thermal derating threshold during the following HiL tests. Therefore, thermal derating due to inverter overheating cannot occur, and the HiL measurements are not affected by a possible thermal derating of the inverter. By applying the same thermal starting conditions, different linear derating strategies are tested at the HiL setup for one lap on the test track. The results are presented in Fig. 12, and the effects of the thermal derating strategies on the lap time and dc energy demand are discussed in Sections III-A and III-B.

A. Effects of the Gradients of the Thermal Derating Functions on DC Energy Demand and Lap Time
By comparing the thermal derating strategy L-130-155 to L-105-155, the lap time is significantly reduced by 17 s. Simultaneously, the dc energy demand increases by almost 1.4 kWh/100 km (see Fig. 12). Hence, an increase of the thermal derating gradient by a factor of two leads to an increased dc energy demand of 4.7% and a lap time improvement of 2.3%. This lap time improvement is due to a higher average velocity. In Fig. 13, the velocity profiles for the derating strategies L-130-155 and L-105-155 are illustrated. Both velocity profiles show a good congruence at the beginning of the test track, where the vehicle drives downhill, and the ETM is not required to operate at its maximum power. Thus, the ETM temperatures are significantly below the derating threshold, and the different thermal derating functions do not affect the ETM power and the corresponding vehicle velocity. However, especially in the section from 8 to 11 km, the vehicle velocity is significantly lower with the L-105-155 strategy than with the L-130-155 alternative. This section is depicted in Fig. 13. In the center are the profiles of the driver torque requests M req,Driver , and the torque requests M req,ETM , which is limited due to the thermal derating function of the PCU.
By starting at 8.1 km, the vehicle is driven uphill, and the driver requests the maximum torque of 160 Nm. For L-130-155, the ETM temperature exceeds the lower derating threshold by almost 2 • C, and subsequently, the torque request is derated to 150 Nm. For the derating strategy L-105-155, the lower derating threshold is exceeded by almost 15 • C. Hence, the driver torque request is reduced even more to 115 Nm. As a consequence, the vehicle acceleration is slower.
However, due to the higher torque of test L-130-155, the ETM temperature increases up to 147 • C at a distance of 8.7 km. Hence, the driver torque request is reduced to 42 Nm, and the vehicle acceleration reduces, which is determined by a lower velocity gradient in Fig. 14. In contrast, the ETM temperature of L-105-155 increases less so that the ETM torque is higher. For a short moment, this leads to a higher velocity compared to L-130-155 at 8.6 km. However, the majority of the velocity of L-105-155 is equal to or smaller than L-130-155, which is the reason for the higher lap time. A similar behavior was determined for the other derating strategies L-115-155 and L-125-155, and in summary, it can be concluded that within particular limits, steeper thermal derating gradients lead to a decrease of lap time.

B. Oscillations Due to the Interactions Between Thermal Derating Strategy and Thermal Behavior of the Electric Drive
For derating strategies from L-105-155 to L-130-155, steeper thermal derating gradients lead to a decrease of lap time. However, there is a particular limit to this correlation. For derating strategies larger than L-130-155, it is determined that the lap time increases instead of further decreasing (see Fig. 12). The reason for this are the torque oscillations, which are due to oscillating ETM temperatures in interaction according to the derating functions.
These oscillations are illustrated in Fig. 15 for the thermal derating strategy L-145-155. At the distance of 9.1 km, the ETM temperature is 140 • C, which is below the lower derating threshold of 145 • C. Hence, the driver torque request M req,Driver of 160 Nm is met by the torque request M req,ETM from the PCU, without a reduction by the thermal derating function. In consequence of the high torque, the ETM temperature increases, and the PCU reduces the torque request at a distance of 9.2 km. However, due to the thermal inertia of the ETM, the ETM temperature continues to rise up to 159 • C, which even exceeds the upper derating threshold of 155 • C. As a result, the ETM torque is set to 0 Nm at a distance of 9.4 km. The described interactions between thermal inertia and the thermal derating function lead to the oscillations of the ETM temperature and the ETM torque. Moreover, comparing the magnitude of the torque oscillation of the thermal derating strategy L-145-155 to L-130-155, it turns out that these oscillations increase with a higher gradient of the thermal derating function (see Fig. 15).  In theory, the increase of oscillations can be illustrated in the root locus curve of Fig. 16. Since the root locus can only be applied for rational transfer functions, the controlled system equation (6) with a time delay element of the ETM is required to be transformed into a rational function. Utilizing the pade approximation, (6) can be written as [40] G(s) = K p t s · s + 1 · 1 − 0.5 · t t · s 1 + 0.5 · t t · s .
The thermal behavior of the ETM is described by (7). There is one pole at −0.01 related to the time constant t s . The second pole is at −0.25, corresponding to 0.5 for the time delay t t . The derating function can be described as a proportional controller in interaction with the controlled ETM system (see Fig. 16).  In the root locus curve, the proportional controller and the controlled system are considered (see Fig. 17). For different derating factors K c , the stability of the system and the damping correlation are determined. For proportional controller settings with small K c values, the damping factor increases, which explains lower oscillations in the controlled system. This is illustrated in Table IV; the damping factor increases from 0.24 to 0.6 for the derating strategies L-130-155 to L-105-155. In terms of stability, for derating strategy L-145-155, K c equals 16 Nm/ • C, and the pole pairs have a positive real part. Hence, the entire system becomes unstable. The instability is determined in the HiL measurements by the ETM temperatures exceeding the upper temperature threshold of 155 • C (see Fig. 15). Also, the instability can be determined by the torque requests, which oscillates between the limitations of 0 and 160 Nm.
Regarding lap time and energy demand, the torque oscillations set a particular limit to the gradient of the thermal derating function. For the derating function L-145-155, the dc energy demand and the lap time are significantly higher than for the derating functions L-115-155 and L-125-155 (see Fig. 9). Moreover, for the thermal derating function L-135-155, the dc energy demand increases by almost 0.1 kWh/100 km, and the lap time increases by one second compared to L-130-155. Hence, regarding lap time and energy demand, the steepest derating gradient is L-130-155.
As demonstrated, for linear derating functions, there is a particular trade-off between lap time improvement by increasing thermal derating gradients and higher magnitudes of torque and ETM temperature oscillations. For future work, non-linear and more advanced derating functions shall be investigated, e.g., thermal derating functions with damping strategies similar  [32] or ETM model-based strategies applying a modelpredictive strategy (MPC) for the ETM temperature control [41]. However, this use case clearly demonstrated how the interactions between the thermal behavior of the ETM and the vehicle performance could be studied with the presented HiL setup. This is another example of how HiL setups can be favorably applied to develop, calibrate, and validate thermal powertrain control functions by means of laboratory test benches. In the presented case study, test benches can deliver a decisive contribution for efficient frontloading for automotive development programs because complex technical dependencies do not have to be simulated in detail (here: thermal behavior of the ETM), they can be tested directly due to the availability of real hardware.

IV. CONCLUSION
In this article, the feasibility of a HiL setup for thermal calibration tasks of electric powertrains is shown. Thereto, a real-time cosimulation of a BEV in interaction with a driver model is developed and combined with an ETM installed on a laboratory test bench. Different gradients of linear thermal derating functions are implemented and tested considering vehicle operations at a high load test track. It is determined that steeper gradients lead to shorter lap times and higher energy demands. In particular, an increased gradient of the thermal derating function by a factor of two leads to a lap time improvement of 2.3% combined with a 4.7% higher energy demand. However, a higher thermal derating gradient in interaction with the thermal behavior of the ETM causes increased magnitudes of torque oscillations. Therefore, the increase of the thermal derating gradient is limited. These test results are based on a HiL test setup considering the interdependencies between thermal behavior of the ETM at the test bench, the virtual vehicle performance, as well as thermal derating strategies of the PCU. This highlights the relevance of HiL testing for thermal calibration tasks in early development phases, and it represents an additional example of how HiL testing can enhance frontloading for automotive development programs.