A method for constructing a rule base of a smart meter manufacturing process scheme

By grouping and differentially analyzing historical data from smart meters, a constraint-based rule tree with weakly labeled parameterized templates is constructed. Then, byte-consistency pruning is used to solve the problems of reliance on human experience and rule tree optimization in existing technologies, thereby improving the efficiency and accuracy of automatic generation of process solutions.

CN122633178APending Publication Date: 2026-08-25CHINA JILIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611125292.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing methods for compiling rule bases for smart meter manufacturing processes rely on human experience, making it difficult to automatically discover and reuse coding patterns between historical order parameter tables and solution tables. Furthermore, rule tree pruning methods are difficult to effectively verify and optimize, resulting in low efficiency in automatically generating manufacturing processes.

Method used

By grouping similar samples, constructing similar sample pairs, calculating parameter differences and encoding differences, generating parameterized template weak labels, constructing a constraint-based rule tree, and using the consistency of back-encoded bytes as the closed-loop evaluation criterion for pruning, redundant branches are eliminated, thereby improving the practicality and reusability of the rule tree.

Benefits of technology

It enables automatic extraction of historical coding mapping patterns, reduces reliance on manual experience, improves the efficiency of rule base construction and the accuracy of rule trees, and enhances the ability to automatically generate process solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633178A_ABST
    Figure CN122633178A_ABST
Patent Text Reader

Abstract

The application discloses a kind of intelligent electric meter process scheme rule base construction methods, first acquisition historical order parameter table and historical scheme table, sample is grouped and constructs similar sample pair, calculates parameter difference and coding difference;Then the sample pair of same change mechanism but different numerical value is merged into template / parameter mode, with template family weak label as supervision target, constraining initial rule tree is constructed;Corresponding back-encoding function library is established for template family, and the consistency of back-encoding result and real data content is compared, to determine the optimal parameter;Finally, closed loop pruning is carried out, and the final rule tree is obtained, the final template and its final parameter are stored in leaf node, to form a rule base that can be directly reused.The application realizes the reuse of subsequent scheme writing automation process based on the coding mapping law in historical scheme, reduces the dependence of rule construction on artificial experience;And improve the accuracy, compactness and subsequent process scheme automatic generation ability of rule tree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart meter technology, and in particular to a method for constructing a rule base for smart meter manufacturing processes. Background Technology

[0002] In the process of developing smart meter manufacturing solutions, the order parameter table typically needs to be further converted into a solution table containing parameter names, target data content, protocol types, data identifiers, control codes, and related functional fields for subsequent parameter distribution, function configuration, automatic programming, or protocol communication calls. This process is essentially a mapping and construction process from order parameters to encoded results, and is often influenced by various factors such as communication protocols, internal coding habits, template structures, multiplier relationships, length constraints, byte order, and field combination methods. Therefore, it has a strong dependence on rules and experience. To improve solution development efficiency and support subsequent automatic generation of process solutions, it is usually necessary to pre-build a coding rule base.

[0003] Existing methods for compiling rule bases for smart meter manufacturing processes typically involve manually building a fixed rule base or constructing rule trees and decision trees based on historical single-sample features and then pruning and optimizing them to generate the solution. Automatic learning methods that build rule trees or decision trees based on historical samples usually begin by collecting and preprocessing historical order parameter data and corresponding result data. Then, fields such as specification type, data identifier, control code, parameter value type, and length features are extracted as input features, and template category, result category, or target attribute category are used as output labels to build an initial decision tree or rule tree. Subsequently, the tree structure is pruned based on indicators such as misclassification rate, information gain, cross-validation error, or model complexity. Finally, a simplified rule tree or rule set is output for new sample classification prediction and rule extraction. While this type of method has some automatic learning capability compared to manually compiling rule bases and can summarize some rule structures from historical samples, its modeling object is usually a single sample. It mainly learns the mapping relationship from "sample features to category labels" and has not yet explored differential patterns and rule summarization based on the parameter and encoding changes among similar samples.

[0004] Existing methods primarily model the mapping relationship between the features and results of individual samples, lacking systematic differential analysis of the correspondence between parameter changes and encoding changes among similar historical samples. Therefore, it is difficult to automatically discover, summarize, and reuse implicit encoding mapping patterns from massive historical order parameter tables and historical scheme tables. Meanwhile, fixed rule base methods heavily rely on human experience, making rule maintenance difficult; and existing rule tree pruning mainly relies on internal indicators such as misclassification rate, information gain, or model complexity, making it difficult to effectively verify and optimize the rule structure based on the final re-encoding results.

[0005] While existing methods can support rule base construction and automatic scheme generation to some extent, they lack a systematic mechanism for constructing sample pairs, performing differential analysis, and summarizing patterns among similar samples in historical order parameter tables and historical scheme tables. Therefore, it is difficult to further transform massive amounts of historical experience into more reusable rule tree structures and rule bases.

[0006] Therefore, this invention proposes a method for constructing a rule tree for smart meter manufacturing processes. By grouping similar samples, constructing similar sample pairs, calculating parameter differences and encoding differences, and summarizing the difference rules, parameterized template weak labels are generated. Then, a constraint-based rule tree is constructed with leaf nodes outputting template types and template parameters. Pruning is performed using the consistency of back-encoded bytes as a closed-loop evaluation criterion. This achieves the goals of automatically extracting and reusing historical encoding mapping rules, effectively verifying rule structures, eliminating redundant branches, and improving the automatic generation capability of manufacturing processes. Summary of the Invention

[0007] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for constructing a rule base for smart meter manufacturing processes. This method solves the problems of difficulty in automatically constructing encoding rules between historical order parameter tables and historical scheme tables, the ineffective reuse of historical experience, and the high dependence on manual experience during the development of smart meter manufacturing process schemes. Compared to traditional tree model pruning methods, this invention uses byte consistency as the closed-loop evaluation criterion, which can eliminate redundant branches while ensuring rule validity, thereby improving the practicality and engineering application value of the rule tree.

[0008] The objective of this invention is achieved through the following technical solution: a method for constructing a rule base for a smart meter manufacturing process, the method comprising:

[0009] (1) Obtain the historical order parameter table and historical plan table, identify the data items that need to be encoded and converted, and construct a structured sample based on the historical order parameter table and historical plan table;

[0010] (2) Group the samples and construct sample pairs from similar samples;

[0011] (3) For each pair of similar samples, calculate the parameter difference and the coding difference of the target coding result to determine the correspondence between parameter changes and coding changes;

[0012] (4) Group sample pairs with the same change mechanism but different values ​​into template / parameter patterns to construct template family weak labels;

[0013] (5) Use the feature vectors of the samples to form a training feature matrix, and use the template family weak labels as the supervision target to construct a constrained initial rule tree;

[0014] (6) Establish a corresponding back-compilation function library for each template family, and compare the consistency between the back-compilation results and the actual data content to determine the optimal parameters;

[0015] (7) Based on the back-compilation results of the optimal parameters, perform closed-loop pruning of the constrained initial rule tree to obtain the final rule tree. The leaf nodes store the final template and its final parameters to form a rule library that can be directly reused.

[0016] Furthermore, the structured sample includes a context information set, the parameter values ​​of the sample, and the target encoding result of the sample in the historical scheme table; the context information set includes at least the specification type, data identifier, control code, parameter name, and related functional fields.

[0017] Furthermore, in step (2), the samples are grouped according to the same data identifier and the same data item name. When constructing sample pairs, if the number of samples is less than the threshold, all pairs are paired. If the number of samples is greater than the threshold, only sample pairs with consistent context information and interpretable differences are retained.

[0018] Furthermore, in step (4), difference records with the same or isomorphic mapping patterns are merged and assigned a template family type. Candidate parameter sets are extracted based on the difference results of sample pairs to construct template family weak labels.

[0019] Furthermore, in step (5), the leaf node output of the constraint-based initial rule tree is limited to template family weak labels, and the template family and its candidate parameter range corresponding to the sample features are determined.

[0020] Furthermore, in step (6), the back-encoding function encodes the template family type, template parameters, sample parameter values ​​and context information, and outputs the predicted data content.

[0021] Further, in step (6), comparing the consistency between the re-encoding result and the real data content includes calculating the re-encoding byte consistency of the atomic tree, specifically: the atomic tree is a local subtree with a certain internal node of the regular tree as the root and containing all its descendant nodes, constructing a sample set covered by the atomic tree, defining the re-encoding byte consistency of the leaf node under the candidate parameter for any candidate parameter, selecting the parameter that maximizes the consistency as the optimal parameter of the leaf node under the current atomic tree structure, and thus obtaining the re-encoding byte consistency of the atomic tree.

[0022] Furthermore, in step (6), comparing the consistency between the re-editing result and the real data content also includes calculating the optimal re-editing byte consistency of the candidate leaf node. Specifically, the re-editing byte consistency of the leaf node on the sample set covered by the atomic tree is first defined. Then, among all candidate template families and candidate parameters, the combination that maximizes consistency is selected as the optimal result of the leaf node, and a unified template family type and its optimal parameters are determined.

[0023] Further, in step (7), a single leaf node is used to replace the atomic tree to perform pruning, and it is determined whether the re-compilation effect can still be maintained at a level no lower than that of the current atomic tree. Specifically, if the optimal consistency of the optimal parameters of the candidate single leaf node is not less than the re-compilation byte consistency of the optimal parameters of the atomic tree, then the single leaf node is used to replace the atomic tree to perform pruning, and the final output template and parameters of the single leaf node are solidified; otherwise, the atomic tree structure is retained unchanged.

[0024] Furthermore, in step (7), each internal node in the final rule tree is used to determine the conditional branch of the input sample in terms of data identifier, control code, reduction type, parameter value type, candidate length, and hexadecimal behavior. The leaf nodes no longer output template family weak labels, but store the final template and its final parameters.

[0025] The beneficial effects of this invention are:

[0026] Compared with existing technologies, this invention can extract encoding mapping patterns from historical schemes by grouping similar samples and summarizing the differences between similar samples, and can reuse these patterns in the automated process of writing subsequent schemes, reducing the dependence of rule construction on human experience; it can improve the efficiency of rule solidification and rule base construction through parameterized template weak labels and constraint-based rule trees; and it can verify the validity of rules and eliminate redundant branches from the perspective of the final encoding result through the back-compilation function library and back-compilation byte consistency closed-loop pruning, thereby improving the accuracy, compactness and automatic generation capability of the rule tree and subsequent process schemes. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating the method for constructing a rule base for smart meter manufacturing processes.

[0029] Figure 2 This is a schematic diagram illustrating the construction of similar sample pairs and the summarization of difference patterns;

[0030] Figure 3 This is a schematic diagram of parameterized template weak tag generation;

[0031] Figure 4 This is a schematic diagram of the initial rule tree training;

[0032] Figure 5 This is a diagram illustrating closed-loop pruning based on byte consistency during recompiling. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are merely illustrative and not intended to limit the invention.

[0034] like Figure 1 As shown, the present invention provides a method for constructing a rule base for a smart meter manufacturing process, and the specific steps are as follows:

[0035] Step 1: Historical Data Processing and Structured Sample Construction

[0036] First, obtain the historical order parameter table and the historical plan table. Assume that after data cleaning and standardization, a total of N historical records are obtained.

[0037] Determine whether a data item requires encoding conversion. For example, in the sample data in Table 3, record number 1, "Converted Baud Rate," has the data content 9600,E,8,1, an empty data identifier, and a control code of C4. This type of record is more suitable for processing as a direct-use rule item, i.e., the corresponding configuration relationship is directly retained in the rule base. For data items that require encoding conversion, construct a structured sample by pairing the historical order parameter table with the historical scheme table as follows:

[0038]

[0039] in, Let i represent the i-th sample. The context information set includes at least the specification type, data identifier, control code, parameter name, and related functional fields. This represents the parameter value of the i-th sample, i.e., the parsed or configured value in the historical order parameter table; This represents the target encoding result of the i-th sample in the historical scheme table. This sample is used for all subsequent differencing, weak label generation, rule tree training, and pruning.

[0040] For example, the "load record start time" record can be constructed as follows: ={Protocol Type=2, Data Identifier=04000A01, Control Code=14, Description=Load Record Start Time} =“01-01 00:00” =“01010000”.

[0041] Step 2: Grouping similar samples and constructing similar sample pairs

[0042] like Figure 2 As shown, in the structured sample set constructed in step one, direct-use records that do not require encoding conversion and records with incomplete fields are removed, and the structured samples that require encoding pattern summarization are retained as the structured samples to be grouped. Then, the structured samples to be grouped are grouped according to the same data identifier and the same data item name. Let there be G sample groups after grouping, and the g-th sample group is denoted as R. g .

[0043] The number of sample pairs is determined by the following formula. This control method aims to achieve near-perfect pairing when the sample size is small, and to automatically limit the size when the sample size is large, preventing a single high-frequency data item from excessively consuming subsequent statistical computation resources. The number of sample pairs is set based on the current historical sample size. The threshold is set to 100, and K is set to 4. In practice, the threshold and the number of nearest neighbors can be set according to the historical sample size. When the sample size of a certain data item group is small, all samples can be paired up. When the sample size is large, only sample pairs with consistent context, few changing fields, and interpretable differences are retained.

[0044]

[0045] in: The number of samples for each group of data items after filtering. P represents the initial number of samples in this data item group, i.e., the number of samples in the g-th group, K is the maximum number of similar samples to retain for each sample, and P is the number of samples to retain for each sample. max This represents the maximum number of sample pairs allowed for this data item group;

[0046] In the example data in Table 3, serial numbers 24 and 25 are "automatic loop display of data items on the first screen" and "automatic loop display of data items on the second screen", respectively. Their descriptions, control codes, and specification contexts are highly consistent and can be regarded as illustrative sample pairs of data in the same family. In the real historical sample database, if the same type of record appears repeatedly across multiple schemes, a large number of similar sample pairs can be formed within the group, which can be used for subsequent difference pattern statistics.

[0047] Step 3: Parameter Differentiation and Encoding Differentiation

[0048] like Figure 2 As shown, for each pair of similar samples First, calculate the parameter difference;

[0049]

[0050] in, This represents the parameter difference result between the i-th sample and the j-th sample. () represents the parametric difference calculation function; Let represent the parameter values ​​of the i-th sample and the j-th sample, respectively; These represent the context information sets for the i-th sample and the j-th sample, respectively, used to help explain the changes in the parameter fields. It is not limited to numerical subtraction; it can also represent structured parameter change events such as enumeration replacement, time field changes, and length changes.

[0051] Then calculate the coding difference for the target coding results of the same pair of samples;

[0052]

[0053] in, This represents the encoding difference result between the i-th sample and the j-th sample. () represents the coding difference calculation function; Let represent the target encoding results of the i-th sample and the j-th sample, respectively. Similar to the parameter difference, It's not a simple numerical subtraction, but rather an identification of which bytes, bits, or fields have changed.

[0054] Thus, the formula and These form a one-to-one difference pair, with the former describing "changes at the input end" and the latter describing "changes at the encoding end." The relationship between the two constitutes the core data foundation for subsequent pattern induction.

[0055] Taking a portion of the data items, we will now provide two types of difference results as examples.

[0056] 1. Numerical scaling zero-padding template:

[0057] Taking the data item name "Lower Limit of Current Triggering Undervoltage Event" as an example, and analyzing historical samples with the same data identifier 04090103, the corresponding samples are shown in Table 1:

[0058] Table 1

[0059] Undervoltage event current trigger lower limit 04090103 000015 0.0015 Undervoltage event current trigger lower limit 04090103 000075 0.0075

[0060] The two data parameter values ​​are 0.0015 and 0.0075, respectively, and the encoded results are 000015 and 000075. If the business value is multiplied by... Then we get 15 and 75 respectively; after padding to a 6-character fixed-length string, we get the encoding result consistent with the historical scheme. Furthermore, the business difference between the two samples is 0.0075-0.0015=0.0060, the corresponding integer difference is 75-15=60, and the difference of the encoding result after removing leading zeros is also 60.

[0061] 2. The ASCII character encoding zero-padding template is shown in Table 2:

[0062] Table 2

[0063] Active accuracy level 04000407 43000000 Active accuracy class: C Active accuracy level 04000407 44000000 Active accuracy class: D

[0064] The parameter changes from "Active Accuracy Level: C" to "Active Accuracy Level: D", and the encoding result changes from 43000000 to 44000000. Since the ASCII hexadecimal values ​​of characters C and D are 43 and 44 respectively, the encoding change in this group of samples does not correspond to a continuous numerical change, but to a stable category mapping relationship. That is, the business-side level values ​​C and D are mapped to different enumerated encoding prefixes, and then the fixed field structure is supplemented for output.

[0065] Step 4: Generating weak labels for candidate parameter sets

[0066] like Figure 3 As shown, after differentiating sample pairs with the same data item name and data identifier, sample pairs with the same change mechanism but different values ​​are grouped into template / parameter patterns. This yields template candidates and clues for parameter solving. For any sample pair within the same group... The difference record has been obtained in the difference stage:

[0067]

[0068] After merging difference records with the same or isomorphic mapping patterns, several difference merge groups are obtained:

[0069]

[0070] in, This represents the k-th difference merge group.

[0071] The difference group is obtained by merging. Then, assign the template family type set to this group. Candidate parameter sets are extracted based on the difference results of sample pairs within the group. Therefore, the weak tag of the k-th template family is denoted as:

[0072]

[0073] The template family weak label corresponding to the k-th difference merge group is represented by, Indicates the template type. This represents the template parameters. It also represents the template family type to which the sample should belong and its set of candidate parameters. The weak labels obtained from the two data points in the above differencing correspond to:

[0074] B1: Numerical scaling zero-padding template, parameters are 10000, 6, left zero padding;

[0075] B2: ASCII hexadecimal character zero-padding template, parameters are ASCII, 8 bits, right padding 000000.

[0076] Step 5: Construct a constraint-based initial rule tree for weakly labeled template families output by leaf nodes.

[0077] like Figure 4 As shown, after obtaining the template family weak labels for each sample, an input feature matrix for rule tree training is constructed. Let the feature vector of the i-th sample be denoted as:

[0078]

[0079] in, Let represent the feature vector of the i-th sample, which describes the input features of this sample that can be recognized and classified by the model during the rule tree training phase. This represents the feature components contained in the i-th sample. The feature components may include attributes used for rule tree splitting decisions, such as data identifier, control code, reduction type, and parameter value type.

[0080] The training feature matrix is ​​constructed from the feature vectors of all samples:

[0081]

[0082] X represents the training feature matrix composed of all sample feature vectors. This represents the transpose of the feature vector of the nth sample; n represents the number of samples participating in the rule tree training. This training feature matrix X serves as the input to the constrained initial rule tree, used to learn the correspondence between sample features and template family weak labels.

[0083] The corresponding supervision label vector is denoted as:

[0084]

[0085]

[0086] in, For the template family weak label of the i-th sample, (i) represents the difference merge group number to which the i-th sample belongs. In other words, it represents the supervision label of the i-th sample. The label of the merged group to which it belongs The value is assigned.

[0087] The feature matrix X is neither the final encoding result nor the weak label itself, but rather the input information used to describe the sample context and encoding; the supervision label vector Y represents the template family weak label to which the sample should ultimately belong, and is the target output of the rule tree training. The rule tree training phase learns the mapping relationship "from sample features to template family weak labels".

[0088] In this invention, the splitting conditions of the rule tree are not limited to data item names and data identifiers, but rather prioritize prior factors that truly influence the encoding results as splitting attributes. These prior factors may include data identifiers, control codes, function extension codes, reduction types, parameter value types, whether decimals are present, the number of decimal places, effective length, whether ASCII encoding is possible, candidate encoding length, whether scaling is possible, and whether byte rearrangement is possible. Through these features, the rule tree can progressively route samples to the corresponding template families.

[0089] Using the training feature matrix X as input and the supervision label vector Y as the supervision target, a constrained initial rule tree T0 is constructed. Here, "constrained" means that the output of the leaf nodes of the tree is not arbitrary, but limited to template family weak labels; that is, the leaf nodes only output:

[0090]

[0091] After this step is completed, the tree model has determined which sample features should be assigned to which template family, but it has not yet finalized which set of specific parameters to use under that template family.

[0092] For example, numerical samples like "lower limit of current triggering undervoltage event" are more likely to enter the "numerical scaling zero-padding template family" in the tree by following the path of "numerical type, containing decimals, fixed candidate length, and possible scaling factor"; while character samples like "active power accuracy level" are more likely to enter the "ASCII hexadecimal character zero-padding template family" by following the path of "character type, can be ASCII encoded, and candidate length is a fixed number of bytes".

[0093] Step Six: Establish Template Family Compilation Function Library

[0094] After the constrained initial rule tree is constructed, the leaf nodes can output weak labels for template families, but they cannot directly output the final encoding results. Therefore, it is necessary to establish a corresponding back-encoding function library for each template family so that the predicted data content can be generated subsequently based on the sample parameter values ​​and context information.

[0095] Let a template family be of type t, and its write-back functions be denoted as:

[0096]

[0097] in, This represents the predicted data content, where t represents the template family type. Indicates template parameters, Indicates the sample parameter value. Indicates contextual information.

[0098] By establishing a template family back-compilation function library, different parameters in the candidate parameter set can be tried one by one within a certain leaf node, and the consistency between the back-compilation results and the actual data content can be compared to determine the optimal parameters.

[0099] Step 7: Calculate the re-encoding byte consistency of the atomic tree

[0100] like Figure 5 As shown, in order to perform closed-loop pruning later, an atomic tree needs to be defined first. An atomic tree is a local subtree rooted at a certain internal node N, containing all its descendant nodes, denoted as [a_n]. :

[0101] The sample set covered by the atomic tree is denoted as:

[0102]

[0103] Atomic Tree For any leaf node k in the template family, its output is still a template family weak label:

[0104]

[0105] For any candidate parameter in leaf node k, the byte rewrite consistency of that leaf node under the candidate parameter is defined as follows:

[0106]

[0107]

[0108] in, This represents the set of samples covered by leaf node k. This represents a scoring function that indicates the consistency between predicted data content and actual data content.

[0109] For leaf node k, select the parameter that maximizes consistency as the optimal parameter for that leaf node under the current atomic tree structure:

[0110]

[0111] Furthermore, an atomic tree can be defined. The consistency of the reassembled bytes is as follows:

[0112]

[0113] in, Representing an atomic tree The set of leaf nodes.

[0114] With the current atomic tree structure remaining unchanged, after each leaf node selects the parameters most advantageous to itself, what is the optimal byte consistency that the entire atomic tree can achieve across its covered samples? The larger this value, the more accurately the current subtree structure can reproduce historical encoding results.

[0115] To give a simple example, for samples like "lower limit of current triggering undervoltage event," if there are two leaf nodes in the atomic tree, and both leaf nodes can find the correct multiplier and zero-padding method in their respective candidate parameter sets, then their atomic tree consistency may reach 1. For samples like "active power accuracy level," if both leaf nodes can correctly rewrite the corresponding ASCII hexadecimal encoding result, then their atomic tree consistency can also reach 1.

[0116] Step 8: Calculate the optimal re-encode byte consistency for candidate single-leaf nodes.

[0117] Suppose we try to replace the atomic tree with a single-leaf node P. This is used to determine whether the re-compilation effect can still be maintained at least as good as that of the current subtree. The single-leaf node retains only one unified template family type and its candidate parameter set. For any candidate parameter, the single-leaf node is defined in the sample set. The consistency of the reassembled bytes is as follows:

[0118]

[0119] Then, among all candidate template families and candidate parameters, the combination that maximizes consistency is selected as the optimal result for the single-leaf node:

[0120]

[0121] The corresponding optimal template family and parameters are:

[0122]

[0123] Represents a node The set of candidate template families that can be selected; representing the set of candidate template families. A template family type;

[0124] Indicates template family type The corresponding set of candidate parameters; Represents the set of candidate parameters A set of template parameters;

[0125] This step involves moving away from having multiple leaf nodes in the current atomic tree each responsible for different samples. Instead, it assumes that a unified template and a set of unified parameters can be used to cover all samples in the atomic tree. If this unified approach still achieves high consistency, it indicates that further splitting in the atomic tree may be redundant.

[0126] Step 9: Closed-loop pruning based on byte consistency after rewriting

[0127] After obtaining the consistency of the atomic trees respectively Optimal consistency with candidate single-leaf nodes Then, the following judgment is made:

[0128]

[0129] If the above conditions are met, it means that replacing the entire atomic tree below node N with a single leaf node will not reduce the consistency of the re-compiled bytes, and may even improve it. In this case, pruning is performed to reshape the atomic tree. Replace it with a single-leaf node P, and solidify the final output template of this single-leaf node as follows:

[0130]

[0131] in, Represents a node The final output of the single-leaf node formed after pruning; This represents the internal node currently being judged as to whether to prune; Indicates at node The optimal template family type determined after byte consistency evaluation on the covered sample set; Representation and optimal template family type The corresponding optimal template parameters. This formula indicates that when the node... When the following atomic tree is replaced by a single-leaf node, the single-leaf node no longer stores the template family weak tag, but directly solidifies into the final template family type and the final parameter combination.

[0132] If the above conditions are not met, the atomic tree structure will remain unchanged.

[0133] Then, the above process is repeated for the remaining internal nodes in the rule tree until there are no unprocessed nodes. This yields the final rule tree T after loop pruning. Pruning is not performed on the entire tree at once, but rather by examining the local subtrees corresponding to each internal node to see if it can be replaced by a simpler single-leaf node.

[0134] Step 10: Output the final rule tree and export the rule base.

[0135] After closed-loop pruning, the final rule tree T is obtained. At this point, each internal node in the tree is used to determine the conditional branches of the input sample based on data identifier, control code, reduction type, parameter value type, candidate length, hexadecimal behavior, etc., while each leaf node no longer outputs the template family weak label, but instead stores the final template and its final parameters.

[0136]

[0137] in, Indicates the first rule in the final rule tree The final output of each leaf node; Indicates the leaf node number in the final rule tree; Indicates the template family type that the leaf node will eventually solidify; This represents the final, fixed template parameters for the leaf node. The formula indicates that after closed-loop pruning, each leaf node in the final rule tree no longer outputs weak template family labels, but instead stores the final template and its final parameters that can be directly used to compile back into the target data content.

[0138] After exporting the entire rule tree, a rule library that can be directly reused is formed.

[0139] The following data is a manufacturing process scheme for a certain smart energy meter. The data is parsed from the parameter table, and the data content is the encoded process data.

[0140] Table 3 Example Data

[0141] 1 Convert baud rate C4 9600,E,8,1 2 2 Compare the internal temperature of the table 02800007 11 B2 2 2 3 Internal software version number F0910050 11 B1 Flash 3 2 4 Internal judgment of Flash A2B03305 11 B1 Flash is OK! 4 2 10 Communication port 1 rate feature word 04000703 14 20 20 1 2 11 Enable the function to report only according to the last communication protocol when reporting. A2A0183B 14 00 00 2 2 12 Monthly Freeze / Refreeze Switch A2A0186A 14 00 00 2 2 13 698 Freeze Time in Seconds A2A0200F 14 00 00 2 2 14 Communication port 2 rate feature word 04000704 14 20 20 1 2 15 Load recording mode word 04000901 14 3F 3F 1 2 16 Timed data freeze mode word 04000902 14 FF FF 1 2 17 Instantaneous freeze data mode word 04000903 14 FF FF 1 2 18 Agreement on freezing data pattern words 04000904 14 FF FF 1 2 19 Freeze data mode word on the hour 04000905 14 03 03 1 2 20 Daily frozen data pattern words 04000906 14 FF FF 1 2 21 Load recording start time 04000A01 14 01010000 01-01 00:00 2 2 22 Category 1 load recording interval 04000A02 14 0015 0015 2 2 23 Category 2 load recording interval 04000A03 14 0015 0015 2 2 24 Automatically cycle through the first screen displaying data items. 04040101 14 0004000101 0400010100 2 2 25 Automatically cycle through the second screen displaying data items. 04040102 14 0004000102 0400010200 2 2 26 Automatically cycle through the data items displayed on the 3rd screen. 04040103 14 007F010000 7F01000000 2 2 27 Automatically cycle through the data items displayed on the 4th screen. 04040104 14 007F010100 7F01010000 2 2 28 Automatically cycle through the data items displayed on the 5th screen. 04040105 14 007F010200 7F01020000 2 2 29 Automatically cycle through the data items displayed on the 6th screen. 04040106 14 007F010300 7F01030000 2 2 30 Automatically cycle through the 7th screen displaying data items. 04040107 14 007F010400 7F01040000 2 2 31 Automatically cycle through the data items displayed on the 8th screen. 04040108 14 0001010000 0101000000 2 2 32 Automatically cycle through the data items displayed on the 9th screen. 04040109 14 0101010000 0101000001 2 2 33 Automatically cycle through the 10th screen displaying data items. 0404010A 14 0201010000 0101000002 2 2 34 Automatically cycle through the 11th screen displaying data items. 0404010B 14 007F020000 7F02000000 2 2 35 Automatically cycle through the 12th screen displaying data items 0404010C 14 007F020100 7F02010000 2 2 36 Automatically cycle through the 13th screen displaying data items. 0404010D 14 007F020200 7F02020000 2 2 37 Automatically cycle through the 14th screen displaying data items. 0404010E 14 007F020300 7F02030000 2 2 38 Automatically cycle through the 15th screen displaying data items. 0404010F 14 007F020400 7F02040000 2 2 39 Automatically cycle through the 16th screen displaying data items. 04040110 14 007F020000 7F02000000 2 2 40 Automatically cycle through the 17th screen displaying data items. 04040111 14 007F020100 7F02010000 2 2 41 Automatically cycle through the 18th screen displaying data items. 04040112 14 007F020200 7F02020000 2 2 42 Automatically cycle through the 19th screen displaying data items. 04040113 14 007F020300 7F02030000 2 2 46 The button displays data items in a cycle on the first screen. 04040201 14 0004000101 0400010100 2 2 47 The button displays data items in a cycle on the second screen. 04040202 14 0004000102 0400010200 2 2 48 The button displays data items in a cycle on the third screen. 04040203 14 0004000401 0400040100 2 2 49 The button displays data items in a cyclical manner on the 4th screen. 04040204 14 0104000401 0400040101 2 2 50 The button cycle displays data items on the 5th screen. 04040205 14 007F010000 7F01000000 2 2 51 The button cycle displays data items on the 6th screen. 04040206 14 007F010100 7F01010000 2 2 52 The button displays data items in a 7-screen loop. 04040207 14 007F010200 7F01020000 2 2 53 The button displays data items in a cyclical manner on the 8th screen. 04040208 14 007F010300 7F01030000 2 2 54 The button cycle displays data items on the 9th screen. 04040209 14 007F010400 7F01040000 2 2 55 The button displays data items in a cyclical manner on the 10th screen. 0404020A 14 0001010000 0101000000 2 2 56 The button displays data items in a cyclical manner on screen 11. 0404020B 14 0101010000 0101000001 2 2 57 The button displays data items in a cyclical manner on the 12th screen. 0404020C 14 0004000401 0400040100 2 2 58 The button displays data items in a cyclical manner on screen 13. 0404020D 14 0104000401 0400040101 2 2 59 The button displays data items in a cyclical manner on screen 14. 0404020E 14 007F010000 7F01000000 2 2 60 The button displays data items in a cyclical manner on screen 15. 0404020F 14 007F010100 7F01010000 2 2 61 The button displays data items in a cyclical manner on screen 16. 04040210 14 007F010200 7F01020000 2 2 62 The button displays data items in a cyclical manner on screen 17. 04040211 14 007F010300 7F01030000 2 2 63 The button displays data items in a cyclical manner on screen 18. 04040212 14 007F010400 7F01040000 2 2 64 The button displays data items in a cyclical manner on screen 19. 04040213 14 0101020000 0102000001 2 2 65 The button displays data items in a cyclical manner on screen 20. 04040214 14 0201020000 0102000002 2 2 66 The button displays data items in a cyclical manner on screen 21. 04040215 14 007F000001 7F00000100 2 2 67 The button presses cycle through the 22nd screen, displaying data items. 04040216 14 0001010001 0101000100 2 2 68 The button presses cycle through the 23rd screen, displaying data items. 04040217 14 0101010001 0101000101 2 2 69 The button presses cycle through the 24th screen, displaying data items. 04040218 14 0201010001 0101000102 2 2 70 The button presses cycle through the 25th screen, displaying data items. 04040219 14 0001020001 0102000100 2 2 71 The button presses cycle through the 26th screen, displaying data items. 0404021A 14 0101020001 0102000101 2 2 72 The button displays data items in a cyclical manner on screen 27. 0404021B 14 0201020001 0102000102 2 2 73 The button displays data items in a cyclical manner on screen 28. 0404021C 14 007F150000 7F15000000 2 2 74 The button displays data items in a cyclical manner on screen 29. 0404021D 14 007F160000 7F16000000 2 2 75 The button presses cycle through the 30th screen, displaying data items. 0404021E 14 007F290000 7F29000000 2 2 76 The button displays data items in a cyclical manner on screen 31. 0404021F 14 007F2A0000 7F2A000000 2 2 77 The button presses cycle through the data items displayed on screen 32. 04040220 14 007F3D0000 7F3D000000 2 2 78 The button presses cycle through the data items displayed on screen 33. 04040221 14 007F3E0000 7F3E000000 2 2 79 The button presses cycle through the data items displayed on screen 34. 04040222 14 007F030000 7F03000000 2 2 80 The button presses cycle through the data items displayed on screen 35. 04040223 14 007F040000 7F04000000 2 2 81 The button presses cycle through the 36th screen, displaying data items. 04040224 14 007F050000 7F05000000 2 2 82 The button presses cycle through the 37th screen, displaying data items. 04040225 14 007F060000 7F06000000 2 2 83 The button displays data items in a cyclical manner on screen 38. 04040226 14 007F070000 7F07000000 2 2 84 The button presses cycle through the data items displayed on screen 39. 04040227 14 007F080000 7F08000000 2 2 85 The button displays data items in a cyclical manner on screen 40. 04040228 14 0002010100 0201010000 2 2 86 The button displays data items in a cyclical manner on screen 41. 04040229 14 0002010200 0201020000 2 2 87 The button displays data items in a cyclical manner on screen 42. 0404022A 14 0002010300 0201030000 2 2 88 The button displays data items in a cyclical manner on screen 43. 0404022B 14 0002020100 0202010000 2 2 89 The button displays data items in a cyclical manner on screen 44. 0404022C 14 0002020200 0202020000 2 2 90 The button presses cycle through the data items displayed on screen 45. 0404022D 14 0002020300 0202030000 2 2 91 The button presses cycle through the 46th screen, displaying data items. 0404022E 14 0002030000 0203000000 2 2 107 Category 3 load recording interval 04000A04 14 0015 0015 2 2 108 Category 4 load recording interval 04000A05 14 0015 0015 2 2 109 Category 5 load recording interval 04000A06 14 0016 0016 2 2 110 Category 6 load recording interval 04000A07 14 0017 0017 2 2 111 Level 2 password 04000C03 14 Security Classification: 11 Password: 789456 Security Level: 11 Password: 789456 2 2 112 Level 4 password 04000C05 14 Security Classification: 22 Password: 11111 Security Classification: 22 Password: 11111 2 2 113 Upper limit of positive active power 04000E01 14 004514 0.1514 2 2 114 Upper limit of reverse active power 04000E02 14 004514 0.1514 2 2 115 Freeze start time on the hour 04001201 14 1001010000 10-01-01 00:00 2 2 116 Freeze interval on the hour 04001202 14 60 60 1 2 117 Daily freeze time 04001203 14 0000 00:00 1 2 122 Power flow reversal event trigger lower limit 04090A01 14 0000145 0.00145 2 2 123 Delay time for determining reverse current events 04090A02 14 60 60 1 2 124 Timed freeze time 16 99991200 99-99 12:00 2 2 125 Electricity meter operation characteristic word 1 04001101 14 00 00 1 2 126 Automatic reset delay time for actively reporting status words 04001405 14 30 30 1 2 127 LCD alarm output control word 55240003 14 00018789 (00018789) 2 2 128 Light-controlled alarm control word 55240004 14 00000000 (00000000) 2 2 129 Voice-activated alarm control words 55240005 14 00000000 00000000 2 2 130 Relay alarm control word 55240006 14 00018789 (00018789) 2 2 132 Configure one or two 485 switches A2A02601 14 02 2 2 134 Does the external network support 645 communication switches? A2A02600 14 00 5A indicates no support, others indicate support. 2 2 135 Load switch control word A2A01837 14 55AA55AA005555AA 2 2 136 alarm threshold for RTC batteries 55290000 14 2500 2500 2 2 137 Alarm threshold for backup battery 55290001 14 5200 5200 2 2 139 Delay C10 3000 4 140 Convert baud rate C4 9600,E,8,1 2 144 slip time 41010200 06 1101 1 5 145 Switching time between two time zone tables 40080200 06 1C00000000000FF 1 5 146 Two sets of daytime switching time 40090200 06 1C00000000000FF 1 5 147 Overcurrent event current trigger lower limit (for single-phase DC meters) 30050501 06 0500011940 0500011940 1 5 148 Number of time zones per year (p≤14) 400C0201 06 1105 1 5

[0142] The above embodiments are used to explain and illustrate the present invention, but not to limit the present invention. Any modifications and changes made to the present invention within the spirit and scope of the claims shall fall within the protection scope of the present invention.

Claims

1. A method for constructing a rule base for a smart meter manufacturing process, characterized in that, The method includes: (1) Obtain the historical order parameter table and historical plan table, identify the data items that need to be encoded and converted, and construct a structured sample based on the historical order parameter table and historical plan table; (2) Group the samples and construct sample pairs from similar samples; (3) For each pair of similar samples, calculate the parameter difference and the coding difference of the target coding result to determine the correspondence between parameter changes and coding changes; (4) Group sample pairs with the same change mechanism but different values ​​into template / parameter patterns to construct template family weak labels; (5) Use the feature vectors of the samples to form a training feature matrix, and use the template family weak labels as the supervision target to construct a constrained initial rule tree; (6) Establish a corresponding back-compilation function library for the template family, and compare the consistency between the back-compilation results and the real data content to determine the optimal parameters; (7) Based on the back-compilation results of the optimal parameters, perform closed-loop pruning of the constrained initial rule tree to obtain the final rule tree. The leaf nodes store the final template and its final parameters to form a rule library that can be directly reused.

2. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 1, characterized in that, In step (1), the structured sample includes a set of context information, the parameter values ​​of the sample, and the target encoding result of the sample in the historical scheme table; the set of context information includes at least the specification type, data identifier, control code, parameter name, and related functional fields.

3. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 1, characterized in that, In step (2), the samples are grouped according to the same data identifier and the same data item name. When constructing sample pairs, if the number of samples is less than the threshold, all samples are paired up. If the number of samples is greater than the threshold, only sample pairs with consistent context information and interpretable differences are retained.

4. The method for constructing a rule base for a smart meter manufacturing process according to claim 1, characterized in that, In step (4), difference records with the same or isomorphic mapping patterns are merged and assigned a template family type. Candidate parameter sets are extracted based on the difference results of sample pairs to construct template family weak labels.

5. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 1, characterized in that, In step (5), the leaf node output of the constraint-based initial rule tree is limited to template family weak labels, and the template family and its candidate parameter range corresponding to the sample features are determined.

6. The method for constructing a rule base for a smart meter manufacturing process according to claim 1, characterized in that, In step (6), the back-encoding function encodes the template family type, template parameters, sample parameter values ​​and context information, and outputs the predicted data content.

7. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 1, characterized in that, In step (6), comparing the consistency between the re-encoding result and the actual data content includes calculating the re-encoding byte consistency of the atomic tree. Specifically, the atomic tree is a local subtree with a certain internal node of the regular tree as the root and containing all its descendant nodes. The sample set covered by the atomic tree is constructed. For any candidate parameter in the leaf node, the re-encoding byte consistency of the leaf node under the candidate parameter is defined. The parameter that maximizes the consistency is selected as the optimal parameter of the leaf node under the current atomic tree structure, thereby obtaining the re-encoding byte consistency of the atomic tree.

8. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 7, characterized in that, In step (6), comparing the consistency between the re-editing result and the real data content also includes calculating the optimal re-editing byte consistency of the candidate leaf node. Specifically, the re-editing byte consistency of the leaf node on the sample set covered by the atomic tree is first defined. Then, among all candidate template families and candidate parameters, the combination that maximizes consistency is selected as the optimal result of the leaf node, and a unified template family type and its optimal parameters are determined.

9. The method for constructing a rule base for a smart meter manufacturing process scheme according to claim 8, characterized in that, In step (7), a single leaf node is used to replace the atomic tree to perform pruning, and it is determined whether the re-compilation effect can still be maintained at a level no lower than that of the current atomic tree. Specifically, if the optimal consistency of the optimal parameters of the candidate single leaf node is not less than the re-compilation byte consistency of the optimal parameters of the atomic tree, then the single leaf node is used to replace the atomic tree to perform pruning, and the final output template and parameters of the single leaf node are fixed; otherwise, the atomic tree structure is retained unchanged.

10. The method for constructing a rule base for a smart meter manufacturing process according to claim 1, characterized in that, In step (7), each internal node in the final rule tree is used to determine the conditional branch of the input sample in terms of data identifier, control code, reduction type, parameter value type, candidate length, and hexadecimal behavior. The leaf nodes no longer output template family weak labels, but store the final template and its final parameters.