Switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM
Through the SSA-CNN-LSTM model, combined with the convolutional neural network and the long-term memory network, the parameters are optimized using the Sparrow Search algorithm to solve the problem of insufficient accuracy in the large amount of data, and high-precision switch cabinet temperature is achieved Humidity prediction has important anti-condensation decision value.
Patent Information
- Application Number
- CN202411044231.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-24
AI Technical Summary
The traditional single neural network model cannot effectively process large data sets, resulting in the difficulty of predicting temperature and humidity of the switch cabinet to meet the requirements and is prone to gradient disappearance.
Using the SSA-CNN-LSTM method, the nonlinear features of the input data are extracted through the convolutional neural network, and the temperature and humidity timing prediction model is established based on the long and short-term memory network, and the model parameters are optimized using the sparrow search algorithm to integrate the optimized SSA -CNN-LSTM model performs the temperature and humidity prediction of switch cabinets.
Effectively reduce network complexity, improve prediction accuracy, solve the problem of overfitting or underfitting, and establish a high-precision multi-point prediction model for temperature and humidity of switch cabinets, which has important significance for pre-regulation and control decision-making of anti-condensation system. .
Smart Images

Figure CN119180190A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of data prediction, and in particular to a switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM. Background Art
[0002] The safety and reliability of power system operation are directly related to whether the power equipment components in the cabinet are working properly, and the main cause of power equipment component failure is air temperature and humidity. my country has a vast territory and significant climate differences. Under long-term rainy conditions, the moisture in the air can easily form serious condensation on the surface of electrical equipment components in the cabinet, which in turn promotes the accumulation of dirt, leading to insulation degradation or flashover accidents.
[0003] Therefore, a high-precision temperature and humidity prediction model with temperature and humidity environmental factors as output variables is established, which provides an important decision-making basis for the pre-control of the temperature and humidity control system. However, the switch cabinet temperature and humidity prediction model involves multiple environmental variable factors, and these factors have nonlinear, time-varying, coupled, and hysteresis characteristics. Currently, commonly used prediction methods include BP neural network, extreme learning machine, support vector machine, and random forest. These methods can not only derive the mapping relationship between the external environmental factors and internal heating factors of the switch cabinet and the internal temperature and humidity of the switch cabinet, but also reduce the prediction time and improve the prediction accuracy.
[0004] However, the traditional single neural network model network cannot handle large data sets and is prone to phenomena such as gradient disappearance, making it increasingly difficult for the prediction accuracy to meet the temperature and humidity prediction requirements. Summary of the invention
[0005] In view of the problem that the existing traditional single neural network model network cannot process data sets with large amounts of data, the present invention is proposed.
[0006] Therefore, the problem to be solved by the present invention is to determine whether condensation is likely to occur during the operation of the switch cabinet.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In the first aspect, an embodiment of the present invention provides a switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM, which includes collecting environmental data and preprocessing the environmental data; using CNN to extract nonlinear characteristics of input data; applying LSTM network to establish a temperature and humidity time series prediction model; using SSA algorithm to optimize CNN-LSTM model parameters, and integrating the optimized SSA-CNN-LSTM model to predict the temperature and humidity of the switch cabinet.
[0009] As a preferred solution of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM described in the present invention, the environmental data collection includes: using four-way temperature and humidity sensors to collect temperature and humidity data of different compartments of the switch cabinet; the external environmental data of the switch cabinet is collected through a small meteorological station; the collection time of the small meteorological station and the four-way temperature and humidity sensors are both in Beijing time, and time synchronization is ensured by the network time protocol NTP.
[0010] As a preferred solution of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM described in the present invention, the preprocessing includes: setting a sliding window of a fixed size, calculating the mean and standard deviation of the data in the window, and if the new data point deviates from the mean by more than 3 standard deviations, marking it as a potential anomaly; calculating the rate of change between two adjacent data points, and setting a rate of change threshold, if the rate of change exceeds the rate of change threshold, marking it as a potential anomaly; setting a maximum and minimum value range for each parameter, if the data exceeds the range, it is directly marked as an anomaly; if a data point is marked as a potential anomaly, no alarm is immediately triggered. If multiple data points are detected continuously and all are marked as potential anomalies, they are marked as anomalies and an alarm is triggered.
[0011] As a preferred solution of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM described in the present invention, wherein: the use of CNN to extract nonlinear features of input data includes: dividing the input time series data into data segments of fixed length, and performing feature extraction on each data segment separately; the feature extraction includes extreme value feature extraction, fluctuation feature extraction, trend feature extraction, periodic feature extraction and peak feature extraction; applying nonlinear transformation to the original data, repeating the feature extraction on the transformed data, and capturing possible nonlinear relationships; if the input contains multiple parameters, calculating the simple ratio and correlation coefficient between the parameters, including: assuming A and B as two parameters, the simple ratio R is calculated as follows:
[0012]
[0013] Correlation coefficient ρ A,B The calculation is as follows:
[0014]
[0015] Among them, A i is the i-th value of parameter A, B i is the i-th value of parameter B, is the average value of parameter A, is the average value of parameter B, and n is the total number of data points; the time information is encoded as periodic features, encoded using sine and cosine functions to capture the cyclic nature of time; the correlation between each feature and the target variable is calculated, and the top N features with the highest correlation are selected as the final output.
[0016] As a preferred solution of the temperature and humidity prediction method of the switch cabinet based on SSA-CNN-LSTM of the present invention, the training of the temperature and humidity time series prediction model includes: using the attention mechanism to enable the temperature and humidity time series prediction model to automatically learn the importance of different features and analyze the attention weights, including: assuming an input sequence is Q = [q1, q2, ..., q T ], attention weight α b And the attention output z is calculated as follows:
[0017] e b =V T tanh(W1h b-1 +W2q b +c)
[0018]
[0019] Among them, V, W1, W2 and c are the trainable parameters of the attention mechanism, h b-1 is the hidden state of the previous time step, q b is the input of the current time step, e b is the attention score at time step b, e g is the attention score of time step g, g is an arbitrary time step, and T is the time step of the input sequence. For 24-hour prediction, an encoder-decoder LSTM structure is used. The encoder captures the information of the input sequence, and the decoder generates multi-step predictions. The teacher forcing technology is used to improve the stability of multi-step predictions during training.
[0020] As a preferred solution of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM described in the present invention, the method of optimizing the CNN-LSTM model parameters using the SSA algorithm includes the following steps: defining the search space, setting the initial global search ratio and local search ratio, and performing an adaptive parameter adjustment mechanism; performing dynamic search strategy adjustment and adaptive step size adjustment; performing an adaptive search optimization strategy, including a combination of global, local, and random searches, and dynamically adjusting the number of elite individuals.
[0021] As a preferred solution of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM described in the present invention, the adaptive parameter adjustment mechanism includes: the dynamic inertia weight w is:
[0022]
[0023] Among them, w is the current inertia weight, w max is the maximum inertia weight, w min is the minimum inertia weight, C is the current iteration number, C max is the maximum number of iterations; set the adaptive acceleration coefficient (c1, c2), and the optimization process is as follows:
[0024] c1=c 1,min +(c 1,max -c 1,min )(1-exp(-γ.C))
[0025] c2=c 2,min +(c 2,max -c 2,min )(1-exp(-δ.C))
[0026] Among them, γ and δ are control parameters used to adjust the rate of acceleration change, c 1,max is the maximum value of the acceleration factor 1, c 1,min is the minimum value of the acceleration factor 1; c 2,max is the maximum value of the acceleration factor 2, c 2,min This is the minimum value of the acceleration factor 2.
[0027] In the second aspect, an embodiment of the present invention provides a switch cabinet temperature and humidity prediction system based on SSA-CNN-LSTM, which includes: an acquisition and preprocessing module, used to collect environmental data and perform preprocessing; a feature extraction module, used to use CNN to extract nonlinear features of input data; a model building module, used to apply LSTM network to establish a temperature and humidity time series prediction model; a model parameter optimization module, used to optimize CNN-LSTM model parameters using SSA algorithm; an optimization integration prediction module, used to integrate the optimized SSA-CNN-LSTM model to predict the temperature and humidity of the switch cabinet.
[0028] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, the steps of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as described in the first aspect of the present invention are implemented.
[0029] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, the steps of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as described in the first aspect of the present invention are implemented.
[0030] The beneficial effects of the present invention are as follows: the present invention extracts nonlinear characteristic factors in the input data through a convolutional neural network, mines the internal connections of the data, can effectively reduce the complexity of the network, reduce the number of connections between convolutional layers, and perform dimensionality reduction and secondary feature extraction on the input features of temperature and humidity prediction. The combination of the CNN-LSTM model has a good prediction effect for characterizing sequence data with spatiotemporal associations; the sparrow search algorithm is used to solve the phenomenon of overfitting or underfitting caused by the CNN-LSTM prediction model in the prediction process, thereby improving the accuracy of the prediction. The establishment of a multi-point prediction model for switch cabinet temperature and humidity is of great significance for the pre-control decision-making of the switch cabinet anti-condensation system. At the same time, it also has great reference value for temperature and humidity prediction in other scenarios in the power field. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0032] Figure 1 This is a flow chart of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM.
[0033] Figure 2 This is the CNN network structure diagram.
[0034] Figure 3 This is the structure diagram of the long short-term memory neural network LSTM.
[0035] Figure 4 This is a schematic diagram of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM.
[0036] Figure 5 This is a temperature effect diagram of the predicted effect of the present invention.
[0037] Figure 6 This is a humidity effect diagram of the predicted effect of the present invention. DETAILED DESCRIPTION
[0038] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0039] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0040] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0041] Example 1
[0042] Reference Figure 1-2 , which is the first embodiment of the present invention, and provides a switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM, including:
[0043] S1: Collect environmental data, process outliers, and perform normalization.
[0044] Specifically, the temperature and humidity prediction model data collection includes: the switch cabinet external environment data including temperature and humidity, atmospheric pressure, wind speed, 24h time node and other data are collected through a small meteorological station.
[0045] Four-way temperature and humidity sensors are used to collect temperature and humidity data in different compartments of the switch cabinet. Since the heat generated inside the switch cabinet is not easy to measure, a controllable heater is used for equivalent replacement. The temperature of the controllable heater is adjusted according to relevant standards. The busbar heater is adjusted to 50°C, and the cable room and trolley heater are adjusted to 35°C. The small meteorological station and the four-way temperature and humidity collector all use Beijing time for collection, and the accurate synchronization of time is guaranteed by the Network Time Protocol (NTP).
[0046] Furthermore, edge computing devices are introduced at each data collection point to realize real-time preprocessing of data. Edge devices can perform preliminary data cleaning, outlier detection and simple statistical analysis.
[0047] Furthermore, the outlier detection process is:
[0048] Set a sliding window of fixed size, such as the most recent 30 data points, and calculate the mean and standard deviation of the data in the window. If a new data point deviates from the mean by more than 3 standard deviations, mark it as a potential anomaly.
[0049] Calculate the rate of change between two adjacent data points and set a reasonable rate of change threshold. For example, the temperature should not change more than 2°C per minute. If the rate of change exceeds the threshold, mark it as a potential anomaly.
[0050] Set reasonable maximum and minimum value ranges for each parameter. If the data exceeds this range, mark it as abnormal directly.
[0051] If a data point is marked as abnormal by any of the above methods, no alarm will be triggered immediately. If 3 to 5 data points are detected continuously and all are marked as potential abnormalities, they will be confirmed as true abnormalities and trigger an alarm.
[0052] Only processed critical data is transmitted to the central system, significantly reducing the amount of data transmission and central processing burden.
[0053] Edge computing devices are equipped with anomaly detection algorithms based on machine learning.
[0054] It can identify abnormal situations such as sensor failure and environmental changes in real time and issue alarms in time.
[0055] Simple statistical analysis includes real-time mean calculation, peak detection, periodicity detection, and trend analysis.
[0056] It can be seen that the present invention has established a method combining intelligent sampling and edge computing based on the external temperature and humidity data of the switch cabinet, atmospheric pressure, wind speed, 24h time node, and the heating value of the busbar inside the switch cabinet, which not only improves the efficiency and accuracy of data collection, but also greatly enhances the real-time response capability and exception handling capability of the system.
[0057] S2: Use CNN to extract nonlinear features of input data.
[0058] First, the input time series data is divided into data segments of fixed length, such as each data segment contains 24 hours of data, and feature extraction is performed on each data segment separately, where feature extraction includes: extreme value feature extraction, fluctuation feature extraction, trend feature extraction, periodic feature extraction and peak feature extraction.
[0059] Extreme value feature extraction includes: finding the maximum and minimum values in each data segment, and calculating the relative time positions of the maximum and minimum values.
[0060] Furthermore, the fluctuation feature extraction is performed:
[0061] Calculate the standard deviation within the data segment to reflect the overall volatility of the data; calculate the average absolute value of the difference between adjacent data points to reflect short-term volatility.
[0062] Furthermore, trend feature extraction includes:
[0063] Divide the data segment into the first half and the second half, calculate the difference between the average values of the two halves to reflect the overall trend, and use linear regression to calculate the slope as another indicator of the trend. The specific calculation is as follows:
[0064] Let X = {x1, x2, ..., x i ,...,x n} is a data segment, where n is the total number of data points and n / 2 represents half the number of data points.
[0065] Average value of the first half:
[0066]
[0067] Average value of the second half:
[0068]
[0069] Difference between means:
[0070]
[0071] The slope β1 in the linear regression model y = β0 + β1x is calculated as follows:
[0072]
[0073] Among them, y is the response variable, β0 is the intercept of the linear regression model, β1 is the slope of the linear regression model, and x i is the independent variable value of the ith data point, y i is the value of the response variable for the ith data point.
[0074] Periodic feature extraction: Calculate the autocorrelation coefficient of the data, select the lag period as 6 hours and 12 hours. The size of the autocorrelation coefficient reflects the periodicity strength of the data. The specific calculation process is as follows:
[0075] For lag period k, the autocorrelation coefficient ρ k The calculation is as follows:
[0076]
[0077] Among them, t is the current time point, x t is the data value at time point t, is the average value of the data.
[0078] Apply a simple nonlinear transformation to the original data, such as taking the square and square root, and repeat the above feature extraction on the transformed data to capture possible nonlinear relationships.
[0079] If the input contains multiple parameters (such as temperature, humidity, pressure, etc.), the simple ratios (such as temperature-humidity ratio) and correlation coefficients between the parameters are calculated as follows:
[0080] Let A and B be two parameters, and the simple ratio R is calculated as follows:
[0081]
[0082] Correlation coefficient ρA,B The calculation is as follows:
[0083]
[0084] Among them, A i is the i-th value of parameter A, B i is the i-th value of parameter B, is the average value of parameter A, is the average value of parameter B.
[0085] Encode temporal information, such as hour of the day and day of the week, as periodic features using sine and cosine functions to capture the cyclical nature of time.
[0086] Calculate the correlation between each feature and the target variable (such as future temperature), and select the top N features with the highest correlation as the final output.
[0087] Optionally, as new data arrives, the features are continuously updated using a sliding window method. Each update only requires calculating the features of the newly added data and updating the overall feature vector, reducing the amount of calculation.
[0088] It can be seen that the simplified feature extraction method above can capture important nonlinear features in the data without using complex CNN, and can effectively process time series data such as environmental parameters such as temperature and humidity, providing valuable input for subsequent prediction or analysis tasks.
[0089] S3: Use LSTM network to establish temperature and humidity time series prediction model.
[0090] Use the features extracted in step S2 as the input of LSTM, including: extreme value features, including maximum value, minimum value and their time position, fluctuation features, including standard deviation and short-term volatility, trend features, including half-segment mean value difference and linear regression slope, periodic features, namely autocorrelation coefficient, peak features, including the number of peaks and average amplitude, nonlinear transformation features, multi-parameter cross features (such as temperature-humidity ratio, correlation coefficient), time feature encoding (periodic encoding of hours and days of the week); standardize the features to ensure that all inputs are on the same scale, construct a sliding window sequence, and organize continuous time step data into an input format acceptable to LSTM.
[0091] The LSTM network includes: designing input nodes that match the number of features and inputting them into the input layer; in the LSTM layer: using a multi-layer LSTM structure, usually 2-3 layers, the number of neurons in each layer can be adjusted from 64-128, and adding a Dropout layer (such as a dropout rate of 0.2) between the LSTM layers to prevent overfitting; the fully connected layer maps the output of the LSTM to the predicted value; the output layer: predicts the temperature and humidity values for the next 24 hours.
[0092] Model training strategies include:
[0093] The mean square error (MSE) is used as the main loss function.
[0094] Use the attention mechanism to let the model automatically learn the importance of different features and analyze the attention weights to understand which features are most critical to prediction. Based on the analysis results, the feature extraction process in S2 can be further optimized. The specific operations are as follows:
[0095] Suppose there is an input sequence Q = [q1,q2,...,q T ], attention weight α b And the attention output z is calculated as follows:
[0096] e b =V T tanh(W1h b-1 +W2q b +c)
[0097]
[0098] Among them, V, W1, W2 and c are the trainable parameters of the attention mechanism, h b-1 is the hidden state of the previous time step, q b is the input of the current time step, e b is the attention score at time step b, e g is the attention score at time step g, where g is an arbitrary time step and T is the time step length of the input sequence.
[0099] According to the results of attention weight analysis, the feature extraction process can be further optimized. For example, if some features are more critical to prediction, these features can be given more weight or processed in more detail during the feature engineering process.
[0100] Furthermore, for 24-hour prediction, an encoder-decoder LSTM structure is used. The encoder captures the information of the input sequence, and the decoder generates multi-step predictions. The teacher forcing technology is used to improve the stability of multi-step predictions during training. Specifically:
[0101] The encoder captures information about the input sequence through a series of LSTM units:
[0102] h b =LSTM(q b ,h b-1 )
[0103] The decoder generates multi-step predictions through a series of LSTM units and an output layer:
[0104] s b =LSTM(y b-1 ,s b-1 ,d)
[0105]
[0106] Among them, s b is the hidden state of the decoder at time step b, y b-1 is the input of the decoder at time step b-1 (prediction of the previous step), s b-1 is the hidden state of the decoder at time step b-1, and d is the context vector passed from the encoder.
[0107] Use the teacher forcing technique to improve the stability of multi-step prediction by using the true target value instead of the model's predicted value as the decoder input:
[0108]
[0109] in, is the true value at time step b-1.
[0110] Furthermore, combined with the anomaly detection result in step S2, special attention is paid to abnormal data points in the prediction process. For the detected anomalies, their weights in the loss function are increased to improve the sensitivity of the model to abnormal situations.
[0111] S4: The SSA algorithm is used to optimize the CNN-LSTM model parameters, and the optimized SSA-CNN-LSTM model is integrated to predict the temperature and humidity of the switch cabinet.
[0112] The parameters of CNN-LSTM are generally determined by experience and grid optimization methods, and the results of their selection may lead to over-fitting and under-fitting. The sparrow search algorithm has good global exploration and local development capabilities. It takes into account all factors in the population, so that the sparrows in the population move toward the global optimal value and converge quickly near the optimal value.
[0113] S4.1: Define the search space: including parameters such as the number of CNN layers, convolution kernel size, number of LSTM layers, number of neurons, etc.; initialize the sparrow population, each sparrow represents a set of model parameter configurations, and set the initial global search ratio and local search ratio, and perform an adaptive parameter adjustment mechanism, including:
[0114] Introduce dynamic inertia weight w:
[0115]
[0116] Among them, w is the current inertia weight, w max is the maximum inertia weight, w min is the minimum inertia weight, C is the current iteration number, C max is the maximum number of iterations.
[0117] Optionally, a larger w in the early stage is beneficial to global search, and a smaller w in the later stage is beneficial to local fine search.
[0118] Adaptive acceleration coefficients (c1, c2) are introduced. The acceleration coefficients c1 and c2 enable the algorithm to have different search capabilities at different iteration stages. The optimization process is as follows:
[0119] c1=c 1,min +(c 1,max -c 1,min )(1-exp(-γ.C))
[0120] c2=c 2,min +(c 2,max -c 2,min )(1-exp(-δ.C))
[0121] Among them, γ and δ are control parameters used to adjust the rate of acceleration change, c 1,max is the maximum value of the acceleration factor 1, c 1,min is the minimum value of the acceleration factor 1; c 2,max is the maximum value of the acceleration factor 2, c 2,min This is the minimum value of the acceleration factor 2.
[0122] S4.2: Perform dynamic search strategy adjustment and adaptive step size adjustment.
[0123] Dynamic search strategy adjustment includes the introduction of a search mode switching mechanism:
[0124] If there is no improvement after M consecutive iterations, increase the global search ratio; if the optimal solution continues to improve, increase the local search ratio.
[0125] Perform adaptive step size adjustment:
[0126] Step size = initial step size × exp(-θ × current number of iterations / maximum number of iterations)
[0127] Among them, θ is a parameter that controls the speed of step size decay.
[0128] S4.3: Perform adaptive search optimization strategies, including a combination of global, local, and random searches, and dynamically adjust the number of elite individuals.
[0129] Discoverer (global search): uses an adaptive step size to explore new parameter space, and if the new position is better, the entire population moves in that direction.
[0130] Follower (local search): Performs local search around the current optimal solution. The search radius decreases with the number of iterations to achieve refined search.
[0131] Sentinel: Randomly jump to new parameter space to maintain population diversity. The jump amplitude decreases with the number of iterations, and more attention is paid to local search in the later stage.
[0132] Conduct adaptive elite retention strategies, including:
[0133] Dynamically adjust the number of elite individuals, that is, retain fewer elites in the early stage to increase exploration, and increase the number of elites in the later stage to accelerate convergence; perform small-scale parameter fine-tuning on the retained elite individuals.
[0134] Furthermore, the optimized SSA-CNN-LSTM model is integrated for temperature and humidity prediction including:
[0135] First, the factors affecting temperature and humidity prediction are analyzed. The main factors affecting the changes in temperature and humidity in the cabinet include: external environment temperature and humidity, external environment wind speed, external environment atmospheric pressure, heat generation in the cabinet, and 24 time nodes.
[0136] The influencing factors are grouped and preprocessed. The first step of preprocessing is to process the abnormal data of each factor. After eliminating the abnormal data, fill it in according to the calculation rules.
[0137] Step 2: Since the data has different measurements, the data is normalized. The LSTM model can well describe the temperature and humidity sequence data with spatiotemporal correlation. At the same time, in order to improve the ability to extract input features, a CNN layer is added to extract features multiple times.
[0138] However, the parameters of CNN-LSTM are generally determined by empirical calculation and grid optimization, which may result in underfitting and overfitting. To solve the above problems, the sparrow search algorithm (SSA) is introduced to optimize the parameters of the CNN-LSTM model.
[0139] This embodiment also provides a switch cabinet temperature and humidity prediction system based on SSA-CNN-LSTM, including:
[0140] The acquisition and preprocessing module is used to collect environmental data and perform preprocessing; the feature extraction module is used to use CNN to extract the nonlinear features of the input data; the model building module is used to apply the LSTM network to establish a temperature and humidity time series prediction model; the model parameter optimization module is used to optimize the CNN-LSTM model parameters using the SSA algorithm; the optimization integration prediction module is used to integrate the optimized SSA-CNN-LSTM model to predict the temperature and humidity of the switch cabinet.
[0141] This embodiment also provides a computer device, which is suitable for the case of a switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as proposed in the above embodiment.
[0142] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0143] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for predicting temperature and humidity of a switch cabinet based on SSA-CNN-LSTM is implemented as proposed in the above embodiment.
[0144] In summary, the present invention extracts nonlinear characteristic factors in the input data through convolutional neural networks, mines the internal connections of the data, can effectively reduce the complexity of the network, reduce the number of connections between convolutional layers, and perform dimensionality reduction and secondary feature extraction on the input features of temperature and humidity prediction. The combination of CNN-LSTM model has a good prediction effect for characterizing sequence data with spatiotemporal correlation; the sparrow search algorithm is used to solve the phenomenon of overfitting or underfitting caused by the CNN-LSTM prediction model in the prediction process, thereby improving the accuracy of the prediction. The establishment of a multi-point prediction model for temperature and humidity of the switch cabinet is of great significance to the pre-control decision-making of the anti-condensation system of the switch cabinet. At the same time, it also has great reference value for temperature and humidity prediction in other scenarios in the power field.
[0145] Example 2
[0146] Referring to Table 1, which is a second embodiment of the present invention, this embodiment provides a switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.
[0147] In order to verify the effectiveness of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM, an experiment was carried out on a 110kV switch cabinet in a substation. The experimental preparation and implementation process are as follows:
[0148] First, a small weather station was installed outside the switch cabinet to collect external environmental data, including temperature, humidity, atmospheric pressure, wind speed, etc. At the same time, four temperature and humidity sensors were installed in different compartments of the switch cabinet (busbar room, cable room and trolley room). Considering that the heat generated inside the switch cabinet is difficult to measure directly, a controllable heater was used for equivalent replacement.
[0149] According to relevant standards, the temperature of the busbar room heater is adjusted to 50°C, and the temperature of the cable room and trolley room heater is adjusted to 35°C. All data acquisition equipment uses Beijing time, and the network time protocol (NTP) is used to ensure time synchronization accuracy.
[0150] At each data collection point, edge computing devices are introduced to achieve real-time data preprocessing. These devices are equipped with anomaly detection algorithms based on machine learning, which can perform preliminary data cleaning, outlier detection and simple statistical analysis. Outlier detection uses multiple detection mechanisms, including sliding window method, rate of change detection and range detection. Only when 3-5 consecutive data points are marked as potential anomalies will the alarm be triggered. This method greatly improves the accuracy of anomaly detection and reduces the false alarm rate.
[0151] First, the original data was normalized to eliminate the influence of different dimensions. Then, the improved CNN model was used to extract nonlinear features, and the input time series data was divided into 24-hour data segments. Comprehensive feature extraction was performed on each data segment, including extreme value features, fluctuation features, trend features, periodic features, and peak features.
[0152] In particular, the present invention introduces an adaptive feature weight mechanism to dynamically adjust the weights of different features according to their contributions to the prediction results.
[0153] In the LSTM network construction phase, a 3-layer LSTM structure was adopted, with 128 neurons in each layer, and a Dropout layer (dropout rate of 0.2) was added between the LSTM layers to prevent overfitting. An attention mechanism was also introduced to enable the model to automatically learn the importance of different features. For 24-hour forecasts, an encoder-decoder LSTM structure was adopted, and the teacherforcing technique was used to improve the stability of multi-step forecasts.
[0154] Finally, the improved sparrow search algorithm (SSA) is used to optimize the hyperparameters of the CNN-LSTM model. Dynamic inertia weight and adaptive acceleration coefficient are introduced to achieve dynamic adjustment of the search strategy; at the same time, adaptive step size adjustment and elite retention strategy are also adopted to effectively balance global exploration and local development capabilities.
[0155] The experiment lasted for 30 days, and the data was divided into a training set (80%) and a test set (20%). For comparative analysis, the traditional ARIMA model, the ordinary LSTM model, and the unoptimized CNN-LSTM model were implemented for prediction. The evaluation indicators of the prediction results include the mean absolute error (MAE), the root mean square error (RMSE), and the mean absolute percentage error (MAPE). The experimental results are shown in the following table:
[0156] Table 1
[0157]
[0158] By analyzing the above table data, it can be concluded that the SSA-CNN-LSTM model is significantly better than other models in all evaluation indicators. Taking temperature prediction as an example, the MAE of the SSA-CNN-LSTM model is 1.18℃, which is 49.79% lower than the traditional ARIMA model, 36.90% lower than the ordinary LSTM model, and 22.37% lower than the unoptimized CNN-LSTM model. This shows that the SSA-CNN-LSTM model has higher prediction accuracy and stronger generalization ability.
[0159] It is worth noting that the SSA-CNN-LSTM model has a particularly significant improvement in humidity prediction. Compared with the ARIMA model, MAE is reduced by 44.87%, RMSE is reduced by 42.95%, and MAPE is reduced by 46.02%. This shows that the model can better capture the complexity and nonlinear characteristics of humidity changes.
[0160] In general, the switchgear temperature and humidity prediction method based on SSA-CNN-LSTM showed excellent performance. It not only significantly improved the prediction accuracy, but also performed well in model stability and adaptability. This method effectively combines the feature extraction capability of CNN, the time series modeling capability of LSTM, and the parameter optimization capability of SSA, providing a powerful tool for intelligent monitoring and predictive maintenance of switchgear.
[0161] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM, characterized by: include, Collecting environmental data and preprocessing the environmental data; Use CNN to extract nonlinear features of input data; Apply LSTM network to establish temperature and humidity time series prediction model; The SSA algorithm is used to optimize the CNN-LSTM model parameters, and the optimized SSA-CNN-LSTM model is integrated to predict the temperature and humidity of the switch cabinet.
2. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 1 is characterized in that: The collected environmental data includes: Use four temperature and humidity sensors to collect temperature and humidity data in different compartments of the switch cabinet; The external environmental data of the switch cabinet is collected through a small weather station; The small weather station and four-channel temperature and humidity sensors all use Beijing time for collection, and the network time protocol NTP is used to ensure time synchronization.
3. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 2 is characterized in that: The pre-processing comprises: Set a sliding window of fixed size, calculate the mean and standard deviation of the data in the window, and mark a new data point as a potential anomaly if it deviates from the mean by more than 3 standard deviations. Calculate the change rate between two adjacent data points and set a change rate threshold. If the change rate exceeds the change rate threshold, mark it as a potential anomaly. Set the maximum and minimum range for each parameter. If the data exceeds the range, it will be marked as abnormal directly. If a data point is marked as a potential anomaly, no alarm is triggered immediately. If multiple data points are detected continuously and all are marked as potential anomalies, they are marked as anomalies and an alarm is triggered.
4. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 3 is characterized in that: The nonlinear features of the input data extracted using CNN include: Divide the input time series data into data segments of fixed length and perform feature extraction on each data segment separately; The feature extraction includes extreme value feature extraction, fluctuation feature extraction, trend feature extraction, periodic feature extraction and peak feature extraction; Applying a nonlinear transformation to the original data, and repeating the feature extraction on the transformed data to capture possible nonlinear relationships; If the input contains multiple parameters, simple ratios and correlation coefficients between the parameters are calculated, including: Let A and B be two parameters, and the simple ratio R is calculated as follows: Correlation coefficient ρ A,B The calculation is as follows: Among them, A i is the i-th value of parameter A, B i is the i-th value of parameter B, is the average value of parameter A, is the average value of parameter B, and n is the total number of data points; Encode time information as periodic features using sine and cosine functions to capture the cyclic nature of time; Calculate the correlation between each feature and the target variable, and select the top N features with the highest correlation as the final output.
5. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 4 is characterized in that: The training of the temperature and humidity time series prediction model includes: Using the attention mechanism, the temperature and humidity time series prediction model automatically learns the importance of different features and analyzes the attention weights, including: Suppose an input sequence is Q = [q1,q2,...,q T ], attention weight α b And the attention output z is calculated as follows: e b =V T fishy(W1h) b-1 +W2q b +c) Among them, V, W1, W2 and c are the trainable parameters of the attention mechanism, h b-1 is the hidden state of the previous time step, q b is the input of the current time step, e b is the attention score at time step b, e g is the attention score at time step g, where g is an arbitrary time step and T is the time step length of the input sequence; For 24-hour predictions, an encoder-decoder LSTM structure is used. The encoder captures the information of the input sequence, and the decoder generates multi-step predictions. The teacher forcing technology is used to improve the stability of multi-step predictions during training.
6. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 5 is characterized in that: The use of the SSA algorithm to optimize the CNN-LSTM model parameters includes the following steps: Define the search space, set the initial global search ratio and local search ratio, and implement an adaptive parameter adjustment mechanism; Perform dynamic search strategy adjustment and adaptive step size adjustment; Conduct adaptive search optimization strategies, including a combination of global, local, and random searches, and dynamically adjust the number of elite individuals.
7. The switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM as claimed in claim 6, characterized in that: The adaptive parameter adjustment mechanism includes: The dynamic inertia weight w is: Among them, w is the current inertia weight, w max is the maximum inertia weight, w min is the minimum inertia weight, C is the current iteration number, C max is the maximum number of iterations; Set the adaptive acceleration coefficient (c1, c2), and the optimization process is as follows: c1=c 1,min +(c 1,max -c 1,min )(1-exp(-γ.C)) c2=c 2,min +(c 2,max -c 2,min )(1-exp(-δ.C)) Among them, γ and δ are control parameters used to adjust the rate of acceleration change, c 1,max is the maximum value of the acceleration factor 1, c 1,min is the minimum value of the acceleration factor 1; c 2,max is the maximum value of the acceleration factor 2, c 2,min This is the minimum value of the acceleration factor 2.
8. A switch cabinet temperature and humidity prediction system based on SSA-CNN-LSTM, based on the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM according to any one of claims 1 to 7, characterized in that: Also includes, The collection and preprocessing module is used to collect environmental data and perform preprocessing; Feature extraction module, used to extract nonlinear features of input data using CNN; Model building module, used to build a temperature and humidity time series prediction model using LSTM network; Model parameter optimization module, used to optimize CNN-LSTM model parameters using SSA algorithm; The optimized integrated prediction module is used to integrate the optimized SSA-CNN-LSTM model to predict the temperature and humidity of the switch cabinet.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM are implemented as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the switch cabinet temperature and humidity prediction method based on SSA-CNN-LSTM are implemented.
Citation Information
Cited By
Condensation prediction control method and system of electrical cabinet
CN121165599A
Abnormity detection method, device and equipment of maglev train suspension system and medium
CN121881519A
