Communication protocol conversion method of hydrogen energy cogeneration system
By using the protocol conversion method of CAN and Modbus RTU protocols in the hydrogen fuel cell co-heating and power supply system, the problem of non-interconnection of communication protocols between different sub-equipments is solved, and debugging efficiency and system interoperability are improved.
Patent Information
- Application Number
- CN202411568464.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The communication protocols between different sub-equipments in the hydrogen fuel cell co-heating and power supply system are incompatible, resulting in unstable system operation and low debugging efficiency.
A communication protocol conversion method is adopted to realize the analysis, reorganization and transmission of CAN protocol and Modbus RTU protocol frames through the CAN transceiver module, protocol conversion unit and 485 transceiver module to ensure the interoperability of communication protocols between different sub-devices.
It solves the problem of non-interconnection of communication protocols between different sub-devices, improves on-site debugging efficiency, and realizes the interoperability and interconnection of equipment communication topology.
Smart Images

Figure CN119449908A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology conversion in the hydrogen energy industry, and relates to a communication protocol conversion method for a hydrogen energy cogeneration system, and specifically to a method for mutual conversion between CAN communication and 485 communication application layer protocols. Background Art
[0002] The global energy landscape is undergoing a profound transformation from reliance on traditional fossil energy to the pursuit of clean and efficient energy. Countries are vigorously developing clean energy, reducing the use of traditional fossil energy, and actively looking for alternative energy. Hydrogen, as an ideal secondary energy carrier, is apparently an absolutely clean fuel.
[0003] Combined heat and power refers to a production method that combines heat supply and power generation. The hydrogen fuel cell combined heat and power system is a technology that uses fuel cell technology to supply electricity and heat energy to users. It is mainly based on proton exchange membrane fuel cells (PEMFC) and is mainly used in the form of distributed power generation. It is one of the important ways to ensure energy supply.
[0004] Fuel cell cogeneration systems are widely used to provide energy for buildings. At present, hydrogen fuel cell distributed power generation has been initially commercialized in Europe, Japan and other countries. However, the use of hydrogen fuel cell cogeneration in my country is still in the stage of project demonstration and application, and all aspects of development are in the early stages, so the system supply chain is not perfect.
[0005] In order to ensure the normal operation of the cogeneration system and the on-grid and off-grid application of electricity, the system needs to build a hydrogen circuit module, an air circuit module, a water circuit module, an on-grid and off-grid control module, a hydrogen fuel cell voltage-saving inspection module, a heat recovery module, a control module, a cloud platform module, etc. Each module requires signal collection and real-time control of dynamic and static components. Because there are many components involved and the domestic supply chain is not complete, different components will use different control signals. For example, heat recovery modules are widely used in the home appliance industry, and the field bus mostly uses 485 signals to build a communication architecture, while the inspection system of hydrogen fuel cells is widely used in the automotive industry, and mostly uses CAN signals to build a communication architecture. If the same communication method is planned in a unified manner, it will cause difficulties in selection. Therefore, in order to solve the problem that the communication protocols between different sub-devices in the hydrogen fuel cell cogeneration system cannot communicate and be compatible, a communication protocol conversion method for a hydrogen energy cogeneration system is proposed, which mainly involves the application layer protocol conversion of the CAN protocol and the 485 signal (Modbus RTU protocol). Through this method, a protocol conversion algorithm is established in the control unit, and with the hardware support of the CAN transceiver and 485 transceiver modules, the protocol conversion unit can communicate and control the sub-devices of the CAN and 485 (Modbus RTU) protocols, which greatly improves the efficiency of on-site debugging and realizes the intercommunication and interconnection of equipment communication topologies. Summary of the invention
[0006] In order to solve the above problems, a communication protocol conversion method for a hydrogen energy cogeneration system is provided to solve the incompatibility problem caused by different communication protocols between devices. This method is not limited to programming languages and embedded chip types.
[0007] To achieve the above objectives, this application provides the following technical solutions:
[0008] One aspect of the present application provides a communication protocol conversion method for a hydrogen energy cogeneration system, including: protocol transceiver, protocol parsing, and protocol reorganization modules, and supported by hardware such as a CAN transceiver module, a protocol conversion unit, and a 485 transceiver module to realize the functions of protocol parsing, protocol reorganization, and protocol transceiver; the CAN transceiver module and the protocol conversion unit are physically connected using a twisted pair to realize bidirectional data transmission; the 485 transceiver module and the central processing unit are physically connected using a twisted pair to realize bidirectional data transmission; the protocol parsing function includes parsing of CAN protocol frames and parsing of Modbus RTU protocol frames; the protocol reorganization function includes reorganizing CAN frames into Modbus RTU frames, and reorganizing Modbus RTU frames into CAN frames; the protocol transceiver function includes the protocol conversion unit sending CAN signals to the controlled device via the CAN transceiver module, and the protocol conversion unit sending 485 signals to the controlled device via the 485 transceiver module.
[0009] Optionally, the application layer protocol of the CAN transceiver module uses the CAN2.0B protocol, and the 485 signal application layer uses the ModbusRTU protocol.
[0010] Optionally, the protocol conversion unit is implemented using an STM32 chip. The method can also be implemented using other chips and can flexibly adapt to a variety of chips and programming languages.
[0011] Optionally, there are two types of correspondence between CAN frames and Modbus RTU frames: one-to-one and one-to-many. Among them, when CAN frames are converted to Modbus RTU frames, there is a one-to-one correspondence, and when Modbus RTU frames are converted to CAN frames, there are two possibilities: one-to-one and one-to-many.
[0012] Optionally, the frame ID of the CAN protocol frame corresponds to the address of the Modbus RTU protocol frame, the first byte of the content of the CAN protocol frame is used as the flag bit of the multi-frame combination, the second byte of the content of the CAN protocol frame corresponds to the function code of the Modbus RTU protocol frame, and the 3rd to 8th bytes of the content of the CAN protocol frame correspond to the data field of the Modbus RTU frame.
[0013] Optional, one-to-many relationship means: when the Modbus RTU frame data field is greater than 6 bytes, the Modbus RTU protocol frame and the CAN frame are in a one-to-many relationship.
[0014] Optional, multi-frame combination flag, through the frame ID between multiple frames and the first byte of the CAN frame content to perform identity check, if the same, then the flag is used to combine multiple frames, and finally realize that multiple CAN frames correspond to one ModbusRTU frame.
[0015] Optionally, in the field of hydrogen fuel cell cogeneration, this method takes into account the data particularity of the applied system during the conversion process, and frames data with the same or similar attributes in priority order according to data attributes.
[0016] The beneficial effects of this application are:
[0017] This application fully considers the particularity of hydrogen fuel cell related communication data, and has the advantages of high efficiency and accuracy in the protocol conversion process. It solves the problem of non-interoperability of communication protocols between neutron equipment in cogeneration equipment, and has a strong reference for the protocol conversion work of hydrogen fuel cell control systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 This is a diagram illustrating the system composition and functions;
[0020] Figure 2 Reconstruct CAN frame flow chart for Modbus RTU frame;
[0021] Figure 3 Reconstruct Modbus RTU frame flow chart for CAN frame;
[0022] Figure 4 Build a relationship diagram for CAN frames and Modbus RTU frames. DETAILED DESCRIPTION
[0023] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other implementations obtained by ordinary technicians in this field without creative work.
[0024] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary workers in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0025] In the description of this application, the term "segment flag" needs to be understood.
[0026] In order to solve the problem that the communication protocols between different sub-devices in the hydrogen fuel cell cogeneration system cannot be interoperable and compatible, a communication protocol conversion method for the hydrogen energy cogeneration system is proposed, including protocol transceiver, protocol parsing, and protocol reorganization modules, and supported by hardware such as CAN transceiver module, protocol conversion unit, and 485 transceiver module. The proposed protocol conversion method is applied to the protocol conversion unit.
[0027] refer to Figure 1-4 This embodiment provides a communication protocol conversion method for a hydrogen energy cogeneration system. Specifically, an embodiment of converting a Modbus RTU protocol frame to a CAN frame is described.
[0028] In the embodiment of the present application, the protocol transceiver module refers to the transceiver of CAN protocol frames and Modbus RTU protocol frames through the CAN transceiver module and the 485 transceiver module; the data parsing module parses the Modbus RTU frame, decomposes the address field, function code, and data field as valid information, and establishes the corresponding relationship between the function code and the CAN frame ID according to the data protocol of the on-site debugging of the hydrogen fuel cell cogeneration system. The CAN frame data and the length of 8 bytes are the maximum upper limit, and the Modbus RTU frame is grouped; the data reorganization module is based on Figure 1 The Modbus RTU frame is rearranged according to the CAN2.0B protocol format according to the corresponding relationship, and the on-site debugging protocol needs to be followed.
[0029] In the example of this application, when the Modbus RTU frame is converted to a CAN frame, there are two corresponding relationships: one-to-one and one-to-many. If the length of the Modbus RTU frame data field is less than 6 bytes, it is a one-to-one relationship, and if it is greater than 6 bytes, it is a one-to-many relationship. In a one-to-one relationship, the segmentation flag is 0; in a one-to-many relationship, the segmentation flag increases from 1 according to the segmentation order.
[0030] During the data reorganization process, the data correlation of the hydrogen fuel cell cogeneration system will be fully considered. For example, hydrogen pressure and air pressure belong to the same pressure category, so during the conversion process they will be arranged continuously in sequence to facilitate analysis and use by upper-level applications.
[0031] Combining the above analysis and Figure 4 In a one-to-one relationship, the address field of the Modbus RTU frame corresponds to the frame ID of the CAN frame, the first byte of the CAN frame data field is the segmentation flag, and the value is 0. The function code of the Modbus RTU protocol frame corresponds to the second byte of the CAN frame data field, and the data field of the Modbus RTU protocol frame corresponds to the third to eighth bytes of the CAN frame data field. In a one-to-many relationship, the first CAN frame segmentation flag is 1, the second CAN frame segmentation flag is 2, and there is no function code. The second to eighth bytes are all Modbus RTU data field content, and the third, fourth, fifth, and fourth CAN frames are similar to the second CAN frame.
[0032] In an optional implementation, the CAN signal transceiver module and the 485 signal transceiver module include at least two corresponding signal sources.
[0033] In an optional implementation, using a debugging computer as a signal source requires a 485 to USB module and a CAN to USB module, and the debugging computer is installed with corresponding drivers and debugging software.
[0034] The test steps of this embodiment are as follows:
[0035] S1. Build a test environment, combined with Figure 1 Build the physical topology. One end of the 485 transceiver module is connected to the protocol conversion unit, and the other end is connected to the computer via the 485 to USB module. One end of the CAN transceiver module is connected to the protocol conversion unit, and the other end is connected to the computer via the CAN to USB module.
[0036] S2. Open the serial port debugging assistant and CAN debugging assistant on the test computer to ensure normal communication between 485 signals and CAN signals.
[0037] S3. Use the serial port debugging assistant to send a Modbus RTU protocol frame with a data field not exceeding 6 bytes.
[0038] S4. Receive and parse the protocol frame received by the CAN debugging assistant, and check its correctness to verify the effectiveness of this embodiment.
[0039] S5. Use the serial port debugging assistant to send a Modbus RTU protocol frame with a data field exceeding 6 bytes.
[0040] S6. Receive and parse the protocol frame received by the CAN debugging assistant, and check its correctness to verify the effectiveness of this embodiment.
[0041] The above-mentioned embodiments are only preferred embodiments of the present application and cannot be used to limit the scope of protection of the present application. Those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present application. Such modifications and variations shall fall within the scope defined by the attached claims.
Claims
1. A communication protocol conversion method for a hydrogen energy cogeneration system, characterized in that: With CAN transceiver module, 485 transceiver module and protocol conversion unit as hardware support, the functions of protocol analysis, protocol reorganization and protocol transceiver are realized; The CAN transceiver module is physically connected to the protocol conversion unit to achieve two-way transmission; the 485 transceiver module is physically connected to the central processor to achieve two-way transmission; The protocol parsing function includes CAN protocol frame parsing and Modbus RTU protocol frame parsing; The protocol reorganization function includes reorganizing CAN frames into Modbus RTU frames, and reorganizing Modbus RTU frames into CAN frames; The protocol transceiver function includes the protocol conversion unit sending CAN signals to the controlled device via the CAN transceiver module, and the protocol conversion unit sending 485 signals to the controlled device via the 485 transceiver module.
2. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 1 is characterized in that: The application layer protocol of the CAN transceiver module uses the CAN2.0B protocol.
3. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 1 is characterized in that: Any embedded processor can be used, there is no requirement for coding language, and it has high flexibility.
4. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 1 is characterized in that: The application layer protocol of the 485 transceiver module uses the Modbus RTU protocol.
5. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 1 is characterized in that: The frame ID of the CAN protocol frame corresponds to the address of the Modbus RTU protocol frame. The first byte of the content of the CAN protocol frame corresponds to the function code of the Modbus RTU protocol frame. The second byte of the content of the CAN protocol frame is used as the flag bit of the multi-frame combination.
6. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 5 is characterized in that: The correspondence between the CAN frame and the Modbus RTU frame is a one-to-one correspondence when the CAN frame is converted into the Modbus RTU frame, and there are two correspondences, one-to-one and one-to-many, when the Modbus RTU frame is converted into the CAN frame.
7. The communication protocol conversion method of a hydrogen energy cogeneration system according to claim 5 is characterized in that: The frame ID between multiple frames and the first byte of the CAN frame content are used for identity check. If they are the same, multiple frames are combined through this flag bit, and finally multiple CAN frames correspond to one Modbus RTU frame.