Non-contact electric quantity calculation method and system for overhead line based on random forest algorithm
Through the non-contact power calculation method based on the random forest algorithm, the problems of low accuracy and low efficiency of telemetry power estimation of automation equipment are solved, and high-precision and high-efficiency power calculation are realized, reducing manual intervention and improving line loss diagnosis and analysis accuracy.
Patent Information
- Application Number
- CN202411343587.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-25
AI Technical Summary
In the prior art, the telemetry power estimation accuracy of automation equipment is low, which leads to difficulty in line loss diagnosis and analysis, and lacks effective power calculating functions, and relies on manual calculations and is inefficient.
Using the contactless power calculation method based on the random forest algorithm, by obtaining current data, inputting a pre-trained model after pre-processing, using the random forest regressor to build a regression model, combining grid search and cross-validation strategies, establishing a cross-validation grid The best random forest prediction model is used to achieve high-precision power calculation.
It improves the accuracy and efficiency of power calculation, reduces manual intervention, realizes automated power data analysis and calculation, and significantly improves work efficiency.
Smart Images

Figure CN119203057A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power grid operation, and in particular to a contactless power calculation method and system for overhead lines based on a random forest algorithm. Background Art
[0002] Line loss management is an important means for power grids to improve quality and efficiency. Electricity is the data basis for line loss calculation and line loss management. In terms of existing line loss management, the main source of overhead line related data in line professional line loss management is the telemetry data of automation equipment. The downstream electricity data is estimated by telemetry current of automation equipment, which further narrows the scope of the problem and facilitates on-site personnel to investigate.
[0003] The main problems with this method at present are: first, the accuracy is low. The accuracy of the telemetered power estimation of the automated equipment is difficult to meet the requirements of power calculation, and calculation errors are prone to occur, resulting in the inability to diagnose the real cause, affecting the line loss diagnosis and analysis; second, each automated equipment lacks the power calculation function, requiring a lot of manual calculation and analysis, which is inefficient. Summary of the invention
[0004] The object of the present invention is to provide a non-contact power calculation method and system for overhead lines based on a random forest algorithm, so as to perform more effective remote non-contact power calculation on overhead lines.
[0005] In order to achieve the above object, the first aspect of the present invention proposes a non-contact power calculation method for overhead lines based on a random forest algorithm, which is characterized by comprising:
[0006] Get the user's current data;
[0007] The current data is pre-processed and input into a pre-trained model, and the power calculation result is output;
[0008] The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
[0009] In the processing of topological information, the pole number where the user and the automatic switch are located is input into the model as the line user information for training. According to the line user information, a multi-layer numerical classification method is established to parse and process the multi-level branches in the topological information. In the multi-layer numerical classification method, a single numerical value in the topological information is first parsed, and the depth information of a single topological structure point is calculated. Then, the numerical value is classified according to the depth information, and the classified numerical values of the same type are used as a data set corresponding to each depth information; after the topological information is parsed and converted into numerical features, the model is built and trained.
[0010] S4, model building and training;
[0011] Among them, in the model building and training, a random forest regressor is used to build a regression model, and the algorithm flow of the regression model construction is:
[0012] S4.1 obtain a sample data set of labeled electricity;
[0013] S4.2 Sample data normalization;
[0014] S4.3 randomly divides the sample data set into a training sample set and a test sample set;
[0015] S4.4 uses the training sample set data to train the random forest model to obtain a trained random forest model;
[0016] The training random forest model combines grid search and cross-validation strategies to establish a cross-validation grid to optimize the optimal model parameters of the random forest prediction model. The algorithm flow of the cross-validation grid is as follows:
[0017] S4.4.1 Set initial parameters;
[0018] S4.4.2 Establish a grid of hyperparameter combinations;
[0019] S4.4.3 5-fold cross validation;
[0020] S4.4.4 Using the coefficient of determination R 2 Evaluate regression model performance;
[0021] S4.4.5. Find the best model hyperparameter combination.
[0022] S4.5 Use the test sample set to verify the computational performance of the trained random forest model to complete the model training
[0023] The second aspect of the present invention proposes a non-contact power calculation system for overhead lines based on a random forest algorithm, comprising:
[0024] An acquisition module, used to acquire the user's current data;
[0025] An electric quantity calculation module is used to input the electric current data into a pre-established model after pre-processing to obtain an electric quantity calculation result;
[0026] The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
[0027] In view of the defects and shortcomings in the prior art, this non-contact power calculation method and system for overhead lines based on random forest algorithm achieves many advantages through the following specific improvements:
[0028] 1. High-precision acquisition:
[0029] The telemetry data of automation equipment in the prior art has low accuracy and is difficult to meet the requirements of power calculation. The present invention introduces historical data analysis and advanced data processing algorithms to achieve high-precision acquisition of power data based on the original current data, ensuring the accuracy and reliability of power calculation.
[0030] 2. System construction and data analysis functions:
[0031] The existing technology lacks effective power analysis and calculation functions, relies on manual calculation, and is inefficient. The present invention integrates a system of data collection, processing, and analysis, which can automatically complete the analysis and calculation of power data, greatly improves work efficiency, and reduces manual intervention. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0033] Figure 1 A schematic diagram of the model training process provided by an embodiment of the present invention;
[0034] Figure 2 A schematic diagram of a model algorithm provided by an embodiment of the present invention;
[0035] Figure 3 A schematic diagram of the power calculation process provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0037] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit the exemplary embodiments according to the present invention.
[0038] The first aspect of this embodiment provides a non-contact power calculation method for overhead lines based on a random forest algorithm. Figure 1 , Figure 1 The model training process diagram provided by the embodiment of the present invention comprises the following steps: S1, obtaining basic data of the power grid;
[0039] Among them, the basic data of the power grid includes marketing management data, metering automation data, distribution network automation data and dispatching automation system data. That is, the basic data of the power grid is the sample data for building the model.
[0040] Specifically, basic grid data can be obtained through data integration. Among them, marketing management data, that is, marketing system archive data, includes but is not limited to basic archive information of substations, lines, transformers, users, basic information of operating electric energy meters, terminal equipment, transformers and other equipment, as well as business data such as meter replacement; metering automation data includes but is not limited to metering automation meter codes, loads, currents, voltages, operating conditions, alarm information and other collected data; distribution network automation data includes but is not limited to distribution network equipment and user topology data, as well as topology change data caused by load cutover and power supply transfer; dispatching automation system data includes but is not limited to main network equipment topology data, as well as switch opening and closing information.
[0041] S2, data preprocessing;
[0042] This step includes calculating the RMS (Root Mean Square) of the current data, calculating the statistical indicators of the current data, and performing logarithmic transformation on the statistical indicators. In order to facilitate data processing and compress the data volume, the current data is also subjected to feature extraction.
[0043] Calculate the root mean square RMS of current data: Calculating the RMS value is a common method to measure the size of an electrical signal, especially in alternating current (AC). The RMS value is the square root of the average of the squares of a set of values. In electrical signals, this can be used to measure the effective value of current or voltage. Specific calculation method: Multiply the three-phase current of the user or substation by a specified multiple, that is, the transformation ratio of the transformer, in order to adjust the current measurement value to the actual current size. Sum the squares of the true values of the three-phase current of the user or substation and divide them by three, and finally take the square root to obtain the RMS value. In practical applications, the RMS value can be used to evaluate the stability and variability of the current because it can effectively express the average energy of the periodically changing current. This step can reduce the amount of current data and improve the efficiency of calculation.
[0044] When the three-phase current is not strictly symmetrical, the total RMS value needs to calculate the RMS value of each phase separately and then combine them. The final formula is:
[0045]
[0046] Calculate current data statistics: Use the describe() method to generate a statistical description of the RMS value, including the calculation of the minimum, maximum, mean, standard deviation, first quartile, median, third quartile, etc. This provides a quick overview of the distribution of the data, which is convenient for analyzing the changes and stability of the current, as well as calculating the amount of electricity using the current.
[0047] Logarithmic transformation of statistical indicators: In the field of data processing and machine learning, logarithmic transformation of data is a common preprocessing step. This transformation is usually used to reduce the skewness of data, making it closer to a normal distribution, or to reduce the range of differences between data for easier analysis or model training. The purpose of logarithmic transformation: Reduce skewness: Many real-world data distributions are skewed, that is, the data tilts to one side. Logarithmic transformation can help reduce the skewness of data and make it closer to a symmetrical distribution; Dealing with extreme values (Outliers): Logarithmic transformation can reduce the impact of extreme values on overall analysis because it reduces the relative difference between larger and smaller values; Linear relationship: In some cases, logarithmic transformation can help linearize the relationship between variables, so that linear models (such as linear regression) can fit the data more effectively.
[0048] S3, processing topology information;
[0049] Considering that the farther away from the gateway, the greater the voltage drop, and the less linear the relationship between current and power, and the topological information of the automatic switch can also be used to know the users connected behind it, it is convenient to calculate the power of the automatic switch. Therefore, the topological information of the line users is also input into the model to reflect this information.
[0050] In the present invention, the pole numbers of users and automatic switches are used as the topological information of users and automatic switches and input into the model for training. Considering that some users are located on the main road, some are located on the branch road, and some lines have multi-level branches, multi-layer values are used to reflect this situation so that the topological information of users on the multi-level branches can be effectively input into the model. By parsing the single value in the topological information and calculating the depth information of a single topological structure point, the values are then classified according to the depth information, and the classified values of the same type are used as a data set corresponding to each depth information.
[0051] The results of processing some user topology information are shown in Table 1:
[0052] Table 1
[0053] username Topology information User 1 25,1 User 2 31,6,1 User 3 28,3,3,1 User 4 28,14,10 User 5 28,3,3,4 User 6 28,3,4,1 User 7 28,14,4,1 User 8 28,14,4,3 User 9 31,15,4 User 10 31,15,12
[0054] As shown in Table 1, user 1 is located at pole No. 1 on the branch of pole No. 25 on the main line, user 2 is located at pole No. 1 on the branch of pole No. 6 on the branch of pole No. 31 on the main line, and so on. This multi-layer numerical method is used to represent the topological information of users.
[0055] During the training process, topological information is parsed and converted into numerical features for use in machine learning models. The specific processing steps are as follows:
[0056] First, the comma-separated numeric strings in the Tuopu column are converted to numeric lists.
[0057] Next, the length of each list (Tuopu_count) is calculated to reflect the complexity of the topology, which helps the model evaluate the impact of the number of nodes in the topology on energy consumption.
[0058] At the same time, the sum of the values in the list is calculated (Tuopu_sum), which represents the cumulative characteristics of the topology and can reveal the possible impact of the electrical properties of the topology as a whole on the energy consumption.
[0059] Finally, the original Tuopu column and the intermediate generated list column are deleted, and only the extracted numerical features are retained. These features can help the model better understand and utilize the impact of topological structure on energy consumption and improve the accuracy of calculation.
[0060] S4, model building and training;
[0061] The model building and training includes model training, model verification and model preservation. The input data of this calculation model include the current data of the distribution network users, the current data of the automatic switch, the topological structure information of the circuit and the power information of the gateway; the output data is the power corresponding to the current flowing through a certain point in the distribution network in one day.
[0062] See the table below for specific parameters:
[0063] Table 2
[0064] Serial number 1 2 3 4 5 6 7 8 9 10 parameter Mean Std Min 25% 50% 75% Max Tuopu Total Energy
[0065] As shown in Table 2, the first seven parameters in the table are the minimum, maximum, mean, standard deviation, first quartile, median, third quartile and maximum value of the current data in one day, which are statistical indicators of the current data and can reflect the more detailed information of the current data of the distribution network users in one day; the eighth parameter 'Tuopu' is the topological information of the user or the automatic switch; the ninth parameter 'Total' is the gateway power information of the line where the user or the automatic switch is located; the tenth parameter 'Energy' is the target value of the model in this example: the power corresponding to the current flowing through the user or the automatic switch in one day.
[0066] During the training process, the model building and training process involves creating a comprehensive machine learning pipeline including data preprocessing, feature selection, and regression analysis.
[0067] First, we ensure that the data fed into the model is of appropriate format and quality through standardization and feature selection based on statistical tests.
[0068] Subsequently, the regression model was constructed using the random forest regressor, and the grid search and cross-validation strategies were combined to establish the optimal model parameters of the cross-validation grid optimization random forest prediction model. This process not only improved the prediction accuracy of the model, but also enhanced its generalization ability when facing unseen data.
[0069] Finally, the finely tuned model is trained on the entire dataset to fully capture and learn the potential relationships and patterns in the data, and the trained model is saved to a specified path to provide support and services for subsequent application scenarios. This series of detailed and rigorous steps ensures the efficiency and reliability of the model in practical applications.
[0070] Please refer to Figure 2 , Figure 2 The algorithm flow of building a regression model using a random forest regressor is demonstrated, including:
[0071] S4.1 obtain a sample data set of labeled electricity;
[0072] S4.2 Sample data normalization;
[0073] Ensure that all data features have been properly adjusted and standardized before data segmentation and model training. This can effectively improve the effect of model training and the final calculation accuracy;
[0074] S4.3 randomly divides the sample data set into a training sample set and a test sample set;
[0075] In the present invention, 80% of the sample data set is used as a training sample set, and 20% is used as a test sample set. This division helps to verify the effect and generalization ability of the model in subsequent model training;
[0076] S4.4 uses the training sample set data to train the random forest model to obtain a trained random forest model;
[0077] Among them, random forest handles classification and regression tasks by constructing multiple decision trees, and specifically establishes a cross-validation grid optimization random forest prediction model.
[0078] At the beginning of the algorithm, the number of trees to be generated is determined. For each tree, samples are first selected from the training data set through random sampling with replacement, i.e. bootstrap sampling, and then a portion of features are randomly selected at each decision point.
[0079] For each tree node, m features are randomly selected and the optimal split is calculated, usually based on the maximum information gain or Gini Impurity:
[0080]
[0081] Where IG is the information gain, D p is the data set of the parent node, D left and D right are the data sets of the left and right child nodes after segmentation, N and N left and N right are the number of samples of the parent node and the two child nodes respectively.
[0082] For selecting random features, at each split, instead of selecting the best split feature from all features, it is selected from a randomly selected subset, which helps to improve the diversity of the forest.
[0083] Each tree is built independently and recursively splits the data according to the selected samples and features until a predetermined stopping condition is reached, such as the tree reaches a maximum depth or the number of samples under a node is less than a minimum split limit.
[0084] For the regression problem in this embodiment, in the prediction stage, each tree predicts a value, and the final prediction result is the average of the prediction values of all trees:
[0085]
[0086] In this way, random forest reduces the risk of overfitting and improves the generalization ability of the model on unseen data. The specific steps of the cross-validation grid optimization random forest prediction model are:
[0087] S4.4.1 Set initial parameters;
[0088] S4.4.2 Establish a grid of hyperparameter combinations;
[0089] S4.4.3 5-fold cross validation;
[0090] In the present invention, the data set is divided 5 times in total, and then 5 training and verification are performed. In each training, 4 subsets are selected as training sample sets, and the remaining 1 subset is used as a verification set. In each verification, the model is trained and evaluated, so a total of 5 independent training and evaluations are performed. After the performance indicators of each training and verification are recorded, the average value of the 5 verification results is calculated as the final performance evaluation indicator of the model. Through this method, 5-fold cross validation can not only provide the performance of the model on different data sets, but also reduce the deviation caused by uneven data division, ensuring that the evaluation of the model is more robust and reliable.
[0091] S4.4.4 Using the coefficient of determination R 2 Evaluate regression model performance;
[0092] Coefficient of determination R 2 It indicates the degree of fit of the model to the data, that is, the proportion of the variance explained by the model to the total variance. Its value range is between 0 and 1. The closer the value is to 1, the stronger the model's ability to explain the data. The calculation formula of the coefficient of determination is as follows:
[0093]
[0094] S4.4.5 Find the best model hyperparameter combination.
[0095] Finding the best model hyperparameter combination is an important step to improve the performance of random forest model. First, it is necessary to define the hyperparameters to be adjusted and their range of values. In the present invention, the number of decision trees (n_estimators) is set to several values between 100 and 500, the maximum depth of the tree (max_depth) is selected between 10 and 50, and the minimum number of samples required for node splitting (min_samples_split) and the minimum number of samples required for leaf nodes (min_samples_leaf) are selected as 2, 5, 10 and 1, 2, 4 respectively. The maximum number of features (max_features) is selected as 'auto', 'sqrt', 'log2', etc. Then select the hyperparameter search method, and the present invention adopts the grid search method. Grid search finds the best parameters by traversing all possible hyperparameter combinations. Although the computational cost is high, the global optimal solution can be found.
[0096] S4.5 uses the test sample set to verify the computational performance of the trained random forest model to complete the training of the model. Specific embodiment:
[0098] Please refer to Figure 3 , Figure 3 The present invention provides a specific embodiment of the contactless electricity quantity calculation for overhead lines based on the random forest algorithm.
[0099] A1. Loading parameters:
[0100] First, the system will load relevant parameters, including the model path, input data path, preprocessing parameters, etc. The main purpose of parameter loading is to provide necessary information and settings for subsequent steps to ensure the smooth progress of the process. These parameters are the basis for subsequent steps.
[0101] Model path: Specify the location of the trained model file.
[0102] Data path: Specify the location of the input data file.
[0103] Preprocessing parameters: including standardization parameters, missing value processing methods, etc.
[0104] The specific parameter input format is as follows:
[0105] mode=1#0 is automatic switch, 1 is user;
[0106] model_path = 'model path' # Input model path;
[0107] file_path = 'Current Excel table path' # Input the exported current Excel table path;
[0108] tuopu='10,4'# Input topology information, separated by commas;
[0109] #If you are a user, enter the following additional parameters;
[0110] multiplier=600# Input transformer ratio to restore the real current;
[0111] total=10456.1#gateway power information.
[0112] A2. Determination category:
[0113] The system will determine the type of data to be processed based on the loaded parameters. If it is user data (Model=1), it will enter the user power calculation process; if it is automatic switch data (Model=0), it will enter the automatic switch power calculation process.
[0114] A3. User power calculation, the specific process is as follows:
[0115] A3.1. Load the trained model:
[0116] The system will load previously trained user power calculation models. These models have been trained and can perform calculations based on the input data.
[0117] A3.2. Load current data and calculate RMS statistical indicators:
[0118] The system loads the user's current data and calculates the RMS (root mean square) statistical index of the data as one of the input features of the model.
[0119] When the three-phase current is not strictly symmetrical, the total RMS value needs to calculate the RMS value of each phase separately and then combine them. The final formula is:
[0120]
[0121] The sample user statistics calculated by the algorithm are shown in the table below;
[0122] Table 3
[0123] Serial number 1 2 3 4 5 6 7 Statistical indicators Mean Std Min 25% 50% 75% Max Calculated Value 52.913 16.833 29.688 38.182 48.659 64.918 94.86
[0124] Process the topology information, parse it from the Tuopu string, and get the derived data of the topology information: the number of topological structures (Tuopu_count) and the sum of all topological values (Tuopu_sum).
[0125] The sample user topology information calculated by the algorithm is shown in the following table;
[0126] Table 4
[0127] data Input information Topology data 1 Topology data 2 Data name Tuopu Tuopu_count Tuopu_sum Numeric 10,4 2 14.0
[0128] A3.3. Construct input DataFrame:
[0129] The current data and its calculated RMS statistical indicators are organized into a DataFrame, which is an efficient data structure that facilitates data processing and model input.
[0130] The data information obtained above constitutes the complete input feature set of the model.
[0131] The complete input feature set is shown in the following table:
[0132] Table 5
[0133] Serial number 1 2 3 4 5 6 7 8 9 10 parameter Mean Std Min 25% 50% 75% Max Total Tuopu_count Tuopu_sum Numeric 52.9 16.8 29.7 38.1 48.7 64.9 94.8 10456.1 2 14.0
[0134] A3.4. Preprocessing data:
[0135] Preprocess the data in the DataFrame, including missing value processing, standardization and other steps to ensure that the data meets the input requirements of the model. Data preprocessing is to ensure that the data meets the input requirements of the model and improve the calculation accuracy of the model. The standardization formula is as follows:
[0136]
[0137] A3.5. Processing topology information:
[0138] When calculating power using a trained model, the topology information (Tuopu column) is processed as follows: First, the comma-separated numeric strings in the Tuopu column are converted into lists of numeric values. Next, the length of each list (Tuopu_count) is calculated from these lists to reflect the complexity of the topology, which helps the model evaluate how the number of nodes in the topology affects energy consumption. At the same time, the sum of the values in the list (Tuopu_sum) is calculated, which represents the cumulative characteristics of the topology and can reveal the possible impact of the overall electrical properties of the topology on energy consumption.
[0139] A3.6. Add topology information to DataFrame:
[0140] The processed topological features are then integrated into the model's input feature set so that the model can use this information to make accurate energy consumption predictions. In this way, the model can more effectively understand and utilize topological information and improve the accuracy of power consumption calculations.
[0141] A3.7. Calculate:
[0142] Use the selected model to calculate the preprocessed data and output the user's power calculation results.
[0143] A3′, automatic switch power calculation process:
[0144] A3′.1. Loading current parameters:
[0145] The system will load the current parameters related to the automated switch.
[0146] A3′.2. Calculate statistical indicators:
[0147] According to the loaded current parameters, relevant statistical indicators are calculated, which will serve as the input features of the model.
[0148] A3′.3. Processing topology information:
[0149] The topology information of the automatic switch is processed in the same way as the user and substation topology information, so that a model for calculating the power of the automatic switch can be established by using the model for calculating the power of the user.
[0150] A3′.4. Establishing the automatic switch calculation model:
[0151] In the process of establishing the automatic switch power calculation model, it is first necessary to use big data analysis and machine learning algorithms to analyze the relationship between the user voltage drop and the grid topology based on the trained user power calculation model. By mining this relationship, a voltage drop model is constructed, which can use the topological information of the automatic switch to calculate the voltage value of the automatic switch. Furthermore, by combining the current information of the automatic switch and the established voltage drop model, the power consumption of the automatic switch can be calculated more accurately.
[0152] A3′.5. Calculate:
[0153] The preprocessed data is calculated using the voltage drop model to obtain the electrical quantity of the automated switch.
[0154] A4. Output calculation results:
[0155] Output the calculation results and show them to the user. Show the complete example and verify it with user data with accurate power consumption data. The processed feature set is input into the loaded model for calculation. The model will output the calculated power consumption value of the user. The model outputs the result (in kWh), Result: 430.862:
[0156] The calculation results of this example show:
[0157] Table 6
[0158]
[0159]
[0160] Prediction results analysis:
[0161] The model has carried out detailed calculations on users and substations on different lines, and the results show that the model has achieved high calculation accuracy on all lines. Whether it is a user with a large power base or a user with a small power base, the model can provide accurate calculation results, showing good applicability.
[0162] The second aspect of this embodiment proposes a non-contact power calculation method for overhead lines based on a random forest algorithm, including:
[0163] Get the user's current data;
[0164] The current data is pre-processed and input into a pre-trained model, and the power calculation result is output;
[0165] The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
[0166] In a specific implementation, the basic data of the power grid includes: marketing management data, metering automation data, distribution network automation data and dispatching automation system data; in the processing topology information, the pole number where the user and the automation switch are located is input into the model as line user information for training.
[0167] Specifically, basic grid data can be obtained through data integration. Among them, marketing management data, that is, marketing system archive data, includes but is not limited to basic archive information of substations, lines, transformers, users, basic information of operating electric energy meters, terminal equipment, transformers and other equipment, as well as business data such as meter replacement; metering automation data includes but is not limited to metering automation meter codes, loads, currents, voltages, operating conditions, alarm information and other collected data; distribution network automation data includes but is not limited to distribution network equipment and user topology data, as well as topology change data caused by load cutover and power supply transfer; dispatching automation system data includes but is not limited to main network equipment topology data, as well as switch opening and closing information.
[0168] In a specific implementation, S2, data preprocessing: This step includes calculating the RMS (Root Mean Square) of the current data, calculating the statistical index of the current data, and performing logarithmic transformation on the statistical index. To facilitate data processing, the data volume is compressed, and feature extraction is also performed on the current data.
[0169] Calculate the root mean square RMS of current data: Calculating the RMS value is a common method to measure the size of an electrical signal, especially in alternating current (AC). The RMS value is the square root of the average of the squares of a set of values. In electrical signals, this can be used to measure the effective value of current or voltage. Specific calculation method: Multiply the three-phase current of the user or substation by a specified multiple, that is, the transformation ratio of the transformer, in order to adjust the current measurement value to the actual current size. Sum the squares of the true values of the three-phase current of the user or substation and divide them by three, and finally take the square root to obtain the RMS value. In practical applications, the RMS value can be used to evaluate the stability and variability of the current because it can effectively express the average energy of the periodically changing current. This step can reduce the amount of current data and improve the efficiency of calculation.
[0170] When the three-phase current is not strictly symmetrical, the total RMS value needs to calculate the RMS value of each phase separately and then combine them. The final formula is:
[0171]
[0172] Calculate current data statistics: Use the describe() method to generate a statistical description of the RMS value, including the calculation of the minimum, maximum, mean, standard deviation, first quartile, median, third quartile, etc. This provides a quick overview of the distribution of the data, which is convenient for analyzing the changes and stability of the current, as well as calculating the amount of electricity using the current.
[0173] Logarithmic transformation of statistical indicators: In the field of data processing and machine learning, logarithmic transformation of data is a common preprocessing step. This transformation is usually used to reduce the skewness of data, making it closer to a normal distribution, or to reduce the range of differences between data for easier analysis or model training. The purpose of logarithmic transformation: Reduce skewness: Many real-world data distributions are skewed, that is, the data tilts to one side. Logarithmic transformation can help reduce the skewness of data and make it closer to a symmetrical distribution; Dealing with extreme values (Outliers): Logarithmic transformation can reduce the impact of extreme values on overall analysis because it reduces the relative difference between larger and smaller values; Linear relationship: In some cases, logarithmic transformation can help linearize the relationship between variables, so that linear models (such as linear regression) can fit the data more effectively.
[0174] In a specific implementation, step S3, processing topology information:
[0175] Considering that the farther away from the gateway, the greater the voltage drop, and the less linear the relationship between current and power, and the topological information of the automatic switch can also be used to know the users connected behind it, it is convenient to calculate the power of the automatic switch. Therefore, the topological information of the line users is also input into the model to reflect this information.
[0176] In the present invention, the pole numbers of users and automatic switches are used as the topological information of users and automatic switches and input into the model for training. Considering that some users are located on the main road, some are located on the branch road, and some lines have multi-level branches, multi-layer values are used to reflect this situation so that the topological information of users on the multi-level branches can be effectively input into the model. By parsing the single value in the topological information and calculating the depth information of a single topological structure point, the values are then classified according to the depth information, and the classified values of the same type are used as a data set corresponding to each depth information.
[0177] The results of processing some user topology information are shown in Table 1:
[0178] Table 1
[0179] username Topology information User 1 25,1 User 2 31,6,1 User 3 28,3,3,1 User 4 28,14,10 User 5 28,3,3,4 User 6 28,3,4,1 User 7 28,14,4,1 User 8 28,14,4,3 User 9 31,15,4 User 10 31,15,12
[0180] As shown in Table 1, user 1 is located at pole No. 1 on the branch of pole No. 25 on the main line, user 2 is located at pole No. 1 on the branch of pole No. 6 on the branch of pole No. 31 on the main line, and so on. This multi-layer numerical method is used to represent the topological information of users.
[0181] During the training process, topological information is parsed and converted into numerical features for use in machine learning models. The specific processing steps are as follows:
[0182] First, the comma-separated numeric strings in the Tuopu column are converted to numeric lists.
[0183] Next, the length of each list (Tuopu_count) is calculated to reflect the complexity of the topology, which helps the model evaluate the impact of the number of nodes in the topology on energy consumption.
[0184] At the same time, the sum of the values in the list is calculated (Tuopu_sum), which represents the cumulative characteristics of the topology and can reveal the possible impact of the electrical properties of the topology as a whole on the energy consumption.
[0185] Finally, the original Tuopu column and the intermediate generated list column are deleted, and only the extracted numerical features are retained. These features can help the model better understand and utilize the impact of topological structure on energy consumption and improve the accuracy of calculation.
[0186] In a specific implementation, a multi-layer numerical classification method is established based on the line user information to parse and process the multi-level branches in the topology information.
[0187] In a specific embodiment, in the multi-layer numerical classification method, the single numerical value in the topological information is first parsed and the depth information of the single topological structure point is calculated. Then, the numerical values are classified according to the depth information, and the classified similar numerical values are used as a data set corresponding to each depth information.
[0188] In a specific implementation, after the topological information is parsed and converted into numerical features, model building and training are performed.
[0189] In a specific implementation, the step of pre-processing the current data and inputting it into a pre-established model to obtain the power calculation result specifically includes:
[0190] Calculate the RMS statistical index of the current data as one of the input features of the model;
[0191] The current data and RMS statistical indicators are organized into a DataFrame, and the obtained data information constitutes a complete input feature set of the model;
[0192] Preprocess the data in DataFrame, including missing value processing and standardization;
[0193] When using the trained model to calculate power, the topology information is processed as follows: First, the comma-separated numeric strings in the Tuopu column are converted into numeric lists; then, the length of each list is calculated from the list to reflect the complexity of the topological structure; at the same time, the sum of the values in the list is calculated;
[0194] Parse the topological information and convert it into numerical features before adding it to the DataFrame;
[0195] Input the DataFrame into the pre-trained model and output the power calculation results.
[0196] In a specific implementation, the algorithm flow of the regression model construction is:
[0197] S4.1 obtain a sample data set of labeled electricity;
[0198] S4.2 Sample data normalization;
[0199] S4.3 randomly divides the sample data set into a training sample set and a test sample set;
[0200] S4.4 uses the training sample set data to train the random forest model to obtain a trained random forest model;
[0201] Specifically, random forest constructs multiple decision trees to handle classification and regression tasks, and specifically establishes a cross-validation grid optimization random forest prediction model.
[0202] At the beginning of the algorithm, the number of trees to be generated is determined. For each tree, samples are first selected from the training data set through random sampling with replacement, i.e. bootstrap sampling, and then a portion of features are randomly selected at each decision point.
[0203] For each tree node, m features are randomly selected and the optimal split is calculated, usually based on the maximum information gain or Gini Impurity:
[0204]
[0205] Where IG is the information gain, D p is the data set of the parent node, D left and D rjght are the data sets of the left and right child nodes after segmentation, N and N left and N right are the number of samples of the parent node and the two child nodes respectively.
[0206] For selecting random features, at each split, instead of selecting the best split feature from all features, it is selected from a randomly selected subset, which helps to improve the diversity of the forest.
[0207] Each tree is built independently and recursively splits the data according to the selected samples and features until a predetermined stopping condition is reached, such as the tree reaches a maximum depth or the number of samples under a node is less than a minimum split limit.
[0208] For the regression problem in this embodiment, in the prediction stage, each tree predicts a value, and the final prediction result is the average of the prediction values of all trees:
[0209]
[0210] S4.5 uses the test sample set to verify the computational performance of the trained random forest model to complete the training of the model.
[0211] In a specific implementation, the training random forest model described in S4.4 is combined with a grid search and a cross-validation strategy to establish a cross-validation grid to optimize the optimal model parameters of the random forest prediction model.
[0212] In a specific implementation, the algorithm flow of the cross-validation grid is:
[0213] S4.4.1 Set initial parameters;
[0214] S4.4.2 Establish a grid of hyperparameter combinations;
[0215] S4.4.3 5-fold cross validation;
[0216] In a specific embodiment, the present invention divides the data set 5 times in total, and then performs 5 training and verifications. In each training, 4 subsets are selected as training sample sets, and the remaining 1 subset is used as a verification set. In each verification, the model is trained and evaluated, so a total of 5 independent training and evaluations are performed. After the performance indicators of each training and verification are recorded, the average value of the 5 verification results is calculated as the final performance evaluation indicator of the model. Through this method, 5-fold cross validation can not only provide the performance of the model on different data sets, but also reduce the deviation caused by uneven data division, ensuring that the evaluation of the model is more robust and reliable.
[0217] S4.4.4 Using the coefficient of determination R 2 Evaluate regression model performance;
[0218] Coefficient of determination R 2It indicates the degree of fit of the model to the data, that is, the proportion of the variance explained by the model to the total variance. Its value range is between 0 and 1. The closer the value is to 1, the stronger the model's ability to explain the data. The calculation formula of the coefficient of determination is as follows:
[0219]
[0220] S4.4.5 Find the best model hyperparameter combination.
[0221] Finding the best model hyperparameter combination is an important step to improve the performance of random forest model. First, it is necessary to define the hyperparameters to be adjusted and their range of values. In the present invention, the number of decision trees (n_estimators) is set to several values between 100 and 500, the maximum depth of the tree (max_depth) is selected between 10 and 50, and the minimum number of samples required for node splitting (min_samples_split) and the minimum number of samples required for leaf nodes (min_samples_leaf) are selected as 2, 5, 10 and 1, 2, 4 respectively. The maximum number of features (max_features) is selected as 'auto', 'sqrt', 'log2', etc. Then select the hyperparameter search method, and the present invention adopts the grid search method. Grid search finds the best parameters by traversing all possible hyperparameter combinations. Although the computational cost is high, the global optimal solution can be found.
[0222] The third aspect of this embodiment proposes a non-contact power calculation system for overhead lines based on a random forest algorithm, including:
[0223] An acquisition module, used to acquire the user's current data;
[0224] The power calculation module is used to input the current data into a pre-established model after pre-processing, obtain the power calculation result output and display it to the user;
[0225] The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
[0226] It is known from common technical knowledge that the present invention can be implemented by other embodiments that do not deviate from its spirit or essential features. Therefore, the above disclosed embodiments are only illustrative in all respects and are not exclusive. All changes within the scope of the present invention or within the scope equivalent to the present invention are included in the present invention.
[0227] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented 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.
[0228] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0229] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0230] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0231] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A non-contact power calculation method for overhead lines based on random forest algorithm, characterized in that: include: Get the user's current data; The current data is pre-processed and input into a pre-trained model, and the power calculation result is output; The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
2. According to claim 1, the non-contact power calculation method for overhead lines based on random forest algorithm is characterized in that: The basic data of the power grid includes: marketing management data, metering automation data, distribution network automation data and dispatching automation system data; in the processing topology information, the pole number where the user and the automation switch are located is input into the model as line user information for training.
3. According to claim 2, the non-contact power calculation method for overhead lines based on random forest algorithm is characterized in that: According to the line user information, a multi-layer numerical classification method is established to parse and process the multi-level branches in the topology information.
4. According to claim 3, the non-contact power calculation method for overhead lines based on random forest algorithm is characterized in that: In the multi-layer numerical classification method, firstly, a single numerical value in the topological information is parsed, and the depth information of a single topological structure point is calculated. Then, the numerical values are classified according to the depth information, and the classified numerical values of the same type are regarded as a data set corresponding to each depth information.
5. The non-contact power calculation method for overhead lines based on random forest algorithm according to claim 1 is characterized in that: After parsing the topological information and converting it into numerical features, the model is built and trained.
6. The non-contact power calculation method for overhead lines based on random forest algorithm according to claim 1 is characterized in that: The step of pre-processing the current data and inputting it into a pre-established model to obtain the power calculation result specifically includes: Calculate the RMS statistical index of the current data as one of the input features of the model; The current data and RMS statistical indicators are organized into a DataFrame, and the obtained data information constitutes a complete input feature set of the model; Preprocess the data in DataFrame, including missing value processing and standardization; When using the trained model to calculate power, the topology information is processed as follows: First, the comma-separated numeric strings in the Tuopu column are converted into numeric lists; then, the length of each list is calculated from the list to reflect the complexity of the topology; at the same time, the sum of the values in the list is calculated; Parse the topological information and convert it into numerical features before adding it to the DataFrame; Input the DataFrame into the pre-trained model and output the power calculation results.
7. The non-contact power calculation method for overhead lines based on random forest algorithm according to claim 6 is characterized in that: The algorithm flow of the regression model construction is: S4.1 obtain a sample data set of labeled electricity; S4.2 Sample data normalization; S4.3 randomly divides the sample data set into a training sample set and a test sample set; S4.4 uses the training sample set data to train the random forest model to obtain a trained random forest model; S4.5 uses the test sample set to verify the computational performance of the trained random forest model to complete the training of the model.
8. According to claim 7, the non-contact power calculation method for overhead lines based on random forest algorithm is characterized in that: The random forest model training described in S4.4 is combined with grid search and cross-validation strategies to establish the optimal model parameters of the cross-validation grid-optimized random forest prediction model.
9. The non-contact power calculation method for overhead lines based on random forest algorithm according to claim 8 is characterized in that: The algorithm flow of the cross-validation grid is: S4.4.1 Set initial parameters; S4.4.2 Establish a grid of hyperparameter combinations; S4.4.3 5-fold cross validation; S4.4.4 Using the coefficient of determination R 2 Evaluate regression model performance; S4.4.
5. Find the best model hyperparameter combination.
10. A contactless power calculation system for overhead lines based on random forest algorithm, characterized in that: include: An acquisition module, used to acquire the user's current data; An electric quantity calculation module is used to input the electric current data into a pre-established model after pre-processing to obtain an electric quantity calculation result; The steps of model training include: S1, obtaining basic data of the power grid; S2, data preprocessing; S3, processing topology information; S4, using a random forest regressor to build a regression model and perform training to obtain a pre-established model.
Citation Information
Patent Citations
Improved low-voltage transformer area line loss calculation method
CN111985524A
Series arc fault detection method based on random forest
CN113552447A
Short-term electric quantity load accurate prediction method based on random forest
CN115204446A
Method and device for calculating residual power supply capacity of active overhead distribution line and medium
CN117895483A
Detecting power disturbances based on networked power meters
US10393793B1
