A protocol conversion response method and device based on an inverter communication adapter
By caching and comparing data frame protocol responses through the inverter communication adapter, and executing responses according to service priorities, the problem of high resource consumption in existing technologies is solved, and efficient and orderly protocol conversion is achieved.
Patent Information
- Application Number
- CN202410829083.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-06-25
AI Technical Summary
In existing technologies, software implementation methods based on protocol stacks consume a lot of resources during protocol conversion, affecting execution efficiency and making them unsuitable for situations where high efficiency is required but flexibility is less critical.
An inverter communication adapter is used to cache data frame protocol responses and quickly compare them with the protocol stack. After determining their validity, the response is executed according to the service priority to ensure that the channel is idle and achieve efficient and orderly protocol conversion.
While ensuring safety and order, it improves the efficiency of protocol conversion and reduces resource consumption, making it suitable for occasions with high efficiency requirements.
Smart Images

Figure CN118890402B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-protocol conversion response technology, and more specifically, to a protocol conversion response method and apparatus based on an inverter communication adapter. Background Technology
[0002] Current protocol conversion is divided into software implementation and hardware implementation. Software implementation is mostly based on actual field application scenarios and performs real-time conversion of the protocol to be converted. Commonly used methods include protocol mapping and protocol stacks. Although these methods can enhance flexibility and reliability, they consume more resources and affect execution efficiency, making them unsuitable for some application scenarios with lower flexibility requirements but higher efficiency requirements. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a protocol conversion response method and apparatus based on an inverter communication adapter.
[0004] According to one aspect of the present invention, a protocol conversion response method based on an inverter communication adapter is provided, comprising:
[0005] When the inverter universal adapter receives a data frame protocol response, the data frame protocol response is buffered.
[0006] The cached data frame protocol response is quickly compared with the protocol stack, and the comparison result is used to determine whether the data frame protocol response is a valid protocol.
[0007] If the comparison result shows that there is a data frame protocol response in the protocol stack, the service priority of the requesting device corresponding to the data frame protocol response is determined according to the corresponding protocol frame matched by the data frame protocol response.
[0008] The data frame protocol response is executed according to the service priority of the data frame protocol response and the pre-defined response rules.
[0009] Optionally, the data frame protocol response is the MODBUS protocol.
[0010] Optionally, determining whether a data frame protocol response is a valid protocol based on the comparison result includes:
[0011] If the comparison result indicates that there is no data frame protocol response in the protocol stack, the processing of the data frame protocol response is abandoned.
[0012] Optionally, the data frame protocol response is executed according to the service priority of the data frame protocol response and the pre-defined response rules, including:
[0013] Determine if there is a protocol response currently being executed; if so, prioritize executing the protocol response that is currently being processed.
[0014] If no protocol response is currently being executed, then determine whether there is a protocol response with a higher service priority than the data frame protocol response among the pending protocol responses. If so, process the protocol response with the higher service priority first.
[0015] If there is no protocol response with a higher service priority than the data frame protocol response, then determine if there is a protocol response with the same service priority as the data frame protocol response. If so, execute them in order of their time sequence.
[0016] If no protocol response with the same service priority as the data frame protocol response exists, then the data frame protocol response is executed.
[0017] According to another aspect of the present invention, a protocol conversion response device based on an inverter communication adapter is provided, comprising:
[0018] The caching module is used to cache the data frame protocol response when the inverter general adapter receives the data frame protocol response;
[0019] The comparison module is used to quickly compare the cached data frame protocol response with the protocol stack, and determine whether the data frame protocol response is a valid protocol based on the comparison result.
[0020] The determination module is used to determine the service priority of the requesting device corresponding to the data frame protocol response based on the corresponding protocol frame matched by the data frame protocol response when the comparison result shows that there is a data frame protocol response in the protocol stack.
[0021] The execution module is used to execute data frame protocol responses according to the service priority of the data frame protocol response and the pre-set response rules.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, the storage medium storing a computer program for performing the methods described in any of the above aspects of the present invention.
[0023] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the method described in any of the preceding aspects of the present invention.
[0024] Therefore, this invention uses protocol stack comparison to determine the protocol type and responds sequentially at the business level according to the priority of the devices that need to respond. Under the premise of rapid protocol conversion, it ensures the safe and orderly operation of the responding devices. At the same time, it caches instructions during processing to keep the channel idle, thereby achieving efficient and orderly protocol conversion and transmission. Attached Figure Description
[0025] Exemplary embodiments of the present invention can be more fully understood by referring to the following figures:
[0026] Figure 1 This is a flowchart illustrating a protocol conversion response method based on an inverter communication adapter provided in an exemplary embodiment of the present invention;
[0027] Figure 2 This is another schematic flowchart of a protocol conversion response method based on an inverter communication adapter provided in an exemplary embodiment of the present invention;
[0028] Figure 3 This is a schematic diagram of the structure of a protocol conversion response device based on an inverter communication adapter provided in an exemplary embodiment of the present invention;
[0029] Figure 4 This is the structure of an electronic device provided in an exemplary embodiment of the present invention. Detailed Implementation
[0030] Hereinafter, exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments of the present invention. It should be understood that the present invention is not limited to the exemplary embodiments described herein.
[0031] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of the invention.
[0032] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of the present invention are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.
[0033] It should also be understood that in the embodiments of the present invention, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.
[0034] It should also be understood that any component, data or structure mentioned in the embodiments of the present invention can generally be understood as one or more unless explicitly defined or given contrary instructions in the context.
[0035] Furthermore, the term "and / or" in this invention is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this invention generally indicates that the preceding and following related objects have an "or" relationship.
[0036] It should also be understood that the description of the various embodiments in this invention emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0037] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0038] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.
[0039] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, they should be considered part of the specification.
[0040] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0041] The embodiments of this invention can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Well-known examples of terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.
[0042] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.
[0043] Exemplary methods
[0044] Figure 1This is a flowchart illustrating a protocol conversion response method based on an inverter communication adapter, provided by an exemplary embodiment of the present invention. This embodiment can be applied to electronic devices, such as... Figure 1 As shown, the protocol conversion response method 100 based on the inverter communication adapter includes the following steps:
[0045] Step 101: When the inverter universal adapter receives a data frame protocol response, the data frame protocol response is buffered.
[0046] Step 102: Quickly compare the cached data frame protocol response with the protocol stack, and determine whether the data frame protocol response is a valid protocol based on the comparison result.
[0047] Step 103: If the comparison result shows that there is a data frame protocol response in the protocol stack, determine the service priority of the requesting device corresponding to the data frame protocol response based on the corresponding protocol frame matched by the data frame protocol response.
[0048] Step 104: Execute the data frame protocol response according to the service priority of the data frame protocol response and the pre-set response rules.
[0049] Specifically, based on the application scenario of inverter communication adapters, this invention establishes a protocol stack comparison mechanism for downstream MODBUS protocol devices communicating via RS485, enabling rapid adaptive response to multiple MODBUS protocols and responding according to the service priority of field devices. (Reference) Figure 2 As shown, the specific implementation process is as follows:
[0050] 1) The inverter communication adapter receives a MODBUS protocol frame via the RS485 line, buffers the data frame to ensure the channel is idle, and monitors the channel data while processing the data.
[0051] 2) Upon receiving a protocol frame, the protocol stack is used to quickly compare the data frame to determine whether the current protocol is an existing and valid protocol. If the protocol already exists, processing continues; otherwise, processing is abandoned.
[0052] 3) Determine the service priority of the corresponding requesting device based on the corresponding protocol frame. If a protocol response process is currently being executed, execute the protocol response that is being processed first.
[0053] 4) If there is no protocol response currently being executed, determine whether there is a higher priority protocol response to be processed. If so, execute the higher priority protocol response first.
[0054] 5) If there is no protocol response with higher business priority, determine whether there is a protocol response of the same level to be executed. Protocol responses of the same level are sorted according to their time sequence.
[0055] 6) If the current protocol has an earlier response time among peer protocols, then execute the response of that protocol.
[0056] Therefore, this invention uses protocol stack comparison to determine the protocol type and responds sequentially at the business level according to the priority of the devices that need to respond. Under the premise of rapid protocol conversion, it ensures the safe and orderly operation of the responding devices. At the same time, it caches instructions during processing to keep the channel idle, thereby achieving efficient and orderly protocol conversion and transmission.
[0057] Exemplary device
[0058] Figure 3 This is a schematic diagram of the structure of a protocol conversion response device based on an inverter communication adapter provided in an exemplary embodiment of the present invention. Figure 3 As shown, the device 300 includes:
[0059] The cache module 310 is used to cache the data frame protocol response when the inverter general adapter receives the data frame protocol response;
[0060] The comparison module 320 is used to quickly compare the cached data frame protocol response with the protocol stack, and determine whether the data frame protocol response is a valid protocol based on the comparison result.
[0061] The determination module 330 is used to determine the service priority of the requesting device corresponding to the data frame protocol response based on the corresponding protocol frame matched by the data frame protocol response when the comparison result shows that there is a data frame protocol response in the protocol stack.
[0062] The execution module 340 is used to execute the data frame protocol response according to the service priority of the data frame protocol response and the pre-set response rules.
[0063] Optionally, the data frame protocol response is the MODBUS protocol.
[0064] Optionally, the comparison module 320 determines whether the data frame protocol response is a valid protocol based on the comparison result, including:
[0065] The abandon submodule is used to abandon processing the data frame protocol response if the comparison result shows that there is no data frame protocol response in the protocol stack.
[0066] Optionally, the execution module 340 includes:
[0067] The first judgment submodule is used to determine whether there is a protocol response being executed. If there is, the protocol response being processed will be executed first.
[0068] The second judgment submodule is used to determine whether there is a protocol response with a higher service priority than the data frame protocol response among the protocol responses to be processed if there is no protocol response currently being executed. If there is, the protocol response with the higher service priority is processed first.
[0069] The third judgment submodule is used to determine whether there is a protocol response with the same service priority as the data frame protocol response if there is no protocol response with a higher service priority than the data frame protocol response. If there is, the protocol responses are executed sequentially according to their time order.
[0070] The execution submodule is used to execute the data frame protocol response if no protocol response with the same service priority as the data frame protocol response exists.
[0071] Exemplary electronic devices
[0072] Figure 4 This is the structure of an electronic device provided in an exemplary embodiment of the present invention. For example... Figure 4 As shown, the electronic device 40 includes one or more processors 41 and a memory 42.
[0073] The processor 41 may be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
[0074] The memory 42 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 41 may execute the program instructions to implement the methods of the software programs of the various embodiments of the present invention described above, and / or other desired functions. In one example, the electronic device may also include an input device 43 and an output device 44, these components being interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0075] In addition, the input device 43 may also include, for example, a keyboard, a mouse, etc.
[0076] The output device 44 can output various information to the outside. The output device 44 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0077] Of course, for the sake of simplicity, Figure 4 Only some of the components of this electronic device relevant to the present invention are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device may include any other suitable components depending on the specific application.
[0078] Exemplary computer program products and computer-readable storage media
[0079] In addition to the methods and apparatus described above, embodiments of the present invention may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the methods according to various embodiments of the present invention described in the "Exemplary Methods" section above.
[0080] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of the present invention. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0081] Furthermore, embodiments of the present invention may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the methods according to various embodiments of the present invention described in the "Exemplary Methods" section above.
[0082] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0083] The basic principles of the present invention have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in the present invention are merely examples and not limitations, and should not be considered as essential features of each embodiment of the present invention. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the present invention to the necessity of employing the aforementioned specific details.
[0084] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0085] The block diagrams of devices, systems, devices, and systems involved in this invention are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, systems, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0086] The methods and systems of the present invention may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of the present invention are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, the present invention may also be implemented as a program recorded on a recording medium, the program comprising machine-readable instructions for implementing the methods according to the present invention. Thus, the present invention also covers recording media storing programs for performing the methods according to the present invention.
[0087] It should also be noted that in the systems, apparatus, and methods of the present invention, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered equivalents of the present invention. The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the invention. Therefore, the invention is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0088] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the invention to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A protocol conversion response method based on an inverter communication adapter, characterized in that, include: When the inverter universal adapter receives a data frame protocol response, the data frame protocol response is cached. The cached data frame protocol response is quickly compared with the protocol stack, and the comparison result is used to determine whether the data frame protocol response is a valid protocol. If the comparison result indicates that the protocol stack contains the data frame protocol response, the service priority of the requesting device corresponding to the data frame protocol response is determined based on the corresponding protocol frame matched by the data frame protocol response. The data frame protocol response is executed according to the service priority of the data frame protocol response and the pre-set response rules; Execute the data frame protocol response according to the service priority and pre-defined response rules, including: Determine if there is a protocol response currently being executed; if so, prioritize executing the protocol response that is currently being processed. If no protocol response is currently being executed, it is determined whether there is a protocol response with a higher service priority than the data frame protocol response among the pending protocol responses. If so, the protocol response with the higher service priority is processed first. If there is no protocol response with a higher service priority than the data frame protocol response, then it is determined whether there is a protocol response with the same service priority as the data frame protocol response. If so, they are executed sequentially according to the time order of the protocol responses. If no protocol response with the same service priority as the data frame protocol response exists, then the data frame protocol response is executed.
2. The method according to claim 1, characterized in that, The data frame protocol response is the MODBUS protocol.
3. The method according to claim 1, characterized in that, Determining whether the data frame protocol response is a legitimate protocol based on the comparison results includes: If the comparison result indicates that the protocol stack does not contain the data frame protocol response, the processing of the data frame protocol response is abandoned.
4. A protocol conversion response device based on an inverter communication adapter, characterized in that, include: A caching module is used to cache the data frame protocol response when the inverter universal adapter receives the data frame protocol response; The comparison module is used to quickly compare the cached data frame protocol response with the protocol stack, and determine whether the data frame protocol response is a valid protocol based on the comparison result. The determining module is used to determine the service priority of the requesting device corresponding to the data frame protocol response based on the corresponding protocol frame matched by the data frame protocol response when the comparison result shows that the protocol stack has the data frame protocol response; The execution module is used to execute the data frame protocol response according to the service priority of the data frame protocol response and the pre-set response rules; The execution module includes: The first judgment submodule is used to determine whether there is a protocol response being executed. If there is, the protocol response being processed will be executed first. The second judgment submodule is used to determine whether there is a protocol response with a higher service priority than the data frame protocol response if no protocol response is currently being executed. If so, the protocol response with the higher service priority is processed first. The third judgment submodule is used to determine whether there is a protocol response with the same service priority as the data frame protocol response if there is no protocol response with a higher service priority than the data frame protocol response. If there is, the protocol responses are executed sequentially according to their time order. The execution submodule is used to execute the data frame protocol response if there is no protocol response with the same service priority as the data frame protocol response.
5. The apparatus according to claim 4, characterized in that, The data frame protocol response is the MODBUS protocol.
6. The apparatus according to claim 4, characterized in that, The comparison module determines whether the data frame protocol response is a valid protocol based on the comparison result, including: The abandonment submodule is used to abandon processing the data frame protocol response if the comparison result shows that the protocol stack does not have the data frame protocol response.
7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for performing the method described in any one of claims 1-3.
8. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1-3.
Citation Information
Patent Citations
Data communication method and system
CN110391999A
Multi-protocol stack communication method for mobile communication core network
CN110891073A