Non-intrusive load decomposition method based on global local attention and pooling scaling

By introducing global local attention and pooling scaling technology into the non-intrusive load decomposition method, combined with the Ro-Transformer and GL-Transformer networks, the problems of insufficient feature extraction capabilities and poor model generalization capabilities in the existing technology are solved. Provides more efficient load identification and more accurate capture of energy consumption patterns.

CN118673428AActive Publication Date: 2024-09-20HENAN UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410694512.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-20
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

Existing non-invasive load decomposition methods based on deep learning have problems with limited feature extraction capabilities and poor model generalization capabilities. In particular, convolutional neural networks cannot effectively extract time series information, and recurrent neural networks have weak channel information extraction capabilities. , and has poor adaptability to new data sets.

Method used

A non-intrusive load decomposition method based on global local attention and pooling scaling is adopted, and a non-intrusive load decomposition network is constructed, including a feature extraction module, a first feature enhancement module with rotation position encoding, and a second feature enhanced with local window layer The enhancement module and output module combine the Ro-Transformer and GL-Transformer networks to perform feature extraction and feature fusion, and use the multi-head self-attention mechanism and rotation position encoding to improve the model's feature extraction capabilities for load data.

Benefits of technology

It improves the accuracy of load identification and the robustness of the model, reduces the consumption of computing resources and identification time, enhances the ability to capture and distinguish energy consumption patterns, effectively handles noise interference, and improves the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673428A
    Figure CN118673428A
Patent Text Reader

Abstract

The invention provides a non-intrusive load decomposition method based on global local attention and pooling scaling. The method provides a non-intrusive load decomposition network, and the load decomposition process comprises the steps: inputting load data into a feature extraction module for feature extraction to generate a feature sequence, inputting the feature sequence into a first feature enhancement module for rotation position coding and learning global features in the feature sequence, performing pooling operation on the global features, sequentially inputting the global features into the first two second feature enhancement modules to learn local features in the feature sequence layer by layer, performing up-sampling operation on the local features, fusing the local features with the global features, and inputting the fused features into the last second feature enhancement module to obtain final fused features; and the output module performs load decomposition according to the final fusion features. According to the method, the global and local features in the load data sequence can be effectively extracted, so that the accuracy of load decomposition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart grid technology, and in particular to a non-intrusive load decomposition method based on global local attention and pooling scaling. Background Art

[0002] Smart grid has become an inevitable trend in energy development. Its key technology is to understand the detailed amount of electricity used, and then optimize electricity use and distribution to achieve the rational use of energy. This process is called load monitoring. At present, due to its low economic cost and easy installation, non-intrusive load monitoring has become the mainstream monitoring method.

[0003] Non-intrusive load monitoring collects information such as voltage, current, active / reactive power, etc. in the house by installing monitoring instruments at the main electricity meter of the house. After feature extraction, these data are compared with the pre-established electrical load feature library to identify the power consumption of each electrical appliance in the house and achieve load decomposition. This method helps to reduce the repeated acquisition of information and improve the efficiency of monitoring.

[0004] At present, the implementation methods of non-intrusive load decomposition are mainly based on deep learning, using various network layers such as convolutional neural networks and recurrent neural networks to extract features. However, although these network models have shown good decomposition accuracy on specific data sets, convolutional neural networks cannot effectively extract time series information, while recurrent neural networks have weak channel information extraction capabilities. In addition, these models have poor generalization capabilities and need to be retrained for new data sets. Summary of the invention

[0005] In order to at least partially solve the problems of limited feature extraction capability and poor model generalization capability of existing deep learning-based load decomposition methods, the present invention proposes a non-intrusive load decomposition method based on global local attention and pooling scaling.

[0006] The present invention provides a non-intrusive load decomposition method based on global local attention and pooling scaling, comprising:

[0007] Step 1: construct a non-intrusive load decomposition network, including a feature extraction module, a first feature enhancement module, three second feature enhancement modules and an output module connected in sequence; wherein, a pooling operation is performed after the first feature enhancement module and the first second feature enhancement module; an upsampling operation is performed between the last two second feature enhancement modules; correspondingly, the load decomposition process of the non-intrusive load decomposition network includes:

[0008] The load data is input into the feature extraction module for feature extraction to generate a feature sequence, the feature sequence is input into the first feature enhancement module for rotational position encoding and learning the global features in the feature sequence, the global features are pooled and sequentially input into the first two second feature enhancement modules to learn the local features in the feature sequence layer by layer, the local features are upsampled and fused with the global features, and the fused features are input into the last second feature enhancement module to obtain the final fused features; the output module performs load decomposition according to the final fused features;

[0009] Step 2: Using the load data of the target type of electrical appliances to train the non-intrusive load decomposition network to obtain a non-intrusive load decomposition model;

[0010] Step 3: Input the load data in the target room into the non-intrusive load decomposition model to obtain a load decomposition result.

[0011] Furthermore, the feature extraction module includes a convolution layer and a pooling layer connected in sequence; the convolution kernel size of the convolution layer is 5 and the step size is 1; the convolution kernel size of the pooling layer is 2 and the step size is 2.

[0012] Furthermore, the second enhancement module adopts a GL-Transformer network, and the GL-Transformer network is a network formed by adding a local window layer to the Transformer network;

[0013] Correspondingly, the processing process of the GL-Transformer network on the input feature sequence includes: inputting the original feature sequence into the multi-head self-attention layer in the Transformer network to calculate the global attention feature; inputting the original feature sequence into the local window layer to obtain a new feature sequence, and inputting the new feature sequence into the multi-head self-attention layer in the Transformer network to obtain the local attention feature; wherein, inputting the original feature sequence into the local window layer to obtain the new feature sequence specifically includes: defining the local window size l s , the current position in the feature sequence and its left position in l s The elements in the range are set to 1, and the elements to the right of the current position are set to 0 to generate a local window mask, and the local window mask is multiplied by the original feature sequence to obtain a new feature sequence; the global attention feature and the local attention feature are weightedly fused using the given weights to obtain a fused representation.

[0014] Furthermore, the first feature enhancement module adopts a Ro-Transformer network; the Ro-Transformer network is a network formed by adding a RoPE layer before the multi-head self-attention layer in the GL-Transformer network; wherein the RoPE layer is used to perform rotational position encoding on the input feature sequence.

[0015] Furthermore, the output module includes a transposed convolutional layer and a fully connected layer connected in sequence.

[0016] Furthermore, during the training process of step 2, the following formula is used as the loss function:

[0017]

[0018] Among them, L is the total loss, JSD represents the JS distance function, p and are the actual value of load data and the predicted value of load data, respectively; τ is the absolute error adjustment value between the actual value of load data and the predicted value of load data; and T represents the time step.

[0019] Furthermore, before extracting features from the original load data, the method further includes: performing data preprocessing on the original load data; the data preprocessing includes:

[0020] Resample the data to form a one-dimensional series;

[0021] Performing data cleaning operations on the one-dimensional sequence, including deleting abnormal data and filling missing data;

[0022] Perform standardization on all data in the one-dimensional sequence after the data cleaning operation.

[0023] Furthermore, the filling of missing data includes: for missing data whose duration is less than a first duration, using a forward filling method; for missing data whose duration is greater than a second duration, using a zero filling method.

[0024] Beneficial effects of the present invention:

[0025] (1) By constructing a first feature enhancement module containing rotational position encoding, a unique encoding is provided for each position in the load data sequence so that the model can distinguish between markers at different positions and prepare for further learning of shallow and deep features in the sequence;

[0026] (2) By constructing a second feature enhancement module, the global and local attention features of the input load data sequence are learned, so that the model can better learn the global trends and local details in the load data sequence, thereby improving the accuracy of load identification;

[0027] (3) By constructing the first and second feature enhancement modules on the traditional Transformer network, the multi-head self-attention mechanism can be fully utilized to extract the features of the load data sequence with time series characteristics, and the global and local features of the load data are fully considered, so that the model can capture the pattern and trend of overall energy consumption, while also identifying and distinguishing the energy consumption patterns of different devices at a more detailed level. In addition, the local attention mechanism can more effectively process real signals, reduce the sensitivity of local areas to noise, help offset noise interference in the data, and improve the robustness of the model. At the same time, the present invention can reduce the consumption of computing resources, significantly shorten the time of load identification, and improve the accuracy of load identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 One of the flow charts of a non-intrusive load decomposition method based on global local attention and pooling scaling provided by an embodiment of the present invention;

[0029] Figure 2 A second flow chart of a non-intrusive load decomposition method based on global local attention and pooling scaling provided in an embodiment of the present invention;

[0030] Figure 3 A diagram of the Ro-Transformer network structure provided by an embodiment of the present invention;

[0031] Figure 4 A GL-Transformer network structure diagram provided for an embodiment of the present invention;

[0032] Figure 5 This is a structural diagram of an output module provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] Combination Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a non-intrusive load decomposition method based on global local attention and pooling scaling, comprising the following steps:

[0035] S101: Construct a non-intrusive load decomposition network, including a feature extraction module, a first feature enhancement module, three second feature enhancement modules and an output module connected in sequence; wherein, a pooling operation is performed after the first feature enhancement module and the first second feature enhancement module; in the embodiment of the present invention, the window size and step size of the pooling operation are 2. An upsampling operation is performed between the last two second feature enhancement modules, aiming to make the local features output by the second feature enhancement module have the same shape as the global features, so as to facilitate the fusion of the two.

[0036] Correspondingly, the load decomposition process of the non-intrusive load decomposition network includes: inputting the load data into the feature extraction module for feature extraction to generate a feature sequence, inputting the feature sequence into the first feature enhancement module for rotational position encoding and learning the global features in the feature sequence, pooling the global features and sequentially inputting them into the first two second feature enhancement modules to learn the local features in the feature sequence layer by layer, upsampling the local features and fusing them with the global features, and inputting the fused features into the last second feature enhancement module to obtain the final fused features; the output module performs load decomposition according to the final fused features.

[0037] In an embodiment of the present invention, the feature extraction module includes a convolution layer and a pooling layer connected in sequence; the convolution kernel size of the convolution layer is 5 and the step size is 1; the convolution kernel size of the pooling layer is 2 and the step size is 2.

[0038] As an implementation method, the structure of the first feature enhancement module is as follows: Figure 3 As shown, the structure of the second feature enhancement module is as follows Figure 4 Since the first feature enhancement module is obtained by further improving the second feature enhancement module, the structure and feature processing process of the second feature enhancement module are first described in detail here.

[0039] In the embodiment of the present invention, the second enhancement module adopts a GL-Transformer network, which is a network formed by adding a local window layer to a Transformer network; wherein G and L represent the abbreviations of Global and Local, respectively.

[0040] Specifically, when processing input data, the traditional Transformer network can only perform global attention calculations on the input data, while ignoring the local details of the input data. Therefore, in order to enable the model to learn the local detail information in the load data, the present invention proposes a GL-Transformer network. The difference between the GL-Transformer network and the traditional Transformer network mainly lies in the introduction of a local window layer, which is used to perform masking on the input data to obtain multiple local sub-input data, and then perform attention calculations based on the multiple sub-input data with a temporal relationship to obtain local attention.

[0041] Furthermore, the GL-Transformer network processes the input feature sequence as follows:

[0042] Step A1: Input the original feature sequence into the multi-head self-attention layer in the Transformer network to calculate the global attention feature G m ;

[0043] Step A2: Input the original feature sequence into the local window layer to obtain a new feature sequence, and input the new feature sequence into the multi-head self-attention layer in the Transformer network to obtain the local attention feature L m ; Among them, the original feature sequence is input into the local window layer to obtain a new feature sequence, which specifically includes: defining the local window size l s , the current position in the feature sequence and its left position in l s The elements in the range are set to 1, and the elements to the right of the current position are set to 0 to generate a local window mask, and the local window mask is multiplied by the original feature sequence to obtain a new feature sequence;

[0044] Specifically, the process of calculating the attention features of the multi-head self-attention layer based on the input data is as follows:

[0045]

[0046] head i =Attention(QW i Q ,KW i K ,VW i V )

[0047] MultiHead(Q,K,V)=Concat(head1,…,head h )W O

[0048] Among them, Q, K, and V represent the query, key, and value matrices respectively, and d k is the dimension of the matrix, x represents the input signal data, W q , W k , W v Convert the input signal data into the coefficient matrix of Q, K, V. head i represents the i-th head in the multi-head attention mechanism, W i Q , W i K , W i V Represents the coefficient matrix of Q, K, V corresponding to each head, W O Indicates mapping of connection results.

[0049] Step A3: Using the given weight G w and L w For the global attention feature G m and the local attention feature L m Perform weighted fusion to obtain the fusion representation F a =G w ×G m +L w ×L m .

[0050] The above process realizes global attention, local attention and linear fusion, and the contribution of the two can be weighed by setting weights, so that the model can better handle global trends and local details, which helps to model energy consumption patterns more accurately.

[0051] Furthermore, the first feature enhancement module adopts a Ro-Transformer network; the Ro-Transformer network is a network formed by adding a RoPE layer before the multi-head self-attention layer in the GL-Transformer network; wherein the RoPE layer is used to perform rotational position encoding on the input feature sequence.

[0052] Specifically, the core idea of ​​rotational position encoding is to transform the query and key formed in the Transformer model so that they carry position information, so that the model can automatically perceive the relative position relationship of different elements in the sequence without making additional changes in subsequent point multiplication operations. The specific calculation method of rotational position encoding is as follows:

[0053] First, add the absolute position information m,n to q,k:

[0054]

[0055] in, and Carry absolute position information m,n;

[0056] Furthermore, in order to and The result after the inner product has relative position information. Find an equivalent way to encode the position so that the above relationship holds, assuming there is a constant relationship:

[0057] f(q,m),f(k,n)=g(q,k,mn)

[0058] After formula conversion, the relative position encoding expressed in complex numbers in two dimensions is finally obtained:

[0059] f(q,m)=qe imθ

[0060] According to the geometric meaning of complex multiplication, this transformation actually corresponds to the rotation operation of the vector, so it is called rotation position embedding, which means that the q vector is multiplied by a rotation matrix on the left, written in matrix form as follows:

[0061]

[0062] Multiply the vector q at position m by the matrix R m , multiply the vector k at position n by the matrix R n , we get the transformed q and k, and use them to calculate the attention mechanism, so that attention automatically implies relative position information. We get the following constant formula:

[0063]

[0064] Among them, nm represents relative position information.

[0065] Since the rotational position encoding realizes the representation of relative position information in the form of absolute position encoding and integrates the relative position information into the self-attention mechanism, the Transformer can more effectively focus on the relationship between different moments, thereby improving the model's sensitivity to the changing relationship of power load at different time points, helping the model to more accurately capture the energy consumption pattern of electrical equipment and improve model performance.

[0066] Furthermore, if Figure 5As shown in the figure, the output module includes a transposed convolution layer and a fully connected layer connected in sequence. The feature dimension is restored by the transposed convolution layer and the fully connected layer, and the result consistent with the output power dimension is finally predicted. Transposed convolution is also called deconvolution, which can restore the dimension. Because the input power sequence generally has smaller output channels and dimensions when it passes through a series of neural network layers, it needs to be restored to its original size for further calculation. The fully connected layer mainly undergoes identity mapping, and its formula is:

[0067] Y(x)=Wx+b

[0068] Among them, W is the weight matrix, the parameters can be learned through the back propagation of the neural network, and b is the bias term.

[0069] S102: using load data of target type electrical appliances to train the non-intrusive load decomposition network to obtain a non-intrusive load decomposition model;

[0070] Specifically, considering that using a single mean square error or mean absolute error is not enough to evaluate the gap between the true value and the predicted value, the embodiment of the present invention uses a combined loss function for comprehensive evaluation during the training process. The combined loss function consists of three parts: a standard mean square error loss function, a Jensen-Shannon divergence, and a probability distribution between measurement predictions.

[0071]

[0072] Among them, L is the total loss, p and are the actual value of the load data (such as the actual power value) and the predicted value of the load data (such as the predicted power value), τ is the absolute error adjustment value between the actual value of the load data and the predicted value of the load data, and T represents the time step. In this loss function, the first term is the mean square error loss function, and the second term is the JS distance function, which is used to evaluate the probability distribution of the discreteness between the predicted value and the actual value.

[0073] S103: Inputting the load data in the target room into the non-intrusive load decomposition model to obtain a load decomposition result.

[0074] The non-intrusive load decomposition method provided by an embodiment of the present invention first performs convolution and pooling processing on the input load data sequence, and then embeds it into the Ro-Transformer. Next, a pooling operation is performed on the output of the Ro-Transformer to extract the global features in the sequence by downsampling and retaining key feature information; this process transmits position information, extracts and learns shallow features, and lays the foundation for subsequent deep feature learning. These global features are then passed to the GL-Transformer, which performs a pooling operation again to emphasize the local feature information in the sequence. It is then passed to another GL-Transformer to further extract more important feature information and obtain a more abstract and refined representation. This process gradually extracts and emphasizes key features at different levels in the input sequence, enhancing the model's understanding and representation capabilities of key features in the electrical operation process.

[0075] On the basis of the above embodiment, in order to improve the accuracy of load decomposition, both the training process and the testing process further include the following steps:

[0076] Before extracting features from the original load data, the method further includes: performing data preprocessing on the original load data; the data preprocessing includes:

[0077] Resample the data to form a one-dimensional series;

[0078] Performing data cleaning operations on the one-dimensional sequence, including deleting abnormal data and filling missing data;

[0079] For example, if the power value at a certain moment in the one-dimensional sequence is negative or exceeds the maximum power that the appliance can withstand, the power value is abnormal data and should be deleted. In the embodiment of the present invention, when filling missing data, it is divided into the following two cases: first, for missing data with a duration less than a first duration (such as 4 minutes), a forward filling method is used, that is, the power data at the previous moment is used for filling to maintain consistency; for missing data with a duration greater than a second duration (such as 2 minutes), a zero filling method is used.

[0080] All data in the one-dimensional sequence after the data cleaning operation are standardized. The formula is as follows:

[0081]

[0082] Where x is the input sequence, μ is the mean, and σ is the standard deviation.

[0083] The non-intrusive load decomposition method based on global-local attention and pooling scaling provided by the embodiment of the present invention mainly includes three stages: data preprocessing - building and training a load decomposition model (including a Ro-Transformer network and a GL-Transformer network) - using the trained model to perform load decomposition. Among them, by adding rotational position encoding to the constructed Ro-Transformer network, a unique encoding is provided for each position in the sequence so that the model can distinguish between markers at different positions. Using the constructed GL-Transformer network, the features are learned globally and locally, so that the model can better learn the global trends and local details in the sequence. Through the load decomposition method of the present invention, the cost of computing resources can be reduced, the load identification time can be shortened, and the accuracy of load identification can be improved.

[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A non-intrusive load decomposition method based on global local attention and pooling scaling, characterized in that: include: Step 1: construct a non-intrusive load decomposition network, including a feature extraction module, a first feature enhancement module, three second feature enhancement modules and an output module connected in sequence; wherein, a pooling operation is performed after the first feature enhancement module and the first second feature enhancement module; an upsampling operation is performed between the last two second feature enhancement modules; correspondingly, the load decomposition process of the non-intrusive load decomposition network includes: The load data is input into the feature extraction module for feature extraction to generate a feature sequence, the feature sequence is input into the first feature enhancement module for rotational position encoding and learning the global features in the feature sequence, the global features are pooled and sequentially input into the first two second feature enhancement modules to learn the local features in the feature sequence layer by layer, the local features are upsampled and fused with the global features, and the fused features are input into the last second feature enhancement module to obtain the final fused features; the output module performs load decomposition according to the final fused features; Step 2: Using the load data of the target type of electrical appliances to train the non-intrusive load decomposition network to obtain a non-intrusive load decomposition model; Step 3: Input the load data in the target room into the non-intrusive load decomposition model to obtain a load decomposition result.

2. According to claim 1, a non-intrusive load decomposition method based on global local attention and pooling scaling is characterized in that: The feature extraction module includes a convolution layer and a pooling layer connected in sequence; the convolution kernel size of the convolution layer is 5 and the step size is 1; the convolution kernel size of the pooling layer is 2 and the step size is 2.

3. According to claim 1, a non-intrusive load decomposition method based on global local attention and pooling scaling is characterized in that: The second enhancement module adopts a GL-Transformer network, and the GL-Transformer network is a network formed by adding a local window layer to the Transformer network; Correspondingly, the processing process of the GL-Transformer network on the input feature sequence includes: inputting the original feature sequence into the multi-head self-attention layer in the Transformer network to calculate the global attention feature; inputting the original feature sequence into the local window layer to obtain a new feature sequence, and inputting the new feature sequence into the multi-head self-attention layer in the Transformer network to obtain the local attention feature; wherein, inputting the original feature sequence into the local window layer to obtain the new feature sequence specifically includes: defining the local window size l s , the current position in the feature sequence and its left position in l s The elements in the range are set to 1, and the elements to the right of the current position are set to 0 to generate a local window mask, and the local window mask is multiplied by the original feature sequence to obtain a new feature sequence; the global attention feature and the local attention feature are weightedly fused using the given weights to obtain a fused representation.

4. According to claim 3, a non-intrusive load decomposition method based on global local attention and pooling scaling is characterized in that: The first feature enhancement module adopts a Ro-Transformer network; the Ro-Transformer network is a network formed by adding a RoPE layer before the multi-head self-attention layer in the GL-Transformer network; wherein the RoPE layer is used to perform rotational position encoding on the input feature sequence.

5. The non-intrusive load decomposition method based on global local attention and pooling scaling according to claim 1, characterized in that: The output module includes a transposed convolutional layer and a fully connected layer connected in sequence.

6. The non-intrusive load decomposition method based on global local attention and pooling scaling according to claim 1, characterized in that: During the training process of step 2, the following formula is used as the loss function: Among them, L is the total loss, JSD represents the JS distance function, p and are the actual value of load data and the predicted value of load data, respectively; τ is the absolute error adjustment value between the actual value of load data and the predicted value of load data; and T represents the time step.

7. The non-intrusive load decomposition method based on global local attention and pooling scaling according to claim 1, characterized in that: Before extracting features from the original load data, the method further includes: performing data preprocessing on the original load data; the data preprocessing includes: Resample the data to form a one-dimensional series; Performing data cleaning operations on the one-dimensional sequence, including deleting abnormal data and filling missing data; Perform standardization on all data in the one-dimensional sequence after the data cleaning operation.

8. The non-intrusive load decomposition method based on global local attention and pooling scaling according to claim 7, characterized in that: The filling of missing data includes: for missing data with a duration less than a first duration, using a forward filling method; for missing data with a duration greater than a second duration, using a zero filling method.

Citation Information

Patent Citations

  • Non-intrusive load decomposition model based on deep learning

    CN115841268A

  • Power load decomposition analysis method and system, computer equipment and storage medium

    CN116227878A

  • Non-intrusive load monitoring method and system based on multi-task learning model

    CN117272230A

  • Non-Intrusive Load Decomposition Method Based on Informer Model Coding Structure

    US20220397874A1