Abstract
Magnetorheological dampers are highly nonlinear damping elements which exhibit multi-dimensional data correspondence problems in the current input and damping force output data sets. Therefore, it is inconvenient to use the traditional modeling method to predict the output damping force of the magnetorheological damper accurately. Although the neural network can predict data-driven output results to a high precision, more models, parameters, and complex structures are required to predict the expected current from the magnetorheological test data set. In this study, a prediction model of the expected current in a magnetorheological damping system was proposed by using the k-nearest neighbor algorithm based on the classification algorithm in machine learning. Then, the k-nearest neighbor prediction model was trained and tested with data obtained experimentally. In order to verify the performance of the k-nearest neighbor algorithm, a comparison was made with a prediction model based on the BP neural network, and the damping force output of the predicted current was simulated. The study results show that the k-nearest neighbor prediction model established has a more straightforward working principle, fewer input variables, and a higher approximation accuracy compared with the BP neural network control system.
1. Introduction
The magnetorheological damper is a shock absorber that utilizes magnetorheological fluid as the working medium. As its damping force output can be adjusted in real time by changing the excitation current, magnetorheological dampers are widely used in intelligent control, robots, medical rehabilitation equipment, and other fields. The characterization of the nonlinear rheological properties and mechanical properties of a magnetorheological fluid under excitation involves the crossing of various disciplines including electricity, magnetism, machinery, and control (Bai et al., 2013). That makes it difficult to establish a dynamic model of the magnetorheological damper through traditional mathematical methods, which leads to substantial inconveniences in the design of the magnetorheological damping control system.
The predictive control of the damping force output of a magnetorheological damper depends on the availability of an accurate control model. Therefore, the establishment of a simple but precise damping force prediction model is key to realizing automatic control of magnetorheological damping systems, which is especially important in designing flexible and safe human-machine interactive robots. F Weber (Weber, 2013; Weber et al., 2014) presented two real-time force tracking control schemes for MR dampers based on the Bouc-Wen model and the extended neural network, respectively. The two methods were validated numerically and experimentally that the real-time control scheme is numerically stable and the force tracking error represents an acceptable accuracy for the former, and the proposed tracking scheme works better when the frequency content of the estimated current is close to that of the training data for the latter. Further, Weber (2015) proposed a novel force tracking control scheme for magnetorheological (MR) dampers. The feed forward, which is derived by a control-oriented mapping approach to reduce modeling effort of the inverse MR damper behavior, compensates for the main steady-state nonlinearity of the MR damper force and thereby linearizes the plant. Recently, Xian-Xu ‘Frank’ Bai (Bai and Tang, 2021) proposed a dynamic resistor-capacitor (RC) operator (dRCO)-based hysteresis model. The input data is preprocessed by the dRCO, and the neural network model is constructed for the parameter identification of the MR damper model. The simulation and experimental tests of MR damper force tracking using different hysteresis models demonstrate that the dRCO model is superior to the Bouc-wen model and the basic RCO model. These preliminary explorations provide a theoretical and experimental basis for the prediction of damping forces and intelligent control of magnetorheological damping systems, and also provide a framework for the subsequent research work in the modeling of intelligent control schemes.
In recent years, the development of artificial intelligence and computing technology has been accompanied by widespread attention directed to data-driven intelligent control. These systems are typical strategies in multidisciplinary control strategy (Li, 2009) and integrate mechanical modeling, control technology, system science, and other disciplines to make the correct decisions in complex environments (Saridis, 1979). As artificial intelligence and machine learning continue to develop, the modeling of magnetorheological damping control systems through intelligent algorithms has been increasingly favored by scholars. The forward modeling of the magnetorheological damping force output by a known excitation current (current → damping force) has been conducted (Fu et al., 2016), in which the nonlinear autoregressive with external input (NARX) neural network was used to model damping force output for a magnetorheological elastomer isolator. Compared with the BP (back propagation) neural network, the NARX neural network can accurately predict the damping force output even if the input displacement and current are noisy. However, this model lacks feedback and is only an open-loop forward prediction model. The hysteretic forward model of a magnetorheological damper with a feed-forward neural network and the forward model of a static magnetorheological damper artificial neural network were proposed by Ekkachai et al. (2012) and Tudón-Martínez et al. (2012) respectively to predict the output magnetorheological damping force. These studies are forward modeling strategies with open-loop characteristics based on known current to damping force output control.
In conditions where the motion state of the system is known, it is necessary to predict the current required to control the damping force at the current state. This involves the reverse modeling of the magnetorheological damping control, which feeds back information on the state of the magnetorheological damping system to realize the intelligent control of the system. Russo and Terzo (2011) present a theoretical and experimental study on a shear mode MR device, by experimentally examination, the acquired data could be used for system modeling, parameter identification, model validation, and control design. Xu et al. (2017) proposed a BP neural network optimized by the Artificial Bee Colony algorithm to predict the control voltage of a magnetorheological damper. However, the predicted voltage of this model could only reflect the two-stage value of the damper near a certain velocity value, and thus the control system could not continuously adjust the damping force output in real time when the magnetorheological damper was operated over a full-speed range. Ekkachai et al. (2013) put forward a feedforward neural network based on the elementary hysteresis model to predict a desired voltage. Although the system could reproduce the desired damping force near a certain velocity, the accuracy of the predicted voltage of the control system was low and exhibited obvious oscillations at high voltages. Besides, the optimal neural network has been applied by Xia (2003) to predict the excitation voltage of the magnetorheological damper. Wang and Liao (2005) and Chang and Zhou (2002) have also used a recurrent neural network (RNN) to establish a reverse dynamic model of the magnetorheological damper to predict the excitation voltage required at both ends of the magnetorheological damper. Neural networks and other intelligent algorithms are commonly used to achieve reverse predictive control of magnetorheological damping systems.
An intelligent control system requires not only forward output control but also closed-loop feedback of the system state information. That enables the input of the next moment to be determined and also influences the output prediction, which is crucial to the design of an intelligent control strategy for a magnetorheological damping system. The forward model of an open loop can facilitate the forward control of an excitation current → damping force at the present moment. However, because of the variable excitation current and system state during damper operation, it is difficult to predict the excitation current (damping force → excitation current) required to achieve the magnetorheological damping force output at the next moment in the full-speed and excitation current variation domains. In the proposed inverse models, the prediction of the control current at both ends of the magnetorheological damper is considered as a regression problem at a certain velocity. This method of treating current prediction as a regression problem generally has following shortcomings: (1) the number of models is large and there are many variables in the input model; (2) the structure and principle of the model are complex; and (3) the prediction accuracy is obviously low in partial current intervals. The above disadvantages increase the complexity of modeling, and delay the response time of the system.
Aiming to solve the above problems, the idea of a classification algorithm in machine learning was applied to propose a prediction method for the expected control current of the required damping force of the magnetorheological system in this study, based on empirically obtained sample data. The k-nearest neighbor algorithm was used to model, compare, predict, and analyze the results of the expected control current. The research results will further promote the development of intelligent control systems for magnetorheological dampers.
2. Experiments and data acquisition
2.1. Experimental equipment and methods
The experimental tests were performed on an RD-8040-1 (with stroke of 55 mm, extended length of 208 mm, body diameter of 42.1 mm, shaft diameter of 10 mm; damper force: 5 cm/sec@1 A, 2447 N; operating temperature 71°C; input current: continuous for 30 seconds, 1 A, intermittent, 2 A) single cartridge magnetorheological damper manufactured by Lord Corporation. A TPD-W2 electronic servo multi-function testbed manufactured by Jinan Kaide (Figure 1), was used to acquire data and carry out damping force-displacement and damping force-velocity experiments on the magnetorheological damper. The excitation waveform under test loading was a sine wave with an excitation amplitude of 20 mm and an excitation frequency of 1 Hz. The starting current of the magnetorheological damper was set as 0 A, which was then increased by 0.02 A for each successive test. In order to maintain the experimental data to within the working range of the damper, the experimental excitation current was designed to load and collect data over three current ranges: 0–0.3 A, 0.3–0.6 A, and 0.6–0.9 A, which were recorded by the computer.

Multi-function testbed.
2.2. Experimental results and data processing
Physical parameters of the magnetorheological damper such as the vibration displacement, bar moving speed, output damping force, and excitation current were collected in real-time to establish a sample database for the prediction model. Any abnormal data points in the starting and stopping phases of the experiment were removed, and the experimental data was then processed to obtain the damper indicator and velocity characteristic diagrams shown in Figure 2. The curve in Figure 2(a) shows the damping force-displacement expression when the excitation current from inside to outside increases from 0.0 to 0.9 A under gradual loading, while the Figure 2(b) is the damping force-velocity characteristic expression of the damper under the working state.

Performance test results of magnetorheological damper: (a) damping force versus displacement and (b) damping force versus velocity.
The following conclusions can be obtained from the performance test of the damper:
The magnetorheological damper is influenced by the electromagnetic nonlinearity of the magnetorheological medium. Within the magnetic saturation range of the magnetorheological fluid, the damping force output increases approximately linearly with the increase of current but becomes less sensitive once the magnetic saturation limit is reached. Therefore, the experimental data reveals that although the excitation current in the saturation region is large under the same state, the damping force varies minimally.
The working state of the magnetorheological damper is a reciprocating cycle. In the discrete loading process of the excitation current, certain current values may correspond to multiple sets of system states (force, displacement, velocity, and acceleration). This phenomenon makes function mapping of the system state-excitation current difficult to carry out using ordinary mathematical methods. Thus, neural network modeling is used to express this relationship as it is insensitive to the mapping relation between the input and output. Theoretically, many sets of neural network models are needed for this expression, and the higher the expression accuracy, the more models required. That is also the difficulty of the current magnetorheological damping expected control current to model the neural network in the full excitation current domain. Consequently, it is necessary to find a new method to predict the expected control current of the damping force required by the system.
3. Prediction modeling of expected current using the k-nearest neighbor algorithm
3.1. Principle of k-nearest neighbor classification algorithm
The k-Nearest Neighbor (kNN) algorithm is a typical unsupervised learning algorithm for solving nonlinear classification problems (Li et al., 2018). The apparent difference between the kNN algorithm and other machine learning algorithms such as the neural network is that it does not have a distinct learning process, so this algorithm is called a lazy learner (Wu et al., 2008). The kNN algorithm is applied in fields such as adaptive process monitoring (Zhu et al., 2018), plastics (Aquino and Pereira-Filho, 2015), prediction of the nuclear receptor (Tiwari and Srivastava, 2018), and pattern recognition (Jiang et al., 2017; Kassani et al., 2017). For the test sample, the Euclidean distance was used to calculate the samples within k training sets closest to the test samples. Then, the corresponding labels of the samples in the k training sets were used to make a prediction of the test samples, that is, the voting decision was made based on the fact that the minority was subordinate to the majority, and the points in the nearest neighbor were divided into this category. Figure 3 shows the function of the kNN classification algorithm in the control model of the magnetorheological damper.

k-Nearest neighbor (kNN) algorithm.
The rectangular curve in Figure 3 represents the indication diagram of the magnetorheological damper. The current of the damper increases from the inner to the outer curve, and the arrow point is the samples to be tested. The circle in the middle of Figure 3 represents the indication diagram obtained using the kNN method for the arrow point. The three circles are equally spaced from each other. At k = 1, the label of the test sample is identified as the label corresponding to the gray training sample; when k = 3, the number of gray labels is the largest, and the label of the test sample is still identified as the label corresponding to the gray training sample. Finally, when k = 5, the number of blue labels is greater than the number of gray labels, and the labels of the test samples are identified as the corresponding labels of the blue training samples. Thus, it is evident that the selection of parameter k has a significant influence on the prediction accuracy of the model.
3.2. Comparison of neural network examples
In order to investigate the prediction accuracy of the kNN algorithm, the traditional neural network algorithm is was used for comparison. Predictions of the expected current by the neural network mainly focused on the prediction of single current values. That is, the training samples were grouped according to the current, and the data sets corresponding to different currents were trained separately. The results of training and testing corresponding to currents of 0.20, 0.40, and 0.60 A are presented in Figure 4.

Training and test results for different current values (I = 0.2, 0.4, and 0.6 A, respectively).
The test results above show that the neural network was able to predict the current to a very high accuracy through the group modeling of current values, with an absolute error of less than 10 mA. However, the control current required in the control process of the magnetorheological damper is a continuous analog quantity. If the continuous current is trained independently, good modeling results can be obtained for each neural network model. That requires a large number of multi-dimensional current-based neural network models with more subdivisions and larger data sets to minimize error. Moreover, in the practical applications, a corresponding mechanism is needed to select the appropriate model, which undoubtedly increases the calculation load of the control model. This, in turn, reduces efficiency and is not conducive to improving the response of the system in practical applications.
If the current is not subdivided into the categories described above, the prediction accuracy of the model is poor. Figure 5 presents the results of the predicted current obtained by training the neural network with the traditional method without current categorization. The average absolute prediction error of the predicted current reaches 0.071 A, taking the algorithm 22.43 s to complete the entire process from training to testing. At an actual current of less than 0.50 A, the value predicted by the neural network tends to exceed the actual value, and the smaller the current, the larger the absolute error between the predicted value and the actual value. When the actual current value is greater than 0.65 A, the predictions tend to be small, and the absolute error between the predicted value and the actual value rises as the current increases. Obviously, the prediction accuracy of this modeling method for the expected control current of a magnetorheological damper is very low.

Current prediction results in a neural network control model.
The results above show that although neural networks trained using subdivided current data sets can achieve high precision, they lack in operability. If the network is trained on an entire data sample, large errors exist. Therefore, the use of the neural network method to predict the expected control current of the magnetorheological damping force has some limitations.
3.3. Prediction implementation of the k-nearest neighbor algorithm
In the kNN algorithm, system state parameters such as damping force F(t), piston displacement s(t), and input current I(t) were used as the training data. The Euclidean formula was used for distance calculations and the value of k was a positive integer between 1 and 20. During training, 20 positive integers were used to train and test the algorithm, and the performance of the algorithm corresponding to each k value was then evaluated according to the performance index of the mean absolute error. The test data set used was the same as that used in the neural network, and the average absolute prediction error of the model under different k values is shown in Figure 6.

The influence of parameter k on the prediction error of the k-nearest neighbor algorithm.
As illustrated in Figure 6, the largest average absolute prediction error of 0.0134 A was observed at k = 5. Conversely, a value of k = 3, gives the smallest average absolute prediction error of 0.0037 A, and is thus selected for use in the algorithm.
3.4. Prediction results and analysis
In the experiments, the kNN algorithm was used to predict the current by first training the model using the collected sample data. The data of the test set was then inputted into the above model to generate current predictions, the results of which are shown in Figure 7. A jump phenomenon of the individual data was observed, and the average absolute prediction error of the was 0.0037 A, taking 0.71 s in total from training to testing.

Test results of k-nearest neighbor control system.
The results in Figure 7 demonstrate that the model can predict the control current of the magnetorheological damper relatively well over the whole test range. In the region of the curve where the test current was less than 0.46 A, all test samples could be accurately predicted. In contrast, small deviations from the real value were observed at test currents greater than 0.46 A.
A total of 92 samples were tested in the model, and only eight test samples exhibited deviations between the actual and predicted values, accounting for 8.70% of the total test samples. The two samples between 0.46 and 0.76 A showed a relative prediction error of greater than 10%, while the remaining six samples had relative prediction errors within 5%.
For general engineering applications, the inverse prediction of control current using the kNN algorithm is feasible for the state parameters data. The average absolute prediction error of the established training model to the test set sample was 0.0037 A, which is about 1/19 of the neural network system. This high control accuracy is conducive for applying the control system to practical engineering applications.
To examine the control accuracy of the magnetorheological damper control model, an evaluation index has been proposed by Wang and Hu (2006), given as follows:
where EI is the relative approximation accuracy,
When the deviation between the predicted value and the actual value is large, the relative approximation accuracy returns a negative value. In order to better reflect the relative approximation accuracy of the two models in the form of a line graph, the values of approximation accuracy less than zero were set to zero in this paper. Using this evaluation index, the relative approximation accuracies of the kNN prediction model and the BP neural network model were then compared, as shown in Figure 8.

Comparison of relative approximation accuracy between the kNN prediction model and the BP neural network model.
As displayed in Figure 8, the relative approximation accuracy of the neural network control model reaches 90% only at currents between 0.42 and 0.70 A, is relatively low at other current ranges. In contrast, the relative approximation accuracy of the kNN prediction model was more than 90% at currents within the test range, which is also consistent with the results of the kNN prediction model in Figure 7. The evaluation index can illustrate the approximation accuracy of the two control models at varying test currents well and reveals the superiority in the accuracy of the kNN prediction model over the neural network control model.
Furthermore, the prediction effect of the two models is not particularly ideal when the current is large, as shown in Figure 8. The approximation accuracy of the kNN control model fluctuates slightly, while that of the neural network control model decreases gradually. This is mainly caused by the reduced increase of the damping force as the current increases and the magnetorheological fluid reaches magnetic saturation. This intensive phenomenon is also shown in the indication and the speed characteristic diagrams in Figure 2 under the large current load. In this case, the kNN algorithm needs higher classification accuracy to judge. However, for the neural network model, this phenomenon is difficult to classify and identify, which eventually causes the prediction accuracy of the two models to decrease when the current is large.
4. Discussion
Through prediction modeling and results analysis, the prediction of the expected current by the kNN algorithm was regarded as a classification problem which is different to the regression problem in the neural network prediction model. By investigating the advantages of the kNN algorithm in a classification problem, the expected current prediction model of a magnetorheological damper was proposed based on the kNN algorithm. Furthermore, the prediction results of the damping force obtained by the kNN algorithm were compared to a general neural network simulation model of the magnetorheological damper due to its maturity and high prediction accuracy based on the current data. Then, the current prediction results of the neural network model and kNN algorithm were input into the neural network simulation model, to analyze the response of the damping force output to the input prediction current.
4.1. Neural network model prediction
In order to reduce the influence of current variation in the model on the prediction accuracy, data of the damping force and other state parameters corresponding to currents between 0.4 and 0.7 A were selected to train the current prediction model of the neural network. The predicted current value was then substituted into the positive model of the neural network, and the predicted results of the output damping force are shown in Figure 9.

Simulation results of the neural network control system.
Figure 9 shows that the expected damping force rises as the current increases. Even in the middle region where the predictions of the neural network are relatively accurate, the gaps between the predicted damping force and the expected damping force are still significant. This large error is mainly due to the large gap between the current predicted by the neural network model and the actual current value, which also increases the gap between the damping force predicted by the positive model and the expected damping force. However, in all test samples, no cases of a wrong directional judgment of damping force were observed, demonstrating that the established neural network positive model can identify the direction of the damping force with high accuracy.
4.2. kNN model prediction
All the current values predicted by the kNN algorithm were input into the neural network positive model, and the corresponding neural network positive model was also matched according to the predicted current. The prediction results obtained by inputting the data into the trained positive model are shown in Figure 10.

Simulation results of kNN control system.
Based on the simulation results, the output controlled damping force predicted by the kNN algorithm appears to be very close to the ideal damping force. Table 1 compares the simulation results of eight samples whose actual current values are deviated from the predicted current values. Among them, the deviation between the predicted current value and the actual current value obtained by the kNN algorithm was minimal, and thus the deviation between the prediction force and the ideal damping force following input into the neural network model remains relatively small. As shown in Table 1, the relative error between the actual controlled damping force and the expected output damping force of the damper is no more than 7%, which is acceptable in general engineering applications. In fact, when the excitation current of the magnetorheological damper was large, the damping force of the magnetorheological damper rose by a smaller amount as the current was increased further, that is, the damping force of the magnetorheological damper was less sensitive to changes in current. Therefore, although the target and the current values predicted by the kNN algorithm in the vast current region contain some errors, the results are not sensitive to the variation in damping force output by the damper.
Simulation results of samples exhibiting a deviation between the actual current value and the predicted current value.
The kNN algorithm requires all training sets to be called at each iteration for the distance to be calculated. As such, large training data sets and data dimensions will result in the significant consumption of computational resources. Additionally, the kNN algorithm cannot give any specific information on the data infrastructure, and thus there is no way to know the characteristics of the average example sample and the typical example sample. This problem is the shortcoming of the kNN algorithm.
5. Conclusion
In the prediction and control for a magnetorheological damping system, the prediction from state parameters data to control current has always been a challenge to overcome in closed-loop control of a magnetorheological damper. In this paper, a data-driven prediction model of the expected control current of a magnetorheological damper was constructed based on the kNN algorithm by considering the characteristics and advantages of machine learning algorithms. A BP neural network with a high damping force prediction accuracy was also used to establish a simulation test model of the magnetorheological damper, which was used to test the performance of the constructed kNN algorithm in predicting the expected current. In the study, the expected current prediction model constructed with the kNN algorithm presents several advantages:
Compared with the neural network, the kNN algorithm operates on a more straightforward principle and with fewer input variables. The system requires only a few parameters during construction, and benefits from a short total duration from training to testing and a fast system response.
Compared with the current neural network prediction model, the expected current prediction model based on the kNN algorithm has a higher approximation accuracy with a consistent overall prediction accuracy, which meets the requirements of general engineering applications.
This work proves that the use of the classification algorithm is feasible to predict the expected current for the closed-loop control of a magnetorheological damping system. Although the kNN algorithm still needs to be optimized and improved in terms of prediction accuracy, this method solves the problem that the neural network algorithm has been too cumbersome and unsolvable in the current reverse prediction. Additionally, the results of this work also serve as a basis for further investigation into other classification algorithms to predict the expected control current.
Footnotes
Acknowledgements
The authors would like to thank the Dynamics Laboratory in College of Mechanical Engineering, Donghua University, for providing the experimental support for the research.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was funded by the Natural Science Foundation of Shanghai, grant number 20ZR1401300.
