CNNLSTM-based energy storage equipment temperature control method and system
By introducing a temperature prediction model based on CNN_LSTM in the energy storage equipment temperature control system, combined with PID control, the problems of insufficient accuracy and complex parameter setting in the temperature control of energy storage equipment are solved, and more efficient temperature control and stronger adaptability are achieved.
Patent Information
- Application Number
- CN202411956597.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-29
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-29
AI Technical Summary
In the operating temperature control of existing energy storage equipment, the PID control method has problems such as insufficient control accuracy, complex parameter setting, and poor adaptability to nonlinear and dynamic changes.
The temperature control method based on CNN_LSTM is adopted, and the temperature control system parameters are adjusted in real time by collecting data through the temperature sensor to input the trained CNN_LSTM model.
It improves the accuracy and adaptability of the temperature control of energy storage equipment, reduces the complexity of parameter setting of the temperature control system, and enhances the degree of automation and robustness of the system.
Smart Images

Figure CN119806240A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a temperature control method and system for energy storage equipment based on CNN_LSTM, belonging to intelligent control technology for energy storage equipment. Background Art
[0002] Energy storage equipment needs to accurately control the operating temperature to maintain the necessary conditions for safe and stable operation of the equipment. The existing energy storage equipment operating temperature control scheme widely adopts the PID control method. PID control has been widely used in industrial control due to its simple structure, easy implementation and good stability. However, with the increasing complexity of power / electronic equipment and the improvement of precision requirements, the traditional PID control method has gradually exposed problems such as insufficient control accuracy and poor adaptability to nonlinear and dynamic changes.
[0003] Taking the liquid cooler that maintains the working temperature of the battery in the energy storage cabinet as an example, its control object is often multi-feature rather than single-feature, such as battery temperature, flow rate of freezing liquid and refrigerant. In addition, these features are collected by sensors and their analog signals are then transmitted to the control end by multiple bundles of winding signal lines. The distance is long, which makes the signal anti-interference ability poor; there are also large deviations in the accuracy of different sensors. In addition, the signals generated in the liquid cooler are usually complex, nonlinear and rapidly changing. This is because the application scenario environment of the liquid cooler is changeable, signal acquisition is easily affected by various factors, and each signal has strong coupling, such as grid load fluctuations, weather changes, and surrounding magnetic field interference.
[0004] Therefore, the use of PID control method alone in the current energy storage equipment working temperature control has the following shortcomings:
[0005] 1. Parameter tuning is complex. The performance of the PID controller depends largely on the tuning of its three parameters (proportional coefficient Kp, integral coefficient Ki, differential coefficient Kd). The tuning process of these parameters is often complicated, requiring rich experience and trial and error, and the optimal parameters of different systems may vary greatly. Improper parameter tuning may cause problems such as system overshoot, oscillation, or slow response.
[0006] 2. Poor adaptability to complex systems. PID controllers have poor adaptability to nonlinear, time-varying or uncertain systems. These systems are often difficult to describe with simple linear models, so the effectiveness of PID controllers will be greatly reduced. In the face of rapidly changing systems or situations that require high-precision control, PID controllers may not meet the requirements.
[0007] 3. Unable to handle multi-variable coupling. In a multi-variable control system, there is often a coupling relationship between the variables. The PID controller will encounter difficulties in handling such a system because it usually only controls a single variable. Summary of the invention
[0008] The technical problem solved by the present invention is: to provide a CNN_LSTM-based energy storage device temperature control method and system in view of the problems of low control accuracy and slow response when the PID control method is applied to the working process of the existing energy storage device.
[0009] The present invention is implemented by the following technical solutions:
[0010] The present invention firstly discloses a temperature control method for energy storage equipment based on CNN_LSTM. A temperature sensor collects the load temperature of the energy storage equipment and inputs it into a trained CNN_LSTM model for temperature prediction. The predicted temperature is output. The error between the predicted temperature and the target temperature of the energy storage equipment is used as feedforward input data of a PID control unit. The PID control unit feeds back the input data to the temperature control system of the energy storage equipment to adjust the load temperature according to the error feedback control.
[0011] In the energy storage device temperature control method based on CNN_LSTM of the present invention, further, the CNN_LSTM model is trained through the following steps:
[0012] Step 1: Collect the original data of the load temperature of the energy storage device at a set frequency within the collection period, clean and normalize the original data collected in step 1, and classify and construct a training set, a verification set, and a test set;
[0013] Step 2: construct a CNN_LSTM model, wherein the CNN_LSTM model uses a CNN network to extract spatial features from the preprocessed training set data, inputs the feature sequence extracted by the CNN network into the LSTM neural network, captures the long-term time dependency in the feature sequence through the LSTM neural network, and learns the evolution of the state of the energy storage device over time;
[0014] Step 3: Train the CNN_LSTM model. Reshape the feature sequence of the training set into a three-dimensional array of sample number, time step, and feature number, and then input it into the CNN_LSTM model for training. Use the Adam optimizer to optimize the weights and biases of the model. Verify the loss value, R2 score, and MSE of the training set and validation set by minimizing the loss function.
[0015] Step 4: Use the test set to predict the trained CNN_LSTM model. The test set and the load temperature data collected by the actual prediction temperature sensor are reshaped into a three-dimensional array of sample number, time compensation, and feature number and input into the CNN_LSTM model for prediction.
[0016] In the energy storage device temperature control method based on CNN_LSTM of the present invention, further, in the step 1, the cleaning of the raw data adopts moving average to remove noise, mean to fill missing values or IQR rule to remove outliers;
[0017] In the moving average noise removal, a window with a size of 3 is used to perform moving average processing on the temperature data column of the load temperature original data to generate a new temperature data column;
[0018] In the method of filling missing values with mean, the mean of the temperature data column of the original load temperature data is calculated, and the mean is used to fill missing values, thereby generating a new temperature data column;
[0019] In the IQR rule for removing outliers, the difference between the third quartile Q3 and the first quartile Q1 in the temperature data column is calculated to obtain the IQR, and outliers are identified and removed according to the IQR rule.
[0020] In the CNN_LSTM-based energy storage device temperature control method of the present invention, further, in the step one, the normalized original data set is divided into a training set and a temporary set, wherein the training set accounts for 40% of the total data, and the temporary set is further divided into a verification set and a test set, wherein the verification set and the test set each account for 50% of the temporary set.
[0021] In the temperature control method of energy storage equipment based on CNN_LSTM of the present invention, further, in the CNN_LSTM model, an LSTM neural network is added between the pooling layer and the fully connected layer of the CNN network, and the feature sequence after the pooling operation of the CNN network is input into the LSTM neural network, and the LSTM neural network performs information learning of the time series, and finally accesses the fully connected layer of the neural network to output the predicted value of the load temperature over the time series.
[0022] In the energy storage device temperature control method based on CNN_LSTM of the present invention, further, in the CNN_LSTM model, the LSTM neural network uses a Sequential model to linearly stack a Conv1D layer, an LSTM layer, and a Dense layer;
[0023] The Conv1D layer sets 64 filters, each filter has a size of 2, and the activation function uses ReLU;
[0024] The LSTM layer includes 50 LSTM units to process the time dependency in the feature sequence input into the LSTM neural network;
[0025] The Dense layer outputs the predicted temperature.
[0026] In the CNN_LSTM-based energy storage device temperature control method of the present invention, further, in the step four, the prediction result output by the CNN_LSTM model is inverse normalized using the inverse_transform method to restore the prediction result to the same data form as the original load temperature data.
[0027] In the energy storage device temperature control method based on CNN_LSTM of the present invention, further, the PID control unit determines the proportional term P of the PID control according to the following formula:
[0028] P=Kp×e(t)
[0029] Wherein, e(t) is the error between the predicted temperature at the current moment and the target temperature of the energy storage device, and Kp is the proportional coefficient of the PID control unit;
[0030] The integral term I of PID control is determined according to the following formula:
[0031]
[0032] in, Represents the error accumulation from time 0 to the current time t, Ki is the integral coefficient of the PID control unit;
[0033] Determine the differential term D of PID control according to the following formula:
[0034]
[0035] in, It represents the rate of change of error within time t, and Kd is the differential coefficient of the PID control unit;
[0036] The proportional term P, the integral term I and the differential term D are added together by the following formula to obtain the control input data u(t) fed back by the PID control unit to the temperature control system:
[0037]
[0038] In the CNN_LSTM-based energy storage device temperature control method of the present invention, further, the temperature control system includes a heating unit and a refrigeration unit. If the control input data u(t) is a positive value, the heating unit is feedback-controlled to increase the heat output and improve the actual load temperature of the energy storage device; if the control input data u(t) is a negative value, the heating unit is feedback-controlled to reduce the heat output, or the heating unit is turned off and the refrigeration unit is turned on to reduce the actual load temperature of the energy storage device.
[0039] The present invention also discloses a CNN-LSTM-based energy storage device temperature control system, which adopts the CNN-LSTM-based energy storage device temperature control method of the present invention, including:
[0040] Temperature sensor, collecting the load temperature of the energy storage device;
[0041] The CNN_LSTM temperature prediction unit is equipped with a trained CNN_LSTM model to predict the load temperature of the energy storage device collected by the temperature sensor and output the predicted temperature;
[0042] The PID control unit uses the error between the predicted temperature and the target temperature of the energy storage device as a feedforward input, feeds back the control input data to the temperature control system of the energy storage device, and adjusts the load temperature.
[0043] The present invention adopts the above technical solution to have the following beneficial effects:
[0044] (1) Considering that the temperature change of the energy storage device is not only related to the external environment (such as air temperature and humidity), but also affected by the multiple coupling effects of the internal load, operating status, current and heat dissipation system of the device, this complexity leads to the temperature change having a highly nonlinear characteristic. The present invention adopts a CNN_LSTM model combining a CNN network and an LSTM neural network for the prediction of the load temperature of the energy storage device. The CNN_LSTM model has a strong learning ability and nonlinear mapping ability for time series data. The CNN_LSTM hybrid model is used to capture the nonlinear relationship in the temperature change of the energy storage device. By combining with the PID control unit, the CNN_LSTM model can learn the dynamic characteristics of the temperature data of the energy storage device and adjust the parameters of the PID control energy storage device temperature control system in real time to adapt to the changes in the power supply system. In this way, the cumbersome manual parameter setting process of the temperature control system can be omitted, and the automation and robustness of the energy storage device temperature control system can be improved.
[0045] (2) The temperature change of energy storage equipment has obvious time dependence, and the past temperature and load operating status will have a lag effect on the current temperature. For example, when the equipment load rises suddenly, the temperature may be delayed for several minutes before it rises significantly. The present invention uses the LSTM time series model with memory function to capture the lag relationship and long-term and short-term dependencies in the temperature data of energy storage equipment. For scenarios with significant delay effects, adjust the time window length to ensure that the model can learn the lag relationship.
[0046] (3) The temperature sensor of the energy storage device may be affected by the environment, electromagnetic interference or equipment aging, resulting in occasional abnormal points or long-term drift. The CNN_LSTM model in the present invention uses moving average to remove noise, mean to fill missing values or IQR rule to detect and remove outliers; a loss function is added to the model design instead of the MAE used in the conventional model to reduce the impact of abnormal values of the temperature data of the energy storage device.
[0047] (4) The present invention optimizes the temperature parameters of energy storage equipment by combining the neural network of the CNN_LSTM model with the PID control technology. The CNN_LSTM neural network can handle complex nonlinear relationships and long-term dependencies. The CNN_LSTM model is introduced into the PID control to predict the load temperature of the energy storage equipment. The future change trend is predicted based on the historical data and current state of the system, and the control strategy is adjusted in advance to deal with possible problems. The system can significantly improve its adaptability to nonlinear, time-varying and uncertain systems of energy storage equipment, avoid the influence of excessive static errors, and ensure accurate output of the system.
[0048] In summary, the CNN_LSTM model adopted by the CNN_LSTM-based energy storage device temperature control method and system provided by the present invention combines the convolutional neural network CNN with the long short-term memory network LSTM to process and predict the load temperature of the energy storage device. It has a powerful ability to process time series data, extract features and capture long-term dependencies, and shows significant advantages in the fields of energy storage device load temperature prediction, equipment status monitoring, etc.
[0049] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 Schematic diagram of a temperature control system for an energy storage device in an embodiment.
[0051] Figure 2 Flow chart of the energy storage device temperature control method in the embodiment.
[0052] Figure 3 It is a schematic diagram of the combined structure of the CNN_LSTM neural network model in the embodiment.
[0053] Figure 4 This is a comparison chart of the loss values of the training set and the validation set in the CNN_LSTM training in the embodiment.
[0054] Figure 5 This is a comparison chart of the actual value and predicted value of the test set data after CNN_LSTM training in the embodiment. DETAILED DESCRIPTION
[0055] Example
[0056] See also Figure 1, the figure is a schematic diagram of the energy storage device temperature control system based on CNN_LSTM of the present invention. The system is based on the PID control system. On the basis of PID control, the CNN_LSTM model is introduced to perform temperature prediction. Specifically, the system includes a temperature sensor, a CNN_LSTM temperature prediction unit and a PID control unit. The load temperature of the energy storage device is collected by the temperature sensor; the CNN_LSTM temperature prediction unit is equipped with a trained CNN_LSTM model to perform temperature prediction on the load temperature of the energy storage device collected by the temperature sensor, and output the predicted temperature Tp to transmit to the PID control unit. The PID control unit uses the temperature error Te between the predicted temperature and the target temperature T of the energy storage device as a feedforward input, and feeds back the control input data to the temperature control system of the energy storage device to adjust the load temperature of the energy storage device, thereby finally realizing precise control of the load temperature.
[0057] Specific as Figure 2 As shown, the CNN_LSTM model used in this embodiment is trained through the following steps:
[0058] Step 1: Collect the original data of the load temperature of the energy storage device at a set frequency within the collection cycle, clean and normalize the original data collected in step 1, and classify and construct a training set, a validation set, and a test set.
[0059] Taking the real-time data of the energy storage cabinet unit in a library in Jishou as an example, the battery temperature change data in the energy storage cabinet for seven days a week is collected by using the temperature sensor at the water outlet of the load end of the energy storage cabinet as the original load temperature data. The data is required to be sampled once every 1 minute, for a total of 10,679 data.
[0060] The raw data is cleaned by using moving average to remove noise, mean value to fill missing values and IQR rule to remove outliers;
[0061] Moving average noise removal is a commonly used smoothing technique that works by applying a fixed-size window to the data and calculating the average of the data within the window. This example uses a window of size 3 to perform moving average processing on the temperature data in the "value" column, generating a new temperature data column "value_smoothed". This method helps reduce random fluctuations and noise in the data and makes the data smoother.
[0062] Mean filling is a simple method to fill missing values, which uses the mean of the data to replace the missing values. This embodiment generates a new temperature data column "value_filled" by calculating the mean of the temperature data in the "value" column and using the mean to fill the missing values.
[0063] IQR (interquartile range) is a statistic used to measure the degree of data dispersion, which represents the difference between the third quartile (Q3) and the first quartile (Q1). This embodiment uses the IQR rule to remove outliers, calculates the difference between the third quartile Q3 and the first quartile Q1 in the temperature data of the "value_filled" column to obtain IQR, and according to the IQR rule, determines that the data point is lower than Q1-1.5IQR or higher than Q3+1.5IQR as an outlier, identifies and removes the outlier.
[0064] The combination of the above three data cleaning methods is very useful in processing the load temperature time series data of energy storage equipment, which is beneficial to improving the data quality and the effect of subsequent model training.
[0065] After the original data is cleaned, the normalized original data set is divided into a training set and a temporary set using the train_test_split function, where the training set accounts for 40% of the total data, and the temporary set is further divided into a validation set and a test set, where the validation set and the test set each account for 50% of the temporary set.
[0066] First, create a feature set X[] and a target variable set Y[]. The target variable is the feature data of the predicted temperature. Here, the temperature data of the past 60 time points are used to predict the temperature at the next time point. X[] is a list of temperature values, each element of which is an array containing the temperature values of the past 60 time points. Y[] is a list of temperature values corresponding to time points, each element of which is a temperature value, indicating the temperature at the next time point after the temperature of the past 60 time points, that is, the predicted future temperature value. Use the train_test_split function to divide the collected original data set into a training set and a temporary set, in which the test set accounts for 40% of the total data. Then, the temporary set is divided into a validation set and a test set again, in which the validation set accounts for 50% of the temporary set, that is, 30% of the total data, and the test set also accounts for 30% of the total data. The purpose of splitting the data set in this way is to have an independent validation set to adjust the model parameters when training the model, and a test set to evaluate the performance of the model.
[0067] The data is then normalized to ensure that the dimensions of different features are consistent, improving the convergence speed and performance of the model. Finally, the data is classified: the first 40% of the data (X_train, Y_train) is used as the training set, the subsequent 30% of the data (X_val, Y_val) is used as the validation set, and the last 30% of the data (true value) (X_test, Y_test) is used as the test set. Among them, X and Y are the feature data and label data in the original data.
[0068] Step 2: Construct a CNN_LSTM model. The CNN_LSTM model uses a CNN network to extract features from the preprocessed data, extracts spatial features from the input data through structures such as convolutional layers and pooling layers, and inputs the feature sequence extracted by the CNN network into the LSTM neural network. The LSTM neural network captures the long-term dependencies in the time series and learns the evolution of the state of the energy storage device over time.
[0069] Specifically, in the CNN_LSTM model, a convolutional neural network (CNN) is used to extract features from the preprocessed data. The CNN network includes a convolutional layer, a pooling layer, and a fully connected layer. The spatial features in the input data are extracted through structures such as the convolutional layer and the pooling layer.
[0070] In this embodiment, the convolution layer slides on the input data through a 7*1 sliding window (convolution kernel) and performs a convolution operation (i.e., point multiplication followed by summation) at each position. The convolution layer extracts local features in the time series through a one-dimensional convolution (Conv1D). The parameters (weights and biases) of the convolution kernel are updated during the training process through the back-propagation algorithm to learn how to extract useful features.
[0071] Different convolution kernels can extract different features. For example, some convolution kernels may be sensitive to the trend of temperature data, while others may be sensitive to the fluctuation of temperature data. These features form feature maps after the convolution layer, and each feature map contains the feature representation of the input data at each time point.
[0072] The pooling layer follows the convolutional layer and is used to downsample the feature map to reduce the spatial dimension of the data, thereby reducing the amount of calculation and preventing overfitting. In this embodiment, the maximum pooling layer (MaxPooling1D) is used to further reduce the dimension of the data and retain key features.
[0073] After the convolution layer, a nonlinear activation function (such as ReLU) is applied to increase the nonlinear expression ability of the network. The activation function maps the output of the convolution layer to a nonlinear space, enabling the network to learn more complex feature representations.
[0074] Spatial features in CNN networks usually refer to the feature information represented by each position on the feature map. In battery temperature data processing, these spatial features may represent specific patterns or trends of temperature data at different time scales, different locations, or different conditions. For example, some features may correspond to periodic changes, mutation points, or long-term trends in temperature data. These spatial features are crucial for subsequent prediction, classification, or recognition tasks because they provide a rich and abstract representation of the input data.
[0075] The CNN_LSTM model of this embodiment adds an LSTM neural network between the pooling layer and the fully connected layer of the CNN network. The feature sequence after the pooling operation of the CNN network is input into the LSTM neural network, and the LSTM neural network performs information learning of the time series. Finally, it is connected to the fully connected layer of the neural network to output the predicted value of the load temperature over the time series.
[0076] like Figure 3 As shown, the input data of the neural network in this embodiment is the temperature data of the energy storage device with a single feature. The data is sampled every 1 minute, so there are 1440 sampling time points in a day. The temperature data is a typical time series data. This data is based on a day as a cycle, so 1440 points are taken as the data input, and the input data dimension is 1440×1. First, a one-dimensional convolution operation is performed on the temperature data. It can be seen from the previous that the data after the one-dimensional convolution operation is an N×1-dimensional data. In the figure, a one-dimensional convolution operation is performed using a (7,1) convolution kernel, so an N×1-dimensional data is obtained; that is, a data channel number of 1, length and width of N×1 is obtained. Then a one-dimensional pooling operation is performed on the convolved data. Finally, the feature structure extracted by the convolutional neural network is input into the LSTM neural network, and the LSTM neural network learns the information of the time series, and finally connects to the fully connected layer at the end of the neural network structure. The fully connected layer predicts the previously extracted and learned features, and finally outputs the predicted value.
[0077] The LSTM neural network captures long-term dependencies in time series through its unique gating mechanism and learns the evolution of device status over time.
[0078] The gating mechanism of LSTM mainly includes three types of gates: forget gate, input gate and output gate, as well as a memory cell. These gates and memory cells work together to enable LSTM to effectively control the flow and storage of information. The forget gate determines which information should be discarded or retained from the memory cell. If the temperature data in a certain period of time is abnormal (such as sensor failure causing incorrect readings), the forget gate will choose to discard this part of the information through the calculation result of the sigmoid function to avoid affecting the subsequent prediction accuracy. The input gate determines which new information should be added to the memory cell. The output gate determines that the information in the memory cell is output to the hidden state. In temperature prediction, the output gate can help the LSTM neural network model generate the current hidden state based on the information in the memory cell, and this hidden state can be used in subsequent prediction tasks.
[0079] The LSTM neural network uses a Sequential model to linearly stack Conv1D layers, LSTM layers, and Dense layers. Specifically, the Conv1D layer sets 64 filters, each with a size of 2, and uses ReLU as the activation function; the LSTM layer contains 50 LSTM units to process the time dependency in the feature sequence input to the LSTM neural network; the Dense layer outputs the predicted temperature, and the output dimension is 1.
[0080] Step 3: Train the CNN_LSTM model. Reshape the feature data of the training set into a three-dimensional array of sample number, time step, and feature number, and input it into the CNN_LSTM model for training. Use the Adam optimizer to optimize the weights and biases of the model. Verify the loss values of the training set and validation set by minimizing the loss function. Calculate and verify the R2 score and MSE.
[0081] As previously recorded in this embodiment, there are a total of 10,679 data points for the temperature data sampled in one week. Each data point contains only one feature, namely the temperature value. Therefore, the initial shape of the sampled data is (10,679,1), and each row represents a temperature value. In order for the CNN_LSTM model to process this data, we need to reshape it into a format suitable for time series input. The CNN_LSTM model usually requires a three-dimensional array with the shape of the number of samples, the time step, and the number of features, where the number of samples represents the number of input sequences in the data set, the time step is the number of data points contained in each sample, that is, the length of each sequence, and the number of features is the number of features for each time step, which only contains a single feature of temperature, so the number of features is 1. Assuming the time step is 10 (it can actually be adjusted as needed), this means that the data input to the model each time is a continuous data sequence of 10 time points. In the CNN_LSTM model, these time series samples are created using the sliding window method: if the time step is 10, the input data of each sample will be the temperature values of 10 consecutive time points. Starting from the first data point, 10 consecutive data points are taken as the first sample. Next, the sliding window moves 1 data point to the right, and the temperature values of the next 10 consecutive time points are taken as the next sample. Repeat this process until the end of the data. In this embodiment, the 10679 temperature data points are selected with a time step of 10, so the number of samples that can be formed = 10679-10+1 = 10670, that is, 10670 samples will be obtained, each sample contains 10 consecutive temperature data points in time steps, and each time step has only 1 temperature data feature. After reshaping, a three-dimensional array with a shape of (10670,10,1) is obtained. This embodiment uses the sliding window method to convert the original 10679 temperature data points into 10670 samples, each sample contains 10 consecutive time point data, and the shape of the data becomes (10670, 10, 1), which meets the input requirements of the CNN_LSTM model. Therefore, according to the input data requirements of the above CNN_LSTM model, whether it is the test set or the training set of the subsequent steps and the load temperature data collected by the temperature sensor during the actual prediction, they are all reshaped into a three-dimensional array of sample number, time step, and feature number as the input of the CNN_LSTM model.
[0082] The data X_train in the training set is reshaped into a three-dimensional array of sample number, time step, and feature number to meet the input requirements of the CNN_LSTM model. When training the CNN_LSTM model, the Adam optimizer is used to optimize the model's weights and biases to minimize the loss function. The Huber Loss function is used to minimize the loss function. The loss values of the training set and the validation set can be obtained by subsequent printing. A total of 30 rounds of training are performed, and a comparison chart of the loss values of the training set and the validation set is generated, as shown in the figure. Figure 4 As shown in the figure. The change trend of the loss value of the CNN_LSTM model on the training set and the validation set with the number of training rounds (Epoch). In the initial stage, the loss value is high, about 0.016, indicating that the CNN_LSTM model has not fully learned the data features. Subsequently, the loss value drops rapidly, indicating that the CNN_LSTM model is learning and optimizing quickly. After about 5 rounds of training, the loss value tends to stabilize and gradually approaches 0, indicating that the performance of the CNN_LSTM model has been significantly improved and has reached saturation. The validation loss value during the training process remains close to the training loss value, which reflects that the CNN_LSTM model performs consistently on the training set and the validation set, without obvious overfitting or underfitting, indicating that the model has strong generalization ability.
[0083] R 2 The scores and mean square error (MSE) are used to obtain the evaluation indicators after the CNN_LSTM model training in this embodiment.
[0084] R 2 The score is a measure of the goodness of the regression model prediction, which is obtained by the following formula to obtain the correlation between the predicted value of the CNN_LSTM model and the actual value. 2 The closer the score is to 1, the better the prediction performance of the model.
[0085]
[0086] Among them, y i is the actual value of the validation set, is the predicted value, is the mean of the actual values, and n is the number of samples in the training set and the validation set.
[0087] The mean square error (MSE) is the square root of the average of the squared errors between the predicted value and the actual value of the validation set. It indicates the deviation of the predicted value. The smaller the value, the better the prediction performance of the model.
[0088]
[0089] Among them, y i is the actual value of the validation set, is the predicted value, is the mean of the actual values, and n is the number of samples.
[0090] The R of the CNN_LSTM model in this embodiment is obtained from the above formula: 2The score is 0.9994, which means that the model fits the data well and there is a high correlation between the predicted values and the actual values. The MSE is 0.0053, which indicates that the difference between the predicted values and the actual values of the model is very small and the prediction performance of the model is good.
[0091] The judgment criteria are implemented through the Adam optimizer algorithm. The loss values of the training set and the validation set gradually decrease as the training progresses, indicating that the model is learning and adapting to the data. The closer the calculation result is to zero, the better the effect. Finally, save the trained model. Name the saved trained model CNN_LSTM_model.h5 for easy call in subsequent predictions.
[0092] Step 4: Use the test set to predict the trained CNN_LSTM model.
[0093] Load the trained model CNN_LSTM_model.h5, predict the test set X_test, and input the test set X_test into the model CNN_LSTM_model.h5, reshape it into a three-dimensional array input of the number of samples, time steps, and number of features as the training set X_train, and then denormalize the model prediction results. Because in the previous data preprocessing stage, we normalized the original temperature data so that all temperature data fall in the [0,1] interval, which is conducive to improving the model operation performance and efficiency. In the output stage, the real temperature needs to be used, so denormalization is performed. This embodiment uses the inverse_transform method for denormalization to restore the predicted temperature data to the original scale, and calls the Matplotlib.pyplot library to generate a comparison chart of the test set X_test (real value) and the predicted value.
[0094] like Figure 5 As shown in the figure, the contrast between the predicted temperature and the actual temperature is clearly shown. The dotted line closely tracks the changes in the actual temperature, showing the real fluctuations in temperature during the day. The solid line represents the predicted temperature, which closely follows the blue line, especially during periods when the temperature fluctuations are relatively gentle, and the two almost overlap. Although there are slight differences between the predicted and actual values at certain time points, especially during periods when the temperature is low or changes are more drastic, the prediction model performs quite well overall. This high degree of overlap shows that the prediction model has high accuracy and reliability, and can accurately predict future temperature trends.
[0095] In this embodiment, after obtaining the predicted temperature of the energy storage cabinet load temperature through the CNN_LSTM model, the PID control unit determines the proportional term P of the PID control according to the following formula:
[0096] P=Kp×e(t)
[0097] Among them, e(t) is the error between the predicted temperature at the current moment and the target temperature of the energy storage device, and Kp is the proportional coefficient of the PID control unit, which reflects the proportional gain of the current error.
[0098] Initially, you can choose a smaller Kp value to start with, gradually increase it, and observe the system response. If the system is slow to respond or the steady-state error is large, you can increase Kp appropriately. If the system oscillates or is unstable, you should reduce Kp appropriately. The larger the Kp, the more aggressive the regulation; reducing Kp will make the regulation more conservative. Increasing the proportional coefficient can make the system more responsive, speed up the regulation, and reduce the steady-state error.
[0099] The integral term I of PID control is determined according to the following formula:
[0100]
[0101] in, It represents the accumulated error from time 0 to the current time t, Ki is the integral coefficient of the PID control unit, and represents the integral gain considering past errors.
[0102] When a PID control system has a steady-state error, the error can be reduced by increasing Ki. However, an excessively large Ki may cause the system to respond more slowly or produce overshoot, so it needs to be adjusted according to the actual situation. At the same time, it is necessary to set an integral limit to prevent the system from losing control due to excessive integral in the initial stage. Integral control can eliminate the error in the static state of PID control and make the controlled physical quantity as close to the target value as possible.
[0103] Determine the differential term D of PID control according to the following formula:
[0104]
[0105] in, It represents the rate of change of the error within time t, Kd is the differential coefficient of the PID control unit, and represents the differential gain of the future error.
[0106] When fluctuations or overshoots occur during the response of the PID control system, the fluctuations or overshoots can be reduced by increasing Kd. However, too large Kd may make the system sensitive to noise and produce unnecessary adjustment actions, so it is necessary to make a trade-off based on the actual situation. Differential control can predict the changing trend of the PID control error and make adjustments in advance, thereby reducing overshoot and stabilization time.
[0107] The proportional term P, the integral term I and the differential term D are added together by the following formula to obtain the control input data u(t) fed back by the PID control unit to the temperature control system:
[0108]
[0109] See again Figure 1 The energy storage cabinet temperature control system of this embodiment includes a heating unit and a refrigeration unit. If the control input data u(t) is a positive value, it means that the target temperature is higher than the actual temperature, and the temperature error e(t) between the current predicted temperature and the target temperature of the energy storage device is a positive value. The feedback control heating unit increases the heat output and improves the actual load temperature of the energy storage device. If the control input data u(t) is a negative value, it means that the target temperature is lower than the actual temperature, and the temperature error e(t) between the current predicted temperature and the target temperature of the energy storage device is a negative value. The feedback control heating unit reduces the heat output, or turns off the heating unit and turns on the refrigeration unit to reduce the actual load temperature of the energy storage device. Finally, the heating / refrigeration units coordinate to adjust the load temperature of the energy storage cabinet to achieve precise control of the load temperature.
[0110] In this document, the directions or positional relationships indicated by terms such as "up", "down", "front", "back", "left", "right", "top", "bottom", "inside", "outside", "vertical", and "horizontal" are based on the directions or positional relationships shown in the accompanying drawings and are only for the clarity of expressing the technical solutions and the convenience of description, and therefore should not be understood as limitations of the present invention.
[0111] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0112] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A temperature control method for energy storage equipment based on CNN_LSTM, characterized in that: The temperature sensor collects the load temperature of the energy storage device and inputs it into the trained CNN_LSTM model for temperature prediction. The predicted temperature is output, and the error between the predicted temperature and the target temperature of the energy storage device is used as the feedforward input data of the PID control unit. The PID control unit inputs the data to the temperature control system of the energy storage device according to the error feedback control to adjust the load temperature.
2. The energy storage device temperature control method based on CNN_LSTM according to claim 1, characterized in that: The CNN_LSTM model is trained through the following steps: Step 1: Collect the original data of the load temperature of the energy storage device at a set frequency within the collection period, clean and normalize the original data collected in step 1, and classify and construct a training set, a verification set, and a test set; Step 2: construct a CNN_LSTM model, wherein the CNN_LSTM model uses a CNN network to extract spatial features from the preprocessed training set data, inputs the feature sequence extracted by the CNN network into the LSTM neural network, captures the long-term time dependency in the feature sequence through the LSTM neural network, and learns the evolution of the state of the energy storage device over time; Step 3: Train the CNN_LSTM model. Reshape the feature sequence of the training set into a three-dimensional array of sample number, time step, and feature number, and then input it into the CNN_LSTM model for training. Use the Adam optimizer to optimize the weights and biases of the model. Verify the loss value, R2 score, and MSE of the training set and validation set by minimizing the loss function. Step 4: Use the test set to predict the trained CNN_LSTM model. The test set and the load temperature data collected by the actual prediction temperature sensor are reshaped into a three-dimensional array of sample number, time compensation, and feature number and input into the CNN_LSTM model for prediction.
3. The energy storage device temperature control method based on CNN_LSTM according to claim 2 is characterized in that: In the step 1, the raw data is cleaned by using moving average to remove noise, mean value to fill missing values or IQR rule to remove outliers; In the moving average noise removal, a window with a size of 3 is used to perform moving average processing on the temperature data column of the load temperature original data to generate a new temperature data column; In the method of filling missing values with mean, the mean of the temperature data column of the original load temperature data is calculated, and the mean is used to fill missing values, thereby generating a new temperature data column; In the IQR rule for removing outliers, the difference between the third quartile Q3 and the first quartile Q1 in the temperature data column is calculated to obtain the IQR, and outliers are identified and removed according to the IQR rule.
4. The energy storage device temperature control method based on CNN_LSTM according to claim 2 is characterized in that: In the step 1, the normalized original data set is divided into a training set and a temporary set, wherein the training set accounts for 40% of the total data, and the temporary set is further divided into a validation set and a test set, wherein the validation set and the test set each account for 50% of the temporary set.
5. The energy storage device temperature control method based on CNN_LSTM according to claim 2, characterized in that: In the CNN_LSTM model, an LSTM neural network is added between the pooling layer and the fully connected layer of the CNN network, and the feature sequence after the pooling operation of the CNN network is input into the LSTM neural network, and the LSTM neural network performs information learning of the time series, and finally accesses the fully connected layer of the neural network to output the predicted value of the load temperature over the time series.
6. The energy storage device temperature control method based on CNN_LSTM according to claim 5 is characterized in that: In the CNN_LSTM model, the LSTM neural network uses a Sequential model to linearly stack Conv1D layers, LSTM layers, and Dense layers; The Conv1D layer sets 64 filters, each filter has a size of 2, and the activation function uses ReLU; The LSTM layer includes 50 LSTM units to process the time dependency in the feature sequence input into the LSTM neural network; The Dense layer outputs the predicted temperature.
7. The energy storage device temperature control method based on CNN_LSTM according to claim 2, characterized in that: In the step 4, the prediction result output by the CNN_LSTM model is denormalized using the inverse_transform method to restore the prediction result to the same data form as the original data of the load temperature.
8. The energy storage device temperature control method based on CNN_LSTM according to claim 1, characterized in that: The PID control unit determines the proportional term P of the PID control according to the following formula: P=Kp×e(t) Wherein, e(t) is the error between the predicted temperature at the current moment and the target temperature of the energy storage device, and Kp is the proportional coefficient of the PID control unit; The integral term I of PID control is determined according to the following formula: in, Represents the error accumulation from time 0 to the current time t, Ki is the integral coefficient of the PID control unit; Determine the differential term D of PID control according to the following formula: in, It represents the rate of change of error within time t, and Kd is the differential coefficient of the PID control unit; The proportional term P, the integral term I and the differential term D are added together by the following formula to obtain the control input data u(t) fed back by the PID control unit to the temperature control system:
9. The energy storage device temperature control method based on CNN_LSTM according to claim 8, characterized in that: The temperature control system includes a heating unit and a refrigeration unit. If the control input data u(t) is a positive value, the heating unit is feedback-controlled to increase the heat output and improve the actual load temperature of the energy storage device; if the control input data u(t) is a negative value, the heating unit is feedback-controlled to reduce the heat output, or the heating unit is turned off and the refrigeration unit is turned on to reduce the actual load temperature of the energy storage device.
10. Energy storage equipment temperature control system based on CNN_LSTM, characterized by: The energy storage device temperature control method according to any one of claims 1 to 8 comprises: Temperature sensor, collecting the load temperature of the energy storage device; The CNN_LSTM temperature prediction unit is equipped with a trained CNN_LSTM model to predict the load temperature of the energy storage device collected by the temperature sensor and output the predicted temperature; The PID control unit uses the error between the predicted temperature and the target temperature of the energy storage device as a feedforward input, feeds back the control input data to the temperature control system of the energy storage device, and adjusts the load temperature.
Citation Information
Patent Citations
Method, device and equipment for controlling refrigerant fluid flow of liquid cooling cabinet
CN118870766A
Temperature control method and device for UV LED module
CN118890741A
Millimeter wave mMIMO channel estimation method and system based on neural network
CN119071109A
Intelligent control of spunlace production line using classification of current production state of real-time production line data
US11853019B1
Apparatus for generating temperature prediction model and method for providing simulation environment
US20210056384A1
Cited By
Method and system for improving rereading stability of NAND flash memory in wide-temperature environment
CN120723165A
NAND flash read disturb stability improvement method and system under wide temperature environment
CN120723165B
Dummy supporting plate cooling system based on vehicle evaluation
CN120803121A
Low-temperature measured value traceability method based on LSTM and multimode calibration system
CN120907695A
Intelligent equipment temperature control method and device, equipment, medium and program product
CN121070157A