A multi-device data transmission system and method
By cooperating with the main control unit and the channel switch, device connection identification, automatic address allocation and data integration on the RS485 bus are realized. This solves the problems of complex device address allocation, impedance matching and bus contention in the existing technology, improves data transmission efficiency and is suitable for multi-device systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAMEN DONESTY ECOMMERCE CO LTD
- Filing Date
- 2023-02-24
- Publication Date
- 2026-04-28
AI Technical Summary
The existing RS485 bus has problems such as complex device address allocation, difficulty in impedance matching, and unstable data transmission due to bus contention in multi-device data transmission. In addition, it is complicated to operate and difficult to automate and identify devices.
The main control unit works in conjunction with the first channel switch to achieve device connection identification, automatic address allocation, data acquisition and integration through a unified communication protocol. It uses RS485 bus for master-slave command interaction to avoid impedance matching problems and achieves data transmission through a unified communication protocol.
It enables automatic allocation and identification of device addresses, avoids impedance matching and bus contention, improves data transmission efficiency, simplifies operation procedures, and is suitable for multi-device systems such as photovoltaic energy storage, power supply, water supply and climate monitoring systems.
Smart Images

Figure CN116192559B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data communication technology, and in particular to a multi-device data transmission system and method. Background Technology
[0002] Current solar energy application-related products, such as inverters and controllers, all have RS485 bus communication functionality, which is used to output data (such as voltage and current) that is inherent to the device or collected by the device. The device provides an RS485 bus with an RJ45 interface to allow external connection.
[0003] RS485 communication networks employ a master-slave communication model, where the master device must guide the slave devices to send data. A common configuration is one master with multiple slave devices. Existing devices are all in RS485 slave mode. To simultaneously obtain data from multiple devices, an RS485 master device is needed capable of connecting to multiple devices at the same time. However, most users lack the relevant knowledge, so a simple operating method is required to implement this.
[0004] Before using an RS485 bus, device addresses need to be configured for simultaneous communication between multiple devices. RS485 bus address allocation methods can be broadly categorized into manual and automatic allocation. Manual allocation requires manual intervention to assign an address to each slave device before connecting all devices to the bus. This process is complex, inconvenient, and demands highly skilled operators. Automatic allocation, on the other hand, automatically configures the address of each device connected to the bus. This method is simple, convenient, and requires less personnel. To achieve automatic address allocation, the industry typically uses bus contention. However, bus contention is prone to device loss, prevents the addition of new devices, and lacks a device identification mechanism. Since all devices are connected to the RS485 bus simultaneously, if one device causes an abnormal state on the RS485 bus, even if other devices function normally, the host will still be unable to read data from them.
[0005] When multiple devices are connected to an RS485 bus simultaneously, impedance matching is required. This can be understood as multiple people sharing an apple; each person must receive exactly one complete apple. Multiple people require multiple complete apples, but if the total number of apples remains constant, it means that whether there are many or few people, each person will not receive exactly one complete apple. Impedance matching ensures that the total number of apples is always the correct amount, guaranteeing that each person receives exactly one complete apple. Impedance mismatch will lead to abnormal command transmission, frequently resulting in errors and packet loss. Generally, a 120Ω resistor is connected in parallel at the host and another 120Ω resistor is connected in parallel at the last connected device (which can also be understood as the device furthest from the host) to achieve impedance matching. However, in practical applications, it is difficult to automatically identify the last device. Even if the last device is identified, it usually requires the manual addition of a 120R resistor, which is relatively complex and inconvenient, and requires certain skills from the operator. Therefore, to achieve automatic impedance matching, the RS485 bus alone is not enough. Various self-designed auxiliary buses are often introduced for judgment. At this time, the device must support the access of the self-designed auxiliary bus. Since there is no standard for auxiliary buses, the device usually does not support the access of self-designed auxiliary buses, which has some limitations and requires the device manufacturer to make customized circuit designs.
[0006] In view of this, the inventors have conducted in-depth research on multi-device data transmission technology and proposed a multi-device data transmission system and method that integrates functions such as device connection identification, automatic device address allocation, device data acquisition, device data integration, and integrated data transmission. Summary of the Invention
[0007] The purpose of this invention is to provide a multi-device data transmission system and method. This system can not only solve the problems of device address allocation, impedance matching and device identification during data transmission, but also integrate the data generated or collected by upstream devices and send the data to downstream devices.
[0008] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution:
[0009] A multi-device data transmission system, comprising:
[0010] Main control unit;
[0011] A first-channel switch has its input terminals connected to multiple RJ45 input interfaces, each of which is used to connect to a data acquisition device. The output terminal of the first-channel switch is connected to the main control unit via a first RS485 bus. The main control unit is also connected to the first-channel switch via a first-channel control bus to control the switch's on / off state, ensuring that only one data acquisition device can communicate with the first RS485 bus and the main control unit at any given time. The main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface. It also uses a unified communication protocol to perform master-slave command interaction with the identified data acquisition device via the first RS485 bus, automatically assigning an address to the data acquisition device and reading data from the assigned address. Finally, the main control unit integrates the read data according to preset rules to obtain a dataset.
[0012] At least one RJ45 output interface is provided. The RJ45 output interface is used to connect to a data receiving device. After the data receiving device is connected to the RJ45 output interface, it communicates with the main control unit through a second RS485 bus. The main control unit is also used to perform master-slave command interaction with the connected data receiving device using a unified communication protocol, so as to send the integrated dataset to the data receiving device through the second RS485 bus according to preset rules.
[0013] Preferably, the main control unit includes:
[0014] The device connection identification module is used to detect and identify whether a data acquisition device is connected to the RJ45 input interface;
[0015] The device address automatic allocation module is used to communicate with the identified data acquisition device via the first RS485 bus using a unified communication protocol to automatically allocate an address to the data acquisition device.
[0016] The device data acquisition module is used to perform master-slave command interaction with the identified data acquisition device via the first RS485 bus using a unified communication protocol, so as to read data from the data acquisition device with the assigned address.
[0017] The device data integration module is used to integrate the read data according to preset rules to obtain a dataset.
[0018] An integrated data transmission module is used to interact with a connected data receiving device using a unified communication protocol, transmitting the integrated dataset to the data receiving device via a second RS485 bus according to preset rules; and
[0019] The storage module is used to store the data obtained by the master control unit through interaction with the data acquisition device and the data receiving device, master-slave interaction commands, and the integrated dataset.
[0020] Preferably, the first channel switch adopts a switching circuit and has multiple channels, and the main control unit controls the conduction / disconnection of each channel in the first channel switch through the first channel control bus.
[0021] Preferably, the system further includes a third RS485 bus connected to the RJ45 output interface. After the data receiving device is connected to the RJ45 output interface, it communicates with the main control unit through the third RS485 bus. The main control unit is also used to perform master-slave command interaction with the connected data receiving device using a unified communication protocol, so as to send the integrated dataset to the data receiving device through the third RS485 bus according to preset rules.
[0022] Preferably, each of the RJ45 input interfaces is connected to a data acquisition device via a network cable, and each of the RJ45 output interfaces is connected to a data receiving device via a network cable. Both the RJ45 input and output interfaces use network cable connectors with +5V, GND, RS485-A, and RS485-B functional points. The +5V functional point is used by the main control unit to detect whether a device is connected.
[0023] Preferably, the data acquisition device is one or more of the inverter, controller, and battery of the photovoltaic energy storage system, and the data receiving device is one or more of the communication module and display module.
[0024] To achieve the above-mentioned technical objectives, the present invention also proposes a multi-device data transmission method, implemented through the aforementioned multi-device data transmission system, which includes the following steps:
[0025] Device connection identification: The main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface. If the identification result is no, it returns and saves the connection identification result that no device is connected to the RJ45 input interface. If the identification result is yes, it proceeds to the next step.
[0026] Automatic device address allocation: The main control unit obtains the connection identification result and determines whether the currently accessed device is a newly accessed data acquisition device. If not, the task ends and the connection identification result is saved. If so, after waiting for other currently executing tasks to finish, the main control unit controls the corresponding channel in the first channel switch to be turned on via the first channel control bus. The data acquisition device communicates with the first RS485 bus and the main control unit through the RJ45 input interface and the first channel switch. Then, the main control unit sends a device address configuration command to the data acquisition device via the first RS485 bus using a unified communication protocol. The data acquisition device returns a device address configuration response command to the main control unit. The configuration is completed, and the main control unit saves the address configuration result and the connection identification result. This step is repeated until all identified and accessed data acquisition devices have been assigned addresses.
[0027] Acquiring Device Data: The main control unit acquires the address configuration result and connection identification result. After waiting for other currently executing tasks to finish, the main control unit first controls the corresponding channel in the first channel switch to be turned on through the first channel control bus, so that the data acquisition device with the first address in the order of address is connected to the first RS485 bus. The main control unit uses a unified communication protocol to send a read command to the data acquisition device through the first RS485 bus. The data acquisition device returns a read response command containing device data to the main control unit. The main control unit saves the device data in the response command until all identified and connected data acquisition devices have completed one round of data reading in address order, and then continues to send the next read command; this step is repeated to continuously poll and read data from the connected data acquisition devices.
[0028] Equipment data integration: The main control unit integrates the read data according to preset rules to obtain a dataset;
[0029] Data integration and transmission: The main control unit uses a unified communication protocol to perform master-slave command interaction with the connected data receiving device, so as to send the integrated dataset to the data receiving device via the second RS485 bus according to preset rules.
[0030] Preferably, the main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface by: the main control unit detects whether all RJ45 input interfaces have a +5V signal. If no +5V signal is detected, it indicates that no device is connected to the RJ45 input interface or the device is disconnected; if a +5V signal is detected, it indicates that a device is connected to the RJ45 input interface.
[0031] Preferably, the unified communication protocol is a custom content protocol based on Modbus. This communication protocol includes a host-send command format and a slave-response command format. The host-send command format includes a device address configuration command format and a read command format. The device address configuration command format includes a special address code, a function code, a starting address, device address configuration, and a CRC checksum. The read command format includes a device address code, a function code, a starting address, a number of read addresses, and a CRC checksum. The slave-response command format includes a device address configuration response command format and a read response command format. The device address configuration response command format includes a special address code, a function code, a device address, and a CRC checksum. The read response command format includes a device address code, a function code, a data length, the data read, and a CRC checksum.
[0032] Preferably, during the automatic device address allocation process, after the main control unit sends a device address configuration command to the data acquisition device via the first RS485 bus using a unified communication protocol, if the data acquisition device does not return a device address configuration response command to the main control unit, the main control unit sends a device address configuration command to the data acquisition device a second time. If the data acquisition device still does not return a device address configuration response command to the main control unit after receiving the address configuration command a second time, the configuration fails and the main control unit saves the address configuration result and connection identification result. If the data acquisition device returns a device address configuration response command to the main control unit after receiving the address configuration command a second time, the configuration is complete and the main control unit saves the address configuration result and connection identification result.
[0033] Preferably, during the process of acquiring device data, after the main control unit issues a read command to the data acquisition device via the first RS485 bus using a unified communication protocol, if the data acquisition device does not return a read response command to the main control unit, the main control unit sends a read command to the data acquisition device a second time. If the data acquisition device still does not return a read response command to the main control unit after receiving the second read command, the data is invalid and the main control unit continues to send the next read command. If the data acquisition device returns a read response command to the main control unit after receiving the second read command, the main control unit saves the data and then continues to send the next read command.
[0034] Preferably, if a newly connected data acquisition device is detected during the acquisition of device data, the current acquisition of device data task continues, and after the data acquisition device with the last address in the address sorting completes data reading, an address is assigned to the new data acquisition device, and then the next acquisition of device data task is executed according to the new address sorting.
[0035] Preferably, the device data integration process specifically involves: classifying the acquired device data according to the meaning of the command references, and organizing the data read by commands with the same meaning together to form a dataset;
[0036] The data integration and transmission process is as follows: the connected data receiving device sends a read command to the main control unit through the second RS485 bus, and the main control unit sends a data group to the data receiving device through the second RS485 bus. The number of the data group is consistent with the number of the RJ45 input interfaces.
[0037] By adopting the above solution, the present invention has the following beneficial effects:
[0038] I. The multi-device data transmission system of the present invention connects multiple devices to their respective RJ45 input interfaces and uses a main control unit to control the on / off state of the first channel switch, ensuring that only one data acquisition device can communicate via the first RS485 bus at a time, thus avoiding impedance matching problems.
[0039] Second, this invention utilizes the first channel control bus to directly detect and identify devices connected to the RJ45 input interface, realizing the device connection identification function. It also utilizes the first RS485 bus to perform master-slave command interaction with the connected devices, establishes a unified communication protocol, realizes automatic address allocation and data polling reading of devices, and avoids bus contention issues.
[0040] Third, the present invention also integrates the read data according to the corresponding rules and packages it into data groups for transmission. The transmitted data also adopts a unified communication protocol, which greatly improves the data transmission efficiency.
[0041] IV. The multi-device transmission system of the present invention is used for data transmission of photovoltaic energy storage system equipment, and can also be used in various types of multi-device systems such as power supply system, water supply system, climate monitoring system, and smart building system, with wide applications.
[0042] In summary, this invention integrates five major functions: device connection identification, automatic device address allocation, device data acquisition, device data integration, and integrated data transmission. It not only solves the problems of impedance matching, high difficulty of manual operation, and bus contention in existing transmission methods, but also significantly improves data reading and transmission efficiency. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other modifications can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a block diagram of a multi-device data transmission system according to an embodiment of the present invention;
[0045] Figure 2 This is a diagram of the main control unit architecture of the present invention.
[0046] Figure 3 This is a flowchart of a multi-device data transmission method according to an embodiment of the present invention;
[0047] Figure 4 This is a flowchart of the device connection identification steps in an embodiment of the present invention;
[0048] Figure 5 This is a flowchart illustrating the automatic device address allocation steps in an embodiment of the present invention.
[0049] Figure 6 This is a flowchart illustrating the steps for acquiring device data according to an embodiment of the present invention.
[0050] Figure 7 This is a flowchart of the device data integration steps in an embodiment of the present invention;
[0051] Figure 8 A flowchart illustrating the steps for integrating data in this embodiment of the invention;
[0052] Label Explanation
[0053] Main control unit 1, device connection identification module 1a, device address automatic allocation module 1b, device data acquisition module 1c, device data integration module 1d, integrated data sending module 1e, storage module 1f;
[0054] 2. First channel switch; 3. RJ45 input interface; 4. Data acquisition device; 5. First RS485 bus; 6. First channel control bus; 7. Second RS485 bus; 8. Third RS485 bus; 9. RJ45 output interface; 10. Data receiving device; 11. Network cable. Detailed Implementation
[0055] The technical solutions of the embodiments of the present invention will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] The “data acquisition equipment” described below can be any device that outputs its own inherent or acquired data. For example, it can be an inverter, controller, or battery of a photovoltaic energy storage system, or a system with multiple devices such as a water supply system, climate monitoring system, or smart building system, or other multi-device systems that can output data. The characteristic of this type of equipment is that it has a data interface and can be used for communication.
[0057] like Figure 1 As shown in the figure, an embodiment of the present invention discloses a multi-device data transmission system, comprising:
[0058] Main control unit 1;
[0059] A first channel switch 2 has its input terminal connected to multiple RJ45 input interfaces 3, each RJ45 input interface 3 used to connect to a data acquisition device 4. The output terminal of the first channel switch 2 is connected to the main control unit 1 via a first RS485 bus 5. The main control unit 1 is also connected to the first channel switch 2 via a first channel control bus 6 to control the on / off state of the first channel switch 2, so that only one data acquisition device 4 can be connected to the first RS485 bus 5 and the main control unit 1 at any given time. The main control unit 1 is used to detect and identify whether a data acquisition device 4 is connected to the RJ45 input interface 3. The main control unit 1 is also used to perform master-slave command interaction with the identified data acquisition device 4 via the first RS485 bus 5 using a unified communication protocol, so as to automatically assign an address to the data acquisition device 4 and read data from the data acquisition device 4 with the assigned address. The main control unit 1 is also used to integrate the read data according to preset rules to obtain a dataset.
[0060] At least one RJ45 output interface 9 is provided. The RJ45 output interface 9 is used to connect to the data receiving device 10. After the data receiving device 10 is connected to the RJ45 output interface 9, it is connected to the main control unit 1 via the second RS485 bus 7. The main control unit 1 is also used to perform master-slave command interaction with the connected data receiving device 10 using a unified communication protocol, so as to send the integrated dataset to the data receiving device 10 via the second RS485 bus 7 according to preset rules.
[0061] Please refer to the appendix. Figure 2 As shown, the main control unit 1 in this embodiment specifically includes:
[0062] The device connection identification module 1a is used to detect and identify whether a data acquisition device 4 is connected to the RJ45 input interface 3;
[0063] The device address automatic allocation module 1b is used to perform master-slave command interaction with the identified data acquisition device 4 via the first RS485 bus 5 using a unified communication protocol, so as to automatically allocate an address to the data acquisition device 4.
[0064] The device data acquisition module 1c is used to perform master-slave command interaction with the identified data acquisition device 4 via the first RS485 bus 5 using a unified communication protocol, so as to read data from the data acquisition device 4 with the assigned address.
[0065] Equipment data integration module 1d; it is used to integrate the read data according to preset rules to obtain a dataset;
[0066] The integrated data transmission module 1e is used to perform master-slave command interaction with the connected data receiving device 10 using a unified communication protocol, so as to send the integrated dataset to the data receiving device 10 via the second RS485 bus 7 according to preset rules; and
[0067] The storage module 1f is used to store the data, master-slave interaction commands, and integrated datasets obtained by the interaction between the master control unit 1 and the data acquisition device 4 and the data receiving device.
[0068] In the embodiments of this application, the first channel switch 2 adopts a switching circuit and has multiple channels. The main control unit 1 controls the conduction / disconnection of each channel in the first channel switch 2 through the first channel control bus 6.
[0069] In this embodiment, preferably, the multi-device data transmission system further includes a third RS485 bus 8 connected to the RJ45 output interface 9. After the data receiving device 10 is connected to the RJ45 output interface 9, it communicates with the main control unit 1 via the third RS485 bus 8. The main control unit 1 is also used to perform master-slave command interaction with the connected data receiving device 10 using a unified communication protocol, so as to send the integrated dataset to the data receiving device 10 via the third RS485 bus 8 according to preset rules. This solution facilitates users in not having to distinguish whether the RJ45 output interface 9 is a communication module interface or a display module interface when wiring, avoiding the situation where incorrect wiring will render the device unusable. At the same time, it separates the communication module and the display module from the main control unit 1, making the data acquisition of the communication module and the display module more flexible.
[0070] As a further preferred embodiment, each of the RJ45 input interfaces 3 is connected to a data acquisition device 4 via a network cable 11, and each of the RJ45 output interfaces 9 is connected to a data receiving device 10 via a network cable 11. Both the RJ45 input interfaces 3 and RJ45 output interfaces 9 can use a universal RS485 interface, such as a network cable connector, which has a unified interface type and a unified functional contact sequence. The difference lies in its use for data input and data output. This network cable connector has functional points +5V, GND, RS485-A, and RS485-B. The +5V functional point is used by the main control unit 1 to detect whether a device is connected. See Table 1 below for the functional point sequence of the network cable connector.
[0071]
[0072] Table 1 RJ45 Interface Functional Contact Sequence
[0073] In a further preferred embodiment, the data acquisition device 4 is one or more of an inverter, controller, and battery in a photovoltaic energy storage system, and the data receiving device 10 is one or more of a communication module and a display module. The communication module can be a Bluetooth module, a WiFi module, and / or a 4G module, and the display module can be a touch screen or other display screen capable of displaying data.
[0074] The multi-device data transmission system of this invention has the following advantages compared with traditional data communication technologies:
[0075] I. The multi-device data transmission system of the present invention connects multiple devices to their respective RJ45 input interfaces and uses the main control unit 1 to control the on / off state of the first channel switch 2, ensuring that only one data acquisition device can communicate and interact through the first RS485 bus 5 at a time, thus avoiding impedance matching problems.
[0076] Second, this invention utilizes the first channel control bus 6 to directly detect and identify the data acquisition device 4 connected to the RJ45 input interface 3, realizing the device connection identification function. Furthermore, it utilizes the first RS485 bus 5 to perform master-slave command interaction with the connected data acquisition device 4, establishes a unified communication protocol, realizes automatic address allocation and data polling reading of the device, and avoids bus contention issues.
[0077] Third, the present invention also integrates the read data according to the corresponding rules and packages it into data groups for transmission. The transmitted data also adopts a unified communication protocol, which greatly improves the data transmission efficiency.
[0078] This invention also proposes a multi-device data transmission method, implemented through the aforementioned multi-device data transmission system, combined with... Figure 3As shown, the method includes the following steps:
[0079] S1. Device connection identification: The main control unit 1 detects and identifies whether there is a data acquisition device 4 connected to the RJ45 input interface 3. If the identification result is no, the connection identification result that no device is connected to the RJ45 input interface 3 is returned and saved. If the identification result is yes, proceed to the next step.
[0080] Combination Figure 4 As shown, in step S1, the main control unit 1 detects and identifies whether a data acquisition device 4 is connected to the RJ45 input interface 3. Specifically, the main control unit 1 detects whether all RJ45 input interfaces 3 have a +5V signal. If no +5V signal is detected, it means that no device is connected to the RJ45 input interface 3 or the device is disconnected. If a +5V signal is detected, it means that a device is connected to the RJ45 input interface 3.
[0081] S2, Automatic Device Address Assignment: Combined with Figure 5 As shown, the main control unit 1 obtains the connection identification result and determines whether the currently accessed device is the newly accessed data acquisition device 4. If not, the task ends and the connection identification result is saved. If so, after waiting for other currently executing tasks to finish, the main control unit 1 controls the corresponding channel in the first channel switch 2 to be turned on through the first channel control bus 6. The data acquisition device 4 is connected to the first RS485 bus 5 and the main control unit 1 through the RJ45 input interface 3 and the first channel switch 2. Then, the main control unit 1 sends a device address configuration command to the data acquisition device 4 through the first RS485 bus 5 using a unified communication protocol. After receiving the address configuration command, the data acquisition device 4 returns a device address configuration response command to the main control unit 1. The configuration is completed and the main control unit 1 saves the address configuration result and the connection identification result. This step is repeated until all identified and accessed data acquisition devices 4 have been assigned addresses.
[0082] During the automatic device address allocation process described above, after the main control unit 1 sends a device address configuration command to the data acquisition device 4 via the first RS485 bus 5 using a unified communication protocol, if the data acquisition device 4 does not return a device address configuration response command to the main control unit, the main control unit 1 sends a second device address configuration command to the data acquisition device 4. If the data acquisition device 4 still does not return a device address configuration response command after receiving the second address configuration command, the configuration fails, and the main control unit 1 saves the address configuration result and connection identification result. If the data acquisition device 4 returns a device address configuration response command to the main control unit 1 after receiving the second address configuration command, the configuration is complete, and the main control unit 1 saves the address configuration result and connection identification result. If the data acquisition device 4 still fails to respond after sending the second address configuration command, it indicates that there is a problem with the device or it is not properly connected. Taking a setup with eight RJ45 input interfaces 3 as an example, the device address allocation principle is as follows: the first RJ45 input interface 3 is always assigned address "01", the second RJ45 input interface 3 is always assigned address "02", the third RJ45 input interface 3 is always assigned address "03", and so on, until the eighth RJ45 input interface 3 is always assigned address "08". Taking the first RJ45 input interface 3 as an example, regardless of the device address of the device connected to the first RJ45 input interface 3, it will always be changed to address "01".
[0083] S3. Obtain device data: Combined with Figure 6 As shown, the main control unit 1 obtains the address configuration result and connection identification result. After waiting for other currently executing tasks to finish, the main control unit 1 first controls the corresponding channel in the first channel switch 2 to be turned on through the first channel control bus 6, so that the data acquisition device 4 with the first address sequence can be connected to the first RS485 bus. The main control unit 1 uses a unified communication protocol to send a read command to the data acquisition device 4 through the first RS485 bus 5. After receiving the read command, the data acquisition device 4 returns a read response command containing device data to the main control unit 1. The main control unit 1 saves the device data in the response command until all the identified and connected data acquisition devices 4 have completed one round of data reading in address order, and then continues to send the next read command; this step is repeated to continuously poll and read data from the connected data acquisition devices 4.
[0084] During the above-mentioned process of acquiring device data, after the main control unit 1 issues a read command to the data acquisition device 4 via the first RS485 bus 5 using a unified communication protocol, if the data acquisition device 4 does not return a read response command to the main control unit 1, the main control unit 1 sends a read command to the data acquisition device 4 a second time. If the data acquisition device 4 still does not return a read response command to the main control unit 1 after receiving the read command a second time, the data is invalid and the main control unit 1 continues to send the next read command. If the data acquisition device 4 returns a read response command to the main control unit 1 after receiving the read command a second time, the main control unit 1 saves the data and then continues to send the next read command.
[0085] If a newly connected data acquisition device 4 is detected during the process of acquiring device data, the current task of acquiring device data continues. After the data acquisition device 4, which is last in the address sort, finishes reading the data, an address is assigned to the new data acquisition device 4, and then the next task of acquiring device data is executed according to the new address sort.
[0086] S4. Equipment Data Integration: The main control unit 1 integrates the read data according to preset rules to obtain a dataset; combined with... Figure 7 As shown, the device data integration process is as follows: The main control unit 1 classifies the acquired device data according to the meaning of the command, and organizes the data read by commands with the same meaning together to form a dataset. Through the above process of acquiring device data, multiple device data are obtained. Based on the logic that a command needs to read all connected devices before switching to the next command, the acquired data can be easily classified according to the command. For example, if 8 devices are connected, the read response commands collected by read command 1 from the 8 devices are classified into one category, and so on for other read commands.
[0087] S5, Data Integration and Issuance: Combining Figure 8As shown, the master control unit 1 uses a unified communication protocol to interact with the connected data receiving device 10 via master-slave commands, so as to send the integrated dataset to the data receiving device 10 via the second RS485 bus 7 according to preset rules. The specific data integration and transmission process in this step is as follows: the connected data receiving device 10 sends a read command to the master control unit 1 via the second RS485 bus 7, and the master control unit 1 sends a data group to the data receiving device 10 via the second RS485 bus 7. The number of data groups is consistent with the number of RJ45 input interfaces 3. Taking the current practical application as an example, 8 device interfaces are set in the current practical application, so the maximum number of connected devices allowed by the hardware is 8. This means that each data transmission consists of 8 data groups, fixed at 8 groups. The group number of the data depends on which device port the device is connected to. For example, if a device is connected to RJ45 input interface 3, then the 3rd data group corresponds to the data from device port 3. If a device is connected, the corresponding data group returns data; if no device is connected, the corresponding data group returns N "00"s. The size of N depends on the command content, because different command contents return different data lengths. As mentioned above, the main control unit 1 uses a unified communication protocol to perform master-slave command interaction with the connected data receiving device 10, so as to send the integrated dataset to the data receiving device 10 via the third RS485 bus 8 according to the preset rules. This process is consistent with the data transmission method and communication protocol used via the second RS485 bus 7. Its advantage is that it can send data to different types of data receiving devices 10 through the second RS485 bus 7 and the third RS485 bus 8 respectively, and the data receiving device 10 can be randomly connected to various structures without distinction, such as communication modules, display modules, etc.
[0088] The following example illustrates the data integration process:
[0089] For example, consider 8 RJ45 input interfaces 3. Assume a read command is 1, and the read response command length for read command 1 is 7 (N=7). Assume all 8 RJ45 input interfaces 3 are connected to devices and have been assigned addresses. Let's designate the data acquisition device 4 connected to the first RJ45 input interface 3 as Device 1, the data acquisition device 4 connected to the second RJ45 input interface 3 as Device 2, and so on. When data receiving device 10 sends read command 1, the main control unit 1 will return 8 sets of data to data receiving device 10 at once: "Read response command for device 1 read command 1", "Read response command for device 2 read command 1", "Read response command for device 3 read command 1", "Read response command for device 4 read command 1", "Read response command for device 5 read command 1", "Read response command for device 6 read command 1", "Read response command for device 7 read command 1", and "Read response command for device 8 read command 1". Other read commands will also return data in this format.
[0090] If at this time only 6 RJ45 input interfaces 3 are connected to the device and have been assigned addresses, and the second RJ45 input interface 3 has no device, and the sixth RJ45 input interface 3 has no device, then when the data receiving device 10 sends read command 1 to the main control unit 1, the main control unit 1 will return the following 8 sets of data to the data receiving device 10: "Read response command for device 1 read command 1", "00 00 00 00 0000 00" (N=7), "Read response command for device 3 read command 1", "Read response command for device 4 read command 1", "Read response command for device 5 read command 1", "00 00 00 00 00 00 00" (N=7), "Read response command for device 7 read command 1", and "Read response command for device 8 read command 1".
[0091] Specifically, the unified communication protocol described in this embodiment is a customized content protocol based on Modbus. This communication protocol includes a host-send command format and a slave-response command format. The host-send command format includes a device address configuration command format and a read command format, as shown in Table 2 below. The device address configuration command format includes a special address code, a function code, a starting address, device address configuration, and CRC checksum, as shown in Table 4 below. The read command format includes a device address code, a function code, a starting address, a number of read addresses, and CRC checksum. The slave-response command format includes a device address configuration response command format and a read response command format, as shown in Table 3 below. The device address configuration response command format includes a special address code, a function code, a device address, and CRC checksum, as shown in Table 5 below. The read response command format includes a device address code, a function code, a data length, the data read, and CRC checksum.
[0092]
[0093] Table 2 Device Address Configuration Command Format
[0094]
[0095] Table 3 Device Address Configuration Response Command Format
[0096] Device address function code Starting address Number of read addresses CRC check 1 byte 1 byte 2 bytes 2 bytes 2 bytes
[0097] Table 4 Read command format
[0098] Device address function code Data length Read data CRC check 1 byte 1 byte 1 byte Data domain 2 bytes
[0099] Table 5 Read Response Command Format
[0100] In the description of this specification, references to terms such as "an embodiment," "some embodiments," "example," "specific example," or "optional embodiment," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0101] The embodiments described above do not constitute a limitation on the scope of protection of this technical solution. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the above embodiments should be included within the scope of protection of this technical solution.
Claims
1. A multi-device data transmission system, characterized in that... include: Main control unit; A first-channel switch has its input terminals connected to multiple RJ45 input interfaces, each of which is used to connect to a data acquisition device. The output terminal of the first-channel switch is connected to the main control unit via a first RS485 bus. The main control unit is also connected to the first-channel switch via a first-channel control bus to control the switch's on / off state, ensuring that only one data acquisition device can communicate with the first RS485 bus and the main control unit at any given time. The main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface. It also uses a unified communication protocol to perform master-slave command interaction with the identified data acquisition device via the first RS485 bus, automatically assigning an address to the data acquisition device and reading data from the assigned address. Finally, the main control unit integrates the read data according to preset rules to obtain a dataset. At least one RJ45 output interface is provided. The RJ45 output interface is used to connect to a data receiving device. After the data receiving device is connected to the RJ45 output interface, it communicates with the main control unit through a second RS485 bus. The main control unit is also used to perform master-slave command interaction with the connected data receiving device using a unified communication protocol, so as to send the integrated dataset to the data receiving device through the second RS485 bus according to preset rules. The main control unit includes: The device connection identification module is used to detect and identify whether a data acquisition device is connected to the RJ45 input interface; The device address automatic allocation module is used to communicate with the identified data acquisition device via the first RS485 bus using a unified communication protocol to automatically allocate an address to the data acquisition device. The device data acquisition module is used to perform master-slave command interaction with the identified data acquisition device via the first RS485 bus using a unified communication protocol, so as to read data from the data acquisition device with the assigned address. The device data integration module is used to integrate the read data according to preset rules to obtain a dataset. An integrated data transmission module is used to interact with a connected data receiving device using a unified communication protocol, transmitting the integrated dataset to the data receiving device via a second RS485 bus according to preset rules; and The storage module is used to store the data obtained by the master control unit through interaction with the data acquisition device and the data receiving device, master-slave interaction commands, and the integrated dataset.
2. The multi-device data transmission system as described in claim 1, characterized in that: The first channel switch uses a switching circuit and has multiple channels. The main control unit controls the on / off state of each channel in the first channel switch through the first channel control bus.
3. The multi-device data transmission system as described in claim 1, characterized in that, The system also includes a third RS485 bus connected to the RJ45 output interface. After the data receiving device is connected to the RJ45 output interface, it communicates with the main control unit through the third RS485 bus. The main control unit is also used to perform master-slave command interaction with the connected data receiving device using a unified communication protocol, so as to send the integrated dataset to the data receiving device through the third RS485 bus according to preset rules.
4. The multi-device data transmission system as described in claim 1, characterized in that, Each of the RJ45 input interfaces is connected to a data acquisition device via a network cable, and each of the RJ45 output interfaces is connected to a data receiving device via a network cable. Both the RJ45 input and output interfaces use network cable connectors. These connectors have function points +5V, GND, RS485-A, and RS485-B. The +5V function point is used by the main control unit to detect whether a device is connected.
5. A method for transmitting data between multiple devices, implemented using a multi-device data transmission system according to any one of claims 1-4, the method comprising the following steps: Device connection identification: The main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface. If the identification result is no, it returns and saves the connection identification result that no device is connected to the RJ45 input interface. If the identification result is yes, it proceeds to the next step. Automatic device address allocation: The main control unit obtains the connection identification result and determines whether the currently accessed device is a newly accessed data acquisition device. If not, the task ends and the connection identification result is saved. If so, after waiting for other currently executing tasks to finish, the main control unit controls the corresponding channel in the first channel switch to be turned on via the first channel control bus. The data acquisition device communicates with the first RS485 bus and the main control unit through the RJ45 input interface and the first channel switch. Then, the main control unit sends a device address configuration command to the data acquisition device via the first RS485 bus using a unified communication protocol. The data acquisition device returns a device address configuration response command to the main control unit. The configuration is completed, and the main control unit saves the address configuration result and the connection identification result. This step is repeated until all identified and accessed data acquisition devices have been assigned addresses. Acquiring Device Data: The main control unit acquires the address configuration result and connection identification result. After waiting for other currently executing tasks to finish, the main control unit first controls the corresponding channel in the first channel switch to be turned on through the first channel control bus, so that the data acquisition device with the first address in the order of address can be connected to the first RS485 bus. The main control unit uses a unified communication protocol to send a read command to the data acquisition device through the first RS485 bus. The data acquisition device returns a read response command containing device data to the main control unit. The main control unit saves the device data in the response command until all the identified and connected data acquisition devices have completed one round of data reading in address order, and then continues to send the next read command. Repeat this step to continuously poll and read data from the connected data acquisition device; Equipment data integration: The main control unit integrates the read data according to preset rules to obtain a dataset; Data integration and transmission: The main control unit uses a unified communication protocol to perform master-slave command interaction with the connected data receiving device, so as to send the integrated dataset to the data receiving device via the second RS485 bus according to preset rules.
6. The multi-device data transmission method as described in claim 5, characterized in that, The main control unit detects and identifies whether a data acquisition device is connected to the RJ45 input interface in the following ways: the main control unit detects whether there is a +5V signal on all RJ45 input interfaces. If no +5V signal is detected, it means that no device is connected to the RJ45 input interface or the device is disconnected; if a +5V signal is detected, it means that a device is connected to the RJ45 input interface.
7. A multi-device data transmission method as described in claim 5, characterized in that, The unified communication protocol is a customized content protocol based on Modbus. This communication protocol includes a host-send command format and a slave-response command format. The host-send command format includes a device address configuration command format and a read command format. The device address configuration command format includes a special address code, a function code, a starting address, device address configuration, and a CRC check. The read command format includes a device address code, a function code, a starting address, a number of read addresses, and a CRC check. The slave-response command format includes a device address configuration response command format and a read response command format. The device address configuration response command format includes a special address code, a function code, a device address, and a CRC check. The read response command format includes a device address code, a function code, a data length, the data read, and a CRC check.
8. The multi-device data transmission method as described in claim 5, characterized in that: During the automatic device address allocation process, after the main control unit sends a device address configuration command to the data acquisition device via the first RS485 bus using a unified communication protocol, if the data acquisition device does not return a device address configuration response command to the main control unit, the main control unit sends a device address configuration command to the data acquisition device a second time. If the data acquisition device still does not return a device address configuration response command to the main control unit after receiving the address configuration command a second time, the configuration fails and the main control unit saves the address configuration result and connection identification result. If the data acquisition device returns a device address configuration response command to the main control unit after receiving the address configuration command a second time, the configuration is complete and the main control unit saves the address configuration result and connection identification result. During the acquisition of device data, after the main control unit issues a read command to the data acquisition device via the first RS485 bus using a unified communication protocol, if the data acquisition device does not return a read response command to the main control unit, the main control unit sends a read command to the data acquisition device a second time. If the data acquisition device still does not return a read response command to the main control unit after receiving the second read command, the data is invalid and the main control unit continues to send the next read command. If the data acquisition device returns a read response command to the main control unit after receiving the second read command, the main control unit saves the data and then continues to send the next read command.
9. A multi-device data transmission method as described in claim 5, characterized in that, If a newly connected data acquisition device is detected during the acquisition of device data, the current acquisition of device data task continues. After the data acquisition device with the last address in the address sorting completes the data reading, the new data acquisition device is assigned an address, and then the next acquisition of device data task is executed according to the new address sorting. The specific process for integrating device data is as follows: the acquired device data is classified according to the meaning of the command, and the data read by commands with the same meaning are organized together to form a dataset. The data integration and transmission process is as follows: the connected data receiving device sends a read command to the main control unit through the second RS485 bus, and the main control unit sends a data group to the data receiving device through the second RS485 bus. The number of the data group is consistent with the number of the RJ45 input interfaces.
Citation Information
Patent Citations
Dual-interface radar data recorder
CN101839974A
CIB-BUS bus-based four-way analog output device
CN105938342A