Non-intrusive load monitoring method and device based on temporal attention mechanism

Information

  • Patent Grant
  • 11868869
  • Patent Number
    11,868,869
  • Date Filed
    Wednesday, June 28, 2023
    a year ago
  • Date Issued
    Tuesday, January 9, 2024
    12 months ago
Abstract
The present invention relates to the field of smart grids, and provides a non-intrusive load monitoring method and device based on temporal attention mechanism. The method comprises the following steps: obtaining a total load data, an equipment load data, and corresponding sampling time of a building during a certain period of time; integrating the total load data and the equipment load data with the corresponding sampling time to obtain an enhanced total load data and an enhanced equipment load data; using a sliding window method to segment the enhanced total load data and the enhanced equipment load data, and constructing a deep learning training dataset; constructing a neural network model based on a deep learning training framework and training the model using the training dataset. The present invention can effectively extract the working time mode of the load and its inherent dependencies, thereby improving the accuracy of load monitoring.
Description

This application claims priority of Chinese Application No. 202211118482.1, filed Sep. 15, 2022, which is hereby incorporated by reference.


TECHNICAL FIELD

The present invention relates to the fields of smart grids and artificial intelligence, specifically a non-intrusive load monitoring method and device based on temporal attention mechanism.


DESCRIPTION OF RELATED ART

Conducting efficient demand response is an important task in reducing energy consumption and promoting the construction of next-generation energy systems. At present, non-intrusive load monitoring technology has been applied to identify and decompose the equipment's power consumption load from the total load, and then used for load side energy consumption planning. Considering the difficulty in ensuring the applicability of traditional load monitoring methods based on switch action detection and feature recognition, non-intrusive load monitoring methods based on deep learning technology have been widely used. However, most existing deep learning methods only rely on electrical quantities such as active power and reactive power as the basis for load identification, without considering the dependency relationship between load working time information and different working modes, which limits the accuracy of load monitoring. In other words, how to integrate load operation time information into the load monitoring process to improve the load monitoring effect of equipment with complex working modes is a key issue to further participate in demand response.


SUMMARY OF THE INVENTION

The object of the present invention is to solve the aforementioned technical issues in the work of power loads participation in demand response, and propose a non-intrusive load monitoring method based on temporal attention mechanism.


The technical solution of the present invention is as follows:


A non-intrusive load monitoring method based on temporal attention mechanism, comprising the following steps:


step 1: obtaining a total load data, an equipment load data, and corresponding sampling time of a building during a certain period of time;


step 2: integrating the total load data and the equipment load data with the corresponding sampling time to obtain an enhanced total load data and an enhanced equipment load data;


step 3: using a sliding window method to segment the enhanced total load data and the enhanced equipment load data, and constructing a deep learning training dataset;


step 4: constructing a neural network model based on a deep learning training framework and training the model using the training dataset obtained in step 3.


Furthermore, the step 1 is specially as follows:


obtaining a load power consumption of the building during a certain period of time, sampling time T=[t0,t1, . . . ,tn], and the total load data comprises a total load active power Pt0:tn, a reactive power Qt0:tn, and an apparent power St0:tn, the equipment load data comprises an active power Pt0:tni, a reactive power Qt0:tni, and an apparent power St0:tni of each equipment during the above sampling time, where i is the equipment number.


Furthermore, the step 2 is specially as follows:


firstly, converting the sampling time T=[t0, t1, . . . , tn] to the corresponding number of weeks, that is Td=[d0, d1, . . . dn], wherein, dn represents the number of weeks the sampling time tn belongs to;


then, based on the attention mechanism, the total load data and the equipment load data are fused separately with Td, as shown below:

F=attn(F,Td)


among them, F can represent the total load active power Pt0:tn, the reactive power Qt0:tn and the apparent power St0:tn, as well as the equipment load active power Pt0:tni, the reactive power Qt0:tni and the apparent power St0:tni; F represents the load data after fusion and enhancement with time information Td; obtaining the enhanced total load data Pt0:tn, Qt0:tn and St0:tn, and the enhanced equipment load data Pt0:tni, Qt0:tn1 and St0:tni; attn( ) represents the attention mechanism function.


Furthermore, the attention mechanism is implemented using a neural network, i.e.,

F=F+φ(TdTd

wherein, φ represents the neural network and·represents matrix product.


Furthermore, the step 3 is specially as follows:


firstly, using the enhanced total load data and the enhanced equipment load data to construct total load samples M=[Pt0:tn, Qt0:tn, St0:tn], as well as individual load samples L1=[Pt0:tni, Qt0:tni, St0:tni];


then, using the sliding window with a width of w and a step size of l to divide M and Li, and constructing the training data, wherein

Mtrain=[{Ptj:tj+w, Qtj:tj+w, Stj:tj+w]|j=0, . . . , n−w}
Ltraini{[Ptj:tj+wi, Qtj:tj+wi, Stj:tj+wi, ]|j=0, . . . , n−w}.


Furthermore, the step 4 is specially as follows:


In step 4.1, inputting Ui to the following deep learning neural networks:

h0=Ui
hm=Φ(Wm·hm−1+bm)


wherein, h0 is neural network input, hm, Wm and bm are respectively the output, weight and bias of the mth hidden layer of the neural network model, and Φ(·) is the activation function;


In step 4.2, designing the following output layer for learning:

Fi=Ψ(WM·hM+bM)


wherein, Fi=[{circumflex over (P)}tj:tj+w, {circumflex over (Q)}tj:tj+wi, Ŝtj:tj+wi]refers to a load forecast of equipment i, hM refers to the output of the last hidden layer of the network, WM and bM refers to the weight and bias of the output layer respectively, Ψ(·) is the activation function;


In step 4.3, the following loss function is designed to train the constructed deep learning neural network model:

lossi=E(Fi, Ltraini)


wherein, E is a prediction deviation measurement function.


Furthermore, after the model training is completed, it is applied to load monitoring in other time periods, specifically, the method described in step 2 is used to enhance the active, reactive, and apparent power data of the building for any length of time period w, the trained neural network model is input, and the model output is the equipment's power consumption in the building during this time period.


A non-intrusive load monitoring device based on temporal attention mechanism, comprising one or more processors, for implementing the non-intrusive load monitoring method based on temporal attention mechanism.


A computer readable storage medium on which a program is stored, when the program is executed by a processor, the non-intrusive load monitoring method based on temporal attention mechanism is implemented.


Comparing with the prior art, the present invention has the following advantages:


(1) in the present invention, for the existing load monitoring methods based on deep learning, they only rely on electrical quantities such as voltage, current, and harmonics as the basis for load monitoring, without considering the problem of load working time patterns and their dependencies, an load data enhancement technology based on attention mechanism is adopted innovatively to fuse load operating time information with its electrical quantities, so as to effectively and fully extract the operating modes of different loads as the basis for load monitoring.


(2) in the present invention, by fusing load working time information with its electrical quantities to form model training data, the constructed deep learning neural network can implicitly learn the working time patterns of different loads, indirectly extract their dependencies, and effectively improve the load monitoring effect for devices with complex working modes.





BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 is a flowchart of a non-intrusive load monitoring method based on temporal attention mechanism of the present invention;



FIG. 2 is a schematic diagram of the structure of a non-intrusive load monitoring device based on temporal attention mechanism of the present invention.





DETAILED DESCRIPTION OF THE INVENTION

The present invention will be described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the described embodiments are only a part of the present invention and not all of them. Therefore, the implementation of the present invention should not be limited by the described embodiments, but should be further understood by these embodiments to better serve technical personnel in the field.


As shown in FIG. 1, the non-intrusive load monitoring method based on temporal attention mechanism of the present invention, comprising the following steps.


Step 1: obtaining a total load data, an equipment load data, and corresponding sampling time of a building during a certain period of time.


Obtaining a load power consumption of a building during a certain period of time, sampling =[t0, t1, . . . , tn], and the total load data comprises a total load active power Pt0:tn, a reactive power Qt0:tn, and an apparent power St0:tn, the equipment load data comprises an active power Pt0:tni, a reactive power Qt0:tni, and an apparent power St0:tni of each equipment during the above sampling time, where i is the equipment number.


In this embodiment, obtaining a load power consumption of a building in total of 10 equipment, the sampling time is 1 second, namely, t0=1, tn=6739200; the obtained load data comprises the load active power P1:6739200, the reactive power Q1:6739200, and the apparent power S1:6739200, and the active power P1:6739200, the reactive power Q1:6739200i and the apparent power S1:6739200i; where the range of the equipment number i is [1,10].


Step 2: integrating the total load data and the equipment load data with the corresponding sampling time to obtain an enhanced total load data and an enhanced equipment load data.


Firstly, converting the sampling time T=[t0, t1, . . . , tn] to the corresponding number of weeks, that is Td=[d0, d1, . . . , dn], wherein, dn represents the number of weeks the sampling time tn belongs to.


In this embodiment, the sampling time t0 belongs to Wednesday, tn belongs to Thursday, then Td can be represented as: Td=[3,3, . . . , 4].


Then, based on the attention mechanism, the total load data and the equipment load data are fused separately with Td, as shown below:

F=attn(F,Td)


among them, F can represent the total load active power Pt0:tn, the reactive power Qt0:tn and the apparent power St0:tn, as well as the equipment load active power Pt0:tni, the reactive power Qt0:tni and the apparent power St0:tni; F represents the load data after fusion and enhancement with time information Td, obtaining the enhanced total load data Pt0:tn, Qt0:tn and St0:tn, and the enhanced equipment load data Pt0:tn, Qt0:tni and St0:tni; attn( ) represents the attention mechanism function.


In this embodiment, the attention mechanism is realized by a single-layer neural network based on ReLU activation function, namely

F=F+ReLU(Wd·Td+bd))·Td


wherein, Wd and bd represent the weight and bias of the single-layer neural network, and·represent the matrix product. The enhanced total load data Pt0:tn, Qt0:tn, and St0:tn, and the enhanced equipment load data Pt0:tni, Qt0:tni, and St0:tni can be obtained.


In this embodiment, obtaining the enhanced total load data P1:6739200, Q1:6739200,and S1:6739200, and obtaining the enhanced equipment load data P1.6739200i, Q1:6739200i, and S1:6739200i.


Step 3: using a sliding window method to segment the enhanced total load data and the enhanced equipment load data, and constructing a deep learning training dataset.


Firstly, using the enhanced total load data and the enhanced equipment load data to construct total load samples M=[Pt0:tn, Qt0:tn, St0:tn], as well as individual load samples Li=[Pt0:tni, Qt0:tni, St0:tni].


In this embodiment, the total load samples and individual load samples can be represented as

M=[P1:6739200,Q1:6739200, S1:6739200]
Li=[P1:6739200, Q1:6739200, S1:6739200]


Then, using the sliding window with a width of w and a step size of l to divide M and Li, and constructing the training data, wherein

Mtrain=[{Ptj:tj+w, Qtj:tj+w, Stj:tj+w]|j=0, . . . ,n−w}
Ltraini=[{Ptj:tj+wi, Qtj:tj+wi, Stj:tj+wi]|j=0, . . . ,n−w}.


In this embodiment, the width w of the sliding window is 599, the step size is 1, then the constructed training data Ui can be further represented as:

Mtrain={[Ptj:tj+599, Qtj:tj+599]|j=0, . . . , 6738601}
Ltraini={[Ptj:tj+599i, Qtj:tj+599i]|j=0, . . . , 6738601}


Step 4: constructing a neural network model based on a deep learning training framework and training the model using the training dataset obtained in Step 3.


In step 4.1, inputting Ui to the following deep learning neural networks:

h0=Ui
hm=Φ(Wm·hm−1+bm)


wherein, h0 is neural network input, hm, Wm and bm are respectively the output, weight and bias of the mth hidden layer of the neural network model, and Φ(·) is the activation function.


In this embodiment, the hidden layers of the deep learning neural network are all CNN structures, with a total of 5 layers, the number of neurons is 900, 720, 640, 750 and 750 in turn, the activation function is ReLU, so the deep learning neural network used can be expressed as:

h0=Ui
hm=ReLU(Wm·hm−1+bm) .


In step 4.2, designing the following output layer for learning:

Fi=Ψ(WM·hM+bM)


wherein, Fi=[{circumflex over (P)}tj:tj+wi, {circumflex over (Q)}tj:tj+wi, Ŝtj:tj+wi] refers to a load forecast of equipment i, hM refers to the output of the last hidden layer of the network, WM and bM refers to the weight and bias of the output layer respectively, Ψ(·) is the activation function.


In this embodiment, Linear is used the activation function Ψ(·), then the output layer of the network can be expressed as:

Fi=Linear(WM·hM+bM)


The load forecast of equipment i during the sampling time t0 to tn can be expressed as:

Fi=[{circumflex over (P)}1:6739200i, {circumflex over (Q)}1:6739200i, Ŝ1:6739200i].


In step 4.3, the following loss function is designed to train the constructed deep learning neural network model:

lossi=E(Fi, Ltraini)

wherein, E is a prediction deviation measurement function.


In this embodiment, Mean square error (MSE) is selected as the prediction deviation measurement function, then the loss function used for model training can be further expressed as:

lossi=MSE({circumflex over (P)}1:6739200i, {circumflex over (P)}1:6739200i)


The neural network model is trained by iteratively optimizing the above training loss function and setting batch_size as 1000, the learning rate as 0.001, and the number of iterations 50.


Furthermore, after the model training is completed, it is applied to load monitoring in other time periods, specifically, the method described in step 2 is used to enhance the active, reactive, and apparent power data of the building for any length of time period w, the trained neural network model is input, and the model output is the equipment's power consumption in the building during this time period.


In this embodiment, collecting the total load active power p6739201:6739800, reactive power Q6739201:6739800, and apparent power S6739201:6739800 of the same building with a length of 599 starting from time 6739201, and using the method described in step 2 to obtain the enhanced total load data P6739201:6739800, Q6739201:6739800, and S6739201:6739800, and obtaining the total load sample V=[P6739201:6739800, Q6739201:6739800i, S6739201:6739800]. Inputting V to the trained neural network model, the model output the equipment's power consumption in the building during this time period, comprising the active power {circumflex over (P)}i6739201:6739800, the reactive power {circumflex over (Q)}6739201:6739800i, and the apparent power Ŝ6739201:6739800i.


As shown in FIG. 2, a non-intrusive load monitoring device based on temporal attention mechanism provided by the present invention, comprising one or more processors for realizing the non-intrusive load monitoring method based on temporal attention mechanism.


The embodiment of the non-intrusive load monitoring device based on temporal attention mechanism of the present invention can be applied to any device with data processing capability, which can be a device or equipment such as a computer. The device embodiments can be realized by software, hardware or combination of software and hardware. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the nonvolatile memory into the memory through the processor of any device with data processing capability. On the hardware level, as shown in FIG. 2, it is a hardware structure diagram of any device with data processing capability where the non-intrusive load monitoring device based on temporal attention mechanism of the present invention. In addition to the processor, memory, network interface and non-volatile memory shown in FIG. 2, any device with data processing capability in the embodiment can also comprise other hardware according to the actual function of any device with data processing capability, which will not be repeated.


The realization process of the function and effect of each unit in the above device is detailed in the realization process of the corresponding steps in the above method, and will not be repeated here.


For the device embodiment, since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant points. The device embodiments described above are only schematic, in which the units described as separate units can be or cannot be physically separated, and the units displayed as units can be or cannot be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the modules can be selected according to the actual needs to realize the purpose of the scheme of the invention. Ordinary technicians in the art can understand and implement without paying creative labor.


This embodiment of the present invention also provides a computer readable storage medium on which a program is stored, when the program is executed by a processor, the non-intrusive load monitoring method and device based on temporal attention mechanism of this embodiment is realized.


The computer readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer readable storage medium may be an external storage device, for example, a plug-in hard disk, a smart media card (SMC), a SD card, a flash card, etc. equipped on the device. Furthermore, the computer readable storage medium can also include both an internal storage unit of any device with data processing capability and an external storage device. The computer readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and can also be used to temporarily store the data that has been output or will be output.


The above description is only a preferred implementation case of the invention and does not limit the invention in any form. Although the implementation process of the invention has been described in detail above, for those who are familiar with the art, they can still modify the technical solutions recorded in the above examples, or replace some of the technical features equally. Any modification and equivalent replacement made within the spirit and principle of the invention shall be included in the protection scope of the invention.

Claims
  • 1. A non-intrusive load monitoring method based on temporal attention mechanism, comprising the following steps: step 1: obtaining a total load data, an equipment load data, and corresponding sampling time of a building during a certain period of time;step 2: integrating the total load data and the equipment load data with the corresponding sampling time to obtain an enhanced total load data and an enhanced equipment load data;step 3: using a sliding window method to segment the enhanced total load data and the enhanced equipment load data, and constructing a deep learning training dataset;step 4: constructing a neural network model based on a deep learning training framework and training the model using the training dataset obtained in step 3;wherein, the step 1 is specially as follows:obtaining a load power consumption of the building during a certain period of time, sampling time T=[t0, t1, . . . , tn], and the total load data comprises a total load active power Pt0:tn, a reactive power Qt0:tn, and an apparent power St0:tn, the equipment load data comprises an active power Pt0:tni, a reactive power Qt0:tni; and an apparent power St0:tni of each equipment during the above sampling time, where i is the equipment number;wherein, the step 2 is specially as follows:firstly, converting the sampling time T=[t0, t1, . . . , tn] to the corresponding number of weeks, that is Td=[d0, d1, . . . , dn], wherein, dn represents the number of weeks the sampling time tn belongs to;then, based on the attention mechanism, the total load data and the equipment load data are fused separately with Td, as shown below: F=attn(F,Td)among them, F can represent the total load active power Pt0:tn, the reactive power Qt0:tn and the apparent power St0:tn, as well as the equipment load active power Pt0:tni, the reactive power Qt0:tni and the apparent power St0:tni; F represents the load data after fusion and enhancement with time information Td; obtaining the enhanced total load data Pt0:tn, Qt0:tn and St0:tn, and the enhanced equipment load data Pt0:tni, Qt0:tni and St0:tni; attn( ) represents the attention mechanism function; andwherein, after the model training is completed, it is applied to load monitoring in other time periods, specifically, the method described in step 2 is used to enhance the active, reactive, and apparent power data of the building for any length of time period w, the trained neural network model is input, and the model output is the equipment's power consumption in the building during this time period.
  • 2. The non-intrusive load monitoring method based on temporal attention mechanism according to claim 1, wherein, the attention mechanism is implemented using a neural network, i.e., F=F+φ(Td)·Td wherein, φ represents the neural network and·represents matrix product.
  • 3. The non-intrusive load monitoring method based on temporal attention mechanism according to claim 2, wherein, the step 4 is specially as follows: in step 4.1, inputting Ui to the following deep learning neural networks: h0=Ui hm=Φ(Wm·hm−1+bm)wherein, h0 is neural network input, hm, Wm, and bm are respectively the output, weight and bias of the mth hidden layer of the neural network model, and Φ(·) is the activation function;in step 4.2, designing the following output layer for learning: Fi=Ψ(WM·hM+bM)wherein, Fi=[{circumflex over (P)}tj:tj+wi, {circumflex over (Q)}tj:tj+wi, Ŝtj:tj+wi] refers to a load forecast of equipment i, hM refers to the output of the last hidden layer of the network, WM and bM refers to the weight and bias of the output layer respectively, Ψ(·) is the activation function;in step 4.3, the following loss function is designed to train the constructed deep learning neural network model: lossi=E(Fi, Ltraini)wherein, E is a prediction deviation measurement function.
  • 4. The non-intrusive load monitoring method based on temporal attention mechanism according to claim 1, wherein, the step 3 is specially as follows: firstly, using the enhanced total load data and the enhanced equipment load data to construct total load samples M=[Pt0:tn, Qt0:tn, St0:tn], as well as individual load samples Li=[Pt0:tni, Qt0:tni, St0:tni];then, using the sliding window with a width of w and a step size of l to divide M and li, and constructing the training data, wherein Mtrain={[Ptj:tj+w, Qtj:tj+w, Stj:tj+w]|j=0, . . . , n−w}Ltraini={[Ptj:tj+wi, Qtj:tj+wi, Stj:tj+wi]|j=0, . . . , n−w}
  • 5. A non-intrusive load monitoring device based on temporal attention mechanism, comprising one or more processors, for implementing the non-intrusive load monitoring method based on temporal attention mechanism according to claim 1.
  • 6. A non-transitory computer readable storage medium on which a program is stored, when the program is executed by a processor, the non-intrusive load monitoring method based on temporal attention mechanism according to claim 1.
Priority Claims (1)
Number Date Country Kind
202211118482.1 Sep 2022 CN national
US Referenced Citations (1)
Number Name Date Kind
20210158186 Mimaroglu May 2021 A1
Non-Patent Literature Citations (3)
Entry
Li et al.(“A Self-training Multi-task Attention Method for NILM” Aug. 5-7, 2022) (Year: 2022).
Piccialli et al.(“Improving Non-Intrusive Load Disaggregation through an Attention-Based Deep Neural Network” Feb. 2021) (Year: 2021).
Schirmer et al.(“Non-Intrusive Load Monitoring: A Review” Jul. 2022) (Year: 2022).