An internet of things device access and protocol adaptive conversion method and system

CN122395299BActive Publication Date: 2026-10-20SHENZHEN YUGAO MICRO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610549157.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-23
Publication Date
2026-10-20
Estimated Expiration
2046-04-23

AI Technical Summary

Technical Problem

不同厂商设备所采用的通信协议结构差异显著,报文字段排列形式、编码方式以及字段依附关系缺乏统一规范,现有方法主要依赖人工解析或固定规则匹配,难以对未知协议或变种协议进行有效识别与适配,导致接入过程复杂且扩展性差;通信报文中字段之间存在位序关联、交互方向对应以及控制依附等多种结构关系,传统基于简单字段切分或浅层特征匹配的方法无法对这些隐含结构关系进行有效建模,造成字段语义解析不完整以及协议理解偏差,影响后续数据转换准确性;在多轮通信交互过程中,请求报文与应答报文之间存在复杂的对应关系与时序依赖,现有方法缺乏对跨报文交互关系的系统建模能力,难以保证字段对位关系的稳定提取;针对字段映射与协议转换过程,传统逐字段匹配或正则表达式匹配方式在面对字段顺序变化、嵌套结构以及动态长度字段时容易失效,导致转换链路不稳定以及数据一致性难以保证

Benefits of technology

本发明在改进TabTransformer模型的特征交互层中引入位序流变机制,对字段位序关系、交互方向关系和依附关系进行联合建模,通过字段关联顺序重排和字段关联分布构建,实现对字段之间结构关系的动态表达,解决传统方法对隐含结构关系建模不足的问题,提高协议上下文向量的表达准确性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122395299B_ABST
    Figure CN122395299B_ABST
Patent Text Reader

Abstract

The application discloses an Internet of Things device access and protocol adaptive conversion method and system, comprising the following steps: S1, obtaining an original message stream to obtain a message field segment and a bit sequence track; S2, constructing a protocol attribute matrix; S3, inputting an improved TabTransformer model, introducing a bit sequence flow variable mechanism in a feature interaction layer, and generating a protocol context vector; S4, constructing a protocol relationship graph; S5, adopting a Leiden algorithm to perform community division, introducing a time direction community returning mechanism, generating a protocol cluster, and determining a cluster center field chain; S6, constructing a field matching dictionary and an Aho-Corasick automatic machine to form a mapping link; and S7, generating a conversion message. The application realizes adaptive analysis and stable mapping of a multi-source heterogeneous Internet of Things device communication protocol, improves the accuracy and consistency of a protocol conversion process, and improves device access efficiency and system compatibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) communication and protocol parsing technology, and in particular to a method and system for IoT device access and protocol adaptive conversion. Background Technology

[0002] With the increasing variety of IoT devices and the growing demand for device interconnection in scenarios such as industrial control, smart manufacturing, and smart energy, adaptive conversion technology for access and communication protocols for multi-source heterogeneous devices has attracted widespread attention. Existing IoT access systems typically rely on predefined protocol templates or manually configured rules to achieve device access and data parsing, but in practical applications, the following problems are commonly encountered: The communication protocol structures used by different manufacturers' equipment vary significantly, and there is a lack of unified standards for message field arrangement, encoding methods, and field dependency relationships. Existing methods mainly rely on manual parsing or fixed rule matching, which makes it difficult to effectively identify and adapt to unknown or variant protocols, resulting in a complex access process and poor scalability. There are various structural relationships between fields in communication messages, such as bit order association, interaction direction correspondence, and control dependency. Traditional methods based on simple field segmentation or shallow feature matching cannot effectively model these implicit structural relationships, resulting in incomplete field semantic parsing and protocol misunderstanding, affecting the accuracy of subsequent data conversion. In multi-round communication interactions, there are complex correspondences and temporal dependencies between request and response messages. Existing methods lack the ability to systematically model cross-message interaction relationships, making it difficult to ensure the stable extraction of field bit relationships. For the field mapping and protocol conversion process, traditional field-by-field matching or regular expression matching methods are prone to failure when faced with changes in field order, nested structures, and dynamically long fields, resulting in unstable conversion links and difficulty in ensuring data consistency.

[0003] Therefore, how to provide a method and system for IoT device access and protocol adaptive conversion is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] One objective of this invention is to propose a method and system for IoT device access and adaptive protocol conversion. This invention constructs message field fragments and bit sequence trajectories by identifying frame boundaries and locating fields in the original message stream, and forms a protocol attribute matrix based on field type labeling, bit sequence calibration, and interaction direction identification. By improving the TabTransformer model and introducing a bit sequence rheometry mechanism at the feature interaction layer, it jointly models field bit sequence relationships, interaction direction relationships, and dependency relationships to generate a protocol context vector. Combining the protocol context vector, it constructs a protocol relationship graph and uses the Leiden algorithm to introduce a time-oriented community partitioning mechanism to obtain protocol clusters and cluster center field chains. Furthermore, it constructs a field matching dictionary based on field bit sequence relationships and forms an Aho-Corasick automaton to achieve multi-pattern matching of message field fragments and bit sequence trajectories, generating field mapping relationships and mapping links, thereby completing field rearrangement, encoding conversion, and instruction reconstruction. This invention has the advantages of high automation in protocol parsing, strong adaptability to multi-source heterogeneous devices, high stability of field mapping relationships, and high accuracy in protocol conversion.

[0005] An IoT device access and protocol adaptive conversion method according to an embodiment of the present invention includes the following steps: S1. Obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; S2. Label the field type, position, and interaction direction of the message field fragments and position trajectory, extract the field position relationship, interaction direction relationship, and dependency relationship, and construct the protocol attribute matrix. S3. Input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector. S4. Construct a protocol relationship graph based on the protocol context vector; S5. The Leiden algorithm is used to divide the protocol relationship graph into communities. A time-oriented community homing mechanism is introduced during the community refinement process to generate protocol clusters. The cluster center field chain is determined based on the field connection relationship within the protocol cluster. S6. Extract field alignment relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and construct an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; S7. Based on the mapping link, perform field rearrangement, encoding conversion, and instruction reconstruction on the original message stream to generate a converted message.

[0006] Optionally, S1 specifically includes: Acquire the continuous byte stream of messages from the target access device during the communication establishment process, and record the message order according to the message arrival time; The start identifier, length field, and check field are identified in the continuous message byte stream, and the boundaries of a single frame message are determined based on the start identifier, length field, and check field to obtain a single frame message; The field start offset, field end offset, and field length are parsed according to the field arrangement order in a single frame message to determine the field boundaries; the single frame message is then split according to the field boundaries to obtain message field fragments. The positional trajectory is obtained by recording the changes in field positions based on the offset position, arrangement order, and sequence of message field fragments in multiple single-frame messages.

[0007] Optionally, the step of labeling message field fragments and bit sequence trajectories with field type, bit sequence, and interaction direction, and extracting field bit sequence relationships, interaction direction relationships, and dependency relationships, specifically involves: The message field fragments are classified into types based on the field value range, field length, and field position in a single frame message, resulting in field type labeling results for numeric fields, control fields, and check fields; The field position is determined according to the field's start offset, end offset, and arrangement order in a single frame message; Based on the order of messages in the continuous message byte stream and the direction of sending and receiving, determine the request direction identifier and response direction identifier corresponding to the field; The adjacent relationships between fields are determined based on their position and arrangement order, thus forming the field positional relationships; The interaction correspondence between fields is determined based on the message sending and receiving direction and the correspondence between adjacent messages, thus forming the interaction direction relationship; Based on the positional relationship between control fields and associated fields, the length correspondence between length fields and data fields, and the verification coverage relationship between verification fields and the entire message frame, dependency relationships are formed between fields.

[0008] Optionally, the construction of the protocol attribute matrix specifically involves: Convert field type annotation results to field type encoding; convert the position of a field in a single frame message to bit order encoding; convert request direction identifiers and response direction identifiers to direction encoding; convert field bit order relationships to bit order relationship encoding; convert interaction direction relationships to interaction relationship encoding; convert dependency relationships to dependency relationship encoding; Using the message field fragments in a single frame as matrix rows, and the field type encoding, bit order encoding, direction encoding, bit order relation encoding, interaction relation encoding, and dependency relation encoding as matrix columns, the various encodings corresponding to the same message field fragment are aligned and arranged to generate field attribute row vectors. These vectors are then combined according to the message arrangement order to obtain the protocol attribute matrix.

[0009] Optionally, the improved TabTransformer model specifically includes a field embedding layer, a relation injection layer, a feature interaction layer, and a vector output layer; The field embedding layer treats each row of the protocol attribute matrix as a message field fragment, maps the field type encoding to a type vector, the bit order encoding to a bit order vector, and the direction encoding to a direction vector; and connects the type vector, bit order vector, and direction vector according to the correspondence of the same message field fragment to form a field attribute vector. The relationship injection layer sets the positional association position, directional association position, and dependent association position in the field attribute vector, fills the positional relationship code into the positional association position, fills the interaction relationship code into the directional association position, and fills the dependent relationship code into the dependent association position to form a relationship enhancement vector; the relationship enhancement vector is arranged according to the field arrangement order in a single frame message to form a field vector sequence; The feature interaction layer introduces a bit order transformation mechanism, which determines the order of fields based on their position in a single frame message; distinguishes the field interaction direction based on request direction identifiers and response direction identifiers and forms corresponding arrangement relationships; determines the connection order between control fields, length fields, data fields, and verification fields based on the dependency relationships between fields; writes the field arrangement order, corresponding arrangement relationships, and connection order into the field association order in the field vector sequence; and rearranges the field arrangement order in the field vector sequence according to the field association order to form a rearranged field vector sequence. In the rearranged field vector sequence, each field vector is transformed into a corresponding value, an index value, and a passed value. The corresponding value and the index value are multiplied in the same position one by one, and the product is normalized according to the rearranged field order to form a field association distribution. The passed values ​​are weighted and accumulated according to the distribution weight in the field association distribution to obtain the contextualized field vector corresponding to each message field fragment. The vector output layer concatenates the contextualized field vectors in the same single frame message in the order of field arrangement to form a single frame context vector; and arranges multiple single frame context vectors in the order of message arrangement to obtain a protocol context vector.

[0010] Optionally, S4 specifically includes: The protocol context vector is divided according to the message arrangement order to obtain multiple single-frame context vectors, and each single-frame context vector is decomposed into corresponding field context fragments according to the field arrangement order. Establish node mapping relationships between field context fragments and corresponding message field fragments to form graph nodes; Within the same single-frame message, based on the position of the field in the message, a positional connection is established between the corresponding graph nodes of adjacent fields; between adjacent messages, a directional connection is established between graph nodes with interactive correspondence, combining the request direction identifier and the response direction identifier; and a dependency connection is established between the corresponding graph nodes, combining the dependency relationships between the control field, length field, data field, and check field; the positional relationship encoding, interaction relationship encoding, and dependency relationship encoding are respectively written into the positional connection relationship, directional connection relationship, and dependency connection relationship. For each graph node, the vector components in the field context fragment are multiplied and summed to obtain the node association value; the differences between the node association values ​​at both ends of the positional connection relationship, the node association values ​​at both ends of the directional connection relationship, and the node association values ​​at both ends of the dependent connection relationship are calculated to obtain the boundary value of the corresponding connection relationship. Write the edge values ​​corresponding to the positional connection relationship, directional connection relationship, and dependent connection relationship into the corresponding connection relationship to form a protocol relationship graph.

[0011] Optionally, S5 specifically includes: Each node in the protocol relationship graph is used as the initial community unit, and the edge values ​​corresponding to the positional connection relationship, directional connection relationship and dependent connection relationship are preserved; The connection edge values ​​between the nodes in the graph and their neighboring communities are statistically analyzed and summed to obtain the total connection value of the nodes pointing to different neighboring communities. The total connection values ​​of different neighboring communities are compared, and the community with the largest total connection value is selected as the node's destination direction. In the process of community refinement, a time-oriented community homing mechanism is introduced. The graph nodes that are homed to the same community are arranged in order according to the position of the field in the single frame message. The sequential arrangement results are distinguished by direction according to the request direction identifier and the response direction identifier. The connection order of the direction distinction results is adjusted by combining the dependency relationship between the control field, length field, data field and check field. Graph nodes with continuous positional order, consistent orientation, and continuous dependency relationships form the same refined community; graph nodes with interrupted positional order, changed orientation, or broken dependency relationships separate from the original community. Based on the refinement of the community, the boundary values ​​corresponding to the positional connection, directional connection and dependency connection are accumulated to obtain the sum of the boundary values ​​within the community. This sum is then compared with the sum of the boundary values ​​within the community before refinement, and the community division results with larger sums of boundary values ​​are retained. Using refined communities as merging units, graph nodes within the same refined community are merged to form merged nodes. The boundary values ​​for the connection relationships between merged nodes are recalculated. These boundary values ​​are obtained by accumulating the boundary values ​​corresponding to positional connection relationships, directional connection relationships, and dependency connection relationships. Based on the merged nodes, the node inclusion, community refinement and merging processes are repeatedly executed until the community division results remain stable, resulting in a protocol cluster. Within each protocol cluster, the graph nodes are arranged sequentially according to the position of the field in the single frame message, and the edge values ​​corresponding to the connection relationships are accumulated to obtain the total node connection value. The graph node with the largest total node connection value is selected as the starting node of the cluster center, and then extended sequentially along the positional connection relationship and the dependency connection relationship to form the cluster center field chain.

[0012] Optionally, S6 specifically includes: Based on the protocol cluster structure, the message field fragments corresponding to the graph nodes are organized, and field correspondence items are formed according to the arrangement order of the cluster center field chain; Based on the positional connection relationship, directional connection relationship and dependent connection relationship between the nodes in the graph, the message field fragments in the field matching item are arranged accordingly to form the field alignment relationship; Write the field identifier, field type, position, request direction identifier, response direction identifier, and dependency relationship into the field alignment relationship to form a field matching term; Based on the order of the field identifiers in the field matching terms, write the field matching terms into the state path to construct the state nodes, state transition edges, and mismatch backoff edges in the Aho-Corasick automaton; Based on the arrangement order of the original message stream, the message field fragments and the bit sequence trajectory are input into the Aho-Corasick automaton, and the field identifier, field type and bit sequence position are matched segment by segment according to the state transition edge; Based on the consistency between the matching result and the field matching terms, record the corresponding status node number and field matching position, and back off based on the mismatch backoff edge when there is a discrepancy; Based on the consistency between the request direction identifier, response direction identifier, dependency relationship and the corresponding information in the field matching terms, the corresponding message field fragments are identified as the same mapping unit; Based on the adjacency relationship of adjacent message field segments in the positional trajectory within the cluster center field chain, the mapping units are sequentially connected to form field mapping relationships; the field mapping relationships are then connected according to the message arrangement order to form mapping links.

[0013] Optionally, S7 specifically includes: Based on the mapping link, the message field fragments in the original message stream are rearranged according to the field mapping relationship, and the target field arrangement sequence is formed according to the field connection order in the mapping link; Based on the field type labeling results in the field positional relationship, the encoding method of the message field fragments in the target field arrangement sequence is adjusted, and the field values ​​are converted according to the encoding rules corresponding to the field types to form the encoded field sequence; The field sequence after encoding conversion is reconstructed according to the arrangement order of the cluster center field chain, and the order of the control field, length field, data field and check field is adjusted according to the dependency relationship between the fields to form the instruction field sequence; Based on the length correspondence between the length field and the data field, the length of the data field in the instruction field sequence is recalculated, and the calculation result is written into the corresponding length field. Based on the verification coverage relationship between the verification field and the entire frame message, the verification calculation is performed on the instruction field sequence, and the verification result is written into the corresponding verification field. The instruction field sequence is concatenated according to the field arrangement order of the single frame message to form a converted single frame message; multiple converted single frame messages are combined according to the message arrangement order to form a converted message.

[0014] Optionally, an IoT device access and protocol adaptive conversion system includes the following modules: The message parsing module is used to obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; The attribute construction module is used to annotate the field type, mark the position, and identify the interaction direction of message field fragments and position trajectories, extract the field position relationship, interaction direction relationship and dependency relationship, and construct the protocol attribute matrix. The representation modeling module is used to input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector. The graph construction module is used to construct a protocol relationship graph based on the protocol context vector; The community partitioning module is used to partition the protocol relationship graph into communities using the Leiden algorithm. During the community refinement process, a time-oriented community homing mechanism is introduced to generate protocol clusters and determine the cluster center field chain based on the field connection relationship within the protocol cluster. The mapping generation module is used to extract field pairing relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and build an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; The protocol conversion module is used to perform field rearrangement, encoding conversion, and instruction reconstruction on the original message stream according to the mapping link, and generate converted messages.

[0015] The beneficial effects of this invention are: This invention introduces a positional rheometry mechanism into the feature interaction layer of the improved TabTransformer model, jointly modeling field positional relationships, interaction direction relationships, and dependency relationships. By rearranging the field association order and constructing the field association distribution, it realizes the dynamic expression of the structural relationship between fields, solves the problem of insufficient modeling of implicit structural relationships in traditional methods, and improves the accuracy of protocol context vector expression. A protocol relationship graph is constructed based on protocol context vectors, and a time-oriented community homing mechanism is introduced into the Leiden algorithm. The community refinement process is constrained by position, interaction direction and dependency relationship, generating protocol clusters and cluster center field chains. This solves the problems of complex cross-message interaction relationships and difficulty in stable extraction of field position relationships, and improves the stability and accuracy of protocol structure division. A field matching dictionary is constructed based on the protocol cluster structure and the cluster center field chain. Combined with the Aho-Corasick automaton, multi-mode matching is performed on message field fragments and bit sequence trajectories to form field mapping relationships and mapping links. This enables field rearrangement, encoding conversion and instruction reconstruction, solving the problem of failure of traditional field matching methods under field order changes and dynamic structures, and improving the accuracy and robustness of protocol adaptive conversion. Attached Figure Description

[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of an IoT device access and protocol adaptive conversion method proposed in this invention; Figure 2 This is a data flow diagram of an IoT device access and protocol adaptive conversion method proposed in this invention; Figure 3This is a schematic diagram of an IoT device access and protocol adaptive conversion system proposed in this invention. Detailed Implementation

[0017] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0018] refer to Figures 1-2 A method for IoT device access and protocol adaptive conversion includes the following steps: S1. Obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; S2. Label the field type, position, and interaction direction of the message field fragments and position trajectory, extract the field position relationship, interaction direction relationship, and dependency relationship, and construct the protocol attribute matrix. S3. Input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector. S4. Construct a protocol relationship graph based on protocol context vectors; S5. The Leiden algorithm is used to divide the protocol relationship graph into communities. A time-oriented community homing mechanism is introduced during the community refinement process to generate protocol clusters. The cluster center field chain is determined based on the field connection relationship within the protocol cluster. S6. Extract field alignment relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and construct an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; S7. Based on the mapping link, perform field rearrangement, encoding conversion, and instruction reconstruction on the original message stream to generate a converted message.

[0019] In this embodiment, S1 specifically refers to: Acquire the continuous byte stream of messages from the target access device during the communication establishment process, and record the message order according to the message arrival time; The start identifier, length field, and check field are identified in the continuous message byte stream, and the boundaries of a single frame message are determined based on the start identifier, length field, and check field to obtain a single frame message; The field start offset, field end offset, and field length are parsed according to the field arrangement order in a single frame message to determine the field boundaries; the single frame message is then split according to the field boundaries to obtain message field fragments. The positional trajectory is obtained by recording the changes in field positions based on the offset position, arrangement order, and sequence of message field fragments in multiple single-frame messages.

[0020] In this embodiment, the message field fragments and bit sequence trajectories are labeled with field type, bit sequence, and interaction direction, and the field bit sequence relationship, interaction direction relationship, and dependency relationship are extracted, specifically as follows: The message field fragments are classified into types based on the field value range, field length, and field position in a single frame message, resulting in field type labeling results for numeric fields, control fields, and check fields; The field position is determined according to the field's start offset, end offset, and arrangement order in a single frame message; Based on the order of messages in the continuous message byte stream and the direction of sending and receiving, determine the request direction identifier and response direction identifier corresponding to the field; The adjacent relationships between fields are determined based on their position and arrangement order, thus forming the field positional relationships; The interaction correspondence between fields is determined based on the message sending and receiving direction and the correspondence between adjacent messages, thus forming the interaction direction relationship; Based on the positional relationship between control fields and associated fields, the length correspondence between length fields and data fields, and the verification coverage relationship between verification fields and the entire message frame, dependency relationships are formed between fields.

[0021] In this embodiment, the protocol attribute matrix is ​​constructed as follows: Convert field type annotation results to field type encoding; convert the position of a field in a single frame message to bit order encoding; convert request direction identifiers and response direction identifiers to direction encoding; convert field bit order relationships to bit order relationship encoding; convert interaction direction relationships to interaction relationship encoding; convert dependency relationships to dependency relationship encoding; Using the message field fragments in a single frame as matrix rows, and the field type encoding, bit order encoding, direction encoding, bit order relation encoding, interaction relation encoding, and dependency relation encoding as matrix columns, the various encodings corresponding to the same message field fragment are aligned and arranged to generate field attribute row vectors. These vectors are then combined according to the message arrangement order to obtain the protocol attribute matrix.

[0022] In this embodiment, the improved TabTransformer model specifically includes a field embedding layer, a relation injection layer, a feature interaction layer, and a vector output layer; In the field embedding layer, the field type encoding is entered into the type mapping table, the positional encoding is entered into the positional mapping table, and the direction encoding is entered into the direction mapping table. The type mapping table, positional mapping table, and direction mapping table output type vector, positional vector, and direction vector of the same length, respectively. The type vector is located at the beginning, the positional vector is located in the middle, and the direction vector is located at the end. The three parts are connected end to end in a fixed order to form the field attribute vector. Each encoding position in the type mapping table corresponds to a vector unit. The field type encoding directly indexes the vector unit of the corresponding category. Each encoding position in the position mapping table corresponds to a position in a single frame of the message. Each encoding position in the direction mapping table corresponds to a request direction identifier or a response direction identifier. The three types of vector units are updated synchronously during the same training process. The type information, position information and direction information in the field attribute vector maintain a consistent dimension. In the relation injection layer, the positional relation encoding is written to the positional association position in the field attribute vector, the interaction relation encoding is written to the direction association position, and the dependency relation encoding is written to the dependency association position. The writing method is to add the relation vector corresponding to the relation encoding to the original position vector item by item to form the relation enhancement vector. After the relation enhancement vectors are formed, all relation enhancement vectors in a single frame are arranged into a field vector sequence according to the field arrangement order, and each position in the field vector sequence is consistent with the position of the field fragment in the message. In the feature interaction layer, the positional rheometry mechanism rearranges the field vector sequence. The position of the field in a single frame message determines the order of the fields. The request direction identifier and the response direction identifier determine the correspondence of the field interaction direction. The dependency relationship determines the connection order between the control field, length field, data field and check field. The three types of relationships together constitute the field association order. The field vector sequence is rearranged according to the field association order. Fields with positional adjacency are arranged adjacently, fields with interactive correspondence are arranged in pairs, and fields with dependency are arranged along the dependency direction. In the rearranged field vector sequence, each field vector enters three sets of linear transformation channels to form corresponding values, index values ​​and transit values. The corresponding values ​​and index values ​​are multiplied item by item and summed item by item. The summation result is normalized within the same field arrangement interval. The normalization process obtains the field association distribution by subtracting the minimum value and dividing by the summation value. The transmitted values ​​are weighted and accumulated according to the distribution weights in the field association distribution to obtain a contextualized field vector. The field order relationship, interaction direction relationship and dependency relationship simultaneously participate in the construction of the field association order and the formation of the field association distribution. In the vector output layer, the contextualized field vectors within a single frame message are concatenated sequentially according to the field arrangement order, and the concatenation result forms a single frame context vector. Multiple single-frame context vectors are arranged in the order of message arrangement to form a message vector sequence. The message arrangement order is consistent with the arrival order in the continuous message byte stream. The output at the end of the message vector sequence, together with the vectors at the beginning, represents the protocol context information in the communication establishment process, forming a protocol context vector.

[0023] In this implementation, the improved TabTransformer model, along with the original TabTransformer model, employs a field embedding layer, a feature interaction layer, and a vector output layer to construct a feature modeling framework based on representation learning. Both models extract latent feature information through the interaction relationships between field vectors and output a unified context vector for subsequent processing. Building upon this, a relation injection layer is introduced to structurally embed field positional relationships, interaction direction relationships, and dependency relationships. This expands the original field attribute vectors, which only contain field type, positional, and direction information, into relation enhancement vectors that include relational information, allowing the structural associations between fields to be explicitly expressed at the input stage. In the feature interaction layer, a positional rheometry mechanism is introduced. The field arrangement order is constructed based on the positional position of the field in a single frame message; the field interaction direction correspondence is constructed based on the request direction identifier and the response direction identifier; and the connection order between control fields, length fields, data fields, and validation fields is constructed based on dependency relationships. These three types of relationships are uniformly transformed into a field association order, and the field vector sequence is rearranged, transforming the field arrangement from a fixed positional order to a structure-driven order. In the rearranged field vector sequence, the corresponding values ​​and index values ​​are used to... The improved model employs a multiplication and normalization process to form a field association distribution. This distribution is then used to weight and accumulate the transmitted values, enabling joint modeling of field positional relationships, interaction direction relationships, and dependency relationships. This allows the strength of field associations to dynamically adjust as structural relationships change. The improved model introduces explicit structural constraints at the field level, avoiding the insufficient structural relationship expression caused by the traditional TabTransformer's reliance on implicit attention weights. In complex protocol messages, it accurately maintains the dependency relationships between control and data fields, as well as the interaction correspondence between request and response messages. Through the construction and rearrangement of field association order, the model exhibits stable response capabilities to field arrangement perturbations, maintaining consistent contextual expression even with differences in message formats across different devices. Guided by the field association distribution, long-distance dependencies between fields are enhanced, reducing interference from irrelevant fields and improving the accuracy of protocol semantic extraction. Overall, the improvements enhance the protocol context vector in terms of structural consistency, interaction consistency, and semantic consistency, thereby improving the stability and accuracy of subsequent protocol relationship graph construction, community partitioning, and field mapping processes.

[0024] In this embodiment, S4 specifically refers to: The protocol context vector is segmented along the message arrangement order to form multiple single-frame context vectors. The vector positions in the single-frame context vector correspond one-to-one with the field arrangement order in the single-frame message. The single-frame context vector is decomposed into field context fragments according to the field arrangement order. The starting position of the field context fragment is consistent with the starting offset of the message field fragment, and the ending position is consistent with the ending offset. Field context fragments and corresponding message field fragments are combined to form graph nodes. Graph nodes record field identifiers, field types, positional positions, request direction identifiers, response direction identifiers, and dependency relationships. Within the same single frame message, adjacent spectral nodes are connected sequentially to form a spectral connection relationship, with the connection direction from the spectral node with the smaller spectral position to the spectral node with the larger spectral position. Between adjacent messages, the graph node corresponding to the request direction identifier and the graph node corresponding to the response direction identifier are connected according to the interactive correspondence to form a directional connection relationship, and the connection direction is from the request direction graph node to the response direction graph node; Within a single frame message, the graph node corresponding to the control field is connected to the graph node corresponding to the controlled field, the graph node corresponding to the length field is connected to the graph node corresponding to the data field, and the graph node corresponding to the verification field is connected to the graph node at the end of the range of the field being verified. The connection results form a dependency connection relationship. The bit order relation encoding is written into the relation position in the bit order connection relation, the interaction relation encoding is written into the relation position in the directional connection relation, and the dependency relation encoding is written into the relation position in the dependency connection relation. The writing result and the connection direction together constitute the connection relation information. The vector components in the field context fragment corresponding to the graph node are multiplied and accumulated one by one in the order of arrangement, and the accumulated result forms the node association value. The node association values ​​of the graph nodes at both ends of the positional connection relationship are subtracted; the node association values ​​of the graph nodes at both ends of the directional connection relationship are subtracted; the node association values ​​of the graph nodes at both ends of the dependent connection relationship are subtracted; and the difference results form the boundary values ​​of the corresponding connection relationships. Boundary values ​​are written with the corresponding positional connection relationships, directional connection relationships, and dependent connection relationships. The connection relationship information is retained together with the boundary values. The graph nodes, positional connections, directional connections, dependency connections, and corresponding boundary values ​​are combined to form a protocol relationship graph. The graph structure is consistent with the field arrangement, interaction, and dependency relationships in the original message stream.

[0025] In this embodiment, S5 specifically refers to: Each node in the protocol relationship graph is treated as an initial community unit, and the boundary values ​​corresponding to the positional connection relationship, directional connection relationship and dependent connection relationship are retained between the initial community units. For any graph node, the connection edge values ​​between the graph node and its neighboring community units are counted and accumulated one by one to form the total connection value of the graph node to different neighboring communities. The neighboring community with the largest total connection value is determined as the direction to which the graph node is assigned. After a graph node is assigned to a community, the graph nodes assigned to the same community enter the community refinement process. The position of the fields in a single frame message determines the arrangement order of the graph nodes. The request direction identifier and the response direction identifier determine the direction differentiation result of the graph nodes. The dependency relationship between the control field, length field, data field and check field determines the connection order between graph nodes. Graph nodes with continuous positional order, consistent orientation, and continuous dependency relationships are retained in the same refined community; graph nodes with interrupted positional order, changed orientation, or broken dependency relationships are separated from the original community. After the community is refined, the boundary values ​​of the positional connection relationship, the directional connection relationship, and the dependency connection relationship within the community are accumulated separately. The sum of the three accumulated results forms the total boundary value within the community. If the total boundary value within the community is greater than the total boundary value of the corresponding community before refinement, the refined community is retained. The refined communities that are retained are used as merging units. Graph nodes in the same refined community are merged into merged nodes according to their positional order. The positional connection boundary values, directional connection boundary values, and dependent connection boundary values ​​between merged nodes are formed by accumulating the corresponding boundary values ​​before merging. After merging, the protocol relationship graph continues to incorporate graph nodes, refine communities, and update merged nodes. When the number of communities, graph node affiliation, and connection edge values ​​remain unchanged in the two rounds, a protocol cluster is formed. After the protocol cluster is formed, the graph nodes within the protocol cluster are arranged in order of the position of the field in the single frame message. The edge values ​​of the positional connection relationship, the edge values ​​of the directional connection relationship, and the edge values ​​of the dependent connection relationship corresponding to the graph node are accumulated to form the total node connection value. The graph node with the largest total node connection value is determined as the cluster center starting node. The cluster center starting node extends sequentially along the positional connection relationship and the dependency connection relationship to form the cluster center field chain.

[0026] In this embodiment, S6 specifically refers to: The graph nodes within the protocol cluster are arranged in order of their positions in a single frame message. The arrangement results correspond one-to-one with the node order in the cluster center field chain. The message field fragments corresponding to the graph nodes are organized into field reference items in sequence. Each message field fragment in the field lookup item retains the field identifier, field type, position, request direction identifier, response direction identifier, and dependency relationship. The node order in the cluster center field chain serves as the target arrangement order for the field lookup item. The positional connection relationship determines the correspondence between the preceding and following positions of the field reference items; the directional connection relationship determines the interactive correspondence between the request direction field and the response direction field; and the dependency connection relationship determines the dependency correspondence between the control field, length field, data field and check field. The three types of correspondence relationships together form the field positional relationship. After the field alignment relationship is formed, the field identifier, field type, position, request direction identifier, response direction identifier, and dependency relationship in the same field alignment relationship are written into the same term in sequence. The contents of the term are arranged in a fixed order, with the field identifier and field type at the beginning, the position in the middle, and the request direction identifier, response direction identifier, and dependency relationship at the end. After the arrangement is completed, a field matching term is formed. Field matching terms are written into the state path in the order of field identifiers. The first field matching term corresponds to the starting state node, and the next field matching term is connected to the previous field matching term to form the next state node. A state transition edge is formed between adjacent state nodes. When there is a mismatch in field identifiers in the state path, the state node points to the previous state node that can continue to match to form a mismatch backoff edge. The state node, state transition edge and mismatch backoff edge together constitute the Aho-Corasick automaton. The message field fragments in the original message stream enter the Aho-Corasick automaton in the order of message arrangement. The bit sequence trajectory is synchronized with the message field fragments. Each message field fragment after entering the automaton is first compared with the field identifier in the current state node, then compared with the field type, and finally compared with the bit sequence position. When the three items are consistent, it enters the next state node along the state transition edge. When there is a discrepancy in the field identifier, field type, or bit order position, the current position backtracks to the previous state node along the mismatch backtracking edge. The backtracked state node continues to compare with the current message field fragment until it enters a new state transition edge or returns to the starting state node. When state transitions are consecutively established, the state node number and the field matching position are written to the same matching record, and the field matching position in the matching record corresponds to the field arrangement position in the original message stream. When the request direction identifier matches the direction information in the field matching term, the response direction identifier matches the direction information in the field matching term, and the dependency relationship matches the dependency relationship in the field matching term, the corresponding message field fragments are grouped into the same mapping unit. After the mapping unit is formed, when the status nodes corresponding to the adjacent message field segments in the bit sequence trajectory are consistent with the adjacent nodes in the cluster center field chain, the previous mapping unit and the next mapping unit are connected sequentially in the bit sequence direction, and the connection result forms a field mapping relationship. The field mapping relationships are connected sequentially along the message arrangement order, with the end of the previous field mapping relationship corresponding to the beginning of the next field mapping relationship. All field mapping relationships are connected end to end to form a mapping link. After the mapping link is formed, each position in the link corresponds to a segment of a message field in the original message stream. The connection direction in the link is consistent with the node order in the cluster center field chain. The field alignment relationship, field matching terms, and mapping units in the link together define the basis for the arrangement of field rearrangement, encoding conversion, and instruction reconstruction.

[0027] In this embodiment, S7 specifically refers to: Based on the mapping link, the message field fragments in the original message stream are rearranged according to the field mapping relationship, and the target field arrangement sequence is formed according to the field connection order in the mapping link; Based on the field type labeling results in the field positional relationship, the encoding method of the message field fragments in the target field arrangement sequence is adjusted, and the field values ​​are converted according to the encoding rules corresponding to the field types to form the encoded field sequence; The field sequence after encoding conversion is reconstructed according to the arrangement order of the cluster center field chain, and the order of the control field, length field, data field and check field is adjusted according to the dependency relationship between the fields to form the instruction field sequence; Based on the length correspondence between the length field and the data field, the length of the data field in the instruction field sequence is recalculated, and the calculation result is written into the corresponding length field. Based on the verification coverage relationship between the verification field and the entire frame message, the verification calculation is performed on the instruction field sequence, and the verification result is written into the corresponding verification field. The instruction field sequence is concatenated according to the field arrangement order of the single frame message to form a converted single frame message; multiple converted single frame messages are combined according to the message arrangement order to form a converted message.

[0028] refer to Figure 3 In this embodiment, an IoT device access and protocol adaptive conversion system includes the following modules: The message parsing module is used to obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; The attribute construction module is used to annotate the field type, mark the position, and identify the interaction direction of message field fragments and position trajectories, extract the field position relationship, interaction direction relationship and dependency relationship, and construct the protocol attribute matrix. The representation modeling module is used to input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector. The graph construction module is used to construct protocol relationship graphs based on protocol context vectors. The community partitioning module is used to partition the protocol relationship graph into communities using the Leiden algorithm. During the community refinement process, a time-oriented community homing mechanism is introduced to generate protocol clusters and determine the cluster center field chain based on the field connection relationship within the protocol cluster. The mapping generation module is used to extract field pairing relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and build an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; The protocol conversion module is used to rearrange fields, convert encodings, and reconstruct instructions in the original message stream according to the mapped link, and generate converted messages.

[0029] Example 1: To verify the feasibility of this invention in practice, it was applied to an IoT access platform in a large smart manufacturing park. The park simultaneously connects 126 devices, including CNC machine tools, environmental monitoring terminals, energy metering terminals, and warehouse control terminals. Communication interfaces include RS485, Ethernet, and serial server forwarding links. In actual operation, Modbus RTU variant messages, custom-length field messages, messages with checksum extensions, and request-response paired interaction messages are simultaneously present. The original access platform used a fixed rule table and manual protocol mapping. When adding new devices, engineers had to check the field positions, length bytes, and checksum rules item by item. On average, it took 2.5 days per type of device to complete protocol adaptation. Furthermore, if the message field order changed or the length field position was adjusted, the original mapping relationship easily became invalid, leading to message parsing errors, field misalignment, and mismatched response instructions. To address this issue, the IoT device access and protocol adaptive conversion method of this invention is adopted. The message parsing module obtains the original message stream, forming message field fragments and bit sequence trajectories. Then, the attribute construction module forms a protocol attribute matrix. The representation modeling module inputs the protocol attribute matrix into the improved TabTransformer model and performs joint modeling of field bit sequence relationships, interaction direction relationships, and dependency relationships through a bit sequence rheometry mechanism to form a protocol context vector. The graph construction module constructs a protocol relationship graph based on the protocol context vector. The community division module obtains protocol clusters and cluster center field chains through the Leiden algorithm and a time-oriented community homing mechanism. The mapping generation module constructs a field matching dictionary and an Aho-Corasick automaton and outputs mapping links. The protocol conversion module completes field rearrangement, encoding conversion, and instruction reconstruction based on the mapping links, generates converted messages, and connects to the unified IoT platform of the park.

[0030] In practical applications, seven consecutive days of field communication messages were collected, yielding 186,000 raw message streams, averaging approximately 26,500 messages per day. After frame boundary identification, the system extracted 742 stable field fragment patterns and 96 sets of high-frequency request-response correspondences. The TabTransformer model was improved to ensure the number of rows in the input protocol attribute matrix matches the number of fields in a single frame message, with a fixed number of 6 columns, corresponding to field type encoding, bit order encoding, direction encoding, bit order relation encoding, interaction relation encoding, and dependency relation encoding, respectively. After 32 rounds of training, the protocol context vector clearly distinguishes between different device types, forming 41 protocol clusters in the protocol relationship graph. This ultimately generated 41 cluster-centric field chains, and based on these, a field matching dictionary of 1186 entries was established. After the Aho-Corasick automaton completes online matching, it can quickly assign new messages to the corresponding mapping links, avoiding the need for manual rule writing for each field. After 30 days of continuous operation following deployment, 18 new devices were added, with 14 completing the connection on the same day and the remaining 4 completing calibration the following day, significantly shortening the connection cycle. Table 1 provides comparative data between the method of this invention and the original rule mapping method in the protocol access and parsing stages.

[0031] Table 1 Comparison of IoT Device Access and Protocol Parsing Effects

[0032] As shown in Table 1, the method of this invention has significant advantages in access efficiency and parsing stability. The average access cycle for a single type of device decreased from 60.4 hours to 8.7 hours, indicating that this invention forms a relatively complete automatic adaptation link through the protocol attribute matrix, protocol relationship graph, and field matching dictionary, significantly reducing manual intervention. The field parsing accuracy increased from 89.1% to 98.3%, and the request-response correspondence recognition accuracy increased from 84.7% to 97.6%, indicating that the bit order change mechanism can effectively characterize the field bit order relationship and interaction direction relationship, and the time-oriented homing mechanism can stably distinguish graph nodes in different interaction time sequences. The field misalignment rate decreased to 1.1%, and the number of manual modifications decreased from 46 times per month to 9 times, indicating that this invention has better adaptability to changes in message order, length field, and dependency relationship, and can effectively solve the problem of frequent failures of the original rule mapping method in the field.

[0033] To further verify the engineering application effect of the present invention after the conversion link is formed, the generation quality of the conversion message and the platform operation indicators were continuously statistically analyzed, and the results are shown in Table 2.

[0034] Table 2 Comparison of Transformed Message Generation and Platform Operation Effects

[0035] Table 2 reflects the significant improvement in overall platform performance after message conversion. The message conversion accuracy reached 98.1%, and the instruction reconstruction consistency rate reached 97.2%, indicating that after the field mapping relationship and mapping link are formed, field rearrangement, encoding conversion, and instruction reconstruction can maintain high consistency. This not only solves the problem of unstable field correspondence but also reduces semantic deviations in control instructions during cross-protocol conversion. The average single message conversion latency decreased from 28.4 milliseconds to 15.7 milliseconds, demonstrating that the field matching dictionary and Aho-Corasick automaton can form a highly efficient matching path on-site. The platform-side data storage failure rate, the number of device offline false alarms, and the energy metering data alignment error all decreased significantly, indicating that this invention not only improves the protocol conversion process itself but also enhances the platform's operational stability and data availability after access, meeting the practical needs of long-term continuous operation of the park's IoT system.

[0036] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for IoT device access and protocol adaptive conversion, characterized in that, Includes the following steps: S1. Obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; S1 specifically includes: Acquire the continuous byte stream of messages from the target access device during the communication establishment process, and record the message order according to the message arrival time; The start identifier, length field, and check field are identified in the continuous message byte stream, and the boundaries of a single frame message are determined based on the start identifier, length field, and check field to obtain a single frame message; The field start offset, field end offset, and field length are parsed according to the field arrangement order in a single frame message to determine the field boundaries; the single frame message is then split according to the field boundaries to obtain message field fragments. The positional trajectory is obtained by recording the changes in field positions based on the offset position, arrangement order, and sequence of message field fragments in multiple single-frame messages; S2. Label the field type, position, and interaction direction of the message field fragments and position trajectory, extract the field position relationship, interaction direction relationship, and dependency relationship, and construct the protocol attribute matrix. The process of annotating message field fragments and positional trajectories with field type, positional order, and interaction direction, and extracting field positional relationships, interaction direction relationships, and dependency relationships, specifically involves: The message field fragments are classified into types based on the field value range, field length, and field position in a single frame message, resulting in field type labeling results for numeric fields, control fields, and check fields; The field position is determined according to the field's start offset, end offset, and arrangement order in a single frame message; Based on the order of messages in the continuous message byte stream and the direction of sending and receiving, determine the request direction identifier and response direction identifier corresponding to the field; The adjacent relationships between fields are determined based on their position and arrangement order, thus forming the field positional relationships; The interaction correspondence between fields is determined based on the message sending and receiving direction and the correspondence between adjacent messages, thus forming the interaction direction relationship; Based on the positional relationship between control fields and associated fields, the length correspondence between length fields and data fields, and the verification coverage relationship between verification fields and the entire frame message, dependency relationships are formed between fields; The construction of the protocol attribute matrix is ​​specifically as follows: Convert field type annotation results to field type encoding; convert the position of a field in a single frame message to bit order encoding; convert request direction identifiers and response direction identifiers to direction encoding; convert field bit order relationships to bit order relationship encoding; convert interaction direction relationships to interaction relationship encoding; convert dependency relationships to dependency relationship encoding; Using the message field fragments in a single frame as matrix rows, and the field type encoding, bit order encoding, direction encoding, bit order relation encoding, interaction relation encoding, and dependency relation encoding as matrix columns, the various encodings corresponding to the same message field fragment are aligned and arranged to generate field attribute row vectors. These vectors are then combined according to the message arrangement order to obtain the protocol attribute matrix. S3. Input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector; the improved TabTransformer model specifically includes a field embedding layer, a relationship injection layer, a feature interaction layer and a vector output layer. The field embedding layer treats each row of the protocol attribute matrix as a message field fragment, maps the field type encoding to a type vector, the bit order encoding to a bit order vector, and the direction encoding to a direction vector; and connects the type vector, bit order vector, and direction vector according to the correspondence of the same message field fragment to form a field attribute vector. The relationship injection layer sets the positional association position, directional association position, and dependent association position in the field attribute vector, fills the positional relationship code into the positional association position, fills the interaction relationship code into the directional association position, and fills the dependent relationship code into the dependent association position to form a relationship enhancement vector; the relationship enhancement vector is arranged according to the field arrangement order in a single frame message to form a field vector sequence; The feature interaction layer introduces a bit order variation mechanism, which determines the order of fields based on their position in a single frame message; and distinguishes the field interaction direction based on the request direction identifier and the response direction identifier to form a corresponding arrangement relationship. The connection order between control fields, length fields, data fields, and validation fields is determined based on the dependency relationships between fields; the field arrangement order, corresponding arrangement relationships, and connection order are written into the field association order in the field vector sequence; The fields in the field vector sequence are rearranged according to the field association order to form a rearranged field vector sequence. In the rearranged field vector sequence, each field vector is transformed into a corresponding value, an index value, and a passed value. The corresponding value and the index value are multiplied in the same position one by one, and the product is normalized according to the rearranged field order to form a field association distribution. The passed values ​​are weighted and accumulated according to the distribution weight in the field association distribution to obtain the contextualized field vector corresponding to each message field fragment. The vector output layer concatenates the contextualized field vectors in the same single frame message according to the field arrangement order to form a single frame context vector; and arranges multiple single frame context vectors according to the message arrangement order to obtain a protocol context vector. S4. Construct a protocol relationship graph based on the protocol context vector; S5. The Leiden algorithm is used to divide the protocol relationship graph into communities. A time-oriented community merging mechanism is introduced during the community refinement process to generate protocol clusters. The cluster center field chain is determined based on the field connection relationships within the protocol clusters. Specifically, S5 involves: Each node in the protocol relationship graph is used as the initial community unit, and the edge values ​​corresponding to the positional connection relationship, directional connection relationship and dependent connection relationship are preserved; The connection edge values ​​between the nodes in the graph and their neighboring communities are statistically analyzed and summed to obtain the total connection value of the nodes pointing to different neighboring communities. The total connection values ​​of different neighboring communities are compared, and the community with the largest total connection value is selected as the node's destination direction. In the process of community refinement, a time-oriented community homing mechanism is introduced. The graph nodes that are homed to the same community are arranged in order according to the position of the field in the single frame message. The sequential arrangement results are distinguished by direction according to the request direction identifier and the response direction identifier. The connection order of the direction distinction results is adjusted by combining the dependency relationship between the control field, length field, data field and check field. Graph nodes with continuous positional order, consistent orientation, and continuous dependency relationships form the same refined community; graph nodes with interrupted positional order, changed orientation, or broken dependency relationships separate from the original community. Based on the refinement of the community, the boundary values ​​corresponding to the positional connection, directional connection and dependency connection are accumulated to obtain the sum of the boundary values ​​within the community. This sum is then compared with the sum of the boundary values ​​within the community before refinement, and the community division results with larger sums of boundary values ​​are retained. Using refined communities as merging units, graph nodes within the same refined community are merged to form merged nodes. The boundary values ​​for the connection relationships between merged nodes are recalculated. These boundary values ​​are obtained by accumulating the boundary values ​​corresponding to positional connection relationships, directional connection relationships, and dependency connection relationships. The process of node inclusion, community refinement, and merging is repeated based on the merged nodes until the community partitioning results remain stable, resulting in a protocol cluster. Within each protocol cluster, the graph nodes are arranged sequentially according to the position of the field in the single frame message, and the edge values ​​corresponding to the connection relationships are accumulated to obtain the total node connection value. The graph node with the largest total node connection value is selected as the starting node of the cluster center, and then extended sequentially along the positional connection relationship and the dependency connection relationship to form the cluster center field chain; S6. Extract field alignment relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and construct an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; S7. Based on the mapping link, perform field rearrangement, encoding conversion, and instruction reconstruction on the original message stream to generate a converted message.

2. The method for IoT device access and protocol adaptive conversion according to claim 1, characterized in that, Specifically, S4 is: The protocol context vector is divided according to the message arrangement order to obtain multiple single-frame context vectors, and each single-frame context vector is decomposed into corresponding field context fragments according to the field arrangement order. Establish node mapping relationships between field context fragments and corresponding message field fragments to form graph nodes; Within the same single frame message, based on the position of the field in the message, positional connection relationships are established between the corresponding graph nodes of adjacent fields; between adjacent messages, directional connection relationships are established between graph nodes with interactive correspondence relationships by combining the request direction identifier and the response direction identifier; and dependency connection relationships are established between the corresponding graph nodes by combining the dependency relationships between the control field, length field, data field and check field. The bit order relation encoding, interaction relation encoding, and dependency relation encoding are written into the bit order connection relation, directional connection relation, and dependency connection relation, respectively; For each graph node, the vector components in the field context fragment are multiplied and summed to obtain the node association value; the differences between the node association values ​​at both ends of the positional connection relationship, the node association values ​​at both ends of the directional connection relationship, and the node association values ​​at both ends of the dependent connection relationship are calculated to obtain the boundary value of the corresponding connection relationship. Write the edge values ​​corresponding to the positional connection relationship, directional connection relationship, and dependent connection relationship into the corresponding connection relationship to form a protocol relationship graph.

3. The IoT device access and protocol adaptive conversion method according to claim 1, characterized in that, Specifically, S6 is: Based on the protocol cluster structure, the message field fragments corresponding to the graph nodes are organized, and field correspondence items are formed according to the arrangement order of the cluster center field chain; Based on the positional connection relationship, directional connection relationship and dependent connection relationship between the nodes in the graph, the message field fragments in the field matching item are arranged accordingly to form the field alignment relationship; Write the field identifier, field type, position, request direction identifier, response direction identifier, and dependency relationship into the field alignment relationship to form a field matching term; Based on the order of the field identifiers in the field matching terms, write the field matching terms into the state path to construct the state nodes, state transition edges, and mismatch backoff edges in the Aho-Corasick automaton; Based on the arrangement order of the original message stream, the message field fragments and the bit sequence trajectory are input into the Aho-Corasick automaton, and the field identifier, field type and bit sequence position are matched segment by segment according to the state transition edge; Based on the consistency between the matching result and the field matching terms, record the corresponding status node number and field matching position, and back off based on the mismatch backoff edge when there is a discrepancy; Based on the consistency between the request direction identifier, response direction identifier, dependency relationship and the corresponding information in the field matching terms, the corresponding message field fragments are identified as the same mapping unit; Based on the adjacency relationship of adjacent message field segments in the positional trajectory within the cluster center field chain, the mapping units are sequentially connected to form field mapping relationships; the field mapping relationships are then connected according to the message arrangement order to form mapping links.

4. The IoT device access and protocol adaptive conversion method according to claim 1, characterized in that, Specifically, S7 is: Based on the mapping link, the message field fragments in the original message stream are rearranged according to the field mapping relationship, and the target field arrangement sequence is formed according to the field connection order in the mapping link; Based on the field type labeling results in the field positional relationship, the encoding method of the message field fragments in the target field arrangement sequence is adjusted, and the field values ​​are converted according to the encoding rules corresponding to the field types to form the encoded field sequence; The field sequence after encoding conversion is reconstructed according to the arrangement order of the cluster center field chain, and the order of the control field, length field, data field and check field is adjusted according to the dependency relationship between the fields to form the instruction field sequence; Based on the length correspondence between the length field and the data field, the length of the data field in the instruction field sequence is recalculated, and the calculation result is written into the corresponding length field. Based on the verification coverage relationship between the verification field and the entire frame message, the verification calculation is performed on the instruction field sequence, and the verification result is written into the corresponding verification field. The instruction field sequence is concatenated according to the field arrangement order of the single frame message to form a converted single frame message; multiple converted single frame messages are combined according to the message arrangement order to form a converted message.

5. An IoT device access and protocol adaptive conversion system, comprising executing the IoT device access and protocol adaptive conversion method according to any one of claims 1 to 4, characterized in that, Includes the following modules: The message parsing module is used to obtain the original message stream of the target access device during the communication establishment process, perform frame boundary identification and field positioning, and obtain message field fragments and bit sequence trajectories; The attribute construction module is used to annotate the field type, mark the position, and identify the interaction direction of message field fragments and position trajectories, extract the field position relationship, interaction direction relationship and dependency relationship, and construct the protocol attribute matrix. The representation modeling module is used to input the protocol attribute matrix into the improved TabTransformer model, introduce a positional rheometry mechanism in the feature interaction layer, and jointly model the field positional relationship, interaction direction relationship and dependency relationship to generate a protocol context vector. The graph construction module is used to construct a protocol relationship graph based on the protocol context vector; The community partitioning module is used to partition the protocol relationship graph into communities using the Leiden algorithm. During the community refinement process, a time-oriented community homing mechanism is introduced to generate protocol clusters and determine the cluster center field chain based on the field connection relationship within the protocol cluster. The mapping generation module is used to extract field pairing relationships based on the protocol cluster structure and cluster center field chain, construct a field matching dictionary, and build an Aho-Corasick automaton based on the field matching dictionary to perform multi-mode matching on message field fragments and bit sequence trajectories, generate field mapping relationships, and form mapping links; The protocol conversion module is used to perform field rearrangement, encoding conversion, and instruction reconstruction on the original message stream according to the mapping link, and generate converted messages.

Citation Information

Patent Citations

  • Industrial control message anomaly clustering method based on self-supervision characterization

    CN121644178A

  • Model construction method applied to field classification of industrial control protocol

    CN121644380A