Disclosure of Invention
The invention provides a vehicle lithium battery fault early-warning method based on multi-element prediction and anomaly detection, which aims to solve the problems that voltage and temperature two important parameters early-warning faults are single, accuracy is reduced during multi-fault early-warning and long-time early-warning cannot be performed.
In order to realize the technical scheme, the method comprises the following steps:
S1, acquiring operation data of a vehicle battery system through a big data platform;
The vehicle battery system comprises a battery system of a normal vehicle and a vehicle with fault alarm;
the fault types include voltage faults and temperature faults;
the voltage faults comprise overvoltage, undervoltage and too fast voltage change of the battery unit;
the temperature fault comprises that the temperature rises too fast and exceeds a set threshold value;
Collecting operation data of a vehicle battery system, including a vehicle ID, a sampling time, a total battery pack voltage (TV), a Highest Cell Voltage (HCV), a Lowest Cell Voltage (LCV), an SOC, a total current (C), a highest probe temperature (HT) and a lowest probe temperature (LT);
S2, data cleaning is carried out on the collected data, and a data set is generated;
Due to the complex operating conditions, the acquired data needs to be cleaned as necessary;
The data cleaning method comprises the following steps:
(1) The method comprises the steps of filling the missing data of the lost frames smaller than three frames by using linear interpolation, and removing the missing fragments larger than three frames, namely six data in one minute are sampled once every ten seconds, if 1-3 data are lost in the fragments, the fragments are missing, linear interpolation is selected for filling the missing values, and the fragments with the missing values larger than 3 data are directly deleted;
(2) The normal range of the SOC is [200V,500V ], [ -1000A,1000A ], [2V,5V ], [ -40 ℃ and 210 ℃ and [0,100] respectively, and the data exceeding the range are regarded as abnormal acquisition data of the sensor to be removed;
(3) Performing noise reduction processing on all data by using wavelet transformation;
The generation of the data set is that the highest voltage (HCV) of a single body, the Highest Temperature (HT) of a probe is randomly used as the last two columns, the Total Voltage (TV) of a battery pack, the total current (C), the SOC, the lowest voltage (LCV) of the single body, the Lowest Temperature (LT) of the probe and the front five data sequences do not have fixed requirements to form a matrix X with the dimension of [ N,7 ];
The expression is as follows:
the highest voltage of a single battery is selected as a predicted label value Y1, the highest temperature of a probe is selected as a predicted label value Y2, and the expression is as follows:
Wherein N represents the total length of the matrix formed by all data and is equal to the sum of the rows of the matrix of the training set and the test set;
S3, dividing the data set into a training set and a testing set;
Specifically, the normal vehicle data is used as a training set to obtain a training matrix Xtr, the fault vehicle is used as a testing set to obtain a testing matrix Xte, and the training set and the testing set keep the same data form;
Namely, a data matrix formed by the No. 1 normal vehicle and the No. 2 normal vehicle is used as a training set, and a data matrix formed by the No. 3 fault vehicle is used as a test set;
The expression is as follows:
Wherein n represents the total number of rows of the training set matrix;
S4, constructing a prediction model through a training set, wherein the method comprises the following steps:
S4.1, inputting a training set into a TCN model and carrying out causal convolution to extract input features, wherein an output formula of the causal convolution is as follows:
In the formula,Cin is the number of input channels equal to the number of input features, 7;cout is the number of output channels equal to the number of convolution kernels, 256 is the value representing the conversion of the extracted features into 256-dimensional data, z is the size of the convolution kernels, 3 is the value, and in the time convolution this value determines how many time steps the convolution kernels cover; The weight of the convolution kernel is represented by weight parameters at the positions i of the output channel cout, the input channel cin and the convolution kernel, the initial value is a random value which is 0 as a mean value and 0.01 as a standard deviation and accords with normal distribution, and the weight determines how the convolution kernel performs weighted summation on the input characteristics so as to generate output; Is the value of the input data at time step t-i and input channel cin, where t-i represents the input value of a lag amount relative to the current time step t; the offset term representing each output channel is 0 in initial value and has no fixed value, the offset term can be continuously adjusted in the training process, and the offset term is used for adding an additional linear offset to the weighted sum result of convolution so as to increase the flexibility of a model;
S4.2, taking the output after the input features are extracted as the input of the LSTM, and obtaining the hidden state of the current time step t;
Specifically, the output after the input features are extracted is used as the input of the LSTM, the input gate, the forgetting gate, the candidate cell state, the cell state update, the output gate and the hidden state update calculation are sequentially carried out after the features enter the LSTM, the long-term dependency relationship is further captured through the LSTM model, and finally, the predicted value is output through the full-connection layer, and the expression is as follows:
Wherein it represents the activation value of the input gate for controlling the amount of new information added to the cell state, sigma represents the sigmoid activation function, the output value is between 0 and 1 for controlling the proportion of input information added, Wi represents the weight matrix of the input gate, and zt-1 represents the hiding state of the last time step, and the value is 128; values representing the output sequence at time step t and output channel cout, used as inputs to the LSTM model; The method comprises the steps of showing that the hidden state of the last time step is spliced with the characteristics extracted by TCN of the current time step, bi showing the bias item of the input gate, ft showing the activation value of the forgetting gate, Wf showing the weight matrix of the forgetting gate, bf showing the bias item of the forgetting gate; Is a candidate cell state, tanh represents a hyperbolic tangent activation function, Wc is a weight matrix used to generate candidate cell states, bc is a bias term for candidate cell states, ct is the cell state of the current time step, ft⊙ct-1 is the ratio ft of the previous cell state, representing a selective forgetting portion; Is a candidate state update under the state of the input gate, according to element multiplication, ot is the activation value of the output gate, Wo is the weight matrix of the output gate, bo is the bias term of the output gate, zt is the hidden state of LSTM at the current time step t, and tan h (ct) represents nonlinear change of the cell state;
S4.3, after calculating to obtain the hidden state of the current time step t, the hidden state is transferred to a full connection layer, and the hidden state is mapped to a target prediction space to obtain a predicted value, wherein the expression is as follows:
In the formula,Is the predicted result of voltage or temperature of time step t, Wy is the weight matrix of the full connection layer, zt is the hidden state of LSTM at the current time step t, by is the bias term of the full connection layer, because binary data (voltage and temperature) is predicted, the dimension of the bias term is 2, representing that the hidden state is mapped to two output targets;
S4.4, after the training set is input into the model, initializing and assigning all weight matrixes and bias items in S4.1-S4.3, calculating the input by using the currently initialized parameter values in forward propagation by the model according to the formula until a final prediction result is output, and obtaining a prediction value through forward propagationAnd the error is calculated through the loss function, then back propagation is carried out for calculating the gradient of the loss function on each parameter, the back propagation can transfer the influence of the loss function on each parameter, then the weight and the bias term parameters obtained in the steps are updated through an Adam optimizer, so that the loss function is reduced, the Mean Square Error (MSE) is used as a training set loss function, and the expression is as follows:
where n represents the length of the data of the training set, where n has a value of 907578, Yt represents the true value of the voltage or temperature at time step t,Is the predicted voltage or temperature value at time t;
s5, inputting the test set into a prediction model, and obtaining a prediction result by taking the highest monomer voltage and the highest probe temperature as prediction label values;
specifically, after the test set is input into the prediction model, the model can repeat the formula obtained by bringing the previous training set into the model to calculate and call the obtained training parameters, and the step of obtaining the prediction result by taking the highest monomer voltage and the highest probe temperature as the prediction label value is as follows:
S5.1, inputting the test set into a TCN model and carrying out causal convolution to extract input features, wherein the expression of the extracted features is as follows:
In the formula,Xt-τ+1:t represents a test set input sequence of past τ time steps, τ being the time window size, and the value being 126;
S5.2, transmitting the features extracted from the TCN as input to the LSTM to obtain a hidden state zt of the time step, wherein the expression is as follows:
wherein zt-τ+1:t represents a hidden state sequence obtained after accepting the feature input;
S5.3, generating predicted values of delta time steps in the future by inputting the hidden state into the full connection layer, wherein the expression is as follows:
In the formula,The method comprises the steps of representing the highest voltage of a monomer and the highest temperature value of a probe, wherein the highest voltage and the highest temperature value of the probe comprise delta time steps in the future, delta is 24, [ HCVt+1:t+Δ,HTt+1:t+Δ ] is a prediction vector of delta time steps in the future of voltage and temperature, Wy is a weight matrix of a full-connection layer, zt is a hidden state of LSTM at the current time step t, only the hidden state obtained at the moment of the last time step t is used here, by is a bias term of the full-connection layer, the bias term is continuously adjusted in the training process, and the bias term is used for adding an additional linear offset to the weighted sum result of convolution so as to increase the flexibility of a model;
Specifically, when the test set enters the TCN-LSTM model, the data is divided into M samples, each sample comprises a sliding window with a length of 126 and a label output with a predicted length of 24, and as sample data 1 enters the model, model parameters obtained by training are called to obtain the highest monomer voltage label dataThen the sample data 2 enters a model to repeat the process to obtain label dataAnd so on for the last sampleObtaining tag dataM is the number of samples, the value is N-N-126-24+1= 29766, and the specific prediction flow is as follows:
similarly, the predicted data of the probe maximum temperature can be obtained according to the methodSuch asThe prediction flow of (1) is as follows:
Wherein Xte represents a test set matrix; representing the first sample of the test set into the TCN-LSTM model, and so onThe method comprises the steps of representing an Mth sample of a test set entering a model and also representing a last sample, wherein N represents the data length of a training set and is equal to the number of rows of a matrix, N represents the total length of the training set and the data of the test set, Y1(1) represents the highest monomer voltage prediction data vector obtained by the first sample, and Y1(M) represents the highest monomer voltage prediction data vector obtained by the Mth sample in a analogized way;
in order to better quantify the difference between the predicted value and the true value obtained by the test set, a Root Mean Square Error (RMSE) is adopted as an evaluation index for evaluating the predicted performance of the model test set, and the calculation formula of the RMSE is as follows:
where N-N represents the length of the data of the test set, Yt represents the true value of the voltage or temperature,Is the predicted voltage or temperature value at time step t;
S6, outputting an early warning result;
Specifically, when the predicted voltage or temperature value exceeds the set upper and lower limits, triggering overvoltage, undervoltage or temperature abnormality alarm, when the predicted value does not exceed the set upper and lower limits, but the predicted value obtains a local abnormality detection algorithm (LOF) to obtain an LOF outlier factor value exceeding 1, triggering voltage abnormality elevation alarm or temperature abnormality elevation alarm;
The method comprises the following steps:
S6.1, carrying out standardization processing on the prediction result;
Specifically, after the predicted values of the voltage data and the temperature data are obtained, the input data need to be standardized to ensure that the data are compared on the same scale, and the standardized formula is as follows:
In the formula,Is the predicted voltage or temperature value obtained at time t, muj is the mean value of the voltage or temperature signature j, sigmaj is the standard deviation of the voltage or temperature signature j, zj is the normalized voltage or temperature value;
S6.2, respectively combining the standardized voltage data or temperature data into a data set D and a data set U, and calculating local outlier factors of each point in the data set D and the data set U to obtain an early warning result, wherein the method comprises the following steps of:
S6.2.1, defining Euclidean distance, namely taking any point o except p in one data point p, D or U in the set, defining the Euclidean distance between the point p and the point o as D(p,o), and for any two points p= (p1,p2,...,pm) and o= (o1,o2,...,om), obtaining the Euclidean distance formula in m-dimensional space:
s6.2.2 defining a kth distance, namely defining the distance between the point p and the nearest k points as d1~k(p),d1~k (p), dk (p), and dk (p) as the kth distance of the point p;
dk (p) is required to satisfy the following two points (1) that at least k points o ' except the point p in D or U enable Dk(p,o′)≤dk (p, o); (2) that at most k-1 points o ' except the point k enable D (p, o ') < D (p, o); wherein the k value is taken as 25, and the distance between the adjacent 25 points is calculated;
S6.2.3 defining a kth distance neighborhood Nk (p), namely a set of all points of which the distance of a kth distance field Nk (p) point p of the point p is less than or equal to the kth distance of the point p, wherein the expression representing the kth distance field is:
Nk(p)={o′|d(p,o′)≤dk(p)}
Where d (p, o ') is the Euclidean distance of point p from point o', dk (p) is the kth distance of point p;
S6.2.4, calculating a kth reachable distance dk,reach (p, o), wherein the kth reachable distance has a calculation formula:
dk,reach(p,o)=max{d(p,o),dk(o)}
Wherein d (p, o) is the Euclidean distance between the point p and the point o, dk (o) is the kth distance of the point o, and max is the maximum value of the two;
s6.2.5, calculating a kth local reachable density lrdk (p) of the point p, wherein the local reachable density is calculated according to the following formula:
Wherein Nk (p) is the number of Nk (p) points in the field of point p, dk,reach (p, o) is the kth reachable distance from point p to point o;
S6.2.6, calculating a kth local outlier factor LOFk (p) of the point p, wherein the calculation formula of the kth local outlier factor is as follows:
wherein, lrdk (o) is the k local reachable density of the point o, lrdk (p) is the k local reachable density of the point p, and I Nk (p) is the number of Nk (p) points in the field of the point p;
S6.2.7, separating points into outliers and normal points based on the calculated local outlier factor value, setting the threshold value of the local outlier factor to be 1, and determining the points to be outliers when the calculated LOFk (p) is greater than 1;
The rule of outputting the early warning result is that when the predicted value of the highest voltage of the monomer is larger than the upper limit cut-off voltage, the overvoltage warning is triggered, and when the predicted value is in the normal range but the LOF outlier factor value is larger than 1, the abnormal voltage fluctuation early warning is triggered, when the predicted value of the highest temperature of the monomer is larger than the upper limit of the temperature, the abnormal temperature warning is triggered, and when the temperature value is in the normal range but the LOF outlier factor value is larger than 1, the abnormal temperature fluctuation early warning is triggered;
The upper cutoff voltage is 4.25V, and the lower cutoff voltage is 3.4V;
the upper temperature limit is 55 ℃.
The beneficial effects of the invention are that
The invention provides a vehicle lithium battery fault early warning method based on multiple prediction and anomaly detection, and experimental results show that on the basis of accurate prediction, accurate multi-step (24 steps, namely 4 minutes in advance) prediction on future data of voltage faults and temperature faults is realized, so that the early warning range is expanded from the voltage faults to the temperature faults with larger influence on safety, and more sufficient emergency treatment time is provided for drivers. Experiment results show that compared with the existing Battery Management System (BMS) early warning method, the method can early warn voltage overrun by 4.5 minutes, early warn voltage abnormal rise and fall before undervoltage by 83.5 minutes, early warn temperature abnormality by 24.6 minutes, and early warn temperature by 35.1 minutes before faults occur.
Detailed Description
The present invention will be described in further detail with reference to specific examples.
As shown in fig. 1 and 2, the method for early warning the fault of the lithium battery for the vehicle based on the multi-element prediction and the anomaly detection comprises the following steps:
S1, acquiring operation data of a vehicle battery system through a big data platform;
The vehicle battery system comprises a battery system of a normal vehicle and a vehicle with fault alarm;
the fault types include voltage faults and temperature faults;
the voltage faults comprise overvoltage, undervoltage and too fast voltage change of the battery unit;
the temperature fault comprises that the temperature rises too fast and exceeds a set threshold value;
The method comprises the steps of collecting vehicle operation data based on a big data platform and extracting actual operation data of a power battery, wherein the collected vehicles comprise normal vehicles and vehicles with fault alarm, fault types comprise voltage faults and temperature faults, the voltage faults comprise overvoltage, undervoltage and too fast voltage changes of battery cells, and the temperature faults comprise too fast temperature rise and temperature exceeding a set threshold (-20 ℃ to 55 ℃);
Collecting operation data of a vehicle battery system, including a vehicle ID, a sampling time, a total battery pack voltage (TV), a Highest Cell Voltage (HCV), a Lowest Cell Voltage (LCV), an SOC, a total current (C), a highest probe temperature (HT) and a lowest probe temperature (LT);
in the embodiment, the real data condition of three electric automobile battery systems running for half a year is acquired through a big data detection platform, the data acquisition process strictly follows the protocol of electric automobile remote service and management technical specification, the data acquisition process comprises two vehicles (No. 1 vehicle and No. 2 vehicle) which normally run and one vehicle (No. 3 vehicle) which have fault alarm, the No. 1 vehicle runs in a summer high-temperature environment, the No. 2 vehicle runs in a winter low-temperature environment, the No. 3 vehicle has BMS fault alarm, the fault types comprise voltage faults (single battery overvoltage, undervoltage and voltage change rate are too fast) and temperature faults (temperature rise is too fast and the temperature exceeds a set threshold), the data sampling frequency of the three vehicles is once every 10 seconds, the charge cut-off voltage (upper limit cut-off voltage) of the battery is 4.25V, the discharge cut-off voltage (lower limit cut-off voltage) is 3.4V, and the temperature upper limit and lower limit range is-20 ℃ to 55 ℃;
S2, data cleaning is carried out on the collected data, and a data set is generated;
Due to the complex operating conditions, the acquired data needs to be cleaned as necessary;
The data cleaning method comprises the following steps:
(1) The method comprises the steps of filling the missing data of the lost frames smaller than three frames by using linear interpolation, and removing the missing fragments larger than three frames, namely six data in one minute are sampled once every ten seconds, if 1-3 data are lost in the fragments, the fragments are missing, linear interpolation is selected for filling the missing values, and the fragments with the missing values larger than 3 data are directly deleted;
(2) The normal range of the SOC is [200V,500V ], [ -1000A,1000A ], [2V,5V ], [ -40 ℃ and 210 ℃ and [0,100] respectively, and the data exceeding the range are regarded as abnormal acquisition data of the sensor to be removed;
(3) Performing noise reduction processing on all data by using wavelet transformation;
The generation of the data set is that the highest voltage (HCV) of a single body, the Highest Temperature (HT) of a probe is randomly used as the last two columns, the Total Voltage (TV) of a battery pack, the total current (C), the SOC, the lowest voltage (LCV) of the single body, the Lowest Temperature (LT) of the probe and the front five data sequences do not have fixed requirements to form a matrix X with the dimension of [ N,7 ];
The expression is as follows:
the highest voltage of a single battery is selected as a predicted label value Y1, the highest temperature of a probe is selected as a predicted label value Y2, and the expression is as follows:
Wherein N represents the total length of the matrix formed by all data and is equal to the sum of the matrix rows of the training set and the testing set, and N is 937433 in the embodiment;
The data set part record data constructed is shown in table 1:
table 1 construction of data set partial data
S3, dividing the data set into a training set and a testing set;
Specifically, the normal vehicle data is used as a training set to obtain a training matrix Xtr, the fault vehicle is used as a testing set to obtain a testing matrix Xte, and the training set and the testing set keep the same data form;
Namely, a data matrix formed by the No. 1 normal vehicle and the No. 2 normal vehicle is used as a training set, and a data matrix formed by the No. 3 fault vehicle is used as a test set;
The expression is as follows:
in the formula, n represents the total row number of the training set matrix, wherein n is 907578 in the embodiment;
S4, constructing a prediction model through a training set, wherein the method comprises the following steps:
S4.1, inputting a training set into a TCN model and carrying out causal convolution to extract input features, wherein an output formula of the causal convolution is as follows:
In the formula,Cin is the number of input channels equal to the number of input features, 7;cout is the number of output channels equal to the number of convolution kernels, 256 is the value representing the conversion of the extracted features into 256-dimensional data, z is the size of the convolution kernels, 3 is the value, and in the time convolution this value determines how many time steps the convolution kernels cover; The weight of the convolution kernel is represented by weight parameters at the positions i of the output channel cout, the input channel cin and the convolution kernel, the initial value is a random value which is 0 as a mean value and 0.01 as a standard deviation and accords with normal distribution, and the weight determines how the convolution kernel performs weighted summation on the input characteristics so as to generate output; Is the value of the input data at time step t-i and input channel cin, where t-i represents the input value of a lag amount relative to the current time step t; the offset term representing each output channel is 0 in initial value and has no fixed value, the offset term can be continuously adjusted in the training process, and the offset term is used for adding an additional linear offset to the weighted sum result of convolution so as to increase the flexibility of a model;
S4.2, taking the output after the input features are extracted as the input of the LSTM, and obtaining the hidden state of the current time step t;
Specifically, the output after the input features are extracted is used as the input of the LSTM, the input gate, the forgetting gate, the candidate cell state, the cell state update, the output gate and the hidden state update calculation are sequentially carried out after the features enter the LSTM, the long-term dependency relationship is further captured through the LSTM model, and finally, the predicted value is output through the full-connection layer, and the expression is as follows:
Wherein it represents the activation value of the input gate for controlling the amount of new information added to the cell state, sigma represents the sigmoid activation function, the output value is between 0 and 1 for controlling the proportion of input information added, Wi represents the weight matrix of the input gate, and zt-1 represents the hiding state of the last time step, and the value is 128; values representing the output sequence at time step t and output channel cout, used as inputs to the LSTM model; The method comprises the steps of showing that the hidden state of the last time step is spliced with the characteristics extracted by TCN of the current time step, bi showing the bias item of the input gate, ft showing the activation value of the forgetting gate, Wf showing the weight matrix of the forgetting gate, bf showing the bias item of the forgetting gate; Is a candidate cell state, tanh represents a hyperbolic tangent activation function, Wc is a weight matrix used to generate candidate cell states, bc is a bias term for candidate cell states, ct is the cell state of the current time step, ft⊙ct-1 is the ratio ft of the previous cell state, representing a selective forgetting portion; Is a candidate state update under the state of the input gate, according to element multiplication, ot is the activation value of the output gate, Wo is the weight matrix of the output gate, bo is the bias term of the output gate, zt is the hidden state of LSTM at the current time step t, and tan h (ct) represents nonlinear change of the cell state;
S4.3, after calculating to obtain the hidden state of the current time step t, the hidden state is transferred to a full connection layer, and the hidden state is mapped to a target prediction space to obtain a predicted value, wherein the expression is as follows:
In the formula,Is the predicted result of voltage or temperature of time step t, Wy is the weight matrix of the full connection layer, zt is the hidden state of LSTM at the current time step t, by is the bias term of the full connection layer, because binary data (voltage and temperature) is predicted, the dimension of the bias term is 2, representing that the hidden state is mapped to two output targets;
S4.4, after the training set is input into the model, initializing and assigning all weight matrixes and bias items in S4.1-S4.3, calculating the input by using the currently initialized parameter values in forward propagation by the model according to the formula until a final prediction result is output, and obtaining a prediction value through forward propagationAnd the error is calculated through the loss function, then back propagation is carried out for calculating the gradient of the loss function on each parameter, the back propagation can transfer the influence of the loss function on each parameter, then the weight and the bias term parameters obtained in the steps are updated through an Adam optimizer, so that the loss function is reduced, the Mean Square Error (MSE) is used as a training set loss function, and the expression is as follows:
where n represents the length of the data of the training set, where n has a value of 907578, Yt represents the true value of the voltage or temperature at time step t,Is the predicted voltage or temperature value at time t;
The method mainly comprises the steps that the built TCN-LSTM hybrid neural network voltage and temperature prediction model is used for capturing local time dependence of an input sequence, the local time dependence is achieved through multi-layer time residual convolution blocks, each convolution block comprises two convolution layers, a ReLU activation function and a Dropout layer, the size of the convolution kernel is 3, the number of the convolution kernels is 256, window moving step length is 1, in the TCN, the output of each layer serves as the input of the next layer, characteristics in a time sequence are extracted layer by layer, finally, the output shape is converted into a shape and dimension suitable for the input of the LSTM model through a full connection layer map, the LSTM model is designed to process long-term dependence in time sequence data, the LSTM model consists of an input layer, a hidden layer containing 128 hidden units, a linear layer and an output layer, the data after the TCN convolution is input to the input layer and the hidden layer of the LSTM, final output is obtained through the ReLU activation function and the full connection layer, super-parameters of the model comprise the number of hidden layers, the number of iterative steps is set, the number of the training steps is 128,16,50,126,24,0.001, and the time step length is set up, and the number of the training steps is 35 respectively;
The training model uses a built training set, and parameters for model training and storage comprise convolution kernel weights and bias items of a TCN model part, wherein the LSTM model part comprises input gates, forgetting gates, candidate memory units and weights of output gates, and bias of the input gates, the forgetting gates, the candidate memory units and the output gates;
Further, as shown in fig. 3, part a shows a structural schematic diagram of a Time Convolution Network (TCN), and when the expansion rate is 1, the model performs causal convolution without skipping time steps, and performs expansion convolution when the expansion rate is greater than 1;
in the embodiment, the training set used by the model is only data of two electric vehicles running for half a year, the data quantity and the data running range of the training set can be increased in the model training process, so that the model fully learns the data characteristics of the vehicle under different environments and driving behavior habits, and the steps can be repeated for different vehicle types to train a plurality of models;
Furthermore, the normal vehicle data used for training the model should contain more vehicle data and vehicle data with larger operating range as much as possible, so that the model can learn different driving habits, different operating conditions and the influence on the change of battery data under the external environment, and the model can obtain more parameters, thereby achieving higher prediction precision;
furthermore, the training model adopts a training-testing mode, so that training vehicles can be increased at any time or periodically or the data quality can be improved to update model parameters;
Furthermore, for higher training precision, different vehicle data of different vehicle types can be acquired for different vehicle types to perform general feature training of the vehicle;
s5, inputting the test set into a prediction model, and obtaining a prediction result by taking the highest monomer voltage and the highest probe temperature as prediction label values;
specifically, after the test set is input into the prediction model, the model can repeat the formula obtained by bringing the previous training set into the model to calculate and call the obtained training parameters, and the step of obtaining the prediction result by taking the highest monomer voltage and the highest probe temperature as the prediction label value is as follows:
S5.1, inputting the test set into a TCN model and carrying out causal convolution to extract input features, wherein the expression of the extracted features is as follows:
In the formula,Xt-τ+1:t represents a test set input sequence of past τ time steps, τ being the time window size, and the value being 126;
S5.2, transmitting the features extracted from the TCN as input to the LSTM to obtain a hidden state zt of the time step, wherein the expression is as follows:
wherein zt-τ+1:t represents a hidden state sequence obtained after accepting the feature input;
S5.3, generating predicted values of delta time steps in the future by inputting the hidden state into the full connection layer, wherein the expression is as follows:
In the formula,The method comprises the steps of representing the highest voltage of a monomer and the highest temperature value of a probe, wherein the highest voltage and the highest temperature value of the probe comprise delta time steps in the future, delta is 24, [ HCVt+1:t+Δ,HTt+1:t+Δ ] is a prediction vector of delta time steps in the future of voltage and temperature, Wy is a weight matrix of a full-connection layer, zt is a hidden state of LSTM at the current time step t, only the hidden state obtained at the moment of the last time step t is used here, by is a bias term of the full-connection layer, the bias term is continuously adjusted in the training process, and the bias term is used for adding an additional linear offset to the weighted sum result of convolution so as to increase the flexibility of a model;
Specifically, when the test set enters the TCN-LSTM model, the data is divided into M samples, each sample comprises a sliding window with a length of 126 and a label output with a predicted length of 24, and as sample data 1 enters the model, model parameters obtained by training are called to obtain the highest monomer voltage label dataThen the sample data 2 enters a model to repeat the process to obtain label dataAnd so on for the last sampleObtaining tag dataM is the number of samples, the value is N-N-126-24+1= 29766, and the specific prediction flow is as follows:
similarly, the predicted data of the probe maximum temperature can be obtained according to the methodSuch asThe prediction flow of (1) is as follows:
Wherein Xte represents a test set matrix; representing the first sample of the test set into the TCN-LSTM model, and so onThe method comprises the steps of representing an Mth sample of a test set entering a model and also representing a last sample, wherein N represents the data length of a training set and is equal to the number of rows of a matrix, N represents the total length of the training set and the data of the test set, Y1(1) represents the highest monomer voltage prediction data vector obtained by the first sample, and Y1(M) represents the highest monomer voltage prediction data vector obtained by the Mth sample in a analogized way;
in order to better quantify the difference between the predicted value and the true value obtained by the test set, a Root Mean Square Error (RMSE) is adopted as an evaluation index for evaluating the predicted performance of the model test set, and the calculation formula of the RMSE is as follows:
where N-N represents the length of the data of the test set, Yt represents the true value of the voltage or temperature,Is the predicted voltage or temperature value at time step t;
The result of the temperature prediction of the test set is shown in fig. 4, part a shows the true value of the temperature, part b is the predicted value of the temperature, part C is the error between the true value and the predicted value (error = true value-predicted value), and the RMSE of the temperature prediction is 0.4616 ℃;
The result of the voltage prediction is shown in fig. 5, the part a shows the true value of the voltage, the part b is the predicted value of the voltage, the part c is the error between the true value and the predicted value, and the RMSE of the voltage prediction is 0.0117V, which proves that the prediction method provided by the invention still has higher accuracy when the 24-step forward prediction is kept;
S6, outputting an early warning result;
Specifically, when the predicted voltage or temperature value exceeds the set upper and lower limits, triggering overvoltage, undervoltage or temperature abnormality alarm, when the predicted value does not exceed the set upper and lower limits, but the predicted value obtains a local abnormality detection algorithm (LOF) to obtain an LOF outlier factor value exceeding 1, triggering voltage abnormality elevation alarm or temperature abnormality elevation alarm;
The method comprises the following steps:
S6.1, carrying out standardization processing on the prediction result;
Specifically, after the predicted values of the voltage data and the temperature data are obtained, the input data need to be standardized to ensure that the data are compared on the same scale, and the standardized formula is as follows:
In the formula,Is the predicted voltage or temperature value obtained at time t, muj is the mean value of the voltage or temperature signature j, sigmaj is the standard deviation of the voltage or temperature signature j, zj is the normalized voltage or temperature value;
S6.2, respectively combining the standardized voltage data or temperature data into a data set D and a data set U, and calculating local outlier factors of each point in the data set D and the data set U to obtain an early warning result, wherein the method comprises the following steps of:
S6.2.1, defining Euclidean distance, namely taking any point o except p in one data point p, D or U in the set, defining the Euclidean distance between the point p and the point o as D(p,o), and for any two points p= (p1,p2,...,pm) and o= (o1,o2,...,om), obtaining the Euclidean distance formula in m-dimensional space:
S6.2.2, defining the kth distance, namely defining the distance between a point p and the nearest k points as D1~k(p),d1~k (p), defining the maximum value of Dk (p), defining Dk (p) as the kth distance of the point p, wherein Dk (p) is required to satisfy the following two points that (1) at least k points o ' except the point p in D or U enable Dk(p,o′)≤dk (p, o), and (2) at most k-1 points o ' except the point k in D or U enable D (p, o ') < D (p, o), wherein the k value is taken as 25 and represents the distance of 25 adjacent points;
S6.2.3 defining a kth distance neighborhood Nk (p), namely a set of all points of which the distance of a point p in a kth distance field Nk (p) of the point p is less than or equal to the kth distance of the point p, wherein the expression representing the kth distance field is:
Nk(p)={o′|d(p,o′)≤dk(p)}
Where d (p, o ') is the Euclidean distance of point p from point o', dk (p) is the kth distance of point p;
s6.2.4, calculating a kth reachable distance dk,reach (p, o), wherein the kth reachable distance has a calculation formula:
dk,reach(p,o)=max{d(p,o),dk(o)}
Wherein d (p, o) is the Euclidean distance between the point p and the point o, dk (o) is the kth distance of the point o, and max is the maximum value of the two;
S6.2.5, calculating the kth local reachable density lrdk (p) of the point p, wherein the local reachable density is calculated according to the formula:
Wherein Nk (p) is the number of Nk (p) points in the field of point p, dk,reach (p, o) is the kth reachable distance from point p to point o;
s6.2.6, calculating a kth local outlier factor LOFk (p) of the point p, wherein the calculation formula of the kth local outlier factor is as follows:
wherein, lrdk (o) is the k local reachable density of the point o, lrdk (p) is the k local reachable density of the point p, and I Nk (p) is the number of Nk (p) points in the field of the point p;
S6.2.7, separating points into outliers and normal points based on the calculated local outlier factor value, setting the threshold value of the local outlier factor to be 1, and determining the points to be outliers when the calculated LOFk (p) is greater than 1;
As shown in fig. 6 and 7, the voltage fault early warning result obtained in the embodiment is shown in fig. 6, the end data (29400 to 29915 frames) of the voltage predicted value is 4.26V at 29444 frames, the upper limit cutoff voltage of the battery is 4.25V, the overvoltage early warning is triggered at this time according to the output rule of the early warning result in the step six, and the BMS warning point of the vehicle is 29447 frames, which proves that compared with the detection method of the original BMS of the vehicle, the early warning method provided by the invention is advanced by 4.5 minutes [ (29447-29444+24) ×10×60] to realize overvoltage warning, and the voltage predicted value is 3.6V at 257 frames, although the voltage predicted value is not lower than the lower limit cutoff voltage, but the calculated LOF outlier is 1.35 exceeding the set threshold, the voltage abnormal warning is triggered, and the BMS 734 frames trigger the undervoltage warning, which is advanced by [ (734-257-24) ×10×60] to realize the voltage abnormal warning trend before the undervoltage warning.
As shown in fig. 8, the temperature fault early warning result obtained in this embodiment is that, in 29728 frames, a temperature anomaly is detected for the first time and an anomaly point is marked, at this time, the LOF calculated value of the point is 752.34, which exceeds the threshold value set by the set LOF anomaly detection, and the temperature predicted value is 26.7 ℃, which does not exceed the upper temperature limit, and then a significant and rapid battery temperature rise occurs, but when the voltage data at this time is compared, the true value of the voltage is in the normal range, and the predicted value of the voltage only has an abnormal rise trend but the value is still within the normal range, so that only the voltage data is focused on to have limitations on fault early warning;
From the first detection of the abnormal value (29728 frames) to the data termination point 29915 frames, the multi-step prediction model based on TCN-LSTM and the LOF local abnormality detection algorithm realize the temperature early warning duration of 35.1 minutes [ (29915-29728+24) x 10/60 ], and compared with the early warning of BMS, the early warning duration is 24.6 minutes [ (29852-29728+24) x 10/60 ], which provides sufficient time for the driver to respond emergently.