A power quality monitoring terminal automatic configuration method and system supporting multiple protocols
By combining hierarchical decision trees and protocol mapping templates, the configuration difficulties of power quality monitoring terminals in multi-protocol environments are solved, achieving efficient and accurate protocol identification and automated configuration, and improving the system's adaptability and configuration efficiency.
Patent Information
- Application Number
- CN202411916643.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-12-24
AI Technical Summary
Power quality monitoring terminals are difficult to configure in multi-protocol environments, have low protocol identification efficiency, and are complex to adapt to new protocols, resulting in high complexity in system deployment and maintenance.
A multi-dimensional analysis method combining hierarchical decision trees, statistical features, and structural features is adopted. The characteristics of communication data packets are extracted by network packet capture tools, and the protocol family is identified and the specific protocol type is determined by using a preset protocol mapping template. A standard configuration instruction set is generated and automated configuration is achieved.
It achieves efficient and accurate protocol identification and automated configuration, reduces system maintenance complexity, improves configuration efficiency and accuracy, and supports the system's adaptive learning and dynamic expansion.
Smart Images

Figure CN119728505B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power quality monitoring, and in particular to a power quality monitoring terminal automatic configuration method and system supporting multiple protocols. BACKGROUND
[0002] With the continuous advancement of smart grid construction, power quality monitoring systems play an increasingly important role in power systems. As the core component of the system, power quality monitoring terminals need to interact with various monitoring platforms. Due to historical reasons and differences in application scenarios, there are multiple communication protocol standards in the power system, including IEC 60870-5-104, DNP3.0, Modbus, etc. This coexistence of multiple protocols brings great challenges to the deployment and configuration of power quality monitoring terminals.
[0003] Currently, the configuration of power quality monitoring terminals mainly has the following technical problems: First, the terminal configuration process usually requires human intervention, and the configuration personnel must be familiar with various protocol specifications, which not only increases the labor cost, but also is prone to configuration errors. Second, the existing protocol identification method is mainly based on fixed feature matching rules, which cannot effectively handle protocol variants and new versions, resulting in low protocol identification accuracy. Third, when encountering new protocol types, the system often needs manual analysis and update of configuration rules, lacking adaptive learning ability. Finally, the data conversion between different protocols lacks unified standards and automated means, increasing the complexity of system maintenance. These problems seriously restrict the large-scale deployment and efficiency improvement of power quality monitoring systems.
[0004] Therefore, there is an urgent need for a solution that can support multiple protocol automatic identification, have protocol adaptive learning ability, and realize terminal configuration automation, to improve the deployment efficiency and operation and maintenance level of power quality monitoring systems. SUMMARY
[0005] In order to solve the technical problems of power quality monitoring terminal configuration difficulty in multiple protocol environment, low protocol identification efficiency and new protocol adaptation complexity, the present application provides a power quality monitoring terminal automatic configuration method and system supporting multiple protocols.
[0006] The technical solution adopted by the present application is: a power quality monitoring terminal automatic configuration method supporting multiple protocols, characterized by comprising the following steps:
[0007] S1. Establishing a communication connection between the power quality monitoring terminal and the configuration system, obtaining the power quality monitoring terminal model identifier, MAC address, IP address and protocol version number of the power quality monitoring terminal;
[0008] S2. Capture the communication data packet of the power quality monitoring terminal by a network packet capturing tool, and extract the features of the communication data packet, including statistical features and structural features;
[0009] S3. Match the historical protocol records in the preset protocol mapping template according to the type identifier of the power quality monitoring terminal, obtain a protocol family candidate list based on the matching of the protocol version number and the version range in the terminal historical record library, and perform hierarchical identification on the statistical features by using a decision tree, wherein the decision tree matches the statistical features in sequence, and in each layer of the identification process, the current features are matched with the corresponding features of each protocol family in the protocol family candidate list stored in the preset protocol mapping template, if the current features do not match all known protocol families, it is determined that a new protocol is found, and a new protocol family category is established for the new protocol in the preset protocol mapping template, and the new protocol is stored as a new specific protocol type, including its statistical features, structural features and feature vector;
[0010] After the protocol family is identified, a protocol type feature vector is constructed based on the structural features, and cosine similarity matching is performed between the protocol type feature vector and the feature vectors of each specific protocol type in the protocol family in the preset protocol mapping template to determine the specific protocol type;
[0011] S4. Based on the specific protocol type, for a known protocol, a field definition table corresponding to the known protocol is obtained from the preset protocol mapping template, and data conversion methods such as data type conversion and byte sequence conversion are determined according to the field mapping relationship between the source protocol and the target protocol, for a newly identified protocol, an initial field definition table is generated according to the field features in the communication data packet, and a basic mapping relationship with the target protocol is established, and a standard configuration instruction set for configuring the power quality monitoring terminal is generated;
[0012] S5. The standard configuration instruction set is issued in steps, and after each configuration instruction is issued, the response of the power quality monitoring terminal is waited for, and after receiving the successful response of the power quality monitoring terminal, the communication state of the power quality monitoring terminal is verified.
[0013] The preset protocol mapping template is a database integrating the information required for protocol identification, protocol conversion and configuration instruction generation, including a terminal protocol record library, a protocol family feature library, a protocol type feature library and a protocol conversion rule library.
[0014] The further technical solution is that the features of the communication data packet in S2 include:
[0015] The statistical features include frame length mean and variance, frequency distribution of function code, data field length mean and variance, and time interval features of adjacent messages;
[0016] Extract the structure characteristics, including the identification position in the frame format, the function code position and type, the address field position in the data field, and the check mode.
[0017] Further technical solutions are that the obtaining of the protocol family candidate list in S3 specifically includes:
[0018] According to the type matching of the power quality monitoring terminal, the historical protocol record stored in the preset protocol mapping template is obtained, the first protocol family candidate list commonly used for the type is obtained, the protocol version number is matched with the version range of the corresponding protocol family stored in the terminal historical record library of the preset protocol mapping template, and the correctness of the data packet source is confirmed by comparing the consistency of the IP address and the source IP address in the communication data packet captured in S2, so as to obtain the protocol family candidate list.
[0019] Further technical solutions are that the hierarchical identification of the statistical characteristics by using the decision tree in S3 specifically includes:
[0020] In the range of the protocol family candidate list, the first layer of the decision tree matches the frame length characteristics with the corresponding candidate protocol family frame length range stored in the protocol family characteristic library of the preset protocol mapping template, the second layer of the decision tree matches the function code characteristics with the corresponding candidate protocol family function code set stored in the protocol family characteristic library, the third layer of the decision tree matches the data field characteristics with the corresponding candidate protocol family data field format stored in the protocol family characteristic library, the fourth layer of the decision tree matches the time interval characteristics with the corresponding candidate protocol family time parameter stored in the protocol family characteristic library, and whether the power quality monitoring terminal belongs to a known protocol family or a new protocol is determined according to the matching results of the four layers.
[0021] Further technical solutions are that the processing of the new protocol in S3 specifically includes:
[0022] When the four layers of the decision tree characteristics are all unmatched with the known protocol family, a new protocol family category is created in the preset protocol mapping template, the statistical characteristics of the current communication data packet are stored in the protocol family characteristic library as the characteristics of the protocol family, including the frame length range, the function code set, the data field format and the time parameter information, the structure characteristics of the current communication data packet are stored in the protocol type characteristic library after standardized processing, including the identification position, the function code position and type, the address field position and the check mode, as the first specific protocol type under the new protocol family;
[0023] The characteristic vectors of the protocol family and the specific protocol type are generated and stored, which are used for subsequent protocol identification.
[0024] The further technical scheme is characterized in that: the structure feature is further analyzed in S3 to determine the specific protocol type, and the specific protocol type comprises:
[0025] Based on the protocol family range determined by the decision tree, the same normalization processing is adopted for the structure feature and the structure feature in the protocol type feature library in the preset protocol mapping template, all position information in the structure feature is converted into an offset relative to the starting position of the frame format, and the type of the function code is converted into a unified code;
[0026] Based on the normalized structure feature, a fixed-dimension 0-1 protocol type feature vector is constructed, the corresponding position takes a value of 1 when the feature exists, and takes a value of 0 when the feature does not exist; the protocol type feature vector and the feature vector of each specific protocol type in the preset protocol mapping template in the protocol family are calculated to obtain a cosine similarity, when the cosine similarity exceeds a preset threshold, the protocol type with the highest similarity is determined as the recognition result, and the specific protocol type recognition is completed within the protocol family range determined by the decision tree.
[0027] The further technical scheme is characterized in that: the processing of the known protocol in S4 comprises:
[0028] The field definition table corresponding to the specific protocol type is read from the protocol conversion rule library in the preset protocol mapping template as a source protocol field definition, a target protocol is determined according to a configuration requirement, and the field mapping relationship of the source protocol and the target protocol is matched in the protocol conversion rule library in the preset protocol mapping template; based on the field mapping relationship, a data conversion method is determined, including data type mapping, byte sequence conversion, field extension and truncation rule, for processing the data format difference between different protocols;
[0029] According to the data conversion method, the configuration requirement is converted into a standard configuration instruction set conforming to the target protocol, including a configuration instruction of a device parameter, a communication parameter and a data acquisition rule, and a check code, a protocol identifier, address information and a frame identifier are added according to a protocol specification for encapsulation.
[0030] The further technical scheme is characterized in that: the processing of the new protocol in S4 comprises:
[0031] According to the analysis result of the communication data packet, the position, length and data type of the key field are recognized, and an initial field definition table is generated;
[0032] The recognized field is mapped with a general field of the target protocol;
[0033] A default data conversion method is adopted to generate a basic configuration instruction set, including necessary device parameter and communication parameter configuration instructions;
[0034] The generated field definition table and mapping relationship are stored in a protocol conversion rule library of the preset protocol mapping template.
[0035] Further technical solutions are as follows: the preset protocol mapping template is a database integrating protocol identification, protocol conversion, and information required for configuration instruction generation, wherein the protocol family refers to a protocol set with similar statistical characteristics, and specifically includes:
[0036] A terminal protocol record library stores a power quality monitoring terminal model and corresponding historical protocol records thereof, and version range information of a protocol family;
[0037] A protocol family feature library stores statistical characteristics of an existing protocol family, including frame length range, function code set, data field format, and time parameter information, and a feature vector of the protocol family;
[0038] A protocol type feature library stores structural characteristics of a specific protocol type, including identification position, function code position and type, address field position, and verification mode, and a feature vector of the specific protocol type;
[0039] A protocol conversion rule library stores a field definition table of a specific protocol type and field mapping relationship between protocols.
[0040] The application further discloses a power quality monitoring terminal automatic configuration system supporting multiple protocols, and has the characteristics that the system comprises:
[0041] A communication module: used for establishing a communication connection between the power quality monitoring terminal and the configuration system, and acquiring a model identifier, a MAC address, an IP address, and a protocol version number of the power quality monitoring terminal;
[0042] A feature extraction module: used for capturing a communication data packet of the power quality monitoring terminal through a network packet capturing tool, and extracting feature information of the communication data packet;
[0043] A protocol identification module: used for matching the preset protocol mapping template according to the model identifier and the protocol version number, and identifying a protocol family and determining a specific protocol type based on the feature information;
[0044] A configuration instruction module: used for acquiring a field definition and a conversion rule from the preset protocol mapping template according to the specific protocol type, and generating a standard configuration instruction set;
[0045] An execution module: used for issuing the standard configuration instruction set in steps and verifying a configuration result.
[0046] The application has the following beneficial effects:
[0047] (1) The application adopts a multi-dimensional analysis method of layered decision tree combined with statistical characteristics and structural characteristics, realizes efficient and accurate protocol recognition. The method analyzes the frame length, function code, data field and time interval characteristics through four-layer decision tree step by step, so that the protocol recognition accuracy is significantly improved. Especially in dealing with complex protocol variants, the system can still maintain stable recognition performance, effectively solving the problem of low protocol recognition efficiency in traditional methods.
[0048] (2) The protocol mapping template system designed in the application establishes a complete protocol information management framework. Through the hierarchical design of the terminal protocol record library, the protocol family feature library, the protocol type feature library and the protocol conversion rule library, the system realizes accurate positioning and efficient management of protocol characteristics. This systematic design not only improves the flexibility of protocol recognition, but also greatly reduces the complexity of system maintenance, providing reliable guarantee for the continuous expansion of the protocol library.
[0049] (3) The application introduces an intelligent new protocol processing mechanism, giving the system autonomous learning ability. When the system encounters unknown protocols, it can automatically analyze the characteristics, establish the mapping relationship and generate the configuration template, realizing the dynamic expansion of the protocol library. This adaptive mechanism significantly improves the versatility of the system, enabling it to continuously adapt to the development of communication protocols, effectively reducing the system maintenance cost.
[0050] (4) The application realizes the full-process automation of power quality monitoring terminal configuration. Through the standardized configuration process and intelligent protocol conversion mechanism, the system can automatically complete the whole process from protocol recognition to instruction issuing, avoiding errors that may be caused by manual intervention, significantly improving the configuration efficiency and accuracy. This technical innovation provides strong support for the large-scale deployment of power quality monitoring systems. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1 Flow chart of power quality monitoring terminal automatic configuration method.
[0052] Figure 2 Flow chart of configuration instruction generation. DETAILED DESCRIPTION
[0053] As Figure 1 shown, the main steps of the method provided by the application are as follows:
[0054] S1: Establish communication connection between power quality monitoring terminal and configuration system, obtain model identifier, MAC address, IP address and protocol version number of power quality monitoring terminal;
[0055] S2: Capture communication data packet of power quality monitoring terminal through network packet capture tool, extract characteristics of communication data packet, including statistical characteristics and structural characteristics;
[0056] S3: According to the power quality monitoring terminal model identifier, match the preset protocol mapping template, use decision tree for hierarchical identification to determine the protocol family, and determine the specific protocol type through feature vector matching;
[0057] S4: Generating a standard configuration instruction set based on the specific protocol type;
[0058] S5: Step-by-step issuing of the standard configuration instruction set and verification of the configuration result.
[0059] As a preferred embodiment of the present application, in step S1, the specific process of establishing a communication connection and obtaining terminal information is as follows:
[0060] S101: The configuration system discovers the power quality monitoring terminal device in the local network through network scanning, and obtains its IP address and MAC address. Specifically, TCP / IP protocol is used for network scanning, and ICMP protocol is used to send probe packets. The IP addresses that receive responses are recorded.
[0061] S102: The configuration system sends a connection request to the discovered terminal device, and establishes a reliable communication connection using TCP protocol. Preferably, the system will manage the timeout of the connection. If no terminal response is received within the preset time (usually 30 seconds), the connection request will be reinitiated, with a maximum of 3 retries.
[0062] S103: After successfully establishing a communication connection, the configuration system sends an identity authentication request to the terminal, and the terminal needs to return its model identifier, device serial number and other basic information. The system verifies the legality of the received information to ensure the integrity and accuracy of the data.
[0063] S104: The configuration system parses the information packet returned by the terminal, extracts the model identifier, and queries the local device type database according to the model identifier to obtain the protocol version number range supported by the terminal of this model. At the same time, the system will record the online status and communication parameters of the terminal.
[0064] S105: The configuration system maintains a heartbeat connection with the terminal and sends heartbeat packets regularly to detect the terminal status. Preferably, if the terminal's heartbeat response is not received for three consecutive times, the system will mark the terminal as offline and record the relevant information in the log.
[0065] As a preferred embodiment of the present application, in step S2, the specific process of capturing the communication data packet of the power quality monitoring terminal through the network packet capture tool and extracting the features is as follows:
[0066] S201: Start the network packet capturing tool, set the packet capturing filter rule, set the filter condition as the bidirectional communication data packet related to the IP address of the power quality monitoring terminal, preferably, set the packet capturing time window as 5 minutes, and ensure that enough communication data samples are obtained.
[0067] S202: Preprocess the captured communication data packet, eliminate the damaged data packet and the repeated data packet, and sort the data packet in time sequence, so as to prepare for subsequent feature extraction.
[0068] S203: Extract the statistical features of the communication data packet, calculate the mean value of the frame length of all data packets, count the standard deviation of the frame length, establish the distribution characteristics of the frame length, count the frequency of the function code in the data packet, generate a function code frequency distribution histogram, calculate the mean value and variance of the data field length, analyze the change rule of the data field length, calculate the time interval of adjacent messages, and obtain the minimum interval, the maximum interval and the average interval and other time characteristics.
[0069] S204: Extract the structure features of the communication data packet, specifically including: analyzing the data frame format, locating and recording the positions of the frame start identifier and the frame end identifier; locating the position of the function code in the data field, identifying the type and coding method of the function code; determining the position and length of the address field, including the source address and target address information; identifying the verification method of the data packet, including the positions and calculation methods of the verification fields such as checksum, CRC verification, etc.
[0070] S205: Standardize the extracted statistical features and structure features to generate a feature data set. For statistical features, normalization processing is adopted to make each feature value fall within the interval [0, 1]; for structure features, the field position information is converted into an offset relative to the frame start position.
[0071] S206: The processed feature data set is input to the subsequent protocol identification module for identification of the protocol family and judgment of the specific protocol type.
[0072] As a preferred embodiment of the application, in step S3, the specific process of protocol identification according to the terminal information and communication features is as follows:
[0073] S301: Based on the model identifier of the power quality monitoring terminal, matching is performed in the terminal protocol record library of the preset protocol mapping template to obtain the protocol record used by the terminal of this model in history, and a preliminary protocol family candidate list is formed. At the same time, the protocol version number obtained is compared with the version range of each protocol family stored in the terminal historical record library, and the protocol family with a matching version number is screened out. By comparing the terminal IP address with the source IP address in the captured communication data packet, the correctness of the data packet source is verified, and finally the protocol family candidate list is determined.
[0074] S302: A four-layer decision tree model is constructed for hierarchical identification of the statistical features of the communication data packet. Within the determined protocol family candidate list range, the decision tree performs feature matching according to the following layers:
[0075] The first layer: The frame length mean and variance are matched with the frame length range stored in the protocol family feature library in the preset protocol mapping template.
[0076] The second layer: The function code frequency distribution is matched with the function code set stored in the protocol family feature library.
[0077] The third layer: The data field length feature is matched with the data field format stored in the protocol family feature library.
[0078] The fourth layer: The message time interval feature is matched with the time parameter stored in the protocol family feature library.
[0079] S303: According to the results of the four-layer matching of the decision tree, it is determined whether the current protocol belongs to a known protocol family or a new protocol. When the four-layer features do not match the known protocol family, a new protocol family category is created in the preset protocol mapping template, and the statistical features of the current communication data packet are stored as the features of the protocol family in the protocol family feature library, including the generation and storage of the feature vector.
[0080] S304: For the identified protocol family, its structural features are further analyzed to determine the specific protocol type. First, the structural features are normalized, all position information is converted into offset relative to the starting position of the frame format, and the coding mode of the function code is unified. Then, based on the normalized structural features, a fixed-dimension 0-1 protocol type feature vector is constructed.
[0081] S305: The constructed protocol type feature vector is calculated for the cosine similarity with the feature vectors of each specific protocol type in the protocol family in the preset protocol mapping template. Preferably, the similarity threshold is set to 0.85, and when the calculated cosine similarity exceeds the threshold, the protocol type with the highest similarity is selected as the identification result.
[0082] S306: For the newly identified protocol, its structural features are normalized and stored in the protocol type feature library, including the identification position, function code position and type, address field position, and verification method information, and a feature vector is generated as the first specific protocol type under the new protocol family.
[0083] As a preferred embodiment of the present application, refer to Figure 2 In step S4, the specific process of generating a standard configuration instruction set according to the protocol identification result is as follows:
[0084] S401: For the identified known protocol, read the corresponding field definition table from the protocol conversion rule library of the preset protocol mapping template, which contains the detailed information of the name, position, length, data type, etc. of each field in the source protocol. According to the system configuration requirements, determine the target protocol type, and find the field mapping relationship between the source protocol and the target protocol in the protocol conversion rule library.
[0085] S402: Based on the field mapping relationship, formulate a data conversion scheme. Specifically, it includes: determining the data type conversion rule to handle the data type difference between different protocols; determining the byte sequence conversion method to solve the byte sequence difference of different protocols; formulating the field extension and truncation rule to handle the field length mismatch; establishing the numerical range mapping relationship to ensure the data conversion within the valid range.
[0086] S403: For the newly identified protocol, generate an initial field definition table by analyzing the structure of the communication data packet. The process includes: identifying the position and length of the key field; inferring the data type of each field; establishing the semantic association of the field; determining the valid value range of the field.
[0087] S404: Map the fields of the new protocol with the general fields of the target protocol to establish a preliminary conversion relationship. Preferentially match the fields related to basic configuration, including but not limited to device address, communication parameter, sampling rate, etc. Key configuration items. For the fields that cannot establish a direct mapping relationship, use default value or reserved field processing.
[0088] S405: According to the configuration requirements and conversion rules, generate a standard configuration instruction set. For known protocols, the configuration instruction set includes: device basic parameter configuration instruction; communication parameter configuration instruction; data acquisition rule configuration instruction; alarm threshold configuration instruction; system time synchronization instruction.
[0089] S406: Standardize and encapsulate the generated configuration instructions, and add necessary protocol elements: add protocol identifier; calculate and add check code; fill in address information; add frame identifier; adjust the byte sequence according to the protocol specification.
[0090] S407: For new protocols, store the generated field definition table and mapping relationship in the protocol conversion rule library of the preset protocol mapping template, which is used for subsequent configuration of similar terminals. At the same time, establish a feedback mechanism for the execution effect of the configuration instruction, which is used to verify and optimize the conversion rule.
[0091] As a preferred embodiment of the present application, in step S5, the specific process of issuing the standard configuration instruction set step by step and verifying the configuration result is as follows:
[0092] S501: Prioritizes the standard configuration instruction set based on the dependencies of the configuration instructions. Basic communication parameter configuration is given the highest priority, followed by basic device parameter configuration, then data acquisition rule configuration, and finally advanced function configuration, ensuring the orderly and reliable nature of the configuration process.
[0093] S502: Establish a configuration status management mechanism to record the execution status and response results of each configuration command. Status information includes command number, sending time, response time, execution result code, and response data. The system uses this mechanism to track configuration progress in real time and handle configuration anomalies promptly.
[0094] S503: Configuration commands are issued one by one according to priority. After each configuration command is sent, the system enters a waiting state. Preferably, the response timeout is set to 3 seconds. During the waiting period, the system continuously monitors the terminal's response information until a response data is received or the timeout period is reached.
[0095] S504: Parse and verify the response data returned by the terminal. Verification includes: the completeness and correctness of the response data; the validity of the response code; the consistency between the read-back values and the sent values of the configuration parameters; and the compliance of communication quality indicators.
[0096] S505: Preferably, based on the verification results, the system takes corresponding processing measures:
[0097] If the verification passes, update the configuration status record and continue to execute the next configuration command;
[0098] If verification fails, initiate the exception handling process: record the reason for failure; attempt to resend the current command, retrying up to 3 times; if it still fails after retrying, terminate the configuration process and generate a fault diagnosis report.
[0099] S506: Preferably, after issuing all configuration commands, the system performs a comprehensive verification of the terminal communication status. Verification items include: the stability of the communication connection; the real-time performance of data transmission; the accuracy of data acquisition; and the effectiveness of the alarm function.
[0100] As a preferred embodiment of the present invention, the preset protocol mapping template is an integrated database system, and its specific implementation process is as follows:
[0101] Construction and maintenance of terminal protocol library: The terminal protocol library adopts a relational database structure to establish a mapping relationship between the type of power quality monitoring terminal and its historical use protocol. Each record contains the terminal type identifier, the list of historical protocol families used, the version range information of each protocol family, the use time period, and the use frequency statistics. The system continuously updates the records based on the actual use of the terminal to ensure the timeliness of the data. When a new protocol is found to be used by the terminal, the corresponding entry is automatically added to the library.
[0102] Organization and update of protocol family feature library: The protocol family feature library uses a multi-dimensional feature matrix storage structure to record the statistical feature information of each protocol family. For each protocol family, the system maintains its feature vector, which includes the statistical distribution parameters of frame length, the frequency table of function code, the data field format description, and the time parameter characteristics. The feature library supports dynamic expansion to accommodate the feature storage needs of newly added protocol families. Through real-time learning mechanisms, the system continuously optimizes and updates the feature parameters based on the accumulation of communication data, improving the representativeness of the features.
[0103] Establishment and expansion of protocol type feature library: The protocol type feature library uses a hierarchical storage structure to save the structural feature information of specific protocol types. Each feature record of a protocol type includes the location and format of the protocol identifier, the location and type of the function code, the distribution characteristics of the address field, and the verification method. The system converts various structural features into standardized feature vectors through standardized processing, facilitating subsequent similarity calculations and protocol identification. For newly discovered protocol types, the system automatically creates new feature records and establishes associations with existing protocols.
[0104] Implementation and management of protocol conversion rule library: The protocol conversion rule library uses a graph structure to store the conversion rules between protocols, including field definition tables and field mapping relationships. The field definition table records the field attributes of each protocol in detail, including field name, data type, length limit, valid value range, etc. The field mapping relationship describes the correspondence between fields in different protocols, including data type conversion rules, byte order processing methods, and numerical range mapping. The system supports dynamic addition and update of rules to ensure the completeness and accuracy of the conversion rules.
[0105] Preferably, the system establishes a strict data consistency maintenance mechanism to ensure the synchronization and association of data between the four sub-libraries. When any sub-library is updated, the system automatically checks and updates the associated data records to maintain data integrity. At the same time, the system implements a version control mechanism to record the change history of templates, supporting data rollback and audit tracking.
[0106] Preferably, the preset protocol mapping template implements a multi-level access control mechanism to limit data access and modification operations according to user permissions. The system uses a transaction processing mechanism to ensure data consistency in concurrent access situations. At the same time, a data caching mechanism is implemented to improve the response speed of frequently accessed data.
[0107] Preferably, the system establishes a complete data backup mechanism, regularly backs up template data, and saves incremental update records. In the event of data anomalies, it can quickly recover to the most recent correct state, ensuring the reliability of the system and the security of the data.
Claims
1. A method for supporting automatic configuration of a power quality monitoring terminal supporting multiple protocols, characterized in that, The method comprises the following steps: S1. Establishing a communication connection between the power quality monitoring terminal and the configuration system, obtaining the power quality monitoring terminal model identifier, MAC address, IP address, and protocol version number of the power quality monitoring terminal; S2. Capturing the communication data packet of the power quality monitoring terminal through a network packet capture tool, and extracting the features of the communication data packet, including statistical features and structural features; S3. Matching the power quality monitoring terminal model identifier with the historical protocol records in the preset protocol mapping template, and matching the protocol version number with the version range in the terminal historical record library to obtain a protocol family candidate list. A decision tree is used to perform hierarchical identification on the statistical features. The decision tree matches the current features with the corresponding features of each protocol family in the protocol family candidate list stored in the preset protocol mapping template in sequence. If none of the known protocol families matches, it is determined that it is a new protocol, and a new protocol family category is established for the new protocol in the preset protocol mapping template, which is stored as a new specific protocol type, including its statistical features, structural features, and feature vector; After completing the protocol family identification, a protocol type feature vector is constructed based on the structural features, and cosine similarity matching is performed between the protocol type feature vector and the feature vectors of each specific protocol type in the protocol family in the preset protocol mapping template to determine the specific protocol type; S4. Based on the specific protocol type, for known protocols, the corresponding field definition table is obtained from the preset protocol mapping template, and the data type conversion and byte sequence conversion data conversion method is determined according to the field mapping relationship between the source protocol and the target protocol. For newly identified protocols, an initial field definition table is generated based on the field features in the communication data packet, and a basic mapping relationship with the target protocol is established to generate a standard configuration instruction set for configuring the power quality monitoring terminal; S5. The standard configuration instruction set is issued in steps, and after issuing each configuration instruction, the response of the power quality monitoring terminal is waited for, and after receiving the successful response of the power quality monitoring terminal, the communication state is verified; The preset protocol mapping template is a database that integrates the information required for protocol identification, protocol conversion, and configuration instruction generation, including a terminal protocol record library, a protocol family feature library, a protocol type feature library, and a protocol conversion rule library.
2. The method of claim 1, wherein the method further comprises: The feature extraction of the communication data packet in S2 includes: Extracting statistical features, including frame length mean and variance, frequency distribution of function code, data field length mean and variance, and adjacent message time interval features; Extracting structural features, including identification position in frame format, function code position and type in data field, address field position, and verification method.
3. The method of claim 1, wherein the method further comprises: The protocol family candidate list obtained in S3 specifically includes: According to the type of the power quality monitoring terminal, historical protocol records stored in a preset protocol mapping template are matched to obtain a first protocol family candidate list commonly used for the type, the protocol version number is matched with a version range of a corresponding protocol family stored in a terminal historical record library of the preset protocol mapping template, and correctness of a data packet source is confirmed by comparing the IP address with a source IP address in the communication data packet captured by S2 to obtain a protocol family candidate list.
4. The method of claim 1, wherein the method further comprises: The hierarchical identification of the statistical features by the decision tree in S3 specifically includes: Within the range of the protocol family candidate list, the decision tree first layer matches the frame length feature with a corresponding candidate protocol family frame length range stored in a protocol family feature library of the preset protocol mapping template, the decision tree second layer matches the function code feature with a corresponding candidate protocol family function code set stored in the protocol family feature library, the decision tree third layer matches the data field feature with a corresponding candidate protocol family data field format stored in the protocol family feature library, and the decision tree fourth layer matches the time interval feature with a corresponding candidate protocol family time parameter stored in the protocol family feature library, and whether the power quality monitoring terminal belongs to a known protocol family or a new protocol is determined according to matching results of the four layers.
5. The method of claim 1, wherein the method further comprises: The processing of the new protocol in S3 specifically includes: When the four-layer features of the decision tree do not match any known protocol family, a new protocol family category is created in the preset protocol mapping template, and statistical features of the current communication data packet are stored in a protocol family feature library as features of the protocol family, including a frame length range, a function code set, a data field format, and a time parameter; After the structure features of the current communication data packet are normalized, the structure features are stored in a protocol type feature library, including an identification position, a function code position and type, an address field position, and a verification mode, as a first specific protocol type under the new protocol family; A feature vector of the protocol family and the specific protocol type is generated and stored for subsequent protocol identification.
6. The method of claim 1, wherein the method further comprises: The further analysis of the structure features to determine the specific protocol type in S3 specifically includes: Based on the protocol family range determined by the decision tree, the same normalization processing is performed on the structure features and structure features in a protocol type feature library in the preset protocol mapping template, all position information in the structure features is converted into an offset relative to a starting position of the frame format, and the type of the function code is converted into a unified code; Based on the normalized structure features, a fixed-dimension 0-1 protocol type feature vector is constructed, a corresponding position takes a value of 1 when the feature exists, and a value of 0 when the feature does not exist; the protocol type feature vector is calculated with a feature vector of each specific protocol type in the protocol family stored in the preset protocol mapping template to obtain a cosine similarity, when the cosine similarity exceeds a preset threshold, a protocol type with the highest similarity is determined as an identification result, and the identification of the specific protocol type is completed within the protocol family range determined by the decision tree.
7. The method of claim 1, wherein the method further comprises: The processing of the known protocol in S4 specifically includes: reading a field definition table corresponding to the specific protocol type from a protocol conversion rule library in the preset protocol mapping template as a source protocol field definition, and determining a target protocol according to a configuration requirement, and matching a field mapping relationship between the source protocol and the target protocol in the protocol conversion rule library in the preset protocol mapping template; determining a data conversion method based on the field mapping relationship, including data type mapping, byte sequence conversion, field extension and truncation rules, for processing data format differences between different protocols; converting the configuration requirement into a standard configuration instruction set conforming to the target protocol according to the data conversion method, including configuration instructions of device parameters, communication parameters and data acquisition rules, and encapsulating by adding a check code, a protocol identifier, address information and a frame identifier according to a protocol specification.
8. The method of claim 1, wherein the method further comprises: The processing of the new protocol in the S4 specifically includes: generating an initial field definition table according to a result of analyzing the communication data packet, identifying a position, a length and a data type of a key field; performing basic mapping of the identified field and a general field of the target protocol; generating a basic configuration instruction set by using a default data conversion method, including necessary device parameter and communication parameter configuration instructions; storing the generated field definition table and the mapping relationship in a protocol conversion rule library of the preset protocol mapping template.
9. The method of claim 1 to 8, wherein, The preset protocol mapping template is a database integrating information required for protocol identification, protocol conversion and configuration instruction generation, wherein a protocol family refers to a protocol set with similar statistical characteristics, and specifically includes: a terminal protocol record library storing a power quality monitoring terminal model and corresponding historical protocol records thereof, and version range information of a protocol family; a protocol family feature library storing statistical characteristics of an existing protocol family, including a frame length range, a function code set, a data field format and time parameter information, and a characteristic vector of the protocol family; a protocol type feature library storing structural characteristics of a specific protocol type, including an identifier position, a function code position and type, an address field position and a check mode, and a characteristic vector of the specific protocol type; a protocol conversion rule library storing a field definition table of a specific protocol type and a field mapping relationship between protocols.
10. A multi-protocol supported power quality monitoring terminal auto-configuration system applying the method of claim 1, characterized in that, including: a communication module for establishing a communication connection between the power quality monitoring terminal and a configuration system, and acquiring a model identifier, a MAC address, an IP address and a protocol version number of the power quality monitoring terminal; a feature extraction module for capturing a communication data packet of the power quality monitoring terminal by a network packet capturing tool, and extracting characteristic information of the communication data packet; a protocol identification module for matching a preset protocol mapping template according to the model identifier and the protocol version number, and identifying a protocol family and determining a specific protocol type based on the characteristic information; a configuration instruction module for acquiring a field definition and a conversion rule from the preset protocol mapping template according to the specific protocol type, and generating a standard configuration instruction set; an execution module for sequentially issuing the standard configuration instruction set and verifying a configuration result.
Citation Information
Patent Citations
Industrial communication multi-protocol conversion system
CN114222009A
Edge IOT multi-protocol intelligent terminal manufacturing system based on OPC object link
CN117579647A