Data protocol conversion method and device, electronic equipment and storage medium
By detecting and parsing data of different protocol types, and using the PID controller to optimize the output rate, the problem of low performance of data protocol conversion equipment in the existing technology is solved, efficient protocol conversion and rate adjustment are achieved, and the requirements of a variety of interface devices are met. need.
Patent Information
- Application Number
- CN202410984394.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-18
AI Technical Summary
Existing data protocol conversion equipment cannot adaptively convert data of different protocol types into specified protocol data with a higher transmission rate. It is limited by the number of interfaces and the single supported protocol type, resulting in low output data performance.
By receiving the data to be converted and the target protocol type, it detects the actual protocol type, parses the data, and performs conversion and output rate adjustment according to the target protocol type. It uses the PID controller to optimize the output rate and supports the conversion of multiple protocol types.
It realizes the conversion of data of different protocol types into designated protocol data with higher transmission rate, meets the data transmission rate requirements of different interface devices, and improves the efficiency and performance of data protocol conversion.
Smart Images

Figure CN118803086A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of protocol conversion, and in particular to a data protocol conversion method, device, electronic device and storage medium. Background Art
[0002] With the development of computer network technology, a variety of different network protocols have emerged, and different types of devices may also use different interface protocols, such as USB (Universal Serial Bus), PCIe (Peripheral Component Interconnect Express,
[0003] High-speed serial computer expansion bus standard), UART (Universal Asynchronous Receiver / Transmitter), SATA (Serial Advanced Technology Attachment), HDMI (High Definition Multimedia Interface), etc. Each device has its own way of exchanging information. When two devices need to communicate with each other, if they do not recognize each other's communication method, they cannot communicate with each other. Protocol conversion plays the role of "translating" between the two networks. However, current data protocol conversion devices can usually only realize data protocol conversion within the same field, and due to the limited number of interfaces, the single type of protocol conversion supported, and the low output data performance, they are generally unable to adaptively convert data of different protocol types into data required by different interface devices.
[0004] Therefore, how to convert data of different protocol types into specified protocol data with a higher transmission rate is a problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of the present application is to provide a data protocol conversion method, device, electronic device and storage medium, aiming to solve the technical problem of how to convert data of different protocol types into specified protocol data with a higher transmission rate.
[0006] To achieve the above purpose, the present application proposes a data protocol conversion method, the method comprising:
[0007] Receiving data to be converted and a target protocol type of the data to be converted;
[0008] Detecting an actual protocol type of the data to be converted to obtain a detection result, and parsing the data to be converted based on the detection result to obtain parsed data;
[0009] Convert the parsed data into target protocol data according to the target protocol type, and output the target protocol data;
[0010] Based on the actual protocol type and the target protocol type, an output rate of the target protocol data is adjusted.
[0011] In one embodiment, the output rate of the target protocol data is controlled by a PID controller, and the step of adjusting the output rate of the target protocol data based on the actual protocol type and the target protocol type includes:
[0012] Determining control parameters of the PID controller based on the actual protocol type and the target protocol type;
[0013] Based on the control parameter and the analysis data, determining an adjustment amount of the control parameter;
[0014] The control parameter is adjusted according to the adjustment amount to obtain a target control parameter, so as to adjust the output rate through the controller configured with the target control parameter.
[0015] In one embodiment, the step of determining the adjustment amount of the control parameter based on the control parameter and the parsed data comprises:
[0016] Modeling is performed based on the control parameters and the analytical data to obtain a PID control model;
[0017] An error value in the system PID control model is obtained, and the adjustment amount is determined based on the error value.
[0018] In one embodiment, the adjustment amount includes a first adjustment amount and a second adjustment amount, the control parameter includes a proportional gain coefficient and an integral gain coefficient, and the target control parameter includes a target proportional gain coefficient and a target integral gain coefficient;
[0019] The step of adjusting the control parameter according to the adjustment amount to obtain the target control parameter comprises:
[0020] adjusting the proportional gain coefficient according to the first adjustment amount, and monitoring a first feedback condition generated during the output of the target protocol data;
[0021] In the case where no error feedback occurs in the first feedback condition, returning to the step of adjusting the proportional gain coefficient according to the first adjustment amount; in the case where error feedback occurs in the first feedback condition, correcting the first adjustment amount according to a preset correction amount, and adjusting the proportional gain coefficient based on the corrected first adjustment amount to obtain the target proportional gain coefficient;
[0022] adjusting the integral gain coefficient according to the second adjustment amount, and monitoring a second feedback condition generated during the output of the target protocol data;
[0023] In the case where error feedback occurs in the second feedback condition, the step of adjusting the integral gain coefficient according to the second adjustment amount is returned to be executed; in the case where error feedback does not occur in the second feedback condition, the target integral gain coefficient is obtained.
[0024] In one embodiment, the step of detecting the actual protocol type of the data to be converted and obtaining the detection result includes:
[0025] Detecting the interface type of the interface called by receiving the data to be converted, and determining a candidate actual protocol type of the data to be converted based on the interface type;
[0026] Extracting the protocol field of the header information in the data to be converted, and determining the verification actual protocol type of the data to be converted by matching the protocol field with a plurality of preset fields;
[0027] In the case that the candidate actual protocol type is consistent with the verification actual protocol type, the candidate actual protocol type is used as the actual protocol type, and the to-be-converted data is marked based on the actual protocol type to obtain the detection result.
[0028] In one embodiment, the step of converting the parsed data into target protocol data according to the target protocol type and outputting the target protocol data includes:
[0029] Determining a preset function used for converting a data protocol according to the target protocol type;
[0030] Converting the parsed data into the target protocol data based on the preset function, and determining an output interface for outputting the target protocol data according to the preset function;
[0031] The target protocol data is output through the output interface.
[0032] In one embodiment, the method further comprises:
[0033] Numbering the data to be converted to obtain numbered data, and monitoring the conversion progress of the data to be converted during the data protocol conversion process;
[0034] The numbering data and the conversion progress are associated and outputted.
[0035] In addition, to achieve the above purpose, the present application also proposes a data protocol conversion device, the data protocol conversion device comprising:
[0036] A receiving module, used for receiving data to be converted and a target protocol type of the data to be converted;
[0037] A parsing module, used for detecting the actual protocol type of the data to be converted, obtaining a detection result, and parsing the data to be converted based on the detection result to obtain parsed data;
[0038] A conversion module, used to convert the parsed data into target protocol data according to the target protocol type, and output the target protocol data;
[0039] A control module is used to adjust the output rate of the target protocol data based on the actual protocol type and the target protocol type.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data protocol conversion method described above.
[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data protocol conversion method described above are implemented.
[0042] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the data protocol conversion method described above are implemented.
[0043] The present application proposes a data protocol conversion method. The present application first receives data to be converted and a target protocol type of the data to be converted to obtain a data basis and a conversion target for protocol conversion; detects the actual protocol type of the data to be converted to obtain a detection result, and parses the data to be converted based on the detection result to obtain parsed data, so as to effectively parse data of different protocol types; converts the parsed data into target protocol data according to the target protocol type, and outputs the target protocol data, so as to perform protocol type conversion and output of different protocol data according to the conversion target; adjusts the output rate of the target protocol data based on the actual protocol type and the target protocol type, so as to meet the data transmission rate requirements of different interface devices by adjusting the output rate of the protocol.
[0044] To summarize, the present application detects and parses data of different protocol types, converts data of different protocol types into target protocol data, and adjusts the output rate of the target protocol data to meet the data transmission rate required by different interface devices, thereby supporting the conversion of data protocols in different fields and achieving the effect of converting data of different protocol types into designated protocol data with a higher transmission rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0047] Figure 1 A flowchart of the first embodiment of the data protocol conversion method of the present application is provided;
[0048] Figure 2 A flowchart of the second embodiment of the data protocol conversion method of this application is provided;
[0049] Figure 3 A system block diagram of a data protocol conversion method provided in Embodiment 2 of the present application;
[0050] Figure 4 A schematic diagram of a data communication scenario in a data protocol conversion method provided for an embodiment of the present application;
[0051] Figure 5 A brief flowchart of the data protocol conversion method provided in Example 2 of the present application;
[0052] Figure 6 This is a schematic diagram of the module structure of the data protocol conversion device according to an embodiment of the present application;
[0053] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the data protocol conversion method in the embodiment of the present application.
[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] The main solution of the embodiment of the present application is: receiving data to be converted and a target protocol type of the data to be converted; detecting an actual protocol type of the data to be converted to obtain a detection result, and parsing the data to be converted based on the detection result to obtain parsed data; converting the parsed data into target protocol data according to the target protocol type, and outputting the target protocol data; adjusting the output rate of the target protocol data based on the actual protocol type and the target protocol type.
[0058] Due to the limited number of interfaces, the single type of protocol conversion supported, and the low output data performance, the current data protocol conversion devices in the prior art generally cannot adaptively convert data of different protocol types into data required by different interface devices. Therefore, how to convert data of different protocol types into designated protocol data with a higher transmission rate is a problem that needs to be solved urgently.
[0059] The present application provides a solution, which detects and parses data of different protocol types, converts data of different protocol types into target protocol data, and adjusts the output rate of the target protocol data to meet the data transmission rate required by different interface devices, thereby achieving the effect of converting data of different protocol types into designated protocol data with a higher transmission rate.
[0060] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, etc. The following takes an electronic device as an example to illustrate this embodiment and the following embodiments.
[0061] Based on this, the present application embodiment provides a data protocol conversion method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data protocol conversion method of the present application.
[0062] In this embodiment, the data protocol conversion method includes steps S10 to S40:
[0063] Step S10, receiving data to be converted and a target protocol type of the data to be converted;
[0064] It should be noted that the data to be converted refers to the data whose data format needs to be converted, and the target protocol type refers to the output protocol format specified by the user.
[0065] Step S20, detecting the actual protocol type of the data to be converted to obtain a detection result, and parsing the data to be converted based on the detection result to obtain parsed data;
[0066] It should be noted that the actual protocol type refers to the protocol format of the data to be converted; the detection result refers to the marking result obtained after the protocol format is detected on the data to be converted; the parsed data refers to the data obtained after parsing the data with detected protocol format according to the data parsing rules corresponding to the protocol format.
[0067] In addition, it should be noted that the actual protocol type of the data to be converted can be detected by detecting the data to be converted in the application layer, or by detecting the physical layer signal of the data to be converted. The specific implementation method for detecting the data to be converted is not specifically limited in this embodiment.
[0068] In addition, it should be noted that since the received data to be converted may be multiple data to be converted, before executing the step of detecting the actual protocol type of the data to be converted, it is necessary to obtain the priority of the data to be converted, and execute the step of detecting the actual protocol type of the data to be converted based on the priority. This can avoid the inability to determine the order in which multiple data to be converted are detected, and provides an effective way to determine the order in which the data to be converted are detected.
[0069] It is understandable that, since different protocol data are parsed in different ways, step S20 is performed to achieve the effect of parsing different protocol data by adopting different parsing ways for different protocol data.
[0070] In a feasible implementation, step S20 may include steps S21 to S23:
[0071] Step S21, detecting the interface type of the interface called by receiving the data to be converted, and determining a candidate actual protocol type of the data to be converted based on the interface type;
[0072] It should be noted that the candidate actual protocol type refers to the protocol type of the data to be converted preliminarily determined only by the interface type of the interface called by the received data.
[0073] Step S22, extracting the protocol field of the header information in the data to be converted, and determining the actual verification protocol type of the data to be converted by matching the protocol field with a plurality of preset fields;
[0074] It should be noted that the protocol field refers to a field that identifies the protocol type used by the data to be converted, the preset field refers to a field pre-configured in the application layer, and the actual protocol type verification refers to a protocol type used to verify the accuracy of the candidate actual protocol type.
[0075] In addition, it should be noted that the preset field may be pre-configured based on an existing protocol field, or may be a user-defined field. In this implementation, the method for obtaining the preset field is not specifically limited.
[0076] It is understandable that since the actual protocol type of the data to be converted is determined only by receiving the interface type of the interface called by the data to be converted, there may be a problem of inaccurate actual protocol type. Therefore, step S22 is performed to identify the protocol field of the data to be converted to verify the protocol type determined according to the interface type, thereby providing accuracy in identifying the data protocol type.
[0077] Exemplarily, the protocol information recorded in the header information of the data to be converted is extracted, and the protocol information is matched with the protocol information configured in the preset detection function, and the protocol information configured by the preset detection function in the application layer that matches the protocol information is determined as the actual protocol type of the data to be converted.
[0078] Step S23, when the candidate actual protocol type is consistent with the verification actual protocol type, the candidate actual protocol type is used as the actual protocol type, and the to-be-converted data is marked based on the actual protocol type to obtain the detection result.
[0079] It can be understood that since different protocol data need to be parsed using different parsing methods, step S23 is performed. By generating data to be converted that is marked with the protocol type, it is avoided that the protocol type of the data to be converted cannot be known when the data to be converted is parsed, and thus the accurate parsing rules cannot be used to parse the data to be converted, thereby improving the accuracy of parsing data of different protocol types.
[0080] Exemplarily, when the candidate actual protocol type and the verification actual protocol type are consistent, the candidate actual protocol type is used as the actual protocol type, and the actual protocol type is marked in the data to be transmitted to obtain a detection result; when the candidate actual protocol type and the verification actual protocol type are inconsistent, the protocol conversion process of the data to be converted is terminated, and an alarm prompt signal is output.
[0081] In this implementation, data of different protocol types are identified so as to be parsed smoothly, thereby improving the accuracy of parsing data of different protocol types.
[0082] Step S30, converting the parsed data into target protocol data according to the target protocol type, and outputting the target protocol data;
[0083] It should be noted that the target protocol data refers to data in a user-specified protocol format obtained after data protocol conversion.
[0084] In a feasible implementation, step S30 may include steps S31 to S33:
[0085] Step S31, determining a preset function used for converting a data protocol according to the target protocol type;
[0086] It should be noted that the preset function refers to a function that is preset to perform a data protocol conversion operation.
[0087] Exemplarily, when the target protocol type configured by the user is PCIe, the main function that performs the data protocol conversion operation will call the sub-function of PCIe to convert the data protocol; when the target protocol type configured by the user is UART, the main function that performs the data protocol conversion operation will call the sub-function of UART to convert the data protocol; when the target protocol type configured by the user is USB, the main function that performs the data protocol conversion operation will call the sub-function of USB to convert the data protocol; when the target protocol type configured by the user is TCP (Transmission Control Protocol), the main function that performs the data protocol conversion operation will call the sub-function of TCP to convert the data protocol; when the target protocol type configured by the user is SATA, the main function that performs the data protocol conversion operation will call the sub-function of SATA to convert the data protocol; when the target protocol type configured by the user is SPI (Serial Peripheral Interface), the main function that performs the data protocol conversion operation will call the sub-function of SPI to convert the data protocol.
[0088] Step S32, converting the parsed data into the target protocol data based on the preset function, and determining an output interface for outputting the target protocol data according to the preset function;
[0089] It should be noted that the output interface refers to a physical interface used to support the output of data in a specific protocol format.
[0090] In addition, it should be noted that since multiple different preset functions can be called at the same time to perform protocol format conversion in different parsing units, the parsed data can be converted into target protocol data. It is possible to convert parsed data of different actual protocol types and perform protocol format conversion in different parsing units through preset functions corresponding to the actual protocol types.
[0091] Exemplarily, when the target protocol type configured by the user is PCIe, the sub-function of PCIe is called to convert the parsed data into PCIe protocol data, and the interface for outputting the PCIe protocol data is determined to be the PCIe interface according to the sub-function of PCIe; when the target protocol type configured by the user is UART, the sub-function of UART is called to convert the parsed data into UART protocol data, and the interface for outputting the UART protocol data is determined to be the UART interface according to the sub-function of UART; when the target protocol type configured by the user is USB, the sub-function of USB is called to convert the parsed data into USB protocol data, and the interface for outputting the USB protocol data is determined to be the USB interface according to the sub-function of USB. USB interface; when the target protocol type configured by the user is TCP, the TCP sub-function is called to convert the parsed data into TCP protocol data, and the interface for outputting the TCP protocol data is determined to be the TCP interface according to the TCP sub-function; when the target protocol type configured by the user is SATA, the SATA sub-function is called to convert the parsed data into SATA protocol data, and the interface for outputting the SATA protocol data is determined to be the SATA interface according to the SATA sub-function; when the target protocol type configured by the user is SPI, the SPI sub-function is called to convert the parsed data into SPI protocol data, and the interface for outputting the SPI protocol data is determined to be the SPI interface according to the SPI sub-function.
[0092] Step S33: output the target protocol data through the output interface.
[0093] In this implementation, by determining the function used to convert the data protocol and the output interface used to output the data, the effect of smoothly converting and outputting data of different protocol types is achieved.
[0094] Step S40: adjusting the output rate of the target protocol data based on the actual protocol type and the target protocol type.
[0095] It should be noted that the output rate refers to the rate at which the target protocol data is output through the output interface.
[0096] It is understandable that, since different interface devices require different data protocol formats and different protocol format data transmission rates are also different, step S40 is performed to adjust the output rate of the target protocol data to achieve the adjustment of the output data after the conversion protocol to a higher transmission rate.
[0097] In a feasible implementation manner, the output rate of the target protocol data is controlled by a PID controller, and step S40 may include steps S41 to S43:
[0098] Step S41, determining control parameters of the PID controller based on the actual protocol type and the target protocol type;
[0099] It should be noted that the PID controller refers to a device that controls the output rate of the target protocol data, and the control parameter refers to a parameter configured in the controller to change the degree of control of the output rate of the PID controller.
[0100] Step S42, determining an adjustment amount of the control parameter based on the control parameter and the analysis data;
[0101] It should be noted that the adjustment amount refers to the value of the adjustment of the control parameter.
[0102] In a feasible implementation, step S42 may include steps S421 to S422:
[0103] Step S421, modeling based on the control parameters and the analytical data to obtain a PID control model;
[0104] It should be noted that the system model refers to a mathematical model used to represent the data state.
[0105] Exemplarily, the analytical data is modeled based on the TDC (Time Delay Controller) theory and the MRAC (Model Reference Adaptive Control) method to obtain the transfer function of the second-order controlled system model:
[0106]
[0107] Among them, b is a coefficient related to the inertia or dynamic response of the system, a1 represents the system damping or some internal resistance factors, and a2 represents the system damping or some internal resistance factors.
[0108] The second-order controlled system model can handle unpredictable changes in system model order, parameters and input signals, thereby ensuring the stable and efficient operation of the system. The second-order controlled system model is then combined with the PID controller:
[0109]
[0110] The transfer function of the closed-loop feedback control system, namely the PID control model, is:
[0111]
[0112] That completes the establishment of the PID control model.
[0113] Step S422, obtaining an error value in the PID control model, and determining the adjustment amount based on the error value.
[0114] It should be noted that the error value refers to the numerical value used to represent the error between the set value and the measured value in the PID control model.
[0115] Exemplarily, in a second-order controlled system model established based on TDC theory and MRAC method, a closed-loop feedback control system is formed with a PID controller, i.e., a PID control model. The output of the PID control model determined based on the closed-loop transfer function of the closed-loop feedback control system is:
[0116]
[0117] Among them, r(t) represents the set value of the model output.
[0118] The output of the reference model of the second-order controlled system model is subtracted from the output of the PID control model:
[0119] ε(t)=y p (t)-y m (t)
[0120] The generalized error value ε(t) of the closed-loop feedback control system is obtained, that is, the error value. The output of the reference model is:
[0121]
[0122] Among them, b m1 Related to the dynamic characteristics of the reference model, b m2 Related to the first-order dynamics or damping of the reference model, b m3 Related to the static gain of the reference model, a m1 Related to the second-order dynamics of the reference model, a m2 Related to the second-order damping or frequency characteristics of the reference model, a m1Related to the static error or other characteristics of the reference model, r(t) represents the set value of the model output.
[0123] Based on the generalized error value, the performance index function is obtained:
[0124]
[0125] The performance indicator function is processed by a gradient descent algorithm to determine an adjustment amount for adjusting the control parameter.
[0126] In this implementation, mathematical modeling is performed on the control parameters and analytical data, and the adjustment amount of the control parameters is determined through the model, thereby achieving the effect of providing an accurate adjustment basis for adjusting the controller parameters.
[0127] Step S43: adjusting the control parameter according to the adjustment amount to obtain a target control parameter, so as to adjust the output rate through the controller configured with the target control parameter.
[0128] It should be noted that the target control parameter refers to a controller parameter that can adjust the target protocol data to meet the transmission rate requirement of the output data.
[0129] In a feasible implementation manner, the adjustment amount includes a first adjustment amount and a second adjustment amount, the control parameter includes a proportional gain coefficient and an integral gain coefficient, and the target control parameter includes a target proportional gain coefficient and a target integral gain coefficient;
[0130] It should be noted that the proportional gain coefficient refers to the proportional gain coefficient of the PID controller, which determines the degree to which the controller output is proportional to the error, that is, the difference between the actual output and the set value; the integral gain coefficient refers to the integral gain coefficient of the PID controller, which determines the degree to which the controller output is proportional to the integral of the error.
[0131] The step of adjusting the control parameter according to the adjustment amount to obtain the target control parameter in step S43 may include steps S431 to S434:
[0132] Step S431, adjusting the proportional gain coefficient according to the first adjustment amount, and monitoring a first feedback condition generated during the output of the target protocol data;
[0133] It should be noted that the first feedback status refers to a feedback status generated only when the proportional gain coefficient is adjusted, and the feedback status is used to indicate whether the target protocol data in the output process is qualified.
[0134] Exemplarily, the first adjustment amount is increased based on the proportional gain coefficient of the PID controller, and a feedback condition generated during the output of the target protocol data is monitored, such as whether there is packet loss in the output target protocol data.
[0135] Step S432, when no error feedback occurs in the first feedback condition, returning to the step of adjusting the proportional gain coefficient according to the first adjustment amount; when error feedback occurs in the first feedback condition, correcting the first adjustment amount according to a preset correction amount, and adjusting the proportional gain coefficient based on the corrected first adjustment amount to obtain the target proportional gain coefficient;
[0136] It should be noted that the preset correction amount refers to a pre-set value for correcting the first adjustment amount.
[0137] Exemplarily, when no erroneous feedback occurs in the first feedback condition, the first adjustment amount continues to be increased on the proportional gain coefficient of the PID controller; when erroneous feedback occurs in the first feedback condition, the preset correction amount is reduced on the basis of the first adjustment amount, and the reduced first adjustment amount is reduced on the basis of the current proportional gain coefficient to obtain the target proportional gain coefficient.
[0138] Step S433, adjusting the integral gain coefficient according to the second adjustment amount, and monitoring a second feedback condition generated during the output of the target protocol data;
[0139] It should be noted that the second feedback condition refers to the feedback condition generated when the integral gain coefficient starts to change, and the feedback condition is used to indicate whether the target protocol data in the output process is qualified.
[0140] Exemplarily, the second adjustment amount is increased based on the integral gain coefficient of the PID controller, and the feedback condition generated during the output of the target protocol data is monitored, such as whether there is packet loss in the output target protocol data.
[0141] Step S434, when error feedback occurs in the second feedback condition, return to the step of adjusting the integral gain coefficient according to the second adjustment amount; when no error feedback occurs in the second feedback condition, obtain the target integral gain coefficient.
[0142] Exemplarily, when false feedback occurs in the second feedback condition, the second adjustment amount continues to be increased on the integral gain coefficient of the PID controller; when no false feedback occurs in the second feedback condition, the current integral gain coefficient is used as the target integral gain coefficient.
[0143] For example, to help understand the implementation process of adjusting the control parameters in this embodiment, please refer to Table 1:
[0144] Initial value / Mb Kp parameter Ki parameter Error feedback Output result / Mb 10 0.050 0.00 0 20 10 0.060 0.00 0 60 10 0.080 0.00 0.03 110 10 0.075 0.10 0.01 105 10 0.075 0.15 0.00 103
[0145] Table 1
[0146] In Table 1, the target protocol type is TCP protocol as an example. The initial value of the output rate of the target protocol data is 10Mb bytes per second, and the Kp parameter and Ki parameter of the PID controller that controls the output of the target protocol data, that is, the proportional gain coefficient and the integral gain coefficient are 0.05 and 0 respectively. The output rate of the PID controller under this parameter configuration controls the output of the target protocol data to be 20Mb bytes per second, and the error feedback generated is 0, that is, no error feedback occurs. Therefore, the Kp parameter is continuously adjusted based on the first adjustment amount until the error feedback is 0.03, that is, when error feedback occurs in the first feedback condition, the first adjustment amount is corrected according to the preset correction amount 0.005, and the reduced first adjustment amount is reduced on the basis of the current Kp parameter 0.08, and the target Kp parameter 0.075 is obtained. Then, the Ki parameter is adjusted according to the second adjustment amount, and the second adjustment amount is increased to 0.1 based on the currently configured Ki parameter 0. By configuring the Kp parameter to be 0.075, the PID controller with the Ki parameter of 0.1 controls the target protocol data to output at a rate of 105 Mb bytes per second, and the error feedback generated is 0.01, that is, when error feedback occurs in the second feedback condition, the Ki parameter is continuously adjusted based on the second adjustment amount until the error feedback is 0, that is, no error feedback occurs in the second feedback condition, and the target Ki parameter is 0.15.
[0147] In this embodiment, the target control parameters are obtained only by adjusting the proportional gain coefficient and the integral gain coefficient of the PID controller, so that the target protocol data is controlled and outputted through the controller configured with the target control parameters, thereby achieving the effect of shortening the time consumed to adjust the target protocol data to a higher output rate.
[0148] In a feasible implementation manner, step S43 may further include step S401:
[0149] Step S401, recording the target control parameter, so as to update the control parameter based on the target control parameter when the actual protocol type and the target protocol type are detected to be reproduced, and the actual protocol type and the target protocol type corresponding to the target control parameter are consistent, wherein the reproduced actual protocol type and the reproduced target protocol type are, after adjusting the output rate of the target protocol data, the actual protocol type and the target protocol type that are repeatedly detected in the data to be converted.
[0150] It can be understood that since the data transmission rates required by different interface devices for data with the same actual protocol type and target protocol type are consistent, step S401 is performed to avoid repeated target control parameter determination for data to be converted with the same actual protocol type and target protocol type, thereby improving the conversion rate of data of different protocol types into designated protocol data with a higher transmission rate.
[0151] In this embodiment, a data protocol conversion method is proposed. By detecting and parsing data of different protocol types, the data of different protocol types are converted into target protocol data, and the output rate of the target protocol data is adjusted to meet the data transmission rate required by different interface devices, thereby achieving the effect of converting data of different protocol types into designated protocol data with a higher transmission rate.
[0152] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , Figure 2 This is a flow chart of the second embodiment of the data protocol conversion method of the present application, wherein the data protocol conversion method further includes steps S100 to S200:
[0153] Step S100, numbering the data to be converted to obtain numbered data, and monitoring the conversion progress of the data to be converted during the data protocol conversion process;
[0154] It should be noted that the numbered data refers to the data obtained after the data to be converted is visualized, and the conversion progress refers to the amount of data that has been converted and the amount of data that remains unconverted during the data protocol conversion process.
[0155] It is understandable that since the user is required to know the conversion progress of the specific data when performing protocol conversion on the data to be converted so as to be able to intervene in time when an abnormality occurs in the protocol conversion process, step S100 is performed to provide a reliable data basis for the user to accurately know the conversion progress of the data to be converted.
[0156] Step S200, outputting the serial number data and the conversion progress in association with each other.
[0157] In this embodiment, by outputting the conversion progress of the data to be converted, the user can accurately know the specific progress of the data in the protocol conversion process.
[0158] For example, to help understand the implementation process of the data protocol conversion method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 3, Figure 3 A system block diagram of a plurality of interface conversion systems used in a data protocol conversion method is provided, specifically:
[0159] An interface part is configured in the FPGA (Field Programmable Gate Array), and the interface types in the interface part include HDMI interface, USB interface, PCIe interface, URAT interface, NETWORK interface, SATA interface and WiFi interface. The control part is configured with FPGA and ARM, wherein FPGA and ARM communicate through CONTROL_SIGNAL, i.e., control signal, and ARM communicates data with SRAM, i.e., static random access memory. In addition, POWER_CONTROL, i.e., the power control part, is used to control the power supply for the system.
[0160] For further information, please refer to Figure 4 , Figure 4 A schematic diagram of a data communication scenario in a data protocol conversion method is provided, specifically:
[0161] Figure 4 The process of communication between the above FPGA and ARM is shown in the figure, where Addr1-Addr8 are the identifiers of the address lines, which are used to transmit address information between the microcontroller or processor and other components such as memory; D0-D15 represent data lines, which are used to transmit data between the microcontroller and external devices. The number following each "D" represents the number of the data line, and there are 16 data lines in total, which means that the data width is 16 bits; nGS5 represents a control signal, which is used to disable (when the signal is high) or enable (when the signal is low) the function in the FPGA; nOE is the negative logic signal of output enable, which is used to control whether the data output is enabled or not; nWE is the negative logic signal of write enable, which is used to control the enablement of data write operation; EINT0 is the output signal of error interrupt, which is used to indicate that some error has occurred and may request the ARM processor to interrupt processing.
[0162] For further information, please refer to Figure 5 , Figure 5 A brief flow chart of a data protocol conversion method is provided, specifically:
[0163] The protocol conversion type configured by the user, i.e., the target protocol type, is received through ARM (Advanced RISC Machine, Advanced Reduced Instruction Set Machine), and the configured protocol conversion type is transmitted to the FPGA module through the FPGA and ARM communication modules. FPGA will start the input protocol adaptive detection module according to the output protocol type configured by ARM, i.e., the target protocol type. The adaptive protocol detection module includes a USB detection module, a PCIe detection module, a URAT detection module, a SATA detection module, an SPI detection module, a network port detection module, an IO detection module, and an I2C detection module. The protocol format detection is performed on the data to be converted through the above-mentioned adaptive protocol detection module, so that the data to be converted with known protocol format is input into the data processing module for parsing and conversion to obtain the target protocol data. Then the target protocol data is adjusted for the output rate through the adaptive transmission rate configuration module to adapt to the data transmission rate required by different interface devices. Finally, the target protocol data with the output rate adapted is output through the data output module.
[0164] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data protocol conversion method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0165] This application also provides a data protocol conversion device, please refer to Figure 6 , the data protocol conversion device comprises:
[0166] A receiving module 10 is used to receive data to be converted and a target protocol type of the data to be converted;
[0167] The parsing module 20 is used to detect the actual protocol type of the data to be converted, obtain a detection result, and parse the data to be converted based on the detection result to obtain parsed data;
[0168] A conversion module 30, configured to convert the parsed data into target protocol data according to the target protocol type, and output the target protocol data;
[0169] The control module 40 is configured to adjust the output rate of the target protocol data based on the actual protocol type and the target protocol type.
[0170] Optionally, the output rate of the target protocol data is controlled by a PID controller, and the control module 40 is further used for:
[0171] Determining control parameters of the PID controller based on the actual protocol type and the target protocol type;
[0172] Based on the control parameter and the analysis data, determining an adjustment amount of the control parameter;
[0173] The control parameter is adjusted according to the adjustment amount to obtain a target control parameter, so as to adjust the output rate through the controller configured with the target control parameter.
[0174] Optionally, the control module 40 is further configured to:
[0175] Modeling is performed based on the control parameters and the analytical data to obtain a PID control model;
[0176] An error value in the PID control model is obtained, and the adjustment amount is determined based on the error value.
[0177] Optionally, the adjustment amount includes a first adjustment amount and a second adjustment amount, the control parameter includes a proportional gain coefficient and an integral gain coefficient, and the target control parameter includes a target proportional gain coefficient and a target integral gain coefficient;
[0178] The control module 40 is also used for:
[0179] adjusting the first control parameter according to the first adjustment amount, and monitoring a first feedback condition generated during the output of the target protocol data;
[0180] adjusting the proportional gain coefficient according to the first adjustment amount, and monitoring a first feedback condition generated during the output of the target protocol data;
[0181] In the case where no error feedback occurs in the first feedback condition, returning to the step of adjusting the proportional gain coefficient according to the first adjustment amount; in the case where error feedback occurs in the first feedback condition, correcting the first adjustment amount according to a preset correction amount, and adjusting the proportional gain coefficient based on the corrected first adjustment amount to obtain the target proportional gain coefficient;
[0182] adjusting the integral gain coefficient according to the second adjustment amount, and monitoring a second feedback condition generated during the output of the target protocol data;
[0183] In the case where error feedback occurs in the second feedback condition, the step of adjusting the integral gain coefficient according to the second adjustment amount is returned to be executed; in the case where error feedback does not occur in the second feedback condition, the target integral gain coefficient is obtained.
[0184] Optionally, the parsing module 20 is further used for:
[0185] Detecting the interface type of the interface called by receiving the data to be converted, and determining a candidate actual protocol type of the data to be converted based on the interface type;
[0186] Extracting the protocol field of the header information in the data to be converted, and determining the verification actual protocol type of the data to be converted by matching the protocol field with a plurality of preset fields;
[0187] In the case that the candidate actual protocol type is consistent with the verification actual protocol type, the candidate actual protocol type is used as the actual protocol type, and the to-be-converted data is marked based on the actual protocol type to obtain the detection result.
[0188] Optionally, the conversion module 30 is further used for:
[0189] Determining a preset function used for converting a data protocol according to the target protocol type;
[0190] Converting the parsed data into the target protocol data based on the preset function, and determining an output interface for outputting the target protocol data according to the preset function;
[0191] The target protocol data is output through the output interface.
[0192] Optionally, the data protocol conversion device is further used for:
[0193] Numbering the data to be converted to obtain numbered data, and monitoring the conversion progress of the data to be converted during the data protocol conversion process;
[0194] The numbering data and the conversion progress are associated and outputted.
[0195] The data protocol conversion device provided by the present application adopts the data protocol conversion method in the above embodiment, which can solve the technical problem of how to convert data of different protocol types into designated protocol data with a higher transmission rate. Compared with the prior art, the beneficial effects of the data protocol conversion device provided by the present application are the same as the beneficial effects of the data protocol conversion method provided by the above embodiment, and other technical features in the data protocol conversion device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0196] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data protocol conversion method in the above-mentioned embodiment 1.
[0197] Reference below Figure 7, which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0198] like Figure 7 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0199] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0200] The electronic device provided by the present application adopts the data protocol conversion method in the above embodiment, which can solve the technical problem of how to convert data of different protocol types into designated protocol data with a higher transmission rate. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the data protocol conversion method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0201] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0202] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0203] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data protocol conversion method in the above-mentioned embodiment.
[0204] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0205] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0206] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device: receives data to be converted and a target protocol type of the data to be converted; detects an actual protocol type of the data to be converted to obtain a detection result, and parses the data to be converted based on the detection result to obtain parsed data; converts the parsed data into target protocol data according to the target protocol type, and outputs the target protocol data; and adjusts the output rate of the target protocol data based on the actual protocol type and the target protocol type.
[0207] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0208] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0209] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0210] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data protocol conversion method, and can solve the technical problem of how to convert data of different protocol types into designated protocol data with a higher transmission rate. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the data protocol conversion method provided by the above-mentioned embodiment, and will not be repeated here.
[0211] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data protocol conversion method when executed by a processor.
[0212] The computer program product provided by the present application can solve the technical problem of how to convert data of different protocol types into data of a specified protocol with a higher transmission rate. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the data protocol conversion method provided by the above embodiment, and will not be repeated here.
[0213] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A data protocol conversion method, characterized in that: The method includes: receiving data to be converted and a target protocol type of the data to be converted; detecting an actual protocol type of the data to be converted to obtain a detection result, and parsing the data to be converted based on the detection result to obtain parsed data; Converting the parsed data into target protocol data according to the target protocol type, and outputting the target protocol data; An output rate of the target protocol data is adjusted based on the actual protocol type and the target protocol type.
2. The method according to claim 1, wherein The output rate of the target protocol data is controlled by a PID controller, and the step of adjusting the output rate of the target protocol data based on the actual protocol type and the target protocol type includes: Determining control parameters of the PID controller based on the actual protocol type and the target protocol type; determining an adjustment amount for adjusting the control parameter based on the control parameter and the analyzed data; The control parameter is adjusted according to the adjustment amount to obtain a target control parameter, so as to adjust the output rate through the controller configured with the target control parameter.
3. The method according to claim 2, wherein The step of determining an adjustment amount of the control parameter based on the control parameter and the analysis data includes: Modeling is performed based on the control parameters and the analytical data to obtain a PID control model; An error value in the PID control model is obtained, and the adjustment amount is determined based on the error value.
4. The method according to claim 2, wherein The adjustment amount includes a first adjustment amount and a second adjustment amount, the control parameters include a proportional gain coefficient and an integral gain coefficient, and the target control parameters include a target proportional gain coefficient and a target integral gain coefficient; The step of adjusting the control parameter according to the adjustment amount to obtain the target control parameter includes: adjusting the proportional gain coefficient according to the first adjustment amount, and monitoring a first feedback condition generated during the output of the target protocol data; If no error feedback occurs in the first feedback condition, returning to the step of adjusting the proportional gain coefficient according to the first adjustment amount; if error feedback occurs in the first feedback condition, correcting the first adjustment amount according to a preset correction amount, and adjusting the proportional gain coefficient based on the corrected first adjustment amount to obtain the target proportional gain coefficient; adjusting the integral gain coefficient according to the second adjustment amount, and monitoring a second feedback condition generated during the output of the target protocol data; If error feedback occurs in the second feedback condition, the step of adjusting the integral gain coefficient according to the second adjustment amount is returned to execution; if no error feedback occurs in the second feedback condition, the target integral gain coefficient is obtained.
5. The method according to claim 1, wherein The step of detecting the actual protocol type of the data to be converted and obtaining a detection result comprises: Detecting an interface type of an interface called by receiving the data to be converted, and determining a candidate actual protocol type of the data to be converted based on the interface type; Extracting a protocol field from header information of the data to be converted, and determining an actual verification protocol type of the data to be converted by matching the protocol field with a plurality of preset fields; In a case where the candidate actual protocol type is consistent with the verified actual protocol type, the candidate actual protocol type is used as the actual protocol type, and the data to be converted is marked based on the actual protocol type to obtain the detection result.
6. The method according to claim 1, wherein The step of converting the parsed data into target protocol data according to the target protocol type and outputting the target protocol data includes: Determining a preset function for converting the data protocol according to the target protocol type; Converting the parsed data into the target protocol data based on the preset function, and determining an output interface for outputting the target protocol data according to the preset function; The target protocol data is output through the output interface.
7. The method according to claim 1, wherein The method further comprises: Numbering the data to be converted to obtain numbered data, and monitoring the conversion progress of the data to be converted during the data protocol conversion process; The numbering data and the conversion progress are associated and outputted.
8. A data protocol conversion device, characterized in that: The device comprises: A receiving module, configured to receive data to be converted and a target protocol type of the data to be converted; a parsing module, configured to detect an actual protocol type of the data to be converted, obtain a detection result, and parse the data to be converted based on the detection result to obtain parsed data; a conversion module, configured to convert the parsed data into target protocol data according to the target protocol type, and output the target protocol data; A control module is configured to adjust an output rate of the target protocol data based on the actual protocol type and the target protocol type.
9. An electronic device, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data protocol conversion method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data protocol conversion method according to any one of claims 1 to 7 are implemented.
