**3. Data Processing**

There are many sources of vibration in a vehicle. Different vibration sources have certain differences in frequency domain characteristics. In this study, a quarter of the vehicle model and the abnormal road surface model are established to analyze the excitation effect of the abnormal road on the overall vehicle system. In order to obtain the vibration frequency range of the vehicle body, a frequency spectrum analysis of the vibration acceleration of the vehicle body is implemented, and a filter based on this analysis result is designed.

#### *3.1. Vehicle Dynamics Analysis*

In order to study the interaction between the vehicle and the road, a quarter-vehicle model is utilized to analyze the vibration of the vehicle in the vertical direction. The simplified vehicle dynamics model is shown in Figure 2.

**Figure 2.** The quarter vehicle model.

mu is the unsprung mass. ms is the sprung mass. *KS* is the stiffness of the spring. *CS* is the damping coefficient of the shock absorber. KT is the stiffness of the tire. *xs* is the vertical displacement of the vehicle body. *xu* is the vertical displacement of the wheel. *xg* is the road surface excitation. The differential equation of motion of the vehicle is described as Equation (1).

$$\begin{cases} \mathbf{m}\_{\sf s} \ddot{\mathbf{x}}\_{\sf s} + \mathbb{C}\_{\sf S} (\dot{\mathbf{x}}\_{\sf s} - \dot{\mathbf{x}}\_{\sf u}) + \mathbf{K}\_{\sf S} (\mathbf{x}\_{\sf s} - \mathbf{x}\_{\sf u}) = \mathbf{0} \\\ \mathbf{m}\_{\sf u} \ddot{\mathbf{x}}\_{\sf u} - \mathbb{C}\_{\sf S} (\dot{\mathbf{x}}\_{\sf s} - \dot{\mathbf{x}}\_{\sf u}) - \mathbf{K}\_{\sf S} (\mathbf{x}\_{\sf s} - \mathbf{x}\_{\sf u}) + \mathbf{K}\_{\sf T} (\mathbf{x}\_{\sf u} - \mathbf{x}\_{\sf S}) = \mathbf{0} \end{cases} \tag{1}$$

This paper analyzes the dynamic response of the vehicle when the vehicle passes through the road surface at different speeds [26]. An abnormal pavement model is shown in Figure 3. The length of the abnormal road surface is L, and the height is h. *v* is the speed of the vehicle. t1 and t2 are the starting moment and the ending moment of the road surface excitation, respectively. The mathematical model is described as Equation (2) [27].

$$\mathbf{x}\_{\mathcal{S}}(t) = \begin{cases} 0.5 \mathbf{h} \big( 1 - \cos \left( \frac{2\pi \mathbf{u}}{L} t \right) \big) \mathbf{t}\_1 \le t \le \mathbf{t}\_2\\ 0, \mathbf{t}\_1 < t \text{ or } t > \mathbf{t}\_2 \end{cases} \tag{2}$$

**Figure 3.** Abnormal road surface excitation at different speeds.

When the vehicle passes through an abnormal road at different speeds, the vertical acceleration response of the vehicle body is shown in Figure 4. The speed of the vehicle has a significant effect on the vertical acceleration of the vehicle. The frequency–domain analysis of the acceleration signal is performed to obtain a spectrogram of the vehicle vibration acceleration signal, as shown in Figure 5. As the vehicle speed increases, the frequency of body vibration increases, but its main component is still in the low-frequency range (30 Hz).

## *3.2. Butterworth Filter*

When the data is collected, the position of the smartphone is not flat, and the slope of the test road surface may interfere with the recognition of the abnormal road surface. Therefore, the data needs to be filtered before using to recognize the abnormal road surface. According to the simulation data analysis results, the vibration caused by the abnormal road surface excitation is mainly distributed in the low-frequency range.

In this paper, the Butterworth filter is used to filter out the through component and the high-frequency noise with the frequency greater than 30 Hz. There are several reasons for choosing the Butterworth filter. Firstly, the Butterworth filter does not generate a ripple in the passband. Secondly, it has been successfully implemented in many commercial tools. Figure 6 shows the frequency response of the fifth-order Butterworth's numerical low-pass filters with a cut-off frequency of 30 Hz.

**Figure 6.** The frequency response of the Butterworth filter.

In addition, the filter delay has a negative impact on the positioning accuracy of abnormal roads surface. The filter delay will shift the positioning of the abnormal road surface towards the vehicle driving direction for a distance. However, because the filtering delay is very small (about 0.1 s), the positioning error caused by the filtering delay is not large, and the positioning accuracy requirements for abnormal road recognition are not high. Therefore, the Butterworth filter can be applied to the recognition of abnormal roads.

#### **4. Abnormal Road Surface Recognition**

#### *4.1. Overview of Abnormal Road Surface Recognition Algorithm*

The framework of the abnormal road recognition algorithm is shown in Figure 7. In order to collect vehicle speed, acceleration, and position information, the smartphone's built-in accelerometer and global positioning navigation system are used. First, the raw data is preprocessed using a Butterworth filter. Secondly, the Gaussian background model is improved by using fuzzy logic control. The improved Gaussian model is combined with the acceleration threshold condition to extract the characteristic acceleration value caused by the abnormal pavement. Finally, the kNN algorithm is used to classify the abnormal road surface.

**Figure 7.** Road surface recognition algorithm framework.

#### *4.2. Gaussian Background Model*

When the vehicle is traveling on a flat road surface, the vibration acceleration in the vertical direction of the vehicle is Gaussian-distributed. In order to verify the conclusion, we used both Kolmogorov–Smirnov and Lilliefors test methods to test whether the acceleration generated by the vehicle on a flat road conforms to the Gaussian distribution. The results show that the assumption is valid. By measuring the vibration acceleration of the vehicle, the vehicle's vertical acceleration will be abrupt when the vehicle passes through an abnormal road surface compared to traveling on a flat road [28]. The Gaussian model is described as Equation (3).

$$\eta(z|\mu, \sigma^2) = \frac{1}{\sigma\sqrt{2\pi}}\mathbf{e}^{\left(\frac{-(z-\mu)^2}{2\sigma^2}\right)}\tag{3}$$

μ is a mathematical expectation. σ is a standard deviation, and *z* is a body vibration acceleration value. If the vehicle passes over an abnormal road, the body acceleration at this time will no longer conform to the Gaussian distribution. Therefore, if *z* is the vertical acceleration of the vehicle caused by abnormal road excitation, the absolute value of the difference between *z* and μ is greater than the product of the threshold TG and the standard deviation σ. The equation can be described as Equation (4).

$$\left| (z - \mu) \right| > \mathcal{T}\_{\mathcal{G}} \* \sigma \tag{4}$$

If Equation (4) is not satisfied, the vehicle is considered to be traveling on a flat road. At this time, the background of the Gaussian model will change, and the model parameters will be updated. The Gaussian model parameter update equation is described as Equation (5).

$$\begin{cases} \mu\_{t+1} = (1 - a)\mu\_t + \alpha(z - \mu\_t) \\ \sigma\_{t+1}^2 = (1 - a)\sigma\_t^2 + \alpha(z - \mu\_t)^2 \end{cases} \tag{5}$$

where α is the learning rate, and the size of the learning rate indicates the speed of the update. μ*<sup>t</sup>*+<sup>1</sup> and σ*t*+1 are the updated mean and standard deviation.

#### *4.3. Improved Gaussian Background Model*

The vibration acceleration of the vehicle is a ffected by the traveling speed. When the vehicle passes over abnormal roads at a di fferent speed, the amplitude of the vibration acceleration is di fferent. In order to avoid false alarms at high speed and false negatives at low speed, the Gaussian model described as Equation (3) needs to be improved. After the improvement, if *z* is the vertical vibration acceleration caused by the abnormal road surface, it can be described as Equation (6).

$$\left| (z - \mu) \right| > \left( \frac{\upsilon}{\mathrm{T\_V}} \right) \* \mathrm{T\_G} \* \sigma \tag{6}$$

In addition, when the vehicle passes an abnormal road surface, the vertical acceleration of the vehicle is large. Therefore, if *z* is the acceleration caused by passing through the abnormal road, *z* will satisfy the following Equation (7).

$$z > \left(\frac{v}{T\_V}\right) T\_Z \tag{7}$$

Similar to the Gaussian background model, the improved Gaussian background model will also update the model parameters. When the acceleration *z* does not satisfy Equations (6) and (7), the data is considered as background data and will be used to update the background parameters. The parameter update formula is shown in Equation (5).

Where *v* is the current vehicle speed, and TV is the speed threshold. Vehicle suspension parameters are di fferent for di fferent types of vehicles. The vibration response of the vehicles body will be significantly di fferent when di fferent types of vehicles pass through the same road surface. The original Gaussian background model has a fixed threshold *TZ*, which is obviously not applicable to di fferent types of vehicles. Therefore, this paper proposes designing a fuzzy logic controller to optimize the Gaussian background model.

Due to the complexity of the vehicle system, it is di fficult to establish accurate mathematical models to describe the relationship between di fferent vehicles and abnormal road surfaces. Fuzzy logic control is based on artificial experience and does not require an accurate mathematical model of the controlled object. Using fuzzy logic, the basic idea of optimizing the abnormal road surface recognition algorithm is: Firstly, find the fuzzy relationship between the road surface recognition algorithm parameter *TZ* and the vehicle suspension parameters. Second, in the process of road surface recognition, according to the di fference of *KS* and *CS* parameters of di fferent vehicles, fuzzy logic is used to modify *TZ*, so that the abnormal road surface recognition algorithm can adapt to di fferent types of vehicles.

In this section, to make the abnormal road recognition algorithm applicable to di fferent types of vehicles, a fuzzy logic inference machine is used to calculate an appropriate *TZ*. The input quantities of the fuzzy logic inference machine are defined as the vehicle suspension sti ffness *KS* and damping *CS*. The basic domain of *KS* is [0,200], the basic domain of *CS* is [0,4], and the basic domain of *TZ* is [0.5,1].

As shown in Figure 8, the membership function is gaussmf type. The input 1 ( *KS*) is qualitative into five sets, denoted as NB, NS, ZO, PS, and PB. The input 2 ( *CS*) is qualitative into four sets, denoted as NB, NS, PS, and PB. The output ( *TZ*) is qualitative into three sets, denoted as NB, ZO, and PB, where NB is negative big, and PB is positive big.

**Figure 8.** Membership function. (**a**) Membership function of input 1 (*KS*). (**b**) Membership function of input 2 (*CS*). (**c**) Membership function of the output (*TZ*).

The establishment of the rule bases of the fuzzy logic inference machine is based on the experiments and CarSim simulation. The rule bases of the fuzzy logic inference machine are shown in Table 1, and Figure 9 shows the interface of the output.


**Table 1.** Rule bases of *TZ*.

**Figure 9.** The surface of fuzzy logic controller's output.

The improved Gaussian background model is described in Algorithm 1.

#### **Algorithm 1:** Abnormal road surface recognition method

**Input:** *z*, the Z-axis acceleration; *v*, the vehicle speed; *KS*, the spring stiffness; *CS*, the damping coefficient. **Output:** *event\_z*, Acceleration due to abnormal road surface.

1. **Algorithm begin:** *2.* μ = 0 *%* μ is a mathematical expectation 3. σ = 0 *%* σ is a standard deviation 4. TG = 2 %TG is the Gaussian matching threshold 5. TV = 20 % TV is the speed threshold 6. if (*v* > TV) 7. *z\_match* ←abs(*z* − μ)/σ 8. % calculating thresholds *TZ* using fuzzy logic inference machines 9. *TZ* ← fuzzy\_control (*KS*, *CS*) 10. if (*z\_match* > TG\**v*/TV) && (abs(*z*) > (*TZ* \* *v*/TV)) 11. *event\_z* ← *z* 12. else % update μ and σ, as described in Equation (5) 13. μ ← (1 − α) \* μ + α\**z* 14. σ ← SQRT ((1 − α) \* σˆ2 + α \* (*z* − μ)ˆ2) % SQRT means calculate square root 15. end if 16. end if 17. return *event\_z* 18. **Algorithm end**

#### **5. kNN Algorithm Abnormal Road Surface Classification**

The kNN classifier is a sample-based machine learning algorithm. Due to the simple and effective characteristics of kNN, kNN has been widely used in engineering applications [29]. First, the abnormal road surface acceleration signal extracted by the abnormal road surface recognition algorithm is used to identify the k nearest neighbor values in the training data set. Then, the abnormal pavement labels corresponding to these nearest neighbor values are counted, and the number of neighboring samples belonging to each possible type is calculated. The most common type of pavement that belongs to most of the k nearest neighbors is the type of pavement being measured.

#### *5.1. Training and Testing Sample Data Sets*

Both the training samples and the test samples are collected by the acceleration sensor of a smartphone. In this study, multiple sets of acceleration data caused by abnormal road surfaces are collected as training data sets. In addition, in order to maintain the independence between training data and test samples, the training samples and test samples are collected on two different roads. The number of training and test samples obtained in this paper is shown in Table 2.


**Table 2.** Number of training and testing sample.

From the perspective of the classification process, kNN most directly establishes a relationship between training samples and test samples, which can effectively avoid the negative impact caused by the improper selection of category features. Another widely used classification algorithm support vector machine (SVM) is utilized to compare with kNN on classifying the road surface. The same training and testing samples are used and the results are shown in Figure 10. The results show that kNN has an advantage over SVM in the classification of abnormal roads.

**Figure 10.** The performance of kNN and SVM.

#### *5.2. Classification Algorithms and Tuning Parameters*

The kNN classification algorithm classifies objects based on the attributes of k neighbors. The value of k is a key parameter of the kNN algorithm. This paper tests the classification effect when k takes different values in the range of 1–19 (odd numbers). Figure 11 shows the classification accuracy when k takes different values. It can be seen from the figure that as the value of k increases, the classification accuracy decreases, and the effect is best when k = 3. Therefore, k is set as 3 in this work.

**Figure 11.** The relationship between classification accuracy (y-axis) and k value (x-axis).

#### **6. Test and Analysis**

## *6.1. Test Conditions*

To validate the performance of the proposed algorithm, an A-class vehicle (Cavalier) and SUV (Qoros 5) are used to perform the test. An app working on a smartphone (Redmi Note 8 Pro) is developed to collect the acceleration, speed, and position. The sampling frequency is 400 Hz. According to the sampling theorem, if the frequency information of a signal is to be saved, the sampling frequency must be twice as much as the frequency of the measured object. If the amplitude information of a signal is to be saved, the sampling frequency is preferably ten times as much as the frequency of the measured object. The sampling frequency of vehicle speed and position is 1 Hz. This is because the GPS module data update frequency in the smartphone used in the experiment is 1 Hz. The smartphone is fixed on the handrail of the driver's seat during the test, as shown in Figure 12.

**Figure 12.** Smartphone installation location.

The vehicle travels at a different speed on an abnormal road and a flat road and performs multiple tests. There are many abnormal road surfaces on the test road, as shown in Figure 13. The actual measurement shows that the area of the pothole on the road is about 1 square meter and the maximum depression depth is 30 mm. The diameter of the raised manhole cover is 700 mm, and the height is 50 mm. The width of the speed bump is 350 mm, and the height is about 30 mm.

**Figure 13.** Abnormal road surfaces on the test road.

#### *6.2. Vehicle Dynamic Response under Di*ff*erent Road Excitations*

When the vehicle is travelling on a flat road surface, its vibration acceleration is relatively stable. When the vehicle passes through an abnormal road surface such as a road pit or a road surface bump, the acceleration of the vehicle in the vertical direction changes significantly. Figure 14 shows the vibration acceleration of the vehicle when the vehicle passes through different roads at a speed of 30 km per hour. Figure 14a shows the vehicle traveling on a flat road surface. In Figure 14b, the vehicle is excited by the pothole road surface. In Figure 14c, the vehicle is excited by the bump road surface. Under the influence of gravity acceleration, the Z-axis acceleration fluctuates around 9.8.

After the original acceleration data is processed by the Butterworth filter, the filtered Z-axis vibration acceleration shown in Figure 15 is obtained. It can be clearly observed that the valid data collected by the smartphone is retained, and the through component and the high-frequency noise are eliminated.

#### *6.3. Test Results and Analysis*

Figure 16 depicts the vertical acceleration values of the vehicle body when the experimental vehicle passes through the same abnormal road surface at different vehicle speeds. The blue triangle in Figure 16 represents the experimental data of the A-class vehicle, and the red rectangle represents the experimental data of the SUV.

It can be observed from Figure 16 that as the vehicle speed increases, the vertical vibration acceleration of the vehicle body also increases. In addition, when the different types of vehicles pass the same abnormal road surface, the vertical vibration acceleration of the vehicle body also has a significant difference.

Comparing the field measurement results with the algorithm identification results, as shown in Table 3, the results show that the proposed method can effectively identify the road surface potholes and bumps. In the 68 sets of road surface pothole data, 64 groups are successfully identified and classified, and the accuracy rate is 94.12%. Among the 151 sets of road surface bumps data, 145 groups are successfully identified and classified, and the accuracy rate is 96.03%. Through onsite investigation of the reported road surface, it is found that the abnormal road surface size of the false alarm is small, or the multiple abnormal road surfaces are close to each other, which leads to erroneous recognition results.


**Table 3.** Abnormal road surface identification result.

**Figure 14.** Vehicle vibration acceleration signal. (**a**) Flat road surface; (**b**) pothole road surface; (**c**) bump road surface.

**Figure 15.** Z-axis vibration acceleration after filtering. (**a**) Flat road surface; (**b**) pothole road surface; (**c**) bump road surface.

**Figure 16.** Vehicle speed and body vibration acceleration.
