RS485 bus-based acquisition instrument dual-unit hot backup and active-standby competition switching method

By using dual-machine hot backup and main-stop competition switching technology in the RS485 bus system, software switches and heartbeat message frames are used to solve the system paralysis problem caused by collector failure, and business continuity and reliability throughout the life cycle are achieved. Avoid additional hardware and cost increase.

CN119011328APending Publication Date: 2024-11-22SHANGHAI JING HAI ENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411289015.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The existing RS485 bus system lacks a dual-machine hot standby mechanism, which causes the system to be paralyzed when the collector fails. The existing dual-main hot standby method requires additional equipment, increase costs and introduces fault points. The competition between main and backup may lead to ping-pong switching, which affects the impact of Business continuity.

Method used

The dual-machine hot backup technology is adopted to realize the main and standby switching through RS485 connection. The host and standby monitor and switch on the bus. The software switches prepared for the main and standby competition and the host heartbeat message frame ensure real-time switching to avoid main robbery events. Achieve business continuity and reliability throughout the life cycle.

Benefits of technology

Without adding additional hardware, the dual-machine hot standby and main standby competition switching of the RS485 bus system is realized, ensuring the real-time and reliability of the service, avoiding the main and backup ping-pong switching and bus conflicts, and improving the overall system Business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119011328A_ABST
    Figure CN119011328A_ABST
Patent Text Reader

Abstract

The invention relates to an RS485 bus-based acquisition instrument dual-machine hot backup and active / standby competition switching method, which comprises the following steps that: when acquisition instruments are powered on or reset and started for the first time, acquisition instruments with even number equipment serial numbers immediately participate in active / standby competition, and acquisition instruments with odd number equipment serial numbers are delayed for a period of time and then participate in active / standby competition. In the normal operation process, when self-inspection of the acquisition instrument host is normal, host heartbeat message frames are sent to the RS485 bus at certain time intervals, and when a fault occurs, sending of the host heartbeat message frames is stopped, and the host is reduced to be in a standby state. The acquisition instrument standby machine monitors the working state of the acquisition instrument standby machine in real time, and when a master rising condition is met, the acquisition instrument standby machine monitors a message frame from a host to heartbeat through an RS485 bus, and at the moment, the standby state is kept, the occurrence of a master robbing event is avoided, and master and standby ping-pong switching is prevented. And if the standby machine with the master raising condition does not monitor that the host heartbeat message frame exists on the bus within the heartbeat timeout time, the host is judged to work abnormally, and at the moment, the standby machine raises the master to take over service processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of communication, and in particular to a method for dual-machine hot standby and master-standby competitive switching of an automatic data acquisition instrument based on an RS485 bus. Background Art

[0002] With the rapid growth of the big data industry, data operations in various industries are becoming increasingly complex. As the starting link and key communication equipment in big data services, data acquisition instruments collect, calculate, store and send data in actual scenarios. The stability and high reliability of the acquisition system need to be fully guaranteed to ensure the quality of the data source.

[0003] RS485 bus is a low-cost half-duplex serial communication bus with advantages such as high sensitivity, long-distance transmission and multi-node support. In the field of industrial automation, RS485 bus is widely used for communication between various devices. In the RS485 network, only one station can send data at the same time, and other stations are in the receiving state to avoid RS485 bus competition risk.

[0004] For data collectors based on RS485 bus, the system transmission topology is usually one master with multiple slaves, that is, one host controls multiple slaves, using master / slave communication mode, and the slaves do not actively send data. Each communication is initiated by the host, and there will be no 485 bus competition risk. See the system topology for details. Figure 1 .

[0005] In the process of studying and practicing the prior art, the inventors found that the prior art had the following problems: 1. The data collector in the RS485 bus system is the most critical node of the entire system. Since there is only one RS485 bus connecting the devices in the entire system, there is no physical signal connection between the devices, such as the master / slave indication signal, master / slave status, and master / slave enable, so there is no perfect dual-host hot standby mechanism based on the RS485 bus. The entire system often has only one data collector working. If this data collector fails, the services of all devices on the bus will be paralyzed. 2. The dual-host hot standby method based on RS485 bus should not only meet the master-slave competition when the data collector equipment is powered on for the first time, but also meet the requirements of the real-time hot standby and master-slave switching of the master and standby data collectors during the operation of the system, so as to greatly improve the business continuity and reliability of the entire system in the complete life cycle; 3. A dual-host system based on RS485 network often requires the addition of additional network element devices, such as a bus controller, to intervene to avoid competition risks on the bus, resulting in higher system costs, networking costs, and the introduction of new system failure points.

[0006] 4. When a host fails and a master-slave switch occurs, after the failed device is restarted, the failed device can still compete for the master status through master-slave competition, resulting in master-slave ping-pong switching, which hinders the normal operation of the communication system. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a method for hot backup of dual machines of a data collector and competitive switching of the main and standby machines based on RS485 bus.

[0008] In order to solve the above technical problems, the present invention is achieved through the following technical solutions: On one hand, the present invention provides a method for hot standby and active / standby competitive switching based on RS485 data collector, including: The data collector uses dual-machine hot backup technology to improve the reliability of the system. The main collector, as the core of the collection service, communicates with subordinate devices to complete data collection. The backup collector, as the backup of the main collector, does not communicate with subordinate devices. When the main collector fails, the system automatically switches the service to the backup collector, which takes over the work of the main collector to ensure the normal operation of the service. In this way, the impact on the system service can be minimized.

[0009] The dual-machine hot standby technical solution for data acquisition instruments based on RS485 bus is constructed in such a way that the host and standby machines of the data acquisition instrument are connected via RS485, and connected to the entire RS485 data bus together with many subordinate devices. Under normal circumstances, the host machine is in working state, and communicates commands and data with many subordinate devices via RS485 bus, while the standby machine is in monitoring state. Once the standby machine finds that the host machine is abnormal, it will replace the host machine in a very short time and fully realize the functions of the host machine.

[0010] When the main unit of the data collector is downgraded to standby, after the performance is restored or the fault is resolved through post-fault processing means or mechanisms, the conditions for upgrading to master are met again, and the standby state is maintained, and the current host state is monitored. When the current host is abnormal, the master switch is implemented. In this way, the master grabbing event is avoided and the master-standby ping-pong switch is prevented.

[0011] The dual-machine hot standby technical solution for data acquisition instruments based on RS485 bus includes two scenarios: the implementation process of the master-slave competition when the data acquisition instrument equipment is powered on for the first time; and how the master and standby data acquisition instruments can achieve real-time hot standby and master-standby switching throughout the entire life cycle during system operation.

[0012] The first master-slave arbitration of the data logger after power-on or reset: When the data logger is powered on, the initial state is the standby state by default. After the device passes the self-test, set the master-slave competition ready switch to the on state.

[0013] Whether the device participating in the active / standby competition has the active / standby competition conditions is realized by setting a software switch prepared for the active / standby competition. Usually, the software switch is closed by default, and is turned on when the device passes the self-test.

[0014] When the device is powered on for the first time or reset, when the primary and backup devices pass the self-test and are both qualified for competition, the primary and backup competition readiness switch is turned on. According to the parity rule of the data acquisition instrument device serial number, the data acquisition instrument with odd device serial number immediately participates in the primary and backup competition, and the data acquisition instrument with even device serial number participates in the primary and backup competition after a delay.

[0015] In this step, the data collector software can read the unique factory serial number of the device to obtain the parity feature of the device serial number.

[0016] Here, with the help of the above-mentioned setting of delaying for a period of time, the collector with an odd-numbered device serial number takes priority in participating in the competition for the primary and backup positions, and competes to become the primary collector; while the collector with an even-numbered device serial number participates in the competition for the primary and backup positions after a delay. At this time, the collector with an odd-numbered device serial number has already competed for the primary status, and the collector with an even-numbered device serial number sets itself to the backup status.

[0017] During the normal operation of the equipment, the main and standby data collectors implement real-time hot backup and switching solutions throughout the entire life cycle as follows: In addition to communicating commands and data with many subordinate devices through the RS485 bus, the host of the data collector also opens performance statistics, business monitoring and fault management, and monitors its own working status in real time. When the working status is normal, it sends the host heartbeat message frame to the RS485 bus at a certain time interval. When a fault occurs or the performance is reduced, the software switch prepared for the master-slave competition is turned off, and the master-slave competition enabling switch is turned off. At this time, the host is reduced to the standby state and stops sending the host heartbeat message frame.

[0018] The master-slave competition enabling switch controls the enabling of competition by adding a controllable software switch in the master-slave competition software module. Usually, the software switch is closed by default. When the switch is turned on to enable the master-slave competition, the master-slave competition starts working and the device participates in the master-slave competition.

[0019] When the mainframe of the data collector is downgraded, the performance is restored or the fault is rectified through the recovery means or mechanism of post-fault processing.

[0020] The backup machine of the data collector monitors its own working status in real time and turns on fault management. When the backup machine of the data collector is in normal self-check status, it is identified as having the conditions for upgrading to the master machine, and the software switch for master-slave competition preparation is turned on.

[0021] The backup machine of the acquisition instrument that is qualified to be promoted to the master monitors the host through the RS485 bus. When it monitors the heartbeat message frame of the host, it confirms that there is a host device on the bus. At this time, it remains in the standby state to avoid the occurrence of master grabbing events and prevent the master-standby ping-pong switch, which affects business continuity. If the backup machine that is qualified to be promoted to the master does not detect the heartbeat message frame of the host on the bus within the timeout period, it determines that the host is working abnormally. At this time, the backup machine is promoted to the master and takes over the business processing.

[0022] Compared with the prior art, the present invention has the following beneficial effects: 1. In the scenario where there is no physical signal connection for dedicated master-slave switching between devices in the RS485 bus system, or no new network element equipment such as bus controller is introduced, and no additional hardware circuit needs to be designed, a reliable dual-host hot standby and master-slave competitive switching method is provided; 2. Use the host heartbeat message frame to monitor whether there is a host on the bus, which can ensure the real-time performance and business continuity of the master-slave switchover; 3. It can not only realize the initial active-standby competition when services are first activated, such as initial power-on and reset, but also complete the active-standby switching in real time throughout the life cycle of the entire system service operation, greatly enhancing service continuity and reliability; 4. It can avoid the occurrence of short-term dual-master or master-standby ping-pong switching, which may cause bus conflicts and lead to frequent interruptions of all device services on the entire bus. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 The figure shows the topology of the single-machine system of the data collector.

[0024] Figure 2 This is the topology diagram of the dual-machine hot standby system of the data collector.

[0025] Figure 3 This is the flow chart of the initial master-slave competition switching method when the data collector is powered on and reset.

[0026] Figure 4 Flowchart of the master-slave competition switching method during the operation of the data collector. DETAILED DESCRIPTION

[0027] The invention provides a method for hot backup of dual machines of a collector based on RS485 bus and competitive switching between the main and standby machines.

[0028] In order to make the technical solution of the present invention more clear, the following embodiments are listed for detailed description: Embodiment 1: Example 1 introduces the implementation process of the master-slave competition when the data collector device is powered on for the first time. Figure 3 , is a flow chart of a method provided in Embodiment 1 of the present invention, comprising: S101: The data logger is powered on or reset.

[0029] S102: Setting the initial state to standby.

[0030] S103: The software performs a self-check on the device.

[0031] S104: After the self-test passes, the device participating in the active / standby competition meets the active / standby competition conditions, and the active / standby competition ready switch is set to the on state. In this step, whether the device participating in the active / standby competition meets the active / standby competition conditions is achieved by setting the active / standby competition ready software switch. Usually, the software switch is closed by default, and the switch is turned on when the device self-test passes.

[0032] S105: In a dual-backup data acquisition system, when the device is powered on for the first time or reset, when the primary and backup devices pass the self-test and are both qualified for competition, according to the parity rule of the data acquisition device serial number, the data acquisition device with an odd device serial number immediately participates in the primary-backup competition, and the data acquisition device with an even device serial number participates in the primary-backup competition after a delay. In this step, the data acquisition device software can read the device's inherent unique factory serial number to obtain the parity feature of the device serial number.

[0033] S106: The dual-backup data acquisition instrument participates in the active-standby competition; in this step, the participation in the active-standby competition is achieved by setting the enable control of the active-standby competition. In this embodiment, the enabling of the competition can be controlled by adding a controllable software switch in the active-standby competition software module. Usually, the software switch is closed by default. When the active-standby competition is enabled by setting the switch to be turned on, the active-standby competition starts to work and the device participates in the active-standby competition.

[0034] After step S104, the software switch for active / standby competition preparation is turned on, and only the devices that have passed the self-test have the conditions for active / standby competition and can participate in the active / standby competition.

[0035] Here, by means of the setting of the delayed first time period in step S105, the collector with an odd-numbered device serial number takes priority in participating in the primary-backup competition and competes to be the primary collector; and the collector with an even-numbered device serial number participates in the primary-backup competition after a delay. At this time, the collector with an odd-numbered device serial number has already competed for the primary status, and the collector with an even-numbered device serial number sets itself to the backup status.

[0036] The above embodiment 1 introduces the implementation process of the master-slave competition when the data collector device is powered on for the first time. During the normal operation of the device, how the master and backup data collectors implement real-time hot backup and switching in the whole life cycle is described in detail through the second and third embodiments.

[0037] Embodiment 2: Embodiment 2 of the present invention is a method flow of the acquisition instrument host, see Figure 4 ,include: S201: In addition to communicating commands and data with numerous subordinate devices through the RS485 bus, the main unit of the data collector monitors its own working status in real time, opens performance statistics, and opens business monitoring and fault management.

[0038] S202: When the host of the data collector is in normal working condition, it sends a host heartbeat message frame to the RS485 bus at a certain time interval. When a fault occurs or the performance is degraded, the software switch prepared for the master-slave competition is turned off, and the master-slave competition enabling switch is turned off.

[0039] In this step, whether the device participating in the active / standby competition has the active / standby competition conditions is realized by setting a software switch prepared for the active / standby competition. Usually, the software switch is closed by default, and is turned on when the device passes the self-test.

[0040] In this step, the participation in the active-standby competition is achieved by setting the active-standby competition enable control. Usually, the software switch is closed by default. When the active-standby competition is enabled by setting the switch to be turned on, the active-standby competition starts to work and the device participates in the active-standby competition.

[0041] S203: The host is reduced to a standby state, at which time the host stops sending heartbeat message frames.

[0042] S204: When the host of the data collector is downgraded, the conditions for upgrading to the main host are met again after the performance is restored or the fault is eliminated through the recovery means or mechanism of post-fault processing.

[0043] At this time, jump to step S301, S302. When the self-test status of the acquisition instrument standby machine is normal, it is identified as having the conditions for upgrading to the master, and the software switch prepared for the master-standby competition is turned on. Then jump to step S303, at this time, monitor the host heartbeat message frame on the bus. If there is a host heartbeat message frame on the bus, keep the standby state to avoid the occurrence of the master grab event, prevent the master-standby ping-pong switch, and affect business continuity. Then implement step S304. If the host heartbeat message frame is not monitored within the timeout period, turn on the master-standby competition enable switch, implement step S305, and the standby machine will be upgraded to the master.

[0044] Embodiment three: Embodiment 3 of the present invention is a method flow of preparing a collection device, see Figure 4 ,include: S301: The data collector standby machine monitors its own working status in real time, opens performance statistics, and opens fault management.

[0045] S302: When the self-check status of the standby machine of the data acquisition instrument is normal, it is identified as having the conditions for becoming the master, and at this time, the software switch for preparing the master-standby competition is turned on.

[0046] S303: The standby machine of the data collector monitors whether there is a host heartbeat message frame on the bus. When a host heartbeat message frame is monitored, it is confirmed that there is a host device on the bus, and the standby state is maintained.

[0047] S304: When no host heartbeat message frame is monitored within the timeout period, it is confirmed that there is no host on the bus or the host is faulty, and the master-slave competition enabling switch is turned on.

[0048] S305: The standby machine is promoted to the main machine. After the standby machine of the data acquisition instrument is promoted to the main machine, it takes over the business processing, and then implements the subsequent processes in a repetitive manner according to the process methods and steps of the main machine of the data acquisition instrument in the second embodiment.

[0049] The above implementation modes are not limitations of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the scope of the technical solution of the present invention also belong to the protection scope of the present invention.

Claims

1. A method for hot standby of dual hosts of a data acquisition instrument based on RS485 bus communication, and active / standby competitive switching, characterized in that: include: The main and backup data acquisition instruments based on RS485 bus communication are connected through the RS485 bus, and connected to the entire RS485 data bus together with many subordinate devices. Among them, the main acquisition instrument is located at the core of the acquisition business, and communicates with the subordinate devices to complete data acquisition; while the backup acquisition instrument, as a backup of the main acquisition instrument, does not communicate with the subordinate devices. The backup acquisition instrument is in a monitoring state. Once the backup acquisition instrument finds that the main acquisition instrument is abnormal, the system automatically switches the main and backup acquisition instruments, switches the business to the backup acquisition instrument, and the backup acquisition instrument takes over the work of the main acquisition instrument to ensure the normal operation of the business.

2. The method according to claim 1, characterized in that It includes two scenarios: the implementation process of the master-slave competition when the data collector equipment is powered on for the first time; and the implementation of real-time hot backup and master-slave switching of the two data collectors during the entire life cycle during system operation.

3. The method according to claim 1, characterized in that The main unit and backup unit of the data logger are connected via the RS485 bus, and are connected to the entire RS485 data bus together with many subordinate devices.

4. The method according to claim 1, characterized in that The main data collector is located at the core of the data collection business, and communicates with subordinate equipment to complete data collection; while the standby data collector serves as a backup for the main data collector and does not communicate with subordinate equipment.

5. The method according to claim 1, characterized in that The standby machine is in monitoring state. Once the standby machine finds that the host machine is abnormal, the system automatically switches between the master and the standby machine, and the standby data collector takes over the work of the master data collector.

6. The method according to claim 2, characterized in that When the device is powered on for the first time or reset, the master and slave devices can participate in the master-slave competition only when they pass the self-test and meet the competition conditions.

7. The method according to claim 6, characterized in that Whether the device participating in the active / standby competition has the active / standby competition conditions is realized by setting a software switch prepared for the active / standby competition. Usually, the software switch is closed by default, and is turned on when the device passes the self-test.

8. The method according to claim 6, characterized in that When the device is powered on or reset for the first time, according to the parity rule of the data logger device serial number, the data logger with an odd device serial number immediately participates in the master-slave competition, and the data logger with an even device serial number participates in the master-slave competition after a delay.

9. The method according to claim 6, characterized in that The participation in the active-standby competition is achieved by setting the enabling control of the active-standby competition. The method adds a controllable software switch in the active-standby competition software module to control the enabling of the competition. Usually, the software switch is turned off by default. When the active-standby competition is enabled by setting the switch to be turned on, the active-standby competition starts to work and the device participates in the active-standby competition.

10. The method according to claim 8, characterized in that The data collector uses software to read the unique factory serial number of the device to obtain the parity feature of the device serial number.

11. The method according to claim 2, characterized in that During the normal operation of the system, the main and standby data collectors realize real-time hot backup and switching throughout the entire life cycle.

12. The method according to claim 11, characterized in that During the normal operation of the system, the main unit of the data collector not only communicates with many subordinate devices through the RS485 bus for instructions and data, but also monitors its own working status in real time, opens performance statistics, opens business monitoring and fault management. The backup unit of the data collector monitors its own working status in real time, opens performance statistics, and opens fault management.

13. The method according to claim 11, characterized in that When the host of the data collector is in normal working state, it sends the host heartbeat message frame to the RS485 bus at a certain time interval. When a fault occurs or the performance is reduced, and the conditions for the master-slave competition are no longer met, the software switch for the master-slave competition preparation is turned off, and the master-slave competition enabling switch is turned off. At this time, the host is reduced to the standby state.

14. The method according to claim 11, characterized in that When the self-test status of the standby machine of the data collector is normal, it is identified as having the conditions for becoming the master machine, and the software switch for preparing the master-standby competition is turned on.

15. The method according to claim 11, characterized in that The backup machine of the data collector monitors whether there is a host heartbeat message frame on the bus. When it monitors the host heartbeat message frame, it confirms that there is a host device on the bus. At this time, it remains in the backup state to avoid the occurrence of master grabbing events and master-standby ping-pong switching, which affects business continuity. When the backup machine of the data collector does not monitor the host heartbeat message frame within the timeout period, it determines that there is no host on the bus or the host is faulty, and turns on the master-standby competition enable switch. At this time, the backup machine is promoted to the master. After the backup machine of the data collector is promoted to the master, it takes over business processing.

16. The method according to claim 13, characterized in that Whether the equipment participating in the active / standby competition has the active / standby competition conditions is realized by setting a software switch prepared for the active / standby competition. The software switch is turned off when the equipment self-check is abnormal, and is turned on when the equipment self-check passes.

17. The method according to claim 13, characterized in that Add a controllable software switch in the active / standby competition software module to control the enabling of competition. When the active / standby competition is disabled by setting the switch off, the device is downgraded. When the active / standby competition is enabled by setting the switch on, the device will participate in the active / standby competition.

18. The method according to claim 13, characterized in that When the data collector host is reduced to standby mode, the original host stops sending heartbeat message frames.

19. The method according to claim 13, characterized in that When the main unit of the data collector is downgraded to standby, the recovery means or mechanism of post-fault processing is used to make the performance recover or the fault be eliminated so that the conditions for upgrading to master are met again, and the software switch prepared for master-standby competition is turned on.