# Research on the Adaptive PID Speed Control Method for Hub Motors

Authors: Jingjun Zhang; Chao Li; Qingbo Jia; Ruizhen Gao
Journal: Mobile Information Systems
 (2022)

---

## Abstract

With the increase in tightening of carbon neutral policies, electric new energy vehicles have become a top priority in the development of the automotive industry. The integrated electric vehicle wheel (hub motor) can effectively optimize the vehicle structure and reduce the weight of the vehicle and reduce the energy consumption. At the same time, the feature that four tires can be driven separately is also conducive to the application of various new control algorithms. In this paper, a generalized adaptive PID control is experimented with the speed control of the hub motor, and a fuzzy control-based variable step method is proposed for the overshoot or even runaway problem caused by the inertia of the hub motor in the process of adaptive PID control. Experiments have demonstrated that this method can effectively reduce the amount of overshoot triggered by adaptive control and shorten the regulation time into a steady state.


---

## Body

## 1. Introduction

As environmental problems become increasingly serious, new energy vehicles powered by electricity are gradually taking over the market [1, 2]. The high torque, compact structure, and high power density of the wheel motor can effectively simplify the vehicle structure and extend the range [3]. At the same time, the feature of four-wheel independent rotation control can also facilitate the implementation of various types of autonomous driving algorithms. In this context, the precise control of motor speed and torque has gradually become a hot spot for research [4]. At this stage, PID control is still the most commonly used closed-loop motor control algorithm. However, conventional PIDs require parameter tuning before use, which is a process of extensive repetition and trial and error. The control effect of traditional PID control in the face of multiple disturbances and high-frequency noise is also unsatisfactory. With the rise of modern control theory, there has been tremendous progress in the control effectiveness of various types of improved algorithms based on PID algorithms [5, 6]. For example, adaptive PID control is designed for the ASPR characteristics of the SISO system using a parallel feedforward compensator [7]. Design of PID controller is based on ABC two-region nonlinear load frequency control [8]. ADRC self-anti-disturbance technique incorporates state observer technique based on conventional PID [9]. Adaptive PID controller is capable of combating actuator failures and unknown environments based on finite time error transform design [10]. With the rise of machine learning techniques, adaptive PID algorithms based on this were birthed [11]. A constrained genetic algorithm (GA) is used to control a nonfragile PID controller with optimal gain [12]. PID control system based on 6-DOF mathematical model combined with back propagation neural network algorithm [13] However, such algorithms require prior training and learning of the overall model, so a large amount of a priori knowledge must be acquired, and they are less applicable to different systems.In this thesis, the system is downscaled using an internally and externally nested dual PID control scheme for a class of high-order multivariable nonlinear time-domain systems such as hub motors. The variable-step fuzzy control method is also designed to address the overshoot phenomenon caused by motor inertia and sampling uncertainty in the actual control of generalized adaptive PID control. By changing the time interval between each PID regulation of the system, the hysteresis of the motor control system is reduced and the regulation capability of the generalized adaptive PID control [14] is better utilized. The control algorithm was also tested in an actual hub motor control system, and good control results were obtained.


## 2. Hub Motor Model

### 2.1. Structural Composition

Hub motors, also known as in-wheel motors as shown in Figure1, integrate the braking, driving, and transmission systems all in the wheel hub [15] (see Figure 1). Unlike conventional car structures, hub motors do not require complex mechanical structures such as transmissions, drive shafts, and differentials. Hub motors can transmit torque directly to the wheels, greatly improving overall transmission efficiency.Figure 1
General structure of the hub motor.The rotor of a hub motor is fixed to the tire and is responsible for outputting torque. The support frame and the sealing ring wrap the capacitor ring, electronic control system, coil stator, and other precision components inside to form the stator of the in-wheel motor. The brake caliper is fixed on the outside of the support frame and forms the braking system with the brake disc fixed on the tire. The stator of the wheel motor is fixed to the frame through the suspension link to realize the suspension and steering of the wheels (the detailed structure of the wheel motor is shown in Figure2). The motor communicates and gives feedback to the VCU (Vehicle Control Unit) through wires. When VCU sends a signal, the motor is energized and the rotor rotates relative to the stator. The electronic phase commutator in the electronic control system controls the sequence and timing of energizing the stator winding according to the signal from the position sensor, generating a rotating magnetic field that drives the rotor to keep rotating forward.Figure 2
The composition of the in-wheel motor.


### 2.2. Physical Model

In order to make the control more stable and intelligent, mathematical modeling of hub motors is required. Most of the hub motors in practical applications are permanent magnet synchronous motors. The permanent magnet synchronous motor is developed from the three-phase synchronous motor [16], whose permanent magnet arrangement structure is shown in Figure 3. Its permanent magnets are embedded in the external rotor, while the coil windings are fixed to the central stator.Figure 3
Permanent magnet synchronous motor arrangement structure.The DC power supply is transformed into three-phase electricity through a three-phase inverter to drive the rotor. The equivalent transformation and simplification leads to the physical model, as shown in Figure4.Figure 4
Physical structure of a permanent magnet synchronous motor.TheABC three-phase corresponds to the WVU three-phase; iA,iB,iC and uA,uB,uC correspond to the current and voltage on the three-phase winding, respectively; N and S poles correspond to the two poles of the permanent magnet; ψf is the motor rotor magnetic chain; θr and ω correspond to the angle of the magnetic chain to the A-axis and the rotor angle of rotation, respectively.The three-phase inverter is a very important component in realizing the control of a permanent magnet synchronous motor, which converts DC power from the battery into three-phase power for direct control of the motor. Its structure is shown in Figure5.Figure 5
Sketch of a three-phase inverter structure.


### 2.3. Mathematical Model

The permanent magnet synchronous motor is a typical nonlinear system. It has the obvious characteristics of many variables, high order, and strong coupling, so much so that it is very difficult to build its accurate model. Therefore, in practical engineering control, certain reasonable assumptions need to be made on the motor model to ensure the maximum simplification of the model while satisfying the required accuracy.(1)
The layout of the permanent magnets on the rotor is perfectly symmetrical and has the same parameters.(2)
The layout structure and parameters of the motor stator winding are identical and symmetrical and the angle of the three phases is 120°.(3)
The conductivity of the magnetic chain is zero.With the above assumptions holding true, the following simplified mathematical model of a permanent magnet synchronous motor can be derived.①
Motor voltage equation is as follows:(1)uaubuc=RS000RS000RSiaibic+pψaψbψc,whereua,ub,uc indicates the instantaneous voltage value on the three phases of the permanent magnet synchronous motor a,b,c. RS denotes the resistance on the stator winding. ia,ib,ic denotes the instantaneous current on the electronic stator windings, respectively. p denotes the operator of this equation for time differentiation calculation. ψa,ψb,ψc indicates the magnetic chain on the three phases of the motor stator winding, respectively.②
Motor magnetic chain equation is as follows:(2)ψaψbψc=LaaLabLacLbaLbbLbcLcaLcbLcciaibic+ψfcosθrψfcosθr−120°ψfcosθr+120°,whereψa,ψb,ψc represents the magnetic chain on the three phase windings of the motor stator, respectively.Lxy represents the mutual inductance between the x phase and the y phase. ψf represents the magnetic chain on the rotor of this motor. θr represents the angle between the rotor magnetic chain and the a axis is shown in Figure 4.③
Electromagnetic torque equation is as follows:(3)Te=12iaψfsinθr+ibψfsinθr−120°+icψfsinθr+120°,where,Te indicates the output torque of the motor. ia,ib,ic represents the instantaneous voltage on the electronic stator winding, respectively. ψf then represents the magnetic chain on the rotor of this motor.④
The equation of motion of the tire is shown below.The force analysis of the tire is shown in Figure6.According to the wheel force analysis diagram, the wheel motion equation is as follows:(4)Te−Tl−Bω=Jdωdt,where,Te is the output torque of the motor which is the drive torque. Tl is the load torque. B is the coefficient of viscous friction of the rotor shaft of the permanent magnet synchronous motor. ω is the angular velocity of the motor rotor. J is the rotational inertia of the wheel motor rotor and tire, and the expression values are shown as(5)J=12mr2,wherem is the total mass of the tire and the motor rotor and r is the radius of the tire.Figure 6
Tire force analysis diagram.


## 2.1. Structural Composition

Hub motors, also known as in-wheel motors as shown in Figure1, integrate the braking, driving, and transmission systems all in the wheel hub [15] (see Figure 1). Unlike conventional car structures, hub motors do not require complex mechanical structures such as transmissions, drive shafts, and differentials. Hub motors can transmit torque directly to the wheels, greatly improving overall transmission efficiency.Figure 1
General structure of the hub motor.The rotor of a hub motor is fixed to the tire and is responsible for outputting torque. The support frame and the sealing ring wrap the capacitor ring, electronic control system, coil stator, and other precision components inside to form the stator of the in-wheel motor. The brake caliper is fixed on the outside of the support frame and forms the braking system with the brake disc fixed on the tire. The stator of the wheel motor is fixed to the frame through the suspension link to realize the suspension and steering of the wheels (the detailed structure of the wheel motor is shown in Figure2). The motor communicates and gives feedback to the VCU (Vehicle Control Unit) through wires. When VCU sends a signal, the motor is energized and the rotor rotates relative to the stator. The electronic phase commutator in the electronic control system controls the sequence and timing of energizing the stator winding according to the signal from the position sensor, generating a rotating magnetic field that drives the rotor to keep rotating forward.Figure 2
The composition of the in-wheel motor.


## 2.2. Physical Model

In order to make the control more stable and intelligent, mathematical modeling of hub motors is required. Most of the hub motors in practical applications are permanent magnet synchronous motors. The permanent magnet synchronous motor is developed from the three-phase synchronous motor [16], whose permanent magnet arrangement structure is shown in Figure 3. Its permanent magnets are embedded in the external rotor, while the coil windings are fixed to the central stator.Figure 3
Permanent magnet synchronous motor arrangement structure.The DC power supply is transformed into three-phase electricity through a three-phase inverter to drive the rotor. The equivalent transformation and simplification leads to the physical model, as shown in Figure4.Figure 4
Physical structure of a permanent magnet synchronous motor.TheABC three-phase corresponds to the WVU three-phase; iA,iB,iC and uA,uB,uC correspond to the current and voltage on the three-phase winding, respectively; N and S poles correspond to the two poles of the permanent magnet; ψf is the motor rotor magnetic chain; θr and ω correspond to the angle of the magnetic chain to the A-axis and the rotor angle of rotation, respectively.The three-phase inverter is a very important component in realizing the control of a permanent magnet synchronous motor, which converts DC power from the battery into three-phase power for direct control of the motor. Its structure is shown in Figure5.Figure 5
Sketch of a three-phase inverter structure.


## 2.3. Mathematical Model

The permanent magnet synchronous motor is a typical nonlinear system. It has the obvious characteristics of many variables, high order, and strong coupling, so much so that it is very difficult to build its accurate model. Therefore, in practical engineering control, certain reasonable assumptions need to be made on the motor model to ensure the maximum simplification of the model while satisfying the required accuracy.(1)
The layout of the permanent magnets on the rotor is perfectly symmetrical and has the same parameters.(2)
The layout structure and parameters of the motor stator winding are identical and symmetrical and the angle of the three phases is 120°.(3)
The conductivity of the magnetic chain is zero.With the above assumptions holding true, the following simplified mathematical model of a permanent magnet synchronous motor can be derived.①
Motor voltage equation is as follows:(1)uaubuc=RS000RS000RSiaibic+pψaψbψc,whereua,ub,uc indicates the instantaneous voltage value on the three phases of the permanent magnet synchronous motor a,b,c. RS denotes the resistance on the stator winding. ia,ib,ic denotes the instantaneous current on the electronic stator windings, respectively. p denotes the operator of this equation for time differentiation calculation. ψa,ψb,ψc indicates the magnetic chain on the three phases of the motor stator winding, respectively.②
Motor magnetic chain equation is as follows:(2)ψaψbψc=LaaLabLacLbaLbbLbcLcaLcbLcciaibic+ψfcosθrψfcosθr−120°ψfcosθr+120°,whereψa,ψb,ψc represents the magnetic chain on the three phase windings of the motor stator, respectively.Lxy represents the mutual inductance between the x phase and the y phase. ψf represents the magnetic chain on the rotor of this motor. θr represents the angle between the rotor magnetic chain and the a axis is shown in Figure 4.③
Electromagnetic torque equation is as follows:(3)Te=12iaψfsinθr+ibψfsinθr−120°+icψfsinθr+120°,where,Te indicates the output torque of the motor. ia,ib,ic represents the instantaneous voltage on the electronic stator winding, respectively. ψf then represents the magnetic chain on the rotor of this motor.④
The equation of motion of the tire is shown below.The force analysis of the tire is shown in Figure6.According to the wheel force analysis diagram, the wheel motion equation is as follows:(4)Te−Tl−Bω=Jdωdt,where,Te is the output torque of the motor which is the drive torque. Tl is the load torque. B is the coefficient of viscous friction of the rotor shaft of the permanent magnet synchronous motor. ω is the angular velocity of the motor rotor. J is the rotational inertia of the wheel motor rotor and tire, and the expression values are shown as(5)J=12mr2,wherem is the total mass of the tire and the motor rotor and r is the radius of the tire.Figure 6
Tire force analysis diagram.


## 3. Design of the Controller

### 3.1. Overall Design of the Controller

The speed control of PM synchronous motors in a DC environment is usually achieved indirectly by changing the loading voltage on the three-phase inverter using PWM modulated waves to control the wheel speed. It is clear from the mathematical modeling that the entire process from load voltage to output wheel speed is high order, strongly coupled, and multivariate. In the actual control we need to face the following situations:(1)
Nonidealization of model constraints. In order for the modeling process to proceed smoothly, we formulated some assumptions about the model. However, the existence of unavoidable factors such as the manufacturing process and assembly errors in the actual control process makes it difficult to achieve the set model constraints perfectly.(2)
The values of the variables are difficult to measure. During the high-speed operation of a hub motor, variables such as instantaneous voltage and instantaneous current on the coil are difficult to measure.(3)
Constants present a strong time-domain [17]. As the motor continues to run, certain factory parameters of the motor will change as the motor runs over time. For example, the stator coil resistance value will gradually increase with the motor temperature. The maximum battery voltage decreases gradually as the battery SOC decreases.The presence of many factors makes it difficult to establish an accurate mathematical model of the loading voltage to the output speed. In order to reduce the influence of the above factors on the motor control, a two-layer PID nested control structure is designed in this paper, as shown in Figure7. The inner loop PID is the torque loop, whose main function is to control the load voltage loaded on the three-phase inverter so that the motor output torque is close to the target torque. The outer loop PID is the speed loop, whose function is to calculate the target torque of the inner loop PID control using the difference between the actual speed and the target speed, thus realizing the closed loop. In the design, the inner loop PID regulation frequency is significantly higher than the outer loop, allowing the torque loop to have enough regulation times to approximate the target torque derived from the speed loop. This design allows the system to well circumvent the problem of nonidealized motor parameters and reduces the system to a first-order nonlinear control problem between torque and speed.Figure 7
General structure of PID control.When the actual output torque is very close to the target torque, the control structure can be simplified as shown in Figure8, and the corresponding controlled model is simplified as shown in the following equation:(6)115πmr2N˙+π30BN=Te−Tl,Figure 8
Simplified PID control structure.In the formula,m is the total mass of the motor rotor tire; r is the radius of the tire; N˙ is the first-order derivative of the actual output speed; B is the coefficient of viscosity of the electronic rotor; N is the actual output speed; Te and Tl are the output torque and drag torque of the motor, respectively.


### 3.2. Conventional PID Control

PID algorithm is widely used in practical industrial control. It compares and analyzes the actual output of the controlled object with the set target quantity, and the difference between the two is adjusted by proportional link (P), integral link (I), and differential link (D) to derive the control quantity. The conventional PID control algorithm is shown as(7)ut=Kpet+Ki∫0tetdt+Kddetdt,where ut is the output of the PID control, et is the difference between the actual value of the controlled quantity and the target value, and Kp, Ki, Kd is the proportionality, integration, and differentiation coefficients, respectively.In the actual control, each observed quantity is not continuous, but discrete with a certain time interval. Therefore, we need to discretize the above traditional PID algorithm formula, and the discretized formula is shown as follows:(8)uk=Kpek+Ki∑i=1kei+KdΔek,Δek=ek−ek−1.The control performance of the PID algorithm depends mainly on the value ofKp, Ki, Kd and the greatest workload in designing the PID controller comes from the constant adjustment and trial and error of the three coefficients of Kp, Ki, Kd [18].The role of the proportionality factor Kp is to speed up the response of the control system. Kp, the larger the coefficient, the faster the response of the system and the higher the accuracy of the system, but it will also cause the system to overshoot and even cause the system to be unstable. Kp, the smaller it is, the lower the response speed of the system will be, thus prolonging the time for the system to reach the steady state and making the dynamic and static characteristics of the system both worse. The function of the integration factor Ki is to eliminate the steady-state error of the system. Ki, the larger the coefficient, the faster the system can eliminate the steady-state error, but when Ki is too large, it will cause integration saturation at the beginning of the regulation process, resulting in a large overshoot. If Ki is too small, it will make the steady-state error difficult to eliminate and affect the regulation accuracy of the system. At the same time, the measurement error will accumulate in the integration, and the accumulated error for a long time will make the regulation accuracy degrade. The differential coefficient Kd can improve the dynamic performance of the system. It can suppress the deviation in any direction and prevent the overshoot phenomenon. However, an excessive amount of Kd makes the regulation process brake earlier, which makes the regulation time longer and reduces the ability of the system to resist disturbances.


### 3.3. Adaptive PID Control

PID control algorithm has been widely used in the industry for its simple structure, good robustness, and easy implementation. But the actual control is mostly accompanied by changes in the control environment, the traditional PID control cannot change the proportional, integral, and differential coefficients in real time according to the changing environment, which makes the control effect is reduced or even out of control.For the actual control situation, adaptive PID control algorithms have been developed rapidly, especially the generalized adaptive PID control algorithm without accurate mathematical model of the controlled object and without a priori knowledge. Since differential regulation has a large impact on the antidisturbance ability of the system, the first-order nonlinear PI control algorithm is used as an example in this paper [18]. The form of its generalized adaptive PI control algorithm is shown as follows:(9)ut=KP+ΔKPtεt+KI+ΔKIt∫0tετdτ.Unlike traditional PI control which uses constant gain coefficients, the gain coefficients for adaptive PI control are divided into two parts, whereKP is the proportional constant gain coefficient andKIis the integral constant gain coefficient. To simplify the debugging process, KI=βKP is set, where KP>0,β>0. ΔKPt and ΔKIt are time-varying gains that automatically adapt to environmental changes using the algorithm. ΔKPt and ΔKIt are determined by the following equations:(10)ΔKP=c^ψ2ψs+l,ΔKI=ΔKP,where c is a dummy parameter, c^ is an estimate of c, β and l are small constants of the designer’s choosing according to the actual situation, and β>0,l>0. s is a filter variable with the expression.(11)s=ε+β∫0tετdτ,c^ is determined by the following equation:(12)c^˙=−σ1γ1c^+σ1ψ2s2ψs+l.The equationsσ1 and γ1 are positive numbers that need to be freely chosen by the designer depending on the actual situation of the control. ψ is a scalar quantity used to describe the state of the system.To prevent the system from going out of control in the event of a contingency, an upper limitZ needs to be set for ΔKP. The expression is shown as(13)ΔKP=c^ψ2ψs+l,c^ψ2ψs+l<Z,ΔKP=Z,c^ψ2ψs+l>Z.


### 3.4. Fuzzy Control of the Step Size

In the actual control, the generalized adaptive PI control can increase the proportional and differential coefficients in real time, thus speeding up the response of the system. However, the hub motor has a large inertia and response time, and once the motor cannot respond in time, the adaptive control accumulates several iterations during which the proportionality coefficient is easily too large, thus making the system start to oscillate. When the system starts to oscillate, the adaptive algorithm will continue to increase the proportionality coefficient and form positive feedback, thus making the system completely out of control.After the PID algorithm is discretized, the time between two regulation controls is called the step size. Extending the step length can make the motor respond in time, thus reducing the accumulation of errors during the motor response and preventing the system from going out of control. However, lengthening the step length will reduce the control accuracy of the system and increase the steady-state error of the system. In this paper, fuzzy control is used to change the step length of the system in real time according to the state of the motor, so that generalized adaptive PI control can perform better and get the optimal control effect.The main components of fuzzy control are: fuzzy interface, fuzzy inference machine, and clear interface [19]. In this paper, the error and the amount of change of error are chosen as the input of fuzzy control to describe the state of the system, and the interval (step size) of system regulation is taken as the output of fuzzy control. The structure of the fuzzy controller is shown in Figure 9.Figure 9
Fuzzy control structure diagram.Fuzzy controller input variables and output variables are called linguistic variables. For example, bigger negative, medium negative, smaller negative, zero, bigger positive, medium positive, smaller positive (abbreviated as {NB, NM, NS, ZE, PS, PM, PB}), and other descriptors used to describe the size of linguistic variables are called linguistic variable values. The set of values of linguistic variables is called the fuzzy domain. The range of the actual input and output quantities of the fuzzy controller is called the fundamental domain, which is a continuous domain. The basic theoretical domain needs to be transformed into a discrete domain of finite integers in the fuzzification phase. Quantization factors are needed for domain transformation between the joint basic and discrete theoretical domains. The quantification factor is determined by the following equation. whereK is the quantization factor; n is the number of discretized basic theoretical domains; a and b are the upper and lower limits of the basic theoretical domains, respectively.(14)K=b−an.The basic theoretical domain is discretized and transformed into a fuzzy domain using an affiliation function. The commonly used affiliation functions are triangular, trapezoidal, Gaussian, etc. In order to simplify the calculation of this paper, we choose the triangular affiliation function.The input errore, the linguistic variables are taken as E, the fuzzy domain is bigger negative, medium negative, smaller negative, zero, smaller positive, medium positive, bigger positive, and smaller positive (abbreviated as {NB, NM, NS, ZE, PS, PM, PB}), the basic domain is [−300, 300], and the discrete domain is taken as [−3, 3]. The quantization factor is taken as 1/100.The variation of the input errorec, the linguistic variables are taken as EC, the fuzzy domain is bigger negative, smaller negative, zero, smaller positive, and bigger positive (abbreviated as {NB, NS, ZE, PS, PB}), the basic domain is [−60, 60], the discrete domain is taken as [−3, 3], and the quantization factor is taken as 1/20.The output quantity steps, the linguistic variables are taken as S. The fuzzy domains are small, relatively small, medium, relatively big, and big (abbreviated as {S, RS, M, RB, B}), the basic domain is [10, 50], and the discrete domain is [1, 5]. The quantization factor is 1/10.The membership function of the error is shown in Figure10.Figure 10
Membership function of error.A table of error membership functions is created from the error membership function diagram, as shown in the Table1.Table 1
Error fuzzy subset membership function table.
Membership−3−2−10123PB00000.30.71PM0000.30.710.7PS000.30.710.70.3ZE00.30.710.70.30NS0.30.710.70.300NM0.710.70.3000NB10.70.30000The membership function diagram and the function table of the change rateEC of the input error are shown in Figure 11 and Table 2.Figure 11
Membership function of the error rate of change.Table 2
Fuzzy subset membership function table of the error rate of change.
Membership−3−2−10123PB00000.30.71PS000.30.710.70.3ZE00.30.710.70.30NS0.30.710.70.300NB10.70.30000The membership function diagram and the function table of the output step S are shown in Figure12 and Table 3.Figure 12
Membership function of the output step size.Table 3
Fuzzy subset membership function table of the output step size.
Membership12345S10.70.300RS0.710.70.30M0.30.710.70.3RB00.30.710.7B000.30.71This paper summarizes 35 fuzzy control rules based on a large number of experiments that relate the error and the rate of change of the error to the actual control system step size. These control rules use the type of “if PB and PB then B.” These rules are summarized in a fuzzy rule control table, as shown in Table4.Table 4
Fuzzy control rule table.
SEPBPMPSZENSNMMBECPBBBRBMRSSSPSRBRBMSMRSRSZEMMMSMMMNSRSRSMSMRBRBNBSSRSMRBBBFinally the results of fuzzy inference are clarified using the center of the gravity method, and the specific clarification rules are shown below, wherevτ is the step size S the affiliation function of the fuzzy set ucv the center of the covered area.(15)vτ=∑k=1mvkucvk∑k=1mucvk.The final system control is shown in Figure13. The error is calculated by the real-time feedback of the rotational speed, and the obtained error is used as the input of the system to obtain the proportionality coefficient by the generalized adaptive PID algorithm KP and integral coefficient KI; the step size of this PID regulation is decided by the fuzzy controller, and the final outer-loop PID generates the control torque, which is input to the inner-loop PID and outputs the control voltage to control the wheel motor rotation.Figure 13
Overall control chart.


## 3.1. Overall Design of the Controller

The speed control of PM synchronous motors in a DC environment is usually achieved indirectly by changing the loading voltage on the three-phase inverter using PWM modulated waves to control the wheel speed. It is clear from the mathematical modeling that the entire process from load voltage to output wheel speed is high order, strongly coupled, and multivariate. In the actual control we need to face the following situations:(1)
Nonidealization of model constraints. In order for the modeling process to proceed smoothly, we formulated some assumptions about the model. However, the existence of unavoidable factors such as the manufacturing process and assembly errors in the actual control process makes it difficult to achieve the set model constraints perfectly.(2)
The values of the variables are difficult to measure. During the high-speed operation of a hub motor, variables such as instantaneous voltage and instantaneous current on the coil are difficult to measure.(3)
Constants present a strong time-domain [17]. As the motor continues to run, certain factory parameters of the motor will change as the motor runs over time. For example, the stator coil resistance value will gradually increase with the motor temperature. The maximum battery voltage decreases gradually as the battery SOC decreases.The presence of many factors makes it difficult to establish an accurate mathematical model of the loading voltage to the output speed. In order to reduce the influence of the above factors on the motor control, a two-layer PID nested control structure is designed in this paper, as shown in Figure7. The inner loop PID is the torque loop, whose main function is to control the load voltage loaded on the three-phase inverter so that the motor output torque is close to the target torque. The outer loop PID is the speed loop, whose function is to calculate the target torque of the inner loop PID control using the difference between the actual speed and the target speed, thus realizing the closed loop. In the design, the inner loop PID regulation frequency is significantly higher than the outer loop, allowing the torque loop to have enough regulation times to approximate the target torque derived from the speed loop. This design allows the system to well circumvent the problem of nonidealized motor parameters and reduces the system to a first-order nonlinear control problem between torque and speed.Figure 7
General structure of PID control.When the actual output torque is very close to the target torque, the control structure can be simplified as shown in Figure8, and the corresponding controlled model is simplified as shown in the following equation:(6)115πmr2N˙+π30BN=Te−Tl,Figure 8
Simplified PID control structure.In the formula,m is the total mass of the motor rotor tire; r is the radius of the tire; N˙ is the first-order derivative of the actual output speed; B is the coefficient of viscosity of the electronic rotor; N is the actual output speed; Te and Tl are the output torque and drag torque of the motor, respectively.


## 3.2. Conventional PID Control

PID algorithm is widely used in practical industrial control. It compares and analyzes the actual output of the controlled object with the set target quantity, and the difference between the two is adjusted by proportional link (P), integral link (I), and differential link (D) to derive the control quantity. The conventional PID control algorithm is shown as(7)ut=Kpet+Ki∫0tetdt+Kddetdt,where ut is the output of the PID control, et is the difference between the actual value of the controlled quantity and the target value, and Kp, Ki, Kd is the proportionality, integration, and differentiation coefficients, respectively.In the actual control, each observed quantity is not continuous, but discrete with a certain time interval. Therefore, we need to discretize the above traditional PID algorithm formula, and the discretized formula is shown as follows:(8)uk=Kpek+Ki∑i=1kei+KdΔek,Δek=ek−ek−1.The control performance of the PID algorithm depends mainly on the value ofKp, Ki, Kd and the greatest workload in designing the PID controller comes from the constant adjustment and trial and error of the three coefficients of Kp, Ki, Kd [18].The role of the proportionality factor Kp is to speed up the response of the control system. Kp, the larger the coefficient, the faster the response of the system and the higher the accuracy of the system, but it will also cause the system to overshoot and even cause the system to be unstable. Kp, the smaller it is, the lower the response speed of the system will be, thus prolonging the time for the system to reach the steady state and making the dynamic and static characteristics of the system both worse. The function of the integration factor Ki is to eliminate the steady-state error of the system. Ki, the larger the coefficient, the faster the system can eliminate the steady-state error, but when Ki is too large, it will cause integration saturation at the beginning of the regulation process, resulting in a large overshoot. If Ki is too small, it will make the steady-state error difficult to eliminate and affect the regulation accuracy of the system. At the same time, the measurement error will accumulate in the integration, and the accumulated error for a long time will make the regulation accuracy degrade. The differential coefficient Kd can improve the dynamic performance of the system. It can suppress the deviation in any direction and prevent the overshoot phenomenon. However, an excessive amount of Kd makes the regulation process brake earlier, which makes the regulation time longer and reduces the ability of the system to resist disturbances.


## 3.3. Adaptive PID Control

PID control algorithm has been widely used in the industry for its simple structure, good robustness, and easy implementation. But the actual control is mostly accompanied by changes in the control environment, the traditional PID control cannot change the proportional, integral, and differential coefficients in real time according to the changing environment, which makes the control effect is reduced or even out of control.For the actual control situation, adaptive PID control algorithms have been developed rapidly, especially the generalized adaptive PID control algorithm without accurate mathematical model of the controlled object and without a priori knowledge. Since differential regulation has a large impact on the antidisturbance ability of the system, the first-order nonlinear PI control algorithm is used as an example in this paper [18]. The form of its generalized adaptive PI control algorithm is shown as follows:(9)ut=KP+ΔKPtεt+KI+ΔKIt∫0tετdτ.Unlike traditional PI control which uses constant gain coefficients, the gain coefficients for adaptive PI control are divided into two parts, whereKP is the proportional constant gain coefficient andKIis the integral constant gain coefficient. To simplify the debugging process, KI=βKP is set, where KP>0,β>0. ΔKPt and ΔKIt are time-varying gains that automatically adapt to environmental changes using the algorithm. ΔKPt and ΔKIt are determined by the following equations:(10)ΔKP=c^ψ2ψs+l,ΔKI=ΔKP,where c is a dummy parameter, c^ is an estimate of c, β and l are small constants of the designer’s choosing according to the actual situation, and β>0,l>0. s is a filter variable with the expression.(11)s=ε+β∫0tετdτ,c^ is determined by the following equation:(12)c^˙=−σ1γ1c^+σ1ψ2s2ψs+l.The equationsσ1 and γ1 are positive numbers that need to be freely chosen by the designer depending on the actual situation of the control. ψ is a scalar quantity used to describe the state of the system.To prevent the system from going out of control in the event of a contingency, an upper limitZ needs to be set for ΔKP. The expression is shown as(13)ΔKP=c^ψ2ψs+l,c^ψ2ψs+l<Z,ΔKP=Z,c^ψ2ψs+l>Z.


## 3.4. Fuzzy Control of the Step Size

In the actual control, the generalized adaptive PI control can increase the proportional and differential coefficients in real time, thus speeding up the response of the system. However, the hub motor has a large inertia and response time, and once the motor cannot respond in time, the adaptive control accumulates several iterations during which the proportionality coefficient is easily too large, thus making the system start to oscillate. When the system starts to oscillate, the adaptive algorithm will continue to increase the proportionality coefficient and form positive feedback, thus making the system completely out of control.After the PID algorithm is discretized, the time between two regulation controls is called the step size. Extending the step length can make the motor respond in time, thus reducing the accumulation of errors during the motor response and preventing the system from going out of control. However, lengthening the step length will reduce the control accuracy of the system and increase the steady-state error of the system. In this paper, fuzzy control is used to change the step length of the system in real time according to the state of the motor, so that generalized adaptive PI control can perform better and get the optimal control effect.The main components of fuzzy control are: fuzzy interface, fuzzy inference machine, and clear interface [19]. In this paper, the error and the amount of change of error are chosen as the input of fuzzy control to describe the state of the system, and the interval (step size) of system regulation is taken as the output of fuzzy control. The structure of the fuzzy controller is shown in Figure 9.Figure 9
Fuzzy control structure diagram.Fuzzy controller input variables and output variables are called linguistic variables. For example, bigger negative, medium negative, smaller negative, zero, bigger positive, medium positive, smaller positive (abbreviated as {NB, NM, NS, ZE, PS, PM, PB}), and other descriptors used to describe the size of linguistic variables are called linguistic variable values. The set of values of linguistic variables is called the fuzzy domain. The range of the actual input and output quantities of the fuzzy controller is called the fundamental domain, which is a continuous domain. The basic theoretical domain needs to be transformed into a discrete domain of finite integers in the fuzzification phase. Quantization factors are needed for domain transformation between the joint basic and discrete theoretical domains. The quantification factor is determined by the following equation. whereK is the quantization factor; n is the number of discretized basic theoretical domains; a and b are the upper and lower limits of the basic theoretical domains, respectively.(14)K=b−an.The basic theoretical domain is discretized and transformed into a fuzzy domain using an affiliation function. The commonly used affiliation functions are triangular, trapezoidal, Gaussian, etc. In order to simplify the calculation of this paper, we choose the triangular affiliation function.The input errore, the linguistic variables are taken as E, the fuzzy domain is bigger negative, medium negative, smaller negative, zero, smaller positive, medium positive, bigger positive, and smaller positive (abbreviated as {NB, NM, NS, ZE, PS, PM, PB}), the basic domain is [−300, 300], and the discrete domain is taken as [−3, 3]. The quantization factor is taken as 1/100.The variation of the input errorec, the linguistic variables are taken as EC, the fuzzy domain is bigger negative, smaller negative, zero, smaller positive, and bigger positive (abbreviated as {NB, NS, ZE, PS, PB}), the basic domain is [−60, 60], the discrete domain is taken as [−3, 3], and the quantization factor is taken as 1/20.The output quantity steps, the linguistic variables are taken as S. The fuzzy domains are small, relatively small, medium, relatively big, and big (abbreviated as {S, RS, M, RB, B}), the basic domain is [10, 50], and the discrete domain is [1, 5]. The quantization factor is 1/10.The membership function of the error is shown in Figure10.Figure 10
Membership function of error.A table of error membership functions is created from the error membership function diagram, as shown in the Table1.Table 1
Error fuzzy subset membership function table.
Membership−3−2−10123PB00000.30.71PM0000.30.710.7PS000.30.710.70.3ZE00.30.710.70.30NS0.30.710.70.300NM0.710.70.3000NB10.70.30000The membership function diagram and the function table of the change rateEC of the input error are shown in Figure 11 and Table 2.Figure 11
Membership function of the error rate of change.Table 2
Fuzzy subset membership function table of the error rate of change.
Membership−3−2−10123PB00000.30.71PS000.30.710.70.3ZE00.30.710.70.30NS0.30.710.70.300NB10.70.30000The membership function diagram and the function table of the output step S are shown in Figure12 and Table 3.Figure 12
Membership function of the output step size.Table 3
Fuzzy subset membership function table of the output step size.
Membership12345S10.70.300RS0.710.70.30M0.30.710.70.3RB00.30.710.7B000.30.71This paper summarizes 35 fuzzy control rules based on a large number of experiments that relate the error and the rate of change of the error to the actual control system step size. These control rules use the type of “if PB and PB then B.” These rules are summarized in a fuzzy rule control table, as shown in Table4.Table 4
Fuzzy control rule table.
SEPBPMPSZENSNMMBECPBBBRBMRSSSPSRBRBMSMRSRSZEMMMSMMMNSRSRSMSMRBRBNBSSRSMRBBBFinally the results of fuzzy inference are clarified using the center of the gravity method, and the specific clarification rules are shown below, wherevτ is the step size S the affiliation function of the fuzzy set ucv the center of the covered area.(15)vτ=∑k=1mvkucvk∑k=1mucvk.The final system control is shown in Figure13. The error is calculated by the real-time feedback of the rotational speed, and the obtained error is used as the input of the system to obtain the proportionality coefficient by the generalized adaptive PID algorithm KP and integral coefficient KI; the step size of this PID regulation is decided by the fuzzy controller, and the final outer-loop PID generates the control torque, which is input to the inner-loop PID and outputs the control voltage to control the wheel motor rotation.Figure 13
Overall control chart.


## 4. Experiment and Analysis

This experimental platform is shown in Figure14, the external STM32 microcontroller receives the feedback speed signal, the speed will be PID processing described above, the output target torque, through CAN communication to vehicle VCU. Vehicle VCU will receive the torque through the built-in PID conversion for the control of wheel motor rotation. The vehicle’s built-in speed controller feeds the actual speed to VCU, which then transmits the speed to the STM32 microcontroller via CAN communication to finally achieve a closed loop.Figure 14
Hub motor experimental platform.Experimentally, the proportionality coefficientKP and the integration coefficient KI were set as the optimal parameters for manual adjustment at 100 r/min. The state description quantity in generalized adaptive PI control is the sum of the absolute value of the system error and the absolute value of the speed acceleration. The three parameters of PID regulation are unchanged, and the target speed of the motor is set to 100 r/min and 300 r/min and record the actual control of tire speed by the system under three modes of generalized adaptive PID mode, fuzzy adaptive PID mode, and conventional PID mode. The experimental results are shown in Figures 15 and 16. The performance comparison between different algorithms is shown in Table 5.Figure 15
Effect diagram of target speed of 100.Figure 16
Effect diagram of target speed 300.Table 5
Control performance index comparison table.
Control strategyControl goals (r/min)Rise timeSteady-state durationOvershoot (%)Steady-state error (%)PID1000.141.2353623000.2151.63234Adaptive PID1000.060.9755043000.110.83293.6Fuzzy adaptive PID1000.0750.6853013000.1350.625173.3In terms of time to approach the target speed, the generalized adaptive PID is the fastest, followed by the fuzzy adaptive PID and finally the conventional PID control. The adaptive PID algorithm automatically increases theKP factor according to the motor state to make the whole faster to approach the target speed. The fuzzy adaptive PID algorithm extends the regulation interval to reduce the number of iterations of the proportionality coefficient relatively slow, but also significantly faster than the traditional PID algorithm.In terms of the time to reach a steady state, the fuzzy adaptive PID control is the best and generalized adaptive PID control has the longest time to enter a steady state. The system lag caused by motor inertia makes the adaptive PID control algorithm iterate the PID control coefficients rapidly even after approaching the target speed, instead prolonging the oscillation time. The addition of fuzzy control allows the system to adjust each PID control interval according to the state of the motor, allowing the motor to respond in sufficient time to reduce the generation of oscillations.In terms of overshoot, the fuzzy adaptive PID algorithm is significantly smaller than the generalized adaptive PID control algorithm. The intelligently adjusted step size significantly reduces the transition accumulation of the proportional coefficient KP, effectively suppressing the control inertia of the system and reducing the generation of overshoot.In terms of steady-state error, the three control methods do not differ much. Fuzzy adaptive PID control is slightly better than generalized adaptive PID control, and the effect is close to that of conventional PID control.From the comparison between Figures15 and 16, it can be concluded that the same PID parameters still play a role in the control of the system as a result of changing the target speed from 100 r/min to 300 r/min. However, the increase in speed makes the steady-state error of the system increase significantly, and the control effect is relatively reduced. The adaptive PID control algorithm with fuzzy adjustment step size still allows the system to regulate faster and enter the steady-state phase in less time than traditional PID algorithms.Overall, fuzzy adaptive PID control retains the ability of generalized adaptive PID control to automatically adjust parameters and can have a fast approach to the target. At the same time, it can also effectively reduce the generation of overshoot and reduce the time to enter the steady state. It can not only approach the target quickly and effectively, but also ensure the lower limit of traditional PID control effect and provide a stable steady-state performance, which effectively increases the robustness of the system when facing different working conditions.


## 5. Conclusion

In view of the problem that the generalized adaptive PID control cannot respond to the lag caused by the inertia and error of the system in time, and is easy to produce overshoot and steady-state error, this paper designs the adaptive step size adjustment algorithm of fuzzy control according to a lot of control experience and summary. If the lag of the system is large, the step length between the two adjustments is lengthened, so that the system can have enough time to respond to the control command and eliminate the lag of the system. When the system lag is small, the PID adjustment can be performed with a small step size to deal with the sudden change of the system in time. Practical verifications at different speeds are carried out on hub motors. Experiments show that the algorithm has a good fast response ability and excellent adaptive ability in the control of the motor. However, good fuzzy control results need to be based on a lot of practical experience. Although the addition of fuzzy control effectively optimizes the effect of control inertia, it also limits the generalizability of the control method. Future research will address multiple factors of motor hysteresis by effective mathematical modeling and propose a generalized method for effective reduction of motor control system hysteresis using modern control theory.



---

*Source: 4979824-2022-09-29.xml*