Control Method of Cold and Hot Shock Test of Sensors in Medium

In order to meet the latest requirements for sensor quality test in the industry, the sample sensor needs to be placed in the medium for the cold and hot shock test. However, the existing environmental test chamber cannot effectively control the temperature of the sample in the medium. This paper designs a control method based on the support vector machine (SVM) classification algorithm and K-means clustering combined with neural network correction. When testing sensors in a medium, the clustering SVM classification algorithm is used to distribute the control voltage corresponding to temperature conditions. At the same time, the neural network is used to constantly correct the temperature to reduce overshoot during the temperature-holding phase. Eventually, overheating or overcooling of the basket space indirectly controls the rapid rise or decrease in the temperature of the sensor in the medium. The test results show that this method can effectively control the temperature of the sensor in the medium to reach the target temperature within 15 min and stabilize when the target temperature is between 145 °C and −40 °C. The steady-state error is less than 0.31 °C in the high-temperature area and less than 0.39 °C in the low-temperature area, which well solves the dilemma of the current cold and hot shock test.


Introduction
Cold and hot shock test is a modern testing method that uses high-and low-temperature cycles to test the quality of sensors. In general, it can be tested directly in high-and lowtemperature environment test chambers. The cold and hot shock test of the sensor in the medium is different from the direct cold and hot shock test. Due to the complexity and particularity of the medium, the sensor placed in it will lead to the characteristics of large inertia and time lag in the whole temperature control process. As shown in Figure 1, a complete hot and cold shock test is divided into high temperature for 30 min and low temperature for 30 min. The sample temperature needs to be kept at the target temperature for more than 15 min in each area. We chose the test standards of 145 • C and −40 • C, which are the most commonly used test standards for engine sensors. We can obviously find that the temperature of the chamber space increases rapidly in a very short time, but the temperature of the measured sensor cannot reach the target temperature in 30 min, showing a great lag. This phenomenon also occurs in low-temperature tests. The cold and hot shock test of the sensor in the medium using environmental test chamber is an important problem to be solved urgently in the current testing field. For example, the engine sensor needs to work in the oil medium, and the traditional hot and cold shock test often leads to problems with the produced engine sensor under long-term operation. Today, with the rapid development of intelligent driving, every sensor in the car may affect the safety of passengers. Therefore, we must simulate the working environment of the more realistically. This effective solution not only improves the current level but also reduces the production cost, ensuring better safety for pro As the control of cold and hot shock test of sensors in the medium in the current testing field, there is no previous related research in the w to the analysis of its characteristics, its main purpose is to solve temperat lems by lag, nonlinearity and large inertia. For different control objects, control scheme shows a strong diversity [1][2][3][4][5][6]. Zhou et al. [7] used the Kalgorithm to cluster temperature measuring points in different location selection of machine tool temperature measuring points. The method ef the number of measuring points and improves testing efficiency, but effective automatic classification and judgment methods. Wang et al GAPSO-optimized Fuzzy PID controller for electric-driven seeding. Th and PSO to optimize fuzzy control, but the combination of the two met and their membership functions do not seem to be related to environme et al. [9] used a neural network to adjust the PID parameters for solvin temperature control system in a resistance furnace. However, it is diffic set when using neural network in the whole system, and the environme resistance furnace is distinct.
In view of the advantages and disadvantages of the above temperat lems and the particularity of the cold and hot shock test of the sensor ca dium environment [10][11][12], this paper combines the advantages of neura means clustering SVM classification method [13]. We propose to use K-SVM classification method as a whole, which can reflect the distributio difference within this medium environment and distribute different con neural network control is only adopted when the temperature difference As the control of cold and hot shock test of sensors in the medium is a new problem in the current testing field, there is no previous related research in the world. According to the analysis of its characteristics, its main purpose is to solve temperature control problems by lag, nonlinearity and large inertia. For different control objects, the temperature control scheme shows a strong diversity [1][2][3][4][5][6]. Zhou et al. [7] used the K-means clustering algorithm to cluster temperature measuring points in different locations for the optimal selection of machine tool temperature measuring points. The method effectively reduces the number of measuring points and improves testing efficiency, but there is a lack of effective automatic classification and judgment methods. Wang et al. [8] presented a GAPSO-optimized Fuzzy PID controller for electric-driven seeding. They combined GA and PSO to optimize fuzzy control, but the combination of the two methods is not clear, and their membership functions do not seem to be related to environmental changes. Liu et al. [9] used a neural network to adjust the PID parameters for solving the problem of temperature control system in a resistance furnace. However, it is difficult to obtain data set when using neural network in the whole system, and the environmental condition of resistance furnace is distinct.
In view of the advantages and disadvantages of the above temperature control problems and the particularity of the cold and hot shock test of the sensor caused by the medium environment [10][11][12], this paper combines the advantages of neural network and K-means clustering SVM classification method [13]. We propose to use K-means clustering SVM classification method as a whole, which can reflect the distribution of temperature difference within this medium environment and distribute different control signals. The neural network control is only adopted when the temperature difference between the medium temperature and the basket temperature is close. Because the range of temperature difference is small and the data available for adjustment are limited, it is convenient to sort out the artificial data set. The control effect of the network can effectively reduce overshoot and improve the stability of temperature control. The organic combination of these two designs can quickly and stably realize the control process for the cold and hot shock test of the sensor in the medium [14,15].

Test Requirements and Requirements Analysis
The cold and hot shock test of the sensor in the medium not only requires rapid heating or cooling to the target temperature within half an hour but also maintenance of the sensor at the target high or low temperature for more than 15 min to ensure effective testing. However, when the environmental test chamber itself is used to conduct a hot and cold shock test of the sensor in the medium, the temperature of the test chamber reaches the target temperature in a very short time; however, the sensor temperature struggles to reach the target temperature within the specified time. In order to meet the test requirements, when the target high temperature is 145 • C and the low temperature is −40 • C, the environmental test chamber is designed to quickly heat up to far more than 145 • C (Upper limit is 165 • C) in the high temperature area and then cool down. Similarly, reducing the temperature in the low temperature to a level much lower than −40 • C (with a lower limit of −70 • C) allows the temperature of the sensor in the medium to quickly reach and maintain the target temperature within a specified period of time. The ideal temperature curve is shown in Figure 2 below. Since it is not possible to maintain the actual situation at a constant target temperature, a maximum error of ±2 • C can be allowed depending on the circumstances. rs 2023, 23, x FOR PEER REVIEW sensor at the target high or low temperature for more than 15 min to en ing. However, when the environmental test chamber itself is used to cold shock test of the sensor in the medium, the temperature of the tes the target temperature in a very short time; however, the sensor tempe reach the target temperature within the specified time. In order to mee ments, when the target high temperature is 145 °C and the low tempera environmental test chamber is designed to quickly heat up to far more t limit is 165 °C) in the high temperature area and then cool down. Simi temperature in the low temperature to a level much lower than −40 °C ( of −70 °C) allows the temperature of the sensor in the medium to quickl tain the target temperature within a specified period of time. The ideal t is shown in Figure 2 below. Since it is not possible to maintain the ac constant target temperature, a maximum error of ±2 °C can be allowed circumstances.

Test Chamber Structure
The controlled test chamber is divided into two layers: the upp area, and the lower layer is the cold area. As depicted in Figure 3a, th positioned within the medium and enclosed in a box. The internal pla ronmental test chamber will automatically elevate and descend to tra between the high-temperature and low-temperature boxes when nece ment usually occurs every 30 min. As shown in Figure 3b, the rising an is controlled by the control panel of the test chamber. When the tempe maximum limit or encounters other special circumstances, the test cham ning, and the alarm light above it will beep simultaneously. The controll the temperature experienced within the test chamber. Take the hot ar When the received voltage signal is lower than the set value, the temp

Test Chamber Structure
The controlled test chamber is divided into two layers: the upper layer is the hot area, and the lower layer is the cold area. As depicted in Figure 3a, the sample sensor is positioned within the medium and enclosed in a box. The internal platform of the environmental test chamber will automatically elevate and descend to transport the sample between the high-temperature and low-temperature boxes when necessary. This movement usually occurs every 30 min. As shown in Figure 3b, the rising and cooling process is controlled by the control panel of the test chamber. When the temperature exceeds the maximum limit or encounters other special circumstances, the test chamber will stop running, and the alarm light above it will beep simultaneously. The controlled voltage reflects the temperature experienced within the test chamber. Take the hot area as an example. When the received voltage signal is lower than the set value, the temperature of the test chamber is increased. On the contrary, when its value is above the set point, the test chamber stops heating up.

Principle of Control Process
Because the power of the environmental test chamber cannot be directly controlled, the heat conduction characteristic of the temperature is used to control the basket temperature from being overheated or overcooled. This property of temperature indirectly affects the rate at which the sample temperature rises and falls. Take the heating up process a s an example. According to the general idea, we should first control the basket temperature to increase to the limit temperature with the maximum power. Then, we should stop heating at a specific node. Follow these steps to reduce the temperature of the basket to the target temperature. In the temperature holding stage, the temperature of the basket is controlled to increase when the sample temperature is lower than the target temperature. Once the temperature exceeds the target temperature, the basket is controlled to stop heating. The internal temperature field is uniform by using the heat dissipation fins inside and outside the container. The testing temperature can be quickly reached within the allotted time and maintained at a stable level. Finally, the sample temperature should exhibit a curve with minimal fluctuations around the target temperature. Take the process of hightemperature area as an example, the following is a step-by-step process. The process in the low-temperature area is similar.
(1) Space temperature rises rapidly; the sample temperature increases accordingly.
(2) Space temperature reaches the high-temperature limit and maintains; the sample temperature continues to rise. (3) Space temperature gradually drops to the target temperature, while the sample temperature gradually increases to the target temperature. (4) Space temperature oscillates around the target temperature, while the sample temperature remains stable at the target temperature.
This paper aims to adjust the voltage output to the control panel of the test chamber based on the temperature information from two groups of sensors input into the temperature control system [16]. As shown in Figure 4, the output signal of the control system is used to simulate the temperature signal received by the test chamber. Finally, the temperature of the medium and sensor is controlled and stabilized at the target value by the test chamber. In general, the output voltage of our control system only affects the control panel. These control voltages represent the values displayed on the control panel. When these values are significantly lower than the target temperature, the heating power of the test chamber is higher. When these values are close to the target temperature, the test chamber

Principle of Control Process
Because the power of the environmental test chamber cannot be directly controlled, the heat conduction characteristic of the temperature is used to control the basket temperature from being overheated or overcooled. This property of temperature indirectly affects the rate at which the sample temperature rises and falls. Take the heating up process a s an example. According to the general idea, we should first control the basket temperature to increase to the limit temperature with the maximum power. Then, we should stop heating at a specific node. Follow these steps to reduce the temperature of the basket to the target temperature. In the temperature holding stage, the temperature of the basket is controlled to increase when the sample temperature is lower than the target temperature. Once the temperature exceeds the target temperature, the basket is controlled to stop heating. The internal temperature field is uniform by using the heat dissipation fins inside and outside the container. The testing temperature can be quickly reached within the allotted time and maintained at a stable level. Finally, the sample temperature should exhibit a curve with minimal fluctuations around the target temperature. Take the process of high-temperature area as an example, the following is a step-by-step process. The process in the low-temperature area is similar.
(1) Space temperature rises rapidly; the sample temperature increases accordingly.
(2) Space temperature reaches the high-temperature limit and maintains; the sample temperature continues to rise. (3) Space temperature gradually drops to the target temperature, while the sample temperature gradually increases to the target temperature. (4) Space temperature oscillates around the target temperature, while the sample temperature remains stable at the target temperature.
This paper aims to adjust the voltage output to the control panel of the test chamber based on the temperature information from two groups of sensors input into the temperature control system [16]. As shown in Figure 4, the output signal of the control system is used to simulate the temperature signal received by the test chamber. Finally, the temperature of the medium and sensor is controlled and stabilized at the target value by the test chamber. In general, the output voltage of our control system only affects the control panel. These control voltages represent the values displayed on the control panel. When these values are significantly lower than the target temperature, the heating power of the test chamber is higher. When these values are close to the target temperature, the test

Control Method
According to the design logic, if there is a significant temperature difference between the sensor in the medium and the temperature in the basket, the rate of temperature rise and drop should be accelerated. When the temperature difference is small, the increase or decrease in temperature should be minimized or halted. However, it is impossible to select the appropriate node adjustment based solely on experience. Furthermore, there is no accurate expert guidance available to make the choice [17,18]. If a continuous and nonlinear method, such as a neural network, is used to adjust each output voltage, we find that these adjustments are unnecessary during the stage of drastic temperature changes. For example, when the temperature is at that level, the difference between 2 V and 2.5 V is barely noticeable on the temperature curve. We studied the cause of this phenomenon and finally found that when the output voltage values represent lower display values, it means that these values are far from the target temperature. Currently, the control system of the test chamber itself does not deem it necessary to adjust the power. Another important reason is that when the temperature difference is large enough, the small voltage change is insufficient to significantly increase the slope of the curve. Therefore, in order to divide the temperature difference data more effectively and clearly, the clustering algorithm is

Control Method
According to the design logic, if there is a significant temperature difference between the sensor in the medium and the temperature in the basket, the rate of temperature rise and drop should be accelerated. When the temperature difference is small, the increase or decrease in temperature should be minimized or halted. However, it is impossible to select the appropriate node adjustment based solely on experience. Furthermore, there is no accurate expert guidance available to make the choice [17,18]. If a continuous and nonlinear method, such as a neural network, is used to adjust each output voltage, we find that these adjustments are unnecessary during the stage of drastic temperature changes. For example, when the temperature is at that level, the difference between 2 V and 2.5 V is barely noticeable on the temperature curve. We studied the cause of this phenomenon and finally found that when the output voltage values represent lower display values, it means that these values are far from the target temperature. Currently, the control system of the test chamber itself does not deem it necessary to adjust the power. Another important reason is that when the temperature difference is large enough, the small voltage change is insufficient to significantly increase the slope of the curve. Therefore, in order to divide the temperature difference data more effectively and clearly, the clustering algorithm is selected to separate the data into rising and cooling processes every time the medium condition changes. According to the characteristics of the input data for this system: the sample complexity is low, the human experience is clear, and the data set has minimal noise. The K-means cluster analysis method [19] is chosen to analyze the cold and hot shock tests data of the test chamber. The appropriate evaluation scheme is selected to obtain the optimal data classification scheme. Based on the clustering results, the support vector machine (SVM) [20] is used to classify and assign the control voltage to each classification. If the neural network is used to solve the classification problem, the data set is still based on the SVM classification. Adopting the method of neural network is obviously superfluous. The value of the control voltage is determined by the self-control system of the test chamber.

K-Means Clustering
K-means is a classical and efficient unsupervised learning method that can divide the sample set into K clusters based on the distance between the sample data. In this way, the points within the cluster are connected as closely as possible, while maximizing the distance between clusters. It is characterized by high cohesion and low coupling. When expressed by the formula, the cluster is divided into (C 1 ,C 2 ,...C k ). Currently, we need to find K centroids to minimize the squared error E. The smaller E is, the higher the similarity within the same cluster. The expression of E is shown in Equation (1).
µ i is the mean vector expression of the cluster C i , as shown in Formula (2), represents the centroid as well.
Since K initial centroids need to be selected at the beginning of the algorithm, the selection of initial centroids in the K-means-based clustering method is completely random. If each clustering result is based on a different centroid, it becomes impossible to evaluate whether the centroid or the change of K value affects the clustering effect after the change in K value. So, it is necessary to obtain the centroid using the same method in order to compare the effect of different K values. The K-means++ algorithm is used to optimize the random initialization of centroids. The main idea of K-means++ [21] clustering is to select a randomly chosen point µ 1 from the input dataset as the initial clustering center. For each point x i in the dataset: (1) Calculate the distance between it and the nearest clustering center in the selected cluster center, as shown in Formula (3). (2) Select a new data point as the new clustering center, and the point with a larger D(x) value is more likely to be chosen as the clustering center. (3) Repeat the above steps until K cluster centroids are selected.
These K centroids are used as initialization centroids for the K-means algorithm. A set of rising and cooling data with a target high temperature of 145 • C and a low-temperature of −40 • C is selected for cluster analysis. The cases of K = 6 and K = 7 are shown in Figures 5 and 6 below. Because the temperature difference data is one-dimensional, it is represented as a line on the graph. Therefore, in order to improve clustering and visualization, the two-end temperature difference data is used to enhance the dimension. After performing PCA, normalization, and dimensionality reduction, the following scatter plot is generated.  The Gap Statistic (GS) method [22] is used to evaluate the clustering r ferent K values and select the best clustering results. The GS method was f by Tibshirani to solve the problem of determining the optimal number of main idea is to describe the difference between the observed value of the sa expected value under a reference distribution using gap statistics. Obtain distance between the sample points in Formula (4) and the expected value form distribution in Formula (5) to determine the optimal maximum K valu Because the Gap value does not have control significance when the nu ters is less than or equal to two, it is calculated for more than three clusters  The Gap Statistic (GS) method [22] is used to evaluate the clustering r ferent K values and select the best clustering results. The GS method was f by Tibshirani to solve the problem of determining the optimal number of main idea is to describe the difference between the observed value of the sa expected value under a reference distribution using gap statistics. Obtain distance between the sample points in Formula (4) and the expected value form distribution in Formula (5) to determine the optimal maximum K valu Because the Gap value does not have control significance when the nu ters is less than or equal to two, it is calculated for more than three clusters Figure 7 below, K = 7 has the highest Gap value, indicating that seven is s The Gap Statistic (GS) method [22] is used to evaluate the clustering results for different K values and select the best clustering results. The GS method was first proposed by Tibshirani to solve the problem of determining the optimal number of clusters. The main idea is to describe the difference between the observed value of the sample and the expected value under a reference distribution using gap statistics. Obtain the Euclidean distance between the sample points in Formula (4) and the expected value under a uniform distribution in Formula (5) to determine the optimal maximum K value.
Because the Gap value does not have control significance when the number of clusters is less than or equal to two, it is calculated for more than three clusters. As shown in Figure 7 below, K = 7 has the highest Gap value, indicating that seven is selected as the optimal clustering result.

SVM Control Voltage Classification
After completing the clustering of the data and selecting the optimal cl scheme, it is also necessary to effectively differentiate between each cluster in achieve a more accurate mapping between input and output. At the same time, s small voltage difference cannot significantly affect the slope of the heating curve arrange three different voltages during the heating stage based on the clustering Therefore, controlling the cold and hot shock test of the sensor in the medium can sidered a classification problem. The entire process can be controlled by classifyin ent voltage values based on varying temperature differences. Support Vector M (SVM) is a highly effective tool for addressing small sample, nonlinear classificatio lems. Because the temperature difference data is linearly separable, it is easier to SVM method to classify the clustering results. Some points do not appear to be segmented when extended to two-dimensional space, but the nature of the origi is linearly separable. So, we can still simplify the problem to a linearly separa without adding nonlinear kernel functions. The core idea of SVM is to find a hyp that can separate different types of data with maximum intervals, thereby achie purpose of classification [23]. In the case of linear inseparability, the kernel func also be introduced to transform the problem into a linear classification problem in dimensional feature space. Because the processed temperature difference data is imately linearly separable, the problem of finding the maximum hyperplane ca rectly transformed into a convex quadratic programming problem with inequa straints. As shown in Formula (6), where is the weight vector, is the train taset, and b is the scalar.
By solving the quadratic programming problem, the values of and b ca tained as shown in Equation (7). The corresponding class mark value y is which represents the positive or negative of the classification. It can also be expr the form of Lagrangian duality, as shown in Formula (8).

SVM Control Voltage Classification
After completing the clustering of the data and selecting the optimal clustering scheme, it is also necessary to effectively differentiate between each cluster in order to achieve a more accurate mapping between input and output. At the same time, since the small voltage difference cannot significantly affect the slope of the heating curve, we can arrange three different voltages during the heating stage based on the clustering results. Therefore, controlling the cold and hot shock test of the sensor in the medium can be considered a classification problem. The entire process can be controlled by classifying different voltage values based on varying temperature differences. Support Vector Machine (SVM) is a highly effective tool for addressing small sample, nonlinear classification problems. Because the temperature difference data is linearly separable, it is easier to use the SVM method to classify the clustering results. Some points do not appear to be linearly segmented when extended to two-dimensional space, but the nature of the original data is linearly separable. So, we can still simplify the problem to a linearly separable case without adding nonlinear kernel functions. The core idea of SVM is to find a hyperplane that can separate different types of data with maximum intervals, thereby achieving the purpose of classification [23]. In the case of linear inseparability, the kernel function can also be introduced to transform the problem into a linear classification problem in a high-dimensional feature space. Because the processed temperature difference data is approximately linearly separable, the problem of finding the maximum hyperplane can be directly transformed into a convex quadratic programming problem with inequality constraints. As shown in Formula (6), where W is the weight vector, X is the training dataset, and b is the scalar.
By solving the quadratic programming problem, the values of W and b can be obtained as shown in Equation (7). The corresponding class mark X i value y j is 1 or −1, which represents the positive or negative of the classification. It can also be expressed in the form of Lagrangian duality, as shown in Formula (8). In this paper, the training and prediction process of the SVM model is implemented using the LIBSVM toolbox in Matlab. Because it is a linearly separable case, the penalty factor C is set to 0, and the kernel function adopts a linear kernel as shown in Formula (9).
SVM was originally designed to solve the two-classification problems. In order to solve this multi-classification problem, we need to design and use multiple classifiers for classification [24]. The commonly used multi-classification schemes are the classical one-to-many and one-to-one schemes. The one-to-many (one-against-all) method takes one category as the positive class and the other categories as the negative class. The classifier is then constructed in turn, and finally, the samples are classified into multiple categories. On the other hand, the one-to-one (one-against-one) approach requires the construction of k (k − 1)/2 classifiers [25]. However, the accuracy does not show significant improvement in the case of existing clustering. Therefore, one-to-many scheme is adopted for designing the classifier. The visualization of the case classification when selecting K = 7 is shown in Figure 8 below.
SVM was originally designed to solve the two-classification problems. In order to solve this multi-classification problem, we need to design and use multiple classifiers for classification [24]. The commonly used multi-classification schemes are the classical oneto-many and one-to-one schemes. The one-to-many (one-against-all) method takes one category as the positive class and the other categories as the negative class. The classifier is then constructed in turn, and finally, the samples are classified into multiple categories. On the other hand, the one-to-one (one-against-one) approach requires the construction of k (k − 1)/2 classifiers [25]. However, the accuracy does not show significant improvement in the case of existing clustering. Therefore, one-to-many scheme is adopted for designing the classifier. The visualization of the case classification when selecting K = 7 is shown in Figure 8 below. A positive voltage value indicates that the sample is in a high-temperature area, while a negative voltage value indicates that the sample is in a low-temperature area. The switching between them depends on the relay module shown in Figure 4. The distribution voltage of each stage is determined based on the temperature difference data, as shown in Table 1 below. Select 2593 sets of data as the training set and 1109 groups as the test set. When dividing the test set data for regression testing of SVM's 7 classification [26], the accuracy is 96.1296% after 500 iterations. As shown in Figure 9 below, because the classification cannot completely separate each cluster, there are some outliers. The presence of these outliers can lead to abrupt fluctuations in the output voltage, which is detrimental to the control system's reliability and can result in hardware damage. Therefore, the Kalman filter module is added in the software design to filter the signal and produce an output. This effectively prevents sudden changes in the signal [27]. The positive voltage value cannot appear in the low-temperature area, and the negative voltage value cannot appear in the high-temperature area either. Otherwise, it will cause test interruption and trigger the equipment's alarm. Therefore, in order to ensure the long-term stable operation of the equipment, a voltage limiting filter is designed at the output to ensure that each output voltage complies with the current equipment's specifications. A positive voltage value indicates that the sample is in a high-temperature area, while a negative voltage value indicates that the sample is in a low-temperature area. The switching between them depends on the relay module shown in Figure 4. The distribution voltage of each stage is determined based on the temperature difference data, as shown in Table 1 below. Select 2593 sets of data as the training set and 1109 groups as the test set. When dividing the test set data for regression testing of SVM's 7 classification [26], the accuracy is 96.1296% after 500 iterations. As shown in Figure 9 below, because the classification cannot completely separate each cluster, there are some outliers. The presence of these outliers can lead to abrupt fluctuations in the output voltage, which is detrimental to the control system's reliability and can result in hardware damage. Therefore, the Kalman filter module is added in the software design to filter the signal and produce an output. This effectively prevents sudden changes in the signal [27]. The positive voltage value cannot appear in the low-temperature area, and the negative voltage value cannot appear in the high-temperature area either. Otherwise, it will cause test interruption and trigger the equipment's alarm. Therefore, in order to ensure the long-term stable operation of the equipment, a voltage limiting filter is designed at the output to ensure that each output voltage complies with the current equipment's specifications.

Back Propagation Neural Network
The control effect of using only the SVM classification method based on cluster analysis essentially fulfills the condition of not exceeding an overshoot of ±2 °C in the test environment. However, it is easy to exceed the limit when the medium environment changes. In order to ensure that the system meets the test requirements within a specific range of environmental changes, it is necessary to minimize the overshoot as much as possible.
In the actual testing process, it has been observed that during the temperature holding stage, following a simple logic of heating up when the temperature is lower than the target temperature value and stopping heating when it is higher than the target temperature value results in a significant overshoot because the medium causes a large inertia of heat transfer in the system. The fine-tuning process of adjusting temperature, whether increasing or decreasing, has a significant delay. Therefore, simply dividing the temperature holding stage into linear divisions is insufficient to achieve optimal control. At this stage, unlike the previous stage with a large temperature difference, the rate of temperature difference change in the container space remains stable at a small value below 0.1 °C /s. The change in the control voltage can effectively influence the temperature change rate of the sample in order to solve this problem, considering the strong fitting ability of neural network for nonlinear functions. Consider the Back Propagation (BP) neural network, specifically the back propagation neural network, to solve the control problem during the temperature holding phase [28].
BP neural network is a classical feedforward neural network that uses a backpropagation method to update weights. It includes an input layer, a hidden layer, and an output layer. The neurons between layers adopt a fully connected structure, which propagate forward using randomly initialized weights. The network backpropagates and updates weights according to the difference between the output value and the expected value in order to achieve self-learning. In theory, a neural network can approximate any nonlinear function. Therefore, by training the network's parameters with high-quality data sets, it can effectively solve the problem of temperature retention phase. The structure of the BP neural network is shown in Figure 10 below. The target high temperature is 145 °C and the low temperature is −40 °C. The input layer E is calculated as the difference between temperature signal TS from the basket sensor and the temperature signal Tc from the sensor. Additionally, EC represents the temperature difference change rate, as shown in Formula (10).

Back Propagation Neural Network
The control effect of using only the SVM classification method based on cluster analysis essentially fulfills the condition of not exceeding an overshoot of ±2 • C in the test environment. However, it is easy to exceed the limit when the medium environment changes. In order to ensure that the system meets the test requirements within a specific range of environmental changes, it is necessary to minimize the overshoot as much as possible.
In the actual testing process, it has been observed that during the temperature holding stage, following a simple logic of heating up when the temperature is lower than the target temperature value and stopping heating when it is higher than the target temperature value results in a significant overshoot because the medium causes a large inertia of heat transfer in the system. The fine-tuning process of adjusting temperature, whether increasing or decreasing, has a significant delay. Therefore, simply dividing the temperature holding stage into linear divisions is insufficient to achieve optimal control. At this stage, unlike the previous stage with a large temperature difference, the rate of temperature difference change in the container space remains stable at a small value below 0.1 • C/s. The change in the control voltage can effectively influence the temperature change rate of the sample in order to solve this problem, considering the strong fitting ability of neural network for nonlinear functions. Consider the Back Propagation (BP) neural network, specifically the back propagation neural network, to solve the control problem during the temperature holding phase [28].
BP neural network is a classical feedforward neural network that uses a backpropagation method to update weights. It includes an input layer, a hidden layer, and an output layer. The neurons between layers adopt a fully connected structure, which propagate forward using randomly initialized weights. The network backpropagates and updates weights according to the difference between the output value and the expected value in order to achieve self-learning. In theory, a neural network can approximate any nonlinear function. Therefore, by training the network's parameters with high-quality data sets, it can effectively solve the problem of temperature retention phase. The structure of the BP neural network is shown in Figure 10 below. The target high temperature is 145 • C and the low temperature is −40 • C. The input layer E is calculated as the difference between temperature signal T S from the basket sensor and the temperature signal Tc from the sensor. Additionally, E C represents the temperature difference change rate, as shown in Formula (10). (10) input variables, the effect of the system cannot be maintained when the target tem and medium environment change. The model consists of a single hidden laye output is represented by voltage U. A full connection structure is adopted betwe and the weight updating mode is backpropagation [29]. The data set used in the training is modified based on the initial data genera SVM classification control. The key point of overshoot occurs just after the rising ing phase. The basket temperature always fluctuates, ranging from temperatu higher than the target temperature (in the high-temperature area) to temperatu lower than the target temperature (in the low-temperature area). Therefore, the of input and output data can be adjusted approximately based on the overshoo ing to the actual test, the basket needs to be cooled by 5 °C beforehand if the hig ature area is adjusted by more than 2 °C. If there is a 2 °C overshoot in the low-tem area, it is necessary to increase the temperature of the basket by 10 °C ahead of Based on the above experience, when the target temperature is 145 °C and −40 ° olds of 140 °C and −30 °C are set to switch between SVM classification control neural network control mode, respectively.
Because the need for neural network accuracy is higher than the predicti more hidden layer neurons are selected. At the same time, it is necessary to m fective control over the medium environment while allowing for a certain change. Therefore, the network should retain a certain level of generalization a mean square error (MSE) in Formula (11) and the mean absolute error (MAE) in (12) are used to measure the performance of the network [30]. MSE measures the of the output results. The smaller the MSE, the smaller the error [31,32]. M measures the average magnitude of the prediction error.
After 1000 iterations, the learning rate is 0.02, and there are 1136 sets of output data for training. Use Mean Squared Error (MSE) as the loss function. decreases as the number of iterations increases, as shown in Figure 11. E C contains more comprehensive information, and even if the medium environment changes greatly, we can receive timely feedback through E C . If only T S and T C are used as input variables, the effect of the system cannot be maintained when the target temperature and medium environment change. The model consists of a single hidden layer, and the output is represented by voltage U. A full connection structure is adopted between layers, and the weight updating mode is backpropagation [29].
The data set used in the training is modified based on the initial data generated using SVM classification control. The key point of overshoot occurs just after the rising and cooling phase. The basket temperature always fluctuates, ranging from temperatures much higher than the target temperature (in the high-temperature area) to temperatures much lower than the target temperature (in the low-temperature area). Therefore, the mapping of input and output data can be adjusted approximately based on the overshoot. According to the actual test, the basket needs to be cooled by 5 • C beforehand if the high-temperature area is adjusted by more than 2 • C. If there is a 2 • C overshoot in the low-temperature area, it is necessary to increase the temperature of the basket by 10 • C ahead of schedule. Based on the above experience, when the target temperature is 145 • C and −40 • C, thresholds of 140 • C and −30 • C are set to switch between SVM classification control mode and neural network control mode, respectively.
Because the need for neural network accuracy is higher than the prediction ability, more hidden layer neurons are selected. At the same time, it is necessary to maintain effective control over the medium environment while allowing for a certain degree of change. Therefore, the network should retain a certain level of generalization ability. The mean square error (MSE) in Formula (11) and the mean absolute error (MAE) in Formula (12) are used to measure the performance of the network [30]. MSE measures the accuracy of the output results. The smaller the MSE, the smaller the error [31,32]. MAE only measures the average magnitude of the prediction error.
After 1000 iterations, the learning rate is 0.02, and there are 1136 sets of input and output data for training. Use Mean Squared Error (MSE) as the loss function. The error decreases as the number of iterations increases, as shown in Figure 11. Sensors 2023, 23, x FOR PEER REVIEW 12 of 19 Figure 11. Error with iterations.
Selecting 300 groups as the test set, the performance evaluation indicators are shown in Table 2 below. The predicted output voltage is essentially consistent with the actual voltage. In order to show the process of neural network adjustment more clearly, several pieces of data were extracted from continuous data sets, as shown in Table 3 below. In the table, the target high temperature is 145 °C and the low temperature is −40 °C.

Overview of Control Methods
To better demonstrate the application of these methods, step-by-step explanations are provided below.
(1) Obtain raw data sets based on experience and experiments. Selecting 300 groups as the test set, the performance evaluation indicators are shown in Table 2 below. The predicted output voltage is essentially consistent with the actual voltage. In order to show the process of neural network adjustment more clearly, several pieces of data were extracted from continuous data sets, as shown in Table 3 below. In the table, the target high temperature is 145 • C and the low temperature is −40 • C.

Overview of Control Methods
To better demonstrate the application of these methods, step-by-step explanations are provided below.
(1) Obtain raw data sets based on experience and experiments.
(2) Use a clustering algorithm to evaluate and obtain the optimal clustering after data preprocessing. (3) Classify the output voltage using SVM and determine the corresponding voltage value through experimentation.
(4) Accurately adjust the data of temperature holding phase on the basis of existing data. Use this data to train the neural network. (5) Conduct experiments and set up appropriate nodes to effectively integrate the two methods. Repeat experiments to verify the stability and effectiveness of the method.

Temperature Compensation
Due to the change of ambient temperature from −50 • C to 170 • C, the characteristics of the sensitive elements in the Pt100 temperature sensor vary with temperature. However, the resistance and capacitance of the signal processing circuit are not significantly affected. If the transmitted signal is not processed, it will affect the control accuracy [33,34]. It is difficult to meet the precision requirements simply by adding hardware compensation to the sensor. The temperature compensation module is used to compensate for temperature variations in the temperature control system. In the software design, the temperature compensation value primarily affects the input signal. The algorithm's input will change accordingly with the change in the compensation value, thus affecting the output voltage value.
After conducting actual debugging, it was found that the influence of the compensation value on the system follows a normal distribution, with the maximum value occurring at −2. It is designed as an external adjustable parameter that allows testers to modify the compensation value during the actual test.

Experiments
The current running status panel of the system is shown in Figure 12. The main part of the program is written using LabVIEW software [35,36]. The design of the front panel is displayed with a graphical interface to facilitate the operation and adjustment of field personnel. After clicking to run the system, the test parameter setting interface will pop up first. Secondly, fill in the upper and lower limits of the high and low temperatures according to the test requirements. Thirdly, set the temperature and temperature compensation. Finally, click the OK button to exit the parameter setting interface and enter the main interface of the control system.
(2) Use a clustering algorithm to evaluate and obtain the optimal clustering after data preprocessing. (3) Classify the output voltage using SVM and determine the corresponding voltage value through experimentation. (4) Accurately adjust the data of temperature holding phase on the basis of existing data.
Use this data to train the neural network. (5) Conduct experiments and set up appropriate nodes to effectively integrate the two methods. Repeat experiments to verify the stability and effectiveness of the method.

Temperature Compensation
Due to the change of ambient temperature from −50 °C to 170 °C , the characteristics of the sensitive elements in the Pt100 temperature sensor vary with temperature. However, the resistance and capacitance of the signal processing circuit are not significantly affected. If the transmitted signal is not processed, it will affect the control accuracy [33,34]. It is difficult to meet the precision requirements simply by adding hardware compensation to the sensor. The temperature compensation module is used to compensate for temperature variations in the temperature control system. In the software design, the temperature compensation value primarily affects the input signal. The algorithm's input will change accordingly with the change in the compensation value, thus affecting the output voltage value.
After conducting actual debugging, it was found that the influence of the compensation value on the system follows a normal distribution, with the maximum value occurring at −2. It is designed as an external adjustable parameter that allows testers to modify the compensation value during the actual test.

Experiments
The current running status panel of the system is shown in Figure 12. The main part of the program is written using LabVIEW software [35,36]. The design of the front panel is displayed with a graphical interface to facilitate the operation and adjustment of field personnel. After clicking to run the system, the test parameter setting interface will pop up first. Secondly, fill in the upper and lower limits of the high and low temperatures according to the test requirements. Thirdly, set the temperature and temperature compensation. Finally, click the OK button to exit the parameter setting interface and enter the main interface of the control system.  Set the target high temperature to 145 • C and the target low temperature to −40 • C for system testing. At the beginning of the test, two containers with a fixed position were used, and the internal volume of each container was filled with 300 mL of oil medium liquid. As shown in Figure 13, without any external intervention in the environmental test chamber, the sample temperature gradually increases for 28 min to reach the target high temperature of 145 • C. However, the target low temperature of −40 • C cannot even be achieved at all. The test results fall far short of the required temperature maintenance at the target temperature for 15 min.
Set the target high temperature to 145 °C and the target low temperature to −40 °C for system testing. At the beginning of the test, two containers with a fixed position were used, and the internal volume of each container was filled with 300 mL of oil medium liquid. As shown in Figure 13, without any external intervention in the environmental test chamber, the sample temperature gradually increases for 28 min to reach the target high temperature of 145 °C . However, the target low temperature of −40 °C cannot even be achieved at all. The test results fall far short of the required temperature maintenance at the target temperature for 15 min. After implementing the SVM control method, which is based on K-means and involves properly adjusting the control voltage, the container holding the medium is positioned as depicted in Figure 14a. When starting the test, the basket temperature increases rapidly to 165 °C. It is important to note that for the long-term use of the equipment, the high temperature should not exceed 165 °C at the high end and should not go below −70°C at the low end. This temperature range has an impact on the rapid increase in the sample temperature. After reaching a certain point, the basket temperature starts to decrease. Finally, the temperature of both areas is around 145 °C , and the low-temperature area is also maintained at −40 °C . However, primarily due to the disparity in heat transfer rates between low and high temperatures, the control accuracy and speed in low temperature are lower than those in high temperature. As shown in Figure 14b, the target holding time at high temperature is 18 min and 27 s, while at low temperature it is 15 min and 16 s, which meets the test requirements satisfactorily. After implementing the SVM control method, which is based on K-means and involves properly adjusting the control voltage, the container holding the medium is positioned as depicted in Figure 14a. When starting the test, the basket temperature increases rapidly to 165 • C. It is important to note that for the long-term use of the equipment, the high temperature should not exceed 165 • C at the high end and should not go below −70 • C at the low end. This temperature range has an impact on the rapid increase in the sample temperature. After reaching a certain point, the basket temperature starts to decrease. Finally, the temperature of both areas is around 145 • C, and the low-temperature area is also maintained at −40 • C. chamber, the sample temperature gradually increases for 28 min to reach the target high temperature of 145 °C . However, the target low temperature of −40 °C cannot even be achieved at all. The test results fall far short of the required temperature maintenance at the target temperature for 15 min. After implementing the SVM control method, which is based on K-means and involves properly adjusting the control voltage, the container holding the medium is positioned as depicted in Figure 14a. When starting the test, the basket temperature increases rapidly to 165 °C. It is important to note that for the long-term use of the equipment, the high temperature should not exceed 165 °C at the high end and should not go below −70°C at the low end. This temperature range has an impact on the rapid increase in the sample temperature. After reaching a certain point, the basket temperature starts to decrease. Finally, the temperature of both areas is around 145 °C , and the low-temperature area is also maintained at −40 °C . However, primarily due to the disparity in heat transfer rates between low and high temperatures, the control accuracy and speed in low temperature are lower than those in high temperature. As shown in Figure 14b, the target holding time at high temperature is 18 min and 27 s, while at low temperature it is 15 min and 16 s, which meets the test requirements satisfactorily. However, primarily due to the disparity in heat transfer rates between low and high temperatures, the control accuracy and speed in low temperature are lower than those in high temperature. As shown in Figure 14b, the target holding time at high temperature is 18 min and 27 s, while at low temperature it is 15 min and 16 s, which meets the test requirements satisfactorily.
After repositioning the container, two additional boxes of medium liquid, filled with oil and with a capacity of 200 mL, are added to the basket. As shown in Figure 15a below, the heating rate of the medium is affected by changes in position and medium mass. Therefore, it can be observed from the rising and falling curve that the holding time of the basket temperature in the high position increases significantly. As shown in Figure 15b, the target holding time in the high-temperature area is 16 min and 23 s, while in the low-temperature area is 15 min and 11 s. However, the effect is slightly lower than what is depicted in the above figure, which can be attributed to the upper limit of equipment performance. The control effect still meets the testing requirements. After repositioning the container, two additional boxes of medium liquid, filled with oil and with a capacity of 200 mL, are added to the basket. As shown in Figure 15a below, the heating rate of the medium is affected by changes in position and medium mass. Therefore, it can be observed from the rising and falling curve that the holding time of the basket temperature in the high position increases significantly. As shown in Figure 15b, the target holding time in the high-temperature area is 16 min and 23 s, while in the lowtemperature area is 15 min and 11 s. However, the effect is slightly lower than what is depicted in the above figure, which can be attributed to the upper limit of equipment performance. The control effect still meets the testing requirements. Although the test requirement is to control the temperature in the medium at ±2 °C , the SVM control using K-means has essentially met the control requirements. However, in fact, as mentioned above, the uncertain factors of the media cannot be avoided. For example, it is impossible for the tester to consistently position the container in the same place every time, and it is not possible to strictly guarantee that the amount or even the type of medium in the container will be consistent with the experimental environment. Because SVM cannot adjust the output voltage value in detail, the system overshoot is larger, making it easier to exceed the test requirements. It is necessary to minimize the overshoot. After controlling the temperature holding stage of the display state of Figure  14 using a BP neural network, the effect on the high-temperature area is shown in Figure  16a. The overshoot is reduced from 1.65 °C to 0.4 °C. Similarly, in the low-temperature area, the overshoot is reduced from 2.2 °C to 0.3 °C , as shown in Figure 16b. Whether at high or low temperatures, the stability of the system has been significantly improved. Although the test requirement is to control the temperature in the medium at ±2 • C, the SVM control using K-means has essentially met the control requirements. However, in fact, as mentioned above, the uncertain factors of the media cannot be avoided. For example, it is impossible for the tester to consistently position the container in the same place every time, and it is not possible to strictly guarantee that the amount or even the type of medium in the container will be consistent with the experimental environment. Because SVM cannot adjust the output voltage value in detail, the system overshoot is larger, making it easier to exceed the test requirements. It is necessary to minimize the overshoot. After controlling the temperature holding stage of the display state of Figure 14 using a BP neural network, the effect on the high-temperature area is shown in Figure 16a. The overshoot is reduced from 1.65 • C to 0.4 • C. Similarly, in the low-temperature area, the overshoot is reduced from 2.2 • C to 0.3 • C, as shown in Figure 16b. Whether at high or low temperatures, the stability of the system has been significantly improved. Because the sample needs to undergo cyclic impact testing in the medium to assess its quality during cold and hot shock tests, 10 complete impact testing processes are selected. The data for the high-temperature area is presented in Table 4, while the data for Because the sample needs to undergo cyclic impact testing in the medium to assess its quality during cold and hot shock tests, 10 complete impact testing processes are selected. The data for the high-temperature area is presented in Table 4, while the data for the low-temperature area is presented in Table 5. Upon analyzing the data in the tables, it is evident that the steady-state error in the high-temperature region is below 0.31 • C, and in the low-temperature area, it is below 0.39 • C. These results indicate that the cold and hot shock test requirements are satisfactorily met.

Conclusions
(1) This article proposes a control method that combines K-means and SVM with neural network correction. The method is designed to achieve the efficient control of the cold and hot shock testing of the sensor in the medium. On the whole, the system utilizes K-means clustering analysis of temperature data and the SVM method to distribute the control voltage signal. In detail, the output control voltage is fine-tuned by combining it with neural network control during the temperature holding stage. Timely control the temperature changes in the basket space in order to indirectly regulate the temperature of the sample sensors in the medium. With the combination of overall control and detail control, this method is highly effective in ensuring that the sample's temperature in the medium meets the industry's test requirements during the cold and hot shock testing. (2) Combined with the graphical interface of LabVIEW, the entire system effectively enhances the stability and controllability of the current cold and hot shock test. It realizes the effective control of the sensor's temperature in the medium, as well as the display and recording of the test data.
However, the controller does not take all variable factors into account as input and can only maintain the control effect within a certain range of medium. When the environment of the medium changes too much, the control effect will be affected. In the future, the amount and types of more medium will be expanded as the input to the system. Several