New energy station network security attack detection method based on LSTM-GRU model
Through the new energy station network security attack detection method based on the LSTM-GRU model, the problems of long detection time and low accuracy in the existing technology are solved, and fast and accurate network security attack detection is achieved, ensuring the power industry and information network stability.
Patent Information
- Application Number
- CN202410856932.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-11-01
AI Technical Summary
The existing technology has a long detection time in the network security detection of new energy stations, and cannot alarm in time. When facing high-dimensional and time-series traffic data, the detection accuracy is low, making it difficult to detect whether the network security is attacked in a timely and accurate manner. , affecting the stability of the power industry production and information network security.
Using the new energy station network security attack detection method based on the LSTM-GRU model, by constructing a long and short-term memory network and a gated recurrent unit network, the network traffic data of the time series is characterized and the Softmax function is introduced to output the network security attack detection results. Assess the status of the network security.
It realizes rapid and accurate detection of network security attacks in new energy stations, improves the efficiency of network traffic abnormality detection, and can timely issue alarm signals to ensure stable power industry production and information network security.
Smart Images

Figure CN118890169A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network attack security detection for new energy stations, and in particular to a network attack detection technology for new energy stations based on an LSTM-GRU model. Background Art
[0002] With the advancement of the construction of new power systems, clean energy represented by photovoltaics and wind power has developed rapidly, and large-scale new energy grid connection and development is the mainstream trend in the future. However, most new energy control centers are unmanned, and most new energy stations are built in remote locations, with scattered outdoor protection equipment and insufficient protection level. Under this background, the network security of the power system faces severe challenges, resulting in huge challenges to the safe and stable operation of the entire large power grid.
[0003] Regarding network security detection and early warning for new energy sites, existing technologies have proposed active early warning technology for network security at new energy sites, which collects log data from hosts, security devices, and network equipment to realize network security monitoring, take user behavior into consideration, and identify illegal device access, thereby improving the security level of the entire power system; it has analyzed the weak links in network security at new energy sites from four aspects: system, structure, management, and physical security, and proposed protective measures to improve the network security prevention capabilities of power monitoring; it has designed a network security early warning platform, proposed a network security alarm and monitoring system, and realized early perception and response to network security issues at new energy sites.
[0004] With the development of artificial intelligence technology in recent years, it has been applied to network security detection. The existing technology uses the random forest algorithm to detect network traffic anomalies; proposes a network anomaly detection technology based on convolutional neural networks, and uses hot coding images to build models; proposes a network attack behavior detection technology based on genetic algorithms and artificial neural networks, extracts network data features, and uses gravity algorithms to obtain trained network parameters to achieve real-time monitoring of network data and tracing of attack behaviors.
[0005] However, the above research method has a long detection time and cannot issue timely alarms when subjected to abnormal attacks. In addition, when faced with traffic data with high-dimensional and time series characteristics, the detection accuracy is low. Therefore, how to timely and accurately detect whether the network security of new energy stations is under attack and issue alarm signals to maintain the stability of power industry production and information network security has become a hot topic and difficulty in current research. Summary of the invention
[0006] The present invention aims to provide a new energy station network security attack detection method based on LSTM-GRU model. The use of long short-term memory network (LSTM) and gated recurrent unit network (GRU) can improve the efficiency of network traffic anomaly detection and realize new energy station network security attack detection.
[0007] In order to achieve the above object, the present invention is implemented by the following technical solutions:
[0008] The present invention is a new energy station network security attack detection method based on LSTM-GRU model, which is characterized by comprising the following operations:
[0009] Build an LSTM-GRU model, input the network traffic of new energy stations into the LSTM model, and learn the network traffic data of the time series;
[0010] Input the results of the LSTM model into the GRU network;
[0011] Introduce the Softmax function, set the output dimension of the Softmax function, output the network security attack detection results, and evaluate the network security status.
[0012] Furthermore, as a preferred embodiment of the present invention, the method further includes normalizing the network traffic of the new energy station and dividing it into a training set and a test set, and the normalization operation is:
[0013]
[0014] In the formula, is the normalized network traffic of new energy stations, x i is the network traffic of new energy stations, min(x i ) is the minimum value of the network flow of the new energy station, max(x i ) is the maximum value of the network traffic of the new energy station;
[0015] The training set is set as the historical network traffic data of new energy stations, and the test set is set as the online network traffic data of new energy stations.
[0016] Furthermore, as a preferred embodiment of the present invention, the formula for selecting information by the "gate" of the LSTM network is:
[0017]
[0018] In the formula, g(x) is the selective output of the "gate", σ is the activation function, the output is the amount of selected information, the size is between 0 and 1, x is the input, W is the weight, and b is the bias;
[0019] The forward propagation expression of the LSTM network is:
[0020]
[0021] In the formula, i t 、f t , o t are the input gate, forget gate and output gate respectively, σ is the activation function, W xi ,xW hi ,(W xf , W hf ,hW xo ,xW ho ,hW xc , W fc is the weight, b i ), b f , b o , b c ) is the bias, c t 、h t are the short-term memory and long-term memory at time t, respectively, t-1 , i h t-1 They are short-term memory and long-term memory at time t-1, respectively, and tanh (is the activation function;
[0022] After back propagation algorithm and cross loss function update parameters, the expression is:
[0023]
[0024] In the formula, y t , are the actual output and the predicted output respectively.
[0025] Further, as a preferred embodiment of the present invention, when constructing the LSTM-GRU model, the hidden state of the LSTM model at the last moment is used as the initial hidden state of the GRU network layer, and the calculation process of the GRU network is:
[0026] The expression for the reset gate is as follows:
[0027] r t =σ(W r x t +U r h t-1 +b r )
[0028] In the formula, r t is the reset gate at time t; σ is the Sigmoid activation function; W r Input data parameter matrix for reset gate; x t is the input at time t; U ris the parameter matrix of the reset gate at time t-1; h t-1 is the hidden door at time t-1; b r To reset the overall gate offset size;
[0029] The expression of hidden door is as follows:
[0030]
[0031] In the formula, h t Hide the door for time t; is the dot multiplication operation; U h is the parameter matrix of the hidden door at time t-1; W h b is the input data parameter matrix for the hidden gate; h is the overall offset size of the hidden door;
[0032] The expression of the update gate is as follows:
[0033] u t =σ(W u x t +U u h t-1 +b u )
[0034] In the formula, u t is the update gate; W u Input state parameter matrix at the current moment; U u b is the input data parameter matrix for the update gate; b u To update the overall gate offset size.
[0035] Further, as a preferred embodiment of the present invention, a Softmax function is introduced, the output dimension of the Softmax function is set, the network security attack detection result is output, and the expression of the introduced Softmax function in evaluating the network security status is:
[0036]
[0037] In the formula, P(y (i) =k|x (i) ) is the probability that sample i belongs to the kth category, and m is the output vector dimension;
[0038] Set the output dimension of the Softmax function to 4, corresponding to the normal state, pre-attack state, intrusion state, and compromise state, respectively. The pre-attack state, intrusion state, and compromise state are abnormal states. Output the detection results to evaluate the network security status.
[0039] The beneficial effects of the present invention are:
[0040] 1. Input the network traffic of the new energy station into the LSTM model, reconstruct the input data through LSTM to obtain the network traffic data of the forgetting, input and output gating, and feature learning time series.
[0041] 2. Input the LSTM prediction results into GRU, and use the advantage of GRU's fast fitting speed to improve the model optimization speed.
[0042] 3. Introduce the Softmax function to output the network security attack detection results and evaluate the network security status. By utilizing the respective advantages of the long short-term memory network (LSTM) and the gated recurrent unit network (GRU), the efficiency of network traffic anomaly detection can be improved, and the network security attack detection of new energy stations can be realized accurately and quickly. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a schematic diagram of the process of the present invention;
[0044] Figure 2 is a flow chart of network security attack detection in an embodiment of the present invention;
[0045] Figure 3 is a graph showing the relationship between the detection accuracy and the number of hidden layers in an embodiment of the present invention;
[0046] Figure 4 is a graph showing the relationship between the detection accuracy and the number of neurons in the hidden layer in an embodiment of the present invention;
[0047] Figure 5 is a graph showing the relationship between the detection accuracy and the learning rate in an embodiment of the present invention;
[0048] Figure 6 PR curve diagrams of various states in an embodiment of the present invention;
[0049] Figure 7 is a graph of various state detection accuracy in an embodiment of the present invention;
[0050] Figure 8 is a loss function change diagram in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.
[0052] like Figure 1 , Figure 2 As shown, a new energy station network security attack detection method based on the LSTM-GRU model of this embodiment includes the following steps:
[0053] S1, build LSTM-GRU model, input the network traffic of new energy stations into LSTM model, and feature learn the network traffic data of time series;
[0054] The data of network traffic flow of new energy stations is input into the LSTM network, and the attention mechanism is used to adaptively allocate the time and features of the data, strengthen the attention to the important time and features in the network traffic, calculate the input gate, forget gate and output gate, extract the network traffic data, and normalize it according to the following formula to divide the data into training set and test set:
[0055]
[0056] In the formula, is the normalized network traffic of new energy stations, x i is the network traffic of new energy stations, min(x i ) is the minimum value of the network flow of the new energy station, max(x i ) is the maximum value of the network traffic of the new energy station;
[0057] The training set is set to historical traffic data, and the test set is set to real-time network traffic data of new energy stations. The input data is input into the LSTM network, and the feature learning time dimension traffic data is performed.
[0058] LSTM network is a special type of recurrent neural network, which has the advantages of high prediction accuracy and strong recursive ability, and can solve the problem of long-term dependence of recurrent neural networks. Adding a "gate" structure to add or discard information can play a role in long-term memory. The formula for selecting information by the "gate" of the LSTM network is:
[0059]
[0060] Where g(x) is the selective output of the “gate”; σ is the activation function, i.e., the Sigmod function, and the output is the amount of selected information, ranging from 0 to 1.
[0061] The forward propagation expression of the LSTM network is:
[0062]
[0063] In the formula, i t 、f t , o t They are input gate, forget gate and output gate respectively; W xi , x W hi ,(W xf , W hf , h W xo, x W ho , h W xc , W fc is the weight; b i , b f , b o , b c ) is the bias; c t 、h t are the short-term memory and long-term memory at time t, respectively. t-1 , i h t-1 are the short-term memory and long-term memory at time t-1 respectively; tanh is the activation function.
[0064] During the forward propagation process, the input gate affects the information of the input data that is stored in the short-term memory; the forget gate affects the information that needs to be stored in the long-term memory, that is, the short-term memory information forgotten at the previous moment; the output gate affects the short-term memory information, that is, the information at the next moment.
[0065] After back propagation algorithm and cross loss function update parameters, the expression is:
[0066]
[0067] In the formula, y t , are the actual output and the predicted output respectively.
[0068] S2, input the results obtained by LSTM into the GRU network to improve the accuracy and speed of the model in detecting network security attacks; use the hidden state of the LSTM network at the last moment as the initial hidden state of the GRU network layer to ensure network coherence, greatly save the time cost of network re-learning, and make the model have higher accuracy in a shorter time. Input the output results of the LSTM network into the GRU network to improve the network fitting speed and improve the accuracy and speed of the model in detecting network security attacks. The calculation process of the entire network is:
[0069] The reset gate is the gate for forgetting information. Its size is determined by the current input data and the hidden gate at the previous moment. The expression is as follows:
[0070] r t =σ(W r x t +U r h t-1 +b r )
[0071] In the formula, r t is the reset gate at time t; σ is the Sigmoid activation function; W r Input data parameter matrix for reset gate; x t is the input at time t; Ur is the parameter matrix of the reset gate at time t-1; h t-1 is the hidden door at time t-1; b r To reset the overall gate offset size.
[0072] The size of the hidden door is determined by the hidden door at the previous moment and the reset door at the current moment. The expression is as follows:
[0073]
[0074] In the formula, h t Hide the door for time t; is the dot multiplication operation; U h is the parameter matrix of the hidden door at time t-1; W h b is the input data parameter matrix for the hidden gate; h The overall offset size of the hidden door.
[0075] The update gate is a gate where information is retained. Its size is determined by the hidden gate at the previous moment and the input at the current moment. The expression is as follows:
[0076] u t =σ(W u x t +U u h t-1 +b u )
[0077] In the formula, u t is the update gate; W u Input state parameter matrix at the current moment; U u h is the input data parameter matrix for the update gate; t-1 is the hidden door at time t-1; b u To update the overall gate offset size.
[0078] S3, introduce the Softmax function to output network security attack detection results and evaluate the network security status: The Softmax function is a multi-classification function. If the output label of input x is y, then the probability that x is the jth class is P(y=j|x). Assuming that the output vector dimension of the Softmax function is m, the size of all elements is between 0 and 1, and the sum is 1, the resulting expression is:
[0079]
[0080] In the formula, P(y (i) =k|x (i) ) is the probability that sample i belongs to the kth category.
[0081] The specific process of using the LSTM-GRU model to conduct security assessment on the new energy station network is as follows:
[0082] Step 1: extract the network traffic data of new energy stations, normalize it, and divide the data into a training set and a test set: Step 2: set the training set to the historical network traffic data of new energy stations;
[0083] Step 3: Input the input data into the LSTM network, feature learn the time dimension traffic data, input the LSTM network output result into the GRU network, the forward propagation network calculates the loss function, and the back propagation network updates the parameters;
[0084] Step 4: Determine whether the termination condition is met. If not, return to step 3; if so, proceed to the next step;
[0085] Step 5: Set the test set to online traffic data and input the input data into the trained model;
[0086] Step 6: Set the output dimension of the Softmax function to 4, corresponding to the normal state and the abnormal state, respectively. The abnormal state includes the pre-attack state, the intrusion state, and the compromise state, and output the detection result. The effectiveness of the detection model proposed in the present invention is verified according to actual network security attacks.
[0087] The following is an example to verify the application effect of the method proposed in this example. The experimental simulation environment is shown in Table 1.
[0088] Table 1 Experimental environment
[0089]
[0090] When the network is attacked, an alarm signal needs to be sent to the staff in time. This embodiment uses detection accuracy, precision and recall as measurement indicators. The calculation expression is as follows:
[0091]
[0092] In the formula, R A , R P , R R They are accuracy, precision, and recall respectively; n TP 、n TN are the number of positive samples and negative samples correctly identified; n FN 、n FP are the number of positive samples and negative samples that are misidentified.
[0093] The PR curve is R P and R R Relationship curve, PR curve and abscissa area are the average accuracy R AP , the calculation formula is:
[0094]
[0095] In the formula, R AP is the average accuracy, R P , R R are precision and recall respectively, and ∫d is the integral function.
[0096] The LSTM-GRU model has many parameters, and hyperparameters can directly affect the model detection effect. Therefore, selecting the optimal hyperparameters and reasonably designing the network structure are crucial to the detection results of network security attacks on new energy stations. The main considerations are as follows:
[0097] (1) Determine the number of hidden layers. When the number of hidden layers in the network is too large, the model has a stronger ability to learn traffic data, but overfitting may occur at this time; when the number of hidden layers in the network is too small, it cannot fully explore the traffic characteristics and the detection accuracy is low. Therefore, the determination of the number of hidden layers is given priority. The number of hidden layer neurons is set to 50, the learning rate is 0.005, and the number of hidden layers is increased from 1. The detection accuracy results are as follows: Figure 3 As shown in the figure, when the number of hidden layers is 2, the detection accuracy reaches the maximum value. When the number of hidden layers is too small, the learning ability is insufficient and the accuracy is low. When the number of hidden layers is large, overfitting occurs and the accuracy decreases. Therefore, the number of hidden layers is set to 2 in subsequent training.
[0098] (2) Determine the number of hidden layer neurons. Set the number of hidden layers to 2, the learning rate to 0.005, and gradually increase the number of hidden layer neurons from 50. The detection accuracy changes as follows: Figure 4 As shown in the figure, when the number of hidden layer neurons reaches 150, the detection accuracy is the highest. If the number of hidden layer neurons continues to increase, the detection accuracy will decrease and overfitting will occur. Therefore, the number of hidden layer neurons in the subsequent LSTM-GRU model is set to 200.
[0099] (3) Determination of learning rate. Set the number of hidden layers to 2, the number of hidden layer neural units to 150, and the learning rate to increase from 0.005. The change of detection accuracy with learning rate is shown in the following figure. Figure 5 As shown in the figure, when the learning rate reaches 0.015, the detection accuracy is the highest. Therefore, the subsequent model learning rate is set to 0.015.
[0100] In summary, the LSTM-GRU model hyperparameters are set to have 2 hidden layers, 200 hidden layer neurons, and a learning rate of 0.015.
[0101] The PR curves of various states based on the method in this paper are as follows Figure 6 As shown in the figure, various states RAP The values are all close to 1, indicating that the proposed method has good detection effect in various states.
[0102] The detection accuracy of various states is as follows Figure 7 As shown in the figure, the proposed method has a high detection accuracy for the normal state, pre-attack state, intrusion state, and compromise state, which shows that the proposed method can accurately predict the network security attack process. When an abnormal state occurs, early intervention can be carried out to prevent the network from being compromised.
[0103] In order to verify the advancement of this method, this method is compared with convolutional neural network, LSTM model and GRU network. The changes of network loss function with the number of iterations are shown as follows: Figure 8 As shown in the figure, when the number of iterations reaches 200, the loss function of the proposed method is the lowest, which is only 0.42, indicating that the proposed method has the best detection effect.
[0104] The results of detection indicators of different methods are shown in Table 2. As can be seen from the table, compared with convolutional neural networks, LSTM models, and GRU networks, the detection accuracy of this method is improved by 12.65%, 6.97%, and 10.82%, respectively, the precision is improved by 15.69%, 8.62%, and 12.54%, respectively, and the recall is improved by 15.21%, 9.25%, and 11.71%, respectively. In terms of detection time, compared with convolutional neural networks and LSTM networks, the detection time of this method is shortened by 242s and 171s, and is only 2s slower than the GRU network. This is because, although the convolutional neural network has the ability of deep learning, it cannot fully learn the characteristics of traffic at different times when facing the time-series station network traffic data, and the calculation time is long; although the LSTM model can extract traffic time series characteristics, the network parameters are too many, and it is easy to overfit, resulting in a decrease in detection effect, and there is still a problem of long detection time; although the GRU network has the advantage of fast detection of time series, the network learning ability is insufficient and cannot fully mine the characteristics of traffic data, resulting in low detection accuracy. To sum up, the method in this paper can respond accurately and quickly to network security attacks on new energy stations, which verifies the superiority of the method in this paper.
[0105] Table 2 Comparison of results of different methods
[0106]
[0107] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A new energy station network security attack detection method based on LSTM-GRU model, Features: The following steps are involved: Build an LSTM-GRU model, input the network traffic of new energy stations into the LSTM model, and learn the network traffic data of the time series; Input the results of the LSTM model into the GRU network; Introduce the Softmax function, set the output dimension of the Softmax function, output the network security attack detection results, and evaluate the network security status.
2. According to claim 1, a new energy station network security attack detection method based on LSTM-GRU model, Features: The method further includes normalizing the network traffic of the new energy station and dividing it into a training set and a test set, and the normalization operation is: In the formula, The network traffic of new energy stations after normalization , x i For new energy field Station network traffic, min(x i )for The minimum value of the network flow of the new energy station, max(x i ) is the maximum value of the network traffic of the new energy station; the training set is set to the historical network traffic data of the new energy station, and the test set is set to the online network traffic data of the new energy station.
3. According to claim 1, a new energy station network security attack detection method based on LSTM-GRU model, Features: Said The formula for the "gate" of the LSTM network to select information is: In the formula, g(x) is the selective output of the "gate", σ is the activation function, the output is the amount of selected information, the size is between 0 and 1, x is the input, W is the weight, and b is the bias; The forward propagation expression of the LSTM network is: In the formula, i t 、f t , o t They are input gate, forget gate and output gate respectively, σ (is the activation function, W xi x, W hi , W xf , W hf ,hW xo , x W ho , h W xc , W fc is the weight, b i 、b f 、b o 、b c ) is the bias, c t 、h t are the short-term memory and long-term memory at time t, respectively, t-1 , i h t-1 They are short-term memory and long-term memory at time t-1, respectively, and tanh (is the activation function; After back propagation algorithm and cross loss function update parameters, the expression is: In the formula, y t , are the actual output and the predicted output respectively.
4. According to claim 1, a new energy station network security attack detection method based on LSTM-GRU model, Features: When constructing the LSTM-GRU model, the hidden state of the LSTM model at the last moment is used as the initial hidden state of the GRU network layer. The calculation process of the GRU network is: The expression for the reset gate is as follows: r t =σ(W r x t +U r h t-1 +b r ) In the formula, r t is the reset gate at time t; σ is the Sigmoid activation function; W r Input data parameter matrix for reset gate; x t is the input at time t; U r is the parameter matrix of the reset gate at time t-1; h t-1 is the hidden door at time t-1; b r To reset the overall gate offset size; The expression of hidden door is as follows: In the formula, h t Hide the door for time t; is the dot multiplication operation; U h is the parameter matrix of the hidden door at time t-1; W h b is the input data parameter matrix for the hidden gate; h is the overall offset size of the hidden door; The expression of the update gate is as follows: u t =σ(W u x t +U u h t-1 +b u ) In the formula, u t is the update gate; W u Input state parameter matrix at the current moment; U u b is the input data parameter matrix for the update gate; b u To update the overall gate offset size.
5. According to claim 1, a new energy station network security attack detection method based on LSTM-GRU model, Features: The Softmax function is introduced, the output dimension of the Softmax function is set, the network security attack detection result is output, and the network security status is evaluated. The expression of the introduced Softmax function is: Where T is the transpose; Ti is the i-th sample; wl is the l-th sample, where l is the subscript; y′ (i) is the output result of network security attack detection of the i-th sample; y (i) is the output result of the GRU model of the i-th sample; x (i) is the category of the i-th sample; P(y (i) =kx (i) ) is the probability that sample i belongs to the kth category; m is the output vector dimension; Set the output dimension of the Softmax function to 4, corresponding to the normal state, pre-attack state, intrusion state, and compromise state, respectively. The pre-attack state, intrusion state, and compromise state are abnormal states. Output the detection results to evaluate the network security status.
Citation Information
Cited By
Enterprise risk dynamic assessment method, system and device based on multi-dimensional data
CN119831353A
