Electric Quantity Calculation Method and Device for Removing Temperature Influence Factors Based on Linear Regression
Through the linear regression model combining power system and Internet data, the influencing factors of temperature are eliminated, and the problem of difficult temperature impact in power analysis is solved, and the accuracy and universality of power analysis are improved.
Patent Information
- Application Number
- CN202210048772.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2042-01-17
AI Technical Summary
When conducting power analysis, it is difficult to effectively remove the influence of other variable factors such as temperature, resulting in low analysis accuracy, and cannot perform alternative calculations in the absence of temperatures similar days.
Using a linear regression-based method, we generate contextual features by collecting and preprocessing power, meteorological and holiday data, fitting training using linear regression models, eliminating temperature influencing factors, and using power systems and Internet data sources to obtain data.
It has achieved accurate removal of temperature influence under different meteorological and holiday conditions, improved the accuracy and universality of power analysis, and supported power analysis for each time period throughout the year.
Smart Images

Figure CN114492010B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of data analysis and artificial intelligence, and mainly relates to a method and device for calculating electricity consumption by removing temperature influencing factors based on linear regression. Background Art
[0002] Currently, when analyzing the electricity consumption of a region, the main data collected is the total electricity consumption data of the region within a time period for analysis. However, in many current application scenarios, such as supporting the analysis of electricity consumption of residents staying at home during the epidemic period, etc., other variable factors (such as temperature typically) between different days need to be removed before further analysis to ensure that the electricity consumption comparison is carried out under controlled variables and to ensure the accuracy of the analysis. The current method is to find days with similar temperatures during the comparison period and calculate the average electricity consumption of these days for substitution. However, there are two problems with the current solution. One is the low accuracy, and the other is that if there are no days with similar temperatures, substitution cannot be carried out. Summary of the Invention
[0003] To solve the drawbacks and deficiencies in the prior art, the present invention proposes a method for calculating electricity consumption by removing temperature influencing factors based on linear regression. Through the analysis and verification of multi-source data, the electricity consumption value of each day after removing the temperature influencing factors can be reasonably obtained, which is convenient for further analysis and use. And this method can obtain data by means of power collection devices such as electric meters and public channels on the Internet, without investing other costs.
[0004] To achieve the above object, the present invention adopts the following technical solutions:
[0005] The method includes the following steps:
[0006] Step 1: Collect the daily energy consumption data of the region where electricity consumption needs to be calculated according to the region, and perform preprocessing;
[0007] Step 2: Collect the daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure within the region released by the National Meteorological Administration, and perform preprocessing;
[0008] Step 3: Collect holiday data, and classify holidays into weekends, weekdays, and long holidays;
[0009] Step 4: Use the holiday data and meteorological data collected in Step 2 and Step 3 to generate the context features of the current day;
[0010] Step 5: Use the electricity consumption data in Step 1 and the context features generated in Step 4 to merge into a sample vector with the electricity consumption data, and perform sample expansion;
[0011] Step 6: Use a linear regression fitting model to fit and train the samples in Step 5;
[0012] Step 7: Extract the temperature feature coefficient parameters of the trained model, and deduct them based on the product of the eigenvalue and the feature coefficient from the daily electricity consumption to obtain the electricity consumption on the day after removing the temperature influence factor. The present invention further includes the following preferred solutions:
[0013] Preferably, in step 1, the collection of the energy consumption data comes from the power user acquisition system, which is the low-voltage residential electricity consumption data. The statistical scope is based on prefecture-level cities. The preprocessing of the energy consumption data is to remove the values with extremely large electricity consumption and negative values.
[0014] Preferably, in step 2, the collection of the meteorological data comes from the data released by the National Meteorological Administration and is obtained after application. The preprocessing of the data includes filling in the missing data. The filling sub-steps are as follows:
[0015] Step 301: According to the differences in the missing data, use other non-missing data fields in the sample for clustering;
[0016] Step 302: Use the average value of the missing category data in the same category of the clustering result to replace the missing data.
[0017] Preferably, in step 4, the context feature refers to the external influence factors on the day that affect the daily electricity consumption data, including meteorological and holiday information. Specifically, it includes: air pressure feature, temperature feature, wind force feature, humidity feature, precipitation feature, and holiday feature. The holiday feature is expressed in the ONEHOT manner, and other features are expressed in segments according to the linear relationship.
[0018] Preferably, in step 5, the sample includes a sample feature vector and a label, and the SMOTE algorithm is used for a certain amount of sample expansion. The sample feature vector refers to the vector generated by connecting the features in step 4, and the label is the daily electricity consumption data.
[0019] Preferably, in step 6, the model for linear regression fitting uses a basic linear regression model, the loss function uses the mean squared error function, and the optimization algorithm uses the gradient descent algorithm.
[0020] Preferably, in step 7, the sign that the model is trained well is that the loss function no longer decreases with the continuous iteration training. The coefficient corresponding to the temperature feature is used as the temperature influence factor, the result of multiplying the feature is used as the influence amount of temperature on electricity consumption, and the electricity consumption result after removing the temperature influence is obtained by directly deducting from the original electricity consumption.
[0021] Furthermore, the present invention also proposes an electricity consumption calculation device for removing temperature influence factors based on linear regression. The device includes:
[0022] Energy consumption data collection module: Collect daily energy consumption data of the areas where electricity consumption calculation is required by region, and perform preprocessing;
[0023] Meteorological data collection module: Collect daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure within the region released by the National Meteorological Administration, and perform preprocessing;
[0024] Holiday data collection module: Collect holiday data, and classify holidays into weekends, weekdays, and long holidays;
[0025] Context feature collection module: Use holiday data and meteorological data to generate the context features of the current day;
[0026] Sample vector generation module: Use context features and electricity consumption data to merge into sample vectors, and perform sample expansion;
[0027] Fitting module: Use a linear regression fitting model to perform fitting training on the samples generated by the sample vector generation module;
[0028] Electricity consumption calculation module: Extract the temperature feature coefficient parameters of the trained model, and deduct according to the product of the eigenvalue and the feature coefficient on the basis of the daily electricity consumption, as the electricity consumption excluding the influence of temperature factors on the current day.
[0029] The present invention also provides a terminal, including a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the method according to the present invention.
[0030] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method according to the present invention are implemented.
[0031] The beneficial effects achieved by the present invention:
[0032] 1. Through the analysis and verification of multi-source data, the present invention can directly remove the influence of temperature factors by using the parameters of the trained model, which is convenient for calculation and ensures accuracy;
[0033] 2. By statistically analyzing all historical information, the present invention can solve the problem of similar calculations for days without corresponding temperatures during the previous analysis period, so as to support the electricity consumption analysis work in all time periods of the whole year, and has high universality. Brief Description of the Drawings
[0034] Figure 1 is a flowchart of a method for calculating electricity consumption by removing the influence of temperature factors based on linear regression according to the present invention. Detailed Embodiments
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the described embodiments of the present invention fall within the scope of protection of the present invention.
[0036] Specifically, the electricity quantity method for eliminating temperature influencing factors based on linear regression proposed in the embodiments of the present application is as Figure 1 shown and includes the following steps:
[0037] Step 1: Collect daily energy consumption data of the regions where electricity quantity calculation is required by region and perform preprocessing;
[0038] The collection of the energy consumption data comes from the power user acquisition system. All the electricity quantity data used in the present invention are low-voltage residential electricity quantity data, and the statistical scope is based on prefecture-level cities.
[0039] The data preprocessing of the electricity quantity includes removing values with extremely large electricity quantities and negative values.
[0040] Step 2: Collect daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure in the region released by the National Meteorological Administration and perform preprocessing;
[0041] The collection of the meteorological data comes from the data released by the National Meteorological Administration and is obtained after application. The main data preprocessing is to fill in the missing data. The sub-steps for filling in are as follows:
[0042] Step 301: Each original data sample has a total of 5 data fields. According to the different missing data, we use the other 4 non-missing data fields in the sample for clustering.
[0043] Step 302: Use the average value of the missing category data in the same category of the clustering result to replace the missing data.
[0044] Step 3: Collect holiday data and classify holidays into weekends, weekdays, and long holidays;
[0045] Step 4: Use the holiday data and meteorological data collected in Step 2 and Step 3 to generate the context features of the current day;
[0046] The context features refer to the external influencing factors of the current day that affect the electricity quantity data of the current day, including meteorological and holiday information.
[0047] In the present invention, it refers to air pressure characteristics, temperature characteristics, wind force characteristics, humidity characteristics, precipitation characteristics, and holiday characteristics. The holiday characteristics are expressed in the ONEHOT manner, and the other characteristics are expressed in segments according to linear relationships.
[0048] Step 5: Use the power consumption data in Step 1 and the context features generated in Step 4 to merge into a sample vector and perform sample augmentation;
[0049] The sample includes a sample feature vector (the vector generated by connecting the features in Step 4) and a label (the daily power consumption data), and a certain amount of sample augmentation is performed using the SMOTE algorithm.
[0050] Step 6: Use the basic linear regression model to perform fitting training on the samples in Step 5;
[0051] For the model fitted by linear regression, the basic linear regression model is used, the loss function uses the mean squared error function, and the optimization algorithm adopts the gradient descent algorithm;
[0052] The expression of the linear regression model is:
[0053]
[0054] where Y i is the dependent variable, which is expressed as the daily power consumption in the present invention, β0 represents the power consumption base, and β i is the regression coefficient, X i is the independent variable, which is expressed as the context features formed in Step 3 in the present invention, and ω represents the offset.
[0055] It can be optimized and iteratively solved by the gradient descent method to improve the convergence speed.
[0056] The mean squared error function between the predicted value and the true value of the above model is used as the loss function. When it no longer decreases with iterative training, it is considered that the model training is completed.
[0057] Step 7: Extract the temperature feature coefficient parameters of the trained model, and deduct them based on the product of the feature value and the feature coefficient on the basis of the daily power consumption, as the power consumption of the day excluding the influence of temperature factors;
[0058] In the above trained model, remove the product of the regression coefficient representing temperature and the independent variable, and deduct it from the power consumption, thereby obtaining the power consumption of the day excluding the influence of temperature factors.
[0059] The sign of training completion is that the loss function no longer decreases with iterative training. We use the coefficient corresponding to the temperature feature as the temperature influence factor, and the result of multiplying it with the feature as the influence amount of temperature on the power consumption. By directly deducting with the original power consumption, the power consumption result after removing the temperature influence can be obtained.
[0060] The present invention also provides an electricity calculation device for eliminating temperature influencing factors based on linear regression, which comprises:
[0061] An energy consumption data collection module: collecting daily energy consumption data of the area where electricity calculation is required by region and performing preprocessing;
[0062] A meteorological data collection module: collecting daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure in the region released by the National Meteorological Administration and performing preprocessing;
[0063] A holiday data collection module: collecting holiday data and classifying holidays into weekends, weekdays, and long holidays;
[0064] A context feature collection module: generating the context features of the current day using holiday data and meteorological data;
[0065] A sample vector generation module: combining context features with electricity data into a sample vector and performing sample expansion;
[0066] A fitting module: performing fitting training on the samples generated by the sample vector generation module using a linear regression fitting model;
[0067] An electricity calculation module: extracting the temperature feature coefficient parameters of the trained model and deducting them based on the product of the eigenvalue and the feature coefficient from the electricity consumption of the current day as the electricity consumption after eliminating the temperature influencing factors of the current day.
[0068] The present disclosure may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0069] A computer-readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example—but not limited to—an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device, such as a punched card or raised structures in grooves storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage medium used herein is not construed as being a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.
[0070] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded to an external computer or external storage device through a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include a copper transmission cable, an optical fiber transmission, a wireless transmission, a router, a firewall, a switch, a gateway computer, and / or an edge server. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.
[0071] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine - related instructions, microcode, firmware instructions, state - setting data, or source code or object code written in any combination of one or more programming languages, including object - oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer - readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand - alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer - readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field - programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer - readable program instructions to implement various aspects of the present disclosure.
[0072] Aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer - readable program instructions.
[0073] These computer - readable program instructions can be provided to a processor of a general - purpose computer, a special - purpose computer, or other programmable data - processing apparatus to produce a machine such that the instructions, when executed by the processor of the computer or other programmable data - processing apparatus, create a means for implementing the functions / acts specified in one or more blocks of the flowchart and / or block diagram. These computer - readable program instructions can also be stored in a computer - readable storage medium, which causes a computer, a programmable data - processing apparatus, and / or other devices to operate in a particular manner, so that the computer - readable medium storing the instructions includes a manufacture, which includes instructions for implementing various aspects of the functions / acts specified in one or more blocks of the flowchart and / or block diagram.
[0074] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, causing a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process such that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in one or more boxes of the flowchart and / or block diagram.
[0075] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functionality involved. It should also be noted that each block of the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or acts, or by a combination of dedicated hardware and computer instructions.
[0076] The applicant has made a detailed description and explanation of the embodiments of the present invention with reference to the accompanying drawings. However, those skilled in the art should understand that the above embodiments are only the preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, rather than a limitation on the protection scope of the present invention. On the contrary, any improvement or modification based on the spirit of the present invention should fall within the protection scope of the present invention.
Claims
1. A method for calculating electricity consumption by eliminating temperature influencing factors based on linear regression, characterized in that: The method includes the following steps: Step 1: Collect the daily energy consumption data of the area where electricity consumption needs to be calculated by region and perform preprocessing; the collection of the energy consumption data comes from the power user acquisition system, which is the low-voltage residential electricity consumption data, and the statistical scope is based on prefecture-level cities. The preprocessing of the energy consumption data is to remove values with extremely large electricity consumption and negative values; Step 2: Collect the daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure in the region released by the National Meteorological Administration and perform preprocessing; Step 3: Collect holiday data and classify holidays into weekends, weekdays, and long holidays; Step 4: Use the meteorological data and holiday data in Step 2 and Step 3 to generate the context features of the current day; Step 5: Combine the preprocessed daily energy consumption data in Step 1 and the context features generated in Step 4 into a sample vector and perform sample augmentation; Step 6: Use a linear regression fitting model to fit and train the samples in Step 5; Step 7: Take out the temperature feature coefficient parameters of the trained model and deduct them based on the product of the feature value and the feature coefficient on the basis of the current day's electricity consumption as the electricity consumption after eliminating the temperature influencing factors on the current day.
2. The method according to claim 1, characterized in that: In Step 2, the collection of the meteorological data comes from the data released by the National Meteorological Administration and is obtained after application. The preprocessing of the data includes filling in the missing data. The sub-steps of filling are as follows: Step 301: According to the differences in the missing data, use other non-missing data fields in the sample for clustering; Step 302: Use the average value of the missing category data in the same category of the clustering result to replace the missing data.
3. The method according to claim 2, characterized in that: In Step 4, the context features refer to the external influencing factors of the current day that affect the current day's electricity consumption data including meteorological and holiday information, specifically including: air pressure feature, temperature feature, wind force feature, humidity feature, precipitation feature, and holiday feature. The holiday feature is expressed in the ONEHOT manner, and other features are expressed in segments according to the linear relationship.
4. The method according to claim 3, characterized in that: In Step 5, the sample includes a sample feature vector and a label, and the SMOTE algorithm is used for a certain amount of sample augmentation. Among them, the sample feature vector refers to the vector generated by connecting the context features in Step 4, and the label is the current day's electricity consumption data.
5. The method according to claim 4, characterized in that: In Step 6, the model for linear regression fitting uses a basic linear regression model, the loss function uses the mean squared error function, and the optimization algorithm uses the gradient descent algorithm.
6. The method according to claim 5, characterized in that: In step 7, the sign that the model is well-trained is that the loss function no longer decreases with iterative training. The coefficient corresponding to the temperature feature is used as the temperature influence factor, and the result of multiplying it with the feature is used as the influence amount of temperature on the electricity quantity. The electricity quantity result after removing the temperature influence is obtained by directly deducting it from the original electricity quantity.
7. An electric quantity calculation device for eliminating temperature influencing factors based on linear regression, characterized in that, The device includes: Energy consumption data collection module: Collect daily energy consumption data of the areas where electricity quantity calculation is required by region, and perform preprocessing; Meteorological data collection module: Collect daily meteorological data including temperature, wind force, humidity, precipitation, and air pressure within the region released by the National Meteorological Administration, and perform preprocessing; Holiday data collection module: Collect holiday data, and classify holidays into weekends, weekdays, and long holidays; Context feature collection module: Use holiday data and meteorological data to generate the context features of the current day; Sample vector generation module: Combine the context features with the preprocessed daily energy consumption data to form a sample vector, and perform sample augmentation; Fitting module: Use a linear regression fitting model to perform fitting training on the samples generated by the sample vector generation module; Electricity quantity calculation module: Extract the temperature feature coefficient parameter of the trained model, and deduct it based on the product of the feature value and the feature coefficient on the basis of the daily electricity quantity, as the electricity quantity after removing the temperature influence factor on the current day.
8. The device according to claim 7, wherein: In the energy consumption data collection module, the collection of the energy consumption data comes from the power user acquisition system, which is low-voltage residential electricity quantity data. The statistical scope is based on prefecture-level cities. The preprocessing of the energy consumption data is to remove values with extremely large electricity quantities and negative values.
9. The device according to claim 8, wherein: In the meteorological data collection module, the collection of the meteorological data comes from the data released by the National Meteorological Administration and is obtained after application. The preprocessing of the data includes filling in the missing data. The filling sub-steps are as follows: Step 301: According to the differences in the missing data, use other non-missing data fields in the sample for clustering; Step 302: Use the average value of the missing category data in the same category of the clustering result to replace the missing data.
10. The device according to claim 9, wherein: In the context feature collection module, the context features refer to the external influence factors of the current day that affect the daily electricity quantity data including meteorological and holiday information, specifically including: air pressure feature, temperature feature, wind force feature, humidity feature, precipitation feature, and holiday feature. The holiday feature is expressed in the ONEHOT manner, and other features are expressed in segments according to the linear relationship.
11. The device according to claim 10, wherein: In the sample vector generation module, the sample includes a sample vector and a label, and the SMOTE algorithm is used for a certain amount of sample augmentation. Among them, the sample feature vector refers to the vector generated by connecting the features in step 4, and the label is the daily electricity quantity data.
12. The device according to claim 11, wherein: In the fitting module, the model for linear regression fitting uses a basic linear regression model, the loss function uses the mean squared error function, and the optimization algorithm uses the gradient descent algorithm.
13. The device according to claim 12, wherein: In the power calculation module, the sign that the model is well-trained is that the loss function no longer decreases with iterative training. The coefficient corresponding to the temperature feature is used as the temperature influence factor, and the result of multiplying it with the feature is used as the influence of temperature on the power. The power result after removing the temperature influence is obtained by directly deducting the original power.
14. A terminal, characterized in that, It includes a processor and a storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1-6.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Federal transfer learning method for predicting residual life of group products
CN113536670A
Power data preprocessing method based on context environment
CN113779109A