Fusion model-based electricity consumption anomaly detection method
By using a fusion model and particle swarm optimization algorithm in the detection of electricity consumption abnormalities, the problems of sparse samples and noise sensitivity in the prior art are solved, the detection accuracy and efficiency are improved, and timely alarms for user electricity consumption abnormalities are achieved.
Patent Information
- Application Number
- CN202411608530.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-28
AI Technical Summary
The existing electrical abnormality detection technology faces problems such as sparse samples, sensitivity to noise, and degradation of model performance due to environmental changes, resulting in low detection efficiency and low accuracy.
The power consumption anomaly detection method based on the fusion model is adopted, and the user's historical power consumption data is collected and preprocessed, abnormal samples are generated using the SMOTE algorithm, the CNN-BiLSTM fusion model is trained, and the fuzzy kernel clustering algorithm is optimized, typical power consumption curves are extracted, similarity calculations are calculated and judged, and the alarm text message is finally sent through the GSM communication module.
It improves the accuracy and efficiency of power consumption abnormality detection, reduces false alarms and missed reports, enhances the model's ability to adapt to environmental changes, and realizes timely alarms for user power consumption abnormalities.
Smart Images

Figure CN119720004A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power electronic control, and in particular to a method for detecting power consumption anomaly based on a fusion model. Background Art
[0002] With the popularization of smart homes and digital lifestyles, users' electricity needs have become diversified, and electricity consumption patterns are constantly evolving. Usually, technicians can use various algorithms to extract features from electricity data to analyze users' electricity usage behaviors. Abnormal user electricity usage, such as sudden surges in electricity usage, equipment failures, or energy waste, will not only lead to high electricity bills, but may also endanger equipment safety and even cause safety hazards such as fires.
[0003] Currently, there are two main ways to detect abnormal electricity usage behavior of users. One is to install hardware equipment such as wireless sensors for regular inspections and manual inspections. The other is to combine data mining with machine learning algorithms. The application of machine learning algorithms in power anomaly detection mainly identifies unusual power usage patterns by analyzing historical power usage data. By training models (such as decision trees, support vector machines, or deep learning networks), the system can automatically detect situations that deviate significantly from normal power usage behavior, thereby promptly discovering potential power failures, equipment failures, or power theft. This type of intelligent monitoring not only improves the safety of electricity use, but also helps relevant departments to save energy, reduce emissions, and optimize power resource management.
[0004] Although the development of existing technologies has greatly improved the efficiency of detecting abnormal electricity consumption data and saved manpower and material resources, it still faces many shortcomings. First, the training of the model relies on a large amount of labeled data, while in actual applications, abnormal events are often rare, making it difficult for the model to learn effective features. Secondly, the algorithm may be sensitive to noise and fluctuations in the data, resulting in false positives or negatives. Finally, environmental changes (such as seasonal fluctuations, equipment aging, etc.) may cause the performance of the model to deteriorate, requiring continuous retraining and adjustment. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes a method for detecting abnormal power consumption based on a fusion model. It mainly collects historical power consumption data of users, including normal power consumption data and abnormal power consumption data, and pre-processes the original data. Secondly, the abnormal power consumption data is generated by the oversampling technology SMOTE algorithm, the number of abnormal samples is increased, and the processed load data is divided into a training set and a test set to train the CNN-BiLSTM fusion model. Subsequently, the fuzzy kernel clustering algorithm is optimized by the particle swarm optimization algorithm, the typical power consumption curve of the user's normal power consumption data curve is extracted, and the similarity coefficient of the data to be detected and the typical power consumption curve is calculated. The data with a similarity less than 0.5 is input into the trained CNN-BiLSTM fusion model, and finally it is determined whether the user has abnormal power consumption. Then, the computer end can be used to send AT commands to the GSM communication module through the serial port data line, so as to send an alarm SMS to the user suspected of abnormal power consumption to warn him of abnormal power consumption.
[0006] A method for detecting abnormal power consumption based on a fusion model comprises the following steps:
[0007] Step 1: Data preprocessing: Use the power grid electricity consumption information collection system to obtain the user's daily 96-point load data, fill in the blank values, and mark the normal electricity consumption data and abnormal electricity consumption data;
[0008] Step 2: Increase the number of abnormal samples: Generate abnormal power consumption data through the oversampling technology SMOTE algorithm, increase the number of abnormal samples, enhance sample diversity, and improve model detection effect;
[0009] Step 3: Train the power consumption anomaly detection model: Divide the processed load data into training set and test set according to 7:3 to train the CNN-BiLSTM fusion model;
[0010] Step 4: Extract typical power consumption curve: Use particle swarm optimization algorithm to optimize the fuzzy kernel clustering algorithm to achieve the best effect, and extract the typical power consumption curve of the user's normal power consumption data curve;
[0011] Step 5: Similarity calculation: Calculate the similarity coefficient between the data to be tested and the typical power consumption curve;
[0012] Step 6: Determine abnormal power consumption: Input the data with small similarity into the CNN-BiLSTM fusion model trained with normal and abnormal power consumption data, and finally determine whether the user has abnormal power consumption;
[0013] Step 7: Abnormal alarm: Use the computer to send AT commands to the communication module through the serial port data line, so as to send alarm text messages to users who are suspected of abnormal power consumption to warn them of abnormal power consumption.
[0014] As a preference, step 1 data preprocessing process:
[0015] Errors in the data collection process (such as human error, equipment failure) will affect the accuracy of the final data. In addition, the data may be disturbed during transmission, resulting in information loss or change. In order to improve the accuracy of the power consumption anomaly detection model, it is necessary to exclude the days with daily data missing more than 30%, and use the Lagrange interpolation method to fill the missing values in the data set when the missing amount is less than 30%. The Lagrange interpolation method formula is as follows:
[0016]
[0017] x and y are the subscripts of missing values and non-missing values a and b; M is the number of values before and after the missing data, L M (a) is the result after missing values are inserted.
[0018] In order to improve model performance, eliminate dimensionality effects, speed up training, avoid feature dominance, improve visualization effects, and enhance model stability, it is necessary to normalize the filled load sequence. The normalization method is expressed as:
[0019]
[0020] Where x represents the original data, x min With x max Represent the maximum and minimum values in the load sequence, respectively, N Represents normalized data.
[0021] The date when abnormal power consumption data occurs is marked as 1, and the date when normal power consumption data occurs is marked as 0.
[0022] As a preference, step 2 adds an abnormal sample process:
[0023] The SMOTE (Synthetic Minority Over-sampling Technique) algorithm is a commonly used oversampling technique, which is mainly used to solve the problem of class imbalance. For each minority class sample, its K nearest neighbors (usually K=5) are calculated, and these neighbor samples also belong to the minority class.
[0024] For each minority class sample, one or more neighbors are randomly selected from its K nearest neighbors to generate new synthetic samples. The generation formula of synthetic samples is:
[0025] y ij =x i +λ×(x i -x ij ) (3)
[0026] where yij The newly synthesized sample, x i is the selected nearest sample, λ represents a random number between 0 and 1, x ij is the current minority class sample.
[0027] As a preference, step 3 trains the CNN-BiLSTM fusion model process:
[0028] Convolutional Neural Network (CNN) has excellent feature extraction capabilities and can learn implicit correlation information between samples. Assume that the input data is X, with a shape of (N, L, C), where N represents the number of samples, L is the sequence length, and C is the number of features. Use multiple one-dimensional convolution kernels to perform convolution operations on the input to extract local features. An activation function (such as ReLU) is usually applied after each convolution layer to introduce nonlinearity. Add a pooling layer (such as maximum pooling or average pooling) after the convolution layer to reduce the feature dimension, reduce computational complexity, and aggregate information. Finally, stack multiple convolutional layers and pooling layers to gradually extract more advanced features.
[0029]
[0030] Where Y[i] is the convolution output, K is the convolution kernel size, W is the convolution kernel weight, b is the bias, A[i] represents the ReLU activation function, P[i] represents the maximum pooling, S is the stride, and f represents the pooling window size. L represents the mean square error, which is the loss function of the CNN convolutional neural network during training.
[0031] The CNN convolutional neural network effectively extracts the features of abnormal power consumption and normal power consumption through convolution and pooling layers, and uses them as input to train the BiLSTM model.
[0032] Bi-directional Long Short-Term Memory (BiLSTM) consists of four parts: input gate, output gate, forget gate and storage unit. These components use sigmoid activation function to control the output vector of the input gate. This output vector ranges from 0 to 1, indicating the probability of an event. Its algorithm can be expressed as:
[0033]
[0034] Where w xf 、w hf 、w cf 、w xi 、w hi 、w ci 、w xo 、w ho With w coRepresent the weight matrix, a f 、a i with a o They represent bias respectively. σ represents the sigmoid activation function, f g ,i g , o g Represent the forget gate, input gate and output gate respectively, (c) t Represents the current memory, hidden layer h t The value of is represented by the output gate function and tanh.
[0035] As a preferred method, step 4 uses a particle swarm optimization algorithm (PSO) to optimize a fuzzy kernel clustering algorithm (KFCM) to extract a user's normal power consumption data curve and a typical power consumption curve:
[0036] Initialize the particle swarm, where each particle represents a possible solution of the cluster center in the fuzzy kernel clustering algorithm;
[0037] The fitness function of the particle swarm optimization algorithm is set as the target error of fuzzy clustering;
[0038] According to the update rule of the particle swarm optimization algorithm, the speed and position of each particle are updated until the fitness function reaches the minimum value, which is the optimal position of the particle in the world, and the optimal number of clusters a is determined. The speed update and position update calculation method of the particle swarm optimization algorithm is:
[0039]
[0040] Among them, w is the inertia weight, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, pbest is the individual optimal solution, and gbest is the global optimal solution.
[0041] The typical daily load curve is extracted according to the optimal cluster number a.
[0042] As a preference, step 5 calculates the similarity coefficient between the data to be detected and the typical load curve:
[0043]
[0044] In the formula N is 96. The typical power consumption curve X t The similarity coefficient with the data to be detected X.
[0045] Preferably, step 6 calculates the probability of abnormal power consumption of a user on a certain day:
[0046] The data with similarity less than 0.5 is input into the CNN-BiLSTM fusion model trained with normal and abnormal electricity consumption data, and finally the probability of abnormal electricity consumption of the user in the time period is output.
[0047] As a preferred embodiment, step 7 sends an abnormal power consumption alarm process:
[0048] Step 1: First make sure the GSM communication module is properly connected to the computer and initialize the GSM communication module in the code, set the baud rate, and make sure the module is ready for communication.
[0049] Step 2: Configure the GSM communication module to send SMS in text mode. Generally, AT commands are used for setting. Enter the target mobile phone number to send SMS with AT commands. After waiting for the module to respond, enter the SMS content to send SMS alarms to users suspected of abnormal electricity consumption.
[0050] The method adopted is mainly to combine unsupervised learning with supervised learning algorithms. By obtaining the load data of 96 points a day from the user in the electricity information collection system. Then the data is preprocessed, including filling in vacant values, normalizing the original data, and marking abnormal data and normal data. In order to reduce the impact of sample imbalance on the model, the oversampling technology SMOTE algorithm is used to construct abnormal data and increase the number of abnormal samples. The processed data is then divided into training sets and test sets in a ratio of 7:3 to train the CNN-BiLSTM fusion model. In order to further improve the recognition accuracy, the particle swarm algorithm is used to optimize the fuzzy kernel clustering algorithm to extract the typical curve of normal electricity data, and the data to be detected is compared with the typical load curve to calculate the similarity. If the similarity is lower than 0.5, the CNN-BiLSTM detection model is further used for further judgment. The judgment process is as follows: Figure 1 When the model is applied to determine that a user is suspected of abnormal electricity consumption on a certain day, a text message alarm device is introduced, that is, a GSM communication module connected to a computer sends an alarm text message to the user. Its operation block diagram is shown in Figure 2 shown. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a flow chart of abnormal power consumption detection and judgment in the present invention.
[0052] Figure 2 This is a flowchart of abnormal data detection and alarm in the present invention. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0054] Embodiment 1: A method for detecting abnormal power consumption based on a fusion model, comprising the following steps:
[0055] Step 1: Data preprocessing: Use the power grid electricity consumption information collection system to obtain the user's daily 96-point load data, fill in the blank values, and mark the normal electricity consumption data and abnormal electricity consumption data;
[0056] Step 2: Increase the number of abnormal samples: Generate abnormal power consumption data through the oversampling technology SMOTE algorithm, increase the number of abnormal samples, enhance sample diversity, and improve model detection effect;
[0057] Step 3: Train the power consumption anomaly detection model: Divide the processed load data into training set and test set according to 7:3 to train the CNN-BiLSTM fusion model;
[0058] Step 4: Extract typical power consumption curve: Use particle swarm optimization algorithm to optimize the fuzzy kernel clustering algorithm to achieve the best effect, and extract the typical power consumption curve of the user's normal power consumption data curve;
[0059] Step 5: Similarity calculation: Calculate the similarity coefficient between the data to be tested and the typical power consumption curve;
[0060] Step 6: Determine abnormal power consumption: Input the data with small similarity into the CNN-BiLSTM fusion model trained with normal and abnormal power consumption data, and finally determine whether the user has abnormal power consumption;
[0061] Step 7: Abnormal alarm: Use the computer to send AT commands to the communication module through the serial port data line, so as to send alarm text messages to users who are suspected of abnormal power consumption to warn them of abnormal power consumption.
[0062] Specific steps:
[0063] (1) Data processing:
[0064] 1) Errors in the data collection process (such as human error, equipment failure) will affect the accuracy of the final data. In addition, the data may be disturbed during the transmission process, resulting in information loss or change. In order to improve the accuracy of the power consumption anomaly detection model, it is necessary to exclude the days with daily data missing more than 30%, and use the Lagrange interpolation method to fill the missing values in the data set when the missing amount is less than 30%. The Lagrange interpolation method formula is as follows:
[0065]
[0066] x and y are the subscripts of missing values and non-missing values a and b; M is the number of values before and after the missing data, L M (a) is the result after missing values are inserted.
[0067] 2) In order to improve model performance, eliminate dimensionality effects, speed up training, avoid feature dominance, improve visualization effects, and enhance model stability, it is necessary to normalize the filled load sequence. The normalization method is expressed as:
[0068]
[0069] Where x represents the original data, x min With x max Represent the maximum and minimum values in the load sequence, respectively, N Represents normalized data.
[0070] 3) The date with abnormal power consumption data is marked as 1, and the date with normal power consumption data is marked as 0.
[0071] (2) Increase the number of abnormal samples:
[0072] 1) SMOTE (Synthetic Minority Over-sampling Technique) is a commonly used oversampling technique, mainly used to solve the problem of class imbalance. For each minority class sample, calculate its K nearest neighbors (usually K = 5), and these neighbor samples also belong to the minority class.
[0073] 2) For each minority class sample, randomly select one or more neighbors from its K nearest neighbors to generate a new synthetic sample. The formula for generating synthetic samples is:
[0074] y ij =x i +λ×(x i -x ij ) (10)
[0075] where y ij The newly synthesized sample, x i is the selected nearest sample, λ represents a random number between 0 and 1, x ij is the current minority class sample.
[0076] (3) Training the power consumption anomaly detection model:
[0077] Convolutional Neural Network (CNN) has excellent feature extraction capabilities and can learn implicit correlation information between samples. Assume that the input data is X, with a shape of (N, L, C), where N represents the number of samples, L is the sequence length, and C is the number of features. Use multiple one-dimensional convolution kernels to perform convolution operations on the input to extract local features. An activation function (such as ReLU) is usually applied after each convolution layer to introduce nonlinearity. Add a pooling layer (such as maximum pooling or average pooling) after the convolution layer to reduce the feature dimension, reduce computational complexity, and aggregate information. Finally, stack multiple convolutional layers and pooling layers to gradually extract more advanced features.
[0078]
[0079] Where Y[i] is the convolution output, K is the convolution kernel size, W is the convolution kernel weight, b is the bias, A[i] represents the ReLU activation function, P[i] represents the maximum pooling, S is the stride, and F represents the pooling window size. L represents the mean square error, which is the loss function of the CNN convolutional neural network during training.
[0080] The CNN convolutional neural network effectively extracts the features of abnormal power consumption and normal power consumption through convolution and pooling layers, and uses them as input to train the BiLSTM model.
[0081] Bi-directional Long Short-Term Memory (BiLSTM) consists of four parts: input gate, output gate, forget gate and storage unit. These components use sigmoid activation function to control the output vector of the input gate. This output vector ranges from 0 to 1, indicating the probability of an event. Its algorithm can be expressed as:
[0082]
[0083] Where w xf 、w hf 、w cf 、w xi 、w hi 、w ci 、w xo 、w ho With w co Represent the weight matrix, a f 、a i with a o They represent bias respectively. σ represents the sigmoid activation function, f g ,i g , o g Represent the forget gate, input gate and output gate respectively, (c) tRepresents the current memory, hidden layer h t The value of is represented by the output gate function and tanh.
[0084] (4) Extract typical power consumption curve:
[0085] 1) Initialize the particle swarm, where each particle represents a possible solution of the cluster center in the fuzzy kernel clustering algorithm;
[0086] 2) The fitness function of the particle swarm optimization algorithm is set as the target error of fuzzy clustering;
[0087] 3) Update the speed and position of each particle according to the update rule of the particle swarm optimization algorithm until the fitness function reaches the minimum value, which is the optimal position of the particle in the world, and determine the optimal number of clusters a, where the speed update and position update calculation method of the particle swarm optimization algorithm is:
[0088]
[0089] Among them, w is the inertia weight, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, pbest is the individual optimal solution, and gbest is the global optimal solution.
[0090] 4) Extract the typical daily load curve according to the optimal cluster number a.
[0091] (5) Similarity calculation:
[0092]
[0093] In the formula N is 96. The typical power consumption curve X t The similarity coefficient with the data to be detected X.
[0094] (6) Determination of abnormal power consumption:
[0095] The data with similarity less than 0.5 is input into the CNN-BiLSTM fusion model trained with normal and abnormal electricity consumption data, and finally the probability of abnormal electricity consumption of the user in the time period is output.
[0096] (7) Abnormal power consumption alarm:
[0097] 1) First make sure the GSM communication module is correctly connected to the computer, and initialize the GSM communication module in the code, set the baud rate, and make sure the module is ready for communication.
[0098] 2) Configure the GSM communication module to send text messages in text mode. Generally, AT commands are used for setting. Enter the target mobile phone number to send text messages using AT commands. After waiting for the module to respond, enter the text message content to send text message alarms to users suspected of abnormal electricity consumption.
Claims
1. A method for detecting abnormal power consumption based on a fusion model, characterized in that: The steps include: (1) Use the power grid electricity consumption information collection system to obtain the user's daily 96-point load data, fill in the blank values and perform data normalization, and mark normal electricity consumption data and abnormal electricity consumption data; (2) Generate abnormal power consumption data through the oversampling technology SMOTE algorithm, increase the number of abnormal samples, enhance sample diversity, and improve the model detection effect; (3) The processed load data is divided into training set and test set according to 7:3 to train the CNN-BiLSTM fusion model; (4) Using the particle swarm optimization algorithm to optimize the fuzzy kernel clustering algorithm, the fuzzy kernel clustering algorithm achieves the best effect and extracts the user's normal electricity consumption data curve and typical electricity consumption curve; (5) Calculate the similarity coefficient between the data to be tested and the typical power consumption curve; (6) Input the data with small similarity into the CNN-BiLSTM fusion model trained with normal and abnormal electricity consumption data, and finally determine whether the user has abnormal electricity consumption; (7) The computer sends AT commands to the communication module through the serial port data line, so as to send alarm text messages to users who are suspected of abnormal electricity usage to warn them of abnormal electricity usage.
2. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: In order to ensure data quality during data preprocessing, it is necessary to fill in missing values and remove data with large missing values, normalize the data, and finally mark normal and abnormal power consumption labels; Step 1: Errors in the data collection process (such as human error, equipment failure) will affect the accuracy of the final data. The data may be disturbed during the transmission process, resulting in information loss or change. In order to improve the accuracy of the power consumption anomaly detection model, it is necessary to exclude the days with daily data missing more than 30%. If the missing amount is less than 30%, the Lagrange interpolation method is used to fill the vacant values in the data set. The Lagrange interpolation method formula is as follows: Where: x and y are the subscripts of missing values and non-missing values a and b; M is the number of values before and after the missing data, L M(a) The result after missing values are inserted; Step 2: In order to improve model performance, eliminate dimensionality effects, speed up training, avoid feature dominance, improve visualization effects, and enhance model stability, the filled load sequence needs to be normalized. The normalization method is expressed as: Where x represents the original data, x min With x max Represent the maximum and minimum values in the load sequence, respectively, N represents the normalized data; Step 3: Mark the date with abnormal power consumption data as 1, and mark the date with normal power consumption as 0.
3. The method for detecting abnormal power consumption based on a fusion model according to claim 1, wherein: The oversampling technology SMOTE algorithm generates abnormal power consumption data, increases the number of abnormal samples, enhances sample diversity, and improves model detection effect. The main steps are: Step 1: SMOTE (Synthetic Minority Over-sampling Technique) is a commonly used oversampling technique, which is mainly used to solve the problem of class imbalance. For each minority class sample, calculate its K nearest neighbors (usually K=5), and these neighbor samples also belong to the minority class; Step 2: For each minority class sample, randomly select one or more neighbors from its K nearest neighbors to generate new synthetic samples. The generation formula of the synthetic samples is: y ij =x i +λ×(x i -x ij ) (3) where y ij The newly synthesized sample, x i is the selected nearest sample, λ represents a random number between 0 and 1, x ij is the current minority class sample.
4. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: The processed load data is divided into training set and test set according to 7:3 to train the CNN-BiLSTM fusion model; Convolutional Neural Network (CNN) has excellent feature extraction capabilities and can learn implicit association information between samples. Assume that the input data is X, and the shape is (N, L, C), where N represents the number of samples, L is the sequence length, and C is the number of features; multiple one-dimensional convolution kernels are used to convolve the input to extract local features; an activation function (such as ReLU) is usually applied after each convolution layer to introduce nonlinearity, and a pooling layer (such as maximum pooling or average pooling) is added after the convolution layer to reduce the feature dimension, reduce the computational complexity, and aggregate information. Finally, multiple convolution layers and pooling layers are stacked to gradually extract more advanced features, which can be expressed as: Where Y[i] is the convolution output, K is the convolution kernel size, W is the convolution kernel weight, b is the bias, A[i] represents the ReLU activation function, P[i] represents the maximum pooling, S is the stride, F represents the pooling window size, and L represents the mean square error, which is the loss function of the CNN convolutional neural network during training; The CNN convolutional neural network effectively extracts the features of abnormal power consumption and normal power consumption through convolution and pooling layers, and uses them as input to train the BiLSTM model; The Bi-directional Long Short-Term Memory (BiLSTM) network consists of four parts: input gate, output gate, forget gate and storage unit. These components use the sigmoid activation function to control the output vector of the input gate. The output vector ranges from 0 to 1, indicating the probability of an event. The algorithm can be expressed as: Where w xf 、w hf 、w cf 、w xi 、w hi 、w ci 、w xo 、w ho With w co Represent the weight matrix, a f 、a i with a o They represent bias, σ represents the sigmoid activation function, and f g ,i g ,o g Represent the forget gate, input gate and output gate respectively, (c) t Represents the current memory, hidden layer h t The value of is represented by the output gate function and tanh.
5. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: The particle swarm optimization algorithm (PSO) is used to optimize the optimal clustering number a of the fuzzy kernel clustering algorithm (KFCM) so that the fuzzy kernel clustering algorithm can achieve the best effect. Finally, the user's normal power consumption data curve and typical power consumption curve are extracted. The specific steps are as follows: Step 1: Initialize the particle swarm, where each particle represents a possible solution of the cluster center in the fuzzy kernel clustering algorithm; Step 2: Set the fitness function of the particle swarm optimization algorithm to the target error of fuzzy clustering; Step 3: Update the speed and position of each particle according to the update rule of the particle swarm optimization algorithm until the fitness function reaches the minimum value, which is the optimal position of the particle in the world, and determine the optimal number of clusters a. The speed update and position update calculation method of the particle swarm optimization algorithm is: Among them, w is the inertia weight, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, pbest is the individual optimal solution, and gbest is the global optimal solution; Step 4: Extract the typical daily load curve according to the optimal cluster number a.
6. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: The similarity coefficient between the data to be tested and the typical load curve is calculated. The calculation formula is as follows: In the formula N is 96. The typical power consumption curve X t The similarity coefficient with the data to be detected X.
7. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: The data with similarity less than 0.5 is input into the CNN-BiLSTM fusion model trained with normal and abnormal electricity consumption data, and finally the probability of abnormal electricity consumption of the user in the time period is output.
8. The method for detecting abnormal power consumption based on a fusion model according to claim 1, characterized in that: Use the computer to send AT commands to the communication module through the serial port data line, so as to send alarm text messages to users who are suspected of abnormal power consumption to warn them of abnormal power consumption. The steps are as follows: Step 1: First make sure the GSM communication module is correctly connected to the computer, and initialize the GSM communication module in the code, set the baud rate, and make sure the module is ready for communication; Step 2: Configure the GSM communication module to send text messages in text mode. Generally, AT commands are used for setting. Use AT commands to enter the target mobile phone number to send text messages. After waiting for the module to respond, enter the text message content to send text message alarms to users suspected of abnormal electricity usage.