Method and device for predicting waterlogging of power equipment, terminal equipment and storage medium
By constructing and training a flood prediction model containing time series features, the problem of low flood prediction accuracy of power equipment in the prior art is solved, and the prediction accuracy and maintenance and control effects are improved.
Patent Information
- Application Number
- CN202411766206.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-11
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN119599218A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power technology, and in particular to a method, device, terminal equipment and storage medium for predicting waterlogging of electric power equipment. Background Art
[0002] As a type of meteorological disaster, typhoons and rainstorms are extremely destructive and pose a serious threat to people's production and life, especially to the waterlogging of power equipment in the power grid. In view of this, it is particularly important to strengthen the prediction of waterlogging of power equipment, make timely preparations for waterlogging of power equipment, and reduce the loss of power equipment caused by waterlogging.
[0003] At present, there are various methods for predicting power equipment waterlogging, mainly including prediction methods based on statistical analysis of historical data and detection data, prediction methods based on simulation, and prediction methods based on intelligent algorithms. For example: the method based on statistical analysis of historical data and monitoring data, which specifically uses historical data to build a rainfall-flood disaster model, analyzes the relationship between rainfall intensity, frequency and flood disasters, and dynamically adjusts model parameters according to real-time monitoring data to improve prediction accuracy; the prediction method based on simulation, which specifically uses a distributed hydrological physics model to simulate the basin hydrology, obtain the physical field (including the predicted water level) in the area where the power equipment is located, analyzes the change trend of the physical field, and predicts the water level change in the future; the prediction method based on intelligent algorithms, which specifically uses data mining technology to extract characteristic information related to flood disasters from historical data and uses machine learning algorithms to build a flood disaster prediction model. Although these methods can provide early warning information to a certain extent when predicting power equipment waterlogging, it is difficult to fully mine and utilize the time series characteristics in the monitoring data, which leads to low accuracy of the final prediction and poor effect on the maintenance and control of power equipment waterlogging. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, terminal device and storage medium for predicting waterlogging of electric power equipment, which can improve the accuracy of waterlogging prediction models and improve the effect of waterlogging maintenance and control of electric power equipment based on the predicted degree of waterlogging of the electric power equipment.
[0005] An embodiment of the present invention provides a method for predicting waterlogging of electric power equipment, comprising:
[0006] Obtain waterlogging data and rainfall data of power equipment in historical periods;
[0007] Construct the time series data to be processed based on the historical waterlogging data of power equipment and the historical rainfall data;
[0008] Inputting the to-be-processed time series data into a waterlogging prediction model so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment;
[0009] The waterlogging prediction model is constructed in the following way:
[0010] Obtain a time series data training set; the time series data training set includes a number of time series data samples, each of which includes waterlogging data samples, rainfall data samples and real waterlogging degree of power equipment at a number of time steps;
[0011] An initial flood prediction model is constructed, and the initial flood prediction model is iteratively trained with the time series data training set until the initial flood prediction model converges, thereby generating a flood prediction model; in each iterative training process, the initial flood prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of flooding of the power equipment based on the time series features.
[0012] Furthermore, the initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a discard layer, a fully connected layer, and an output layer;
[0013] In each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted flooding degree of the power equipment according to the time series features, including:
[0014] In each iterative training process, the time series data sample is input into the long short-term memory layer through the input layer, so that the long short-term memory layer extracts the time series features of the time series data sample, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer;
[0015] The attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain a second output result of the attention mechanism layer, and inputs the second output result into the discard layer;
[0016] The discard layer discards neurons in the second output result according to a preset discard rate to obtain a third output result of the discard layer, and inputs the third output result into the fully connected layer;
[0017] The fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
[0018] Furthermore, after the initial flooding prediction model extracts the time series features of the time series data samples and outputs the predicted flooding degree of the power equipment according to the time series features, it also includes:
[0019] Calculate the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set;
[0020] If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted;
[0021] If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, the current hyperparameters of the initial waterlogging prediction model are obtained;
[0022] Combining the current hyperparameters into an initialization particle set; wherein the initialization particle set includes each initialization particle and particle information of each initialization particle, and the particle information includes the particle position and particle velocity at the current moment;
[0023] The fitness of each initialized particle is calculated through the fitness function to obtain the fitness value of each initialized particle;
[0024] For each initialized particle, the particle update operation is repeatedly performed until the fitness difference of the current initialized particle is less than the preset difference threshold;
[0025] The current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to the updated particles corresponding to the initialized particles;
[0026] Wherein, the particle update operation includes:
[0027] Get the current particle position and current particle velocity of the currently initialized particle;
[0028] Update the particle speed at the current moment according to the preset particle speed update formula to obtain the particle speed at the next moment;
[0029] Update the particle position at the current moment according to the preset particle position update formula to obtain the particle position at the next moment;
[0030] Construct and update particles according to the particle speed and particle position at the next moment;
[0031] The fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle;
[0032] The fitness difference of the currently initialized particle is calculated based on the fitness value of the updated particle and the fitness value of the currently initialized particle.
[0033] Furthermore, after obtaining the time series data training set, it also includes:
[0034] The time series data training set is normalized to obtain a normalized time series data training set.
[0035] Based on the above method embodiment, the present invention provides a corresponding device embodiment;
[0036] An embodiment of the present invention provides a device for predicting waterlogging of electric power equipment, including: a data acquisition module, a time series data construction module, a waterlogging prediction module and a waterlogging prediction model construction module;
[0037] The data acquisition module is used to acquire waterlogging data and rainfall data of power equipment in historical periods;
[0038] The time series data construction module is used to construct the time series data to be processed according to the waterlogging data of the power equipment in the historical period and the rainfall data in the historical period;
[0039] The waterlogging prediction module is used to input the to-be-processed time series data into a waterlogging prediction model, so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment;
[0040] The waterlogging prediction model construction module is used to obtain a time series data training set; the time series data training set includes a number of time series data samples, each time series data sample includes waterlogging data samples, rainfall data samples and the degree of waterlogging of actual power equipment at a number of time steps; an initial waterlogging prediction model is constructed, and the initial waterlogging prediction model is iteratively trained with the time series data training set until the initial waterlogging prediction model converges, thereby generating a waterlogging prediction model; in each iterative training process, the initial waterlogging prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of waterlogging of the power equipment based on the time series features.
[0041] Furthermore, the initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a discard layer, a fully connected layer, and an output layer;
[0042] In each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted flooding degree of the power equipment according to the time series features, including:
[0043] In each iterative training process, the time series data sample is input into the long short-term memory layer through the input layer, so that the long short-term memory layer extracts the time series features of the time series data sample, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer;
[0044] The attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain a second output result of the attention mechanism layer, and inputs the second output result into the discard layer;
[0045] The discard layer discards neurons in the second output result according to a preset discard rate to obtain a third output result of the discard layer, and inputs the third output result into the fully connected layer;
[0046] The fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
[0047] Furthermore, it also includes: a model evaluation and parameter adjustment module;
[0048] The model evaluation and parameter adjustment module is used to calculate the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set;
[0049] If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted;
[0050] If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, the current hyperparameters of the initial waterlogging prediction model are obtained;
[0051] Combining the current hyperparameters into an initialization particle set; wherein the initialization particle set includes each initialization particle and particle information of each initialization particle, and the particle information includes the particle position and particle velocity at the current moment;
[0052] The fitness of each initialized particle is calculated through the fitness function to obtain the fitness value of each initialized particle;
[0053] For each initialized particle, the particle update operation is repeatedly performed until the fitness difference of the current initialized particle is less than the preset difference threshold;
[0054] The current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to the updated particles corresponding to the initialized particles;
[0055] Wherein, the particle update operation includes:
[0056] Get the current particle position and current particle velocity of the currently initialized particle;
[0057] Update the particle speed at the current moment according to the preset particle speed update formula to obtain the particle speed at the next moment;
[0058] Update the particle position at the current moment according to the preset particle position update formula to obtain the particle position at the next moment;
[0059] Construct and update particles according to the particle speed and particle position at the next moment;
[0060] The fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle;
[0061] The fitness difference of the currently initialized particle is calculated based on the fitness value of the updated particle and the fitness value of the currently initialized particle.
[0062] Furthermore, it also includes: a data preprocessing module;
[0063] The data preprocessing module is used to perform normalization processing on the time series data training set to obtain the normalized time series data training set.
[0064] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the method for predicting waterlogging of electric power equipment described in the above-mentioned embodiment of the invention is implemented.
[0065] Another embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the method for predicting waterlogging of electric power equipment described in the above-mentioned embodiment of the invention.
[0066] The following beneficial effects are achieved by implementing the present invention:
[0067] The present invention provides a method, device, terminal device and storage medium for predicting waterlogging of electric equipment. The method for predicting waterlogging of electric equipment obtains waterlogging data and rainfall data of electric equipment in historical periods, and constructs time series data to be processed according to the obtained data; then the time series data to be processed is input into a waterlogging prediction model so that the waterlogging prediction model outputs a predicted value of the degree of waterlogging of the electric equipment; wherein, when the waterlogging prediction model is constructed, the initial waterlogging prediction model is trained by a time series data training set containing time series features, so that the generated waterlogging prediction model has the ability to extract time series features. By obtaining data containing historical periods to construct the time series data to be processed with time series features, the time series features of the time series data to be processed can be extracted by the waterlogging prediction model when the data is input into the waterlogging prediction model, and then the predicted degree of waterlogging of the electric equipment is output based on the extracted time series features. The accuracy of the waterlogging prediction model is improved by considering the time series features, thereby improving the effect of waterlogging maintenance and control of the electric equipment based on the predicted degree of waterlogging of the electric equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 It is a flowchart of a method for predicting waterlogging of electric power equipment provided by an embodiment of the present invention.
[0069] Figure 2 It is a schematic diagram of the structure and hyperparameter adjustment of a waterlogging prediction model provided by an embodiment of the present invention.
[0070] Figure 3 It is a structural schematic diagram of a device for predicting waterlogging of electric power equipment provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0072] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0073] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0074] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0075] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0076] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0077] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0078] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0079] like Figure 1 As shown, a method for predicting waterlogging of electric power equipment provided by an embodiment of the present invention includes:
[0080] Step S1: Obtaining waterlogging data of power equipment in historical periods and rainfall data in historical periods;
[0081] Step S2: construct the time series data to be processed according to the waterlogging data of the power equipment in the historical period and the rainfall data in the historical period;
[0082] Step S3: inputting the to-be-processed time series data into a waterlogging prediction model, so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment;
[0083] The waterlogging prediction model is constructed in the following way:
[0084] Obtain a time series data training set; the time series data training set includes a number of time series data samples, each of which includes waterlogging data samples, rainfall data samples and real waterlogging degree of power equipment at a number of time steps;
[0085] An initial flood prediction model is constructed, and the initial flood prediction model is iteratively trained with the time series data training set until the initial flood prediction model converges, thereby generating a flood prediction model; in each iterative training process, the initial flood prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of flooding of the power equipment based on the time series features.
[0086] For step S1, the waterlogging data and rainfall data of the power equipment in the historical period are obtained; wherein, in order to ensure the accuracy of the data, the rainfall data in the historical period indicated by the weather forecast of the area where the power equipment is located is obtained when obtaining the rainfall data in the historical period as the rainfall data in the historical period of the present invention. The waterlogging data of the power equipment in the historical period mainly refers to the depth of waterlogging in the power equipment in the historical period.
[0087] For step S2, the time series data to be processed is constructed according to the waterlogging data of the power equipment in the historical period and the rainfall data in the historical period. For example, if the historical period includes three time points, namely: January 1, 2019, January 2, 2019 and January 3, 2019; the waterlogging depths of the power equipment corresponding to the three time points are: 10cm, 20cm and 30cm respectively; the single-day rainfall corresponding to the three time points are: 20mm, 20mm and 25mm respectively; the cumulative rainfall corresponding to the three time points are 20mm, 40mm and 85mm respectively; then the final time series data to be processed can be expressed as {[2019 / 1 / 1(10cm, 20mm, 20mm)], [2019 / 1 / 2(20cm, 20mm, 40mm)], [2019 / 1 / 3(20cm, 25mm, 85mm)]}.
[0088] For step S3, the time series data to be processed in step S2 is input into the waterlogging prediction model, and the waterlogging prediction model outputs the predicted value of the waterlogging degree of the power equipment, which is mainly the predicted value of the waterlogging degree of the power equipment in the short term from the historical period. Exemplarily, the predicted value output here is the predicted value of the waterlogging depth of the power equipment on 2019 / 1 / 8, 2019 / 1 / 9 and 2019 / 1 / 10. The predicted value of the waterlogging depth of the power equipment is provided to the power equipment operation and maintenance personnel, so that the power equipment operation and maintenance personnel can make flood prevention preparations for the power equipment based on the data, thereby reducing the equipment loss and equipment damage caused by the failure to take timely precautions against waterlogging.
[0089] The construction of the above-mentioned flooding prediction model first requires obtaining a time series data set. The time series data training set includes several time series data samples. Each time series data sample includes flooding data samples, rainfall data samples and the degree of flooding of actual power equipment at several time steps; the time steps in each time series data sample are continuously arranged time steps.
[0090] In a preferred embodiment, after acquiring the time series data training set, the method further includes: normalizing the time series data training set to obtain the normalized time series data training set.
[0091] Specifically, after obtaining the time series data training set, the time series data training set needs to be normalized to obtain the normalized time series data training set, and the normalized time series data training set is divided into a training set and a test set according to a ratio of 5:1. Preferably, the method used for normalization is maximum-minimum normalization. This normalization method can avoid the subsequent slowing down of model learning speed and model convergence as a large amount of data is input into the initial flooding prediction model for training. Use the formula shown below to map the data to the range of 0 to 1 to achieve normalization.
[0092]
[0093] Among them, x is a time series data sample; y is a normalized time series data sample; max and min are the maximum time series data sample and the minimum time series data sample in the time series data training set.
[0094] Furthermore, an initial waterlogging prediction model is constructed. Preferably, when constructing the initial waterlogging prediction model, the hyperparameters of the initial model are selected as the initial hyperparameters of the initial waterlogging prediction model; the initial waterlogging prediction model is trained with a time series data training set until the initial waterlogging prediction model converges, thereby generating a waterlogging prediction model.
[0095] In a preferred embodiment, the initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a discard layer, a fully connected layer and an output layer; in each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted degree of flooding of the power equipment according to the time series features, including: in each iterative training process, the time series data samples are input into the long short-term memory layer via the input layer, so that the long short-term memory layer extracts the time series features of the time series data samples, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer; the attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain the second output result of the attention mechanism layer, and inputs the second output result into the discard layer; the discard layer discards the neurons in the second output result according to the preset discard rate to obtain the third output result of the discard layer, and inputs the third output result into the fully connected layer; the fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
[0096] Specifically, Figure 2As shown in the figure, the initial flooding prediction model includes an input layer, a long short-term memory layer (LSTM layer), an attention mechanism layer (Attention layer), a discard layer (Dropout layer), a fully connected layer and an output layer, which are connected in sequence. In the process of iteratively training the initial flooding prediction model according to the time series data sample, a time series data sample is first input into the initial flooding prediction model. The time series data sample first passes through the input layer to reach the LSTM layer. The LSTM layer is used to process the time series features. At this time, the LSTM layer extracts the time series features in the sample to obtain a first output result containing the time series features, and transmits the first output result to the Attention layer. The Attention layer contains an attention mechanism, which focuses on different time steps in the first output result sequence to obtain a second output result, and transmits the second output result to the Dropout layer; the Dropout layer selects a suitable Dropout rate, that is, the above-mentioned preset dropout rate, and discards neurons in the second output result according to the dropout rate. After obtaining the third output result, the third output result is transmitted to the fully connected layer, and the fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result. The LSTM layer is responsible for capturing long-term dependencies in the time series, while the attention mechanism can dynamically adjust the contribution of different time steps to the prediction results, thereby more accurately identifying key feature information. The flood prediction model constructed and trained by the above network structure can better pay attention to the time series characteristics when predicting the degree of flooding of power equipment, so that the final prediction result has a higher prediction accuracy.
[0097] In a preferred embodiment, after the initial flooding prediction model extracts the time series features of the time series data samples and outputs the predicted degree of flooding of the power equipment according to the time series features, it also includes: calculating the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set; if the root mean square error of the current iteration is less than a preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, then the hyperparameters of the initial flooding prediction model are not adjusted; if the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is less than the preset root mean square error threshold is not less than a preset mean square error threshold, then the current hyperparameters of the initial waterlogging prediction model are obtained; the current hyperparameters are combined into an initialization particle set; wherein the initialization particle set includes each initialization particle and the particle information of each initialization particle, and the particle information includes the particle position at the current moment and the particle speed at the current moment; the fitness of each initialization particle is calculated by a fitness function to obtain the fitness value of each initialization particle; for each initialization particle, the particle update operation is repeatedly performed until the fitness difference of the current initialization particle is less than the preset difference threshold; the current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to each update particle corresponding to each initialization particle;
[0098] The particle update operation includes: obtaining the particle position and particle velocity of the currently initialized particle at the current moment; updating the particle velocity at the current moment according to a preset particle velocity update formula to obtain the particle velocity at the next moment; updating the particle position at the current moment according to a preset particle position update formula to obtain the particle position at the next moment; constructing an updated particle according to the particle velocity at the next moment and the particle position at the next moment; calculating the fitness of the updated particle through a fitness function to obtain the fitness value of the updated particle; and calculating the fitness difference of the currently initialized particle according to the fitness value of the updated particle and the fitness value of the currently initialized particle.
[0099] Specifically, after one iteration of training of the initial flood prediction model, the hyperparameters of the initial flood prediction model are evaluated by the root mean square error RMSE and the mean square error MSE to determine whether the hyperparameters of the initial flood prediction model need to be adjusted. RMSE and MSE are specifically expressed as:
[0100]
[0101] Among them, y and They respectively represent the actual degree of flooding of power equipment and the predicted degree of flooding of power equipment of the i-th time series data sample, and N is the total number of samples in the time series data training set.
[0102] The smaller the values of MAE and RMSE, the higher the prediction accuracy of the model. If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted, and it is considered that the initial waterlogging prediction model converges at this time, and the waterlogging prediction model is generated. If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, it is necessary to adjust the hyperparameters of the initial waterlogging prediction model. In the present invention, the adjustment of the hyperparameters of the initial waterlogging prediction model is achieved by a particle swarm algorithm. The hyperparameters mainly include the number of LSTM memory units, the optimizer type, the batch size, the number of iterations, and the learning rate. In the present invention, the hyperparameters set the number of LSTM network layers to 1, the number of hidden layer nodes to 20, the batch size to 512, the number of model iterations to 150, and the initial learning rate to 0.0001.
[0103] First, the current hyperparameters of the initial waterlogging prediction model are obtained, and the current hyperparameters are combined into an initialization particle set, which contains a number of initialization particles and particle information of each initialization particle. The particle information mainly includes the particle position at the current moment and the particle speed at the current moment. Preferably, each initialization particle corresponds to an adjustment scheme of a hyperparameter. Secondly, the fitness of each initialization particle is calculated by a fitness function to obtain the fitness value of each initialization particle. In the present invention, the fitness function uses the root mean square error RMSE as the fitness function. For each initialization particle, the particle update operation is repeatedly performed until the fitness difference of the initialization particle is less than the preset difference threshold, and the current hyperparameters of the initial waterlogging prediction model are updated according to the hyperparameters corresponding to each update particle corresponding to each initialization particle. Preferably, when the initialization particle set contains multiple initialization particles, the hyperparameters corresponding to the update particle with the smallest fitness difference are selected on the basis of satisfying that the fitness difference is less than the preset difference threshold to update the current hyperparameters of the initial waterlogging prediction model. The particle update operation is specifically as follows: obtaining the current particle position and the current particle velocity of the currently initialized particle, updating the current particle velocity according to the preset particle velocity update formula to obtain the particle velocity at the next moment; updating the current particle position according to the preset particle position update formula to obtain the particle position at the next moment.
[0104] Among them, the preset particle speed update formula is as follows:
[0105] v t+1 =ωv t +c1r1(x pbest -x t )+c2r2(x gbest -x t )
[0106] Among them, r1 and r2 are two random numbers uniformly distributed in the range [0, 1]; c1 and c2 are acceleration coefficients; ω is the inertia weight factor; v t+1 is the speed updated at time t+1; x t is the position at time t; x pbest is the optimal position reached by the individual particle; x gbest is the optimal position reached by the particle group;
[0107] The default particle position update formula is as follows:
[0108] x t+1 =x t +v t+1
[0109] Among them, x t+1 The updated position at time t+1.
[0110] After each particle update, the updated particle is constructed according to the particle speed and particle position at the next moment; the fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle; the fitness difference of the current initialized particle is calculated according to the fitness value of the updated particle and the fitness value of the current initialized particle. If the fitness difference is less than the preset difference threshold, the current loop is exited. The hyperparameters of the initial flooding prediction model are updated according to the loop results. As a global optimization algorithm, the particle swarm algorithm can effectively search for the optimal hyperparameter configuration and further improve the generalization ability and prediction performance of the model.
[0111] Based on the above method embodiment, the present invention provides a corresponding device embodiment.
[0112] like Figure 3 As shown, an embodiment of the present invention provides a device for predicting waterlogging of electric power equipment, including: a data acquisition module, a time series data construction module, a waterlogging prediction module and a waterlogging prediction model construction module;
[0113] The data acquisition module is used to acquire waterlogging data and rainfall data of power equipment in historical periods;
[0114] The time series data construction module is used to construct the time series data to be processed according to the waterlogging data of the power equipment in the historical period and the rainfall data in the historical period;
[0115] The waterlogging prediction module is used to input the to-be-processed time series data into a waterlogging prediction model, so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment;
[0116] The waterlogging prediction model construction module is used to obtain a time series data training set; the time series data training set includes a number of time series data samples, each time series data sample includes waterlogging data samples, rainfall data samples and the degree of waterlogging of actual power equipment at a number of time steps; an initial waterlogging prediction model is constructed, and the initial waterlogging prediction model is iteratively trained with the time series data training set until the initial waterlogging prediction model converges, thereby generating a waterlogging prediction model; in each iterative training process, the initial waterlogging prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of waterlogging of the power equipment based on the time series features.
[0117] In a preferred embodiment, the initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a dropout layer, a fully connected layer, and an output layer;
[0118] In each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted flooding degree of the power equipment according to the time series features, including:
[0119] In each iterative training process, the time series data sample is input into the long short-term memory layer through the input layer, so that the long short-term memory layer extracts the time series features of the time series data sample, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer;
[0120] The attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain a second output result of the attention mechanism layer, and inputs the second output result into the discard layer;
[0121] The discard layer discards neurons in the second output result according to a preset discard rate to obtain a third output result of the discard layer, and inputs the third output result into the fully connected layer;
[0122] The fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
[0123] In a preferred embodiment, it also includes: a model evaluation and parameter adjustment module;
[0124] The model evaluation and parameter adjustment module is used to calculate the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set;
[0125] If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted;
[0126] If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, the current hyperparameters of the initial waterlogging prediction model are obtained;
[0127] Combining the current hyperparameters into an initialization particle set; wherein the initialization particle set includes each initialization particle and particle information of each initialization particle, and the particle information includes the particle position and particle velocity at the current moment;
[0128] The fitness of each initialized particle is calculated through the fitness function to obtain the fitness value of each initialized particle;
[0129] For each initialized particle, the particle update operation is repeatedly performed until the fitness difference of the current initialized particle is less than the preset difference threshold;
[0130] The current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to the updated particles corresponding to the initialized particles;
[0131] Wherein, the particle update operation includes:
[0132] Get the current particle position and current particle velocity of the currently initialized particle;
[0133] Update the particle speed at the current moment according to the preset particle speed update formula to obtain the particle speed at the next moment;
[0134] Update the particle position at the current moment according to the preset particle position update formula to obtain the particle position at the next moment;
[0135] Construct and update particles according to the particle speed and particle position at the next moment;
[0136] The fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle;
[0137] The fitness difference of the currently initialized particle is calculated based on the fitness value of the updated particle and the fitness value of the currently initialized particle.
[0138] In a preferred embodiment, it further comprises: a data preprocessing module;
[0139] The data preprocessing module is used to perform normalization processing on the time series data training set to obtain the normalized time series data training set.
[0140] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0141] Those skilled in the art can clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0142] Based on the above method item embodiments, the present invention provides corresponding terminal device item embodiments.
[0143] An embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for predicting waterlogging of electric power equipment as described in any one of the present invention is implemented.
[0144] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0145] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0146] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0147] Based on the above method item embodiments, the present invention provides a corresponding storage medium item embodiment.
[0148] An embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is executed, the device where the storage medium is located is controlled to execute a method for predicting waterlogging of electric power equipment as described in any one of the present inventions.
[0149] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium.
[0150] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting waterlogging of electric power equipment, characterized in that: include: Obtain waterlogging data and rainfall data of power equipment in historical periods; Construct the time series data to be processed based on the historical waterlogging data of power equipment and the historical rainfall data; Inputting the to-be-processed time series data into a waterlogging prediction model so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment; The waterlogging prediction model is constructed in the following way: Obtain a time series data training set; the time series data training set includes a number of time series data samples, each of which includes waterlogging data samples, rainfall data samples and real waterlogging degree of power equipment at a number of time steps; An initial flood prediction model is constructed, and the initial flood prediction model is iteratively trained with the time series data training set until the initial flood prediction model converges, thereby generating a flood prediction model; in each iterative training process, the initial flood prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of flooding of the power equipment based on the time series features.
2. A method for predicting waterlogging of electric power equipment according to claim 1, characterized in that: The initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a discard layer, a fully connected layer and an output layer; In each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted flooding degree of the power equipment according to the time series features, including: In each iterative training process, the time series data sample is input into the long short-term memory layer through the input layer, so that the long short-term memory layer extracts the time series features of the time series data sample, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer; The attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain a second output result of the attention mechanism layer, and inputs the second output result into the discard layer; The discard layer discards neurons in the second output result according to a preset discard rate to obtain a third output result of the discard layer, and inputs the third output result into the fully connected layer; The fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
3. A method for predicting waterlogging of electric power equipment according to claim 1, characterized in that: After the initial flooding prediction model extracts the time series features of the time series data samples and outputs the predicted flooding degree of the power equipment based on the time series features, it also includes: Calculate the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set; If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted; If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, the current hyperparameters of the initial waterlogging prediction model are obtained; Combining the current hyperparameters into an initialization particle set; wherein the initialization particle set includes each initialization particle and particle information of each initialization particle, and the particle information includes the particle position and particle velocity at the current moment; The fitness of each initialized particle is calculated through the fitness function to obtain the fitness value of each initialized particle; For each initialized particle, the particle update operation is repeatedly performed until the fitness difference of the current initialized particle is less than the preset difference threshold; The current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to the updated particles corresponding to the initialized particles; Wherein, the particle update operation includes: Get the current particle position and current particle velocity of the currently initialized particle; Update the particle speed at the current moment according to the preset particle speed update formula to obtain the particle speed at the next moment; Update the particle position at the current moment according to the preset particle position update formula to obtain the particle position at the next moment; Construct and update particles according to the particle speed and particle position at the next moment; The fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle; The fitness difference of the currently initialized particle is calculated based on the fitness value of the updated particle and the fitness value of the currently initialized particle.
4. A method for predicting waterlogging of electric power equipment according to claim 1, characterized in that: After obtaining the time series data training set, it also includes: The time series data training set is normalized to obtain a normalized time series data training set.
5. A device for predicting waterlogging of electric power equipment, characterized in that: include: Data acquisition module, time series data construction module, waterlogging prediction module and waterlogging prediction model construction module; The data acquisition module is used to acquire waterlogging data and rainfall data of power equipment in historical periods; The time series data construction module is used to construct the time series data to be processed according to the waterlogging data of the power equipment in the historical period and the rainfall data in the historical period; The waterlogging prediction module is used to input the to-be-processed time series data into a waterlogging prediction model, so that the waterlogging prediction model outputs a predicted value of the waterlogging degree of the power equipment; The waterlogging prediction model construction module is used to obtain a time series data training set; the time series data training set includes a number of time series data samples, each time series data sample includes waterlogging data samples, rainfall data samples and the degree of waterlogging of actual power equipment at a number of time steps; an initial waterlogging prediction model is constructed, and the initial waterlogging prediction model is iteratively trained with the time series data training set until the initial waterlogging prediction model converges, thereby generating a waterlogging prediction model; in each iterative training process, the initial waterlogging prediction model extracts the time series features of the time series data samples, and outputs a predicted degree of waterlogging of the power equipment based on the time series features.
6. The device for predicting waterlogging of electric power equipment according to claim 5, characterized in that: The initial flooding prediction model includes: an input layer, a long short-term memory layer, an attention mechanism layer, a discard layer, a fully connected layer and an output layer; In each iterative training process, the initial flooding prediction model extracts the time series features of the time series data samples, and outputs the predicted flooding degree of the power equipment according to the time series features, including: In each iterative training process, the time series data sample is input into the long short-term memory layer through the input layer, so that the long short-term memory layer extracts the time series features of the time series data sample, obtains the first output result of the long short-term memory layer, and inputs the first output result into the attention mechanism layer; The attention mechanism layer focuses on each time step in the first output result through the attention mechanism to obtain a second output result of the attention mechanism layer, and inputs the second output result into the discard layer; The discard layer discards neurons in the second output result according to a preset discard rate to obtain a third output result of the discard layer, and inputs the third output result into the fully connected layer; The fully connected layer predicts the predicted degree of flooding of the power equipment of the time series data sample according to the third output result, and outputs the predicted degree of flooding of the power equipment through the output layer.
7. The device for predicting waterlogging of electric power equipment according to claim 5, characterized in that: Also included: Model evaluation and parameter adjustment module; The model evaluation and parameter adjustment module is used to calculate the root mean square error of the current iteration and the mean square error of the current iteration according to the predicted degree of flooding of the power equipment, the actual degree of flooding of the power equipment and the number of samples in the time series data training set; If the root mean square error of the current iteration is less than the preset root mean square error threshold, and the mean square error of the current iteration is less than the preset mean square error threshold, the hyperparameters of the initial waterlogging prediction model are not adjusted; If the root mean square error of the current iteration is not less than the preset root mean square error threshold, or the mean square error of the current iteration is not less than the preset mean square error threshold, the current hyperparameters of the initial waterlogging prediction model are obtained; Combining the current hyperparameters into an initialization particle set; wherein the initialization particle set includes each initialization particle and particle information of each initialization particle, and the particle information includes the particle position and particle velocity at the current moment; The fitness of each initialized particle is calculated through the fitness function to obtain the fitness value of each initialized particle; For each initialized particle, the particle update operation is repeatedly performed until the fitness difference of the current initialized particle is less than the preset difference threshold; The current hyperparameters of the initial waterlogging prediction model are updated with the hyperparameters corresponding to the updated particles corresponding to the initialized particles; Wherein, the particle update operation includes: Get the current particle position and current particle velocity of the currently initialized particle; Update the particle speed at the current moment according to the preset particle speed update formula to obtain the particle speed at the next moment; Update the particle position at the current moment according to the preset particle position update formula to obtain the particle position at the next moment; Construct and update particles according to the particle speed and particle position at the next moment; The fitness of the updated particle is calculated through the fitness function to obtain the fitness value of the updated particle; The fitness difference of the currently initialized particle is calculated based on the fitness value of the updated particle and the fitness value of the currently initialized particle.
8. The device for predicting waterlogging of electric power equipment according to claim 5, characterized in that: Also includes: Data preprocessing module; The data preprocessing module is used to perform normalization processing on the time series data training set to obtain the normalized time series data training set.
9. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for predicting waterlogging of electric power equipment as claimed in any one of claims 1 to 4 is implemented.
10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is executed, the device where the storage medium is located is controlled to execute a method for predicting waterlogging of electric power equipment as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Waterlogging water depth prediction and multi-factor time sequence analysis method based on ILSTM
CN117332702A
Deep learning flood forecasting method and device fused with sparse self-attention mechanism
CN118586441A
Hydrological model parameter automatic calibration method and system based on fusion model and medium
CN118821630A