CN111127251A - Attack identification method based on LSTM neural network and grid-connected interface device - Google Patents

Attack identification method based on LSTM neural network and grid-connected interface device Download PDF

Info

Publication number
CN111127251A
CN111127251A CN201911342782.6A CN201911342782A CN111127251A CN 111127251 A CN111127251 A CN 111127251A CN 201911342782 A CN201911342782 A CN 201911342782A CN 111127251 A CN111127251 A CN 111127251A
Authority
CN
China
Prior art keywords
output
gate
input
weight
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911342782.6A
Other languages
Chinese (zh)
Inventor
习伟
李鹏
匡晓云
徐成斌
贺生国
姚浩
于杨
简淦杨
杨祎巍
陈锐
祖连兴
陈远生
占捷文
王乾刚
朱小帆
丁凯
何鸿雁
黄植炜
肖声远
吕志宁
刘威
邓巍
宁柏锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Power Supply Co ltd
China South Power Grid International Co ltd
CYG Sunri Co Ltd
Original Assignee
Shenzhen Power Supply Co ltd
China South Power Grid International Co ltd
CYG Sunri Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Power Supply Co ltd, China South Power Grid International Co ltd, CYG Sunri Co Ltd filed Critical Shenzhen Power Supply Co ltd
Priority to CN201911342782.6A priority Critical patent/CN111127251A/en
Publication of CN111127251A publication Critical patent/CN111127251A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Business, Economics & Management (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Economics (AREA)
  • Public Health (AREA)
  • Water Supply & Treatment (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides an attack identification method based on an LSTM neural network, which is characterized by comprising the following steps: the method comprises the steps of detecting data acquired by a grid-connected interface device in real time, identifying the data through an LSTM neural network model, and sending an alarm prompt and generating a corresponding log record when the data subjected to network attack exists; and when the data is normal, forwarding the data and uploading the data to the monitoring master station. The invention also provides a grid-connected interface device. Compared with the prior art, the long-time and short-time memory-based network model is adopted to detect the original data acquired by the grid-connected interface device in real time, when the original data has network attack, an alarm prompt is sent out and a corresponding log record is generated, when the original data does not have the network attack, the original data is forwarded, abnormal data are prevented from being uploaded to the upper layer by the grid-connected interface device, and therefore the information safety and the operation reliability of the combined cooling heating and power system are guaranteed.

Description

Attack identification method based on LSTM neural network and grid-connected interface device
Technical Field
The invention relates to a power grid system, in particular to an attack identification method based on an LSTM neural network and a grid-connected interface device.
Background
With the rapid development of economy and the improvement of the national standard of living, the demand and the requirement of energy sources in both industry and civilian use are continuously increasing. The phenomenon is obvious on the fossil energy, and the fossil energy still stays at the first place in various types of energy in twenty years in the future according to the latest statistical data of the global energy use condition.
In 2001, a plurality of government agencies in China jointly issue a 'rule on the development of cogeneration', which clearly shows that China encourages research and development and application of relevant aspects in the field of cogeneration and the like, encourages and supports the input of gas turbines using natural gas as energy, and gives great attention to national support and encourages application and research of relevant aspects in combined cycle cogeneration of gas turbines and small-sized gas combined cooling, heating and power generation and the like.
The combined cooling heating and power system is a combined cooling, heating and power system which takes gradient utilization of energy as a basic idea and natural gas as primary energy to generate three kinds of energy, namely cold, heat and power. Compared with the common energy supply system, the combined cooling heating and power system can supply the generated energy to the outside in addition to the efficient recovery and utilization of the energy, and has extremely low pollution to the environment.
The cold and heat electricity trigeminy supplies the system: the Combined Cooling, Heating and power supply, i.e. CCHP (Combined Cooling and power), refers to the power demand of users supplied by the generated power generated by using natural gas as the main fuel to drive gas power generation equipment such as gas turbines, micro-combustion engines or internal combustion engine generators, and the waste heat discharged after the system generates power is supplied to users for Cooling and Heating by waste heat recycling equipment. By the method, the primary energy utilization rate of the whole system is greatly improved, and the cascade utilization of energy is realized. The control variable of the cooling, heating and power triple supply system is mainly the gas engine power, and the control strategy is as follows: according to predicted or actually measured cold, heat and electric loads, the power of the combustion engine in optimized operation and the corresponding comprehensive utilization efficiency of the energy in optimized operation are calculated by using a program, and then the system operation state is adjusted by controlling the power of the combustion engine, so that the system tends to the highest state of the comprehensive utilization efficiency of the energy in the whole operation stage. In order to avoid optimization failure caused by load errors or overlarge errors in the calculation process, the comprehensive utilization efficiency of the optimized operation energy calculated by the program is compared with the actually measured comprehensive utilization efficiency of the energy, and if the difference is overlarge and exceeds a set value, the control system needs to be checked and corrected.
The combined cooling heating and power system is connected with a large power grid through a grid-connected interface device. With the development of the power grid towards the intellectualization direction, the national support of policies related to the cooling, heating and power combined supply system and the requirements of industries and people on the quality of electric energy at the present stage make the performances of the cooling, heating and power combined supply system grid-connected interface device, such as operation reliability, information safety and the like, more and more paid attention by researchers.
The combined network interface device of the combined cooling heating and power system is a kind of important intelligent equipment in the power grid, and the information technology is widely used in the current power grid. The intelligent devices in the power grid transmit respective instructions and requests through various communication modes, so that the importance of information technology is further highlighted in the intelligent power grid. However, while the power grid is developed intelligently and interactively, the network attack technology is also evolved step by step, the attack means has the characteristics of diversity, pertinence and the like, and an attacker can customize different information attack behaviors or modes for different service fields in the power grid, such as attack behaviors specific to intelligent equipment such as a power generation system, a power distribution network system, a control device and a protection device. At the present stage, the information security protection mechanism of the intelligent devices is not perfect, and the intelligent devices also have the intrusion tolerance function, so that the intelligent devices in the power grid cannot be well protected by using the traditional information security protection technology before the customized attack means.
Disclosure of Invention
The invention aims to provide an attack identification method based on an LSTM neural network and a grid-connected interface device, and aims to solve the technical problem of improving the information security and the operation reliability of a combined cooling heating and power system.
In order to solve the problems, the invention adopts the following technical scheme: an attack identification method based on an LSTM neural network comprises the steps of detecting data acquired by a grid-connected interface device in real time, identifying the data through an LSTM neural network model, and sending an alarm prompt and generating a corresponding log record when the data subjected to network attack exists; and when the data is normal, forwarding the data and uploading the data to the monitoring master station.
Further, when the data subjected to the network attack exists in the data, the data is also intercepted.
Further, when data subjected to network attack exists in the data, the alarm prompt is sent to an upper layer.
Further, before the data is identified by the LSTM neural network model, model training is also performed on the LSTM neural network, and the model training includes:
acquiring a training data set, namely acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive and negative samples form the training data set;
secondly, model training is carried out on the long-time memory neural network: and performing model training on the long-time memory neural network model through a training data set to obtain a trained LSTM neural network model.
Further, the model training of the long-term and short-term memory neural network model comprises:
(1) initializing an input and giving a desired output;
(2) randomly selecting a sample from the training sample set as the input of the LSTM neural network model, calculating the output value of each neuron by forward propagation, and calculating ftForget gate output, itInput gate output, ctCell state output, otOutput gate output, htThe values of five vectors are finally output:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure BDA0002332094210000032
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure BDA0002332094210000033
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure BDA0002332094210000034
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) introducing a cross entropy loss function E ═ y ln a + (1-y) ln (1-a)]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets the expectation, the expectation refers to the error value between the expected output and the actual output, the error value is less than or equal to 0.02, and the next sample is learned; otherwise, calculating the error term of the output layer:
Figure BDA0002332094210000031
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; the error term at the t-1 moment needs to be calculated when the time is propagated reversely:
Figure BDA0002332094210000041
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure BDA0002332094210000042
wherein E is a loss function;
Figure BDA0002332094210000043
the output of the previous layer after the calculation of the weight value and the offset value;
Figure BDA0002332094210000044
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure BDA0002332094210000045
input gate to output weight gradient:
Figure BDA0002332094210000046
cell state to output weight gradient:
Figure BDA0002332094210000047
output gate to output weight gradient:
Figure BDA0002332094210000048
input to forget gate weight gradient:
Figure BDA0002332094210000049
input to input gate weight gradient:
Figure BDA00023320942100000410
input to cell state weight gradient:
Figure BDA00023320942100000411
input to output gate weight gradient:
Figure BDA00023320942100000412
forgetting gate threshold gradient:
Figure BDA00023320942100000413
input gate threshold gradient:
Figure BDA00023320942100000414
cell state threshold gradient:
Figure BDA00023320942100000415
output gate threshold gradient:
Figure BDA00023320942100000416
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure BDA0002332094210000051
input gate-to-output weight update:
Figure BDA0002332094210000052
cell state to outputUpdating the weight:
Figure BDA0002332094210000053
input to forget gate weight update:
Figure BDA0002332094210000054
input to forget gate weight update:
Figure BDA0002332094210000055
input to input Gate weight update:
Figure BDA0002332094210000056
input to cell state weight update:
Figure BDA0002332094210000057
input to output gate weight update:
Figure BDA0002332094210000058
forgetting to update the door threshold:
Figure BDA0002332094210000059
input gate threshold update:
Figure BDA00023320942100000510
updating the unit state threshold:
Figure BDA00023320942100000511
updating the output gate threshold value:
Figure BDA00023320942100000512
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) and repeating the process until all samples are learned to obtain the trained LSTM neural network model.
The invention also discloses a grid-connected interface device, which comprises a control module, a display module, a communication module, an alternating current module, an input/output module, a detection module, a storage module and a power module, wherein:
the control module is connected with the power supply module, the detection module, the communication module, the output module, the display module and the storage module;
the control module is used for being connected and communicated with the upper layer and the lower layer through the communication module and sending the received data to the detection module for real-time detection and classification; generating alarm information according to the alarm prompt sent by the detection module, sending the alarm information to the display module, sending the alarm information, log records and data to the storage module for storage and/or sending the alarm information, the log records and the data to an upper layer through the communication module;
the display module is used for displaying the running state, realizing man-machine interaction and displaying after receiving the alarm prompt of the control module;
the communication module is used for communicating with external intelligent equipment;
the alternating current module is used for collecting analog electric parameters such as voltage and current of a common connection point, and power generation units and load analog quantities in the cold-hot triple supply system, transmitting the collected analog quantities to the AD conversion module to be converted into digital quantities which can directly participate in calculation, converting the digital quantities into digital signals and then transmitting the digital signals to the detection module;
the output module is used for outputting the instruction signal sent by the control module;
the input module is used for receiving and controlling the state and instruction information of a load switching switch in a common connection point or a cold-hot triple co-generation system and sending the state and instruction information to the detection module;
the power supply module is used for supplying power to each module;
the storage module is used for storing;
the detection module is used for detecting and classifying data sent by the control module in real time through a long-time memory neural network, outputting a classification result, judging whether a network attack class exists in the classification result, generating an alarm prompt according to the type of the network attack and sending the alarm prompt and a log record to the control module when the network attack class exists in the classification result, and intercepting the data; and when the data in the classification result are all classified into the normal class, the data are sent to the control module, and the control module sends the data to the upper layer through the communication module.
Further, before real-time detection and classification are performed on the data sent by the control module through the LSTM neural network model, the detection module also performs model training on the LSTM neural network, where the model training includes:
acquiring a training data set, namely acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive and negative samples form the training data set;
secondly, model training is carried out on the long-time memory neural network: and performing model training on the long-time and short-time memory neural network through a training data set to obtain a trained LSTM neural network model.
Further, the model training of the long-time and short-time memory neural network model comprises:
(1) initializing an input and giving a desired output;
(2) randomly selecting a sample from the training sample set as the input of the LSTM neural network model, calculating the output value of each neuron by forward propagation, and calculating ftForget gate output, itInput gate output, ctCell state output, otOutput gate output, htThe values of five vectors are finally output:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure BDA0002332094210000061
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure BDA0002332094210000071
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure BDA0002332094210000078
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) introducing a cross-entropy loss function E ═ ylna + (1-y) ln (1-a)]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets the expectation, the expectation refers to the error value between the expected output and the actual output, the error value is less than or equal to 0.02, and the next sample is learned; otherwise, calculating the error term of the output layer:
Figure BDA0002332094210000072
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; the error term at the t-1 moment needs to be calculated when the time is propagated reversely:
Figure BDA0002332094210000073
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure BDA0002332094210000074
wherein E is a loss function;
Figure BDA0002332094210000075
the output of the previous layer after the calculation of the weight value and the offset value;
Figure BDA0002332094210000076
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure BDA0002332094210000077
input gate to output weight gradient:
Figure BDA0002332094210000081
cell state to output weight gradient:
Figure BDA0002332094210000082
output gate to output weight gradient:
Figure BDA0002332094210000083
input to forget gate weight gradient:
Figure BDA0002332094210000084
input to input gate weight gradient:
Figure BDA0002332094210000085
input to cell state weight gradient:
Figure BDA0002332094210000086
input to output gate weight gradient:
Figure BDA0002332094210000087
forgetting gate threshold gradient:
Figure BDA0002332094210000088
input gate threshold gradient:
Figure BDA0002332094210000089
cell state threshold gradient:
Figure BDA00023320942100000810
output gate threshold gradient:
Figure BDA00023320942100000811
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure BDA00023320942100000812
input gate-to-output weight update:
Figure BDA00023320942100000813
cell state to output weight update:
Figure BDA00023320942100000814
input to forget gate weight update:
Figure BDA00023320942100000815
input to forget gate weight update:
Figure BDA00023320942100000816
input to input Gate weight update:
Figure BDA00023320942100000817
input to cell state weight update:
Figure BDA00023320942100000818
input to output gate weight update:
Figure BDA00023320942100000819
forgetting to update the door threshold:
Figure BDA0002332094210000091
input gate threshold update:
Figure BDA0002332094210000092
updating the unit state threshold:
Figure BDA0002332094210000093
updating the output gate threshold value:
Figure BDA0002332094210000094
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) and repeating the process until all samples are learned to obtain the trained LSTM neural network model.
Compared with the prior art, the method has the advantages that the long-time memory network (LSTM) -based model is adopted to detect the original data acquired by the grid-connected interface device in real time, when the network attack exists in the original data, the alarm prompt is sent out and the corresponding log record is generated, when the network attack does not exist in the original data, the original data is forwarded, the abnormal data is prevented from being uploaded to the upper layer by the grid-connected interface device, and therefore the information safety and the operation reliability of the combined cooling heating and power system are guaranteed.
Drawings
Fig. 1 is a structural diagram of a prior art intercooled-thermoelectric cogeneration system.
Fig. 2 is a flow chart of the present invention.
FIG. 3 is a schematic diagram of the LSTM neural network of the present invention.
Fig. 4 is a block diagram showing the configuration of the grid-connected interface device according to the present invention.
Fig. 5 is a schematic diagram of a specific example of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
As shown in fig. 1, the system structure of combined cooling, heating and power system is shown, the dotted line with double arrows in the figure is the communication line, the solid line is the power line, and the information that the combined cooling, heating and power system (grid-connected interface device) needs to collect mainly includes three types: the system comprises public connection point information, unit running state information and an upper layer scheduling instruction. Therefore, the system needs to exchange information with a lower-layer cold and hot combined supply system, a cold and hot load (intelligent equipment such as environmental meteorological monitoring and the like, which is not shown in the figure) and an upper-layer dispatching center, and collect electric quantities such as voltage, current and the like of a grid-connected point. In addition, running state information is generated according to the information and then is sent to a triple co-generation system monitoring master station (monitoring master station), so that the monitoring master station can judge the running state of the cooling, heating and power triple co-generation system in real time.
The combined cooling heating and power grid-connected interface device communicates respective instructions and requests with a lower-layer unit (combined cooling and power system, cooling and power load), an upper-layer monitoring master station and a scheduling center in a communication mode, so that the combined cooling and power grid-connected interface device occupies the position of an information interaction center in a grid-connected system. However, this also makes the possibility that the combined cooling heating and power grid-connected interface device is attacked by information and the influence on the operation of the whole system after the attack is great. For example, if the combined cooling, heating and power grid-connected interface device suffers from Dos attack, the combined cooling, heating and power grid-connected interface device cannot or stops responding to requests and instructions from a lower-layer unit, an upper-layer monitoring master station and a scheduling center, and even the combined cooling, heating and power grid-connected interface device is broken down. At this time, the whole system is in a paralyzed state. And the upper monitoring master station can not obtain an accurate state value of the combined cooling heating and power supply grid-connected interface device, so that an administrator makes an erroneous decision, and the safe and stable operation of the whole combined cooling heating and power supply system is endangered.
As shown in fig. 2, the invention discloses an attack identification method based on long-time and short-time memory neural network (LSTM) for a triple co-generation system, which comprises the steps of detecting data acquired by a grid-connected interface device in real time, identifying the data through an LSTM neural network model, and sending an alarm prompt and generating a corresponding log record when the data subjected to network attack exists; and when the data is normal, forwarding the data and uploading the data to the monitoring master station.
The data comprises voltage, current, frequency, active power, reactive power and power factor data of a public connection point, data such as remote signaling, remote measurement and power consumption, commands such as remote control opening and closing, remote regulation and starting and stopping, output power, load power, environmental meteorological data and the like of a cold and hot triple supply system;
the network attack is a denial of service attack (Dos) attack, which refers to a defect of intentionally attacking a network protocol implementation or exhausting resources of an attacked object by a brute force means directly, and aims to make a target computer or a network fail to provide normal service or resource access, so that a target system service system stops responding or even crashes, and the attack does not include intrusion into a target server or a target network device. These service resources include network bandwidth, file system space capacity, open processes or allowed connections. Such attacks can result in resource scarcity, and the consequences of such attacks cannot be avoided no matter how fast the processing speed of the computer is, how large the memory capacity is, and how fast the network bandwidth is.
The normal state is not under network attack.
When the data subjected to the network attack exists in the data, the data is also intercepted.
The alarm prompt is the type of network attack;
when data subjected to network attack exists in the data, an alarm prompt is sent to an upper layer (a main station for monitoring a combined cooling and heating system and the like), and the upper layer (the combined cooling and heating grid-connected interface device) is informed of the attack and the attack, so that an upper layer controller can know the running state of the combined cooling and heating grid-connected interface device, and a correct instruction can be issued conveniently.
The alarm prompt is displayed through a display and/or an indicator light; the alarm prompt is used for displaying the type of the network attack; the indicator light can set light sources with different colors according to the number of network attacks, so that a system administrator can perform attack processing after being prompted by an alarm.
When the data subjected to network attack exists in the data, the alarm prompt and the log record are also stored.
As shown in fig. 2, before the data is identified by the LSTM neural network model, model training is also performed on the LSTM neural network, and the model training includes:
acquiring a training data set, acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive samples represent original data when the grid-connected interface device is normal, the original data comprise voltage, current, frequency, active power, reactive power and power factor data of a public connection point, data such as remote signaling, remote measurement and power consumption, commands such as remote control switching-on and switching-off, remote regulation and starting and stopping, output power, load power and environmental meteorological data of the combined cooling and heating supply system and the like, and the negative samples represent abnormal data which are abnormal to the normal data when the grid-connected interface device is attacked by Dos; the positive and negative samples form a training data set;
secondly, model training is carried out on the long-time memory neural network: and performing model training on the long-time memory neural network model through a training data set to obtain the trained long-time memory (LSTM) neural network model.
The model training of the long-time memory neural network model comprises the following steps:
(1) initializing an input and giving a desired output; the scheme needs to detect whether the data contains the Dos attack type, so that the data is divided into two types: dos attack class, normal class; by X ═ X1,x2,…,xn,yk) To represent one sample in the training set, where x1、x2、…、xnRepresenting the characteristics of the sample X, selecting a source IP address, a target IP address, a protocol type, a service type, a data length and a time stamp of the sample as a characteristic vector for representing the sample X, wherein n is 6 to represent the characteristic number; y isk1, 2 denotes whether the sample belongs to the kth class, 0 denotes no; 1, indicates belonging to the kth class; and using the class value as the label value (i.e., the expected output value) of the sample; setting a network structure as three layers, namely an input layer, a hidden layer and an output layer;
(2) randomly selecting a sample (positive sample or negative sample) from the training sample set as an input of the LSTM neural network model, and calculating an output value of each neuron by forward propagation, namely calculating f in FIG. 3t(forget gate output), it(input gate output), ct(cell state output), ot(output gate output), ht(final output) values of five vectors:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure BDA0002332094210000121
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure BDA0002332094210000122
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure BDA0002332094210000125
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) the invention belongs to the binary problem, and the output layer adopts a sigmod activation function, so that a cross entropy loss function E ═ y ln a + (1-y) ln (1-a) is introduced]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets expectations (expectation refers to the error between the expected output and the actual output, ≦ 0.02), learn the next sample; otherwise, calculating the error term of the output layer:
Figure BDA0002332094210000123
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; the error term at the t-1 moment needs to be calculated when the time is propagated reversely:
Figure BDA0002332094210000124
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure BDA0002332094210000131
wherein E is a loss function;
Figure BDA0002332094210000132
the output of the previous layer after the calculation of the weight value and the offset value;
Figure BDA0002332094210000133
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure BDA0002332094210000134
input gate to output weight gradient:
Figure BDA0002332094210000135
cell state to output weight gradient:
Figure BDA0002332094210000136
output gate to output weight gradient:
Figure BDA0002332094210000137
input to forget gate weight gradient:
Figure BDA0002332094210000138
input to input gate weight gradient:
Figure BDA0002332094210000139
input to cell state weight gradient:
Figure BDA00023320942100001310
input deviceTo output gate weight gradient:
Figure BDA00023320942100001311
forgetting gate threshold gradient:
Figure BDA00023320942100001312
input gate threshold gradient:
Figure BDA00023320942100001313
cell state threshold gradient:
Figure BDA00023320942100001314
output gate threshold gradient:
Figure BDA00023320942100001315
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure BDA00023320942100001316
input gate-to-output weight update:
Figure BDA00023320942100001317
cell state to output weight update:
Figure BDA00023320942100001318
input to forget gate weight update:
Figure BDA0002332094210000141
input to forget gate weight update:
Figure BDA0002332094210000142
input to input Gate weight update:
Figure BDA0002332094210000143
input to cell state weight update:
Figure BDA0002332094210000144
input to output gate weight update:
Figure BDA0002332094210000145
forgetting to update the door threshold:
Figure BDA0002332094210000146
input gate threshold update:
Figure BDA0002332094210000147
updating the unit state threshold:
Figure BDA0002332094210000148
updating the output gate threshold value:
Figure BDA0002332094210000149
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) the above process is repeated until all samples are learned, and a trained long-time memory (LSTM) neural network model (namely, the weight and threshold parameters in the network) is obtained.
When the network is trained, the neurons allocate a weight to each feature of the sample, and the weight depends on the importance degree of the corresponding feature (for example, according to the characteristic that Dos attacks exist and are sent repeatedly frequently, the feature of the timestamp is obvious in the scheme); each layer in the network is configured with a bias term, so that the output of the neuron introduces nonlinear characteristics. For the technical scheme, because the problem of two classifications is solved, the sigmod function is adopted as the activation function of the output layer, so that the output of the output layer has the probability of normal Dos attack types, and the sum of output values is ensured to be 1; then, after each sample is input into the network, the probability of the normal and Dos attack type is finally output through the processing of the input layer, the hidden layer and the output layer. For example, after a sample (negative sample) under Dos attack is input to the network for processing, the final output is a normal type, and the probabilities of Dos attack are respectively: 0.40, 0.60; and the desired output of the network is: 0. 1, calculating the error between the actual output and the expected output, and if the error meets the requirement (less than or equal to 0.02), then learning the next sample; otherwise, indicating that the weight and the threshold of each layer in the network do not meet the set error requirement, performing back propagation on the error according to the steps in the training process, and updating the weight and the threshold; then, a new round of learning is carried out, and finally, the output probability becomes: 0.05, 0.95; the error at this time is calculated again, and if the error at this time meets the requirement, the corresponding type (i.e., Dos attack) with the highest probability (0.95) is output as the type of the sample, i.e., the sample is the sample subjected to Dos attack. After all samples are trained, the obtained final weight and threshold are the optimal parameter values of the model capable of classifying the training samples as accurately as possible, and (the network taking the obtained optimal weight and threshold as parameters) can have certain prediction capability on similar samples (real-time data).
As shown in fig. 4, the present invention further discloses a combined cooling heating and power supply grid interface device (grid interface device), which includes a control module (main CPU), a display module, a communication module, an ac module, an input/output module, a detection module, a storage module, and a power module, wherein:
the control module is connected with the power supply module, the detection module, the communication module, the output module, the display module and the storage module; the system is used for being connected and communicated with the upper layer and the lower layer through the communication module and sending the received data to the detection module for real-time detection and classification; generating alarm information according to the alarm prompt sent by the detection module, sending the alarm information, log records and data to the display module, storing the alarm information, the log records and the data in the storage module and/or sending the alarm information, the log records and the data to an upper layer (a main monitoring station of a triple co-generation monitoring system) through the communication module; the control module also coordinates and controls the work among all the modules connected with the control module, and makes a correct decision through intelligent management, analysis and judgment and then sends the decision to a lower layer through the input and output module;
the data comprises voltage, current, frequency, active power, reactive power and power factor data of a public connection point, data such as remote signaling, remote measurement and power consumption, commands such as remote control opening and closing, remote regulation and starting and stopping, output power, load power, environmental meteorological data and the like of a cold and hot triple supply system;
the log record includes information: attack time, attack duration, attack mode, type of transmission protocol corresponding to the attack, error data segmentation, start and end address information of the error data (namely, address information of the source device and the target device), and the like.
The display module is used for displaying the running state, realizing man-machine interaction and displaying after receiving the alarm prompt of the control module; the display module is a display and/or an indicator light, and displays an alarm prompt through the display and/or displays through the indicator light; the alarm prompt is used for displaying the type of the network attack; the indicator light can set light sources with different colors according to the number of network attacks, so that a system administrator can perform attack processing after being prompted by an alarm, and better human-computer interaction experience is realized;
the communication module is used for communicating with external intelligent equipment, mainly used for interacting data with intelligent equipment such as a lower layer controller, an environmental weather monitoring device, a cold and hot load and the like in a cold and hot triple supply system and a triple supply system monitoring master station and a scheduling center in an upper layer station, and mainly used for receiving or forwarding state information from the intelligent equipment on the lower layer and instruction information of a photovoltaic monitoring system and the scheduling center in the upper layer station, data such as remote signaling, remote measuring and power consumption, commands such as remote control on-off brake, remote regulating, start-stop and the like, output power, load power, environmental weather data and the like of a power generation unit;
the alternating current module is used for collecting analog electric parameters such as voltage and current of a common connection point, and power generation units and load analog quantities in the cold-hot triple supply system, transmitting the collected analog quantities to the AD conversion module to be converted into digital quantities which can directly participate in calculation, converting the digital quantities into digital signals and then transmitting the digital signals to the detection module;
the output module is used for outputting the instruction signals sent by the control module, and the instruction signals comprise an output control common connection point switch, a load switching switch in a cold-hot triple co-generation system, a breaker switch and the like;
the input module is used for receiving and controlling the state and instruction information of a load switching switch in a common connection point or a cold-hot triple co-generation system and sending the state and instruction information to the detection module;
the power supply module is used for supplying power to the control module, the communication module, the display module, the input and output module, the alternating current acquisition module, the detection module and other modules;
the storage module is used for storing alarm information, log information, data, control programs, electrical parameter information such as voltage and current of a public connection point, and state information such as a public connection point switch, a load switching switch in a cold and hot triple supply system, a breaker switch and the like;
the detection module is used for detecting and classifying data sent by the control module in real time through a long-time memory neural network, outputting a classification result, judging whether the classification result has a network attack class or not, generating an alarm prompt according to the type of the network attack and sending the alarm prompt and a log record to the control module when the network attack class exists in the classification result, and intercepting the data, and the control module sends the alarm prompt to the display module for display; when the data in the classification result are all classified into a normal class, the data are sent to the control module, and the control module sends the data to an upper layer through the communication module;
the data comprises voltage, current, frequency, active power, reactive power and power factor data of a public connection point, data such as remote signaling, remote measurement and power consumption, commands such as remote control opening and closing, remote regulation and starting and stopping, output power, load power, environmental meteorological data and the like of a cold and hot triple supply system;
the normal data is data which is not attacked by the network.
The alarm prompt is used for displaying the type of the network attack when the display module is used as a display; when the light source is an indicator light, light sources with different colors can be set according to the number of network attacks, so that a system administrator can perform attack processing after being prompted by an alarm.
As shown in fig. 2, before the detection module performs real-time detection and classification on the data sent by the control module through the long-time and short-time memory neural network model, the detection module also performs model training on the LSTM neural network, where the model training includes:
acquiring a training data set, acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive samples represent original data when the grid-connected interface device is normal, the original data comprise voltage, current, frequency, active power, reactive power and power factor data of a public connection point, data such as remote signaling, remote measurement and power consumption, commands such as remote control switching-on and switching-off, remote regulation and starting and stopping, output power, load power and environmental meteorological data of the combined cooling and heating supply system and the like, and the negative samples represent abnormal data which are abnormal to the normal data when the grid-connected interface device is attacked by Dos; the positive and negative samples form a training data set;
secondly, model training is carried out on the long-time memory neural network: and performing model training on the long-time memory neural network through a training data set to obtain a trained long-time memory (LSTM) neural network model.
The model training of the long-time memory neural network model comprises the following steps:
(1) initializing an input and giving a desired output; the scheme needs to detect whether the data contains the Dos attack type, so that the data is divided into two types: dos attack class, normal class; by X ═ X1,x2,…,xn,yk) To represent one sample in the training set, where x1、x2、…、xnRepresenting the characteristics of the sample X, selecting a source IP address, a target IP address, a protocol type, a service type, a data length and a time stamp of the sample as a characteristic vector for representing the sample X, wherein n is 6 to represent the characteristic number; y isk1, 2 denotes whether the sample belongs to the kth class, 0 denotes no; 1, indicates belonging to the kth class; and using the class value as the label value (i.e., the expected output value) of the sample; setting a network structure as three layers, namely an input layer, a hidden layer and an output layer;
(2) randomly selecting a sample (positive sample or negative sample) from the training sample set as the input of the neural network model, and calculating the output value of each neuron by forward propagation, namely calculating f in fig. 3t(forget gate output), it(input gate output), ct(cell state output), ot(output gate output), ht(final output) values of five vectors:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure BDA0002332094210000171
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure BDA0002332094210000172
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure BDA0002332094210000189
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) the invention belongs to the binary problem, and the output layer adopts a sigmod activation function, so that a cross entropy loss function E- [ ylna + (1-y) ln (1-a) is introduced]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets expectations (expectation refers to the error between the expected output and the actual output, ≦ 0.02), learn the next sample; otherwise, calculating the error term of the output layer:
Figure BDA0002332094210000181
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; t-1 time needs to be calculated when propagating backward along timeError term of etching:
Figure BDA0002332094210000182
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure BDA0002332094210000183
wherein E is a loss function;
Figure BDA0002332094210000184
the output of the previous layer after the calculation of the weight value and the offset value;
Figure BDA0002332094210000185
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure BDA0002332094210000186
input gate to output weight gradient:
Figure BDA0002332094210000187
cell state to output weight gradient:
Figure BDA0002332094210000188
output gate to output weight gradient:
Figure BDA0002332094210000191
input to forget gate weight gradient:
Figure BDA0002332094210000192
input to input gate weight gradient:
Figure BDA0002332094210000193
input to cell state weight gradient:
Figure BDA0002332094210000194
input to output gate weight gradient:
Figure BDA0002332094210000195
forgetting gate threshold gradient:
Figure BDA0002332094210000196
input gate threshold gradient:
Figure BDA0002332094210000197
cell state threshold gradient:
Figure BDA0002332094210000198
output gate threshold gradient:
Figure BDA0002332094210000199
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure BDA00023320942100001910
input gate to outputAnd (3) updating the weight:
Figure BDA00023320942100001911
cell state to output weight update:
Figure BDA00023320942100001912
input to forget gate weight update:
Figure BDA00023320942100001913
input to forget gate weight update:
Figure BDA00023320942100001914
input to input Gate weight update:
Figure BDA00023320942100001915
input to cell state weight update:
Figure BDA00023320942100001916
input to output gate weight update:
Figure BDA00023320942100001917
forgetting to update the door threshold:
Figure BDA0002332094210000201
input gate threshold update:
Figure BDA0002332094210000202
updating the unit state threshold:
Figure BDA0002332094210000203
updating the output gate threshold value:
Figure BDA0002332094210000204
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) the above process is repeated until all samples are learned, and a trained long-time memory (LSTM) neural network model (namely, the weight and threshold parameters in the network) is obtained.
When the network is trained, the neurons allocate a weight to each feature of the sample, and the weight depends on the importance degree of the corresponding feature (for example, according to the characteristic that Dos attacks exist and are sent repeatedly frequently, the feature of the timestamp is obvious in the scheme); each layer in the network is configured with a bias term, so that the output of the neuron introduces nonlinear characteristics. For the technical scheme, because the problem of two classifications is solved, the sigmod function is adopted as the activation function of the output layer, so that the output of the output layer has the probability of normal Dos attack types, and the sum of output values is ensured to be 1; then, after each sample is input into the network, the probability of the normal and Dos attack type is finally output through the processing of the input layer, the hidden layer and the output layer. For example, after a sample (negative sample) under Dos attack is input to the network for processing, the final output is a normal type, and the probabilities of Dos attack are respectively: 0.40, 0.60; and the desired output of the network is: 0. 1, calculating the error between the actual output and the expected output, and if the error meets the requirement (less than or equal to 0.02), then learning the next sample; otherwise, indicating that the weight and the threshold of each layer in the network do not meet the set error requirement, performing back propagation on the error according to the steps in the training process, and updating the weight and the threshold; then, a new round of learning is carried out, and finally, the output probability becomes: 0.05, 0.95; the error at this time is calculated again, and if the error at this time meets the requirement, the corresponding type (i.e., Dos attack) with the highest probability (0.95) is output as the type of the sample, i.e., the sample is the sample subjected to Dos attack. After all samples are trained, the obtained final weight and threshold are the optimal parameter values of the model capable of classifying the training samples as accurately as possible, and (the network taking the obtained optimal weight and threshold as parameters) can have certain prediction capability on similar samples (real-time data).
As shown in fig. 5, for the detection module to obtain the voltage and current parameters from the ethernet communication module in real time and detect the parameters, if Dos attack exists in the parameters, the long-term memory neural network module will recognize Dos attack from the parameters, so as to output the detection result of the information of Dos attack, and the control module will issue an alarm prompt and generate a log record according to the detection result.

Claims (8)

1. An attack identification method based on an LSTM neural network is characterized in that: the method comprises the steps of detecting data acquired by a grid-connected interface device in real time, identifying the data through an LSTM neural network model, and sending an alarm prompt and generating a corresponding log record when the data subjected to network attack exists; and when the data is normal, forwarding the data and uploading the data to the monitoring master station.
2. The LSTM neural network-based attack recognition method of claim 1, wherein: when the data subjected to the network attack exists in the data, the data is also intercepted.
3. The LSTM neural network-based attack recognition method of claim 1, wherein: and when the data subjected to the network attack exists in the data, sending an alarm prompt to an upper layer.
4. The LSTM neural network-based attack recognition method of claim 1, wherein: before data is identified through the LSTM neural network model, model training is carried out on the LSTM neural network, and the model training comprises the following steps:
acquiring a training data set, namely acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive and negative samples form the training data set;
secondly, model training is carried out on the long-time memory neural network: and performing model training on the long-time memory neural network model through a training data set to obtain a trained LSTM neural network model.
5. The LSTM neural network-based attack recognition method of claim 4, wherein: the model training of the long-time memory neural network model comprises the following steps:
(1) initializing an input and giving a desired output;
(2) randomly selecting a sample from the training sample set as the input of the LSTM neural network model, calculating the output value of each neuron by forward propagation, and calculating ftForget gate output, itInput gate output, ctCell state output, otOutput gate output, htThe values of five vectors are finally output:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure FDA0002332094200000011
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure FDA0002332094200000012
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure FDA00023320942000000211
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) introducing a cross entropy loss function E ═ y ln a + (1-y) ln (1-a)]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets the expectation, the expectation refers to the error value between the expected output and the actual output, the error value is less than or equal to 0.02, and the next sample is learned; otherwise, calculating the error term of the output layer:
Figure FDA0002332094200000021
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; the error term at the t-1 moment needs to be calculated when the time is propagated reversely:
Figure FDA0002332094200000022
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure FDA0002332094200000023
wherein E is a loss function;
Figure FDA0002332094200000024
the output of the previous layer after the calculation of the weight value and the offset value;
Figure FDA0002332094200000025
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure FDA0002332094200000026
input gate to output weight gradient:
Figure FDA0002332094200000027
cell state to output weight gradient:
Figure FDA0002332094200000028
output gate to output weight gradient:
Figure FDA0002332094200000029
input to forget gate weight gradient:
Figure FDA00023320942000000210
input to input gate weight gradient:
Figure FDA0002332094200000031
input to cell state weight gradient:
Figure FDA0002332094200000032
input to output gate weight gradient:
Figure FDA0002332094200000033
forgetting gate threshold gradient:
Figure FDA0002332094200000034
input gate threshold gradient:
Figure FDA0002332094200000035
cell state threshold gradient:
Figure FDA0002332094200000036
output gate threshold gradient:
Figure FDA0002332094200000037
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure FDA0002332094200000038
input gate-to-output weight update:
Figure FDA0002332094200000039
cell state to output weight update:
Figure FDA00023320942000000310
input to forget gate weight update:
Figure FDA00023320942000000311
input to forget gate weight update:
Figure FDA00023320942000000312
input to input Gate weight update:
Figure FDA00023320942000000313
input to cell state weight update:
Figure FDA00023320942000000314
input to output gate weight update:
Figure FDA00023320942000000315
forgetting to update the door threshold:
Figure FDA00023320942000000316
input gate threshold update:
Figure FDA00023320942000000317
updating the unit state threshold:
Figure FDA00023320942000000318
updating the output gate threshold value:
Figure FDA00023320942000000319
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) and repeating the process until all samples are learned to obtain the trained LSTM neural network model.
6. A grid-connected interface device is characterized in that: including control module, display module, communication module, exchange module, input/output module, detection module, storage module and power module, wherein:
the control module is connected with the power supply module, the detection module, the communication module, the output module, the display module and the storage module;
the control module is used for being connected and communicated with the upper layer and the lower layer through the communication module and sending the received data to the detection module for real-time detection and classification; generating alarm information according to the alarm prompt sent by the detection module, sending the alarm information to the display module, sending the alarm information, log records and data to the storage module for storage and/or sending the alarm information, the log records and the data to an upper layer through the communication module;
the display module is used for displaying the running state, realizing man-machine interaction and displaying after receiving the alarm prompt of the control module;
the communication module is used for communicating with external intelligent equipment;
the alternating current module is used for collecting analog electric parameters such as voltage and current of a common connection point, and power generation units and load analog quantities in the cold-hot triple supply system, transmitting the collected analog quantities to the AD conversion module to be converted into digital quantities which can directly participate in calculation, converting the digital quantities into digital signals and then transmitting the digital signals to the detection module;
the output module is used for outputting the instruction signal sent by the control module;
the input module is used for receiving and controlling the state and instruction information of a load switching switch in a common connection point or a cold-hot triple co-generation system and sending the state and instruction information to the detection module;
the power supply module is used for supplying power to each module;
the storage module is used for storing;
the detection module is used for detecting and classifying data sent by the control module in real time through a long-time memory neural network, outputting a classification result, judging whether a network attack class exists in the classification result, generating an alarm prompt according to the type of the network attack and sending the alarm prompt and a log record to the control module when the network attack class exists in the classification result, and intercepting the data; and when the data in the classification result are all classified into the normal class, the data are sent to the control module, and the control module sends the data to the upper layer through the communication module.
7. The grid-tied interface device according to claim 6, wherein: before real-time detection and classification are carried out on data sent by the control module through the LSTM neural network model by the detection module, model training is carried out on the LSTM neural network model, and the model training comprises the following steps:
acquiring a training data set, namely acquiring positive and negative samples of data of a combined cooling heating and power supply grid-connected interface device, wherein the positive and negative samples form the training data set;
secondly, model training is carried out on the long-time memory neural network model: and performing model training on the long-time and short-time memory neural network through a training data set to obtain a trained LSTM neural network model.
8. The grid-tied interface device according to claim 7, wherein: the model training of the long-time memory neural network model comprises the following steps:
(1) initializing an input and giving a desired output;
(2) randomly selecting a sample from the training sample set as the input of the LSTM neural network, calculating the output value of each neuron by forward propagation, and calculating ftForget gate output, itInput gate output, ctCell state output, otOutput gate output, htThe values of five vectors are finally output:
ft=σ(Wfxxt+Wfhht-1+Wfcct-1+bf);
it=σ(Wixxt+Wihht-1+Wicct-1+bi);
Figure FDA0002332094200000051
ot=σ(Woxxt+Wohht-1+Wocct-1+bo);
Figure FDA0002332094200000052
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; x is the number oftInputting training samples; h ist-1Is the output of the previous moment;
Figure FDA0002332094200000053
representing a multiply by element operator; the sigma is a binary classification activation function sigmod; tan h is an activation function;
(3) introducing a cross entropy loss function E ═ y ln a + (1-y) ln (1-a)]Calculating an error value, wherein y and a are respectively an expected output value and an actual output value of the sample; if the error meets the expectation, the expectation refers to the error value between the expected output and the actual output, the error value is less than or equal to 0.02, and the next sample is learned; otherwise, calculating the error term of the output layer:
Figure FDA0002332094200000061
where E is the loss function, htIs the output at time t;
(4) starting back propagation according to the error in the step (3), wherein the back propagation of the error comprises two directions: backward propagation along time and backward propagation along the model structure; the error term at the t-1 moment needs to be calculated when the time is propagated reversely:
Figure FDA0002332094200000062
where E is the loss function, ht-1Is the output at time t-1, δt-1Represents the error at time t-1; back propagation along the model structure:
Figure FDA0002332094200000063
wherein E is a loss function;
Figure FDA0002332094200000064
the output of the previous layer after the calculation of the weight value and the offset value;
Figure FDA0002332094200000065
the error of the l-1 layer at the time t is shown;
(5) calculating the following weights and threshold gradients from the error terms calculated by back-propagation in step (4): forget gate to output weight gradient:
Figure FDA0002332094200000066
input gate to output weight gradient:
Figure FDA0002332094200000067
cell state to output weight gradient:
Figure FDA0002332094200000068
output gate to output weight gradient:
Figure FDA0002332094200000069
input to forget gate weight gradient:
Figure FDA00023320942000000610
input to input gate weight gradient:
Figure FDA00023320942000000611
input to cell state rightHeavy gradient:
Figure FDA00023320942000000612
input to output gate weight gradient:
Figure FDA00023320942000000613
forgetting gate threshold gradient:
Figure FDA00023320942000000614
input gate threshold gradient:
Figure FDA00023320942000000615
cell state threshold gradient:
Figure FDA00023320942000000616
output gate threshold gradient:
Figure FDA00023320942000000617
wherein, Wfx、Wfh、WfcThe weight matrixes are respectively input to a forgetting gate, the forgetting gate is output, and the forgetting gate is in a unit state; wix、Wih、WicWeight matrices for input to input gate, input gate to output, input gate to cell state, respectively; wox、Woh、WocThe weight matrixes are respectively input to an output gate, the output gate to an output and the output gate to a unit state; wcx、WchThe weight matrixes are respectively input to a unit state and the unit state to output; bf、bi、bc、boBias terms for the forgetting gate, the input gate, the cell state, and the output gate, respectively; e is a loss function; deltaf,t、δi,t、δc,t、δo,tRespectively correspond to f in the networkt、it、ct、otThe error term of (2); wherein xtAn input representing time t; h isj-1Represents the output of the output layer at time j-1; t represents transposition;
weight and threshold update: forget gate-to-output weight update:
Figure FDA0002332094200000071
input gate-to-output weight update:
Figure FDA0002332094200000072
cell state to output weight update:
Figure FDA0002332094200000073
input to forget gate weight update:
Figure FDA0002332094200000074
input to forget gate weight update:
Figure FDA0002332094200000075
input to input Gate weight update:
Figure FDA0002332094200000076
input to cell state weight update:
Figure FDA0002332094200000077
input to output gate weight update:
Figure FDA0002332094200000078
forgetting to update the door threshold:
Figure FDA0002332094200000079
input gate threshold update:
Figure FDA00023320942000000710
updating the unit state threshold:
Figure FDA00023320942000000711
updating the output gate threshold value:
Figure FDA00023320942000000712
wherein η -0.01 is the learning rate;
(6) entering the next round of training, namely recalculating the output of the sample according to the updated weight and the threshold value until the error meets the expectation;
(7) and repeating the process until all samples are learned to obtain the trained LSTM neural network model.
CN201911342782.6A 2019-12-23 2019-12-23 Attack identification method based on LSTM neural network and grid-connected interface device Pending CN111127251A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911342782.6A CN111127251A (en) 2019-12-23 2019-12-23 Attack identification method based on LSTM neural network and grid-connected interface device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911342782.6A CN111127251A (en) 2019-12-23 2019-12-23 Attack identification method based on LSTM neural network and grid-connected interface device

Publications (1)

Publication Number Publication Date
CN111127251A true CN111127251A (en) 2020-05-08

Family

ID=70501553

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911342782.6A Pending CN111127251A (en) 2019-12-23 2019-12-23 Attack identification method based on LSTM neural network and grid-connected interface device

Country Status (1)

Country Link
CN (1) CN111127251A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112165485A (en) * 2020-09-25 2021-01-01 山东炎黄工业设计有限公司 Intelligent prediction method for large-scale network security situation
CN113592150A (en) * 2021-07-04 2021-11-02 北京工业大学 Attack phase prediction method based on LSTM and attacker information
CN117473396A (en) * 2023-11-23 2024-01-30 湖南盈旺智慧能源科技有限公司 New energy automobile intelligent battery management system based on deep learning

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103545931A (en) * 2013-10-30 2014-01-29 国家电网公司 Distributed type photovoltaic power generation grid connection interface device
CN104167763A (en) * 2014-09-04 2014-11-26 华电电力科学研究院 Distributed energy management method and distributed energy management device composed of ground layer, intermediate layer and energy management layer
CN109670306A (en) * 2018-11-27 2019-04-23 国网山东省电力公司济宁供电公司 Electric power malicious code detecting method, server and system based on artificial intelligence
CN109922038A (en) * 2018-12-29 2019-06-21 中国电力科学研究院有限公司 A kind of detection method and device of the abnormal data for electric power terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103545931A (en) * 2013-10-30 2014-01-29 国家电网公司 Distributed type photovoltaic power generation grid connection interface device
CN104167763A (en) * 2014-09-04 2014-11-26 华电电力科学研究院 Distributed energy management method and distributed energy management device composed of ground layer, intermediate layer and energy management layer
CN109670306A (en) * 2018-11-27 2019-04-23 国网山东省电力公司济宁供电公司 Electric power malicious code detecting method, server and system based on artificial intelligence
CN109922038A (en) * 2018-12-29 2019-06-21 中国电力科学研究院有限公司 A kind of detection method and device of the abnormal data for electric power terminal

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112165485A (en) * 2020-09-25 2021-01-01 山东炎黄工业设计有限公司 Intelligent prediction method for large-scale network security situation
CN113592150A (en) * 2021-07-04 2021-11-02 北京工业大学 Attack phase prediction method based on LSTM and attacker information
CN117473396A (en) * 2023-11-23 2024-01-30 湖南盈旺智慧能源科技有限公司 New energy automobile intelligent battery management system based on deep learning

Similar Documents

Publication Publication Date Title
CN111127251A (en) Attack identification method based on LSTM neural network and grid-connected interface device
CN111131237B (en) Microgrid attack identification method based on BP neural network and grid-connected interface device
CN111144549A (en) Microgrid attack identification method based on convolutional neural network and microgrid coordination controller
Zu et al. A simple gated recurrent network for detection of power quality disturbances
CN115907168A (en) Abnormal data processing system for power load prediction
CN114430165A (en) Micro-grid group intelligent coordination control method and device based on depth model prediction
CN111143835B (en) Non-invasive protection method for business logic of electric power metering system based on machine learning
CN116562158A (en) Method for estimating residual life of air circuit component of aeroengine based on interpretable attention mechanism
CN111061152B (en) Attack recognition method based on deep neural network and intelligent energy power control device
CN111045330B (en) Attack identification method based on Elman neural network and grid-connected interface device
CN113033089B (en) Method and device for identifying abnormal electricity consumption user
CN116956203B (en) Method and system for measuring action characteristics of tapping switch of transformer
CN116500480A (en) Intelligent battery health monitoring method based on feature transfer learning hybrid model
CN113420896B (en) Transformer substation inspection auxiliary method and system based on artificial intelligence and big data analysis
KR20240001975A (en) Systems for predicting and monitoring solar power generation using artificial intelligence
CN113872183A (en) Comprehensive energy optimization and coordination system
CN109767062B (en) Dynamic generation method of power grid task disposal scheme
CN113536607A (en) Transformer substation signal transmission system evaluation method and system
CN115598459A (en) Power failure prediction method for 10kV feeder line fault of power distribution network
Meng et al. Study on immune cloud model adapted to complex mechanical system diagnosis
Haolan et al. Incipient fault detection of power distribution system based on statistical characteristics and transformer network
CN114626195B (en) Modeling method and system for solid oxide fuel cell system by using space-time data
CN116760195B (en) Method, system, equipment and storage medium for monitoring all-element resources of power system
CN110716496B (en) Intelligent control system abnormity prediction method based on ensemble learning
Sun et al. Classification of Frequency Disturbance Event in Power Systems Considering Optimal PMU Placement

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200508