Ammeter test method and device, and storage medium
By collecting user information and original power sequence signals of power users, performing hierarchical clustering, and generating test cases that are suitable for each power user group, it solves the problem of the laboratory environment and the actual operating environment in the existing power meter testing method. The deviation problem improves the consistency of meter performance and the simulation of test cases.
Patent Information
- Application Number
- CN202411491005.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-18
AI Technical Summary
The existing meter testing methods use fixed test cases in laboratory environments, resulting in deviations between the laboratory environment and the actual operating environment, resulting in poor consistency of meter performance and large fluctuations in performance.
By collecting user information and original power sequence signals of power users, constructing reference power sequence signals and target power sequence signals, performing hierarchical clustering, generating test cases that are suitable for each power user group, and conducting electricity meter testing.
It improves the simulation of the meter in the actual operating environment, ensures the consistency of the meter performance, and reduces the deviation of the test cases.
Smart Images

Figure CN119474930A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric meter testing, and in particular to an electric meter testing method, equipment and storage medium. Background Art
[0002] In the process of the development of intelligent power grids, electricity meters are intelligent nodes for energy management. Through interconnection with the power grid, they can upload electricity consumption data to cloud servers in real time, so that energy management departments and electricity users can conduct remote monitoring and analysis, optimize energy allocation, and reasonably arrange electricity consumption plans to achieve energy conservation and emission reduction.
[0003] At present, electricity meters are tested in a laboratory environment using fixed test cases. However, each electricity user provides a different operating environment for the electricity meter, resulting in a certain deviation between the laboratory environment and the actual operating environment of the electricity meter. This makes the performance consistency of the electricity meter poor, and the performance is prone to large fluctuations in different operating environments. Summary of the invention
[0004] In view of this, the present invention provides a method, a device and a storage medium for testing an electric meter, so as to improve the consistency of the performance of the electric meter.
[0005] A first aspect of the present invention provides a method for testing an electric meter, comprising:
[0006] If a new electricity meter is to be put into use in a designated area, user information and original electricity usage sequence signals generated in each time period are collected from electricity users in the area;
[0007] splicing the original power consumption sequence signals into a reference power consumption sequence signal, and extracting original power consumption features from the original power consumption sequence signals;
[0008] Reducing the dimension of the reference power usage sequence signal into a first target power usage sequence signal and a second target power usage sequence signal; the dimension of the first target power usage sequence signal is lower than the dimension of the second target power usage sequence signal;
[0009] Clustering the electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption characteristics to obtain a plurality of first user clusters;
[0010] In each of the first user clusters, clustering the electricity users according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters;
[0011] In each of the second user clusters, a test power sequence signal is constructed according to the second target power sequence signal; the number of dimensions of the test power sequence signal is equal to the number of dimensions of the reference power sequence signal;
[0012] A test case adapted to the second user cluster is generated according to the test electricity sequence signal, and the test case is called to test the electricity meter to obtain a test report.
[0013] A second aspect of the present invention provides a test device for an electric meter, comprising:
[0014] An electricity user data collection module is used to collect user information and original electricity usage sequence signals generated in various time periods from electricity users in a designated area if a new electricity meter is to be put into use in the area;
[0015] An electricity user characteristic construction module, used for splicing each of the original electricity consumption sequence signals into a reference electricity consumption sequence signal, and extracting original electricity consumption characteristics from each of the original electricity consumption sequence signals;
[0016] A power sequence signal dimensionality reduction module, used to reduce the dimension of the reference power sequence signal into a first target power sequence signal and a second target power sequence signal; the dimension of the first target power sequence signal is lower than the dimension of the second target power sequence signal;
[0017] a first clustering module, configured to cluster the electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption characteristic to obtain a plurality of first user clusters;
[0018] a second clustering module, configured to cluster the electricity users in each of the first user clusters according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters;
[0019] A power usage sequence signal construction module, configured to construct a test power usage sequence signal in each of the second user clusters according to the second target power usage sequence signal; the number of dimensions of the test power usage sequence signal is equal to the number of dimensions of the reference power usage sequence signal;
[0020] The electric meter test module is used to generate a test case adapted to the second user cluster according to the test electricity sequence signal, call the test case to test the electric meter and obtain a test report.
[0021] A third aspect of the present invention provides an electronic device, the electronic device comprising:
[0022] at least one processor; and
[0023] a memory communicatively connected to the at least one processor; wherein,
[0024] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for testing the electric meter as described in the first aspect above.
[0025] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for testing an electric meter as described in the first aspect above is implemented.
[0026] A fifth aspect of the present invention provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the method for testing an electric meter as described in the first aspect above is implemented.
[0027] In this embodiment, if a new electricity meter is to be put into use in a designated area, user information and original electricity consumption sequence signals generated in each time period are collected from electricity users in the area; each original electricity consumption sequence signal is spliced into a reference electricity consumption sequence signal, and original electricity consumption characteristics are extracted from each original electricity consumption sequence signal; the reference electricity consumption sequence signal is reduced in dimension into a first target electricity consumption sequence signal and a second target electricity consumption sequence signal; the number of dimensions of the first target electricity consumption sequence signal is lower than the number of dimensions of the second target electricity consumption sequence signal; electricity users are clustered according to the first target electricity consumption sequence signal and the reference electricity consumption characteristics to obtain a plurality of first user clusters; in each first user cluster, electricity users are clustered according to the second target electricity consumption sequence signal and user information to obtain a plurality of second user clusters; in each second user cluster, a test electricity consumption sequence signal is constructed according to the second target electricity consumption sequence signal; the number of dimensions of the test electricity consumption sequence signal is equal to the number of dimensions of the reference electricity consumption sequence signal; a test case adapted to the second user cluster is generated according to the test electricity consumption sequence signal, and the test case is called to test the electricity meter and obtain a test report. This embodiment maintains a balance between computational complexity and accuracy through hierarchical clustering, improves clustering efficiency, and constructs appropriate test cases for each typical group of electricity users to test the electricity meter, which can improve the simulation of the actual operating environment of the electricity meter and ensure that the performance of the electricity meter remains consistent.
[0028] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1 This is a flow chart of a method for testing an electric meter provided in Embodiment 1 of the present invention.
[0031] Figure 2 It is a schematic diagram of a clustering process provided in the first embodiment of the present invention.
[0032] Figure 3 It is a structural diagram of a decoder provided in Embodiment 1 of the present invention.
[0033] Figure 4 It is a structural schematic diagram of an electric meter testing device provided in Embodiment 2 of the present invention.
[0034] Figure 5 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0037] Embodiment 1
[0038] See also Figure 1, shows a flow chart of a method for testing an electric meter provided by a first embodiment of the present invention, the method can be executed by a testing device for an electric meter, the testing device for an electric meter can be implemented in the form of hardware and / or software, and the testing device for an electric meter can be configured in an electronic device. Figure 1 As shown, the method includes:
[0039] Step 101: If a new electricity meter is to be installed in a designated area, user information and original electricity usage sequence signals generated in each time period are collected from electricity users in the area.
[0040] According to the installation and update plan of the electricity meter, a new electricity meter is put into operation in a designated area. At this time, during the production stage of the electricity meter, the electricity meter can be connected to the test platform and various tests can be performed on the electricity meter, such as functional test, performance test, safety test, etc.
[0041] The test data includes the user information of the electricity users in the area, as well as a series of electricity usage signals (i.e., original electricity usage sequence signals) generated by the electricity usage behavior of the electricity users in the area in various time periods. The users' electricity usage behavior has a high correlation with the time period, thus generating corresponding electricity usage patterns. For example, the use of electric fans, air conditioners, freezers and other electrical appliances is increased in summer, and the use of water heaters, electric heaters and other electrical appliances is increased in winter.
[0042] In this embodiment, user information and original power consumption sequence signals generated in various time periods can be collected from power users in the region through the user management system of the power grid and interaction with electricity meters. The original power consumption sequence signal is a sequence composed of the power consumption of the power users.
[0043] The time period is usually a long period of time that characterizes the periodic changes in electricity consumption of electricity users, such as seasons (such as spring, summer, autumn, winter, etc.).
[0044] Generally speaking, the conversion of each time period is different in different regions. Therefore, the start date and end date of each time period can be set according to the actual situation of different regions, and the original electricity consumption sequence signals generated within the start date and end date can be collected from electricity users in the corresponding region.
[0045] Step 102: splice the original power consumption sequence signals into a reference power consumption sequence signal, and extract original power consumption features from the original power consumption sequence signals.
[0046] In this embodiment, the original power usage sequence signals may be connected in sequence to form a new power usage signal, which is recorded as a reference power usage sequence signal.
[0047] For each original electricity consumption sequence signal, statistically significant features can be extracted from each original electricity consumption sequence signal and recorded as original electricity consumption features, such as total electricity consumption, (hourly / daily / weekly) average electricity consumption, fluctuation range of electricity consumption (i.e., the range consisting of the upper limit and lower limit of electricity consumption), peak value of electricity consumption, trough value of electricity consumption, cycle of electricity consumption, standard deviation of electricity consumption, total electricity bill, average electricity bill, and so on.
[0048] Step 103: Reduce the dimension of the reference power usage sequence signal into a first target power usage sequence signal and a second target power usage sequence signal.
[0049] In actual applications, when testing the electricity meter, the group characteristics of electricity users are abstracted by clustering them, so as to build highly simulated test cases and simulate the actual operating environment of the electricity meter as much as possible to ensure the consistency of the meter performance.
[0050] Since the dimensionality of the reference power consumption sequence signal is high, ranging from hundreds of thousands to millions, and there are certain differences in the behaviors of different electricity users, there are many noise signals in the reference power consumption sequence signal. If the reference power consumption sequence signal is directly used to cluster the electricity users, not only will the high dimensionality lead to high resource consumption and long time consumption, but the clustering accuracy will also be reduced due to the large number of noise signals.
[0051] In this embodiment, a dimensionality reduction algorithm such as PCA (Principal Component Analysis) can be used to perform two dimensionality reduction operations on the reference power usage sequence signal. While retaining the valid information of the reference power usage sequence signal as much as possible, the features with duplicate information in the reference power usage sequence signal are merged and the features with invalid information are deleted. One dimensionality reduction operation reduces the reference power usage sequence signal to a first target power usage sequence signal, and the other dimensionality reduction operation reduces the reference power usage sequence signal to a second target power usage sequence signal.
[0052] The dimension number of the first target power usage sequence signal is lower than the dimension number of the second target power usage sequence signal.
[0053] Generally, the number of dimensions of the first target power usage sequence signal is maintained between tens and hundreds, and the number of dimensions of the second target power usage sequence signal is maintained between hundreds and thousands. This can reduce resource consumption and time consumption, and improve clustering accuracy.
[0054] Step 104 : Clustering electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption characteristics to obtain a plurality of first user clusters.
[0055] In practical applications, the first target power consumption sequence signal has a low dimensionality. Although it improves the efficiency of clustering electricity users, it also means that the first target power consumption sequence signal has less information. When the first target power consumption sequence signal is used alone to cluster electricity users, the probability of overfitting increases, which causes a certain deviation in the clustering of electricity users. Therefore, Figure 2 As shown, electricity users can be clustered based on the first target electricity consumption sequence signal as a main component and the reference electricity consumption characteristics as a supplement, to obtain multiple first user clusters.
[0056] Compared with the dimensionality of the first target electricity consumption sequence signal, the dimensionality of the reference electricity consumption feature is low (usually in the single digit). In the process of clustering electricity users, adding the reference electricity consumption feature has basically no effect on resource consumption and time consumption. By adding a small amount of information, the process of clustering electricity users can be constrained and corrected, effectively reducing overfitting and ensuring the accuracy of clustering electricity users.
[0057] In one embodiment of the present invention, step 104 may include the following steps:
[0058] Step 1041: For each electricity user, the total electricity consumption, the average electricity consumption and the fluctuation range of electricity consumption are spliced after the first target electricity consumption sequence signal to obtain a first electricity consumption vector.
[0059] In this embodiment, the original electricity consumption characteristics include total electricity consumption, average electricity consumption, fluctuation range of electricity consumption, standard deviation of electricity consumption and total electricity bill. Among them, total electricity consumption, average electricity consumption and fluctuation range of electricity consumption can directly reflect the characteristics of electricity consumption behavior of electricity users, and thus can be used as clustering features to participate in the direct clustering process. The standard deviation of electricity consumption and total electricity bill can reflect the fluctuation of electricity consumption of electricity users, and thus can be used as clustering indicators to participate in the evaluation of clustering operations.
[0060] For each electricity user, the total electricity consumption, average electricity consumption and fluctuation range of electricity consumption are spliced after the first target electricity consumption sequence signal to obtain a new sequence, and a vectorization operation is performed on the new sequence to obtain a first electricity consumption vector.
[0061] Furthermore, the original power consumption sequence signal of each time period has a set of original power consumption characteristics, and the total power consumption, average power consumption and power consumption fluctuation range in each set of original power consumption characteristics are spliced into a first array in sequence, and each first array is spliced into a second array in sequence, and the second array is spliced after the first target power consumption sequence signal to obtain a new sequence.
[0062] Step 1042: Initialize multiple first user clusters.
[0063] In the initial stage of clustering electricity users, a plurality of first user clusters may be initialized, wherein each first user cluster has a first center point, and the number of dimensions of the first center point is the same as the number of dimensions of the first electricity consumption vector.
[0064] Furthermore, the number of the first user clusters may be determined using methods such as the Elbow Method, Silhouette Score Method, and Calinski Harabasz Method, and the first center point may be determined by a random method or the like.
[0065] Step 1043: Calculate the first distance between the first power consumption vector of each power user and each first center point.
[0066] In practical applications, electricity users can be clustered through multiple rounds of iterations.
[0067] In each round of iteration, on the one hand, each electricity user is traversed, and on the other hand, each first user cluster is traversed, and the first distance, such as Euclidean distance, cosine distance, etc., is calculated between the first electricity consumption vector of each electricity user and the first center point of each first user cluster.
[0068] Step 1044: Divide the electricity users into a first user cluster with the smallest first distance.
[0069] In each round of iteration, each electricity user can be traversed, and for the current electricity user, the first electricity consumption vector of the current electricity user is compared with the first distance between the first center points of each first user cluster, and the first distance with the smallest value is selected, and the current electricity user is divided into the first user cluster with the smallest first distance.
[0070] Step 1045: In each first user cluster, assign an average value of the first power consumption vectors of all power users to the first center point.
[0071] In each round of iteration, if all electricity users are re-divided into corresponding first user clusters, each first user cluster can be traversed, the average value between the first electricity consumption vectors of all electricity users in the current first user cluster can be calculated, and the average value between the first electricity consumption vectors of all electricity users in the current first user cluster can be assigned to the first center point in the current first user cluster, and the first center point in the current first user cluster is kept as the center of mass of all electricity users in the current first user cluster.
[0072] Step 1046: Calculate a first clustering index value according to the first center point of each first user cluster, the standard deviation of electricity consumption, and the total electricity cost.
[0073] In each round of iteration, the first clustering index value may be calculated by comprehensively considering the first center point of each first user cluster, the standard deviation of power consumption and the total electricity charge. The first clustering index value may be used to evaluate the effect of clustering electricity users.
[0074] Since most electricity users use a tiered electricity billing model, the electricity bill is not directly proportional to the electricity consumption, and there is a certain difference between the two. Therefore, it is possible to consider measuring the fluctuations of electricity consumption of electricity users from two perspectives: total electricity bill and standard deviation of electricity consumption.
[0075] In a specific implementation, for each electricity user, the difference between the first electricity consumption vector and the first center point is squared to obtain a benchmark index value.
[0076] The standard deviation of electricity consumption and total electricity cost are integrated into indicator weights using a linear or nonlinear method.
[0077] Exemplarily, for the same original power consumption sequence signal, the product between the standard deviation of power consumption and the preset first parameter weight, and the product between the total electricity cost and the preset second parameter weight are added to obtain the cycle weight; for the reference power consumption sequence signal, all cycle weights are added to obtain the index weight.
[0078] For each electricity user, the product of the benchmark index value and the index weight is calculated to obtain the weighted index value.
[0079] For each first user cluster, the sum of the weight adjustment index values of each electricity user is calculated to obtain a cluster index value.
[0080] The sum of the cluster index values of the first user clusters is calculated to obtain a first clustering index value.
[0081] Then, the first clustering index value can be expressed as:
[0082]
[0083] Where k∈K, K is the number of the first user cluster, i∈I, I is the number of electricity users in the first user cluster, j∈J, J is the number of time periods, H 1 is the first clustering index value, σ is the standard deviation of electricity consumption, Charge is the total electricity charge, w 1 is the first parameter weight, w 2 is the second parameter weight, User is the first electricity consumption vector of the electricity user, and Center is the first center point.
[0084] Step 1047 , determine whether the first clustering index value meets the preset first clustering condition; if so, execute step 1048 ; if not, return to execute step 1043 .
[0085] Step 1048: Determine a plurality of first user clusters to complete clustering.
[0086] In each round of iteration, whether the first clustering index value meets the preset first clustering condition can be used to determine whether the first clustering index value converges. For example, the first clustering index value is less than a preset threshold, the change value of the first clustering index value in multiple consecutive rounds of iterations is less than the preset threshold, and so on.
[0087] If the first clustering index value satisfies the first clustering condition, it can be determined that the clustering of the electricity users is completed, and a plurality of first user clusters and the electricity users contained therein are output.
[0088] If the first clustering index value does not meet the first clustering condition, the process may return to step 1043 to step 1047 to enter the next round of iteration until the electricity users are clustered.
[0089] Step 105 : In each first user cluster, cluster the electricity users according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters.
[0090] like Figure 2 As shown, in each first user cluster, attention can be shifted from the electricity consumption behavior of the electricity user itself to the electricity user itself, and the electricity users in the first user cluster are clustered based on the second target electricity consumption sequence signal as the main part and the user information as the auxiliary part, so as to obtain multiple second user clusters, so that the user information of the electricity users in the second user cluster is similar, which is convenient for providing special tests based on electricity users with similar user information and improving the efficiency of the test, for example, anti-electricity theft test, lithium battery charging sensitivity test, group peak impact test, etc.
[0091] Among them, multiple threads can be started in the thread pool, the number of threads is equal to the number of first user clusters, each first user cluster is assigned to each thread, each thread is responsible for clustering the electricity users in the corresponding first user cluster, realizing concurrent clustering, thereby improving the clustering speed.
[0092] Furthermore, the first target electricity consumption sequence signal with a lower dimensionality is used to perform the initial clustering of electricity users, and the second target electricity consumption sequence signal with a higher dimensionality is used to perform the secondary clustering of electricity users, thereby realizing a hierarchical clustering architecture. The initial clustering is oriented towards global electricity users, and the dimension of the features is lower. The clustering accuracy can meet the business requirements and effectively reduce the amount of clustering calculation. The secondary clustering is oriented towards local electricity users, and the dimension of the features is higher. The amount of clustering calculation can be controlled and the clustering accuracy can be effectively improved. On the whole, the balance between the amount of calculation and the accuracy is maintained, thereby improving the efficiency of clustering.
[0093] In one embodiment of the present invention, step 105 may include the following steps:
[0094] Step 1051: For each electricity user, the user category and risk level are concatenated after the second target electricity consumption sequence signal to obtain a second electricity consumption vector.
[0095] In this embodiment, the user information includes the user category and risk level set for the electricity user according to the business requirements, wherein the user category of the electricity user may include large family users, small family users, suspected rental users, suspected commercial users, etc., and the risk level of the electricity user may include low-risk users, medium-risk users (such as charging lithium batteries), high-risk users (such as those who steal electricity), and the like.
[0096] The user category of the electricity user and the risk level of the electricity user can both be expressed in numerical values, wherein the numerical value of the risk level of the electricity user is positively correlated with the business risk of the electricity user, that is, the higher the numerical value of the risk level of the electricity user, the higher the business risk of the electricity user, and conversely, the lower the numerical value of the risk level of the electricity user, the lower the business risk of the electricity user.
[0097] Generally speaking, the business end of the power grid can classify electricity users, detect risky behaviors, and monitor them based on their electricity usage behavior data, and mark the user categories and risk levels of electricity users based on the monitoring results.
[0098] For each electricity user, its user category and risk level are spliced after the second target electricity consumption sequence signal to obtain a new sequence, and a vectorization operation is performed on the new sequence to obtain a second electricity consumption vector.
[0099] Step 1052: In the first user cluster, initialize multiple second user clusters according to risk levels and the number of electricity users.
[0100] In the initial stage of clustering electricity users in the first user cluster, multiple second user clusters can be initialized according to factors such as risk level and the number of electricity users, wherein each second user cluster has a second center point, which can be determined by random methods, etc., and the number of dimensions of the second center point is the same as the number of dimensions of the second electricity consumption vector.
[0101] Among them, factors such as risk level and the number of electricity users are mainly related to the number of second user clusters, and play a role in constraining the number of second user clusters, thereby controlling the amount of clustering calculations.
[0102] Then, the number of second user clusters in each first user cluster may be the same or different, and this embodiment does not impose a limitation on this.
[0103] In a specific implementation, in each first user cluster, the square root (i.e., the second root) of the ratio between the number of electricity users and the preset adjustment coefficient is taken to obtain a benchmark number. At this time, the benchmark number is nonlinearly related to the number of electricity users. While maintaining typicality when clustering electricity users, the number of second clusters is reduced to control the amount of calculation.
[0104] In each first user cluster, the risk levels of the electricity users are averaged to obtain an average risk value.
[0105] If the average risk value is greater than or equal to the preset risk threshold, that is, the risk value of the reputation is high, the average risk value can be mapped to the step length by using a table lookup or other method; wherein the step length is positively correlated with the average risk value, that is, the higher the average risk value, the larger the step length, and vice versa, the lower the average risk value, the smaller the step length.
[0106] The sum of the reference number and the step length is rounded up to obtain the number of clusters. In this way, if the overall risk of electricity users in the first user cluster is high, a second user cluster with a larger number can be clustered in the first user cluster to provide a more refined test and ensure the effect of the test.
[0107] If the average risk value is less than the preset risk threshold, that is, the reputation risk value is low, the benchmark number can be rounded down to get the number of clusters. In this way, if the overall risk of electricity users in the first user cluster is low, the number of second user clusters can be locally converged in the first user cluster, and the number margin of the second user cluster can be reserved for the first user cluster with higher risk, and the number of second user clusters can be fine-tuned in different first user clusters to constrain the number of second user clusters, thereby controlling the amount of clustering calculations.
[0108] Then, in a given first user cluster, the number of clusters can be expressed as:
[0109] When Risk ≥ Th, Num cluster =Ceiling(sqrt(Num user / τ)+f(Risk));
[0110] When Risk<Th, Num cluster =Floor(sqrt(Num user / τ).
[0111] Among them, Risk is the average risk value, Th is the risk threshold, Num cluster is the number of clusters, Num user is the number of electricity users, τ is the adjustment coefficient, Ceiling is rounding up, Floor is rounding down, sqrt is square root, and f is the function that maps the average risk value to the step size.
[0112] In each first user cluster, the second user cluster may be initialized according to the corresponding cluster number, that is, the number of the second user clusters is the cluster number.
[0113] Step 1053: In the first user cluster, calculate the second distance between the second power consumption vector of each power user and each second center point.
[0114] In practical applications, electricity users can be clustered in the first user cluster through multiple rounds of iterations.
[0115] In each round of iteration, on the one hand, each electricity user is traversed, and on the other hand, each second user cluster is traversed, and a second distance, such as Euclidean distance, cosine distance, etc., is calculated between the second electricity consumption vector of each electricity user and the first center point of each second user cluster.
[0116] Step 1054: In the first user cluster, divide the electricity users into a second user cluster with the smallest second distance.
[0117] In each round of iteration, each electricity user in the first user cluster can be traversed, and for the current electricity user, the second electricity consumption vector of the current electricity user is compared with the second distances between the second center points of each second user cluster, and the second distance with the smallest value is selected, and the current electricity user is divided into the second user cluster with the smallest second distance.
[0118] Step 1055: In each second user cluster of the first user cluster, assign an average value of the second power consumption vectors of all power users to the second center point.
[0119] In each round of iteration, if all electricity users in the first user cluster are re-divided into corresponding second user clusters, each second user cluster can be traversed, the average value between the second electricity consumption vectors of all electricity users in the current second user cluster can be calculated, and the average value between the second electricity consumption vectors of all electricity users in the current second user cluster can be assigned to the second center point in the current second user cluster, and the second center point in the current second user cluster can be kept as the center of mass of all electricity users in the current second user cluster.
[0120] Step 1056: In the first user cluster, calculate a second clustering index value according to the second center point of each second user cluster.
[0121] In each round of iteration, the second clustering index value can be calculated based on the second center point of each second user cluster in the first user cluster. The second clustering index value can be used to evaluate the effect of clustering electricity users, for example, mean cross entropy (Mean Squared Error, MSE), mean entropy (Normalized Mutual Information, NM), adjusted Rand index (Adjusted Rand Index, ARI), sum of squared errors (Sum of Squared Errors, SSE), and the like.
[0122] Step 1057 , in the first user cluster, determine whether the second clustering index value meets the preset second clustering condition; if so, execute step 1058 ; if not, return to execute step 1053 .
[0123] Step 1058: Determine that multiple second user clusters in the first user cluster complete clustering.
[0124] In each round of iteration, whether the second clustering index value meets the preset second clustering condition can be used to determine whether the second clustering index value converges. For example, the second clustering index value is less than a preset threshold, the change value of the second clustering index value in multiple consecutive rounds of iterations is less than the preset threshold, and so on.
[0125] If the second clustering index value satisfies the second clustering condition, it can be determined that the clustering of the electricity users is completed, and a plurality of second user clusters in the first user cluster and the electricity users contained therein are output.
[0126] If the second clustering index value does not meet the second clustering condition, the process may return to step 1053 to step 1057 to enter the next round of iteration until the electricity users are clustered.
[0127] Step 106: In each second user cluster, construct a test power usage sequence signal according to the second target power usage sequence signal.
[0128] In each second user cluster, machine learning or deep learning can be used to perform a dimensionality increase operation based on the second target power usage sequence signal to construct a test power usage sequence signal, wherein the number of dimensions of the test power usage sequence signal is equal to the number of dimensions of the reference power usage sequence signal.
[0129] The test power consumption sequence signal is a simulated power consumption sequence signal, which maintains the main power consumption behavior characteristics of the power users in the second user cluster and removes the interference of noise.
[0130] In one embodiment of the present invention, step 106 may include the following steps:
[0131] Step 1061: In each second user cluster, an average value of multiple second target power usage sequence signals with the smallest second distance is calculated to obtain a characteristic power usage sequence signal.
[0132] In this embodiment, the second distance of the second power consumption vector to which each second target power consumption sequence signal belongs can be queried in each second user cluster, and multiple second target power consumption sequence signals with the smallest second distance can be screened out. The average value of the multiple second target power consumption sequence signals with the smallest second distance can be calculated to obtain a characteristic power consumption sequence signal.
[0133] Among them, the plurality of second target power sequence signals with the smallest second distance may be N (N is a positive integer) second target power sequence signals with the smallest second distance, or may be M% (M is a positive number) second target power sequence signals with the smallest second distance.
[0134] The characteristic power usage sequence signal can characterize the center of gravity of the second user cluster to a certain extent. Compared with the second center point, the characteristic power usage sequence signal can increase the typicality to a certain extent, which is conducive to designing test cases with higher adaptability.
[0135] Step 1062: Determine an encoder and a decoder trained in a self-supervised manner based on the sample power usage sequence signal.
[0136] In this embodiment, an encoder and a decoder may be constructed based on a Seq2Seq (Sequence-to-sequence) architecture in deep learning, and the encoder and the decoder may be trained in a self-supervised manner according to a sample power sequence signal.
[0137] Self-supervision means that the sample power consumption sequence signal serves as both a training sample and a training supervision. At this time, the encoder is used to encode the sample power consumption sequence signal into an intermediate power consumption sequence signal, and the decoder is used to decode the intermediate power consumption sequence signal into a predicted power consumption sequence signal that tends to the reference power consumption sequence signal.
[0138] The so-called trend means that the predicted power consumption sequence signal is as similar as possible to the reference power consumption sequence signal.
[0139] Among them, the number of dimensions of the sample power usage sequence signal and the number of dimensions of the predicted power usage sequence signal are equal to the number of dimensions of the reference power usage sequence signal, and the number of dimensions of the intermediate power usage sequence signal is equal to the number of dimensions of the second target power usage sequence signal.
[0140] When training the encoder and decoder, you can use MAE (Mean Absolute Error), RAE (Relative Absolute Error), MAPE (Mean Absolute Percentage Error) and other functions as loss functions.
[0141] When the training of the encoder Encoder and the decoder Decoder is completed, the encoder Encoder is discarded and the decoder Decoder is retained.
[0142] It should be pointed out that the structures of the encoder Encoder and the decoder Decoder are not limited to artificially designed neural networks, such as U-Net (U-type network), HRNet (High Resolution Network), etc., and can also be neural networks optimized by model quantization methods, neural networks searched for electricity consumption characteristics of electricity users by NAS (Neural Architecture Search) methods, etc. This embodiment does not impose any restrictions on this.
[0143] Step 1063: Input the characteristic power sequence signal into a decoder and decode it into a test power sequence signal.
[0144] In this embodiment, the characteristic power sequence signal is input into a decoder to perform a decoding operation to obtain a test power sequence signal.
[0145] For example, many Seq2Seq architectures use Skip Connection to pass detailed information from the bottom layer to the upper layer, retaining more details, improving gradient propagation, and alleviating gradient vanishing. When the decoder is disassembled separately, the Skip Connection will be destroyed, resulting in performance degradation of the decoder. Therefore, in this example, a decoder that is independent of the encoder can be provided.
[0146] The so-called independence means that there is no SkipConnection between the encoder Encoder and the decoder Decoder.
[0147] like Figure 3As shown, the decoder Decoder includes a first convolutional layer ConV1, a second convolutional layer ConV2, a third convolutional layer ConV3, a first long short-term memory network LSTM1, a second long short-term memory network LSTM2 and a fully connected layer (Fully Connected Layer, FC).
[0148] Optionally, the structure of the encoder Encoder and the structure of the decoder Decoder are symmetrical.
[0149] Among them, the first convolutional layer ConV1, the second convolutional layer ConV2 and the third convolutional layer ConV3 are all convolutional layers (Convolutional Layer), which can provide convolution operations, normalization operations, activation operations and other operations, such as BN (BatchNormlization, batch normalization), ReLU (Rectified Linear Unit, linear rectification function), etc., to extract features.
[0150] The first long short-term memory network LSTM1 and the second long short-term memory network LSTM2 are both long short-term memory networks (LSTM), which can be used to process and predict events with long intervals and delays in time series.
[0151] In the fully connected layer, each node is connected to all nodes in the previous layer to integrate the features extracted previously.
[0152] In this example, it can be divided into the following three stages:
[0153] 1. Stage 1
[0154] The characteristic power usage sequence signal is input into the first convolutional layer ConV1 for processing to obtain the first power usage signal feature.
[0155] The first power usage signal feature is input into the first long short-term memory network LSTM1 for processing to obtain the second power usage signal feature.
[0156] The second power usage signal feature is upsampled to obtain a third power usage signal feature.
[0157] 2. Stage 2
[0158] The third power usage signal feature is input into the second convolutional layer ConV2 for processing to obtain a fourth power usage signal feature.
[0159] The fourth power usage signal feature is input into the second long short-term memory network LSTM2 for processing to obtain the fifth power usage signal feature.
[0160] The fifth power usage signal feature is upsampled to obtain a sixth power usage signal feature.
[0161] 3. Stage 3
[0162] The sixth electrical usage signal feature is input into the third convolutional layer ConV3 for processing to obtain the seventh electrical usage signal feature.
[0163] The seventh power consumption signal feature is input into the fully connected layer FC and mapped into a test power consumption sequence signal.
[0164] In this example, the structure of the decoder is simple, which effectively reduces the amount of calculation while ensuring the accuracy of the test power sequence signal. In addition, the structure of Stage 1 and Stage 2 can be abstracted into the concept of module, which is easy to replace and find the optimal solution.
[0165] Of course, the above decoder is only used as an example. When implementing this embodiment, other decoders can be set according to actual conditions, and this embodiment does not limit this. In addition, in addition to the above decoder, those skilled in the art can also use other decoders according to actual needs, and this embodiment does not limit this.
[0166] Step 107: Generate a test case adapted to the second user cluster according to the test power usage sequence signal, call the test case to test the electric meter, and obtain a test report.
[0167] In this embodiment, if Figure 2 As shown, a variety of different test cases can be pre-configured for the electric meter, and appropriate test cases can be selected according to the business nature of the second user cluster. The test power sequence signal is written into the test case to obtain a test case adapted to the second user cluster, so that the test case can be used to drive the corresponding simulation equipment, provide an electrical signal to the electric meter according to the test power sequence signal, test the electric meter according to the business requirements, and obtain a corresponding test report.
[0168] The test platform provides test case management capabilities with real-time insights and customization options, suitable for meter testing of all sizes. The test platform is a comprehensive test management tool that provides test planning, execution, real-time dashboards and report generation, and integrates with tools such as Jira and GitHub. By centrally managing test cases and test results, the test planning and execution process is simplified.
[0169] In this embodiment, if a new electricity meter is to be put into use in a designated area, user information and original electricity consumption sequence signals generated in each time period are collected from electricity users in the area; each original electricity consumption sequence signal is spliced into a reference electricity consumption sequence signal, and original electricity consumption characteristics are extracted from each original electricity consumption sequence signal; the reference electricity consumption sequence signal is reduced in dimension into a first target electricity consumption sequence signal and a second target electricity consumption sequence signal; the number of dimensions of the first target electricity consumption sequence signal is lower than the number of dimensions of the second target electricity consumption sequence signal; electricity users are clustered according to the first target electricity consumption sequence signal and the reference electricity consumption characteristics to obtain a plurality of first user clusters; in each first user cluster, electricity users are clustered according to the second target electricity consumption sequence signal and user information to obtain a plurality of second user clusters; in each second user cluster, a test electricity consumption sequence signal is constructed according to the second target electricity consumption sequence signal; the number of dimensions of the test electricity consumption sequence signal is equal to the number of dimensions of the reference electricity consumption sequence signal; a test case adapted to the second user cluster is generated according to the test electricity consumption sequence signal, and the test case is called to test the electricity meter and obtain a test report. This embodiment maintains a balance between computational complexity and accuracy through hierarchical clustering, improves clustering efficiency, and constructs appropriate test cases for each typical group of electricity users to test the electricity meter, which can improve the simulation of the actual operating environment of the electricity meter and ensure that the performance of the electricity meter remains consistent.
[0170] Embodiment 2
[0171] See also Figure 4 , shows a schematic diagram of the structure of a test device for an electric meter provided in Embodiment 2 of the present invention. Figure 4 As shown, the device comprises:
[0172] The electricity user data collection module 401 is used to collect user information and original electricity usage sequence signals generated in each time period from electricity users in the specified area if a new electricity meter is to be put into use in the specified area;
[0173] The power user characteristic construction module 402 is used to splice each of the original power consumption sequence signals into a reference power consumption sequence signal, and extract the original power consumption characteristics from each of the original power consumption sequence signals;
[0174] The power sequence signal dimension reduction module 403 is used to reduce the dimension of the reference power sequence signal into a first target power sequence signal and a second target power sequence signal; the dimension of the first target power sequence signal is lower than the dimension of the second target power sequence signal;
[0175] A first clustering module 404 is used to cluster the electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption feature to obtain a plurality of first user clusters;
[0176] A second clustering module 405 is used to cluster the electricity users in each of the first user clusters according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters;
[0177] A power usage sequence signal construction module 406 is used to construct a test power usage sequence signal in each of the second user clusters according to the second target power usage sequence signal; the number of dimensions of the test power usage sequence signal is equal to the number of dimensions of the reference power usage sequence signal;
[0178] The electric meter test module 407 is used to generate a test case adapted to the second user cluster according to the test electricity sequence signal, call the test case to test the electric meter and obtain a test report.
[0179] In one embodiment of the present invention, the original power consumption characteristics include total power consumption, average power consumption, fluctuation range of power consumption, standard deviation of power consumption and total electricity charges;
[0180] The first clustering module 404 includes:
[0181] a first power consumption vector construction module, configured to, for each of the power users, concatenate the total power consumption, the average power consumption and the power consumption fluctuation range after the first target power consumption sequence signal to obtain a first power consumption vector;
[0182] A first user cluster initialization module, used to initialize multiple first user clusters; each of the first user clusters has a first center point;
[0183] A first distance calculation module, used for calculating a first distance between the first power consumption vector of each of the power users and each of the first center points;
[0184] A first user cluster division module, used for dividing the electricity users into the first user cluster with the smallest first distance;
[0185] A first central point updating module, configured to assign, in each of the first user clusters, an average value of the first power consumption vectors of all the power users to the first central point;
[0186] a first clustering index value calculation module, configured to calculate a first clustering index value according to the first center point of each of the first user clusters, the standard deviation of the power consumption, and the total electricity fee;
[0187] A first clustering condition judgment module, used to judge whether the first clustering index value meets the preset first clustering condition; if so, execute the first clustering determination module; if not, return to execute the first distance calculation module;
[0188] The first cluster determination module is used to determine a plurality of the first user clusters to complete clustering.
[0189] In one embodiment of the present invention, the first clustering index value calculation module includes:
[0190] a benchmark index value calculation module, configured to obtain a benchmark index value by squaring the difference between the first power consumption vector and the first center point for each of the power users;
[0191] An indicator weight fusion module, used to fuse the standard deviation of the power consumption and the total electricity fee into an indicator weight;
[0192] A weight adjustment index value calculation module, used for calculating the product between the benchmark index value and the index weight for each of the electricity users to obtain a weight adjustment index value;
[0193] A cluster index value calculation module, used for calculating the sum of the weight adjustment index values of each of the electricity users for each of the first user clusters to obtain a cluster index value;
[0194] The index summing module is used to calculate the sum of the cluster index values of each of the first user clusters to obtain a first clustering index value.
[0195] In one embodiment of the present invention, the indicator weight fusion module is further used for:
[0196] For the same original power consumption sequence signal, add the product between the standard deviation of the power consumption and the preset first parameter weight, and the product between the total electricity fee and the preset second parameter weight to obtain a cycle weight;
[0197] For the reference power consumption sequence signal, all the cycle weights are added together to obtain an index weight.
[0198] In one embodiment of the present invention, the user information includes user category and risk level;
[0199] The second clustering module 405 includes:
[0200] A second power consumption vector construction module is used for splicing the user category and the risk level after the second target power consumption sequence signal for each of the power users to obtain a second power consumption vector;
[0201] A second user cluster initialization module, used to initialize multiple second user clusters in the first user cluster according to the risk level and the number of the electricity users; each of the second user clusters has a second center point;
[0202] A second distance calculation module, configured to calculate, in the first user cluster, a second distance between the second power consumption vector of each of the power users and each of the second center points;
[0203] A second user cluster division module, configured to divide the electricity users into the second user cluster with the smallest second distance in the first user cluster;
[0204] A second central point updating module, configured to assign an average value of the second power consumption vectors of all the power users in each of the second user clusters of the first user cluster to the second central point;
[0205] a second clustering index value calculation module, configured to calculate a second clustering index value in the first user cluster according to the second center point of each of the second user clusters;
[0206] A second clustering condition judgment module, used to judge whether the second clustering index value meets the preset second clustering condition in the first user cluster; if so, execute the second clustering determination module; if not, return to execute the second distance calculation module;
[0207] The second cluster determination module is used to determine a plurality of the second user clusters in the first user cluster to complete clustering.
[0208] In one embodiment of the present invention, the second user cluster initialization module is further used for:
[0209] In the first user cluster, taking the square root of the ratio between the number of the electricity users and the preset adjustment coefficient to obtain a reference number;
[0210] In the first user cluster, averaging the risk levels to obtain an average risk value;
[0211] If the average risk value is greater than or equal to a preset risk threshold, the average risk value is mapped to a step length; the step length is positively correlated with the average risk value;
[0212] Rounding up the sum of the benchmark number and the step size to obtain the number of clusters;
[0213] If the average risk value is less than a preset risk threshold, the benchmark number is rounded down to obtain the cluster number;
[0214] Initialize the second user cluster according to the cluster number.
[0215] In one embodiment of the present invention, the power sequence signal building module 406 includes:
[0216] a characteristic power usage sequence signal calculation module, configured to calculate an average value of a plurality of second target power usage sequence signals with the smallest second distance in each second user cluster to obtain a characteristic power usage sequence signal;
[0217] An architecture determination module is used to determine an encoder and a decoder trained in a self-supervised manner based on a sample power usage sequence signal; the encoder is used to encode the sample power usage sequence signal into an intermediate power usage sequence signal, and the decoder is used to decode the intermediate power usage sequence signal into a predicted power usage sequence signal tending to the reference power usage sequence signal; the number of dimensions of the sample power usage sequence signal and the number of dimensions of the predicted power usage sequence signal are both equal to the number of dimensions of the reference power usage sequence signal, and the number of dimensions of the intermediate power usage sequence signal is equal to the number of dimensions of the second target power usage sequence signal;
[0218] The characteristic power sequence signal decoding module is used to input the characteristic power sequence signal into the decoder to decode it into a test power sequence signal.
[0219] In one embodiment of the present invention, the decoder includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a first long short-term memory network, a second long short-term memory network and a fully connected layer;
[0220] The characteristic power sequence signal decoding module is also used for:
[0221] Inputting the characteristic power usage sequence signal into the first convolutional layer for processing to obtain a first power usage signal feature;
[0222] Inputting the first power usage signal feature into the first long short-term memory network for processing to obtain a second power usage signal feature;
[0223] Upsampling the second power usage signal feature to obtain a third power usage signal feature;
[0224] Inputting the third power usage signal feature into the second convolutional layer for processing to obtain a fourth power usage signal feature;
[0225] Inputting the fourth power usage signal feature into the second long short-term memory network for processing to obtain a fifth power usage signal feature;
[0226] Upsampling the fifth power usage signal feature to obtain a sixth power usage signal feature;
[0227] Inputting the sixth power usage signal feature into the third convolutional layer for processing to obtain a seventh power usage signal feature;
[0228] The seventh power signal feature is input into the fully connected layer and mapped into a test power sequence signal.
[0229] The test device for an electric meter provided in the embodiment of the present invention can execute the test method for an electric meter provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the test method for an electric meter.
[0230] Embodiment 3
[0231] See also Figure 5 , shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0232] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0233] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0234] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the test method of the electric meter.
[0235] In some embodiments, the test method of the electric meter can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the test method of the electric meter described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the test method of the electric meter in any other appropriate manner (for example, by means of firmware).
[0236] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0237] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0238] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0239] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0240] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0241] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0242] Embodiment 4
[0243] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements the method for testing an electric meter provided in any embodiment of the present invention.
[0244] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate 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 can 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 can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0245] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0246] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for testing an electric meter, characterized in that: include: If a new electricity meter is to be put into use in a designated area, user information and original electricity usage sequence signals generated in each time period are collected from electricity users in the area; splicing the original power consumption sequence signals into a reference power consumption sequence signal, and extracting original power consumption features from the original power consumption sequence signals; Reducing the dimension of the reference power usage sequence signal into a first target power usage sequence signal and a second target power usage sequence signal; the dimension of the first target power usage sequence signal is lower than the dimension of the second target power usage sequence signal; Clustering the electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption characteristics to obtain a plurality of first user clusters; In each of the first user clusters, clustering the electricity users according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters; In each of the second user clusters, a test power sequence signal is constructed according to the second target power sequence signal; the number of dimensions of the test power sequence signal is equal to the number of dimensions of the reference power sequence signal; A test case adapted to the second user cluster is generated according to the test electricity sequence signal, and the test case is called to test the electricity meter to obtain a test report.
2. The method according to claim 1, characterized in that The original electricity consumption characteristics include total electricity consumption, average electricity consumption, fluctuation range of electricity consumption, standard deviation of electricity consumption and total electricity charges; The clustering of the electricity users according to the first target electricity consumption sequence signal and the reference electricity consumption feature to obtain a plurality of first user clusters includes: For each of the electricity users, the total electricity consumption, the average electricity consumption and the fluctuation range of the electricity consumption are spliced after the first target electricity consumption sequence signal to obtain a first electricity consumption vector; Initializing a plurality of first user clusters; each of the first user clusters has a first center point; Calculating a first distance between the first power consumption vector of each of the power users and each of the first center points; dividing the electricity users into the first user cluster with the smallest first distance; In each of the first user clusters, assigning an average value of the first power consumption vectors of all the power users to the first center point; Calculating a first clustering index value according to the first center point of each of the first user clusters, the standard deviation of the power consumption, and the total electricity fee; Determine whether the first clustering index value meets the preset first clustering condition; if so, determine that the plurality of first user clusters have completed clustering; if not, return to execute the calculation of the first distance between the first power consumption vector of each of the power users and each of the first center points.
3. The method according to claim 2, characterized in that The calculating the first clustering index value according to the first center point of each of the first user clusters, the standard deviation of the power consumption and the total electricity fee includes: For each of the electricity users, square the difference between the first electricity consumption vector and the first center point to obtain a benchmark index value; The standard deviation of the electricity consumption and the total electricity fee are combined into an indicator weight; For each of the electricity users, calculating the product of the benchmark index value and the index weight to obtain a weight adjustment index value; For each of the first user clusters, calculating the sum of the weight adjustment index values of each of the electricity users to obtain a cluster index value; The sum of the cluster index values of the first user clusters is calculated to obtain a first clustering index value.
4. The method according to claim 3, characterized in that The step of integrating the standard deviation of the power consumption and the total electricity fee into an indicator weight includes: For the same original power consumption sequence signal, add the product between the standard deviation of the power consumption and the preset first parameter weight, and the product between the total electricity fee and the preset second parameter weight to obtain a cycle weight; For the reference power consumption sequence signal, all the cycle weights are added together to obtain an index weight.
5. The method according to claim 2, characterized in that: The user information includes user category and risk level; In each of the first user clusters, the electricity users are clustered according to the second target electricity usage sequence signal and the user information to obtain a plurality of second user clusters, including: For each of the electricity users, the user category and the risk level are concatenated after the second target electricity consumption sequence signal to obtain a second electricity consumption vector; In the first user cluster, a plurality of second user clusters are initialized according to the risk level and the number of the electricity users; each of the second user clusters has a second center point; In the first user cluster, calculating a second distance between the second power consumption vector of each of the power users and each of the second center points; In the first user cluster, the electricity user is divided into the second user cluster with the smallest second distance; In each of the second user clusters of the first user cluster, assigning an average value of the second power consumption vectors of all the power users to the second center point; In the first user cluster, calculating a second clustering index value according to the second center point of each of the second user clusters; In the first user cluster, determine whether the second clustering index value meets the preset second clustering condition; if so, determine that multiple second user clusters in the first user cluster have completed clustering; if not, return to execute the calculation of the second distance between the second power consumption vector of each of the power users and each of the second center points in the first user cluster.
6. The method according to claim 5, characterized in that Initializing a plurality of second user clusters in the first user cluster according to the risk level and the number of the electricity users includes: In the first user cluster, taking the square root of the ratio between the number of the electricity users and the preset adjustment coefficient to obtain a reference number; In the first user cluster, averaging the risk levels to obtain an average risk value; If the average risk value is greater than or equal to a preset risk threshold, the average risk value is mapped to a step length; the step length is positively correlated with the average risk value; Rounding up the sum of the benchmark number and the step size to obtain the number of clusters; If the average risk value is less than a preset risk threshold, the benchmark number is rounded down to obtain the cluster number; Initialize the second user cluster according to the cluster quantity.
7. The method according to claim 5, characterized in that The step of constructing a test power usage sequence signal in each of the second user clusters according to the second target power usage sequence signal includes: In each of the second user clusters, calculating an average value of a plurality of the second target power usage sequence signals with the smallest second distance to obtain a characteristic power usage sequence signal; Determine an encoder and a decoder to be trained using a self-supervised method based on a sample power usage sequence signal; the encoder is used to encode the sample power usage sequence signal into an intermediate power usage sequence signal, and the decoder is used to decode the intermediate power usage sequence signal into a predicted power usage sequence signal tending toward the reference power usage sequence signal; the number of dimensions of the sample power usage sequence signal and the number of dimensions of the predicted power usage sequence signal are both equal to the number of dimensions of the reference power usage sequence signal, and the number of dimensions of the intermediate power usage sequence signal is equal to the number of dimensions of the second target power usage sequence signal; The characteristic power sequence signal is input into the decoder and decoded into a test power sequence signal.
8. The method according to claim 7, characterized in that The decoder includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a first long short-term memory network, a second long short-term memory network and a fully connected layer; The step of inputting the characteristic power sequence signal into the decoder and decoding it into a test power sequence signal comprises: Inputting the characteristic power usage sequence signal into the first convolutional layer for processing to obtain a first power usage signal feature; Inputting the first power usage signal feature into the first long short-term memory network for processing to obtain a second power usage signal feature; Upsampling the second power usage signal feature to obtain a third power usage signal feature; Inputting the third power usage signal feature into the second convolutional layer for processing to obtain a fourth power usage signal feature; Inputting the fourth power usage signal feature into the second long short-term memory network for processing to obtain a fifth power usage signal feature; Upsampling the fifth power usage signal feature to obtain a sixth power usage signal feature; Inputting the sixth power usage signal feature into the third convolutional layer for processing to obtain a seventh power usage signal feature; The seventh power signal feature is input into the fully connected layer and mapped into a test power sequence signal.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method for testing an electric meter according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for testing an electric meter according to any one of claims 1 to 8 is implemented.