Fault prediction method, device and storage medium
By using the leapfrog algorithm and the firefly algorithm to optimize training parameters in inverter fault prediction, combined with the bidirectional long short-term memory network, the problem of difficulty in inverter fault prediction in the existing technology is solved, and efficient and accurate fault prediction is achieved. Predict and reduce the effectiveness of repair costs.
Patent Information
- Application Number
- CN202110820577.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-20
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-07-20
AI Technical Summary
It is difficult to effectively predict inverter failures with existing technology, which increases the difficulty and cost of maintenance and affects the safety and reliability of the equipment.
The leapfrog algorithm and the firefly algorithm are used to optimize the training parameters, and the bidirectional long short-term memory network is combined for fault prediction. The cross-entropy loss function and Dropout regularization are used to improve the prediction accuracy and speed of the model.
It effectively shortens the search time, improves the search accuracy and speed, avoids falling into the local optimal solution, improves the accuracy of fault prediction and model training speed, and reduces maintenance costs.
Smart Images

Figure CN113505875B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of control, and in particular to a fault prediction method, device and storage medium. Background Art
[0002] With the application of inverters in power systems and control systems, the impact of their failures has become increasingly important. Most motors are connected to inverters in control systems. Serious failures of the inverter will not only damage the inverter, but also the motor, which will increase the difficulty and cost of maintenance. Therefore, it is of great significance to improve the safety and reliability of the inverter, effectively predict possible failures of the inverter, take preventive tests in advance, save economic costs, and improve reliability. Summary of the invention
[0003] The main purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a fault prediction method, device and storage medium to solve the problem of predicting possible faults of equipment in the prior art.
[0004] On the one hand, the present invention provides a fault prediction method, comprising: using a frog leaping algorithm to optimize the training parameters of a prediction target device to obtain a local optimal solution of the training parameters; using a firefly algorithm to solve the local optimal solution of the optimized training parameters to obtain a global optimal solution of the training parameters; inputting the obtained global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model, and outputting a predicted value of a set operating parameter of the prediction target device.
[0005] Optionally, the training parameters are optimized using a frog leaping algorithm to obtain a local optimal solution of the training parameters, including: step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the frog leaping algorithm; step S12, initializing the adaptation parameter and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog; step S13, sorting the frogs according to the calculated fitness of the frogs, and updating the positions in each population according to the first position update rule; step S14, determining whether to change the position update rule according to the difference in fitness before and after the position update; step S15, if it is determined to change the position update rule, updating the position according to the second position update rule; step S16, mixing the updated frogs in each population with all populations, re-sorting them according to fitness, and re-dividing the population; repeating steps S12 to S16 until a first preset number of iterations or a first preset search accuracy is reached, and then outputting the local optimal solution of the training parameters.
[0006] Optionally, a firefly algorithm is used to find a global optimal solution for the local optimal solution of the training parameters obtained by optimization, including: step S21, initializing the calculation parameters of the firefly algorithm, and inputting the local optimal solution of the training parameters as the second objective function; step S22, calculating the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculating the update step size to update the position; step S23, updating the positions of all fireflies, and the firefly with the strongest luminous brightness moves randomly; step S24, judging whether the second preset number of iterations or the second preset search accuracy has been reached, and if not, returning to step S22, and outputting the position of the firefly when the second preset number of iterations or the second preset search accuracy has been reached.
[0007] Optionally, the update step size is adaptively updated according to the distance between fireflies.
[0008] Optionally, the global optimal solution of the training parameters is input into a bidirectional long short-term memory network to train a fault prediction model, and the predicted value of the set operating parameters of the predicted target device is output, including: setting the time window size, setting the number of batch processed data and the time series step size during the fault prediction model training process; using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network; calculating the cross entropy loss function, and when the minimized loss function is calculated, performing Dropout regularization; when the set number of traversal times is reached, ending the model training and outputting the predicted value of the set operating parameter.
[0009] Optionally, the prediction target device includes: an inverter; the training parameters include: operating time series data of the inverter's current, operating time series data of the voltage and / or operating time series data of the torque.
[0010] On the other hand, the present invention provides a fault prediction device, comprising: a first optimization unit, used to use a frog leaping algorithm to optimize the training parameters of the prediction target device to obtain a local optimal solution of the training parameters; a second optimization unit, used to use a firefly algorithm to solve the global optimal solution of the optimized local optimal solution of the training parameters to obtain a global optimal solution of the training parameters; a model training unit, used to input the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model, and output the predicted value of the set operating parameters of the prediction target device.
[0011] Optionally, the first optimization unit uses a frog leaping algorithm to optimize the training parameters to obtain a local optimal solution of the training parameters, including: step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the frog leaping algorithm; step S12, initializing the adaptation parameter and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog; step S13, sorting the frogs according to the calculated fitness of the frogs, and updating the position in each population according to the first position update rule; step S14, determining whether to change the position update rule according to the difference in fitness before and after the position update; step S15, if it is determined to change the position update rule, updating the position according to the second position update rule; step S16, mixing the updated frogs in each population with all populations, re-sorting them according to fitness, and re-dividing the population; repeating steps S12 to S16 until the first preset number of iterations or the first preset search accuracy is reached, and then outputting the local optimal solution of the training parameters.
[0012] Optionally, the second optimization unit uses the firefly algorithm to solve the global optimal solution of the local optimal solution of the training parameters obtained by optimization, including: step S21, initializing the calculation parameters of the firefly algorithm, and inputting the local optimal solution of the training parameters as the second objective function; step S22, calculating the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculating the update step size to update the position; step S23, updating the positions of all fireflies, and the firefly with the strongest luminous brightness moves randomly; step S24, judging whether the second preset number of iterations or the second preset search accuracy has been reached. If not, returning to step S22, and outputting the position of the firefly when the second preset number of iterations or the second preset search accuracy has been reached.
[0013] Optionally, it includes: the update step size is adaptively updated according to the distance between fireflies.
[0014] Optionally, the model training unit inputs the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model, and outputs the predicted value of the set operating parameters of the predicted target device, including: setting the time window size, setting the number of batch processed data and the time series step size during the fault prediction model training process; using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network; calculating the cross entropy loss function, and performing Dropout regularization when the minimized loss function is calculated; when the set number of traversals is reached, ending the model training and outputting the predicted value of the set operating parameter.
[0015] Optionally, the prediction target device includes: an inverter; the training parameters include: operating time series data of the inverter's current, operating time series data of the voltage and / or operating time series data of the torque.
[0016] Another aspect of the present invention provides a storage medium having a computer program stored thereon, wherein the program implements the steps of any of the aforementioned methods when executed by a processor.
[0017] According to the technical solution of the present invention, the improved frog leaping algorithm is adopted, which can effectively shorten the search time and improve the search accuracy and speed.
[0018] According to the technical solution of the present invention, the improved frog leaping algorithm combined with the adaptive firefly algorithm is used to optimize the training parameters of the bidirectional LSTM, which can reduce the number of bidirectional LSTM training steps, avoid falling into the local optimum, and improve the model prediction accuracy.
[0019] According to the technical solution of the present invention, by improving the leapfrog algorithm, the update rule is selected according to whether the updated fitness meets the needs. When the updated fitness is not at the set value, a new update rule is used: the fitness update method is changed when the fitness is not updated or the update speed is slow, the fitness is updated accurately and effectively, and the search speed is accelerated. It has higher accuracy and faster search speed than the original random update method (the step length search is shortened, which can speed up the search speed. The original step length is randomly updated, and the present invention is adaptively updated, so the accuracy can be improved).
[0020] According to the technical solution of the present invention, the adaptive firefly algorithm position update method uses an adaptive step size factor to avoid search failure and excessive search time, thereby speeding up the search speed.
[0021] According to the technical solution of the present invention, the improved frog leaping algorithm is combined with the adaptive firefly algorithm (AFA-MLA) to optimize the bidirectional LSTM, and the fitting weights and bias of the fully connected layer are also put into the AFA-MLA algorithm for optimization, and the loss function is calculated to minimize it, so that the selection of training parameters is more based on basis and accurate, and the final prediction result is closer to the true value, which speeds up the training speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0023] Figure 1 is a method schematic diagram of an embodiment of a fault prediction method provided by the present invention;
[0024] Figure 2 A flowchart of a specific implementation of the step of optimizing the training parameters by using the leapfrog algorithm to obtain the local optimal solution of the training parameters is shown;
[0025] Figure 3 A flow chart of an improved frog leaping algorithm is shown;
[0026] Figure 4 A flowchart of a specific implementation method of the steps of solving the global optimal solution of the local optimal solution of the training parameters obtained by optimization using the firefly algorithm is shown;
[0027] Figure 5 shows a flow chart of the adaptive firefly algorithm;
[0028] Figure 6 It is a schematic diagram of the long short-term memory network (LSTM) unit structure;
[0029] Figure 7 A flowchart diagram of a specific implementation method of the step of inputting the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model is shown;
[0030] Figure 8 A schematic diagram of the structure of a bidirectional long short-term memory network (LSTM) is shown;
[0031] Fig. 9 A schematic diagram of the process of optimizing a bidirectional long short-term memory network by combining an improved frog leaping algorithm with an adaptive firefly algorithm is shown;
[0032] Fig.10 A structural block diagram of an embodiment of a fault prediction device provided by the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. 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 making creative work are within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] The frog leaping algorithm (FLA) is a heuristic optimization method that simulates the process of frogs looking for food. The frogs in the population are in good and bad positions. The frogs in bad positions will gradually jump to relatively good positions until they find the optimal position, but they are prone to fall into the local optimal solution. The present invention first improves the update speed and accuracy of the frog leaping algorithm, and then uses the adaptive firefly algorithm to avoid falling into the local optimal solution and achieve the global optimum.
[0036] The present invention provides a fault prediction method, which can be used for fault prediction of inverters, for example. Figure 1 It is a method schematic diagram of an embodiment of the fault prediction method provided by the present invention.
[0037] like Figure 1 As shown, according to an embodiment of the present invention, the inverter fault prediction method at least includes step S110, step S120 and step S130.
[0038] Step S110: using a leapfrog algorithm to optimize the training parameters of the prediction target device to obtain a local optimal solution of the training parameters.
[0039] The time series data of the set operating parameters of the prediction target device is used as the input of the bidirectional long short-term memory network, and the training parameters are processed before being input into the bidirectional long short-term memory network to obtain the global optimal solution of the training parameters of the prediction target device. First, the frog leaping algorithm is used to optimize the training parameters to obtain the local optimal solution of the training parameters. The prediction target device may specifically include: an inverter; the training parameters are parameters for fault prediction, which may specifically be the time series data of the operating parameters of the prediction target device, and the operating parameters may be, for example, current, voltage and / or torque, that is, the operating time series data of current, the operating time series data of voltage and / or the operating time series data of torque.
[0040] Figure 2The flowchart of a specific implementation method of the steps of optimizing the training parameters by using the leapfrog algorithm to obtain the local optimal solution of the training parameters is shown. Figure 2 As shown, in a specific implementation, step S110 includes step S11, step S12, step S13, step S14, step S15 and step S16.
[0041] Step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the leapfrog algorithm.
[0042] According to the design requirements, if current is used for fault prediction, considering that too many training parameters will increase the training time, each layer of LSTM uses the same training parameters, 8 training parameters for each layer, plus 3 parameters for the fully connected layer, then the bidirectional LSTM requires 19 training parameters, so the search space is D = 19 dimensions. The calculation parameters of the frog leaping algorithm include: the total number of frogs m, the number of frog populations n, the number of frogs in each population λ, and the position of the i-th frog. Assume that there are a total of m frogs forming the initial population, and the position of the i-th frog is X i , where i = 1, 2...m; m frogs are divided into n populations, each population has λ frogs, then m = λn. Initialize the parameters m, n, X i .
[0043] Step S12, initializing the adaptation parameters and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog.
[0044] Initialize the adaptation parameters α, X in the first objective function min , X max , calculate the value of the first objective function, α is the adaptive step size factor. The first objective function here corresponds to the fitness of the frog's position. The objective function selected here is the fitting function to achieve the designed accuracy and shortest convergence time, where the accuracy is represented by acc, η is the adaptation constant, and X i+1 Indicates the frog's updated position, X b For fitness
[0045]
[0046] The highest frog location, search range [X min ,X max ].
[0047] Among them, g(x) represents the fitness of the frog; st is the requirement for the parameter range.
[0048] Step S13: Sort the frogs according to the calculated fitness of the frogs, and in each population, update the positions according to the first position update rule.
[0049] In each population, the frogs with poorer fitness within the location area where the population is located should jump towards the frog with the best fitness within this location area, and sort the frogs according to different fitness levels. The position of the frog with the worst fitness is X v , and the position of the frog with the best fitness is X b , and the position of the frog with the best fitness in the entire population is represented by X q .
[0050] The first position update rule is as follows:
[0051]
[0052] In the formula, is the position of the frog with the best fitness in the k-th (k < n) population, respectively represent the unupdated value and the updated value of the position of the frog with the worst fitness in the k-th population; X k represents the displacement amount of iteration.
[0053] Step S14: Determine whether to change the position update rule according to the difference in fitness before and after position update.
[0054] represents the updated fitness value of the position of the frog with the worst fitness in the k-th population; represents the fitness value before the update of the position of the frog with the worst fitness in the k-th population; if the difference in fitness of the frog with the worst fitness before and after updating the position then update the position information normally; if then determine to change the position update rule, where s is a constant, and the range is [2, 10].
[0055] Step S15: If it is determined to change the position update rule, then update the position according to the second position update rule.
[0056] If it means that the fitness of the new position has not been significantly optimized. At this time, in order to speed up the search speed, use the improved position update rule, that is, the second position update rule, as shown in the following formula:
[0057]
[0058] Among them, a1 and a2 are convergence constants, a1<a2, and the range is [0,1]. The improved position update rule can not only avoid the position not being updated, but also speed up the update speed, greatly improve the search speed, and accelerate the global search capability and convergence speed.
[0059] Step S16, the updated frogs in each population are mixed with all populations, re-sorted according to fitness, and the populations are re-divided.
[0060] The updated frogs in each population are mixed with all populations, re-sorted according to fitness, and all populations are re-divided, and then steps S12 to S16 are repeated until the first preset number of iterations or the first preset search accuracy is reached, and the local optimal solution of the training parameters is output. For example, until the maximum number of iterations M=500 is reached or the search accuracy acc is reached, the objective function and the frog's position information, that is, the local optimal solution of 19 training parameters, is output.
[0061] The above steps can also refer to Figure 3 The flowchart of the improved frog leaping algorithm is shown.
[0062] Step S120, using the firefly algorithm to solve the local optimal solution of the training parameters obtained by optimization for the global optimal solution, so as to obtain the global optimal solution of the training parameters;
[0063] After outputting the frog’s position, i.e., the local optimal solution of 19 training parameters, the adaptive firefly algorithm (AFA) is used to find the global optimal solution.
[0064] FA mainly uses the characteristics of fireflies' luminescence. Fireflies always move towards fireflies that are brighter than themselves. Its assumptions are: 1) Fireflies, regardless of gender, will be attracted to all other fireflies that are brighter than themselves; 2) The attraction of fireflies is proportional to the brightness. For any two fireflies, one will move towards the other one that is brighter than it, and the brightness decreases with the increase of distance; 3) If it does not find a firefly brighter than a given firefly, it will move randomly.
[0065] As mentioned above, the firefly algorithm contains two elements, namely brightness and attractiveness. Brightness reflects the quality of the firefly's position and determines its moving direction, and attractiveness determines the distance the firefly moves. The target optimization is achieved by continuously updating the brightness and attractiveness. The objective function value represents the brightness of the firefly. Brighter fireflies will attract other individuals to move in this direction. The attraction between them is inversely proportional to the distance. If there is no brighter individual around a firefly, it chooses not to move or randomly changes its position.
[0066] Figure 4The flowchart of a specific implementation method of the steps of using the firefly algorithm to solve the global optimal solution of the local optimal solution of the training parameters obtained by optimization is shown. Figure 4 As shown, in a specific implementation, step S120 includes step S21, step S22, step S23 and step S24.
[0067] Step S21, initializing the calculation parameters of the firefly algorithm, and inputting the global optimal solution of the training parameters as the second objective function.
[0068] Input the second objective function g(y), which is the brightness of the firefly. As with the improved frog leaping algorithm, the objective function is also set to achieve the fastest convergence speed and accuracy. The calculation parameters of the firefly algorithm include: the total number of fireflies, the number of fireflies in each population, the position of the i-th firefly, the maximum attraction, and the light absorption coefficient. Initialize the total number of fireflies num, the maximum number of iterations max, and the position Y of the i-th firefly i , where i = 1,2...num; the population of fireflies corresponds to the number of training parameters required for the bidirectional long short-term memory network, that is, 19, update the step size α, the maximum attraction β0, the light intensity absorption coefficient γ, and calculate the value of the second objective function.
[0069] Step S22, calculate the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculate the update step length to update the position.
[0070] Calculate the brightness of each firefly (i.e., the value of the second objective function), the distance y between different fireflies, and the relative attraction β. According to the fact that fireflies will fly to the position of brighter fireflies, the position update formula is:
[0071] y i (t+1)=y i (t)+β(y j (t)-y i (t))+α(rand-0.5)
[0072] Where α is the update step size. For example, χ is a random number in [0,1], α is the adaptive step size factor, and rand is a random factor that follows a uniform distribution.
[0073] The update step size α is adaptively updated according to the distance between fireflies. When the distance between fireflies is too large, in order to avoid search failure and long search time, using an adaptive step size can speed up the search.
[0074] Step S23, updating the positions of all fireflies, and the firefly with the brightest light moves randomly.
[0075] Step S24, determine whether the second preset number of iterations max or the second preset search accuracy is reached. If the second preset number of iterations max and the second preset search accuracy are not reached, return to step S22, and output the position of the firefly when the second preset number of iterations max or the second preset search accuracy is reached.
[0076] The output position parameters corresponding to each population are the 19 training parameters optimized from the improved frog leaping algorithm, otherwise return to step S22.
[0077] The above steps can also refer to Figure 5 Flowchart of the adaptive firefly algorithm shown.
[0078] Step S130, inputting the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model to obtain a fault prediction model.
[0079] Figure 6 This is a schematic diagram of the long short-term memory network (LSTM) unit structure. Figure 6 As shown in Figure 1, the LSTM unit structure is mainly composed of a forget gate, an input gate, and an output gate:
[0080] 1. Forget Gate
[0081] The forget gate determines whether to keep or remove the information of the previous state, and how much to keep; the input is the previous hidden state h t-1 and x t σ is the sigmoid function, σ = [0,1]; 0 means directly discarding the value of the previous cell state, that is, C t-1 ; 1 represents complete retention of C t-1 ; 0-1 means retaining part of C t-1 The value of .
[0082] f t =σ[W f (h t-1 +x t )+b f ]
[0083] In the formula, f t For the forget gate; W f is the training parameter of the forget gate, which is also the weight; b f It is another training parameter of the forget gate, which is also the bias.
[0084] 2. Input Gate
[0085] The information input by the input gate is kept in C t In the example, the input is the previous hidden state h t-1 and xt , after the activation function tanh, the output is a candidate state c t '.i t h t-1 and x t The output value after the σ function is also in the range of [0,1].
[0086]
[0087] At this time, the cell state is updated, and the output of the forget gate and the input gate need to be taken into account. The updated cell state is: C t
[0088] C t =f t ·C t-1 +i t ·c t '
[0089] 3. Output Gate
[0090] The output gate outputs the output state h of the hidden layer. t , the input of this part is composed of h t-1 and x t After the sigmoid function output, we get o t , and then the updated cell state C t After tanh processing, the output state h is obtained t .
[0091] o t =σ[W o (h t-1 +x t )+b o ]
[0092] h t =o t ·tanh·(c t ')
[0093] Figure 7 A flowchart of a specific implementation of the step of inputting the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model is shown. Figure 7 As shown, in a specific implementation, step S130 includes step S31, step S32, step S33 and step S34.
[0094] Step S31, setting the time window size, setting the number of batch processing data and the time series step size during model training;
[0095] Set the time window size, the batch size of data to be processed in batches during model training, and the time series step size.
[0096] Step S32, using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network.
[0097] Based on the set time window size, the number of batches of data processed during model training, and the time series step size, the bidirectional long short-term memory network model is trained and the neural network structure is built. The bidirectional LSTM structure is as follows Figure 8 As shown, the predicted time series is i(t)=p1h 1t +p2h 2t +p;
[0098] Among them, i(t) is the predicted value of the set operating parameter (for example, current), p1 and p2 are the weight values of the hidden layer output of the forward LSTM and the reverse LSTM respectively, and p is the bias.
[0099] Step S33, calculate the cross entropy loss function, and when the minimized loss function is calculated, perform Dropout regularization.
[0100] The sigmoid activation function is used, so the loss function uses the cross entropy loss function. The weights and biases p1, p2, and p of the fault prediction output value are adjusted to obtain the minimized loss function value, and then Dropout regularization is performed. Otherwise, the weights and biases of the fully connected layer are fine-tuned. In order to prevent overfitting, a Dropout layer is added to the bidirectional LSTM and fully connected layers, and Dropout is set to 0.5, so that the probability of discarding and retaining the data output by the hidden layer is the same, and the weight will not be increased to a high level to cause the model to overfit.
[0101] Step S34, when the set traversal times are reached, the model training is terminated and the predicted values of the set operating parameters are output.
[0102] Until the set epoch value is reached, that is, the number of times all samples traverse the algorithm, the model training is terminated, and the predicted value i(t) of the set operating parameter (such as current) is output after training, otherwise, step S33 is repeated.
[0103] The steps of optimizing the bidirectional long short-term memory network AFA-MFLA-BLSTM by combining the improved frog leaping algorithm with the adaptive firefly algorithm are as follows: Fig. 9 shown.
[0104] Step S1, initialize the input layer, output layer data dimension, and number of hidden units of the bidirectional LSTM, and correspond the firefly position parameters one by one to the training parameters of the bidirectional LSTM.
[0105] The output position parameters corresponding to each population are the training parameters optimized from the improved frog leaping algorithm; 19 populations of fireflies are used, with a total of 19 set training parameters, namely, the LSTM training parameters W of the first layer, f1 , b f1 , W i1 , b i1 , W c1 , b c1 , W o1 , b o1 ; LSTM training parameters W of the second layer f2 , b f2 , W i2 , b i2 , W c2 , b c2 , W o2 , b o2 The output fitting weights and biases p1, p2 and p of the fully connected layer are selected; the time series data of the inverter operation status, such as the operation time series data of the current, are selected.
[0106] Step S2, enter the MFLA algorithm, correspond the 19 training parameters to the 19 populations of frogs, initialize, randomly generate the total number of frogs m, the position of the i-th frog is x i , where i = 1, 2...m; divide m frogs into n populations, each population has λ frogs, and initialize the search range [X min ,X max ]. When the accuracy or maximum number of iterations is reached, the local optimal solution of 19 training parameters is output.
[0107] Step S3, calculate the objective function, enter the FA-MLA algorithm step, and output the position of the firefly that finally reaches the accuracy or the maximum number of iterations, that is, the 19 position parameters of the global optimal solution, which represents the optimal solution when the search accuracy and speed are achieved, that is, the solution of the training parameters.
[0108] Step S4, enter the bidirectional LSTM, determine the number of bidirectional LSTM units, if the number is too small, the model will be poorly fitted, if the number is too large, overfitting will occur. There are two layers of LSTM here, each layer uses 3 LSTM units, the data dimension of the input layer is n_input = S, and the number of units in each LSTM hidden layer is The integer value of the output layer, the data dimension output_dim = C. Initialize the values of Q, S, and C.
[0109] Step S5: taking the time series data of the inverter operation status, such as the operation time series data of the current, as the input of the network, and preprocessing the data.
[0110] Step S6, set the time window size, set the batch size of the data to be processed in batches during model training, and set the time series step size.
[0111] Step S7, train the bidirectional LSTM model and build a recurrent neural network structure. The bidirectional LSTM structure is shown in the figure Figure 2 As shown, the predicted time series of the fault circuit is i(t) = p1h 1t +p2h 2t +p;
[0112] Among them, i(t) is the predicted value of the current, p1 and p2 are the weight values of the hidden layer output of the forward LSTM and the reverse LSTM respectively, and p is the bias. Perform parameter training.
[0113] Step S8, calculate the loss function and Dropout regularization. Since the sigmoid activation function is used here, the cross entropy loss function is selected as the loss function. The weights and biases p1, p2 and p of the fault prediction output value are adjusted to obtain the minimized loss function value. In order to prevent overfitting, a Dropout layer is added to the bidirectional LSTM and fully connected layers, and Dropout = 0.5 is set to make the probability of discarding and retaining the data output by the hidden layer the same, so as not to increase the weight too high to cause the model to overfit;
[0114] Until the epoch value is reached, that is, the number of times all samples traverse the algorithm, the model training is terminated, and the predicted value i(t) of the current is output after training, otherwise step S8 is repeated.
[0115] The present invention also provides a fault prediction device, which can be used for example for fault prediction of an inverter.
[0116] Fig.10 FIG. 1 is a structural block diagram of an embodiment of a fault prediction device provided by the present invention. Fig. 9 As shown, the fault prediction device 100 includes a first optimization unit 110 , a second optimization unit 120 and a model training unit 130 .
[0117] The first optimization unit 110 is used to optimize the training parameters of the prediction target device by using the leapfrog algorithm to obtain a local optimal solution of the training parameters.
[0118] The time series data of the set operating parameters of the prediction target device is used as the input of the bidirectional long short-term memory network, and the training parameters are processed before being input into the bidirectional long short-term memory network to obtain the global optimal solution of the training parameters of the prediction target device. First, the frog leaping algorithm is used to optimize the training parameters to obtain the local optimal solution of the training parameters. The prediction target device may specifically include: an inverter; the training parameters are parameters for fault prediction, which may specifically be the time series data of the operating parameters of the prediction target device, and the operating parameters may be, for example, current, voltage and / or torque, that is, the operating time series data of current, the operating time series data of voltage and / or the operating time series data of torque.
[0119] Figure 2 The flowchart of a specific implementation method of the steps of optimizing the training parameters by using the leapfrog algorithm to obtain the local optimal solution of the training parameters is shown. Figure 2 As shown, in a specific implementation, the first optimization unit 110 uses the leapfrog algorithm to optimize the training parameters of the predicted target device to obtain the local optimal solution of the training parameters, including step S11, step S12, step S13, step S14, step S15 and step S16.
[0120] Step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the leapfrog algorithm.
[0121] According to the design requirements, if current is used for fault prediction, considering that too many training parameters will increase the training time, each layer of LSTM uses the same training parameters, 8 training parameters for each layer, plus 3 parameters for the fully connected layer, then the bidirectional LSTM requires 19 training parameters, so the search space is D = 19 dimensions. The calculation parameters of the frog leaping algorithm include: the total number of frogs m, the number of frog populations n, the number of frogs in each population λ, and the position of the i-th frog. Assume that there are a total of m frogs forming the initial population, and the position of the i-th frog is X i , where i = 1, 2...m; m frogs are divided into n populations, each population has λ frogs, then m = λn. Initialize the parameters m, n, X i .
[0122] Step S12, initializing the adaptation parameters and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog.
[0123] Initialize the adaptation parameters α, X in the first objective function min , X max, calculate the value of the first objective function, where α is the adaptive step factor. Here, the first objective function corresponds to the fitness of the position where the frog is located. The selected objective function here is a fitting function to achieve the designed accuracy and the shortest convergence time, where the accuracy is represented by acc, η is the adaptation constant, X i+1 represents the position after the frog updates its position, and X b is the position of the frog with the highest fitness, and the search range is [X min , X max .
[0124]
[0125] Among them, g(x) represents the fitness of the frog; s.t is the requirement for the parameter range.
[0126] Step S13: Sort the frogs according to the calculated fitness of the frogs, and in each population, update the position according to the first position update rule.
[0127] In each population, the frogs with relatively poor fitness in the position area where the population is located should jump towards the frog with the best fitness in this position area, and sort the frogs according to different fitness levels. The position of the frog with the worst fitness is X v , and the position of the frog with the best fitness is X b . The position of the frog with the best fitness in the entire population is represented by X q .
[0128] The first position update rule is as follows:
[0129]
[0130]
[0131] In the formula, is the position of the frog with the best fitness in the kth (k < n) population, respectively represent the unupdated value and the updated value of the position of the frog with the worst fitness in the kth population; X k represents the displacement of the iteration.
[0132] Step S14: Determine whether to change the position update rule according to the difference in fitness before and after the position update.
[0133] represents the updated fitness value of the position of the frog with the worst fitness in the kth population; represents the fitness value before the update of the position of the frog with the worst fitness in the kth population; if the fitness difference of the frog with the worst fitness before and after updating the position then update the position information normally; if Then determine the change position update rule, where s is a constant in the range of [2,10].
[0134] Step S15: If it is determined to change the location update rule, the location update is performed according to the second location update rule.
[0135] like This means that the fitness of the new position has not been significantly optimized. In order to speed up the search, an improved position update rule, namely the second position rule, is used, as shown in the following formula:
[0136]
[0137] Among them, a1 and a2 are convergence constants, a1<a2, and the range is [0,1]. The improved position update rule can not only avoid the position not being updated, but also speed up the update speed, greatly improve the search speed, and accelerate the global search capability and convergence speed.
[0138] Step S16, the updated frogs in each population are mixed with all populations, re-sorted according to fitness, and the populations are re-divided.
[0139] The updated frogs in each population are mixed with all populations, re-sorted according to fitness, and all populations are re-divided, and then steps S12 to S16 are repeated until the first preset number of iterations or the first preset search accuracy is reached, and the local optimal solution of the training parameters is output. For example, until the maximum number of iterations M=500 is reached or the search accuracy acc is reached, the objective function and the frog's position information, that is, the local optimal solution of 19 training parameters, is output.
[0140] The above steps can also refer to Figure 3 The flowchart of the improved frog leaping algorithm is shown
[0141] The second optimization unit 120 uses the firefly algorithm to solve the global optimal solution of the training parameters to obtain the global optimal solution of the training parameters.
[0142] After outputting the position of the output frog, i.e. the local optimal solution of the 19 training parameters, the adaptive firefly algorithm (AFA) is used to solve the global optimal solution.
[0143] FA mainly uses the characteristics of fireflies' luminescence. Fireflies always move towards fireflies that are brighter than themselves. Its assumptions are: 1) Fireflies, regardless of gender, will be attracted to all other fireflies that are brighter than themselves; 2) The attraction of fireflies is proportional to the brightness. For any two fireflies, one will move towards the other one that is brighter than it, and the brightness decreases with the increase of distance; 3) If it does not find a firefly brighter than a given firefly, it will move randomly.
[0144] As mentioned above, the firefly algorithm contains two elements, namely brightness and attractiveness. Brightness reflects the quality of the firefly's position and determines its moving direction, and attractiveness determines the distance the firefly moves. The target optimization is achieved by continuously updating the brightness and attractiveness. The objective function value represents the brightness of the firefly. Brighter fireflies will attract other individuals to move in this direction. The attraction between them is inversely proportional to the distance. If there is no brighter individual around a firefly, it chooses not to move or randomly changes its position.
[0145] Figure 4 The flowchart of a specific implementation method of the steps of using the firefly algorithm to solve the global optimal solution of the local optimal solution of the training parameters obtained by optimization is shown. Figure 4 As shown, in a specific implementation, the second optimization unit 120 uses the firefly algorithm to solve the global optimal solution of the training parameters, and obtaining the global optimal solution of the training parameters includes step S21, step S22, step S23 and step S24.
[0146] Step S21, initializing the calculation parameters of the firefly algorithm, and inputting the global optimal solution of the training parameters as the second objective function.
[0147] Input the objective function g(y), which is the brightness of the firefly. As with the improved frog leaping algorithm, the objective function is also set to achieve the fastest convergence speed and accuracy. The calculation parameters of the firefly algorithm include: the total number of fireflies, the number of fireflies in each population, the position of the i-th firefly, the maximum attraction, and the light absorption coefficient. Initialize the total number of fireflies num, the maximum number of iterations max, and the position Y of the i-th firefly i , where i = 1, 2...num; the population of fireflies corresponds to the number of training parameters required for the bidirectional long short-term memory network, that is, 19, update the step size α, the maximum attraction β0, the light intensity absorption coefficient γ, and calculate the value of the second objective function.
[0148] Step S22, calculate the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculate the update step length to update the position.
[0149] Calculate the brightness of each firefly (i.e., the value of the second objective function), the distance y between different fireflies, and the relative attraction β. According to the fact that fireflies will fly to the position of brighter fireflies, the position update formula is:
[0150] y i (t+1)=y i (t)+β(y j (t)-y i (t))+α(rand-0.5)
[0151] Where α is the update step size. For example, χ is a random number in [0,1], α is the adaptive step size factor, and rand is a random factor that follows a uniform distribution.
[0152] The update step size α is adaptively updated according to the distance between fireflies. When the distance between fireflies is too large, in order to avoid search failure and long search time, using an adaptive step size can speed up the search.
[0153] Step S23, updating the positions of all fireflies, and the firefly with the brightest light moves randomly.
[0154] Step S24, determine whether the second preset number of iterations max is reached. If it has not reached the second preset number of iterations max and the second preset search accuracy has not been reached, return to step S22, and output the position of the firefly when the second preset number of iterations or the second preset search accuracy is reached.
[0155] The output position parameters corresponding to each population are the 19 training parameters optimized from the improved frog leaping algorithm, otherwise return to step S22.
[0156] The above steps can also refer to Figure 5 Flowchart of the adaptive firefly algorithm shown.
[0157] The model training unit 130 is used to input the global optimal solution of the training parameters into a bidirectional long short-term memory network to train the fault prediction model, and output the predicted value of the set operating parameter of the prediction target device.
[0158] Figure 6 This is a schematic diagram of the long short-term memory network (LSTM) unit structure. Figure 6 As shown in Figure 1, the LSTM unit structure is mainly composed of a forget gate, an input gate, and an output gate:
[0159] 1. Forget Gate
[0160] The forget gate determines whether to keep or remove the information of the previous state, and how much to keep; the input is the previous hidden state ht-1 and x t σ is the sigmoid function, σ = [0,1]; 0 means directly discarding the value of the previous cell state, that is, C t-1 ; 1 represents complete retention of C t-1 ; 0-1 means retaining part of C t-1 The value of .
[0161] f t =σ[W f (h t-1 +x t )+b f ]
[0162] In the formula, f t For the forget gate; W f is the training parameter of the forget gate, which is also the weight; b f It is another training parameter of the forget gate, which is also the bias.
[0163] 2. Input Gate
[0164] The information input by the input gate is kept in C t In the example, the input is the previous hidden state h t-1 and x t , after the activation function tanh, the output is a candidate state c t '.i t h t-1 and x t The output value after the σ function is also in the range of [0,1].
[0165]
[0166] At this time, the cell state is updated, and the output of the forget gate and the input gate need to be taken into account. The updated cell state is: C t
[0167] C t =f t ·C t-1 +i t ·c t '
[0168] 3. Output Gate
[0169] The output gate outputs the output state h of the hidden layer. t , the input of this part is composed of h t-1 and x t After the sigmoid function output, we get o t , and then the updated cell state C t After tanh processing, the output state h is obtained t .
[0170] o t =σ[W o (h t-1 +x t )+b o ]
[0171] h t =o t ·tanh·(c t ')
[0172] Figure 7 A flowchart of a specific implementation of the step of inputting the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model is shown. Figure 7 As shown, in a specific implementation, the model training unit 130 inputs the global optimal solution of the training parameters into a bidirectional long short-term memory network to train the fault prediction model, and outputs the predicted value of the set operating parameters of the predicted target device, including step S31, step S32, step S33 and step S34.
[0173] Step S31: setting the time window size, setting the number of batch processing data and the time series step size during model training;
[0174] Set the time window size, the batch size of data to be processed in batches during model training, and the time series step size.
[0175] Step S32, using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network,
[0176] Based on the set time window size, the number of batches of data processed during model training, and the time series step size, the bidirectional long short-term memory network model is trained and the neural network structure is built. The bidirectional LSTM structure is as follows Figure 8 As shown, the predicted time series is i(t)=p1h 1t +p2h 2t +p;
[0177] Among them, i(t) is the predicted value of the set operating parameter (for example, current), p1 and p2 are the weight values of the hidden layer output of the forward LSTM and the reverse LSTM respectively, and p is the bias.
[0178] Step S33, calculate the cross entropy loss function, and when the minimized loss function is calculated, perform Dropout regularization.
[0179] The sigmoid activation function is used, so the loss function uses the cross entropy loss function. The weights and biases p1, p2, and p of the fault prediction output value are adjusted to obtain the minimized loss function value, and then Dropout regularization is performed. Otherwise, the weights and biases of the fully connected layer are fine-tuned. In order to prevent overfitting, a Dropout layer is added to the bidirectional LSTM and fully connected layers, and Dropout is set to 0.5, so that the probability of discarding and retaining the data output by the hidden layer is the same, and the weight will not be increased to a high level to cause the model to overfit.
[0180] Step S34, when the set traversal times are reached, the model training is terminated and the predicted values of the set operating parameters are output.
[0181] Until the set epoch value is reached, that is, the number of times all samples traverse the algorithm, the model training is terminated, and the predicted value i(t) of the set operating parameter (such as current) is output after training, otherwise, step S33 is repeated.
[0182] The present invention also provides a storage medium corresponding to the fault prediction method, on which a computer program is stored, and when the program is executed by a processor, the steps of any of the aforementioned methods are implemented.
[0183] Accordingly, the solution provided by the present invention, according to the technical solution of the present invention, adopts an improved frog leaping algorithm, which can effectively shorten the search time, improve the search accuracy and speed; increase the heat exchange speed, and reduce the heat exchange time.
[0184] According to the technical solution of the present invention, the improved frog leaping algorithm combined with the adaptive firefly algorithm is used to optimize the training parameters of the bidirectional LSTM, which can reduce the number of bidirectional LSTM training steps, avoid falling into the local optimum, and improve the model prediction accuracy.
[0185] According to the technical solution of the present invention, by improving the leapfrog algorithm, the update rule is selected according to whether the updated fitness meets the needs. When the updated fitness is not at the set value, a new update rule is used: the fitness update method is changed when the fitness is not updated or the update speed is slow, the fitness is updated accurately and effectively, and the search speed is accelerated. It has higher accuracy and faster search speed than the original random update method (the step length search is shortened, which can speed up the search speed. The original step length is randomly updated, and the present invention is adaptively updated, so the accuracy can be improved).
[0186] According to the technical solution of the present invention, the adaptive firefly algorithm position update method uses an adaptive step size factor to avoid search failure and excessive search time, thereby speeding up the search speed.
[0187] According to the technical solution of the present invention, the improved frog leaping algorithm is combined with the adaptive firefly algorithm (AFA-MLA) to optimize the bidirectional LSTM, and the fitting weights and bias of the fully connected layer are also put into the AFA-MLA algorithm for optimization, and the loss function is calculated to minimize it, so that the selection of training parameters is more based on basis and accurate, and the final prediction result is closer to the true value, which speeds up the training speed.
[0188] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on a computer-readable medium or transmitted via a computer-readable medium. Other examples and implementations are within the scope and spirit of the present invention and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hard wiring, or a combination of any of these. In addition, each functional unit may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit.
[0189] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0190] The units described as separate components may or may not be physically separated, and the components of the control device may or may not be physical units, that is, they may be located in one place or distributed in multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0191] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0192] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.
Claims
1. A fault prediction method, characterized in that: include: The frog leaping algorithm is used to optimize the training parameters of the prediction target device to obtain a local optimal solution of the training parameters; The prediction target device includes: an inverter; the training parameters include: operating time series data of the inverter's current, operating time series data of the voltage and / or operating time series data of the torque; Using the firefly algorithm to solve the global optimal solution of the local optimal solution of the training parameters obtained by optimization, so as to obtain the global optimal solution of the training parameters; Inputting the obtained global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model, and outputting a predicted value of the set operating parameter of the prediction target device; The training parameters are optimized using the leapfrog algorithm to obtain the local optimal solution of the training parameters, including: Step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the leapfrog algorithm; Step S12, initializing the adaptation parameter and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog; Step S13, sorting the frogs according to the calculated fitness of the frogs, and updating the positions of the frogs in each population according to the first position updating rule; Step S14, determining whether to change the location update rule according to the difference between the fitness before and after the location update; represents the updated fitness value of the position of the frog with the worst fitness in the kth population; Indicates the fitness value of the frog with the worst fitness in the kth population before the update; if the fitness difference before and after the frog with the worst fitness updates its position Then determine the change position update rule, where s is a constant in the range of [2,10]; Step S15: If it is determined to change the location update rule, the location update is performed according to the second location update rule; the second location update rule is as shown in the following formula: in, is the position of the frog with the best fitness in the kth population, is the position of the frog with the worst fitness in the kth population, is the position of the frog with the best fitness in the entire population, They represent the unupdated and updated values of the position of the frog with the worst fitness in the kth population, respectively; a1 and a2 are convergence constants, a1<a2, and both are in the range of [0,1]; Step S16, mixing the updated frogs in each population with all populations, re-sorting them according to fitness, and re-dividing the populations; Steps S12 to S16 are repeatedly executed until a first preset number of iterations or a first preset search accuracy is reached, and then a local optimal solution of the training parameters is output.
2. The method according to claim 1, characterized in that: The firefly algorithm is used to solve the global optimal solution of the local optimal solution of the training parameters obtained by optimization, including: Step S21, initializing the calculation parameters of the firefly algorithm, and inputting the local optimal solution of the training parameters as the second objective function; Step S22, calculating the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculating the update step length to update the position; Step S23, updating the positions of all fireflies, and the firefly with the strongest brightness moves randomly; Step S24, determining whether the second preset number of iterations or the second preset search accuracy has been reached, if not, returning to step S22, and outputting the position of the firefly when the second preset number of iterations or the second preset search accuracy has been reached.
3. The method according to claim 2, characterized in that include: The update step size is adaptively updated according to the distance between the fireflies.
4. The method according to any one of claims 1 to 3, characterized in that: The globally optimal solution of the training parameters is input into a bidirectional long short-term memory network to train a fault prediction model, and a predicted value of the set operating parameter of the prediction target device is output, including: Set the time window size, the number of batches of data to be processed, and the time series step size during the fault prediction model training process; Using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network; Calculate the cross entropy loss function. When the minimized loss function is calculated, perform Dropout regularization. When the set number of iterations is reached, the model training ends and the predicted values of the set operating parameters are output.
5. A fault prediction device, characterized in that: include: A first optimization unit, configured to optimize the training parameters of the prediction target device by using a leapfrog algorithm to obtain a local optimal solution of the training parameters; The prediction target device includes: an inverter; the training parameters include: operating time series data of the inverter's current, operating time series data of the voltage and / or operating time series data of the torque; The second optimization unit uses a firefly algorithm to solve the local optimal solution of the training parameter obtained by optimization to obtain a global optimal solution of the training parameter; A model training unit, used for inputting the global optimal solution of the training parameters into a bidirectional long short-term memory network to train a fault prediction model, and outputting a predicted value of a set operating parameter of the prediction target device; The first optimization unit uses a leapfrog algorithm to optimize the training parameters to obtain a local optimal solution of the training parameters, including: Step S11, setting the dimension of the search space according to the number of training parameters required by the bidirectional long short-term memory network, and initializing the calculation parameters of the leapfrog algorithm; Step S12, initializing the adaptation parameter and search range of the objective function, and calculating the value of the first objective function as the fitness of the frog; Step S13, sorting the frogs according to the calculated fitness of the frogs, and updating the positions of the frogs in each population according to the first position updating rule; Step S14, determining whether to change the location update rule according to the difference between the fitness before and after the location update; represents the updated fitness value of the position of the frog with the worst fitness in the kth population; Indicates the fitness value of the frog with the worst fitness in the kth population before the update; if the fitness difference before and after the frog with the worst fitness updates its position Then determine the change position update rule, where s is a constant in the range of [2,10]; Step S15: If it is determined to change the location update rule, the location update is performed according to the second location update rule; the second location update rule is as shown in the following formula: in, is the position of the frog with the best fitness in the kth population, is the position of the frog with the worst fitness in the kth population, is the position of the frog with the best fitness in the entire population, They represent the unupdated and updated values of the position of the frog with the worst fitness in the kth population, respectively; a1 and a2 are convergence constants, a1<a2, and both are in the range of [0,1]; Step S16, mixing the updated frogs in each population with all populations, re-sorting them according to fitness, and re-dividing the populations; Steps S12 to S16 are repeatedly executed until a first preset number of iterations or a first preset search accuracy is reached, and then a local optimal solution of the training parameters is output.
6. The device according to claim 5, characterized in that The second optimization unit uses the firefly algorithm to solve the global optimal solution of the local optimal solution of the training parameter obtained by optimization, including: Step S21, initializing the calculation parameters of the firefly algorithm, and inputting the local optimal solution of the training parameters as the second objective function; Step S22, calculating the luminous brightness of each firefly, the distance between different fireflies and the relative attraction, and calculating the update step length to update the position; Step S23, updating the positions of all fireflies, and the firefly with the strongest brightness moves randomly; Step S24, determining whether the second preset number of iterations or the second preset search accuracy has been reached, if not, returning to step S22, and outputting the position of the firefly when the second preset number of iterations or the second preset search accuracy has been reached.
7. The device according to claim 6, characterized in that include: The update step size is adaptively updated according to the distance between the fireflies.
8. The device according to any one of claims 5 to 7, characterized in that: The model training unit inputs the global optimal solution of the training parameters into a bidirectional long short-term memory network to train the fault prediction model, and outputs the predicted value of the set operating parameter of the prediction target device, including: Set the time window size, the number of batches of data to be processed, and the time series step size during the fault prediction model training process; Using the obtained global optimal solution of the training parameters as the input of the bidirectional long short-term memory network; Calculate the cross entropy loss function. When the minimized loss function is calculated, perform Dropout regularization. When the set number of iterations is reached, the model training ends and the predicted values of the set operating parameters are output.
9. A storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the steps of any method described in claims 1-4 are implemented.
Citation Information
Patent Citations
Method for predicting transient stability of power system based on LSTM double-structure model
CN110829417A
