#### Abstract

An electronic stability control (ESC) based on torque distribution is proposed for an eight in-wheel motor-independent drive electric vehicle (8WIDEV). The proposed ESC is extremely suitable for the independent driving vehicle to enhance its handling stability performance. The vehicle model is established based on a prototype 8WIDEV. A hierarchical control strategy, which includes a reference state generation controller, an upper-level vehicle controller, and a lower-level optimal control allocation controller, is utilized in the ESC. The reference state generation controller is used to obtain the ideal reference vehicle state. The upper-level vehicle controller is structured based on sliding mode control, which obtains the generalized objective force during 8WIDEV movement, therein considering the side slip angle and yaw rate. The lower-level optimal control allocation controller attempts to allocate the vehicle’s objective force in each motor optimally and reasonably. The model is validated by field measurement results under the step input condition and snake input condition. Simulation results from a hardware-in-the-loop (HIL) simulation platform indicate that the ESC based on the optimized allocation proposed for 8WIDEV achieves better stability performance compared with direct yaw moment control (DYC).

#### 1. Introduction

The structure of an electric vehicle driven by in-wheel motors is different from that of traditional vehicles driven by internal combustion engines in that it does not use an engine or transmission, places the motor inside the hub appropriately, and uses a battery as the power supply. The eight in-wheel motor-independent drive electric vehicle (8WIDEV) has eight independent controllable motors, which has the potential to improve the vehicle handling stability [1, 2]. The 8WIDEV system is a typical redundantly actuated system and has greater flexibility than four in-wheel motor-independent drive electric vehicles [3]. Due to its many advantages, 8WIDEV is widely used as a special vehicle. However, 8WIDEV has different characteristics from 4WIDEV, a high center of mass and complicated driving conditions. Because the executor has numerous and more complex nonlinear characteristics, the vehicle control strategy is more complicated [4].

Currently, there are three commonly used control structures for the dynamic control of a vehicle driven by in-wheel motors: decentralized, centralized, and hierarchical control structures. Because of its flexibility, the hierarchical control strategy is more suitable for solving complex nonlinear and redundant systems with executive constraints, compared with decentralized and centralized control structures [5–8]. The hierarchical control structure uses a control law in the upper controller to solve the complex and nonlinear problem of the vehicle. The lower-level optimal control allocation controller used in the hierarchical control structure assigns the target moment to the actuators under the constraint condition [9, 10]. A commonly used control method considers the problem as a control allocation problem with constraints [11, 12]. Most research on vehicle control systems is now directed at 4WIDEV, having made great progress [13–15]. A state feedback-based control system using direct yaw moment control is set up for 4WIDEV, effectively reducing the modeling difficulty. Comparing with the widely used model following control, the stability of the vehicle is improved [3, 8, 16]. A control strategy with an optimal target is proposed to improve the electric drive vehicle dynamic stability and maneuverability. In lower-level optimal control allocation controllers, an optimization algorithm is used to distribute the motor torque to achieve effective control [17, 18]. Based on a hierarchical control structure, an ESC system suitable for a 4WIDEV is presented. Three levels of control logic are designed in the ESC system, which contains a torque distribution algorithm based on a minimum-objective-function to enhance the vehicle’s stability [19]. Fully utilizing the hierarchical structure, a linear quadratic regulator control method is obtained by controlling the yaw rate to design the upper-level controller, and a fast calculation method is used to achieve a fast motor torque distribution [20]. Taking two variables reflecting the advantages and disadvantages of the vehicle’s lateral movement in the motion control unit, the objective yaw moment is obtained by fuzzy logic control. However, this method is highly dependent on engineering and a lack of control accuracy [21]. A new control method is proposed based on model predictive control (MPC) theory to address the issues of multiple objectives with constraints, which can maximize the regeneration efficiency while maintaining the vehicle dynamics [22]. These methods focus on the vehicle torque allocation but do not optimize the vehicle handling stability for vehicle motion control.

However, fewer studies have focused on the 8WIDEV with high weights. As the number of driving wheels increases, the 8WIDEV becomes applicable to more complicated driving conditions, given its greater flexibility and maneuverability. To improve the 8WIDEV handling stability, the longitudinal dynamic control and lateral dynamic control are constructed. The target lateral force and target yaw moment are obtained by controlling the two corresponding vehicle variables in lateral control [23]. A hierarchical control allocation strategy is developed by considering the real-time performance of the control for multiaxle land vehicles equipped with independent driving wheels [24]. Because the vehicle’s steering wheel angle is not large, the distribution of the motor torque needs to satisfy the demanded lateral force of the vehicle, and the torque of the motor readily experiences a saturated amplitude. Vehicle stability control is mainly reflected in two variables. Vehicle handling stability is not only related to the vehicle longitudinal speed but also directly related to vehicle yaw speed and side slip angle, which is directly related to the vehicle heading angle, and determines the performance of the vehicle trajectory tracking. In addition, although the two variables are controlled simultaneously sometimes and the target yaw moment and lateral force are obtained, the motor output torque readily becomes saturated for a vehicle without active steering [10, 23]. Based on nonlinear control theory, a fuzzy logic method, the yaw moment is obtained by controlling the lateral slip angle and yaw rate. However, it is not easy to establish precise mathematical relations for this control method, and it is more dependent on experience [21].

The yaw rate is mathematically related to yaw moment; thus, it can be directly controlled. However, the relationship between the side slip angle and yaw moment represents an “un-matching system,” which can be expressed as that the side slip angle being tracked to an ideal stare quantity by controlling the yaw rate as an intermediate variable; however, the actual yaw rate is not sufficient to track its reference value [25]. The required lateral force can be calculated via steering angle control, and the expected yaw moment is obtained by fully utilizing the yaw rate. This integrated control method can be used by active steering vehicles [26]. The control configuration vehicle principle is structured to improve the flexibility and performance of the structure layout. Although this method can focus on the side slip angle control, it is only suitable for steer-by-wire vehicles, which presents limitations for use in vehicles without active steering or auxiliary steering.

Most control allocation rules now adopt traditional allocation methods such as average allocation and direct control allocation. These methods are faster in calculating the torque distribution; however, their torque allocation method is simple. The vehicle dynamics constraints and the optimization of the torque distribution need to be fully considered [27, 28]. Considering the nonlinear saturation and coupling relationship of the tire force and torque saturation amplitude of the drive motor, a lower-level optimal control allocation controller is constructed. A nonlinear tire is regarded as a more extensive “constrained nonlinear actuator” in the control allocation. The optimization-based control allocation method with weighted least square (WLS) is used for the torque force distribution; this can effectively increase the computation speed [29].

In this paper, ESC based on a hierarchical control strategy is established to enhance the performance of the handling stability and trajectory capability of 8WIDEV. The hierarchical control structure includes the reference state generation controller, the upper-level vehicle controller, and the lower-level optimal control allocation controller. By utilizing the classic reference model of the vehicle, a monorail of four-axle vehicles based on a two DoF model is established to obtain the required reference state of the vehicle. The reference state generation controller is designed using the reference state of the vehicle. In contrast to the linear control method, attempting to consider vehicle nonlinearity and uncertainty, the upper-level vehicle controller is built using the nonlinear control method, therein achieving strong robustness to vehicle parameter uncertainties and external disturbances. The upper-level vehicle controller includes a yaw moment synthesis controller, therein considering the two control variables related to lateral motion tracking while adjusting the weight coefficient. Actuator torque allocation for redundant systems is modeled as a constrained optimization problem. The main contribution of this paper lies in the following points. First, based on prototype vehicle parameters, a dynamic model of an 8WIDEV is established. This model can fully reflect the dynamic characteristics of the vehicle and provide a favorable basis and conditions for verifying the control method. The effectiveness of the vehicle model is verified through comparison simulations in MATLAB/Simulink with the experimental results for the prototype vehicle. Second, the vehicle slip angle and the yaw rate tracking are realized via sliding mode control, and the corresponding yaw moment is obtained. This provides the advantage of avoiding the saturation of the motor torque caused by satisfying the lateral force requirement. The stability control strategy proposed in this paper improves the stability of vehicles according to the simulation and contrasts with DYC control. Third, because most previous stability control studies on the 8WIDEV lack validation, in this paper, a hardware-in-the-loop (HIL) experiment verifies that the ESC proposed improves vehicle handling and stability [30, 31].

The structure of this paper is divided into the following main parts: first, the 22-DoF vehicle dynamic model is introduced, including the vehicle body model, suspension model, wheel model, tire model, and electric motor model. Second, a vehicle control strategy for the 8WIDEV based on a hierarchical structure is proposed, whereby the ESC system in the vehicle improves the vehicle handling stability. Finally, analysis of a simulation experiment and a hardware-in-the-loop (HIL) experiment to verify the vehicle dynamic model established in MATLAB/Simulink demonstrates the dynamic characteristics of the 8 × 8 prototype vehicle and verifies the effectiveness of the control strategy proposed in this paper to improve the vehicle handling stability and good trajectory tracking ability. Finally, we conclude the paper, therein describing valuable observations obtained in this study.

#### 2. Vehicle Model

The research in this paper focuses on a 8WIDEV handling stability project. The 8 × 8 prototype vehicle is shown in Figure 1. The 8WIDEV is equipped with eight independently controllable in-wheel motors, which can be described as larger unsprung masses. The importance of vehicle dynamics control is to establish a nonlinear vehicle dynamics characteristic model that can reflect the vehicle dynamics characteristics.

This section mainly describes the 22-DoF vehicle dynamic mode, including a model of the vehicle body, suspension, tires, wheels, and electric motor. The vehicle body model usually only considers motion in three directions. Considering the static and unsteady problem of the suspension system and the body in the vertical dynamics, a suspension model based on the static equilibrium is constructed, and the vehicle body model considers the 6-DoF of the body. Considering the effects of the slip rate, side slip angle, road adhesion coefficient concerning the tire forces, nonlinear saturation, and coupling of the total tire force, a tire model based on the nonlinear saturation and coupling characteristics of the tire is established. Table 1 lists the main parameters of the 8WIDEV. The parameters of the 8WIDEV are obtained from the manufacturer. The vehicle body model, suspension model, wheel model, tire model, and motor model constitute the 8WIDEV dynamic model. As described in the previous paragraph, the following sections mainly describe the modeling of each part of the 8WIDEV based on a variety of theoretical methods. The 8WIDEV dynamic model is validated in Experiment and Simulation.

##### 2.1. Vehicle Body Model

Figure 2 shows the planer motion of the vehicle body, which is considered as a general rigid body with 6-DoF, including translational and rotational degrees of freedom in three directions. The equations of motion for the vehicle model can be expressed as follows:where and . and are the rolling resistance and air resistance, respectively; is the slope resistance; ; , , and are the longitudinal, lateral, and vertical acceleration of the vehicle, respectively; , , and are the longitudinal, lateral, and vertical velocity of the vehicle, respectively; , , and denote the roll, pitch, and yaw rate, respectively; and are the roll angle and pitch angle, respectively; and , , and represent the longitudinal force, lateral force, and vertical force in the vehicle coordinate system, respectively. To clarify the variables, denotes the first/second/third/fourth axis, and denotes the left/right wheel of the vehicle. , , and represent the centroid height, track width, and distance from the axles to the centroid; and are the vehicle mass and spring mass, respectively; , , , , and denote the rolling resistance coefficient, gradient, air resistance coefficient, windward area, and air density, respectively; and , , and are the moment of inertia around the *x*-axis, *y*-axis, and *z*-axis, respectively.

The tire coordinate system is shown in Figure 3. The relationship between the tire force in the vehicle coordinate system and in the tire coordinate system can be expressed by the following equations, which provide representations in different coordinate systems:

##### 2.2. Suspension Model

The suspension and vehicle body in the vehicle vertical dynamics represent a statically indeterminate problem. Based on the traditional displacement method, the suspension force and vertical force of the tire are solved. In addition, the suspension model is built based on suspension parameters and suspension system theory of 8WIDEV and mainly refers to the dynamic method of multiaxle vehicle suspension modeling [23]. First, the suspension force and tire load under the static balance of the vehicle are solved by the displacement method. Second, the dynamic suspension force and the dynamic tire load are calculated in the motion state relative to the static equilibrium state, being based on the motion differential equation.

Under static balance of the vehicle, the balance of the vehicle vertical force and the balance equation of the body moment are given as follows:

It is assumed that the stiffness of each axle suspension is the same, and the static suspension force of each axle is obtained:where

The static forces of each suspension are described as follows:

Then, the static vertical load of each wheel is described as follows:where is the mass of each electric wheel.

The dynamic force of suspension caused by a change in the body posture is mainly reflected in the vehicle load transfer caused by the movement of the vehicle and the pitch motion. The dynamic suspension force expression is as follows:

The vertical movement, tilting movement, and pitching movement of the body lead to the vertical deformation of the suspension expressed as follows:

The dynamic vertical force of the wheel caused by the unevenness of the pavement is as follows:

The suspension system and the vertical load of the tire can be expressed as follows:where and are the vertical displacement of the vertical position and the vertical displacement of the suspension system, respectively; and are the corresponding *K* and *C* tire characteristics; and and denote the *K* and *C* characteristics of the suspension.

##### 2.3. Wheel Model

Based on the dynamic analysis of wheels in automobile theory [26], the differential equation for wheel motion can be written as follows:where , , , and represent the electric wheel torque, the moment of inertia, the angular velocity, and the effective radius of the tire, respectively.where is the tire rolling resistance moment and and correspond to the vertical force of the wheel and the rolling resistance coefficient.

##### 2.4. Tire Model

Tires have strong nonlinear characteristics, which are mainly manifested in the relationship between the lateral force and the cornering angle of the tire and the relationship between the lateral force and the longitudinal force of the tire. It is important to establish a tire model that can reflect the nonlinear characteristics of vehicle tires. Currently, the “magic” tire model, power exponential unified tire model, and swift tire model are commonly used in tire modeling. In vehicle dynamics research, the widely used “magic” tire model established by Professor Pacejka [32], based on test data and formula obtained by trigonometric function fitting, can be used to completely and accurately describe lateral/longitudinal forces. The “magic” tire model is more suitable for multiwheeled vehicles of large mass and high centroid, and it is often used in multiaxle vehicle tire modeling; this model is used in the tire modeling of the 8WIDEV. The tire model, based on exact mathematical formulas, clearly describes changes in the tire longitudinal slip ratio/lateral forces with changing tire slip ratio/side slip angle. The longitudinal force and lateral force are obtained by considering the influence of the ground adhesion coefficient by modifying the basic expressions. Their specific description is given as follows:where denotes the ground adhesion coefficient; and are the corresponding longitudinal slip rate and side slip angle of the corresponding tire, respectively; and , , , and are gated by the fitting parameters of the tire model.

Another way to express the longitudinal/lateral tire force and the tire slip rate/side slip angle is shown in Figure 4. Figure 4 shows the relationship between the tire force and the slip rate clearly and is accurately expressed by the magic formula tire model. Figure 4 shows the tire longitudinal force and tire lateral force with respect to the tire slip rate when the tire vertical load is 4 kN and the road adhesion coefficient is 0.8. The red solid line, black dashed line, and black dashed line in Figure 4 represent the results at three different tire corners, respectively. The three groups of lines that first increase and then decrease are the result of the change of tire longitudinal force with tire side slip angle, while the remaining three groups are the result of the change of tire lateral force with the tire slip rate. Taking the red solid line as an example, when the slip angle of the tire is 0.8 and the slip ratio of the tire is less than 0.2, the relationship between the longitudinal force of the tire and the cornering angle is almost linear and the tire longitudinal force increased with the slip rate. And when the slip rate is 0.2, the tire longitudinal force reaches the maximum value. When the tire slip rate continues to increase, the longitudinal force decreases nonlinearly with the tire slip rate. The tire lateral force decreases nonlinearly with the increase of the tire slip rate. When the side slip angle of tire is the other value, the tire force has similar analysis results with the change of the tire slip rate. It can also be seen that, at the same slip rate, such as 0.2, the bigger the side slip angle, the larger the longitudinal force of the tire, and the smaller the lateral force of the tire.

##### 2.5. Electric Motor Model

The parameter matching and selection requirements of in-wheel motors are decided by the power and torque of the vehicle dynamics performance. It is important to describe the process of choosing motor specification based on the vehicle dynamics. The full load of the vehicle is tens of tons, and considering the relatively large available space for the hub, a planetary gear reducer for the drive system was selected, with a transmission ratio preset as 10. Next, the choice of motor specification was divided into two parts: the motor power demands and the motor torque and speed requirements. First, we introduce the power demands of the motor. The motor power depends on the vehicle power demand. Equation (21) expresses the vehicle power demand:where is the mechanical transmission efficiency.

Based on the vehicle dynamics performance, the vehicle power demand mainly concerns three aspects: (1) the requirements for achieving maximum speed, (2) achieving the maximum gradability performance, and (3) satisfying the acceleration performance requirements of the vehicle. The vehicle maximum speed is the top speed on a straight and good road with full load or half load. In this case, the slope resistance and acceleration resistance are zero. The vehicle power demand can be obtained as follows:where and are the vehicle maximum speed and maximum power under the maximum speed demanding situation. The climbing ability of the vehicle is determined such that all the power overcomes the slope resistance after overcoming the rolling resistance. Moreover, the vehicle can maintain a uniform speed:where and are the maximum gradient and the steady speed in this case and is the vehicle power demand when realizing the maximum gradient. The maximum power should enable the vehicle to reach 50km/h in 50s. Therefore, the vehicle’s maximum power demand and rated power should not be less than 1019 kW and 526 kW, respectively. Note that some in-wheel motors cannot effectively provide power in situations whereby the motor cannot function normally or whereby the vehicle is on a slippery or uneven road. Finally, the required rated power of each motor is no less than 87 kW.

Second, we calculate the motor torque and speed requirements. The maximum speed and rated speed of the wheel motor are decided by the maximum speed and commonly used speed, respectively. The maximum speed and rated speed of the motor can be calculated as follows:

The maximum speed and the rated speed are calculated. The peak torque of the selected in-wheel motor is determined by the dynamic factor of the vehicle:where , , and are the peak torque of the motor, the dynamic factor, and the number of in-wheel motors. The peak torque is 992 kW when all eight motors are operating properly. The rated torque of the motor is determined by the rated speed and rated power. The following equation describes their relationship:

The rated torque of the motor is not less than 315 Nm after calculation. Permanent magnet synchronous motors (PMSMs) are used as in-wheel motors to meet the vehicle performance requirements. By analyzing the requirements of vehicle dynamic performance, the rated power of the motor is finally chosen as 90 kW, and the rated torque is 340 Nm. The final selection of the motor specifications is shown in Table 2. The PMSM is designed and manufactured by the motor manufacturer based on the basic motor demands and requirements.

After choosing the motor model, the PMSM was manufactured. A bench test of the PMSM was conducted in the laboratory, and the calibration was performed, as shown in Figure 5. The PMSM is installed on the bench, which is controlled by the on-off switch of the IGBT of the PWSM controller. The motor is calibrated by controlling the voltage and output torque of the motor and recording the current. Figure 6 shows the external characteristic curve of the motor at peak power and rated power, respectively, and interprets the relationship between motor torque and motor speed.

The vehicle controller, which contains the electric stability control system, sends the target torque command to the motor controller. The main research topic here is the vehicle control strategy toward improving the vehicle handling stability. The response speed of the PMSMs is high compared with the wheel dynamics; thus, the input and output of this motor torque is described as a first-order system:where represents the damping ratio.

A planetary reducer is adopted between the in-wheel motor and the hub. Thus, the output torque of the electric wheel iswhere and are the transmission ratio of the reducer and the efficiency of the mechanical transmission, respectively.

#### 3. Control Structure

An electronic stability control (ESC) is proposed in this paper for the object under study in this paper, 8WIDEV, to improve the vehicle stability performance, therein adopting a hierarchical control structure. A hierarchical control structure is suitable for over-driven electric vehicles, as shown in Figure 7, which includes the upper controller and lower controller. The upper controller can be applied to in-wheel motor-independent drive electric vehicles with strong and complex nonlinearities. The generalized target forces, such as the target lateral force and the target yaw moment, can be obtained by using nonlinear or linear methods. The lower controller can fully utilize the overdrive of the in-wheel motors to realize the distribution of the generalized force for the torque of each in-wheel motor.

The hierarchical control structure is superior to the centralized control structure in terms of control flexibility and fault tolerance. Therefore, the commonly used hierarchical control structure is designed to control the handling stability of the 8WIDEV. The upper controller mostly controls the vehicle speed and yaw angular speed. Vehicle handling stability can be improved at low speed and good working conditions. The lower controller realizes the distribution of each motor’s torque by using different distribution methods. By reasonably and effectively allocating the torque control vehicles for each in-wheel motor, the vehicle can track the reference path preferable. The ESC proposed in this paper fully utilizes the hierarchical structure and improves it on this basis. The ESC includes a reference state generation controller, an upper-level vehicle controller, and a lower-level optimal control allocation controller, as illustrated in Figure 8. The reference state generation controller based on a 2-DoF model is designed to obtain the reference side slip angle. The upper-level vehicle motion controller, including a yaw moment synthesis controller and a longitudinal motion controller, obtains the corresponding control objective force to meet the stability requirements of the vehicle during the moving process. Because of the advantages of sliding mode control, the upper-level vehicle controller fully utilizes its nonlinear characteristics; this can help in establishing an accurate mathematical relation, compared with fuzzy logic control, and effectively mitigate chattering by selecting an appropriate sliding surface and linear saturation function. Considering the vehicle’s handling stability under comprehensive operating conditions, the side slip angle and yaw angular velocity of the center of mass are considered simultaneously in the lateral stability. The in-wheel motor’s torque distribution is realized by the optimization-based control allocation method under the constraints. The optimization control allocation, including the minimum tire load rate and error approximate minimization function, considers the friction circle constraint and the motor’s external characteristic constraint, therein using the weighted least square method (WLS) to improve the distribution efficiency. By optimizing and designing the upper and lower controllers, the vehicle handling stability can be significantly improved.

##### 3.1. Reference State Generation Controller

The most commonly used reference model in vehicle dynamic control, as shown in Figure 9, is the linear reference model based on the idea of a traditional two-axle vehicle [12]. This reference dynamic model can calculate the reference state of a vehicle according to the driver inputs.

The research object in this paper adopts a mechanical double front axle steering mechanism based on Ackerman steering theory. The state equation of the double front axle steering vehicle can be described as follows:where is the lateral stiffness of each axle, denotes the vehicle weight when fully equipped, and is the *z*-axis moment of inertia.

The ground adhesion vehicle limits the maximum lateral acceleration; thus, the maximum yaw rate is limited by the maximum lateral acceleration and the longitudinal speed. Similarly, satisfying the vehicle lateral safety, the side slip angle is subject to the longitudinal speed [26]:

Based on the above analysis, the vehicle’s two ideal variables are described by the following equation:

In a sense, to simplify the algorithm, it is assumed that the vehicle acceleration and the displacement of the accelerator/brake pedal are linear. Thus, the expected speed of the vehicle is obtained:where is the initial vehicle longitudinal velocity at time and denotes the desired longitudinal acceleration/deceleration.

##### 3.2. Upper-Level Vehicle Controller

The upper-level vehicle controller contains the vehicle longitudinal motion controller and the vehicle yaw motion synthesis controller, whose purpose is to generate the objective longitudinal force and the objective yaw moment of the vehicle as needed. By tracking the longitudinal speed, the vehicle longitudinal motion controller obtains the desired longitudinal force. The side slip angle, as another variable, is controlled to obtain the objective yaw moment, instead of obtaining the lateral force required by the vehicle, which reduces the saturation of the tire longitudinal force distribution due to the lateral force required by the vehicle. The vehicle yaw moment synthesis controller obtains the synthetic moment by controlling the side slip angle and the yaw rate.

Vehicle handling stability is mainly determined by the longitudinal speed and yaw rate. According to the deviation from the reference state and actual state, the desired longitudinal force produced by the tire longitudinal and the lateral forces are calculated. Using the same method, the desired lateral force and the desired yaw moment can be obtained. The upper-level vehicle controller is designed using differential equations (1), (2), and (6). The simplified differential equation is expressed as follows:where represents the sum of the air resistance, slope resistance, and rolling resistance.

The tire force control is realized by the actuator. Because of the nonlinear coupling between the longitudinal and lateral forces, the actuator faces difficulties in controlling the lateral force accurately. Moreover, the output torque of the motor and brake directly affects the longitudinal force of the tire. The vehicle studied in this paper does not utilize active steering; thus, it is difficult to control the lateral force accurately by compensating with the steering angle.

In this paper, the resultant force and yaw moment produced by the tire longitudinal force are taken as the target control force:wherein which , , and are the reference longitudinal force, lateral force, and yaw moment of the vehicle generated by every tire lateral force. , , and are the corresponding force/yaw moment of the vehicle by the longitudinal force of the obtained tire vector decomposition.

Because of its strong robustness and anti-interference ability, sliding model control (SMC) is adopted in this paper to address the vehicle nonlinearity, unmodeled dynamics, and parameter uncertainty [28]. The fundamental aspect of the sliding surface design is to make the vehicle track the objective of the longitudinal speed, side slip angle, and yaw rate. The sliding surface is selected as follows:where , , and are the sliding surface and is the integral coefficient. The control error gradually weakens or decreases to zero as approaches zero. The switching function can be used to improve the quality of the sliding mode motion, as can the proper selection of the reaching law. The constant velocity reaching law is adopted in this paper. It can be described by the following equation:where , , and are the approaching law constant. The yaw moment is not directly related to the vehicle side slip angle, and therefore, an intermediate variable is constructed. The intermediate control variable is obtained by the following equation:

Thus, the sliding mode function and the approach law are further expressed as follows:

In the sliding mode control law, we use the Lyapunov stability theory to design an appropriate sliding mode control to satisfy the reachability condition. The Lyapunov function is constructed as follows:

This represents the distance from the system curve to the switching function, and the Lyapunov inequality is described as follows:

As long as the Lyapunov arrival condition is satisfied, the moving points outside the sliding mode will reach the surface in a finite time approaching to the sliding surface. Thus, the inequality should hold. To mitigate chattering caused by the switching of system state values near the sliding mode surface, the linear saturation function takes the place of the sign function as in the following equation:

Through equations (34)–(42), the objective reference longitudinal force and the objective yaw moment, given the generalized target force to be obtained, are obtained:where and are calculated by the corresponding actual variables tracking the ideal reference side slip angle and the ideal reference yaw rate, respectively. However, is obtained by controlling the vehicle side slip angle, with taken as an intermediate variable, and tracking the ideal reference side slip angle.

The yaw moment synthesis controller obtains the objective yaw moment though a joint action calculation result though two variables by adjusting the corresponding weight coefficient [19]:where and are the weight coefficients of the yaw moment. If the variation rate of the state quantity deviation is increased, the corresponding weight coefficient increases; otherwise, the corresponding weight coefficient decreases. The 8WIDEV can satisfy the stability control requirements as long as the tire force satisfies the generalized force in the vehicle in the lower-level controller.

##### 3.3. Lower-Level Optimal Control Allocation Controller

As the most important part of the ESC system, the lower-level controller plays a crucial role in the motor torque distribution and manages the distribution of the longitudinal force/yaw moment acquired by the upper-level vehicle controller. The force of each tire, including the tire longitudinal force and the tire lateral force, can be controlled theoretically. However, the wheel steering angle is directly related to the input of the steering wheel driver, and the 8WIDEV, as the research object in this paper, does not utilize active steering. The lateral force of the tire is difficult to control accurately. Therefore, the resultant force of the tire longitudinal force in the vehicle coordinate system is taken as the target force, defined as . The two different torque distribution methods, concretely speaking, the rule-based braking torque distribution and optimization control allocation, are described in the following parts. The rule-based braking torque distribution is designed using the traditional DYC. Correspondingly, the ESC proposed in this paper uses the optimization torque allocation method. The two allocation methods are introduced in the following two sections.

###### 3.3.1. Rule-Based Braking Torque Distribution

According to the description of the vehicle steering in vehicle theory, the effect of each wheel generating a braking force on the yaw moment of the vehicle is different. The main contribution to the internal yaw moment of the vehicle comes from the rear inner wheel, whereas the lateral yaw moment produced by the front inner wheel is the most effective [22]. First, we determine the value and direction of the yaw moment of the required motion. Second, the required yaw moment satisfies the requirements according to the braking torque distribution. Considering the different effects of each in-wheel motor on the yaw moment of the vehicle, a rule-based braking torque distribution is proposed in this paper and as a contrastive control strategy. The dynamic distribution ratios of power from the main to secondary system are 0.5 : 0.25 : 0.15 : 0.1.

During vehicle steering, there are two cases of note: insufficient steering and excessive steering. Figure 10 shows the case of insufficient steering during a left turn. The desired yaw rate is nonnegative and larger than the actual yaw moment. Their expressions are given as follows:

By comprehensively analyzing and compensating the lack of vehicle steering in this case, the required yaw moment is found to be toward the inside, the inner rear wheel is the main brake wheel, and the other wheel on the left is the secondary brake wheel. The left wheel force produces the required yaw moment as follows:where and are the additional yaw moment and the braking force exerted by each motor, respectively. The rules for the other cases, including the excessive steering in the left turn and excessive steering and insufficient steering in the right turn, are the same as in the above case.

###### 3.3.2. Optimization Torque Distribution

Actuator torque allocation for redundant systems can be described as a constraint optimization problem. Considering the nonlinear saturation and coupling relationship of the tire force and torque saturation amplitude of the drive motor, the lower-level optimal control allocation controller is constructed. The nonlinear tire is regarded as a more extensive “constrained nonlinear actuator” in the control allocation. The optimization-based control allocation method-weighted least square method (WLS) is introduced in this paper and can achieve the required vehicle stability performance [6].

According to equations (1)–(3), (7), and (8), the relationship between the objective force and the tire longitudinal force can be expressed bywhere and denote the coefficient matrix and the output variable, respectively.

The maximum tire longitudinal output force cannot exceed the tire friction ellipse constraint and external characteristic curve of the motor torque. First, the tire force is limited by the ground adhesion and the dynamic vertical force of each tire. According to the concept of the tire friction circle, the tire longitudinal force and lateral force need to satisfy the following conditions:where , , and are the maximum in-wheel motor output torque, wheel radius, and deceleration ratio of the reducer. Second, the friction circle coupled with the longitudinal force and lateral force also limits the output tire longitudinal force.

Overall, considering the friction circle constraint and the maximum torque constraint of the in-wheel motor, the constraint of the longitudinal force of the tire can be merged into the following equation:where

The constraint condition is an equality constraint. It is possible that there is no solution in the limit condition. To address this possible problem, the minimum error approximation is used to replace the equality equation constraint. The main goal of the optimal allocation is to minimize the allocation error. The objective equation can be expressed by the squared norm:where is the diagonal weighted matrix for adjusting the tracking performance. It is defined as follows:

To improve the vehicle stability by guaranteeing the output reserve of the tire longitudinal force, the vehicle’s stability margin is also considered when the vehicle torque is allocated. Therefore, considering further improvement in the stability under the limit condition and maneuverability under good conditions, an additional objective function is used based on the principle of the small tire load rate by reserving the load of the longitudinal force. Its norm expression is expressed by the following condition:where means the diagonal weighted matrix.

The distribution of the objective force/moment obtained by the upper-level vehicle controller into the longitudinal force of each tire is an optimization-based control allocation problem with a boundary constraint. This leads to a linear constrained quadratic programming problem. Such problem can be expressed as follows:

This problem is typical of the two-step optimization of sequential least squares (SLS). By setting the weight coefficient , the above two-step algorithm can be integrated into a one-step algorithm and solved by weighted least square (WLS) [17].

The active set method algorithm is used to calculate the target torque of the in-wheel motor, as shown in Figure 11. In the active set method, it is important to calculate and judge whether is zero. Following this process, the optimal solution of the constrained optimization objective can ultimately be obtained.

#### 4. Vehicle Model Verification and Analysis of Control Strategy

The 8WIDEV developed by our lab is a modified 8 × 8 prototype vehicle, whose basic structural parameters are shown in Table 1. Section 4.1 mainly concerns the comparative analysis of the vehicle model simulation and vehicle experiments under the same conditions, and analysis of the ESC in the hardware-in-the-loop simulation platform is presented in Section 4.2.

##### 4.1. Vehicle Model Validation

First, we verify the effectiveness of the vehicle dynamic model built-in MATLAB/Simulink. The validity of the vehicle dynamic model can be approximately verified by comparing the prototype vehicle results with the simulation results of the dynamics model of the 8WIDEV under different and the same conditions. The experimental vehicle is equipped with gyroscopes, accelerator/brake pedal signal sensors, and a steering wheel angle sensor and is driven by eight in-wheel motors with equal torque.

Through comparison of the experimental vehicle test data and simulation of the vehicle model, the accuracy of the model is verified. Under this scheme, deviations between the torque values obtained by each wheel and those of the wheels in the prototype vehicle are unavoidable. However, under the premise of sufficient power and satisfying the given vehicle working conditions, the influence of the deviations on the handling stability is not significant.

The vehicle angle step input and snake condition test are typical conditions for testing vehicle dynamics and are also important conditions in testing vehicle handling stability. Therefore, the two conditions are utilized based on controllability and stability test procedures for automobiles—the Pylon course slalom test of GB/T 6323.1-1994—to compare the results of the experimental vehicle and the simulation results of the vehicle model. The vehicle model established in MATLAB/Simulink uses the built-in MATLAB/Simulink Dormand–Prince algorithm to solve the problem.

Figure 12 shows the experimental 8WIDEV with angular steps at the laboratory site of a cooperating company. Figure 1 shows the experimental vehicle with angular steps at the experimental site. In the steering wheel angle step input condition, the longitudinal speed is set to a constant value of 80 km/h. Figure 12 describes the results of the prototype vehicle results and the 8WIDEV simulation, including the (a) steering angle, (b) yaw rate, (c) lateral acceleration, and (d) body roll angle. Figure 12(a) shows the comparison of the data collected from the steering wheel angle sensor and the simulation results from MATLAB/Simulink.

**(a)**

**(b)**

**(c)**

**(d)**

The simulation results reach their maximum in a very short period of time and remain unchanged for a typical angular step change of 2 seconds. In contrast, the experimental vehicle was slightly delayed; however, it also completed a step change in 0.4 seconds and remained unchanged. Both vehicles ended up at 57 degrees. Figure 12(b) shows the comparison results of the vehicle yaw rate under experimental and simulation conditions. The final steady-state value of the vehicle simulation and experimental results is approximately 5.8 deg/s. In addition, through comparative experiments, it is found that the time for simulation stabilization in MATLAB/Simulink is 0.3 s faster than that in the experimental vehicle experiment. Figure 12(c) shows the results of the changes in the lateral acceleration of the vehicle dynamics. The lateral acceleration of the vehicle increases gradually from zero at 2 s to 2 m/s^{2} in the 3.4 s. The lateral acceleration of the experimental vehicle was stabilized at 2 m/s^{2} at 3.6 s, which shows a delay of 6% compared with the simulation results. The amplitude in the simulation results is slightly larger than that in the experimental results. Figure 12(d) shows the changes in the roll angle of the vehicle of vehicle dynamics. It also produces the same analysis results as the lateral acceleration. Figures 12(b)–12(d) show that the steady-state values of the yaw rate, lateral acceleration, and roll angle and their corresponding times are approximately equal. There is a slight difference between experiment and simulation in terms of transient response with the stepped input of the same steering wheel angle.

The vehicle during the snake experiment passes through four piles at a constant speed of 50 km/h. Figure 13 shows the 8WIDEV performing the snake experiment at the experimental site. Figure 14 displays the simulation results of the vehicle dynamics model and the results of the prototype vehicle, including the (a) longitudinal and lateral displacement, (b) longitudinal speed, (c) steering wheel angle, (d) yaw rate, and (e) roll rate and lateral velocity.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

The solid line in Figure 14 represents the simulation results in MATLAB/Simulink, while the dotted line represents the experimental results of the experimental vehicle. Figure 14(a) shows the trajectory of the 8WIDEV in geodetic coordinates. The maximum lateral displacement of the 8WIDEV model simulation is 4.7 m, which is larger than the maximum lateral displacement of the experimental vehicle by 4.5 m. The error is less than 5% when comparing their trajectories. Figure 14(b) shows the longitudinal speed changes over time. These changes basically stabilized at a fixed speed of 50 km/h. In addition, the lateral motion of the vehicle caused fluctuations of the vehicle longitudinal speed, where the maximum fluctuation value was not more than 2 m/s^{2}. The vehicle is turning at the maximum steering wheel angle of 200 deg, as described in Figure 14(c). The yaw rate maximum was 20 deg/s during maximum lateral displacement, as illustrated in Figure 14(d). Figures 14(e) and 14(f) show that the roll angle and lateral acceleration follow the same rule. The results of MATLAB/Simulink simulation are consistent with the results of the experimental 8WIDEV. By comparison, each index response process of the simulation of the vehicle dynamics model built-in MATLAB/Simulink and the results of the experimental prototype are the same.

Through the simulation test and real vehicle test of the 8 × 8 prototype vehicle, the response speed of the vehicle model is found to be related to the real vehicle test. The main reason for this is that the simulation model does not consider the characteristics of free travel, inertia, and stiffness of the steering system, and there are differences between the actual driver’s operation and an ideal driver’s operation in the simulation model. In terms of response amplitude, the deviation between the simulation results and the real vehicle tests is large at the peak, mainly because the simulation model neglects the inertia of certain rotating parts in the real vehicle and simplifies the suspension system to be a mass-free, fixed stiffness, and fixed damping object. In addition, the accuracy of the tire model also produces deviations from the test results. However, these deviations are essentially unavoidable. Generally, the test results are consistent in terms of their trend, and the deviations between the results are within a reasonable range. Therefore, from a practical point of view, the simulation model can accurately reflect the response characteristics of the real vehicle. From a theoretical point of view, the accuracy of the simulation model can satisfy the requirements of vehicle dynamics research and can be used as a simulation model for vehicle handling and stability control.

It is demonstrated that the vehicle model based on MATLAB/Simulink can reflect the dynamic characteristics of the 8 × 8 prototype vehicle. The errors between the vehicle model and experimental vehicle remain as less than 8%. This is sufficient to show that the vehicle model can replace the experimental 8WIDEV for simulation experiments, thereby providing a favorable basis and conditions for the validation of the control strategy of handling stability.

##### 4.2. Analysis and Comparison of Proposed Control Strategy

This section mainly verifies the ESC proposed in this paper. Because the test prototype vehicle is still in the debugging stage, it is not possible to verify the ESC proposed in this paper on the experimental vehicle driven by 8 in-wheel motors developed by our lab. To verify the ESC strategy proposed in this paper, a hardware-in-the-loop (HIL) test platform based on dSPACE/AutoBox is built by the authors. The HIL platform includes a AC/DC inverter, dSPACE/AutoBox, VCU, brake/accelerator pedal, steer wheel, CAN bus, and related accessories.

Figure 15 shows a process schematic of the HIL platform. The VCU includes the ESC strategy code automatically generated by the real-time workspace (RTW) provided by MATLAB/Simulink, and the manual code integration is conducted in CodeWarrior. The necessary hardware-related codes, such as the header file, interrupt service program, and hardware-related codes, are included. The ESC strategy is transformed into a real-time code in this way. The vehicle dynamic simulation model is embedded in dSPACE/AutoBox in the form of a real-time simulation model. First, the RTW real-time code generation environment provided by MATLAB/Simulink is used to automatically generate real-time code for the vehicle dynamic simulation model. Then, the real-time code of the vehicle dynamic simulation model is downloaded to the AutoBox real-time simulator by using the Real-Time Interface (RTI) provided by dSPACE such that the AutoBox is equivalent to the “experiment vehicle” that can operate in real time. The information exchange and interconnections between the VCU and dSPACE/AutoBox are realized by the CAN bus. The PC interacts with dSPACE/AutoBox through the ControlDesk test kit for, e.g., adjusting parameters online, displaying the status of the control system and data storage, and tracking the response curve of the process.

The above introduced the construction of the HIL simulation platform. The construction of the test bed mainly concerns the process and theory of building the HIL simulation platform. The completed HIL simulation platform is shown in Figure 16. The specific experimental process is given below.

During the test, the driver inputs the driving intent instructions to the VCU through the A/D interface. The vehicle controller filters and calibrates these signals linearly for the acceleration/brake pedal and steering wheel sensor signals, which are converted into digital signals. Based on these signals and the real-time vehicle status feedback, such as the in-wheel motor working status and the wheel angle of dSPACE/AutoBox, the real-time operation control algorithm is implemented, and control instructions are sent to dSPACE/AutoBox for real-time control.

Simultaneously, the AutoBox DS1005 processing board receives the in-wheel motor torque command sent by the VCU and runs the vehicle dynamic simulation model in real time through the real-time control module. The real-time change of the vehicle state value and the in-wheel motor state value are fed back to the monitoring interface of the ControlDesk and PC. The measurement, control, parameter adjustment, and monitoring interface based on the ControlDesk integrated testing software can interact with the vehicle motion parameter signals and driving environment information.

The double-line simulation with a driver-in-loop setup is a classic test condition for vehicle stability testing; this testing type is selected in this paper and sets a constant longitudinal vehicle speed of 100 km/h. The purpose of the high-speed setting is to conduct investigations and evaluate the stability performance of the vehicle. The DYC method based on the hierarchical control structure utilizes the same reference model and upper controller as the ESC. The difference between them is that the DYC method uses the proposed method in Section 3.3.1 in the lower controller, whereas the ESC uses the optimization torque distribution in the lower controller.

Figure 17(a) describes how the vehicle trajectory controlled by the two methods can track the desired trajectory, and the ESC strategy achieves good performance in trajectory tracking compared with the DYC. It can also be seen that the trajectory controlled by the DYC cannot track the desired path well in the second section of the straight line because the actual path cannot converge quickly to the desired path description, and there is a certain amplitude of left-right swing along the desired path. From Figure 17(b), the longitudinal speed is approximately stable at the expected velocity and can track the expected speed under the ESC system proposed in this paper. In addition, the longitudinal speed controlled by the DYC is lower than the expected speed in the lane-change process and shows a small fluctuation. Two variables can be controlled under the DYC and ESC in Figures 17(c) and 17(d). The yaw rate and side angle of the vehicle in the last straight line oscillate slightly, and it requires approximately 3 s to stabilize. Figure 17(e) shows that the trajectories in the phase diagrams of the two control methods can converge to zero. This proves that the two control methods are effective at ensuring vehicle stability, which is consistent with Figure 17(a). The phase diagram of the side slip angle and side slip angle rate is an important basis for judging vehicle stability. Figure 17(f) also proves this point because the error of the expected yaw rate and the actual yaw rate is smaller when controlled by the optimization method. The proposed method and DYC can guarantee proper vehicle handling and stability at high speed from the vehicle kinematics analysis. In addition, the ESC based on optimal control has a faster tracking performance and greater stability compared with the DYC based on the rule-based braking torque distribution.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

Figures 18(a) and 18(b) show the eight in-wheel motor torque distribution of the ESC. Figure 18(a) shows the front four in-wheel motor driving/braking torque, while Figure 18(b) shows the rear four in-wheel motor driving/braking torque. Figures 18(c) and 18(d) both describe the eight in-wheel motor torques controlled by the DYC. The optimal output change rate of the in-wheel motors controlled by the ESC is small, in contrast to the DYC distribution. Based on the optimal control method, the utilized maximum negative and positive torques of the motor of the ESC are −100 Nm and 200 Nm. The motor almost operates in the rated torque range and fully utilizes the independent control of each motor. The DYC based on the rule-based braking torque distribution is essentially different from the control methods proposed in this paper and realizes the stabilization of the vehicle by applying braking torque to the motors after the torque distribution is determined. Therefore, when the braking torque is applied, the negative motor torque readily saturates such that the peak torque of the motors can be easily reached. The breaking torque of the left first and left third in-wheel motors already exceeded −330 Nm, which negatively affects vehicle handling and stability.

**(a)**

**(b)**

**(c)**

**(d)**

#### 5. Discussion and Conclusions

Each in-wheel motor is independently and precisely controlled, making the system more likely to achieve vehicle dynamic stability control. The ESC proposed for an 8WIDEV improves the vehicle handling and control stability. A hierarchical top-down control structure includes a reference state generation controller, an upper-level vehicle controller, and a lower-level optimal control allocation controller. The upper-level vehicle controller, including the yaw moment synthesis controller, comprehensively considers the objective yaw moment calculated from the error of the side slip angle and the error of the yaw rate by adjusting the weight coefficient. The lower-level optimal allocation controller based on an accurate control allocation method takes not only the friction circle constraint of the mutual coupling of the tire longitudinal force/lateral force and external characteristic constraint of the in-wheel motor into account but also utilizes an advanced fast calculation method, WLS, for the torque distribution in each in-wheel motor. The effectiveness of the vehicle dynamic model based on prototype parameters is verified by comparison under two different conditions. The validity of the vehicle dynamic model established in this paper is verified by comparing simulation and experiment results. In addition, the HIL experimental results confirmed that the ESC proposed in this paper, compared with the DYC, can improve the handling and control stability of the vehicle. Each motor has two different working modes, which can coordinate generating the desired yaw moment. Both simulation results and experimental results have shown that the transient response speed of the vehicle is high.

Our next task is to apply the ESC proposed in this paper to the experimental vehicle after completing debugging and verifying the ESC control strategy. More importantly, the in-wheel motor more effectively enables the regeneration of energy to the battery during braking and thus increases the vehicle’s range, which is another hot topic and direction worth studying.

#### Data Availability

The data used to support the finding of this study are available from the corresponding author.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest.

#### Acknowledgments

The research funding for this paper comes from a grant from the Chinese PLA General Armament of Department (no. 40402050101). This project funding support is gratefully acknowledged and laid the foundation for this paper to proceed smoothly.