Data transmission interface conversion method

By analyzing the characteristics of the input data and using machine learning models to match the conversion algorithm module, dynamically converting the data and adding error detection and correction processes, the problems of low accuracy and low efficiency of protocol matching and lack of error detection in the prior art are solved, and efficient and reliable data transmission interface conversion is achieved.

CN120123276APending Publication Date: 2025-06-10NANJING SHENDA ENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510188689.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The existing data transmission interface conversion method has low accuracy and efficiency in protocol matching during the conversion process, and lacks error detection and correction processes, which cannot ensure the integrity and reliability of data.

Method used

By receiving input data, its characteristics are analyzed to determine the input protocol, and the target protocol is determined according to the interface type of the target device. Use machine learning models to match the conversion algorithm module, dynamically convert data, and add dynamic hierarchical error detection and correction processes during the conversion process.

Benefits of technology

It improves the accuracy and efficiency of protocol matching, ensures data integrity and reliability, and realizes efficient and flexible data transmission interface conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123276A_ABST
    Figure CN120123276A_ABST
Patent Text Reader

Abstract

The invention discloses a data transmission interface conversion method, which comprises the following steps of: receiving input data, analyzing characteristics of the input data and determining an input protocol; determining a target protocol according to the interface type of the target device; matching conversion algorithm modules by using a machine learning model, and selecting an optimal conversion algorithm module from an algorithm database according to an input protocol and a target protocol; executing data conversion by the selected conversion algorithm module, and converting the input data into a target protocol format; sending the converted data to the target equipment; according to the invention, the protocol type of the input data can be accurately identified and dynamically converted into the target protocol required by the target equipment, the accuracy and efficiency of protocol matching are improved, meanwhile, a dynamic hierarchical error detection and correction process is added in a data transmission interface conversion process, and the integrity and reliability of the data are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a method for converting data transmission interfaces. Background Art

[0002] With the rapid development of information technology, the demand for data transmission between various electronic devices and systems is increasing day by day. Data transmission has become a key link in information interaction. Different devices or systems are usually equipped with different types of data transmission interfaces and protocols, such as common RS-485 interfaces, USB interfaces, Ethernet interfaces, fiber optic interfaces, etc. These interfaces have significant differences in transmission rate, signal characteristics, electrical standards, data formats, and communication protocols. For example, interface incompatibility (different devices use different types of data transmission interfaces), protocol differences (different devices may adopt different communication protocols), inconsistent data formats (different devices have different encoding and decoding methods for data), etc.; when different data transmission interfaces are used between two devices, data conversion is required. In the existing interface conversion methods, the accuracy and efficiency of protocol matching are relatively low during the conversion process, and there is no error detection and correction process, which cannot ensure the integrity and reliability of data. Summary of the Invention

[0003] The purpose of the present invention is to provide a method for converting data transmission interfaces, which can accurately identify the protocol type of input data and dynamically convert it into the target protocol required by the target device, improve the accuracy and efficiency of protocol matching, and at the same time add a dynamic hierarchical error detection and correction process during the data transmission interface conversion process to ensure the integrity and reliability of data.

[0004] The technical solution of the present invention is as follows:

[0005] A method for converting a data transmission interface, comprising:

[0006] (1) Receiving input data, analyzing the characteristics of the input data, and determining the input protocol;

[0007] (2) Determining the target protocol according to the interface type of the target device;

[0008] (3) Using a machine learning model matching conversion algorithm module, selecting the optimal conversion algorithm module from the algorithm database according to the input protocol and the target protocol;

[0009] (4) The selected conversion algorithm module performs data conversion to convert the input data into the target protocol format;

[0010] (5) Sending the converted data to the target device.

[0011] As a preference of the present invention, the process of determining the input protocol is as follows: extract input features from the input data, where the input features include a frame header, a data packet length, a check code, and a timing sequence, and the input feature vector is F = [f 1 , f 2 ,..., f n ; match the extracted input features with the protocol features predefined in the protocol feature library. The protocol feature library is a matrix P, and each row represents the feature vector of a protocol. Calculate the similarity between the input features and each protocol feature in the protocol feature library:

[0012]

[0013] where S i is the similarity between the input features and the i-th protocol in the protocol feature library, and P i is the feature vector of the i-th protocol in the protocol feature library;

[0014] Select the protocol with the highest similarity to the input features as the recognition result:

[0015]

[0016] As a preference of the present invention, the process of using the machine learning model to match the conversion algorithm module is as follows:

[0017] Use the neural network matching algorithm to match the conversion algorithm module predefined in the database; the input feature vector is F, and the target protocol feature vector is T, then the matching score M is:

[0018]

[0019] where:

[0020] S(F, T) is the protocol similarity;

[0021] Latency is the conversion latency;

[0022] Compatibility is the compatibility score;

[0023] w 1 , w 2 , w 3 are weight coefficients given by the protocol matching model and are used to balance the influence of different dimensions;

[0024] Select the conversion algorithm module with the highest score as the matching result.

[0025] As a preference of the present invention, the process of the selected conversion algorithm module performing data conversion is as follows:

[0026] (1) Load the selected conversion algorithm module using a dynamic link library;

[0027] (2) Call the conversion function to convert the input data into the target protocol format;

[0028] (3) After the conversion is completed, call to unload and release resources, close the dynamic link library handle, and clean the cache.

[0029] To improve the accuracy and efficiency of protocol matching, the present invention also includes optimizing the weight coefficients w 1 , w 2 , w 3 , and the specific optimization process is as follows:

[0030] (1) Data preparation: Collect historical data and construct a training data set;

[0031] S1: Record the input feature F and the target protocol feature T for each protocol match;

[0032] S2: Record the actually selected conversion algorithm and its performance metrics, where the performance metrics include latency and compatibility;

[0033] S3: Organize the historical data into training samples (X, y), where X is the input feature matrix, and each row represents the feature vector of a sample [S(F, T), Latency, Compatibility], X = [x 1 , x 2 ,..., x i ,..., x n , and y is the label vector indicating whether the actually selected conversion algorithm is optimal, 1 means optimal, and 0 means non-optimal;

[0034] (2) Model selection: Select a machine learning model and define the model formula;

[0035] Set a logistic regression classification model in the neural network, and the prediction probability formula of the logistic regression is:

[0036]

[0037] Among them, w 0 is the bias term, w 1 , w 2 , w 3 are the weight coefficients;

[0038] (3) Model training: Loss function, optimization algorithm, iterative update;

[0039] S1: Use the cross-entropy loss function to measure the difference between the model prediction value and the true value:

[0040]

[0041] where N is the number of samples;

[0042] S2: Minimize the loss function using the gradient descent method:

[0043]

[0044] where α is the learning rate and j is the weight index (j = 0, 1, 2, 3);

[0045] S3: Repeatedly calculate the gradient and update the weights until the loss function converges or the maximum number of iterations is reached;

[0046] (4) Model evaluation: Divide the dataset and evaluate the model performance;

[0047] Divide the dataset into a training set and a test set, where the training set accounts for 70% and the test set accounts for 30%; Evaluate the model performance using accuracy, precision, recall, and F1-score:

[0048]

[0049]

[0050] where TP is the true positive, TN is the true negative, FP is the false positive, and FN is the false negative;

[0051] (5) Model deployment: Save the model parameters, dynamically load the weights, and select the optimal algorithm;

[0052] Save the obtained weight coefficients w 0 , w 1 , w 2 , w 3 to the algorithm database; During the protocol matching process, dynamically load the weight coefficients and calculate the matching score:

[0053]

[0054] Select the optimal conversion algorithm module according to the matching score M.

[0055] In order to ensure the integrity and reliability of data during the data transmission interface conversion process, the present invention further includes a dynamic hierarchical error detection and correction process, and the dynamic hierarchical error detection and correction process includes:

[0056] (1) Input data verification layer, including:

[0057] S1: Protocol feature verification, check whether the input data conforms to the protocol specification;

[0058] S2: Error tolerance threshold adjustment, dynamically set the error tolerance threshold based on the historical error rate:

[0059] Threshold = μ error + ασ error

[0060] where μ error is the historical average error rate, σ error is the standard deviation, and α is the adjustment coefficient;

[0061] (2) The conversion process monitoring layer includes:

[0062] S1: Field mapping verification, checking whether the field mapping between the input protocol and the target protocol is complete; if not, triggering an error alert and simultaneously triggering data re - conversion;

[0063] S2: Data format consistency verification, comparing the data formats before and after conversion, using a hash function to generate the data hash values before and after conversion to ensure consistency:

[0064] Hash input = SHA256(Raw Data)

[0065] Hash output = SHA256(Converted Data)

[0066] If the hash values are inconsistent, i.e., Hash input ≠ Hash output , then trigger an error alert and simultaneously trigger data re - conversion;

[0067] S3: Real - time redundancy check, generating a redundant copy of the input data before conversion, then performing conversions on the input data and the redundant copy respectively, and comparing whether the conversion results of the input data and the redundant copy are consistent after conversion. If they are inconsistent, trigger an error handling mechanism;

[0068] (3) The output data verification layer includes:

[0069] S1: Protocol compliance check, calculating the checksum of the output data, comparing it with the check field of the target protocol, and verifying whether the output data frame structure, timing, and check code meet the requirements of the target protocol; if not, trigger an error handling mechanism and select an error correction or re - transmission strategy according to the error type;

[0070] S2: End - to - end verification, after the target device receives the data, sending a feedback signal ACK / NACK to confirm the data integrity; if NACK is received, trigger an error handling mechanism and select an error correction or re - transmission strategy according to the error type.

[0071] As a preference of the present invention, the input data verification layer adopts cyclic redundancy check CRC and calculates the check code using a protocol - specific CRC polynomial:

[0072] CRC result = CRC gen (D, P)

[0073] where D is the data stream and P is the generating polynomial;

[0074] Compare whether the calculated CRC value is consistent with the CRC field in the data packet. If not, mark it as incorrect data and request retransmission of the data.

[0075] Preferably, the error handling mechanism of the present invention includes:

[0076] Re - conversion: Re - convert the data using the redundant copy;

[0077] Log recording: Record error information for subsequent analysis;

[0078] Error correction: Correct the data using Reed - Solomon codes;

[0079] Request for retransmission: If the error cannot be corrected, request retransmission of the data.

[0080] Preferably, the error types include:

[0081] Correctable errors: Several bit errors;

[0082] Uncorrectable errors: Packet loss or complete failure of the checksum;

[0083] If a correctable error is detected, trigger error correction and correct the data using Reed - Solomon codes;

[0084] If an uncorrectable error is detected, discard the data packet, record the log, and at the same time request retransmission of the data.

[0085] Further preferably, the process of correcting the data using Reed - Solomon codes is as follows:

[0086] Encode the data using Reed - Solomon codes, divide the data into k symbols, generate an encoding of n symbols (n > k), and can correct up to errors t:

[0087] Encoded Data = RS Encode(Payload, k, n)

[0088] where k is the number of original data symbols and n is the number of encoded data symbols.

[0089] The advantages of the present invention are:

[0090] (1) It can accurately identify the protocol type of the input data and dynamically convert it into the target protocol required by the target device, achieving efficient and flexible data transmission interface conversion.

[0091] (2) By optimizing the weight coefficients of the protocol matching model through machine learning, the model parameters can be dynamically adjusted according to historical data and actual performance, thereby improving the accuracy and efficiency of protocol matching.

[0092] (3) Add a dynamic hierarchical error detection and correction process during the data transmission interface conversion. The dynamic hierarchical error detection and correction process covers three stages: input data parsing, protocol conversion process, and output data sending. It performs full-link detection from input to output, reduces the probability of missed detection, can significantly improve the reliability of data transmission interface conversion, and ensure data integrity. Brief Description of the Drawings

[0093] Figure 1 is a schematic diagram of the process of the present invention;

[0094] Figure 2 is a schematic diagram of the process of optimizing the protocol matching model of the present invention;

[0095] Figure 3 is a schematic diagram of the dynamic hierarchical error detection and correction process of the present invention. Detailed Embodiment

[0096] The present invention will be specifically introduced below in conjunction with the accompanying drawings and specific embodiments.

[0097] As Figure 1 shown, this embodiment is a data transmission interface conversion method, including:

[0098] (1) Receive the input data, analyze the characteristics of the input data, and determine the input protocol;

[0099] (2) Determine the target protocol according to the interface type of the target device;

[0100] (3) Use the machine learning model matching conversion algorithm module to select the optimal conversion algorithm module from the algorithm database according to the input protocol and the target protocol;

[0101] (4) The selected conversion algorithm module performs data conversion to convert the input data into the target protocol format;

[0102] (5) Send the converted data to the target device.

[0103] The process of determining the input protocol in this embodiment is as follows:

[0104] Extract input features from the input data. The input features include frame header, packet length, check code, and timing. The input feature vector is F = [f1 , f 2 ,..., f n ; Match the extracted input features with the predefined protocol features in the protocol feature library. The protocol feature library is matrix P, where each row represents the feature vector of a protocol, and calculate the similarity between the input features and each protocol feature in the protocol feature library:

[0105]

[0106] Among them, S i is the similarity between the input features and the i-th protocol in the protocol feature library, and P i is the feature vector of the i-th protocol in the protocol feature library;

[0107] Select the protocol with the highest similarity to the input features as the recognition result:

[0108]

[0109] The process of using the machine learning model to match the conversion algorithm module in this embodiment is as follows:

[0110] Use the neural network matching algorithm to match the predefined conversion algorithm modules in the database. There are multiple predefined conversion algorithm modules, such as the conversion algorithm module for RS-485 interface to USB interface, the conversion algorithm module for USB interface to Type-C interface, etc. The conversion algorithm for each protocol is encapsulated as an independent module, and each module contains protocol feature description, conversion function, and performance metrics;

[0111] If the input feature vector is F and the target protocol feature vector is T, then the matching score M is:

[0112]

[0113] Among them:

[0114] S(F, T) is the protocol similarity;

[0115] Latency is the conversion latency;

[0116] Compatibility is the compatibility score;

[0117] w 1 , w 2 , w 3 are weight coefficients given by the protocol matching model and are used to balance the influence of different dimensions;

[0118] Select the conversion algorithm module with the highest score as the matching result.

[0119] The process of the selected conversion algorithm module in this embodiment performing data conversion is as follows:

[0120] (1) Load the selected conversion algorithm module using a dynamic link library;

[0121] (2) Call the conversion function to convert the input data into the target protocol format;

[0122] (3) After the conversion is completed, call to unload and release resources, close the dynamic link library handle, and clean the cache.

[0123] This embodiment can accurately identify the protocol type of the input data and dynamically convert it into the target protocol required by the target device, realizing an efficient and flexible data transmission interface conversion.

[0124] As Figure 2 shown, in order to improve the accuracy and efficiency of protocol matching, this embodiment also includes optimizing the weight coefficients w 1 , w 2 , w 3 , and the specific optimization process is as follows:

[0125] (1) Data preparation: Collect historical data and construct a training data set;

[0126] S1: Record the input feature F and the target protocol feature T for each protocol match;

[0127] S2: Record the actually selected conversion algorithm and its performance metrics, where the performance metrics include latency and compatibility;

[0128] S3: Organize the historical data into training samples (X, y), where X is the input feature matrix, and each row represents the feature vector of a sample [S(F, T), Latency, Compatibility], X = [x 1 , x 2 ,..., x i ,..., x n , and y is the label vector indicating whether the actually selected conversion algorithm is optimal, 1 indicates optimal, and 0 indicates non-optimal;

[0129] (2) Model selection: Select a machine learning model and define the model formula;

[0130] Set a logistic regression classification model in the neural network, and the prediction probability formula of logistic regression is:

[0131]

[0132] where, w 0 is the bias term, w 1 , w 2 , w 3 are the weight coefficients;

[0133] (3) Model training: loss function, optimization algorithm, iterative update;

[0134] S1: Use the cross - entropy loss function to measure the difference between the model prediction value and the true value:

[0135]

[0136] where N is the number of samples;

[0137] S2: Use the gradient descent method to minimize the loss function:

[0138]

[0139] where α is the learning rate and j is the weight index (j = 0, 1, 2, 3);

[0140] S3: Repeatedly calculate the gradient and update the weights until the loss function converges or reaches the maximum number of iterations;

[0141] (4) Model evaluation: divide the dataset, evaluate the model performance;

[0142] Divide the dataset into a training set and a test set, where the training set accounts for 70% and the test set accounts for 30%; use accuracy, precision, recall, and F1 - score to evaluate the model performance:

[0143]

[0144] where TP is the true positive, TN is the true negative, FP is the false positive, and FN is the false negative;

[0145] (5) Model deployment: save the model parameters, dynamically load the weights, select the optimal algorithm;

[0146] Save the weight coefficients w 0 , w 1 , w 2 , w 3 to the algorithm database; during the protocol matching process, dynamically load the weight coefficients and calculate the matching score:

[0147]

[0148] Select the optimal transformation algorithm module according to the matching score M.

[0149] In this embodiment, the weight coefficients of the protocol matching model are optimized through machine learning, and the model parameters can be dynamically adjusted according to historical data and actual performance, thereby improving the accuracy and efficiency of protocol matching, so that the matching score M can accurately reflect the optimal transformation algorithm.

[0150] Such as Figure 3As shown, in order to ensure the integrity and reliability of data during the data transmission interface conversion process, this embodiment further includes a dynamic hierarchical error detection and correction process, and the dynamic hierarchical error detection and correction process includes:

[0151] (1) Input data verification layer, which is used to ensure the integrity and legality of the input data, prevent incorrect data from entering the conversion process, and includes:

[0152] S1: Protocol feature verification, which checks whether the input data conforms to the protocol specifications, including the frame header, packet length, checksum, and timing;

[0153] S2: Error tolerance threshold adjustment, which dynamically sets the error tolerance threshold based on the historical error rate:

[0154] Threshold = μ error + ασ error

[0155] where μ error is the historical average error rate, σ error is the standard deviation, and α is the adjustment coefficient;

[0156] (2) Conversion process monitoring layer, which is used to prevent logical errors or data loss during the conversion process, and includes:

[0157] S1: Field mapping verification, which checks whether the field mapping between the input protocol and the target protocol is complete; if it is not complete, an error alert is triggered, and at the same time, data re-conversion is triggered;

[0158] S2: Data format consistency verification, which compares the data formats before and after conversion, such as the encoding method and data length, and uses a hash function to generate the data hash values before and after conversion to ensure consistency:

[0159] Hash input = SHA256(Raw Data)

[0160] Hash output = SHA256(Converted Data)

[0161] If the hash values are inconsistent, i.e., Hash input ≠ Hash output , an error alert is triggered, and at the same time, data re-conversion is triggered;

[0162] S3: Real-time redundancy check. Before conversion, a redundant copy of the input data is generated. Then, the input data and the redundant copy are respectively subjected to conversion. After conversion, the conversion results of the input data and the redundant copy are compared to check if they are consistent. If they are not consistent, the error handling mechanism is triggered. Through the comparison with the redundant copy, errors in the conversion process can be quickly detected and corrected, achieving high reliability. Performing the check in real-time during the conversion process reduces the possibility of error propagation, achieving real-time performance. The number of redundant copies can be dynamically adjusted according to the importance of the data (for example, generating multiple copies for critical data), achieving flexibility.

[0163] (3) Output data verification layer, which is used to ensure that the output data complies with the target protocol specifications, including:

[0164] S1: Protocol compliance check. Calculate the checksum of the output data and compare it with the check field of the target protocol to verify whether the output data frame structure, timing, and check code meet the requirements of the target protocol. If they do not meet, the error handling mechanism is triggered, and the error correction or retransmission strategy is selected according to the error type.

[0165] S2: End-to-end check. After the target device receives the data, it sends a feedback signal ACK / NACK to confirm the data integrity. If NACK is received, the error handling mechanism is triggered, and the error correction or retransmission strategy is selected according to the error type.

[0166] In this embodiment, the input data verification layer adopts cyclic redundancy check CRC, and uses a protocol-specific CRC polynomial (such as CRC-16 for USB) to calculate the check code:

[0167] CRC result = CRC gen (D, P)

[0168] where D is the data stream and P is the generating polynomial;

[0169] Compare whether the calculated CRC value is consistent with the CRC field in the data packet. If they are not consistent, mark it as error data and request data retransmission.

[0170] In this embodiment, the error handling mechanism includes:

[0171] Re-conversion: Re-convert the data using the redundant copy;

[0172] Log recording: Record the error information for subsequent analysis;

[0173] Error correction: Use Reed-Solomon codes to correct the data;

[0174] Request for retransmission: If the error cannot be corrected, request data retransmission.

[0175] In this embodiment, the error types include:

[0176] Correctable errors: several bit errors, such as 1 bit error or 2 bit errors;

[0177] Uncorrectable errors: packet loss or complete failure of the check code;

[0178] If a correctable error is detected, error correction is triggered, and Reed-Solomon code is used to correct the data;

[0179] If an uncorrectable error is detected, the packet is discarded and logged, and at the same time, a request for data retransmission is made.

[0180] The process of using Reed-Solomon code to correct data in this embodiment is as follows:

[0181] Encode the data using Reed-Solomon code, divide the data into k symbols, and generate an encoded data of n symbols (n > k), which can correct up to number of errors t:

[0182] Encoded Data = RS Encode(Payload, k, n)

[0183] Where k is the number of original data symbols and n is the number of encoded data symbols.

[0184] The dynamic hierarchical error detection and correction process in this embodiment covers three stages: input data parsing, protocol conversion process, and output data sending. It performs full-link detection from input to output, reduces the probability of missed detection, can significantly improve the reliability of data transmission interface conversion, and ensure data integrity.

[0185] RS-485 interface is commonly used in industrial automation and long-distance communication, supports multi-point communication, and uses differential signals for transmission; USB interface is commonly used for short-distance communication between computers and peripherals and supports high-speed data transmission; The data transmission conversion between RS-485 interface and USB interface is taken as an example below.

[0186] Step 1: The RS-485 interface receives RS-485 data and analyzes the characteristics of the RS-485 data:

[0187] Frame header: 0xAA;

[0188] Packet length: 5 bytes;

[0189] Check code: CRC-16 = 0x1234;

[0190] Match the protocol type:

[0191]

[0192] Where F is the input feature vector, Pi is the feature vector of the RS-485 protocol in the protocol feature library; S i is the similarity;

[0193] Confirm that the input data is the RS-485 protocol.

[0194] Step 2: Confirm that the target device interface type is USB;

[0195] Step 3: Use the predefined conversion algorithm module in the neural network matching algorithm database:

[0196] If the input feature vector is F and the target protocol feature vector is T, then the matching score M is:

[0197]

[0198] Where:

[0199] S(F, T) is the protocol similarity;

[0200] Latency is the conversion latency;

[0201] Compatibilty is the compatibility score;

[0202] w 1 ,w 2 ,w 3 are the weight coefficients;

[0203] The conversion algorithm module with the highest score is the conversion algorithm module for converting the RS-485 interface to the USB interface.

[0204] Step 4:

[0205] Use the dynamic link library to load the conversion algorithm module for converting the RS-485 interface to the USB interface, call the conversion function, and initialize the conversion parameters, including the baud rate and data format, and parse each field of the RS-485 data frame:

[0206] Frame header: 0xAA;

[0207] Packet length: 5 bytes;

[0208] Payload: [0x01, 0x02, 0x03, 0x04, 0x05];

[0209] Checksum: CRC-16 = 0x1234;

[0210] Map the fields of RS-485 to the USB packet:

[0211] Map the frame header of RS-485 to the SYNC field of USB;

[0212] The payload of RS-485 is directly mapped to the payload of USB;

[0213] Convert the differential signal of RS-485 to the NRZI encoding of USB:

[0214] USB Data = NRZI Encode(RS-485 Data)

[0215] Repackage the USB data packet: Add the header, payload, and checksum of the USB data packet to complete the data conversion; The converted USB data packet:

[0216] Header: SYNC field;

[0217] Payload: [0x01, 0x02, 0x03, 0x04, 0x05];

[0218] Checksum: CRC-16 = 0x5678;

[0219] After the conversion is completed, call the unload to release resources, close the dynamic link library handle, and clean the cache.

[0220] Step Five: Send the converted data to the target device.

[0221] Dynamic hierarchical error detection and correction process:

[0222] (1) Input data verification:

[0223] Check the CRC-16 checksum of the RS-485 data to ensure data integrity.

[0224] (2) Conversion process monitoring:

[0225] Use a hash function to generate the data hash values before and after the conversion, and compare the data hash values before and after the conversion:

[0226] Hash RS485 = SHA256(RS-485 Data),

[0227] Hash USB = SHA256(USB Data).

[0228] If the hash values are inconsistent, trigger an error alert and trigger the data to be reconverted at the same time.

[0229] (3) Output data verification:

[0230] Check the checksum of the USB data packet to ensure data integrity; after the target device receives the data, it sends a feedback signal ACK / NACK to confirm the data integrity; if NACK is received, the error handling mechanism is triggered, and the error correction or retransmission strategy is selected according to the error type.

[0231] The above embodiments are only used to illustrate the technical solutions of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any form. Any technical solutions obtained by using equivalent replacements or equivalent transformations fall within the protection scope of the present invention.

Claims

1. A data transmission interface conversion method, characterized in that: include: (1) receiving input data, analyzing the characteristics of the input data, and determining the input protocol; (2) Determine the target protocol based on the interface type of the target device; (3) using a machine learning model to match the conversion algorithm module, and selecting the optimal conversion algorithm module from the algorithm database based on the input protocol and the target protocol; (iv) the selected conversion algorithm module performs data conversion to convert the input data into the target protocol format; (V) Send the converted data to the target device.

2. The data transmission interface conversion method according to claim 1, characterized in that: The process of determining the input protocol is as follows: extracting input features from the input data, wherein the input features include frame header, data packet length, checksum and timing, and the input feature vector is F=[f1, f2, ..., f n ]; Match the extracted input features with the predefined protocol features in the protocol feature library. The protocol feature library is a matrix P, where each row represents a feature vector of a protocol. Calculate the similarity between the input features and each protocol feature in the protocol feature library: Among them, S i is the similarity between the input feature and the i-th protocol in the protocol feature library, P i is the feature vector of the i-th protocol in the protocol feature library; Select the protocol with the highest similarity to the input feature as the recognition result:

3. The data transmission interface conversion method according to claim 2, characterized in that: The process of using the machine learning model matching conversion algorithm module is as follows: Use the conversion algorithm module predefined in the neural network matching algorithm database; the input feature vector is F, the target protocol feature vector is T, and the matching score M is: in: S(F, T) is the protocol similarity; Latency is the conversion delay; Compatibility is the compatibility score; w1, w2, and w3 are weight coefficients, given by the protocol matching model, used to balance the impact of different dimensions; The conversion algorithm module with the highest score is selected as the matching result.

4. The data transmission interface conversion method according to claim 3, characterized in that: The process of data conversion performed by the selected conversion algorithm module is as follows: (1) Use the dynamic link library to load the selected conversion algorithm module; (2) Call the conversion function to convert the input data into the target protocol format; (3) After the conversion is completed, call uninstall to release resources, close the dynamic link library handle, and clean up the cache.

5. The data transmission interface conversion method according to claim 3, characterized in that: It also includes optimizing the weight coefficients w1, w2, ω3 of the protocol matching model. The specific optimization process is as follows: (1) Data preparation: collect historical data and build a training data set; S1: Record the input features F and target protocol features T of each protocol match; S2: recording the actually selected conversion algorithm and its performance indicators, wherein the performance indicators include latency and compatibility; S3: Organize historical data into training samples (X, y), where X is the input feature matrix, each row represents the feature vector of a sample [S(F, T), Latency, Compatibility], X = [x1, x2, .., x i , .., x n ], y is a label vector, indicating whether the conversion algorithm actually selected is optimal, 1 indicates optimal, and 0 indicates non-optimal; (2) Model selection: select a machine learning model and define the model formula; A logistic regression classification model is set in the neural network, and the prediction probability formula of the logistic regression is: Among them, w0 is the bias term, w1, w2, w3 are weight coefficients; (3) Model training: loss function, optimization algorithm, iterative update; S1: Use the cross entropy loss function to measure the difference between the model prediction value and the true value: Where N is the number of samples; S2: Use gradient descent to minimize the loss function: Where α is the learning rate and j is the weight index (j=0, 1, 2, 3); S3: Repeatedly calculate gradients and update weights until the loss function converges or the maximum number of iterations is reached; (4) Model evaluation: divide the data set and evaluate the model performance; The dataset is divided into a training set and a test set, with the training set accounting for 70% and the test set accounting for 30%; the model performance is evaluated using accuracy, precision, recall, and F1 score: Among them, TP is a true positive example, TN is a true negative example, FP is a false positive example, and FN is a false negative example; (5) Model deployment: save model parameters, dynamically load weights, and select the optimal algorithm; The trained weight coefficients w0, w1, w2, w3 are saved in the algorithm database; during the protocol matching process, the weight coefficients are dynamically loaded and the matching scores are calculated: The optimal conversion algorithm module is selected according to the matching score M.

6. The data transmission interface conversion method according to claim 1, characterized in that: Also included is a dynamic layered error detection and correction process, the dynamic layered error detection and correction process comprising: (1) Input data verification layer, including: S1: Protocol feature verification, checking whether the input data conforms to the protocol specification; S2: Error tolerance threshold adjustment, dynamically setting the error tolerance threshold based on historical error rates: Threshold=μ error +as error where μ error is the historical average error rate, σ error is the standard deviation, α is the adjustment coefficient; (2) Conversion process monitoring layer, including: S1: Field mapping verification, checking whether the field mapping between the input protocol and the target protocol is complete; if it is incomplete, an error alarm is triggered and data reconversion is triggered; S2: Verify the consistency of data format. Compare the data formats before and after the conversion. Use the hash function to generate the hash values ​​of the data before and after the conversion to ensure consistency: Hash input =SHA256(Raw Data) Hash output =SHA256(Converted Data) If the hash values ​​do not match input ≠Hash output , then an error alarm is triggered and data reconversion is triggered; S3: Real-time redundancy check: Generate a redundant copy of the input data before conversion, then perform conversion on the input data and the redundant copy respectively, and compare the conversion results of the input data and the redundant copy after conversion to see if they are consistent. If they are inconsistent, the error handling mechanism is triggered; (3) Output data verification layer, including: S1: Protocol compliance check, calculate the checksum of the output data, compare it with the checksum field of the target protocol, and verify whether the output data frame structure, timing, and checksum meet the requirements of the target protocol; if not, trigger the error handling mechanism and select the error correction or retransmission strategy according to the error type; S2: End-to-end verification. After receiving the data, the target device sends a feedback signal ACK / NACK to confirm the data integrity. If NACK is received, the error handling mechanism is triggered, and the error correction or retransmission strategy is selected according to the error type.

7. The data transmission interface conversion method according to claim 6, characterized in that: The input data verification layer uses a cyclic redundancy check (CRC) and calculates the check code using a protocol-specific CRC polynomial: CRC result CRC gen (D,P) Where D is the data stream and P is the generating polynomial; The calculated CRC value is compared with the CRC field in the data packet to see if they are consistent. If they are inconsistent, it is marked as erroneous data and the data is requested to be retransmitted.

8. The data transmission interface conversion method according to claim 6, characterized in that: The error handling mechanism includes: Reconversion: Reconvert data using redundant copies; Log: record error information for subsequent analysis; Error correction: Data is corrected using Reed-Solomon codes; Request retransmission: Request data retransmission if the error cannot be corrected.

9. The data transmission interface conversion method according to claim 6, characterized in that: The error types include: Correctable errors: several bit errors; Uncorrectable error: data packet loss or complete failure of checksum; If a correctable error is detected, error correction is triggered and the data is corrected using Reed-Solomon codes; If an uncorrectable error is detected, the packet is discarded and logged, and data retransmission is requested.

10. The data transmission interface conversion method according to claim 8 or 9, characterized in that: The process of using Reed-Solomon code to correct data is: Use Reed-Solomon code to encode data, divide the data into k symbols, generate n symbols (n>k), and correct up to Errors: Encoded Data=RS Encode(Payload, k, n) Among them, k is the number of original data symbols, and n is the number of encoded data symbols.