Energy storage device temperature control method and system based on cnn_lstm
By introducing a CNN_LSTM model combined with PID control into energy storage devices, the problems of low accuracy and poor adaptability of PID control in temperature control of energy storage devices are solved, and precise temperature control of energy storage devices and improved system robustness are achieved.
Patent Information
- Application Number
- CN202411956597.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-29
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-12-29
AI Technical Summary
Existing PID control methods suffer from low control accuracy, complex parameter tuning, poor adaptability to complex systems, and inability to handle multivariable coupling issues in temperature control of energy storage devices.
A CNN_LSTM-based temperature control method is adopted. Data is collected by temperature sensors for training, and the CNN_LSTM model is used to predict the temperature. The PID control unit is then used for feedback adjustment to achieve precise temperature control of the energy storage device.
It improves the accuracy and adaptability of temperature control in energy storage devices, simplifies the parameter tuning process, can handle complex nonlinear and multivariable coupling relationships, and ensures the robustness and automation of the system.
Smart Images

Figure CN119806240B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a temperature control method and system for energy storage devices based on CNN_LSTM, belonging to the field of intelligent control technology for energy storage devices. Background Technology
[0002] Energy storage devices require precise temperature control to maintain safe and stable operation. Existing temperature control schemes for energy storage devices widely employ PID control. PID control, with its advantages of simple structure, ease of implementation, and good stability, has been widely used in industrial control. However, with the increasing complexity of power / electronic equipment and the rising precision requirements, traditional PID control methods have gradually revealed problems such as insufficient control accuracy and poor adaptability to nonlinear and dynamic changes.
[0003] Taking a liquid chiller that maintains the operating temperature of batteries within an energy storage cabinet as an example, its controlled objects are often multi-featured rather than single-featured, such as battery temperature, and the flow rate and velocity of the coolant and refrigerant. Furthermore, these features are acquired through analog signals collected by sensors and then transmitted to the control terminal via multiple bundles of winding signal lines. This lengthy process results in poor signal interference resistance; the accuracy of different sensors also varies significantly. Moreover, the signals generated within the liquid chiller are typically complex, nonlinear, and rapidly changing. This is because the environments in which liquid chillers are used are highly variable, signal acquisition is susceptible to various factors, and the signals exhibit strong coupling, such as fluctuations in grid load, weather changes, and interference from surrounding magnetic fields.
[0004] Therefore, using PID control alone for the operating temperature control of current energy storage devices has the following shortcomings:
[0005] 1. Complex parameter tuning. The performance of a PID controller largely depends on the tuning of its three parameters (proportional coefficient Kp, integral coefficient Ki, and derivative coefficient Kd). The tuning process for these parameters is often complex, requiring extensive experience and trial-and-error methods, and the optimal parameters can vary significantly between different systems. Improper parameter tuning can lead to problems such as system overshoot, oscillation, or slow response.
[0006] 2. Poor adaptability to complex systems. PID controllers are poorly adapted to nonlinear, time-varying, or uncertain systems, which are often difficult to describe with simple linear models, thus significantly reducing the effectiveness of PID controllers. In rapidly changing systems or applications requiring high-precision control, PID controllers may fail to meet the requirements.
[0007] 3. Inability to handle multivariable coupling. In multivariable control systems, there are often coupling relationships between variables. PID controllers encounter difficulties when handling such systems because they typically only control a single variable. Summary of the Invention
[0008] The technical problem solved by this invention is to address the issues of low control accuracy and slow response when applying PID control methods to the operation of existing energy storage devices, and to provide a temperature control method and system for energy storage devices based on CNN_LSTM.
[0009] This invention is achieved using the following technical solution:
[0010] This invention first discloses a temperature control method for energy storage devices based on CNN_LSTM. A temperature sensor collects the load temperature of the energy storage device and inputs it into a trained CNN_LSTM model for temperature prediction, outputting the predicted temperature. 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 controls the input data to the temperature control system of the energy storage device to adjust the load temperature based on the error feedback.
[0011] In the CNN_LSTM-based temperature control method for energy storage devices of the present invention, the CNN_LSTM model is further trained through the following steps:
[0012] Step 1: Collect raw load temperature data of the energy storage device at a set frequency within the collection period. Clean and normalize the raw data collected in Step 1, and classify and construct training set, validation set and test set.
[0013] Step 2: Construct a CNN_LSTM model. The CNN_LSTM model uses a CNN network to extract spatial features from the preprocessed training set data. The feature sequences extracted by the CNN network are input into the LSTM neural network. The LSTM neural network captures the long-term time dependencies in the feature sequences and learns the evolution of the energy storage device's state 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 model's weights and biases. Validate the loss values, R2 scores, and MSE of the training and validation sets by minimizing the loss function.
[0015] Step 4: Predict the trained CNN_LSTM model using the test set. The test set and the load temperature data collected by the actual temperature sensor are both reconstructed 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 CNN_LSTM-based temperature control method for energy storage devices of the present invention, further, in step one, 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 process, a window of size 3 is used to perform a moving average on the temperature data column of the original load temperature data, generating a new temperature data column.
[0018] In the process of filling missing values with the 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 to generate 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 temperature control method for energy storage devices of the present invention, further, in step one, the normalized original dataset 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.
[0021] In the CNN_LSTM-based temperature control method for energy storage devices 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. The feature sequence after pooling operation of the CNN network is input into the LSTM neural network, which performs time series information learning. Finally, it is connected to the fully connected layer of the neural network to output the predicted value of the load temperature over time.
[0022] In the CNN_LSTM-based temperature control method for energy storage devices of the present invention, further, in the CNN_LSTM model, the LSTM neural network uses a Sequential model to linearly stack Conv1D layers, LSTM layers and Dense layers.
[0023] The Conv1D layer has 64 filters, each with a size of 2, and uses ReLU as the activation function.
[0024] The LSTM layer contains 50 LSTM units to process the time dependencies in the feature sequences input to the LSTM neural network.
[0025] The Dense layer outputs the predicted temperature.
[0026] In the CNN_LSTM-based temperature control method for energy storage devices of the present invention, further, in step four, the prediction results output by the CNN_LSTM model are denormalized using the inverse_transform method to restore the prediction results to the same data form as the original load temperature data.
[0027] In the CNN_LSTM-based temperature control method for energy storage devices of the present invention, the PID control unit further determines the proportional term P of the PID control according to the following formula:
[0028] P = Kp × e(t)
[0029] Where 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 the PID control is determined according to the following formula:
[0031]
[0032] in, This represents the cumulative error from time 0 to the current time t, where Ki is the integral coefficient of the PID control unit.
[0033] The derivative term D of the PID control is determined according to the following formula:
[0034]
[0035] in, Kd represents the rate of change of error within time t, and Kd is the differential coefficient of the PID control unit.
[0036] The control input data u(t) fed back to the temperature control system by the PID control unit is obtained by adding the proportional term P, integral term I, and derivative term D using the following formula:
[0037]
[0038] In the CNN_LSTM-based temperature control method for energy storage devices of the present invention, the temperature control system further includes a heating unit and a cooling unit. If the control input data u(t) is positive, the feedback control of the heating unit increases the heat output, thereby increasing the actual load temperature of the energy storage device. If the control input data u(t) is negative, the feedback control of the heating unit decreases the heat output, or turns off the heating unit and turns on the cooling unit, thereby reducing the actual load temperature of the energy storage device.
[0039] This invention also discloses a temperature control system for energy storage devices based on CNN_LSTM, which employs the aforementioned temperature control method for energy storage devices based on CNN_LSTM, comprising:
[0040] Temperature sensors collect the load temperature of energy storage devices;
[0041] The CNN_LSTM temperature prediction unit, equipped with a trained CNN_LSTM model, predicts the load temperature of the energy storage device collected by the temperature sensor and outputs 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 to feed back control input data to the temperature control system of the energy storage device, thereby adjusting the load temperature.
[0043] The present invention, by adopting the above technical solution, has the following beneficial effects:
[0044] (1) Considering that the temperature change of energy storage equipment 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, this complexity leads to highly nonlinear temperature changes. Therefore, this invention uses a CNN_LSTM model, a combination of CNN and LSTM networks, to predict the load temperature of energy storage equipment. The CNN_LSTM model has strong learning and nonlinear mapping capabilities for time-series data. This hybrid CNN_LSTM model captures the nonlinear relationships in the temperature changes of energy storage equipment. By combining it with a PID control unit, the CNN_LSTM model can learn the dynamic characteristics of the temperature data of the energy storage equipment and adjust the parameters of the PID control system in real time to adapt to changes in the power supply system. This eliminates the cumbersome manual parameter tuning process of the temperature control system, improving the automation and robustness of the energy storage equipment temperature control system.
[0045] (2) Temperature changes in energy storage devices exhibit significant time dependence; past temperatures and load operating conditions have a lag effect on current temperatures. For example, when the device load suddenly increases, the temperature may not rise significantly until several minutes later. This invention employs an LSTM time series model with memory capabilities to capture the lag relationships and long-short-term dependencies in the temperature data of energy storage devices. For scenarios with significant delay effects, the time window length is adjusted to ensure that the model can learn the lag relationships.
[0046] (3) Temperature sensors in energy storage devices may be affected by the environment, electromagnetic interference, or equipment aging, leading to occasional anomalies or long-term drift. The CNN_LSTM model in this invention uses moving average to remove noise, mean to fill missing values, or IQR rules to detect and remove outliers; a loss function is added to the model design instead of the MAE used in conventional models to reduce the impact of outliers in the temperature data of energy storage devices.
[0047] (4) This invention optimizes the temperature parameters of energy storage devices by combining a CNN_LSTM neural network with PID control technology. The CNN_LSTM neural network can handle complex nonlinear relationships and long-term dependencies. By introducing the CNN_LSTM model into PID control to predict the load temperature of the energy storage device, the system predicts future trends based on historical data and current status, and adjusts the control strategy in advance to address potential problems. This can significantly improve the system's adaptability to nonlinear, time-varying, and uncertain systems of energy storage devices, avoid the impact of excessive static errors, and ensure accurate system output.
[0048] In summary, the CNN_LSTM-based temperature control method and system for energy storage devices provided by this invention combine a convolutional neural network (CNN) with a long short-term memory network (LSTM) to process and predict the load temperature of energy storage devices. This method has a strong ability to process time-series data, extract features, and capture long-term dependencies, demonstrating significant advantages in fields such as load temperature prediction and equipment status monitoring for energy storage devices.
[0049] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0050] Figure 1 This is a schematic diagram of the temperature control system of the energy storage device in the embodiment.
[0051] Figure 2 This is a flowchart of the temperature control method for the energy storage device in the embodiment.
[0052] Figure 3 This 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 validation set during the training of CNN_LSTM in the example.
[0054] Figure 5 This is a comparison chart of the actual and predicted values of the test set after training the CNN_LSTM in the example. Detailed Implementation
[0055] Example
[0056] See Figure 1The figure shows a schematic diagram of the temperature control system for energy storage devices based on CNN_LSTM according to the present invention. The system is based on a PID control system and introduces a CNN_LSTM model for temperature prediction. Specifically, it includes a temperature sensor, a CNN_LSTM temperature prediction unit, and a PID control unit. The temperature sensor collects the load temperature of the energy storage device. The CNN_LSTM temperature prediction unit carries a trained CNN_LSTM model to predict the load temperature of the energy storage device collected by the temperature sensor and outputs the predicted temperature Tp, which is transmitted 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 the 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, and finally achieves precise control of the load temperature.
[0057] Specifically, such as Figure 2 As shown, the CNN_LSTM model used in this embodiment is trained through the following steps:
[0058] Step 1: Collect raw load temperature data of the energy storage device at a set frequency within the collection period. Clean and normalize the raw data collected in Step 1, and classify and construct training set, validation set and test set.
[0059] Taking the actual data of a library energy storage cabinet unit in Jishou as an example, the battery temperature change data of the energy storage cabinet for seven days in a week was collected by the water outlet temperature sensor at the load end of the energy storage cabinet as the raw load temperature data. The data was required to be sampled once every 1 minute, for a total of 10,679 data points.
[0060] The original data was cleaned by moving average to remove noise, mean to fill missing values, and IQR rule to remove outliers.
[0061] Moving average noise reduction is a commonly used smoothing technique that works by applying a fixed-size window to the data and calculating the average value of the data within the window. This example uses a window of size 3 to perform a moving average 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, making it smoother.
[0062] Mean filling is a simple method for filling missing values by using the mean of the data to replace the missing values. In this example, the mean of the temperature data in the "value" column is calculated and used to fill the missing values, generating a new temperature data column "value_filled".
[0063] IQR (Interquartile Range) is a statistic used to measure the dispersion of data. It represents the difference between the third quartile (Q3) and the first quartile (Q1). This embodiment uses the IQR rule to remove outliers. The IQR is calculated by taking the difference between the third quartile (Q3) and the first quartile (Q1) in the temperature data in the "value_filled" column. According to the IQR rule, data points below Q1 - 1.5IQR or above Q3 + 1.5IQR are identified as outliers and removed.
[0064] The combination of the three data cleaning methods mentioned above is very useful in processing load temperature time series data of energy storage devices, which helps to improve data quality and the effect of subsequent model training.
[0065] After cleaning the original data, the train_test_split function is used to divide the normalized original dataset into a training set and a temporary set, with the training set accounting for 40% of the total data. The temporary set is then further divided into a validation set and a test set, with the validation set and test set each accounting for 50% of the temporary set.
[0066] First, create a feature set X[] and a target variable set Y[], where the target variable is the feature data for predicting temperature. Here, we use temperature data from the past 60 time points to predict the temperature at the next time point. X[] is a list of temperature values, where each element is an array containing the temperature values from the past 60 time points. Y[] is a list of temperature values corresponding to time points, where each element is a temperature value representing the temperature at the next time point given the temperatures from the past 60 time points, i.e., the predicted future temperature value. Use the `train_test_split` function to split the collected raw dataset into a training set and a temporary set, with the test set accounting for 40% of the total data. Next, split the temporary set again into a validation set and a test set, with the validation set accounting for 50% of the temporary set (30% of the total data) and the test set also accounting for 30% of the total data. The purpose of splitting the dataset in this way is to have an independent validation set to adjust the model parameters during model training, and a test set to evaluate the model's performance.
[0067] The data is then normalized to ensure consistency in the units of measurement across different features, improving the model's convergence speed and performance. Finally, the data is categorized: the first 40% (X_train, Y_train) serves as the training set, the next 30% (X_val, Y_val) as the validation set, and the last 30% (the ground truth values) (X_test, Y_test) as the test set. Here, X and Y represent the feature data and label data from the original dataset.
[0068] Step 2: Construct a CNN_LSTM model. The CNN_LSTM model uses a CNN network to extract features from the preprocessed data. It extracts spatial features from the input data through structures such as convolutional layers and pooling layers. The feature sequences extracted by the CNN network are input into the LSTM neural network. The LSTM neural network captures long-term dependencies in the time series and learns the evolution of the energy storage device's state 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 convolutional layers, pooling layers, and fully connected layers. Spatial features in the input data are extracted through structures such as convolutional layers and pooling layers.
[0070] In this embodiment, the convolutional layer slides across the input data using a 7*1 sliding window (convolutional kernel) and performs a convolution operation (i.e., summation after dot product) at each position. The convolutional layer extracts local features from the time series through one-dimensional convolution (Conv1D). The parameters (weights and biases) of the convolutional kernel are updated during training using a backpropagation algorithm to learn how to extract useful features.
[0071] Different convolutional kernels can extract different features. For example, some convolutional 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 convolutional layers, and each feature map contains the feature representation of the input data at various time points.
[0072] Pooling layers follow convolutional layers and are used to downsample feature maps to reduce the spatial dimensionality of the data, thereby reducing computational cost and preventing overfitting. In this embodiment, a max-pooling layer (MaxPooling1D) is used to further reduce the dimensionality of the data while preserving key features.
[0073] After the convolutional layers, non-linear activation functions (such as ReLU) are applied to enhance the network's non-linear expressive power. The activation function maps the output of the convolutional layer to a non-linear space, enabling the network to learn more complex feature representations.
[0074] In CNN networks, spatial features typically refer to the feature information represented at each location on the feature map. In battery temperature data processing, these spatial features may represent specific patterns or trends in temperature data across different time scales, locations, or conditions. For example, some features may correspond to periodic changes, abrupt changes, 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] In this embodiment, the CNN_LSTM model adds an LSTM neural network between the pooling layer and the fully connected layer of the CNN network. The feature sequence after pooling operation of the CNN network is input into the LSTM neural network, which learns the information 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 time.
[0076] like Figure 3 As shown, in this embodiment, the input data for the neural network is the temperature data of a single-feature energy storage device. The data is sampled every minute, resulting in 1440 sampling points per day. Temperature data is typical time-series data, with a daily cycle; therefore, 1440 points are used as the input, resulting in a 1440×1 dimension. First, a one-dimensional convolution operation is performed on the temperature data. As previously mentioned, the data after the one-dimensional convolution operation is an N×1 dimension data. In the figure, a (7,1) convolution kernel is used for the one-dimensional convolution operation, resulting in one N×1 dimension data; that is, a data with one channel and N×1 length and width. Then, a one-dimensional pooling operation is performed on the convolutional data. Finally, the feature structure extracted by the convolutional neural network is input into the LSTM neural network, which learns the time-series information. A fully connected layer is then connected at the end of the neural network structure to predict the extracted and learned features, ultimately outputting the predicted value.
[0077] LSTM neural networks capture long-term dependencies in time series through their unique gating mechanism, learning how device states evolve over time.
[0078] The gating mechanism of LSTM mainly includes three types of gates: the forget gate, the input gate, and the output gate, as well as a memory cell. These gates and the memory cell 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 for a certain period is abnormal (e.g., a sensor malfunction causing incorrect readings), the forget gate will discard this information based on the calculation result of the sigmoid function to avoid affecting the accuracy of subsequent predictions. The input gate determines which new information should be added to the memory cell. The output gate determines whether the information in the memory cell is output to the hidden state. In temperature prediction, the output gate helps 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 has 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 temporal dependencies in the feature sequences input to the LSTM neural network; and the Dense layer outputs the predicted temperature with an output dimension of 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 then input it into the CNN_LSTM model for training. Use the Adam optimizer to optimize the model's weights and biases. Validate the loss values of the training and validation sets by minimizing the loss function, and calculate and validate the R2 score and MSE.
[0081] As described earlier in this embodiment, the temperature data sampled over one week totals 10,679 data points. Each data point contains only one feature, namely the temperature value. Therefore, the initial shape of the sampled data is (10679, 1), with each row representing a temperature value. To enable the CNN_LSTM model to process this data, we need to reshape it into a format suitable for time series input. CNN_LSTM models typically require a three-dimensional array with the shape of the number of samples, the time step, and the number of features. The number of samples represents the number of input sequences in the dataset, the time step is the number of data points contained in each sample, i.e., the length of each sequence, and the number of features is the number of features per time step. Here, only the single feature of temperature is included, so the number of features is 1. Assuming the time step is 10 (which can be adjusted as needed), this means that each time the data is input to the model, it is a data sequence of 10 consecutive time points. In the CNN_LSTM model, these time series samples are created using a sliding window method: for example, when the time step is 10, the input data for 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 one data point to the right and takes the temperature values of the next 10 consecutive time points as the next sample, repeating this process until the end of the data. In this example, 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 containing temperature data points of 10 consecutive time steps, with only one temperature data feature per time step. After reshaping, a three-dimensional array with the shape (10670, 10, 1) is obtained. In this embodiment, the original 10679 temperature data points are transformed into 10670 samples using a sliding window method. Each sample contains 10 consecutive time points, and the data shape becomes (10670, 10, 1), which meets the input requirements of the CNN_LSTM model. Therefore, according to the above input data requirements of the CNN_LSTM model, whether it is the test set, the training set for subsequent steps, or the load temperature data collected by the temperature sensor during actual prediction, all are reconstructed into a three-dimensional array of sample number, time step, and feature number as input to the CNN_LSTM model.
[0082] The training data X_train is reshaped into a three-dimensional array of sample number, time step, and feature number to suit the input requirements of the CNN_LSTM model. During training, 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 for the training and validation sets are then printed. The training run is repeated for 30 epochs, and a comparison graph of the loss values for the training and validation sets is generated. Figure 4 As shown, the loss values of the CNN_LSTM model on the training and validation sets change with the number of training epochs. Initially, the loss value is high, approximately 0.016, indicating that the CNN_LSTM model has not yet fully learned the data features. Subsequently, the loss value decreases rapidly, showing that the CNN_LSTM model is learning and optimizing quickly. After about 5 epochs of training, the loss value stabilizes and gradually approaches 0, indicating that the performance of the CNN_LSTM model has significantly improved and is approaching saturation. The validation loss value during training remains close to the training loss value, reflecting the consistent performance of the CNN_LSTM model on both the training and validation sets, without obvious overfitting or underfitting, indicating that the model has strong generalization ability.
[0083] With R 2 The scores and mean squared error (MSE) are used to obtain the evaluation metrics after training the CNN_LSTM model in this embodiment.
[0084] R 2 The score is a measure of the goodness of a regression model's predictions; it is calculated using the following formula to obtain the correlation between the predicted values and the actual values from the CNN_LSTM model. R 2 The closer the score is to 1, the better the model's predictive performance.
[0085]
[0086] Among them, y i It is the actual value of the validation set. It is a predicted value. is the mean of the actual values, and n is the number of samples in the training and validation sets.
[0087] The Mean Squared Error (MSE) is calculated as the square root of the average of the squared errors between the predicted values and the actual values on the validation set. It represents the magnitude of the deviation from the predicted values; a smaller MSE value indicates better predictive performance of the model.
[0088]
[0089] Among them, y i It is the actual value of the validation set. It is a predicted value. is the mean of the actual values, and n is the sample size.
[0090] The R-value of the CNN_LSTM model in this embodiment is obtained from the above formula. 2A score of 0.9994 indicates that the model fits the data well, and there is a high correlation between the predicted and actual values. An MSE of 0.0053 indicates that the difference between the model's predictions and actual values is very small, and the model's predictive performance is excellent.
[0091] The evaluation criteria are implemented using the Adam optimizer algorithm. The loss values on both the training and validation sets gradually decrease as training progresses, indicating that the model is learning and adapting to the data. The closer the calculated loss is to zero, the better the performance. Finally, the trained model is saved. The saved trained model is named CNN_LSTM_model.h5 for easy use in subsequent predictions.
[0092] Step 4: Make predictions using the trained CNN_LSTM model on the test set.
[0093] The trained model CNN_LSTM_model.h5 is loaded, and predictions are made on the test set X_test. The test set X_test is input into the model CNN_LSTM_model.h5 using the same three-dimensional array as the training set X_train, representing the number of samples, time step, and number of features. The model's predictions are then denormalized. Because the original temperature data was normalized in the previous data preprocessing stage, ensuring all temperature data fall within the [0,1] interval, which improves model performance and efficiency, and the output stage requires the actual temperature, denormalization is performed. This embodiment uses the inverse_transform method for denormalization, restoring the predicted temperature data to its original scale. The Matplotlib.pyplot library is then called to generate a comparison plot between the test set X_test (actual values) and the predicted values.
[0094] like Figure 5 As shown, the comparison between predicted and actual temperature values is clearly illustrated. The dashed line closely tracks the actual temperature changes, displaying the true temperature fluctuations throughout the day. The solid line represents the predicted temperature, closely following the blue line, especially during periods of relatively stable temperature fluctuations, where the two almost overlap. Although slight differences exist between predicted and actual values at certain points in time, particularly during periods of lower or more drastic temperature changes, the overall performance of the prediction model is quite excellent. This high degree of overlap indicates that the prediction model has high accuracy and reliability, capable of accurately predicting 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] Where e(t) is the error between the predicted temperature and the target temperature of the energy storage device at the current moment, and Kp is the proportional gain of the PID control unit, reflecting the proportional gain of the current error.
[0098] Initially, a small Kp value can be chosen and gradually increased, observing the system's response. If the system is sluggish or has a large steady-state error, Kp can be increased appropriately. If the system exhibits oscillations or instability, Kp should be decreased appropriately. A larger Kp results in a more aggressive regulatory action; a smaller Kp results in a more conservative regulatory action. Increasing the proportional gain can make the system more responsive, accelerate the regulation speed, and reduce the steady-state error.
[0099] The integral term I of the PID control is determined according to the following formula:
[0100]
[0101] in, This represents the cumulative error from time 0 to the current time t. Ki is the integral coefficient of the PID control unit, representing the integral gain considering past errors.
[0102] When a PID control system exhibits steady-state error, the error can be reduced by increasing Ki. However, an excessively large Ki may slow down the system response or cause overshoot, thus requiring adjustment based on the actual situation. Simultaneously, an integral limit needs to be set to prevent excessively large integral values in the initial stage from causing system runaway. Integral control can eliminate errors in the static state of PID control, allowing the controlled physical quantity to approach the target value as closely as possible.
[0103] The derivative term D of the PID control is determined according to the following formula:
[0104]
[0105] in, It represents the rate of change of error within time t, and Kd is the differential coefficient of the PID control unit, representing the differential gain of the error in the future.
[0106] When fluctuations or overshoot occur during the response of a PID control system, the fluctuations or overshoot can be reduced by increasing Kd. However, an excessively large Kd may cause the system to become sensitive to noise, resulting in unnecessary adjustment actions. Therefore, a trade-off needs to be struck based on the actual situation. Derivative control can predict the changing trend of PID control error and make adjustments in advance, thereby reducing overshoot and settling time.
[0107] The control input data u(t) fed back to the temperature control system by the PID control unit is obtained by adding the proportional term P, integral term I, and derivative term D using the following formula:
[0108]
[0109] See you again Figure 1 The energy storage cabinet temperature control system in this embodiment includes a heating unit and a cooling unit. If the control input data u(t) is positive, it indicates 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 positive. Feedback control then increases the heat output of the heating unit, raising the actual load temperature of the energy storage device. If the control input data u(t) is negative, it indicates 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 negative. Feedback control then reduces the heat output of the heating unit, or shuts down the heating unit and turns on the cooling unit, lowering the actual load temperature of the energy storage device. Ultimately, the heating / cooling units work in coordination to adjust the load temperature of the energy storage cabinet, achieving precise control of the load temperature.
[0110] In this document, the terms "upper," "lower," "front," "back," "left," "right," "top," "bottom," "inner," "outer," "vertical," and "horizontal," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only used for the clarity of expressing the technical solution and for the convenience of description, and therefore should not be construed as limiting the present invention.
[0111] In this document, the terms “including,” “comprising,” or any other variations thereof are intended to cover non-exclusive inclusion, which includes not only the elements listed but also other elements not expressly listed.
[0112] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A temperature control method for energy storage devices based on CNN_LSTM, characterized in that: Temperature sensors collect the load temperature of the energy storage device and input it into a trained CNN_LSTM model for temperature prediction, outputting the predicted temperature. 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 uses the error feedback to control the input data to adjust the load temperature of the energy storage device's temperature control system. The CNN_LSTM model is trained through the following steps: Step 1: Collect raw load temperature data of the energy storage device at a set frequency within the collection period. Clean and normalize the raw data collected in Step 1, and classify and construct training set, validation set and test set. Step 2: Construct a CNN-LSTM model. This model uses a CNN network to extract spatial features from the preprocessed training data. The feature sequences extracted by the CNN network are then input into an LSTM neural network. The LSTM neural network captures the long-term temporal dependencies in the feature sequences, learning the evolution of the energy storage device's state over time. In the CNN_LSTM model, an LSTM neural network is added between the pooling layer and the fully connected layer of the CNN network. The feature sequence after pooling operation of the CNN network is input into the LSTM neural network, which learns the information 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 time. The LSTM neural network uses a Sequential model to linearly stack Conv1D layer, LSTM layer and Dense layer. The Conv1D layer has 64 filters, each with a size of 2, and the activation function is ReLU. The LSTM layer contains 50 LSTM units to process the time dependence in the feature sequence input to the LSTM neural network. The Dense layer outputs the predicted temperature. 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 model's weights and biases. Validate the loss value, R2 score and MSE of the training set and validation set by minimizing the loss function. Step 4: Predict the trained CNN_LSTM model using the test set. The test set and the load temperature data collected by the actual prediction temperature sensor are both reconstructed into a three-dimensional array of sample number, time step and feature number and input into the CNN_LSTM model for prediction.
2. The temperature control method for energy storage devices based on CNN_LSTM according to claim 1, characterized in that: In step one, the cleaning of the raw data is carried out by moving average to remove noise, mean to fill missing values, or IQR rule to remove outliers. In the moving average noise removal process, a window of size 3 is used to perform a moving average on the temperature data column of the original load temperature data, generating a new temperature data column. In the process of filling missing values with the 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 to generate 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.
3. The temperature control method for energy storage devices based on CNN_LSTM according to claim 1, characterized in that: In step one, the normalized original dataset is divided into a training set and a temporary set, with the training set accounting for 40% of the total data. The temporary set is then divided into a validation set and a test set, with the validation set and test set each accounting for 50% of the temporary set.
4. The temperature control method for energy storage devices based on CNN_LSTM according to claim 1, characterized in that: In step four, the prediction results output by the CNN_LSTM model are denormalized using the inverse_transform method to restore the prediction results to the same data format as the original load temperature data.
5. The temperature control method for energy storage devices based on CNN_LSTM according to claim 1, characterized in that: The PID control unit determines the proportional term of the PID control according to the following formula. P : , Where e(t) is the error between the predicted temperature at the current moment and the target temperature of the energy storage device. Kp It is the proportional coefficient of the PID control unit; The integral term of PID control is determined according to the following formula. I : , in, This represents the cumulative error from time 0 to the current time t. Ki It is the integral coefficient of the PID control unit; The derivative term D of the PID control is determined according to the following formula: , in, This represents the rate of change of the error within time t. Kd These are the derivative coefficients of the PID control unit; The proportional term is expressed by the following formula. P、 Integral term I Adding the derivative term D, we obtain the control input data fed back to the temperature control system by the PID control unit. u(t) : 。 6. The temperature control method for energy storage devices based on CNN_LSTM according to claim 5, characterized in that: The temperature control system includes a heating unit and a cooling unit. If the control input data... u(t) If the value is positive, the feedback control heating unit increases heat output, raising the actual load temperature of the energy storage device; if the control input data is negative... u(t) If the value is negative, the feedback control unit reduces the heat output of the heating unit, or turns off the heating unit and turns on the cooling unit to reduce the actual load temperature of the energy storage device.
7. A temperature control system for energy storage devices based on CNN_LSTM, characterized in that: The temperature control method for an energy storage device according to any one of claims 1-6 includes: Temperature sensors collect the load temperature of energy storage devices; The CNN_LSTM temperature prediction unit, equipped with a trained CNN_LSTM model, predicts the load temperature of the energy storage device collected by the temperature sensor and outputs 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 to feed back control input data to the temperature control system of the energy storage device, thereby adjusting 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