A distributed energy protocol converter simulation detection method

By establishing communication behavior profiles and using active protocol probes, the interface protocols of protocol converters are automatically identified and compared, solving the problems of cumbersome manual configuration and low efficiency in anomaly location in existing technologies, and realizing efficient and accurate detection of distributed energy protocol converters.

CN123185090APending Publication Date: 2026-11-27STATE GRID JIANGSU ELECTRIC POWER CO LTD TAIZHOU POWER SUPPLY BRANCH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611439340.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies rely on manual configuration of protocol parameters in the detection of distributed energy protocol converters, resulting in a large workload and difficulty in accurately associating messages before and after conversion. Furthermore, the efficiency of anomaly location is low, and the detection is cumbersome, especially in scenarios involving multiple manufacturers, models, and protocols.

Method used

By establishing communication behavior profiles, setting up bypass message capture nodes, using active protocol probes and unified time base recording, the interface protocol is automatically identified, and messages are collected from multiple locations for semantic and temporal comparison to determine protocol compatibility and abnormal link segments.

Benefits of technology

It reduces the workload of manual configuration, improves the automation level and anomaly detection efficiency of the protocol converter, ensures the accuracy and comprehensiveness of the detection results, and is suitable for conversion detection between heterogeneous protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123185090A_ABST
    Figure CN123185090A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of electric power communication and communication protocol simulation detection, and discloses a distributed energy protocol converter simulation detection method. The method establishes a communication behavior image including a protocol identification sub-image and a conversion mapping sub-image, sets a multi-position bypass message capture node among a source side simulation node, a to-be-tested protocol converter and a target side simulation node, respectively identifies a source interface protocol and a target interface protocol, and uses an active protocol probe to confirm an interface that cannot be uniquely determined; generates a test transaction according to the source and target interface protocols and a conversion direction, converts messages before and after the test transaction when there is no inheritable transaction identifier, and compares semantics and timing to obtain protocol compatibility, semantic conversion consistency, data acquisition reliability and end-to-end processing delay, and simultaneously determine a first inconsistent link section. The present application can improve the automation degree of multi-protocol converter detection, the accuracy of cross-protocol message association and the efficiency of abnormal positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of power communication and communication protocol simulation and testing technology, and discloses a simulation and testing method for distributed energy protocol converters. Background Technology

[0002] With the large-scale integration of distributed photovoltaic (PV) and distributed energy storage devices, data acquisition and control command exchange are required between these devices and the dispatching master station, energy management platform, and monitoring terminals. Due to differences in communication protocols, message structures, data point addresses, data encoding methods, and communication timing among different manufacturers and device models, protocol converters are typically used in engineering sites to parse different communication protocols, map data points, and convert messages. The protocol compatibility, data conversion accuracy, and response timeliness of these converters directly affect the normal uploading of operational data from distributed energy devices and the correct issuance of control commands.

[0003] Before a protocol converter is put into field use, it is usually necessary to use a simulation master station, equipment simulation software, or dedicated testing equipment to test the protocol converter's communication connection, data point mapping, telemetry data conversion, remote signaling status transition, and control response. Existing testing methods often involve manually configuring communication addresses, data point tables, communication rates, and message parameters according to pre-determined source and target protocols. Test personnel then send test messages item by item and verify the output results after protocol conversion. This testing method can complete basic functional verification when the number of devices under test and protocol types is small. However, when there are many models of distributed energy devices, inconsistent protocol versions, or frequently changing test scenarios, it requires repeated protocol parameter configuration and test environment adjustments, making the testing process cumbersome and susceptible to errors from manual configuration and comparison.

[0004] Patent CN114401323A discloses a substation communication protocol full mapping analysis simulation conversion device, comprising a file parsing module, an equipment simulation module, a protocol conversion module, a signal receiving module, a transmit / receive information comparison module, and a comparison result generation module. This device simulates IED devices within a substation by parsing an SCD file, converting the parsed information into 104 protocol point table information, receiving 104 protocol information output from remote control equipment, and comparing transmit and receive data based on SOE time stamps and address information to generate a comparison report. This prior art can improve the efficiency of remote control signal verification in fixed protocol mapping scenarios and can be considered a similar prior art to this application.

[0005] However, the aforementioned existing technologies are mainly aimed at mapping detection between pre-defined IEC 61850 and IEC 60870-5-104 protocols, requiring SCD files and preset point tables as the basis for testing. When the input protocol, output protocol, or specific protocol version of the converter under test is not yet clear, existing devices cannot automatically determine the matching communication protocol based on the messages from the interface under test, nor do they provide a mechanism to further confirm the target protocol by sending protocol-specific test messages when multiple candidate protocols have similar characteristics. Therefore, in distributed energy testing scenarios with multiple manufacturers, models, and protocols, manual selection of protocol types and configuration of corresponding test parameters are still required.

[0006] Meanwhile, existing technologies typically determine the correctness of the conversion based on the final comparison between the simulated transmitted data and the output data of the protocol converter. This lacks correlation detection of messages at the source-side simulation node, the input side of the protocol converter under test, the output side of the protocol converter under test, and the target-side simulation node. When inconsistencies are detected in data point values, quality indicators, message timing, or response results, it is difficult to further determine whether the anomaly occurred during test message transmission, source protocol reception, protocol parsing, data point mapping, data conversion, target protocol encapsulation, or output forwarding. This requires testers to retrieve communication records from different nodes and check each segment, resulting in low anomaly localization efficiency.

[0007] Furthermore, the identification features of different protocols include not only frame headers, frame lengths, function codes, and address fields, but also communication behaviors such as message exchange order, heartbeat cycles, response timeouts, and retransmission rules. Protocol conversion detection also requires combining the source interface protocol, the target interface protocol, and the semantic mapping relationship between their data points to determine whether the semantics of data point identifiers, values, quality identifiers, and time information are consistent before and after the conversion. Existing detection devices lack a unified organization and invocation mechanism for the aforementioned protocol identification features, cross-protocol mapping relationships, and detection scenario parameters. This makes it difficult to automatically generate corresponding test transactions based on the detection object and to perform correlated detection under different communication scenarios such as network latency, packet loss, message duplication, or response timeouts.

[0008] Therefore, there is a need to provide a simulation detection method for distributed energy protocol converters, which can reduce manual protocol configuration while automatically determining the protocol to be tested, comparing the correlation of messages before and after conversion, and locating abnormal link segments, thereby improving the automation level, detection accuracy, and anomaly investigation efficiency of multi-protocol converter detection. Summary of the Invention

[0009] The present invention aims to solve the problems of existing distributed energy protocol converter detection process, such as reliance on manual determination of communication protocol, large workload of test parameter configuration, difficulty in accurately correlating messages before and after protocol conversion, and difficulty in locating specific abnormal link segments after detecting anomalies.

[0010] To achieve the above objectives, the present invention provides a simulation and testing method for distributed energy protocol converters, comprising the following steps:

[0011] S1. Obtain interface specification samples of distributed energy devices and establish a communication behavior profile, which includes a specification identification sub-profile and a transformation mapping sub-profile.

[0012] S2 connects the protocol converter under test between the source-side simulation node and the target-side simulation node, sets up bypass message capture nodes at multiple locations on the communication link, and records the node identifier and timestamp of the captured message based on a unified time base.

[0013] S3. Candidate protocols are determined based on the source-side interface message and the target-side interface message of the protocol converter under test, respectively. For interfaces whose interface protocols cannot be uniquely determined, an active protocol probe is generated based on the active protocol probe template in the corresponding protocol identification sub-profile, and the source interface protocol and the target interface protocol are determined based on the response results.

[0014] S4. Load the corresponding transformation mapping sub-portfolio according to the source interface specification, target interface specification and specification transformation direction, generate test transactions according to the preset detection scenario, and associate the captured messages obtained by each message capture node before and after the specification transformation of the same test transaction.

[0015] S5, based on the semantic mapping relationship and timing constraints of the data points in the transformation mapping sub-portfolio, performs semantic and temporal comparisons on the associated captured messages, determines the protocol compatibility, semantic transformation consistency, data acquisition reliability and end-to-end processing latency, and determines the first inconsistent link segment according to the message transmission order, and outputs the detection results and anomaly location results.

[0016] The beneficial effects of this invention are as follows:

[0017] 1. This invention organizes the frame structure, protocol feature fields, communication timing, and active protocol probes required for protocol identification into a protocol identification sub-portfolio, and organizes the source interface protocol, target interface protocol, and the semantic mapping relationship of data points between them into a conversion mapping sub-portfolio, so that detection parameters from different manufacturers, different models, and different conversion directions can be stored and called in a unified structure, reducing the workload of repetitive configuration.

[0018] 2. The present invention performs passive candidate protocol screening on the source-side interface and the target-side interface respectively. When the interface protocol cannot be uniquely determined by the interface message alone, an active protocol probe with protocol differentiation capability is sent according to the interface communication role without changing the device operating state. This can reduce misidentification caused by similar frame structure, protocol encapsulation or protocol version differences.

[0019] 3. This invention collects messages at multiple locations on the communication link and records node identifiers and timestamps based on a unified time base, enabling multiple messages of the same test transaction before and after protocol conversion to be accurately associated, avoiding information loss caused by making single-point judgments based solely on the final output message;

[0020] 4. This invention performs unified semantic comparison of data point identifiers, values, status and quality identifiers in different protocols through data point semantic mapping relationship, without relying on the source protocol message and the target protocol message having the same frame structure or the same data point address, and can be applied to the conversion detection between heterogeneous protocols.

[0021] 5. By comparing the associated messages at adjacent message capture nodes, this invention can identify the first inconsistent link segment and pinpoint the protocol conversion anomaly to specific processing stages such as receiving, parsing, mapping, conversion, encapsulation, or forwarding, thereby reducing the workload of manually retrieving communication records segment by segment and investigating anomalies.

[0022] 6. This invention can automatically detect protocol compatibility, semantic conversion consistency, data acquisition reliability, and end-to-end processing latency in normal communication scenarios and various abnormal communication scenarios, so that the detection results can more comprehensively reflect the operating performance of the protocol converter in the actual communication environment. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating the overall method of the present invention;

[0024] Figure 2 This is a schematic diagram of the multi-node link deployment of the present invention;

[0025] Figure 3 This is a schematic diagram illustrating the communication behavior of the present invention;

[0026] Figure 4 This is a schematic diagram of the active reduction probe verification of the present invention;

[0027] Figure 5 This is a schematic diagram of the test transactions and message associations of the present invention;

[0028] Figure 6 This is a schematic diagram illustrating the location of abnormal link segments according to the present invention. Detailed Implementation

[0029] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] Reference Figures 1-6 This invention discloses a simulation and testing method for distributed energy protocol converters, comprising the following steps:

[0031] S1, Obtain interface protocol samples of distributed energy devices and establish a communication behavior profile, which includes a protocol identification sub-profile and a transformation mapping sub-profile;

[0032] S2, connect the protocol converter under test between the source-side simulation node and the target-side simulation node, set up bypass message capture nodes at multiple locations on the communication link, and record the node identifier and timestamp of the captured message based on a unified time base;

[0033] S3, determine candidate protocols based on source-side interface messages and target-side interface messages respectively; for interfaces whose interface protocols cannot be uniquely determined, generate active protocol probes based on the active protocol probe template in the protocol identification sub-profile, and determine the source interface protocol and target interface protocol based on the response results;

[0034] S4. Load the corresponding transformation mapping sub-portfolio according to the source interface specification, target interface specification and specification transformation direction, generate test transactions according to the preset detection scenario, and associate the captured messages obtained by each message capture node before and after the specification transformation of the same test transaction.

[0035] S5, based on the semantic mapping relationship and timing constraints of the data points in the transformation mapping sub-portfolio, performs semantic and temporal comparisons on the associated captured messages, determines the protocol compatibility, semantic transformation consistency, data acquisition reliability and end-to-end processing latency, and determines the first inconsistent link segment according to the message transmission order, and outputs the detection results and anomaly location results.

[0036] In one embodiment, this embodiment uses a source-side simulation node, a protocol converter under test, a target-side simulation node, a packet capture node, a unified clock source, a network state simulation unit, and a detection control terminal to form a simulation detection environment.

[0037] The source-side simulation node is used to simulate distributed photovoltaic inverters, energy storage converters, energy storage battery management devices, electricity meters, or data acquisition devices. It generates source-side test messages based on the protocol identification sub-profile and conversion mapping sub-profile of the source interface protocol. The target-side simulation node is used to simulate the dispatch master station, energy management platform, or aggregation terminal. It receives and parses the target interface protocol messages output by the converter of the protocol under test, and generates corresponding response messages in the control-type test transactions.

[0038] The protocol converter under test (PDT) is connected between the source-side emulation node and the target-side emulation node. For Ethernet protocols, the source-side emulation node, the DDT, and the target-side emulation node are connected via a switching network; for serial protocols, a serial interface conversion board or serial server is used to establish the corresponding link. The network status simulation unit is connected in series in the link where network impairments need to be applied, and is used to set parameters such as transmission delay, jitter, packet loss, duplication, out-of-order delivery, or connection interruption.

[0039] In a preferred embodiment, four message capture nodes are set up according to the message transmission order:

[0040] The first message capture node is set at the message sending end of the source-side simulation node;

[0041] The second message capture node is set on the input side of the protocol converter under test;

[0042] The third message capture node is set on the output side of the protocol converter under test;

[0043] The fourth message capture node is set at the message receiving end of the target-side simulation node.

[0044] When site conditions are limited, any three of the four packet capture nodes mentioned above can be set, but at least the input and output sides of the protocol converter under test should be covered. For Ethernet links, bypass capture can be implemented through network splitters, switch mirror ports, or promiscuous mode of the network interface card; for serial links, bypass capture can be implemented through high-impedance listening interfaces. Each capture node only reads online packets, does not insert trace fields into the original packets, and does not change the frame length, checksum field, or payload content of the original packets.

[0045] Each message capture node is connected to a unified clock source. This unified clock source can be a single hardware clock, a precise time synchronization protocol, or a calibrated software clock. Before detection begins, the detection control terminal sends a synchronization calibration command to each capture node, records the clock deviation between nodes, and compensates for it. Preferably, the calibrated timestamp error of each capture node is less than one-tenth of the minimum delay threshold to be measured. For example, when the minimum decision resolution for the end-to-end processing delay to be measured is 1 ms, the timestamp error between nodes is controlled within 0.1 ms.

[0046] Each capture record includes at least: a tracking identifier, a node identifier, an interface identifier, a communication direction, a capture timestamp, the original message, a parsing result, and a parsing status. The tracking identifier is assigned to the capture record by the detection control terminal and is stored only as associated metadata in the detection database; it is not written to the original message transmitted online. The node identifier indicates whether the capture record originated from the first, second, third, or fourth message capture node; the interface identifier distinguishes different physical interfaces or logical connections of the same device; and the communication direction distinguishes uplink and downlink messages.

[0047] Obtain interface specification samples for distributed energy devices. These samples can be derived from device communication manuals, authorized exported device point lists, normal communication messages collected in the laboratory, specification configuration files provided by the manufacturer, or verified historical test records. Structure the specification identification-related content and the specification conversion mapping-related content separately to form specification identification sub-profiles and conversion mapping sub-profiles.

[0048] The communication behavior profile is stored using a hierarchical data structure, where the reduction identification sub-profile and the transformation mapping sub-profile each include the following:

[0049] The specification identifies sub-portraits that include at least:

[0050] The basic information layer of the protocol includes the protocol name, protocol version, equipment manufacturer, equipment model, transmission medium, and communication role;

[0051] Interface and link parameter layer, including IP address, port number, serial port parameters, station address, public address, connection method and timeout;

[0052] The frame structure constraint layer includes a start field, length relation, control field, address field, data field, and end or validation rules;

[0053] The specification feature field layer includes function code, type identifier, service identifier, address format, control field combinations and their occurrence positions;

[0054] The timing constraint layer includes connection establishment order, request-response interval, periodic reporting interval, heartbeat cycle, retransmission, and timeout.

[0055] The proactive protocol probe layer includes applicable communication roles, probe function semantics, field generation constraints, legal response constraints, response time limits, and sending security restrictions.

[0056] The transformation mapping sub-profile corresponds to at least one of the source interface specification, target interface specification, device model and configuration version, including the source interface specification identifier, target interface specification identifier, data point semantic mapping table, time identifier transformation rules and communication direction.

[0057] The transformation mapping sub-profile also includes detection scenario parameters, which include network status parameters, device load parameters, allowable error, judgment threshold, and number of tests.

[0058] Each specification feature field record includes the field name, field position, field length, allowed value set, matching weight, and whether it is a strongly discriminative field. A strongly discriminative field is a field that has a high degree of differentiation between candidate specifications, such as a specific start byte, a specific function code, a specific type identifier, or a specific combination of control fields.

[0059] The semantic mapping table for data points in the transformation mapping sub-profile is used to establish the correspondence between source data points and target data points under a specific source interface specification and target interface specification transformation direction. Each mapping record includes at least: source data point identifier, target data point identifier, source data type, target data type, source scaling factor, target scaling factor, source offset, target offset, source unit, target unit, valid value range, allowable error, quality identifier mapping relationship, time identifier transformation rule, and communication direction.

[0060] For example, the following mapping record is established for three typical data points of the inverter:

[0061] Active power: The source side uses an integer register value with a scaling factor of 0.1, while the target side uses a floating-point telemetry value. The unified semantic unit is kW, and the allowable error is 0.5%.

[0062] DC side voltage: The source side uses an integer register value with a scaling factor of 0.1, and the target side uses a floating-point telemetry value. The unified semantic dimension is V, and the allowable error is 0.2%.

[0063] Operating status: The source side uses enumerated values ​​0, 1, 2, and the target side uses single-point state or enumerated state, requiring that the semantics of the converted state be completely consistent.

[0064] For numerical data points, the original values ​​from the source and target sides are converted into unified semantic values. Source-side unified semantic value of each data point Unified semantic values ​​with the target side It can be obtained by the following formula:

[0065] ;

[0066] ;

[0067] In the formula, The raw values ​​obtained from parsing the source protocol message. The raw values ​​obtained from parsing the target specification message; and These are the source-side and target-side scaling factors, respectively. and These are the offsets for the source and target sides, respectively. If the units on the source and target sides are different, the unit conversion factor is merged in the scaling factor, or the unit conversion is performed after the scaling factor is converted.

[0068] The quality identification mapping relationship is stored in a mapping table. For example, the quality states such as "valid", "communication abnormal", "out of limit", and "manual substitution" on the source side are mapped to the quality bit combinations that the target side specification can express. When the target specification does not support a certain quality state on the source side, it is mapped according to the pre-confirmed degradation rules and marked as a quality semantic degradation in the detection result, instead of being directly judged as a numerical error.

[0069] Active protocol probes are used to distinguish candidate protocols when passive identification cannot uniquely determine the protocol of the interface to be identified. Each active protocol probe template includes at least the applicable candidate protocol, applicable communication role, probe functional semantics, probe field generation constraints, valid response frame constraints, functional semantic constraints, response time limit, maximum number of retries, and transmission security limits. The detection control terminal determines the probe transmission direction based on the communication role, connection status, and request-response direction recorded in the protocol identification sub-profile of the interface to be identified.

[0070] Active protocol probes prioritize query, link test, or identity reading messages, and avoid using control messages that alter device operating status. For example, probes can read device identifiers, read read-only status variables, perform link tests, or issue general call requests. Security restrictions on probe transmission include: limiting transmission frequency, limiting concurrent transmissions, prohibiting register writing, prohibiting remote connection / reconnection, prohibiting modification of protection settings, and prohibiting triggering device resets.

[0071] In one embodiment, after detection is initiated, the interface messages of the protocol converter under test are first acquired within a preset passive observation time. The passive observation time can be set from 5s to 60s depending on the message period, or it can be set to acquire at least 10 valid messages. The captured messages are deduplicated, grouped by direction, and checked for length. The start field, frame length relationship, control field, address field, checksum relationship, function code or type identifier, and time interval between adjacent messages are extracted.

[0072] For each specification to be matched in the specification identification sub-profile database Calculate frame structure matching degree Matching degree of specification feature fields Time series matching degree Each matching degree is normalized to between 0 and 1.

[0073] Frame structure matching degree can be calculated using the following formula:

[0074] ;

[0075] In the formula, The number of frame structure constraints used in the comparison. For matching specifications The Item frame structure constraint weights, and ; For the first The matching result of the item frame structure constraints is set to 1 if satisfied and 0 if not satisfied. For length or address fields within the allowable range, the result can be adjusted according to the degree of deviation. Set to a value between 0 and 1.

[0076] The matching degree of the specification feature fields can be calculated using the following formula:

[0077] ;

[0078] In the formula, The number of specification feature fields participating in the comparison. For the first The weights of the feature fields in the item specification, and ; The value is 1 when both the field value and its location satisfy the specification for identifying the sub-portrait; 0.5 when only the field value matches but the location does not; and 0 when there is no match.

[0079] The timing matching degree is calculated using the following formula:

[0080] ;

[0081] In the formula, For the first Measured time series parameters, For matching specifications The corresponding number Standard timing parameters, The number of timing parameters to be compared and , In order to be with the first The time series parameters are preset positive numbers with the same dimensions and Timing parameters may include connection establishment time, request-response interval, periodic reporting interval, heartbeat cycle, and retransmission interval.

[0082] The candidate specification is calculated according to the following formula. Passive match score :

[0083] ;

[0084] In the formula, , and The weights are non-negative, and In this embodiment, it can be set to... , , When the resolution of the reduction frame structure is low but the resolution of the temporal features is high, the resolution can be improved based on the calibration results of the confirmed samples. The value of .

[0085] Set candidate threshold Identification threshold Conflict threshold and minimum verification threshold Passive match score not lower than The proposed specifications are included in the candidate specification set and sorted from highest to lowest score. In this embodiment... , , ; Calibrated from confirmed samples and meeting the requirements .

[0086] When the highest passive match score is not lower than Furthermore, there is no second-highest candidate specification or the difference between the highest passive matching score and the second-highest passive matching score greater than [missing information]. When the highest score is reached, the protocol corresponding to that score is directly determined as the current interface protocol. Otherwise, the process proceeds to the active protocol probe confirmation process; if no passive matching score is found, the process continues. When the rules are in effect, if the highest passive match score is not lower than The two highest-scoring unmatched specifications are taken as specifications to be verified. If the highest passive matching score is lower than... If not, then no active reduction probe will be sent and an unrecognized reduction result will be output.

[0087] The probe with the highest discriminative power that does not change the device's operating state is selected from the active protocol probe templates of candidate protocols or protocols to be verified. The sending direction is determined based on the communication role and communication direction of the interface to be identified. The detection control terminal generates a complete probe message according to the field generation constraints, sends it to the protocol converter under test through the corresponding interface, and collects the return message within the response time limit.

[0088] The following judgments are performed on the returned message in sequence:

[0089] Determine whether the returned message meets the start field, length relationship, control field, and verification rules of the candidate specification;

[0090] Determine whether the function code, type identifier, or service identifier of the returned message corresponds to the functional semantics of the sent probe;

[0091] Determine whether the response address, transaction sequence, or request confirmation relationship is consistent with the probe;

[0092] Determine whether the response time is within the response time limit specified by the active protocol probe template.

[0093] When all the above conditions are met, the corresponding candidate specification is marked as a valid response specification. For valid response specifications, an active response score can be calculated. :

[0094] ;

[0095] In the formula, To respond to the frame structure and functional semantic matching degree, In response to timing matching degree, The weights are between 0 and 1, and in this embodiment, they can be set. The valid response specification with the highest proactive response score that is higher than the proactive acknowledgment threshold is determined as the current interface specification.

[0096] When multiple candidate protocols generate valid responses and the score difference is still no greater than the conflict threshold, a second active protocol probe is sent. The second active protocol probe has different functional fields or data objects than the first active protocol probe to improve distinguishability. If the second active protocol probe still cannot distinguish between the two, a manual confirmation prompt is output, and the interface message, probe message, response message, matching score, and timestamp are saved for use in supplementing the protocol profile.

[0097] In a specific example, an interface may simultaneously possess two candidate profiles: a register access protocol with a message header and a register access protocol transparently carried in a TCP connection via serial frames. The probe for the first candidate profile includes a message header, transaction sequence, and length fields, while the probe for the second candidate profile includes a device address, function field, and frame checksum field. The interface to be identified only returns a valid response to the second type of probe; therefore, the protocol corresponding to the second candidate profile is determined as the current interface protocol. This probe only performs read-only data queries and does not change the operating state of the device under test.

[0098] In one embodiment, after determining the source interface specification and the target interface specification, the corresponding transformation mapping sub-profile is loaded based on both and the specification transformation direction, and a preset detection scenario is generated according to the detection task. The preset detection scenario is formed by a combination of network status parameters and device load parameters.

[0099] Network status parameters may include at least: packet loss rate, fixed transmission delay, delay jitter, out-of-order probability, repetition probability, and connection interruption time. Device load parameters may include at least: the number of data points participating in the test, packet transmission period, number of concurrent connections, periodic reporting rate, and control command frequency.

[0100] This embodiment sets up the following three types of detection scenarios:

[0101] Normal scenario: Packet loss rate is set to 0, additional latency is set to 0 to 5ms, latency jitter is no more than 1ms; device load is set to 100 data points, 1s reporting cycle and single connection;

[0102] Slight interference scenario: Packet loss rate set to 0.5%, additional latency set to 20ms, latency jitter set to 5ms; device load set to 500 data points, 500ms reporting cycle and 2 concurrent connections;

[0103] Severe interference scenario: Packet loss rate set to 2%, additional latency set to 50ms, latency jitter set to 15ms, out-of-order probability set to 0.5%; device load set to 1000 data points, 200ms reporting cycle and 4 concurrent connections.

[0104] The above scenario parameters are used to illustrate the implementation process. In actual testing, the parameters should be set according to the rated communication capability of the device under test, the network conditions at the engineering site, and the testing specifications, so as to avoid exceeding the interface load specified in the instruction manual of the device under test.

[0105] Each test transaction generates a unique transaction identifier, which includes at least: transaction identifier, source specification type, target specification type, source data point identifier, target data point identifier, source semantic value, expected target semantic value, source quality identifier, expected target quality identifier, sending time, timeout limit, and scenario identifier.

[0106] For telemetry-related transactions, the source-side simulation node generates test values ​​within the valid value range based on the data point semantic mapping table, covering zero, rated, boundary, and random values. For state-related transactions, each valid enumerated state is generated sequentially. For control-related transactions, simulation control objects that can be confirmed by the target-side simulation node but will not cause dangerous actions are prioritized and executed in an isolated test environment.

[0107] Taking active power data points as an example, the source-side data points use integer values ​​with a scaling factor of 0.1kW, while the target-side data points are represented as floating-point numbers. When the unified semantic value of the test transaction is 125.6kW, the source-side simulation node generates an original value of 1256, and the expected target semantic value calculated by the data point semantic mapping table is 125.6kW. After receiving the target specification message, the target-side simulation node parses the original target value and converts it into a unified semantic value for comparison.

[0108] In one embodiment, when both the source and target protocols have transaction sequences that can be associated, and the protocol converter under test retains or establishes an explicit sequence mapping during the conversion process, the capture records formed by the same test transaction at each message capture node are directly associated based on the transaction identifier or sequence mapping table.

[0109] The detection and control terminal establishes an internal transaction identifier for the source-side test transaction and records the correspondence between the source specification transaction sequence and the internal transaction identifier. After the target-side message arrives, the corresponding internal transaction identifier is found according to the target specification transaction sequence, the sequence mapping information generated by the converter, or the response relationship. Then, the records of the first to fourth message capture nodes are grouped into the same transaction record group.

[0110] When there is no directly inheritable transaction identifier between the source interface specification and the target interface specification, a candidate capture record set is first formed based on the communication direction, interface identifier, and preset time window. The upper limit of the preset time window is not less than the sum of the maximum normal response time in the specification identification sub-profile and the maximum additional latency in the current scenario.

[0111] Irrelevant records are then excluded based on at least two of the following: function code or type identifier, sequence information, data point identifier, and semantic content digest. The semantic content digest is generated from functional semantics, data point identifier, semantic value under uniform dimensions, quality identifier, and message direction, rather than directly generating the same digest for raw binary messages of different specifications.

[0112] The source-side capture record can be calculated using the following formula. Recording with target side Correlation score :

[0113] ;

[0114] In the formula, , , , and These are functional semantic matching degree, data point mapping matching degree, semantic value matching degree under unified scale, communication direction matching degree, and time proximity degree, with each matching degree taking a value from 0 to 1; to The weights are non-negative and sum to 1. Temporal proximity can be calculated using the following formula:

[0115] ;

[0116] In the formula, and These are the timestamps of the two captured records. For preset time window and Among the candidate records whose association scores reach the association threshold, the record with the highest association score is selected first; when the difference between the highest and second highest association scores is not greater than the preset association conflict threshold, the record with the smallest time difference and that satisfies the temporal constraints of the adjacent node order and the conventional recognition sub-portrait is selected.

[0117] After association is completed, a complete transaction record group can include: the first capture record, the second capture record, the third capture record, and the fourth capture record. If a node fails to obtain a record within the corresponding timeout period, that location is marked as missing a record, and the abnormal link location process begins.

[0118] In one embodiment, it is first determined whether the protocol converter under test has established links with the source simulation node and the target simulation node respectively; then it is determined whether the request message has received a valid response, whether the periodic reporting meets the timing constraints, and whether the data points can be output according to the mapping relationship.

[0119] Effective response rate It can be calculated using the following formula:

[0120] ;

[0121] In the formula, The number of requests that require a response and the number of transactions sent. , The number of request transactions that received a valid response within the timeout period.

[0122] Data point mapping pass rate It can be calculated using the following formula:

[0123] ;

[0124] In the formula, The number of data points participating in the test and , This refers to the number of data points that can be found on the target side, and whose data type, communication direction, and functional semantics conform to the transformation mapping sub-profile.

[0125] When both the source and target links are successfully established, and and When the corresponding preset thresholds are reached, the protocol converter under test is determined to be protocol compatible in the current testing scenario. The preset thresholds can be set according to the testing specifications. For example, in a normal scenario, the effective response rate threshold can be set to 0.99, and the data point mapping pass rate threshold can be set to 0.98.

[0126] For the The unified semantic values ​​of the data points before and after the reduction transformation are as follows: and Calculate the relative semantic error using the following formula. :

[0127] ;

[0128] In the formula, For the first Each data point corresponds to a preset positive number, whose unit is... Consistency can be determined based on the range, resolution, or detection configuration of the data point. For data points close to zero, an absolute error threshold can also be set simultaneously, and the numerical consistency is determined when the relative error condition or absolute error condition specified by the conversion mapping sub-profile is met.

[0129] when Not greater than the Allowable error for each data point And when the quality identifier after specification conversion conforms to the quality identifier mapping relationship, let the consistency indicator quantity... Otherwise, Semantic conversion consistency rate Calculate using the following formula:

[0130] ;

[0131] In the formula, The number of valid data point observation records participating in semantic consistency statistics and For state variables, a semantic consistency determination is made by enumerating the states; for time markers, a determination is made that the time difference does not exceed a preset allowable deviation.

[0132] Transactions received by the target-side simulation node within the test transaction timeout period, correctly parsed according to the target specification, and associated with the source-side test transaction are defined as valid received transactions. Data acquisition reliability. Calculate using the following formula:

[0133] ;

[0134] In the formula, The total number of test transactions sent and , This is the number of valid received transactions. For the same transaction received repeatedly, it is counted as only one valid reception and the number of duplicate messages is counted separately; transactions that fail to resolve, cannot be associated, or exceed the timeout limit are not counted as valid received transactions.

[0135] For the A valid receive transaction, based on the source-side sending timestamp recorded by the first message capture node. The target side received timestamp recorded by the fourth message capture node Compute end-to-end processing latency :

[0136] ;

[0137] Average end-to-end processing latency Calculate using the following formula:

[0138] ;

[0139] In addition to the average value, the system can also output the maximum latency, minimum latency, and preset percentile latency. If three packet capture nodes are used and no fourth packet capture node is set, the timestamp of the nearest capture node on the target side will be used as the latency. The delay measurement boundaries should be specified in the test report. When it is necessary to test the complete control request-response process, the source-side request sending timestamp can also be included. The timestamp of the corresponding response returned to the source simulation node. The time difference between them is defined as the control response delay. .

[0140] In one embodiment, the capture records of the same test transaction are compared segment by segment according to the link order of the first, second, third, and fourth packet capture nodes. Before the comparison, the differences in link layer encapsulation, TCP segmentation, or reassembly that may occur at different packet capture locations but do not change the semantics of the application layer protocol are normalized, and the original packets before normalization are retained as detection evidence.

[0141] When the first message capture node has captured the message sent by the source side, but the second message capture node fails to capture the corresponding message within the input timeout period, or when the application layer protocol data unit, communication direction, or necessary link field of the second capture record is inconsistent with the application layer protocol data unit, communication direction, or necessary link field of the first capture record after normalization, the link between the first message capture node and the second message capture node is identified as the first inconsistent link segment and marked as an input link anomaly.

[0142] When the message from the second message capture node can be correctly parsed according to the source interface protocol, while the associated message from the third message capture node does not conform to the target interface protocol or the conversion mapping sub-profile, the link between the second and third message capture nodes is identified as the first link segment where inconsistency occurs, i.e., the anomaly is located in the protocol conversion processing segment; then, the anomaly type is classified according to the observable field differences, rather than directly determining that a specific software module inside the converter has failed.

[0143] Further subdivide the anomaly types based on the comparison results:

[0144] If the target data point identifier does not match the mapping table, it is determined that the data point address mapping is abnormal;

[0145] If the target data type is inconsistent with the mapping table, it is determined to be a data type conversion error;

[0146] If the data point is correctly identified but the uniform semantic value exceeds the allowable error, it is judged as an abnormal numerical conversion.

[0147] If the numerical value is correct but the target quality label does not match the mapping relationship, it is judged as an abnormal quality label conversion;

[0148] If the functional semantics or target specification frame structure is invalid, it is determined to be a message encapsulation anomaly;

[0149] If a valid request has been received on the input side of the converter, but no corresponding message is received on the output side after a specified time, it is determined to be a conversion processing timeout exception.

[0150] When the message of the third message capture node conforms to the target interface specification and the transformation mapping sub-profile, but the fourth message capture node fails to capture the corresponding message within the output timeout period, or when the application layer specification data unit after normalization of the fourth capture record and the third capture record is inconsistent, the link between the third message capture node and the fourth message capture node is identified as the first inconsistent link segment and marked as an output link anomaly.

[0151] The anomaly localization results should include at least: anomaly test transaction identifier, anomaly occurrence time, anomaly type, the first link segment where inconsistency occurred, captured messages from adjacent nodes, parsing results, field differences, and corresponding timestamps.

[0152] In one embodiment, this embodiment tests a distributed energy protocol converter that converts a source-side register access protocol to a target-side power telecontrol protocol. The source-side simulation node simulates a photovoltaic inverter, and the target-side simulation node simulates an energy management master station. Both the source-side and target-side links use Ethernet. Four packet capture nodes are respectively located at the source-side transmitter, converter input, converter output, and target-side receiver.

[0153] The source-side communication behavior profile specifies that source-side messages have a transaction sequence, message length, device unit identifier, function field, and data field; the target-side communication behavior profile specifies that target-side messages have a start field, length field, control field, and application service data unit. Target-side telemetry values ​​are represented in floating-point format, and operational status is represented using status information objects. The aforementioned frame fields are only used for validating the corresponding protocol; the detection system does not add custom fields to online messages.

[0154] The semantic mapping table for data points is set up as follows:

[0155] The DC-side voltage register is mapped to a DC-side voltage information object; the source primitive type is a 16-bit unsigned integer with a scaling factor of 0.1, the target primitive type is a floating-point number, the unified semantic unit is V, and the allowable error is 0.2%.

[0156] The active power register is mapped to an active power information object; the source primitive type is a 16-bit signed integer with a scaling factor of 0.1, the target primitive type is a floating-point number, the unified semantic unit is kW, and the allowable error is 0.5%.

[0157] The running status register is mapped to the running status information object; the source primitive type is an enumerated integer, and the target primitive type is a status value, requiring that the status enumerations be completely consistent.

[0158] Twenty frames of interface packets were collected during a 10-second passive observation period. The following sub-profiles of the source-side protocol to be matched were calculated: frame structure matching degree, protocol feature field matching degree, and temporal matching degree. After applying the appropriate weights, the passive matching score was:

[0159] ;

[0160] The score is higher than the recognition threshold of 0.85, and the difference between it and the second highest candidate protocol score is greater than 0.08. Therefore, the source interface protocol is directly determined, and no active protocol probe is sent.

[0161] For the other interface to be identified, the highest and second highest passive matching scores are 0.81 and 0.77, respectively, with a difference of 0.04, which is less than the conflict threshold of 0.08. The detection system generates read-only query probes for the two candidate protocols. The interface to be identified only returns a valid response that satisfies the frame structure, functional semantics, and response time limit to the second candidate protocol probe; therefore, the second candidate protocol is determined to be the protocol of this interface.

[0162] In a normal scenario, 100 test transactions are generated, including 80 telemetry transactions and 20 status transactions. Taking the active power transaction as an example, the transaction identifier is T00031, the unified semantic value is 125.6kW, the original value on the source side is 1256, the expected value on the target side is 125.6kW, and the timeout limit is 200ms.

[0163] The target-side resolution value is 125.6kW, the quality identifier is valid, therefore the relative semantic error of this transaction is 0, and the consistency indicator is 1; the end-to-end processing latency of this transaction is 9.130ms.

[0164] Of the 100 test transactions, 99 were received, correctly parsed, and associated with the source test transactions within the timeout period, while the remaining transaction timed out. Among the semantic observation records corresponding to the 99 valid received transactions, 98 met the requirements for data point mapping, numerical values, and quality identification, while the remaining one exhibited a semantic conversion anomaly. Therefore, we can conclude that:

[0165] ;

[0166] If the number of valid data point observation records participating in the semantic consistency statistics is 99, and 98 of these observation records are consistent, then:

[0167] ;

[0168] The detection system calculates the average end-to-end processing latency based on the timestamps of all valid transactions and outputs the maximum latency and percentile latency. These values ​​are for illustrative purposes only; the actual detection results depend on the device under test and the scenario parameters.

[0169] In transaction T00057, the source-side unified semantic value is 125.6kW. The original message of the first capture record is consistent with that of the second capture record, and the second capture record can be correctly parsed according to the source specification; the third capture record conforms to the target specification frame structure, but the parsed target-side unified semantic value is 12.56kW. The fourth capture record is consistent with the third capture record.

[0170] The relative semantic error of this transaction is:

[0171] ;

[0172] This is significantly greater than the allowable error of 0.005. Since the input and output link messages are consistent, but the converter output value does not match the semantic mapping relationship of the data points, the detection system identifies the link segment between the second and third message capture nodes as the first inconsistency and further subdivides the anomaly into a numerical conversion anomaly. Further comparison of the scaling factors in the mapping table suggests that the target-side value may have been multiplied by an insufficient ten-fold scaling factor.

[0173] In transaction T00082, the first to third message capture nodes all captured the corresponding messages, and the third capture record conformed to the target protocol and data point semantic mapping relationship. However, the fourth message capture node failed to capture the corresponding message within the output timeout period. Therefore, the detection system identified the link between the third and fourth message capture nodes as the first inconsistent link segment and output an output link message missing anomaly, instead of misjudging the anomaly as a data point conversion error of the protocol converter.

[0174] This invention is not limited to the conversion detection from a single source-side protocol to a single target-side protocol. For a protocol converter with one source-side interface corresponding to multiple target-side interfaces, a target-side simulation node and a packet capture node can be set up for each target-side interface, and the target interface identifier can be recorded in the test transaction. For a protocol converter where multiple source-side devices converge to one target-side interface, a source device identifier can be added to the test transaction, and a semantic mapping relationship from source device data points to target data points can be established respectively.

[0175] Communication behavior profiles can be stored in relational databases, document databases, or local structured files. When a profile is updated, a separate version number is created for the new specification version, while historical versions are retained. The detection report should record the actual profile version used to facilitate subsequent reproduction of the detection process.

[0176] The weights and thresholds used for candidate reduction identification can be configured manually or calibrated offline using confirmed samples. Offline calibration is only used to determine the matching weights and thresholds; online detection still completes reduction identification according to the determined frame structure, feature fields, and temporal constraints, without relying on uninterpretable classification results.

[0177] In addition to outputting specification compatibility, semantic conversion consistency, data acquisition reliability, and end-to-end processing latency, the test report should also save test scenario parameters, test transaction list, profile version, capture records of each node, and anomaly location basis. For control request-response scenarios, the control response latency can also be output separately, so that those skilled in the art can reproduce the test process based on the same inputs and parameters.

[0178] In this embodiment, the protocol converter under test (PTD) is connected between the source-side simulation node and the target-side simulation node. The PTD includes a source-side interface facing the source-side simulation node and a target-side interface facing the target-side simulation node.

[0179] In this invention, "interface to be identified" refers to any one of the source-side interface and the target-side interface; the protocol determined through protocol identification is called the interface protocol of that interface, wherein the interface protocol corresponding to the source-side interface is denoted as the source interface protocol. The interface specification corresponding to the target side interface is denoted as the target interface specification. .

[0180] Before the test begins, the source-side interface protocol status and the target-side interface protocol status are obtained respectively. When an interface protocol has been explicitly specified by the device configuration file, the confirmed point table file, or the test task, the interface protocol is directly adopted; when an interface protocol has not been explicitly specified, passive protocol identification and active protocol probe confirmation are performed independently for that interface.

[0181] Specifically, when performing source-side interface identification, source-side interface packets are collected at the source-side interface of the protocol converter under test. Candidate source-side protocols are determined based on the frame structure characteristics, protocol feature fields, and timing characteristics of the source-side interface packets, and the finally determined protocol is recorded as the source interface protocol. .

[0182] When performing target-side interface identification, target-side interface messages are collected at the target-side interface of the protocol converter under test. Based on the target-side interface messages, candidate target-side protocols are determined, and the finally determined protocol is recorded as the target interface protocol. .

[0183] When the target interface does not generate a valid message during the passive observation period, the target simulation node sends a query-type or link test-type active protocol probe based on the active protocol probe template of the candidate protocol, and determines the target interface protocol based on the returned message. .

[0184] After completing the identification of both interfaces, the detection and control terminal performs the detection according to the source interface protocol. Target Interface Specification And the corresponding transformation mapping sub-portfolio is loaded according to the protocol transformation direction. The transformation mapping sub-portfolio includes at least the message parsing rules of the source interface protocol, the message generation rules of the target interface protocol, and the semantic mapping relationship between the source data points and the target data points.

[0185] When the protocol converter under test has multiple source-side interfaces or multiple target-side interfaces, a unique interface identifier is configured for each interface, and protocol identification, communication behavior profile loading, and test transaction association are performed according to the interface identifier.

[0186] In this embodiment, four packet capture nodes are set up sequentially according to the packet transmission direction:

[0187] The first message capture node is set at the sending end of the source-side simulation node and is used to obtain the source protocol message actually sent by the source-side simulation node.

[0188] The second message capture node is set on the input side of the protocol converter under test and is used to acquire the source protocol messages actually received by the protocol converter under test.

[0189] The third message capture node is set on the output side of the protocol converter under test, and is used to acquire the target protocol message output by the protocol converter under test after parsing, mapping and encapsulation.

[0190] The fourth message capture node is set at the receiving end of the target-side simulation node and is used to acquire the target protocol messages actually received by the target-side simulation node.

[0191] An input link segment is formed between the first and second message capture nodes; a protocol conversion processing segment is formed between the second and third message capture nodes; and an output link segment is formed between the third and fourth message capture nodes.

[0192] Each message capture node records a timestamp based on a unified clock reference, forming a capture record that includes node identifier, interface identifier, communication direction, timestamp, original message, parsing result, and parsing status. Message capture nodes only perform bypass acquisition of communication messages and do not write tracking fields to the original messages being transmitted online.

[0193] When all four message capture nodes are set, it is possible to determine input link abnormalities, internal conversion abnormalities of the protocol converter under test, and output link abnormalities, respectively.

[0194] When the testing environment can only set up three message capture nodes, the three nodes should include at least a second message capture node on the input side of the protocol converter under test and a third message capture node on the output side of the protocol converter under test. The third node is set at the sending end of the source-side simulation node or the receiving end of the target-side simulation node.

[0195] When the third node is set at the source-side simulation node's transmitting end, it can distinguish between input link anomalies and protocol conversion processing anomalies, but the output link uses the third packet capture node as the measurement boundary. When the third node is set at the target-side simulation node's receiving end, it can distinguish between protocol conversion processing anomalies and output link anomalies, but the input link uses the second packet capture node as the measurement boundary. The test report records the actual packet capture nodes used and the uncovered link segments.

[0196] Matching parameters, thresholds, and abnormal branch implementation methods

[0197] In the aforementioned passive matching score Based on this, set the candidate threshold. Identification threshold Conflict threshold and minimum verification threshold ,satisfy ,and .

[0198] In the formula, , and These are the weights for frame structure matching, reduced feature field matching, and temporal matching, respectively, all of which are non-negative, and: ;

[0199] in, Used to form a candidate reduction set, Used to determine whether the highest passive matching score is sufficient to directly determine the interface specification. Used to determine whether there is a recognition conflict between the highest and second-highest passive matching scores. Used to determine whether active verification of the highest-scoring unmatched specification is still allowed when the candidate set is empty.

[0200] In this embodiment, , , ; It can be calibrated offline using confirmed samples, and is not limited to fixed values.

[0201] When the highest passive match score is not lower than Furthermore, there is no second-highest candidate specification or the difference between the highest and second-highest passive matching scores is greater than [missing information]. When the highest passive matching score is obtained, the specification corresponding to it is determined as the interface specification of the interface to be identified.

[0202] If the above direct determination conditions cannot be met, the active reduction probe confirmation process begins; if the candidate reduction set is empty, then proceed according to... Further determine whether to select the two highest-scoring unmatched specifications for verification.

[0203] When the candidate specification set is empty and the highest passive matching score is not lower than When the passive matching score is higher than the two specifications to be matched, the two specifications with the highest passive matching scores are used as specifications to be verified; when the highest passive matching score is lower than the two specifications to be matched, the two specifications to be matched are used as specifications to be verified. At this time, no active reduction probe is sent; instead, the result "unrecognized reduction" is output directly.

[0204] The time difference between the timestamp sent from the source side and the timestamp received from the target side is defined as the end-to-end processing delay. When it is necessary to inspect the complete request-response process, the timestamp of the source request will be sent. The timestamp of the corresponding response returned to the source-side simulation node. The time difference between them is defined as the control response delay. This distinguishes between one-way end-to-end processing latency and complete request-response latency.

[0205] Active reduction probe implementation method 1: Transparent transmission of Modbus TCP and Modbus RTU

[0206] In this embodiment, the interface to be identified uses a TCP connection, but the number of passively collected packets is insufficient. The candidate protocols include ModbusTCP and ModbusRTU, which is transparently carried in the TCP link via a serial port server.

[0207] Modbus TCP application data units have an MBAP header, which includes a transaction identifier, a protocol identifier, a length field, and a unit identifier. The transaction identifier is used for request and response pairing, and the protocol identifier is set to zero in Modbus communication. Modbus serial messages use a frame structure consisting of a device address, function code, data field, and CRC check field.

[0208] The detection and control terminal first generates the first active protocol probe. The first active protocol probe adopts the Modbus TCP frame structure, including: a two-byte transaction identifier; a two-byte protocol identifier with a value of zero; a two-byte length field; a one-byte unit identifier; and a protocol data unit consisting of a function code and query data.

[0209] The protocol data unit preferentially uses function code 0x2B and MEI type 0x0E to request the read device identifier; when the device under test does not support reading the device identifier, function code 0x03 is used to read the read-only holding register confirmed by the device point table. The Modbus specification defines 0x03 as the function of reading the holding register and 0x2B / 0x0E as the function of reading the device identifier.

[0210] After sending the first active protocol probe, collect the return message within the response time limit. When the return message has a valid MBAP header, a protocol identifier of zero, a returned transaction identifier that is the same as the requested transaction identifier, a length field that matches the number of subsequent fields, and a function code and data content that conform to the request semantics, mark ModbusTCP as a valid response protocol.

[0211] If the first active protocol probe does not receive a valid response, a second active protocol probe is generated. The second active protocol probe uses a Modbus RTU frame structure, including the device address, function code 0x03, starting register address, number of registers, and CRC check field, and is transparently transmitted through the current TCP connection.

[0212] When the returned message includes the same device address, function code, number of valid bytes, register data, and valid CRC check field as the request, and does not have an MBAP header, the Modbus RTU transparently carried by TCP will be identified as the interface protocol of the current interface to be identified.

[0213] Both active protocol probes only read the device identifier or read-only register, and do not use functions such as writing to a single coil, writing to a register, or otherwise changing the device's operating state. Each probe sends a maximum of two messages, and the sending interval between adjacent probes is not less than the preset minimum sending interval; when neither type of probe receives a valid response, a manual confirmation prompt is output.

[0214] Active protocol probe implementation method two: IEC60870-5-104 link test;

[0215] In this embodiment, the interface to be identified uses a TCP connection. The passively captured message is characterized by a starting field of 0x68 and a length field and a control field. However, due to the insufficient number of valid information messages, a custom TCP protocol cannot be ruled out.

[0216] On the established TCP connection, the detection and control terminal generates a U-format link test active protocol probe, i.e., a TESTFR activation message, based on the IEC60870-5-104 communication behavior profile, and waits for a TESTFR confirmation message within a preset response time limit. IEC60870-5-104 is a telemetry communication protocol based on standard transmission configuration; established connections without data transmission can be tested using the TESTFR activation message, and the receiving end confirms the connection with a TESTFR confirmation message.

[0217] IEC 60870-5-104 is marked as a valid response protocol when the return message meets the following conditions:

[0218] The returned message satisfies the APDU start field and length relationship of this specification;

[0219] The returned message control field is in the TESTFR acknowledgment format corresponding to the TESTFR activation message;

[0220] The connection direction and TCP session returned in the message are consistent with the active protocol probe.

[0221] The return time does not exceed the preset link test response time limit in the communication behavior profile.

[0222] TESTFR link testing is only used to confirm the status of the communication link and protocol, and does not include remote control, parameter writing, setting modification or device reset.

[0223] When no TESTFR acknowledgment message is received, but the passive matching result is still higher than the candidate threshold, the detection control terminal can send a second link verification probe in the isolated simulation environment. The second link verification probe uses a confirmed query or general call message from the communication behavior profile. If the second probe still does not receive a valid response, the TCP session, probe message, response record, and matching score are saved, and a manual confirmation prompt is output. The interface is not directly identified as IEC60870-5-104.

[0224] In a complete testing instance, neither the source-side interface specification nor the target-side interface specification of the protocol converter under test is specified in advance.

[0225] First, 10 seconds of interface packets were collected from the source interface. The passive matching score of the Modbus TCP profile was 0.82, and the passive matching score of the Modbus RTU profile with TCP transparent bearer was 0.78. The difference between the two was 0.04, which is less than the conflict threshold of 0.08. The detection control terminal sequentially sent Modbus TCP read device identifier probes and Modbus RTU read-only register probes. The interface under test only returned a valid response to the read device identifier probe with an MBAP header. Therefore, the source interface protocol was modified accordingly. It has been confirmed as ModbusTCP.

[0226] Subsequently, interface messages were collected from the target interface. Its passive matching score for the IEC60870-5-104 profile was 0.79, which did not reach the identification threshold. The detection control terminal sent a TESTFR link test probe and received a valid TESTFR confirmation message within the response time limit. Therefore, the target interface protocol was confirmed. It is determined to be IEC60870-5-104.

[0227] The detection and control terminal loads the conversion mapping sub-portfolio corresponding to the conversion direction of ModbusTCP to IEC60870-5-104, and generates an active power test transaction. The unified semantic value on the source side is set to 125.6kW, the original register value on the source side is 1256, and the scaling factor is 0.1; the expected unified semantic value on the target side is 125.6kW.

[0228] The source-side packets captured by the first and second packet capture nodes are consistent, indicating that the input link is normal; the target protocol packets captured by the third packet capture node can be correctly parsed, but its unified semantic value is 12.56kW; the packets captured by the fourth packet capture node are consistent with those captured by the third packet capture node.

[0229] Since the messages between the first and second nodes are consistent, and the messages between the third and fourth nodes are consistent, but the semantic values ​​between the second and third nodes are inconsistent for the first time, the protocol conversion processing section between the input and output sides of the protocol converter under test is identified as the first link segment where inconsistency occurs, and the anomaly is further subdivided into numerical conversion anomalies based on the comparison results of the scaling factor.

[0230] The above embodiments fully illustrate the implementation process of establishing a communication behavior profile, passive protocol identification, active protocol probe confirmation, test transaction generation, multi-node message association, semantic and time sequence comparison, and the location of the first inconsistent link segment. Those skilled in the art can implement the method described in this invention based on the above content without creative effort.

[0231] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A simulation and testing method for distributed energy protocol converters, characterized in that, Includes the following steps: S1, Obtain interface specification samples of distributed energy devices, and establish a communication behavior profile including a specification identification sub-profile and a conversion mapping sub-profile; S2, connect the protocol converter under test between the source-side simulation node and the target-side simulation node, set up bypass message capture nodes at multiple locations on the communication link, and capture messages based on a unified time base record; S3, determine candidate protocols based on source-side interface messages and target-side interface messages respectively; for interfaces that cannot be uniquely determined, generate probes based on active protocol probe templates, and determine source interface protocols and target interface protocols based on response results; S4. Load the corresponding transformation mapping sub-portfolio according to the source interface specification, target interface specification and specification transformation direction, generate test transactions according to the preset detection scenario, and associate the captured messages of the same test transaction before and after the specification transformation. S5. Based on the transformation mapping sub-portrait, perform semantic and temporal comparisons on the associated captured messages, determine the first inconsistent link segment according to the message transmission order, and output the protocol compatibility, semantic transformation consistency, data acquisition reliability, end-to-end processing latency, and anomaly location results.

2. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S1, the protocol identification sub-portrait includes basic protocol information, interface and link parameters, frame structure constraints, protocol feature field set, timing constraints, and active protocol probe template; the conversion mapping sub-portrait corresponds to the source interface protocol, target interface protocol, and device model or configuration version, including a data point semantic mapping table and detection scenario parameters; each mapping record in the data point semantic mapping table includes source data point identifier, target data point identifier, source data type, target data type, source ratio coefficient, target ratio coefficient, source offset, target offset, source unit, target unit, valid value range, allowable error, quality identifier mapping relationship, time identifier conversion rule, and communication direction; the active protocol probe template includes probe function semantics, field generation constraints, legal response frame constraints, response time limit, applicable communication role, and transmission security restrictions.

3. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S2, at least three of the following are set up: a first message capture node, a second message capture node, a third message capture node, and a fourth message capture node, respectively, at the transmitting end of the source-side simulation node, the input side of the protocol converter under test, the output side of the protocol converter under test, and the receiving end of the target-side simulation node, with at least the second and third message capture nodes included. Each message capture node forms a capture record based on a unified clock reference, including a tracking identifier, a node identifier, an interface identifier, a communication direction, a timestamp, the original message, and the parsing result. The tracking identifier is only stored as associated metadata, and the message capture node uses a bypass method to collect and not modify the online transmission message.

4. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S3, for each specification to be matched... Frame structure matching degrees normalized to 0 to 1 were obtained respectively. Matching degree of specification feature fields Time series matching degree The passive matching score is calculated according to the following formula. : ; In the formula, , and The weights are non-negative, and The frame structure matching degree The matching degree of the protocol feature fields is determined based on the weighted proportions of the start field, length relationship, control field, address field, and verification rules of the interface message that satisfy the candidate protocol; The timing matching degree is determined based on the occurrence position and number of matches of candidate specification type identifier, function code, address format, or control field combination; Calculate according to the following formula: ; In the formula, For the first Measured time series parameters, For matching specifications The corresponding number Standard timing parameters, The number of timing parameters to be compared and , In order to be with the first The time series parameters are preset positive numbers with the same dimensions and Prototypes with passive matching scores not lower than the candidate threshold are identified as candidate prototypes and sorted from highest to lowest according to their passive matching scores.

5. The distributed energy protocol converter simulation and testing method according to claim 4, characterized in that, Set candidate threshold Identification threshold Conflict threshold and minimum verification threshold ,in ; When the highest passive match score is not lower than Furthermore, there is no second-highest candidate specification or the difference between the highest and second-highest passive matching scores is greater than [missing information]. In this case, the corresponding interface specification is determined directly; otherwise, when there is a passive matching score not lower than... When selecting candidate specifications, active confirmation is performed from the candidate specifications. If no candidate specification exists but the highest passive matching score is not lower than [the specified value], [further confirmation is performed]. When the highest passive matching score is lower than the required score, the two specifications to be matched are taken as specifications to be verified. If an unrecognized protocol result is output, for protocols that require active confirmation, an active protocol probe that does not change the operating state of the device under test is sent according to the communication role and communication direction of the interface to be identified, and the valid response protocol is determined based on the legal response frame constraints, functional semantic constraints and response time limits; if multiple valid response protocols still cannot be distinguished, a second active protocol probe with different functional fields or data objects is sent, and if they still cannot be distinguished, a manual confirmation prompt is output.

6. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S4, each test transaction includes a transaction identifier, source protocol type, target protocol type, source data point identifier, target data point identifier, source semantic value, expected target semantic value, source quality identifier, expected target quality identifier, transmission time, timeout limit, and scenario identifier. The preset detection scenario is formed by a combination of network status parameters and device load parameters. The network status parameters include at least one of packet loss rate, transmission delay, delay jitter, out-of-order probability, and connection interruption time. The device load parameters include at least one of the number of data points, message transmission period, number of concurrent connections, and control command frequency.

7. The simulation and testing method for distributed energy protocol converters according to claim 6, characterized in that, When there are inheritable transaction identifiers or explicit sequence mappings before and after the protocol conversion, the captured messages of the same test transaction are associated based on the transaction identifiers or sequence mappings. When there are no directly inheritable transaction identifiers, a candidate capture record set is first formed based on the communication direction, interface identifier, and preset time window. Then, irrelevant records are excluded based on at least two of the function code or type identifier, sequence information, data point identifier, and semantic content digest. The candidate capture records are then processed accordingly. and The association score is calculated using the following formula: ; In the formula, , , , and These are functional semantic matching degree, data point mapping matching degree, semantic value matching degree under unified scale, communication direction matching degree, and time proximity; to The weights are non-negative and sum to 1, where the temporal proximity is calculated according to the following formula: ; In the formula, and These are the timestamps of the two candidate capture records. The preset time window is used; among the candidate records whose association scores reach the association threshold, the record with the highest association score is selected first. When the difference between the highest association score and the second highest association score is not greater than the preset association conflict threshold, the record with the smallest time difference and that satisfies the adjacent node order and timing constraints is selected as the capture message corresponding to the same test transaction.

8. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S5, based on the data type, scaling factor, offset, and unit conversion rules in the semantic mapping relationship of the data points, the first... The source semantic values ​​of each data point before reduction transformation target semantic value after reduction transformation Convert to the same dimension and calculate the relative semantic error according to the following formula. : ; In the formula, For the first Each data point corresponds to a preset positive number, whose unit is... Consistent; when Not greater than the Allowable error for each data point And when the quality identifier after specification conversion conforms to the quality identifier mapping relationship, let the consistency indicator quantity... Otherwise The semantic conversion consistency rate is calculated according to the following formula. : ; In the formula, The number of valid data point observation records participating in semantic consistency statistics; when the protocol converter under test completes link establishment with the source-side simulation node and the target-side simulation node respectively, and the effective response rate and data point mapping pass rate both reach the corresponding preset thresholds, it is determined that the protocol converter under test is protocol compatible in the current detection scenario. The effective response rate is the ratio of the number of request transactions that receive a valid response within the timeout period to the number of request transactions that need to be responded to, and the data point mapping pass rate is the ratio of the number of data points that have been mapped to the number of data points participating in the test.

9. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S5, transactions received by the target-side simulation node within the timeout period of the test transaction, which can be correctly parsed according to the target interface specification and can be associated with the source-side test transaction, are determined as valid received transactions. The data acquisition reliability is calculated according to the following formula. : ; In the formula, The total number of test transactions sent and , To effectively receive the number of transactions; for the first A valid receive transaction, based on the sending timestamp of the source-side simulation node. and the received timestamp of the target-side simulation node Compute end-to-end processing latency and average end-to-end processing delay : ; 。 10. The simulation and testing method for distributed energy protocol converters according to claim 1, characterized in that, In step S5, the captured messages of the same test transaction are compared according to the link order of the source-side simulation node transmitter, the input side of the protocol converter under test, the output side of the protocol converter under test, and the target-side simulation node receiver: when the source-side transmitter has captured the corresponding message, but the converter input side has not captured the corresponding message within the input timeout period, or when the application layer protocol data unit, communication direction, or necessary link field after link layer difference normalization is inconsistent, the first inconsistent link segment is determined as the input link; When the converter input side message can be correctly parsed according to the source interface protocol, but the converter output side associated message does not conform to the conversion mapping sub-profile in terms of data point identification, data type, numerical conversion, unit, quality identification, functional semantics or target interface protocol frame structure, the first inconsistent link segment is determined as the protocol conversion processing segment, and the anomaly is classified into data point address mapping anomaly, data type conversion anomaly, numerical conversion anomaly, quality identification conversion anomaly, message encapsulation anomaly or conversion processing timeout anomaly based on the observed field differences; When the converter output message conforms to the target interface specification and the conversion mapping sub-profile, but the target simulation node does not capture the corresponding message or the normalized target received message is inconsistent with the converter output message, the first inconsistent link segment is determined as the output link.

Citation Information

Patent Citations

  • Transformer substation communication protocol full mapping analysis analog conversion device

    CN114401323A