Method and system for screening of abnormal electricity
By simulating manual login to the metering system through automation technology, and utilizing multi-window analysis and preset threshold screening, the problem of low efficiency in traditional power anomaly screening methods has been solved, achieving efficient and accurate power anomaly identification.
Patent Information
- Application Number
- CN202411729402.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2044-11-28
AI Technical Summary
Traditional methods for screening abnormal power consumption are inefficient and have a high error rate, making it difficult to meet the current needs for efficient and accurate management.
The system uses automated technology to simulate manual login to the metering system, obtains electricity consumption data of all users within a preset period, analyzes data ratios and average daily electricity consumption using multiple time windows, filters out preliminary abnormal data based on preset thresholds, and confirms the final abnormal data through sliding windows and difference checks.
This improved the efficiency and accuracy of power anomaly screening, reduced the workload of manual intervention and on-site inspection, and ensured the accurate identification of power anomalies.
Smart Images

Figure CN119740158B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power information technology, and more specifically, to a method and system for screening abnormal power consumption. Background Technology
[0002] In recent years, with the improvement of residents' living standards and changes in electricity consumption habits, inquiries and requests regarding electricity consumption and bills have been increasing, and the phenomenon of line leakage is commonplace. Some users mistakenly believe that electricity bills incurred due to leakage can be reduced or waived by the power supply department, which undoubtedly brings considerable difficulties to electricity bill collection and customer service. However, traditional methods for screening abnormal electricity consumption are inefficient and have a high error rate, making it difficult to meet the current needs for efficient and accurate management. Summary of the Invention
[0003] The main objective of this application is to provide a method and system for screening abnormal power consumption, so as to at least solve the problem of low efficiency in existing methods for screening abnormal power consumption.
[0004] To achieve the above objectives, according to one aspect of this application, a method for screening abnormal electricity consumption is provided, comprising: using automated technology to simulate manual login to a metering system to obtain daily electricity consumption data of all users within a preset period; starting from the initial moment of the preset period, selecting a continuous time period of a first window length, calculating the ratio of each electricity consumption data in a first sub-window within the first window to the electricity consumption data of the first day within the first window, obtaining multiple first results, and marking the electricity consumption data as preliminary abnormal data when all the first results exceed a first preset threshold; sliding the first window until all the preset periods have been traversed to obtain all the preliminary abnormal data; from Starting from the earliest of the multiple times corresponding to all the preliminary abnormal data, a continuous time period of the second window length is selected, and the average daily electricity consumption within the second window is calculated to obtain the first average daily electricity consumption. The ratio of the first average daily electricity consumption to the second average daily electricity consumption of a preset historical period is calculated to obtain the second result. If the second result is greater than or equal to the second preset threshold, the electricity consumption data within the second window is marked as the first abnormal data. The second window is slid until all the preset periods are traversed to obtain all the first abnormal data. From the first abnormal data, electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold is selected to obtain abnormal data.
[0005] Optionally, automation technology is used to simulate manual login to the metering system to obtain daily electricity consumption data for all users within a preset period. This includes: storing the electricity consumption data automatically exported from the manual login metering system in corresponding folders using the date of each day as the folder naming standard; merging a first preset value of data files exported from each folder into one file; checking the number of data files exported each day, and if the number of files for the day is less than the first preset value, automatically clearing the data in the corresponding folder and restarting the data export process for that day to obtain the electricity consumption data.
[0006] Optionally, the method further includes: retrieving the electricity consumption data corresponding to the date entered in the filtering conditions of the manual login metering system.
[0007] Optionally, before obtaining the daily electricity consumption data of all users within a preset period, the method further includes: preprocessing the data, wherein the preprocessing includes removing invalid data and processing missing values.
[0008] Optionally, the automation technology also includes automatically merging multiple data files exported from a folder each day to form a unified dataset.
[0009] Optionally, the length of the first window is set to cover the time period required to identify sudden increases in user power consumption, the length of the first window is greater than the length of the first sub-window, and the length of the first sub-window is greater than the first day of the preset period.
[0010] Optionally, the first preset threshold is set as a multiple threshold, used as a benchmark for the initial abnormal data screening, and the second preset threshold is set as a ratio threshold, used as a criterion for judging the first abnormal data.
[0011] Optionally, the preset historical period is a historical reference period, including the previous month and the same period last year, used to provide a reference benchmark for the second average daily electricity consumption.
[0012] According to another aspect of this application, a power consumption anomaly screening system is provided, comprising: an acquisition module, configured to use automated technology to simulate manual login to a metering system and acquire daily power consumption data of all users within a preset period; a power consumption surge screening module, configured to select a continuous time period of a first window length starting from the initial moment of the preset period, calculate the ratio of each power consumption data in a first sub-window within the first window to the power consumption data of the first day within the first window, obtain multiple first results, and mark the power consumption data as preliminary abnormal data when all the first results exceed a first preset threshold; a first traversal module, configured to slide the first window until all preset periods are traversed to obtain all the preliminary abnormal data; and a daily average power consumption comparison and analysis module. The first module is used to select a continuous time period of a second window length, starting from the earliest time among multiple times corresponding to all the preliminary abnormal data, calculate the average daily electricity consumption within the second window to obtain the first average daily electricity consumption, calculate the ratio of the first average daily electricity consumption to the second average daily electricity consumption of a preset historical period, obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold; the second traversal module is used to slide the second window until all the preset periods are traversed to obtain all the first abnormal data; the leakage current characteristic constant power module is used to select electricity consumption data from the first abnormal data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold to obtain abnormal data.
[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the power anomaly screening methods.
[0014] By applying the technical solution of this application, daily electricity consumption data of all users within a preset period is obtained through automated technology. Starting from the initial moment of the preset period, a continuous time period of the length of a first window is selected, and the ratio of the data within the window to the data of the first day is calculated. When the ratio exceeds a first preset threshold, it is marked as preliminary abnormal data. The first window is slid until all preset periods are traversed to obtain all preliminary abnormal data. Starting from the earliest record of the preliminary abnormal data, a continuous time period of the length of a second window is selected, and the average daily electricity consumption within the second window is calculated, and the ratio with the data of a preset historical period is calculated. If the ratio is greater than or equal to a second preset threshold, it is further marked as first abnormal data. The second window is slid until all preset periods are traversed to obtain all first abnormal data. From the first abnormal data, electricity consumption data that is greater than a third preset threshold and the difference in electricity consumption between two adjacent days is less than a fourth preset threshold is selected to obtain abnormal data, thereby solving the problem of low efficiency in traditional electricity anomaly screening methods. Attached Figure Description
[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0016] Figure 1 A hardware structure block diagram of a mobile terminal performing a power anomaly screening method according to an embodiment of this application is shown;
[0017] Figure 2 A flowchart illustrating a power anomaly screening method according to an embodiment of this application is shown;
[0018] Figure 3 A schematic flowchart of the main program for a power anomaly screening method according to an embodiment of this application is shown;
[0019] Figure 4 A flowchart illustrating the power consumption data export process of an optional power consumption anomaly screening method provided according to an embodiment of this application is shown.
[0020] Figure 5 A flowchart illustrating the combined electricity consumption data of an optional electricity anomaly screening method provided according to an embodiment of this application is shown.
[0021] Figure 6 A flowchart illustrating an optional power anomaly screening method provided according to an embodiment of this application is shown.
[0022] The attached figures are labeled as follows:
[0023] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation
[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] As described in the background section, existing power anomaly screening methods are inefficient and have a high error rate, making it difficult to meet the current needs for efficient and accurate management. To address the problem of low efficiency in power anomaly screening methods, embodiments of this application provide a power anomaly screening method and system.
[0028] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0029] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of screening abnormal battery power according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0030] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] This embodiment provides a method for screening abnormal power consumption on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0032] Figure 2 This is a flowchart of a power anomaly screening method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0033] Step S201: Use automation technology to simulate manual login to the metering system and obtain the daily electricity consumption data of all users within a preset period;
[0034] Specifically, automation technology typically refers to the use of programming and software tools to automatically execute a series of tasks that humans can perform manually, thereby improving efficiency and reducing errors. In this solution, automation technology is mainly used to simulate the process of power company employees logging into the power metering system, automatically performing data query and export operations, thus avoiding the tedious steps of manually logging in and exporting data repeatedly.
[0035] Since electricity metering systems typically require user authentication, including entering usernames and passwords, automation software can simulate these manual operations to automate the login process. This technology can utilize automation frameworks or libraries such as Selenium, BeautifulSoup, or Scrapy, which can control browsers or directly parse web page data to automate login and data scraping.
[0036] After logging into the system, the automation software automatically queries and downloads daily electricity consumption data for all power users based on a preset period (e.g., the past 60 days in this solution) and filtering criteria. The system may offer a batch data export function, but to ensure data integrity and accuracy, the automation software checks the export status. If incomplete data is found, it automatically performs supplementary export until all required data is obtained.
[0037] Step S202: Starting from the initial moment of the preset period, select a continuous time period of the first window length, calculate the ratio of each of the above-mentioned electricity consumption data in the first sub-window of the first window to the above-mentioned electricity consumption data on the first day in the first window, and obtain multiple first results. If all the above-mentioned first results exceed the first preset threshold, mark the above-mentioned electricity consumption data as preliminary abnormal data.
[0038] Specifically, regarding the selection of the first window length, a fixed-length time window (called the first window) is selected starting from the first day of a preset period (60 days), for example, a continuous 7 days. This window length is chosen based on the analysis of abnormal electricity consumption characteristics. Anomalies typically appear within a short period, hence a moderately short window is selected for data comparison and analysis. Within the selected first window, a sub-window is selected (e.g., the last five days within the first window in this scheme), and the ratio between the electricity consumption data for each day of the last five days within the first window and the electricity consumption data for the first day of that window is calculated. This calculation step is used to assess the trend of electricity consumption over time, particularly whether there is a sudden and sustained large increase. There is a preset threshold used to determine whether the electricity consumption ratio is abnormal. If all calculated ratios (i.e., the first result) exceed this first preset threshold, for example, a ratio greater than 13 times in this scheme, this indicates that within the selected first window, the user's electricity consumption has experienced a significant and sustained surge, which is an initial indication of an abnormal electricity consumption. When the ratio exceeds the preset threshold, the algorithm marks all electricity consumption data within the first window as preliminary abnormal data. This means that for every 7-day cycle, if the electricity consumption on each day increases significantly compared to the first day, then the electricity consumption data for those 7 days will be considered to have potential anomalies.
[0039] Step S203: Slide the first window until all the preset cycles have been traversed to obtain all the preliminary abnormal data.
[0040] Specifically, after completing the analysis of the first window, the window is slid forward one day (or slid according to specific settings), and the same data ratio calculation and outlier marking are performed on the new first window. This process is repeated until all data within the preset period is covered, thus ensuring that all initial outliers within the entire period are identified.
[0041] Step S204: Starting from the earliest time among multiple times corresponding to all the above preliminary abnormal data, select a continuous time period of the second window length, calculate the average daily electricity consumption within the second window to obtain the first average daily electricity consumption, calculate the ratio of the first average daily electricity consumption to the second average daily electricity consumption of the preset historical time period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold.
[0042] Specifically, for the selected second window length, a new time window, called the second window, is chosen based on the earliest recorded time point of the preliminary abnormal data. Its length differs from the first window (e.g., 5 consecutive days in this scheme) and is used to assess the average change in electricity consumption over a longer period. Within the second window, the electricity consumption data for each day is averaged to obtain the daily average electricity consumption within that window, i.e., the first daily average electricity consumption. This step is to capture the daily patterns of electricity consumption behavior and check for fluctuations outside the normal range. Next, the first daily average electricity consumption is compared with the second daily average electricity consumption for a preset historical period (e.g., last month or the same period last year). The second daily average electricity consumption is the daily average electricity consumption under historical normal electricity consumption patterns and is used as a benchmark for judging anomalies. There is a second preset threshold used to determine whether the ratio between the first and second daily average electricity consumption is abnormal. If the calculated ratio (the second result) is greater than or equal to this threshold, for example, a ratio greater than or equal to 5 in this scheme, this means that the user's daily average electricity consumption within the second window is significantly higher than the historical normal level, which is further evidence of abnormal electricity consumption. If the second result exceeds the second preset threshold, then the electricity consumption data in the second window will be marked as the first abnormal data. This means that not only is a short-term surge in electricity consumption identified, but it is also confirmed that this surge has not returned to normal levels over a longer period of time, thereby increasing the reliability of the anomaly detection.
[0043] Through this process, the initial abnormal data is further verified and refined into first-level abnormal data, which usually indicates that the anomaly is more obvious and persistent. The second-level analysis increases the depth and breadth of anomaly detection, plays a crucial role in confirming power abnormalities, and also provides a more accurate basis for the final anomaly data screening.
[0044] Step S205: Slide the second window until all preset cycles have been traversed to obtain all the first abnormal data.
[0045] Specifically, after initially marking the first abnormal data, the second window continues to slide. This means the system moves the window to the next time point, covering a new time period. For example, if the second window is a continuous 5 days, after analyzing the first 5-day window, it will move to cover a continuous 5 days starting from the second day, and so on. The second window continues to slide until it covers the entire preset period (e.g., 60 days) and analyzes every continuous time period within the period. This ensures the algorithm can check all possible data fluctuation patterns within the period, not just the immediate subsequent time periods of the initial abnormal data. Through the sliding and analysis of the second window, if the ratio of the calculated average daily electricity consumption to the historical average daily electricity consumption is greater than or equal to a second preset threshold within any window, then all electricity consumption data within that window will be marked as the first abnormal data. This marking continues throughout the entire preset period until all data has been checked. This process ensures a comprehensive analysis of the data throughout the entire period, not just a simple confirmation of the initial abnormal data. It allows the screening algorithm to capture abnormal patterns that may appear in different parts of the period, enhancing the comprehensiveness and accuracy of the screening.
[0046] Step S206: Select electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold from the first abnormal data to obtain abnormal data.
[0047] Specifically, from the set of data previously marked as the first anomaly, further filtering is performed to identify data with electricity consumption exceeding a third preset threshold. This threshold is typically set to a relatively high, fixed value, such as 15 kWh in this scheme. It reflects that in the power system, only when electricity consumption reaches or exceeds this value can it be considered a truly anomaly. This helps filter out data that, although initially marked as anomaly, do not show significant changes in actual electricity consumption. In addition to the absolute value of electricity consumption, the difference in electricity consumption between two consecutive days is also checked to see if it is less than another preset threshold, namely the fourth preset threshold. For example, in this scheme, this threshold is set to 10 kWh. Even if the electricity consumption on a certain day exceeds the third preset threshold, if the difference between it and the electricity consumption of the previous or subsequent day is less than 10 kWh, it indicates that this high electricity consumption change is relatively stable, rather than a random or instantaneous anomaly. This difference check helps identify data that remains consistently at an abnormal level, rather than experiencing brief fluctuations, thereby improving the accuracy and reliability of anomaly detection.
[0048] Identifying anomalous data: By filtering according to the above two conditions, the scope can be further narrowed down from the initial anomalous data to identify data points that not only show significantly higher than normal electricity consumption but also exhibit a relatively stable pattern of change between adjacent days. These data points are ultimately confirmed as anomalous data, representing abnormal electricity consumption situations that may genuinely require the power company's attention and investigation within the preset period.
[0049] This final screening step effectively identifies the most likely abnormal power consumption from a large amount of data by combining the absolute value and relative stability of power consumption. This reduces the workload of subsequent manual intervention and on-site inspections, and improves the efficiency and accuracy of the entire screening process.
[0050] Figure 3 This is a flowchart of the main program for the power anomaly screening method according to an embodiment of this application. Figure 3 As shown, it includes the following steps:
[0051] Check that all exported historical files are complete;
[0052] If all historical export files are complete, export the user meter data for the current day;
[0053] If the historical export files are incomplete, export the historical data that was not exported by executing the "Export user meter data for today" step;
[0054] Merge the data in each exported directory into a single table;
[0055] Analyze and filter daily electricity consumption;
[0056] Output the filtered results;
[0057] End the process.
[0058] In a specific embodiment of this application, automation technology is used to simulate manual login to the metering system to obtain daily electricity consumption data of all users within a preset period. This includes: storing the electricity consumption data automatically exported from the aforementioned manual login metering system in corresponding folders using the date of each day as the folder naming standard; merging a first preset value of data files exported from each folder into one file; checking the number of data files exported each day; and if the number of files for the day is less than the first preset value, automatically clearing the data in the corresponding folder and restarting the data export process for the day to obtain the aforementioned electricity consumption data.
[0059] Specifically, the system uses automation technology to simulate the operations of power company employees, automatically logging into the electricity metering system. This process is similar to employees manually logging into the system, but it is executed automatically by the software, avoiding the tediousness and potential errors of manual operation. The software automatically performs data queries and exports, obtaining daily electricity consumption data for all users within a preset period.
[0060] File Naming and Storage: The software automatically categorizes and stores the exported electricity consumption data according to the date of each day. Specifically, the daily electricity consumption data is stored in a folder named after that date, for example, "2023-03-15" represents the data for March 15th. The data in each folder corresponds to the electricity consumption of all users on that day, facilitating subsequent data processing and analysis by date.
[0061] File merging: After storing the data, the software further processes it, merging multiple data files exported from each folder (for example, due to system limitations, 600 pages can be exported each time, potentially up to 8 times) into a single file. This simplifies data management, making subsequent data analysis more convenient and avoiding the need to open and manipulate multiple files when processing data.
[0062] Data Integrity Check and Remediation: The software has an automatic data integrity check function. It checks whether the number of data files exported each day reaches a preset first value (e.g., 8 files). If the number of files on a given day is less than this preset value, it indicates that the data export is incomplete, possibly due to system limitations or technical problems during the export process. In this case, the software will automatically clear the data in that folder and restart the data export process for that day to ensure data integrity and the accuracy of subsequent analysis.
[0063] Specifically, a flowchart of an optional power consumption anomaly screening method provided according to an embodiment of this application is shown below for exporting power consumption data. Figure 4 As shown, it includes the following steps:
[0064] Iterate through the folders to be exported;
[0065] Open the browser using Selenium technology;
[0066] Log in to the metering system through interfaces such as tag search and tag click;
[0067] Get the export date based on the folder name;
[0068] By entering the date in the metering system's filter criteria, you can retrieve the meter data for that day.
[0069] Export data once every 600 pages;
[0070] Determine whether to increment the number of files in the exported directory by 1;
[0071] If the number of files in the directory has not been incremented by 1, wait 10 seconds and then execute the step "Determine if the number of files in the directory has been incremented by 1 by exporting the directory";
[0072] If the number of files in the directory is incremented by 1, determine whether all data for the day has been exported.
[0073] If not all data is exported for the day, execute the step of "exporting data every 600 pages";
[0074] If all data for the day has been exported, copy the data to the exported folder;
[0075] Determine if the traversal is complete;
[0076] If the traversal is not complete, execute the "traverse the required export folders" step;
[0077] Once the traversal is complete, the process ends.
[0078] Through the above steps, the electricity anomaly screening software can continuously and automatically export and organize electricity consumption data within a preset period from the electricity metering system, forming an orderly and complete dataset. By automating login, data export, file naming and storage, data merging, and integrity checks and data recovery, the entire data acquisition process is designed to be both efficient and reliable, ensuring that each user's daily electricity consumption data is collected accurately, providing high-quality data support for the precise identification and subsequent processing of electricity anomalies.
[0079] In one embodiment of this application, the method further includes: retrieving the electricity consumption data corresponding to the date entered in the filtering conditions of the manual metering system.
[0080] Specifically, the software uses automation technology to simulate the operational process of employees in the electricity metering system, including logging into the system and setting filter criteria. Typically, when employees search for data in the system, they input a specific date or date range as query parameters to obtain electricity consumption information for the corresponding time period. The software automates this operation, allowing the system to automatically acquire the required data daily without human intervention. After automatically logging into the system, the software automatically inputs the preset date into the system's filter criteria. This date refers to the specific date on which the software plans to acquire electricity consumption data. For example, if the software is scheduled to run automatically every evening, it will input the current date that evening and retrieve the electricity consumption data for all users that day. This date-based data retrieval ensures the real-time nature and relevance of the data; that is, the data acquired by the software is always up-to-date and corresponds to the target date.
[0081] By precisely inputting the target date in the filtering criteria, the software can retrieve highly accurate electricity consumption data directly related to that date. This step is crucial in the entire data acquisition process because it directly affects the accuracy and effectiveness of subsequent data analysis. Only by ensuring that the acquired data accurately matches the target date can the electricity anomaly screening algorithm analyze based on the correct dataset, thereby effectively identifying genuine electricity consumption anomalies.
[0082] In a specific embodiment of this application, before obtaining the daily electricity consumption data of all users within a preset period, the above method further includes: preprocessing the data, wherein the preprocessing includes removing invalid data and processing missing values.
[0083] Specifically, data preprocessing is an indispensable step before data analysis, especially when dealing with large amounts of data, as data quality directly affects the reliability of the analysis results. Through automated preprocessing, electricity anomaly screening software can ensure that electricity consumption data obtained from the electricity metering system has been properly cleaned and prepared, thereby supporting subsequent in-depth analysis and anomaly identification.
[0084] Removing invalid data: Before analyzing electricity consumption data, data that does not meet requirements or cannot be used for analysis is checked and removed. Invalid data may include erroneous readings, non-numeric characters, extreme outliers (such as negative electricity consumption or excessively high electricity consumption beyond physical possibility), duplicate records, or any other form of non-compliant data. Removing this invalid data prevents it from misleading the analysis results and ensures that the algorithm identifies electricity consumption anomalies based on reliable data.
[0085] Handling Missing Values: Sometimes, datasets may contain missing electricity consumption data for certain users on certain dates. This could be due to metering equipment malfunctions, data transmission problems, or system recording errors. Software preprocessing includes handling these missing values. Common methods include imputing missing values (e.g., using the user's historical average electricity consumption, median, or the average electricity consumption of other users within the same time period), or, in some cases, excluding the entire user's data if there is too much missing data to avoid affecting the accuracy of the analysis results. The purpose of handling missing values is to make the dataset more complete, supporting comprehensive analysis by the algorithm.
[0086] By removing invalid data and handling missing values, the software can significantly improve the quality of the dataset. This step is crucial for ensuring the accuracy and effectiveness of the power anomaly screening algorithm. High-quality datasets not only reduce errors in the analysis results but also enhance the algorithm's ability to identify genuine anomalies, thereby improving the efficiency and reliability of the entire power anomaly screening process.
[0087] In a specific embodiment of this application, the above-mentioned automation technology further includes: automatically merging multiple data files exported from a folder each day to form a unified dataset.
[0088] Specifically, the automatic data file merging process ensures that daily electricity consumption data can be completely collected and integrated even under system export limitations. This operation also helps correct duplicate data or data fragmentation problems that may be caused by multiple exports, improving the integrity and accuracy of the dataset and providing a solid data foundation for accurate screening of electricity consumption anomalies. Through automation, user electricity consumption data is exported daily from the electricity metering system and stored in folders named after the current date. Since the system may limit the amount of data exported each time, multiple export operations may be required within a day, resulting in each folder potentially containing multiple data files. To facilitate subsequent data analysis and processing, an automatic data file merging function is also provided. It identifies each folder named after a date and automatically merges all exported data files within these folders into a single unified data file. This process typically utilizes data processing techniques, such as the `concat` function in the pandas library, to concatenate multiple CSV or Excel files, using unique identifiers such as asset numbers as primary keys to ensure accurate data merging. By automatically merging multiple data files within folders, a unified dataset containing electricity consumption data for all users on a specific date can be generated. This dataset is complete and structured, facilitating further processing and analysis by algorithms. A unified dataset not only simplifies data management but also improves the efficiency and accuracy of data analysis.
[0089] Specifically, a flowchart of the combined electricity consumption data for an optional electricity anomaly screening method provided according to an embodiment of this application is shown below. Figure 5 As shown, it includes the following steps:
[0090] Traverse the directories that need to be merged;
[0091] Determine if the traversal is complete;
[0092] The process ends once the traversal is complete.
[0093] Use pandas technology to read all data in the directory before the entire directory has been traversed;
[0094] Use concat to merge all the data;
[0095] Select the required field data;
[0096] Save the merged data in the current directory and execute the "Traverse the directories to be merged" step.
[0097] In a specific embodiment of this application, the length of the first window is set to cover the time period required to identify sudden increases in user power consumption. The length of the first window is greater than the length of the first sub-window, and the length of the first sub-window is greater than the first day of the preset period.
[0098] Specifically, the length of the first window is set based on the time period required to identify sudden increases in user power consumption. The choice of this time period is crucial because it determines the shortest duration of power consumption changes that the software can detect. For example, if the software aims to identify significant power consumption increases lasting several days, the length of the first window would be set to cover this period, such as 7 days. This window length setting ensures that the software can capture the complete pattern of power consumption surges.
[0099] Within the first window, smaller first sub-windows are further subdivided. The length of the first sub-window is shorter than the first window, but still longer than the first day of the preset period. For example, if the first window length is set to 7 days, the first sub-window might be set to 5 days. This division allows the software to detect changes in electricity consumption on a shorter timescale, helping to distinguish between normal fluctuations and abnormal surges. Simultaneously, by setting the first sub-window to be longer than the first day of the preset period, the software ensures that changes in electricity consumption after the start of the period are considered during analysis, avoiding the omission of important data.
[0100] By setting windows of varying lengths, the power consumption anomaly screening software can strike a balance between flexibility and accuracy. A longer first window ensures the software captures continuous power surge patterns, while a shorter first sub-window helps the software identify power consumption changes more quickly and precisely. This multi-layered window configuration allows the software to more accurately filter out anomalies from user power consumption data, reducing false alarms and improving screening efficiency.
[0101] In a specific embodiment of this application, the first preset threshold is set as a multiple threshold, which is used as a benchmark for the preliminary screening of abnormal data, and the second preset threshold is set as a ratio threshold, which is used as a criterion for judging the first abnormal data.
[0102] Specifically, the first preset threshold is set as a multiple threshold. In the initial stage of power consumption anomaly screening, this multiple threshold is used to filter preliminary abnormal data. Specifically, the software compares a user's power consumption over different time periods. If the power consumption during a certain period significantly increases compared to a reference period (such as the first day or average daily power consumption), and the increase exceeds the multiple set by the first preset threshold, then the data for that period will be initially marked as abnormal. For example, if the first preset threshold is set to 13 times, the software will filter out user data where power consumption suddenly increases to more than 13 times the level of the first day.
[0103] After initial screening of abnormal data, a "second preset threshold" is used to precisely determine which data constitutes a true anomaly. This threshold is typically expressed as a ratio used to assess the reliability of the initially screened abnormal data. For example, the second preset threshold might be set as the ratio of average daily electricity consumption during a period of sudden increase to the average daily electricity consumption of the previous month or the same period last year. If this ratio exceeds the limit set by the second preset threshold (e.g., 5 times), then this data will be identified as an anomaly and processed as the first type of anomaly. This helps the software exclude increases in electricity consumption caused by seasonal changes, equipment upgrades, or other normal factors, thereby more accurately identifying genuine electricity consumption anomalies.
[0104] By setting two preset thresholds, a phased strategy is employed to filter out abnormal data. The first preset threshold is used to quickly eliminate most normal data, narrowing down the range of abnormal data; while the second preset threshold is used for further precise judgment, ensuring that the finally filtered data truly represents abnormal power levels. This strategy not only improves the efficiency of abnormal data filtering but also increases the accuracy of judgment, avoiding a large number of false alarms.
[0105] Anomaly Data Identification and Feedback: After filtering and judging based on the two preset thresholds mentioned above, the software can identify truly possible abnormal electricity consumption data and output this data for the power company to further analyze and process. Identified abnormal data may include a significant increase in user electricity consumption, sustained high electricity consumption, or other unusual electricity usage patterns. This data is crucial for the power company to promptly investigate potential circuit faults, leakage, or abnormal user electricity behavior.
[0106] In a specific embodiment of this application, the aforementioned preset historical period is a historical reference period, including the previous month and the same period last year, used to provide a reference benchmark for the aforementioned second daily average electricity consumption.
[0107] Specifically, preset historical periods refer to selected past periods as reference points for current electricity consumption analysis. These historical periods include, but are not limited to, the same period of the previous month and the same period of the previous year (for example, if the current month is October 2023, then the same period of the previous year refers to October 2022). They provide users with electricity consumption data within these specific historical periods so that the software can compare and analyze current electricity consumption patterns.
[0108] Electricity consumption data within a preset historical period is used as a reference benchmark for the second average daily electricity consumption. This means that calculating the average daily electricity consumption within these historical periods is typically done by dividing the total electricity consumption within that period by the number of days in that period. This average daily electricity consumption becomes a key benchmark for the software to assess whether a user's current electricity consumption pattern is abnormal. When identifying abnormal user electricity consumption, the average daily electricity consumption within the user's current preset period is compared with the average daily electricity consumption within the preset historical period. Using a set second preset threshold (ratio threshold), if the ratio between the user's current average daily electricity consumption and the average daily electricity consumption of the historical reference period exceeds a certain limit, this may indicate that the user's electricity consumption pattern is abnormal and requires further investigation.
[0109] By using data from the previous month and the same period last year as benchmarks, the software can account for the impact of seasonality, cyclicality, and other long-term trends on electricity consumption. For example, electricity consumption is typically higher in summer than in winter, and specific events from the previous year (such as large events or abnormal weather) may also affect electricity consumption. By comparing with historical data, the software can filter out these normal fluctuations and focus on identifying genuine anomalies in electricity consumption.
[0110] The use of preset historical time periods improves the accuracy of anomaly identification. By comparing current data with historical data, the software can assess current electricity consumption based on the user's long-term electricity usage patterns. If a user experiences a significant, unexpected increase in electricity consumption without considering seasonality, this may indicate a circuit fault, leakage, or other anomaly, and this data will be flagged for further review.
[0111] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the power anomaly screening method of this application will be described in detail below with reference to specific embodiments.
[0112] This embodiment relates to a specific method for screening abnormal power consumption. A flowchart illustrating an optional method for screening abnormal power consumption according to an embodiment of this application is shown below. Figure 6 As shown, it includes the following steps:
[0113] Traverse the directory to be analyzed, which contains 60 days of user meter data;
[0114] Determine if the directory has been completely traversed;
[0115] Read the merged meter data from the folder before the directory has been completely traversed;
[0116] Add the read merged meter data to list A, and execute the step of "traversing the directory to be analyzed, a total of 60 days of user meter data";
[0117] After the directory traversal is complete, iterate through list A;
[0118] Determine if list A has been completely traversed;
[0119] If list A has not been fully traversed, subtract the two days' data from each other using the meter asset number as the primary key to obtain the daily electricity consumption data.
[0120] Store the reduced electricity consumption data into another list B, and then perform the "traverse the list" step.
[0121] After iterating through list A, iterate through list B;
[0122] Determine if list B has been completely traversed;
[0123] If list B has not been fully traversed, select 7 days of electricity consumption data;
[0124] If the electricity consumption over the next five days is divided by the electricity consumption on the first day, and both times are greater than 13, then the user is selected.
[0125] Add the selected users to the total data and execute the "traverse list B" step;
[0126] After traversing list B, read the electricity consumption data of all users from the previous month;
[0127] Calculate the average daily electricity consumption of all users last month;
[0128] Iterate through the total data, starting from day one, and retrieve the electricity consumption data for five consecutive days in each iteration;
[0129] Calculate the average daily electricity consumption for these five days;
[0130] If the average daily electricity consumption is 5 times or more than the average daily electricity consumption of the previous month, then select the user;
[0131] Based on this, the user's electricity consumption was greater than 15 kWh five days later, and the difference in electricity consumption between two consecutive days was within 10 kWh.
[0132] The users selected in the previous step are data on users with abnormal power consumption, which will be output to the cloud drive;
[0133] End the process.
[0134] This invention also provides a power anomaly screening system, comprising:
[0135] The acquisition module is used to simulate manual login to the metering system using automation technology to acquire the daily electricity consumption data of all users within a preset period.
[0136] Specifically, the acquisition module is used to simulate the process of power company employees logging into the electricity metering system through automation technology, automatically performing data query and export operations, thus avoiding the tedious steps of manual login and data export. Since electricity metering systems typically require user authentication, including entering usernames and passwords, the automation software simulates these manual operations to automatically complete the login process. This technology can use automation frameworks or libraries such as Selenium, BeautifulSoup, or Scrapy, which can control browsers or directly parse web page data to automate login and data scraping. After logging into the system, the automation software automatically queries and downloads daily electricity consumption data for all power users based on a preset period (e.g., the past 60 days in this solution) and filtering conditions. The system may provide a batch data export function, but to ensure data integrity and accuracy, the automation software checks the data export status; if incomplete data is found, it automatically performs supplementary export until all required data is obtained.
[0137] The power consumption surge screening module is used to select a continuous time period of the first window length starting from the initial moment of the preset period, calculate the ratio of each of the above power consumption data in the first sub-window of the first window to the above power consumption data of the first day in the first window, obtain multiple first results, and mark the above power consumption data as preliminary abnormal data when all the above first results exceed the first preset threshold.
[0138] Specifically, in the power consumption surge screening module, for the selection of the first window length, a fixed-length time window (called the first window) is selected starting from the first day of a preset period (60 days), for example, 7 consecutive days. This window length is chosen based on the analysis of abnormal power consumption characteristics. Anomalies typically appear within a short period, hence a moderately short window is selected for data comparison and analysis. Within the selected first window, a sub-window is selected (e.g., the last five days within the first window in this scheme), and the ratio between the power consumption data for each day of the last five days within the first window and the power consumption data for the first day of that window is calculated. This calculation step is used to assess the trend of power consumption over time, particularly whether there is a sudden and sustained large increase. There is a preset threshold for judging whether the power consumption ratio is abnormal. If all calculated ratios (i.e., the first result) exceed this first preset threshold, for example, a ratio greater than 13 times in this scheme, this indicates that within the selected first window, the user's power consumption has experienced a significant and sustained surge, which is an initial indication of power consumption anomalies. When the ratio exceeds a preset threshold, the algorithm will mark all electricity consumption data within the first window as preliminary abnormal data. This means that for every 7-day cycle, if the electricity consumption on each day increases significantly compared to the first day, then the electricity consumption data for those 7 days will be considered potentially abnormal.
[0139] The first traversal module is used to slide the first window mentioned above until all the preset cycles are traversed to obtain all the preliminary abnormal data mentioned above.
[0140] Specifically, the first traversal module, after completing the analysis of the first first window, slides the window forward one day (or according to specific settings) and continues to perform the same data ratio calculation and outlier marking on the new first window. This process is repeated until all data within the entire preset period is covered, thereby ensuring that all initial outliers within the entire period are identified.
[0141] The daily average electricity consumption comparison and analysis module is used to select a continuous time period of the second window length from the earliest time among multiple times corresponding to all the above-mentioned preliminary abnormal data, calculate the daily average electricity consumption within the second window to obtain the first daily average electricity consumption, calculate the ratio of the first daily average electricity consumption to the second daily average electricity consumption of a preset historical period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold.
[0142] Specifically, in the daily average electricity consumption comparison and analysis module, a new time window, called the second window, is selected based on the earliest recorded time point of the preliminary abnormal data. Its length differs from the first window (e.g., 5 consecutive days in this scheme) and is used to assess the average change in electricity consumption over a longer period. Within the second window, the electricity consumption data for each day is averaged to obtain the daily average electricity consumption within that window, i.e., the first daily average electricity consumption. This step is to capture the daily patterns of electricity consumption behavior and check for fluctuations outside the normal range. Next, the first daily average electricity consumption is compared with the second daily average electricity consumption for a preset historical period (e.g., last month or the same period last year). The second daily average electricity consumption is the daily average electricity consumption under historical normal electricity consumption patterns and is used as a benchmark for judging abnormalities. There is a second preset threshold used to determine whether the ratio between the first and second daily average electricity consumption is abnormal. If the calculated ratio (the second result) is greater than or equal to this threshold, for example, a ratio greater than or equal to 5 in this scheme, this means that the user's daily average electricity consumption within the second window is significantly higher than the historical normal level, which is further evidence of abnormal electricity consumption. If the second result exceeds the second preset threshold, then the electricity consumption data in the second window will be marked as the first abnormal data. This means that not only is a short-term surge in electricity consumption identified, but it is also confirmed that this surge has not returned to normal levels over a longer period of time, thereby increasing the reliability of the anomaly detection.
[0143] Through the daily average electricity consumption comparison and analysis module, the initial abnormal data, after further verification, was refined into first-level abnormal data, which usually indicates that the anomaly is more obvious and persistent. The second-level analysis increases the depth and breadth of anomaly detection, plays a crucial role in confirming electricity consumption anomalies, and also provides a more accurate basis for the final anomaly data screening.
[0144] The second traversal module is used to slide the second window until all the preset cycles are traversed to obtain all the first abnormal data.
[0145] Specifically, the second traversal module is used to continue sliding the second window after the initial marking of the first abnormal data. This means that the system moves the window to the next time point, covering a new time period. For example, if the second window is a continuous 5 days, after analyzing the first 5-day window, it will move to cover a continuous 5 days starting from the second day, and so on. The second window will continue to slide until it covers the entire preset period (e.g., 60 days) and analyzes every continuous time period within the period. This ensures that the algorithm can check all possible data fluctuation patterns within the period, not just the direct subsequent time periods of the initial abnormal data. Through the sliding and analysis of the second window, if the ratio of the calculated average daily electricity consumption to the historical average daily electricity consumption is greater than or equal to a second preset threshold in any window, then all electricity consumption data in that window will be marked as the first abnormal data. This marking will continue during the traversal of the entire preset period until all data has been checked. This traversal process ensures a comprehensive analysis of the data throughout the entire period, not just a simple confirmation of the initial abnormal data. It enables the screening algorithm to capture abnormal patterns that may appear in different parts of the period, enhancing the comprehensiveness and accuracy of the screening.
[0146] The leakage current characteristic constant power module is used to select power consumption data that are greater than the third preset threshold and the difference between the power consumption of two adjacent days is less than the fourth preset threshold from the above-mentioned first abnormal data to obtain abnormal data.
[0147] Specifically, the leakage current characteristic constant power module is used to further filter data from the set of previously marked first abnormal data, identifying those with power consumption exceeding a third preset threshold. This threshold is typically set to a relatively high fixed value, such as 15 kWh in this scheme. It reflects that in a power system, only when power consumption reaches or exceeds this value can it be considered a true anomaly. This helps filter out data that, although initially marked as abnormal, do not show significant changes in actual power consumption. In addition to the absolute value of power consumption, the module also checks whether the difference in power consumption between two consecutive days is less than another preset threshold, i.e., a fourth preset threshold. For example, in this scheme, this threshold is set to 10 kWh. Even if the power consumption on a certain day exceeds the third preset threshold, if the difference between it and the power consumption of the previous or subsequent day is less than 10 kWh, it indicates that this high power consumption change is relatively stable, rather than a random or instantaneous anomaly. This difference check helps identify data that remains consistently at abnormal levels, rather than experiencing brief fluctuations, thereby improving the accuracy and reliability of anomaly detection.
[0148] This invention provides a computer-readable storage medium including a stored program, wherein the program, when running, controls the device containing the computer-readable storage medium to perform the power anomaly screening method.
[0149] Specifically, methods for screening abnormal power consumption include:
[0150] Step S201: Use automation technology to simulate manual login to the metering system and obtain the daily electricity consumption data of all users within a preset period;
[0151] Step S202: Starting from the initial moment of the preset period, select a continuous time period of the first window length, calculate the ratio of each of the above-mentioned electricity consumption data in the first sub-window of the first window to the above-mentioned electricity consumption data on the first day in the first window, and obtain multiple first results. If all the above-mentioned first results exceed the first preset threshold, mark the above-mentioned electricity consumption data as preliminary abnormal data.
[0152] Step S203: Slide the first window until all the preset cycles have been traversed to obtain all the preliminary abnormal data.
[0153] Step S204: Starting from the earliest time among multiple times corresponding to all the above preliminary abnormal data, select a continuous time period of the second window length, calculate the average daily electricity consumption within the second window to obtain the first average daily electricity consumption, calculate the ratio of the first average daily electricity consumption to the second average daily electricity consumption of the preset historical time period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold.
[0154] Step S205: Slide the second window until all preset cycles have been traversed to obtain all the first abnormal data.
[0155] Step S206: Select electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold from the first abnormal data to obtain abnormal data.
[0156] This invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:
[0157] Step S201: Use automation technology to simulate manual login to the metering system and obtain the daily electricity consumption data of all users within a preset period;
[0158] Step S202: Starting from the initial moment of the preset period, select a continuous time period of the first window length, calculate the ratio of each of the above-mentioned electricity consumption data in the first sub-window of the first window to the above-mentioned electricity consumption data on the first day in the first window, and obtain multiple first results. If all the above-mentioned first results exceed the first preset threshold, mark the above-mentioned electricity consumption data as preliminary abnormal data.
[0159] Step S203: Slide the first window until all the preset cycles have been traversed to obtain all the preliminary abnormal data.
[0160] Step S204: Starting from the earliest time among multiple times corresponding to all the above preliminary abnormal data, select a continuous time period of the second window length, calculate the average daily electricity consumption within the second window to obtain the first average daily electricity consumption, calculate the ratio of the first average daily electricity consumption to the second average daily electricity consumption of the preset historical time period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold.
[0161] Step S205: Slide the second window until all preset cycles have been traversed to obtain all the first abnormal data.
[0162] Step S206: Select electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold from the first abnormal data to obtain abnormal data.
[0163] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0164] Step S201: Use automation technology to simulate manual login to the metering system and obtain the daily electricity consumption data of all users within a preset period;
[0165] Step S202: Starting from the initial moment of the preset period, select a continuous time period of the first window length, calculate the ratio of each of the above-mentioned electricity consumption data in the first sub-window of the first window to the above-mentioned electricity consumption data on the first day in the first window, and obtain multiple first results. If all the above-mentioned first results exceed the first preset threshold, mark the above-mentioned electricity consumption data as preliminary abnormal data.
[0166] Step S203: Slide the first window until all the preset cycles have been traversed to obtain all the preliminary abnormal data.
[0167] Step S204: Starting from the earliest time among multiple times corresponding to all the above preliminary abnormal data, select a continuous time period of the second window length, calculate the average daily electricity consumption within the second window to obtain the first average daily electricity consumption, calculate the ratio of the first average daily electricity consumption to the second average daily electricity consumption of the preset historical time period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold.
[0168] Step S205: Slide the second window until all preset cycles have been traversed to obtain all the first abnormal data.
[0169] Step S206: Select electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold from the first abnormal data to obtain abnormal data.
[0170] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0171] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0173] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0174] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0175] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0176] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0177] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0178] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0179] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for screening abnormal power levels, characterized in that, include: The system uses automation technology to simulate manual login to the metering system and obtains daily electricity consumption data for all users within a preset period. Starting from the initial moment of the preset period, a continuous time period of the first window length is selected, and the ratio of each of the electricity consumption data in the first sub-window within the first window to the electricity consumption data of the first day within the first window is calculated to obtain multiple first results. If all the first results exceed the first preset threshold, the electricity consumption data is marked as preliminary abnormal data. The first window length is set to cover the time period required for identifying sudden increases in user electricity consumption. The length of the first window is greater than the length of the first sub-window, and the length of the first sub-window is greater than the first day of the preset period. Slide the first window until all the preset cycles have been traversed to obtain all the preliminary abnormal data; Starting from the earliest of the multiple times corresponding to all the preliminary abnormal data, a continuous time period of the second window length is selected, the average daily electricity consumption within the second window is calculated to obtain the first average daily electricity consumption, the ratio of the first average daily electricity consumption to the second average daily electricity consumption of the preset historical time period is calculated to obtain the second result, and if the second result is greater than or equal to the second preset threshold, the electricity consumption data within the second window is marked as the first abnormal data. Slide the second window until all the preset cycles have been traversed to obtain all the first abnormal data; From the first abnormal data, select the electricity consumption data that is greater than the third preset threshold and the difference in electricity consumption between two adjacent days is less than the fourth preset threshold to obtain abnormal data.
2. The method according to claim 1, characterized in that, Utilizing automation technology to simulate manual login to the metering system, daily electricity consumption data for all users within a preset period is obtained, including: The electricity consumption data automatically exported from the manual metering system will be stored in the corresponding folders using the date of each day as the folder name standard. Merge the first preset value of data files exported from each of the folders into one file; Check the number of data files exported each day. If the number of files for the day is less than the first preset value, automatically clear the data in the corresponding folder and restart the data export process for the day to obtain the electricity consumption data.
3. The method according to claim 1, characterized in that, The method further includes: Based on the date entered in the filtering conditions of the manual metering system, the electricity consumption data corresponding to the date is retrieved.
4. The method according to claim 1, characterized in that, Before acquiring the daily electricity consumption data of all users within a preset period, the method further includes: The data is preprocessed, including removing invalid data and handling missing values.
5. The method according to claim 1, characterized in that, The automation technology also includes: It automatically merges multiple data files exported from a folder each day into a unified dataset.
6. The method according to claim 1, characterized in that, The first preset threshold is set as a multiple threshold, which is used as the benchmark for the initial abnormal data screening. The second preset threshold is set as a ratio threshold, which is used as the judgment criterion for the first abnormal data.
7. The method according to claim 1, characterized in that, The preset historical time period is a historical reference period, including the previous month and the same period last year, used to provide a reference benchmark for the second average daily electricity consumption.
8. A power anomaly screening system, characterized in that, include: The acquisition module is used to simulate manual login to the metering system using automation technology to acquire the daily electricity consumption data of all users within a preset period. The power consumption surge screening module is used to select a continuous time period of a first window length starting from the initial moment of the preset period, calculate the ratio of each power consumption data in the first sub-window of the first window to the power consumption data of the first day in the first window, obtain multiple first results, and mark the power consumption data as preliminary abnormal data when all the first results exceed a first preset threshold. The first window length is set to cover the time period required for identifying user power consumption surges, the length of the first window is greater than the length of the first sub-window, and the length of the first sub-window is greater than the first day of the preset period. The first traversal module is used to slide the first window until all the preset cycles are traversed to obtain all the preliminary abnormal data. The daily average electricity consumption comparison and analysis module is used to select a continuous time period of the second window length from the earliest time among multiple times corresponding to all the preliminary abnormal data, calculate the daily average electricity consumption within the second window to obtain the first daily average electricity consumption, calculate the ratio of the first daily average electricity consumption to the second daily average electricity consumption of the preset historical time period to obtain the second result, and mark the electricity consumption data within the second window as the first abnormal data if the second result is greater than or equal to the second preset threshold. The second traversal module is used to slide the second window until all the preset cycles are traversed to obtain all the first abnormal data. The leakage current characteristic constant power module is used to select power consumption data from the first abnormal data that are greater than a third preset threshold and the difference in power consumption between two adjacent days is less than a fourth preset threshold to obtain abnormal data.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the power anomaly screening method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Abnormal electric quantity data detection method based on long-term and short-term memory network
CN111612651A
Electricity consumption abnormity prompting method and device, computer equipment and storage medium
CN112714368A