CN112650048A - Industrial gateway redundancy system and control method - Google Patents
Industrial gateway redundancy system and control method Download PDFInfo
- Publication number
- CN112650048A CN112650048A CN202110079796.4A CN202110079796A CN112650048A CN 112650048 A CN112650048 A CN 112650048A CN 202110079796 A CN202110079796 A CN 202110079796A CN 112650048 A CN112650048 A CN 112650048A
- Authority
- CN
- China
- Prior art keywords
- gateway
- slave
- bus
- slave station
- fault
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B9/00—Safety arrangements
- G05B9/02—Safety arrangements electric
- G05B9/03—Safety arrangements electric with multiple-channel loop, i.e. redundant control systems
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses an industrial gateway redundancy system and a control method, comprising a first gateway and a second gateway which are connected with each other; a plurality of slave stations connected to the first gateway and the second gateway through at least one bus, respectively; the first gateway is configured to collect data of each slave station, and judge whether to switch from the first working state to the second working state according to the number and/or distribution of communication failure slave stations of each gateway; the second gateway is configured to switch from the second operating state to the first operating state after receiving the state switching notification or interrupting communication with the first gateway; the invention realizes the maximum redundancy of a plurality of gateways, can carry out auxiliary acquisition on the standby gateway and can also be switched into a main working state according to the fault condition, thereby increasing the switching flexibility of the industrial gateway redundancy system and improving the reliability and the workability of the system.
Description
Technical Field
The invention relates to the field of industrial data acquisition, in particular to an industrial gateway redundancy system and a control method.
Background
In the field of industrial automation control, in order to avoid the occurrence of plant shutdown conditions, an industrial automation control system is required to have higher reliability and high availability, in the prior art, the high availability of the system is generally improved in a redundancy mode, and a specific method is to copy or backup key components or key control applications of the control system, so that the real-time acquisition of field data is ensured, and the continuous operation of plant production is realized.
The gateway is used for connecting two or more heterogeneous networks to enable the networks to communicate with each other. The industrial gateway fuses the heterogeneous sensing network into the industrial internet, carries out protocol conversion between various bus protocols of an industrial field and required communication protocols, and realizes data interaction between different protocols. However, the working environment of the industrial gateway is different from that of the common internet gateway device, and the industrial gateway also needs to be directed to a harsh industrial application environment. Therefore, gateway redundancy is an indispensable part in a control system, a 1:1 hot backup redundancy technology is mostly adopted in the prior art, two identical gateways are adopted and are in an operating state at the same time, one gateway is in a normal working state, real-time collected data are reported to a controller, the other gateway is in a standby state and does not participate in data collection, and when the working gateway fails, the standby gateway enters a working state to complete undisturbed switching.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides an industrial gateway redundancy system, which comprises a first gateway and a second gateway which are connected with each other; the slave stations are respectively connected with the first gateway and the second gateway through at least one bus; the first gateway is configured to collect data of each slave station and judge whether the slave station needs to be switched from the first working state to the second working state according to the number and/or distribution of communication failure slave stations of each gateway; a second gateway configured to switch from the second operating state to the first operating state after receiving the state switching notification or interrupting communication with the first gateway; the first working state is configured to report successfully acquired slave station data to the controller, and send a supplementary acquisition notification containing a slave station address failed in acquisition to the gateway in the second working state; the second operating state is configured to respond to a supplemental acquisition notification, perform supplemental acquisition on a secondary station that fails in acquisition, and report data to the controller.
Preferably, the first gateway is configured to analyze a failure level of the first gateway according to a slave station data acquisition situation, receive failure level information sent by the second gateway, and switch to the second working state when all slave station data located under the same bus cannot be acquired and the failure level of the first gateway is higher than the failure level of the second gateway.
Preferably, the first gateway is configured to switch to the second working state when the number of the slave stations failing in acquisition is greater than a preset value and the number of the slave stations communicating normally is less than the number of the slave stations communicating normally with the second gateway.
Preferably, the second gateway is configured to reply to a response message after receiving the time synchronization information sent by the first gateway, wherein the response message includes the failure level and the number of the slave stations which cannot normally communicate with the second gateway.
Preferably, the first gateway is configured to determine whether the number of slave stations in normal communication with the first gateway is smaller than the number of slave stations in normal communication with the second gateway when the first gateway cannot acquire all slave station data connected to the first bus and the second gateway cannot acquire all slave station data connected to the second bus but can acquire at least one piece of slave station data connected to the first bus, and if so, the first gateway switches to the second operating state.
The invention also discloses a control method for the industrial gateway redundancy system, which comprises the following steps:
step S1, after the master gateway finishes one period of slave station data acquisition, analyzing the fault level of the master gateway according to the acquired slave station data;
step S2, the standby gateway replies response information after receiving the synchronization information sent by the main gateway, wherein the response information comprises the failure level of the gateway and the number of the slave stations which can not normally communicate with the gateway;
step S3, the main gateway judges whether the gateway switching is needed according to the number and/or distribution of the communication failure slave stations of the standby gateway, if not, the successfully collected slave station data is reported to the controller, and a supplementary collection notice containing the failed slave station address is sent to the standby gateway;
and step S4, the standby gateway responds to the supplementary acquisition notice, performs supplementary acquisition on the failed acquisition slave station and reports the data to the controller.
Preferably, step S3 further includes: and S31, the main gateway receives the fault level information sent by the standby gateway, and if all slave station data under the same bus cannot be collected and the fault level of the main gateway is higher than that of the standby gateway, a redundancy switching signal is sent to the standby gateway.
Preferably, step S3 further includes: s32, if the master gateway cannot collect all slave station data connected to the first bus, and the standby gateway cannot collect all slave station data connected to the second bus but can collect at least one slave station data connected to the first bus, determining whether the number of slave stations in normal communication with the master gateway is less than the number of slave stations in normal communication with the standby gateway, if so, the master gateway sends a redundancy switching signal to the standby gateway.
Preferably, step S3 further includes: and S33, if the number of the slave stations which fail to collect by the main gateway is larger than the preset value and the number of the slave stations which normally communicate is less than the number of the slave stations which normally communicate with the standby gateway, the main gateway sends a redundancy switching signal to the standby gateway.
The invention also discloses a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of any one of the above redundancy switching methods for the industrial gateway.
The industrial gateway redundancy system disclosed by the invention realizes the maximum redundancy of a plurality of gateways by judging the fault conditions of the main gateway and the standby gateway, the standby gateway can perform auxiliary acquisition under the condition that the main gateway is in a light fault and cannot independently finish data acquisition without directly maintaining or replacing the first gateway, and the main gateway can be switched into a standby state according to the fault condition when in a specific heavy fault, and the original standby gateway is switched into the main gateway, so that the switching flexibility of the industrial gateway redundancy system is increased, the reliability and the workability of the system are improved, and the risk of shutdown is reduced.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a schematic structural diagram of an industrial gateway redundancy system according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of an industrial gateway redundancy system according to another embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an industrial gateway redundancy system according to another embodiment of the present invention.
Fig. 4 is a schematic flowchart illustrating steps of a control method for an industrial gateway redundancy system according to an embodiment of the present invention.
Fig. 5 is a flowchart illustrating a specific step of step S3 according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention without any inventive step, are within the scope of protection of the invention.
In the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, "above" or "below" a first feature means that the first and second features are in direct contact, or that the first and second features are not in direct contact but are in contact with each other via another feature therebetween. Also, the first feature being "on," "above" and "over" the second feature includes the first feature being directly on and obliquely above the second feature, or merely indicating that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature includes the first feature being directly under and obliquely below the second feature, or simply meaning that the first feature is at a lesser elevation than the second feature.
Unless defined otherwise, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs. The use of "first," "second," and similar terms in the description and claims of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. Also, the use of the terms "a" or "an" and the like do not denote a limitation of quantity, but rather denote the presence of at least one.
Example 1
Fig. 1 is a schematic diagram of an industrial gateway redundancy system according to the present embodiment, which includes a first gateway, a second gateway, and a plurality of slave stations, where the first gateway and the second gateway are connected to each other; a plurality of slave stations, namely slave devices, are respectively connected with a first gateway and a second gateway through at least one bus; the first gateway is configured to collect data of the slave stations and judge whether the first working state needs to be switched to the second working state according to the number and/or distribution of the communication failure slave stations of the gateways. The second gateway is configured to switch from the second operating state to the first operating state upon receiving a state switch notification or an interruption of communication with the first gateway. The first working state is configured to report successfully acquired slave station data to the controller, and send a supplementary acquisition notice with a slave station address failed in acquisition to the gateway in the second working state; the second operating state is configured to respond to a supplemental acquisition notification, perform supplemental acquisition on a secondary station that fails in acquisition, and report data to the controller.
Specifically, in this embodiment, a gateway a is used as a first gateway, a gateway B is used as a second gateway, the gateway a is used as a primary gateway, and the gateway B is used as a standby gateway. When the gateway A is used as a main gateway, the gateway A is in a first working state, collects data of each slave station according to a preset period, reports the successfully collected data of the slave station to the controller, and sends a supplementary collection notice with a slave station address failed in collection to the gateway B used as a standby gateway. And the gateway B as the standby gateway is in a second working state, only monitors the bus state, diagnoses the bus fault and does not receive bus data. And after receiving the supplementary acquisition notice sent by the main gateway, the slave station which fails in acquisition carries out supplementary acquisition and reports the data to the controller.
In this embodiment, the gateway a and the gateway B are connected to each other for communication, and the connection may be a wired connection or a wireless connection, and only the gateways need to communicate with each other, and in this embodiment, a serial port communication mode may be specifically used. The gateway A and the gateway B are also respectively in communication connection with an external controller and are used for sending the slave station data acquired by the gateway A and the gateway B to the controller and forwarding the data sent by the controller to the slave station. The plurality of slave stations are respectively connected with the gateway A and the gateway B through buses, the buses can adopt RS485 buses or other bus protocols, and the buses can be one or more buses, namely, all or groups of the slave stations can be connected with the gateway A or the gateway B through different buses. Each slave station may also be connected to gateway a via the same bus and to gateway B via another bus. Or each slave station can be respectively connected with the gateway A or the gateway B through the same bus. And the gateway A or the gateway B packages the acquired slave station data into a data packet and uploads the data packet to the controller, wherein the data packet comprises the acquired slave station data and a timestamp, the controller only allocates one memory to each slave station, and the data acquired by the gateway A and the gateway B are stored in the same memory.
In this embodiment, the second gateway is configured to reply a response message after receiving the time synchronization information sent by the first gateway, where the response message includes the failure level and the number of slave stations and slave station addresses that cannot normally communicate with the second gateway, and the slave station addresses include the connected bus information. Specifically, the slave device is connected with a gateway A and a gateway B through a bus respectively, the gateway A is used as a master gateway to collect slave device data and upload the slave device data to the controller, the gateway A periodically sends local time information to the gateway B, and the gateway B responds. The gateway B corrects the self time by receiving the time information of the gateway A, and the correction mode is specifically that the gateway B receives the time information in the data packet sent by the gateway A, the theoretical communication time consumption and the time of the interrupt response delay and takes the time as the time of the gateway B. The gateway B as the standby gateway only monitors the bus state, diagnoses the bus fault and does not receive bus data.
After the gateway A finishes one-cycle data acquisition, the self fault level is analyzed according to the data acquisition condition, time synchronization information can be sent to the gateway B, and response information sent to the gateway A by the gateway B is waited, wherein the specific response information comprises the fault level of the gateway B, the number of communication faults of slave equipment connected with the gateway B and slave station addresses, the slave station addresses comprise connected bus information, and the fault level comprises the slave station data acquisition condition of the same bus. The gateway A judges whether to switch from the first working state to the second working state according to the data acquisition condition of the slave stations positioned on the same bus or the number of the communication failure slave stations of each gateway, or judges whether to switch from the first working state to the second working state according to the data acquisition condition of the slave stations positioned on the same bus and the number of the communication failure slave stations of each gateway, namely, the gateway A is switched from a main gateway to a standby gateway, and the gateway B is switched to the main gateway.
In this embodiment, the gateway a serving as the master gateway analyzes its own failure level. The fault level is divided into a first-level fault and a fifth-level fault according to specific conditions, wherein the first-level fault is a light fault, and particularly is a local light fault which does not influence the current operation, such as a single-network fault of a redundant control network. The second-stage fault is a general fault, particularly a fault affecting local control output, such as a communication fault of a part of slave equipment on an RS485 bus. The third level fault is a heavy fault, specifically a fault affecting the whole bus, such as a whole RS485 bus fault. The fourth-level fault is a serious fault, specifically a fault affecting all control outputs, such as a redundant control network dual-network fault. The fifth-level fault is a fatal fault, in particular to an unrecoverable hardware fault, such as a Flash, DDR RAM and SRAM unrecoverable hardware fault, and the degree of the first-level fault to the fifth-level fault is increased in sequence.
If the slave equipment fails to be acquired, the gateway A synchronizes the slave equipment information which fails to be acquired to the gateway B, and the slave equipment information comprises the virtual address of the slave equipment; and the gateway B analyzes the slave equipment information sent by the gateway A, acquires the slave equipment data failed to be acquired by the gateway A according to the slave equipment address, and uploads the acquired slave equipment data and the state to the controller, and correspondingly, the controller issues the data to the slave equipment through the gateway A and then issues the data through the gateway B.
Therefore, when the number of faults generated by the slave devices connected to the master gateway increases, the data acquisition time is prolonged, which is not beneficial to the effectiveness of data acquisition, and therefore, when the acquisition time is too long, appropriate gateway switching is required. Specifically, the first gateway is configured to analyze a self fault level according to a data acquisition condition and receive fault level information sent by the second gateway, and when all slave station data located under the same bus cannot be acquired and the self fault level is higher than the fault level of the second gateway, the first gateway is switched to the second working state.
When the gateway A is in the third-level fault, if the fault level of the gateway A is larger than the received fault level of the gateway B, the switching of the main gateway is carried out, the switching of the gateway B is carried out to be the main gateway, and the switching of the gateway A to be the standby gateway is carried out. Through the switching mode, after the whole RS485 bus fails, the polling time of the bus is prolonged, and the corresponding data acquisition period is prolonged, so that in order to avoid the situation, under the condition that the gateway A has a heavier fault, and the gateway B has a normal fault, a light fault or a common fault, the redundant switching is triggered, and the influence on the communication of the whole system due to overlong bus polling time is avoided.
In this embodiment, the first gateway is further configured to switch to the second operating state when the number of the slave stations failing in acquisition is greater than a preset value and the number of the slave stations communicating normally is less than the number of the slave stations communicating normally with the second gateway, when both the first gateway and the second gateway fail in a level less than the third level failure. Specifically, the preset value may be set according to specific requirements, and in this embodiment, the preset value is set to be half of the number of the slave stations, that is, when more than half of the slave stations connected to the gateway a have failed and the number of the normally operating slave stations connected to the gateway a is smaller than that of the gateway B, and there is no communication failure of the same slave device in the slave devices connected to the gateway a and the gateway B, the master gateway is switched, the gateway B is switched to the master gateway, and the gateway a is switched to the standby gateway.
In this embodiment, the first gateway is configured to determine whether the number of slave stations in normal communication with the first gateway is smaller than the number of slave stations in normal communication with the second gateway when the first gateway cannot acquire all slave station data connected to the first bus and the second gateway cannot acquire all slave station data connected to the second bus but can acquire at least one piece of slave station data connected to the first bus, and if so, switch to the second operating state. That is, the first gateway is configured to determine whether the number of slave stations in normal communication with the first gateway is smaller than the number of slave stations in normal communication with the second gateway when a bus connected to the slave stations fails and another bus connected to the slave stations by the second gateway also fails, and if so, switch to the second operating state.
Specifically, the failure levels of the gateway a and the gateway B are both the third-level failure, and the failure buses are not the same bus, in such cases, whether switching is performed is determined according to the number of the slave stations capable of normally communicating with each gateway, if the number of the slave stations capable of normally communicating with the gateway a is less than the number of the slave stations capable of normally communicating with the gateway B, switching is performed on the master gateway, the gateway B is switched to the master gateway, and the gateway a is switched to the standby gateway, and if the number of the slave stations capable of normally communicating with the gateway a is more than or equal to the number of the slave stations capable of normally communicating with the gateway B, switching is not performed.
In other embodiments, the fault distribution rate of the gateway is represented by the variance of the fault rates of the buses of the gateway, and the fault distribution rate of the first gateway is The second gateway failure distribution rate is WhereinAndrespectively represent the average failure rate of each bus of the gateway A and the gateway B, and respectively NA、NBNumber of buses, W, connected to the first gateway A and the second gateway B, respectivelyA1、WA2…WAnFor respective connections of buses A1, A2 … An connected to the first gatewayNumber of slave stations, WB1、WB2…WBnThe number of slave stations connected to each of the buses B1, B2 … Bn connected to the second gateway, MA1、MA2…MAn、MB1、MB2…MBnFor the number of faults corresponding to the slave on each bus. When any one of the following conditions is satisfied, switching of the main gateway is performed:
(1) when the failure level of the gateway A is a third-level failure and is higher than the failure level of the gateway B, namely the overall communication of at least one RS485 bus fails, or the failure rate of at least one bus in the gateway A bus is equal to 1.
(2) And if the failure grades of the gateway A and the gateway B are both smaller than the third-level failure, triggering redundancy switching when the failure distribution rate of the first gateway is larger than a preset failure threshold value and larger than the failure distribution rate of the second gateway, and switching the first gateway to a second working state.
(3) The first gateway is configured to judge whether the first gateway fault distribution rate is greater than the second gateway fault distribution rate when the first gateway cannot collect all slave station data connected to the first bus and the second gateway cannot collect all slave station data connected to the second bus but can collect at least one slave station data connected to the first bus, and if so, switching is performed to switch the first gateway to the second working state. Wherein the first bus and the second bus may be any different bus.
Specifically, as shown in fig. 3, the gateway a is connected to three buses, which are a bus a1, a bus a2, and a bus A3, the gateway B is connected to three buses, which are a bus B1, a bus B2, and a bus B3, the slave stations are connected to the buses of the gateway a and the gateway B, and the buses a1, a2, and A3 are connected to the buses of W1, a2, and A3, respectivelyA1、WA2、WA3W is respectively connected with the slave stations, buses B1, B2 and B3B1、WB2、WB3A slave station, and the number of faults of the slave station on each bus is MA1、MA2、MA3、MB1、MB2、MB3Then the failure rate of each bus isMean failure rate of gateway a Mean failure rate of gateway BThe fault distribution rate of the gateway A is expressed by the variance of the fault rates of all buses of the gateway A The fault distribution rate of the gateway B is represented by the variance of the fault rates of all buses of the gateway BWherein N isA、NBThe numbers of buses connected to the gateway a and the gateway B are respectively equal to 3 in this embodiment, and when any one of the following conditions is satisfied, the master gateway is switched:
(1) when the failure level of the gateway A is a third-level failure, namely the integral communication of at least one RS485 bus fails, or the failure rate of at least one of the three buses of the gateway A is equal to 1, namely OrOrThe corresponding data acquisition period is extended, so as to avoid such a situationWhen the gateway A cannot collect all slave station data under the same bus and the own fault level is higher than the fault level of the gateway B, the redundancy switching is triggered to switch to the second working state.
(2) And if the failure grades of the gateway A and the gateway B are both smaller than the third-level failure, triggering redundancy switching when the failure distribution rate of the first gateway is larger than a preset failure threshold value and larger than the failure distribution rate of the second gateway, and switching the first gateway to a second working state. In a specific embodiment, the preset failure threshold may be set to 0.1, when the failure distribution rate ρ of the gateway a is greater than or equal to pA> 0.1, and ρA>ρBFor example, if 3, and 4 slave stations are connected to the buses a1, a2, and A3, respectively, 3, and 4 slave stations are connected to the buses B1, B2, and B3, respectively, and the number of bus fault slave stations connected to the gateway a is 0, 2, and 3, respectively, the fault distribution rate ρ of the gateway a is largerAWhen the number of the gateway B connected bus fault slave stations is 1, 2, and 2, respectively, when the failure distribution rate ρ is 0.113, the failure distribution rate ρ isB0.0185, then ρA>0.1, and ρA>ρBSwitching the gateway, wherein the fault distribution rate represents the density degree of the faults of the slave stations to a certain extent, the larger the fault distribution rate is, the more concentrated the fault slave stations are, and when the fault distribution rate rho of the gateway A isA> 0.1, and ρA>ρBIn case of (3), the gateway is switched.
(3) The first gateway is configured to judge whether the first gateway fault distribution rate is greater than the second gateway fault distribution rate when the first gateway cannot collect all slave station data connected to the first bus and the second gateway cannot collect all slave station data connected to the second bus but can collect at least one slave station data connected to the first bus, and if so, switching is performed to switch the first gateway to the second working state. Wherein the first bus and the second bus may be any different bus. That is, the failure grades of the gateway A and the gateway B are both serious failures, the failure buses are not the same, and according to the failure distribution rate of the gateway, if the failure distribution rate rho of the gateway A is larger than the failure distribution rate rho of the gateway BAGreater than gateway B failure distribution rateThen switching is carried out, if the failure distribution rate rho of the gateway AAGreater than the failure distribution rate ρ of gateway BBThen no handover is performed.
After the main gateway is judged to be required to be switched, the first gateway switches the first working state to the second working state and sends a gateway switching instruction to the second gateway, and the second gateway switches the second working state to the first working state after confirming the gateway switching instruction. Specifically, after the main gateway is switched, the switched gateway B serves as the main gateway, the gateway a performs maintenance or serves as a standby gateway, the gateway a stops the output of each bus, and notifies the gateway B through a serial port that the redundancy is switched to the main gateway, and after the switching, the gateway B still operates according to the operating modes of the main gateway in the first operating state and the standby gateway in the second operating state.
In some embodiments, after receiving the redundant switching signal, the second gateway in the second operating state delays for a predetermined time to perform multiple acknowledgements on the switching signal, and then converts the second operating state into the first operating state. Specifically, after receiving the redundant switching signal, the gateway B serving as the standby gateway needs to delay a period of time to confirm the switching signal, and once receiving the switching signal, the gateway B reads the switching state once every 0.2ms, and if the switching signals are all switching signals for 5 consecutive times, the gateway B confirms that the switching signals are valid switching signals, switches the gateway B to the master gateway, and meanwhile, in order to avoid bus collision, the gateway B enters the working state after delaying a certain time, and preferably 1 s. After the gateway B is used as a main gateway, the gateway A is used as a standby gateway, and the working mode of the gateway B is the same as that of the gateway A. After the second gateway is switched to the first working state, redundant switching is not carried out within preset time. For example, within 60 seconds after the occurrence of the redundancy switching, the redundancy switching does not occur due to the comparison of fault levels, the number of communication fault slave stations or the distribution situation of the communication fault slave stations, so that frequent switching caused by time break and time break in the wiring process is avoided.
In some embodiments, when the first gateway or the second gateway analyzes that the failure level is the fourth level or the fifth level failure, the operation of the first gateway or the second gateway is suspended. That is, when the gateway a or the gateway B analyzes that the failure level thereof is a serious failure or a fatal failure, the hardware device of the gateway needs to be replaced or repaired. Further, for the same slave station, when neither the gateway a nor the gateway B can acquire data, the hardware device of the gateway needs to be replaced or maintained.
The second gateway in the second working state is also configured to switch to the first working state when the first gateway in the first working state cannot receive the transmission time information, the acquisition failure information or the synchronous acquisition information. Specifically, if the redundant communication between the gateway a and the gateway B is interrupted, the gateway B cannot receive the time information, the acquisition failure information, the synchronous acquisition information, and the like of the gateway a, and then the gateway B enters the master gateway mode, acquires all slave device data, and reports the data to the controller, and the controller retains the latest data to be stored in the memory allocated to the slave station according to the timestamp in the reported slave device data packet.
The industrial gateway redundancy system disclosed in the embodiment realizes the maximum redundancy of a plurality of gateways by judging the fault conditions of the main gateway and the standby gateway, under the condition that the main gateway is in a light fault and cannot independently complete data acquisition, the standby gateway can perform auxiliary acquisition without directly maintaining or replacing the first gateway, and when the main gateway is in a specific heavy fault, the main gateway can be switched to a standby state according to the fault condition, one of the original standby gateways is switched to the main gateway, so that the switching flexibility of the industrial gateway redundancy system is increased, the reliability and the workability of the system are improved, and the risk of shutdown is reduced.
Example 2
Fig. 2 is a schematic diagram of an industrial gateway redundancy system disclosed in this embodiment, which includes a first gateway, a second gateway, a third gateway, and a plurality of slave stations, where the first gateway, the second gateway, and the third gateway are connected to each other; a plurality of slave stations, namely slave devices, are respectively connected with a first gateway, a second gateway and a third gateway through at least one bus; the first gateway is configured to collect data of each slave station, and judge whether to switch from the first working state to the second working state according to the data collection condition of the slave stations located on the same bus and/or the number of communication failure slave stations of each gateway, or judge whether to switch from the first working state to the second working state according to the number and/or distribution of the communication failure slave stations of each gateway. The second gateway or the third gateway is configured to switch from the second operating state to the first operating state upon receiving the state switching notification or upon communication interruption with the first gateway. The first working state is configured to report successfully acquired slave station data to the controller, and send a supplementary acquisition notice with a slave station address failed in acquisition to the gateway in the second working state; the second operating state is configured to respond to a supplemental acquisition notification, perform supplemental acquisition on a secondary station that fails in acquisition, and report data to the controller.
Specifically, in this embodiment, a gateway C is taken as a first gateway, a gateway D is taken as a second gateway, a gateway E is taken as a third gateway, the gateway C is taken as a main gateway in advance, and the gateways D and E are standby gateways. And when the gateway C is used as a main gateway, the gateway C is in a first working state, acquires the data of each slave station according to a preset period, reports the successfully acquired data of the slave station to the controller, and sends a supplementary acquisition notice with the address of the slave station failed in acquisition to the gateway D or E used as a standby gateway. And D or E as the standby gateway is in a second working state, only monitors the bus state, diagnoses the bus fault and does not receive bus data. And after receiving the supplementary acquisition notice sent by the main gateway, the slave station which fails in acquisition carries out supplementary acquisition and reports the data to the controller.
In this embodiment, the gateways C, D and E are connected to each other for communication, and the connection may be a wired connection or a wireless connection, and only the gateways need to communicate with each other, and in this embodiment, a serial port communication mode may be specifically used. The gateways C, D and E are also respectively in communication connection with an external controller and are used for sending the slave station data collected by the gateways to the controller and forwarding the data sent by the controller to the slave station. The slave stations are respectively connected with the gateways C, D and E through buses, the buses can adopt RS485 buses or other bus protocols, and the buses can be one or more buses, namely, all or each group of the slave stations can be connected with the gateway C, D or E through different buses. Each slave station can also be connected with the gateway C through the same bus, connected with the gateway D through another bus and connected with the gateway E through another bus. Or the slave stations may be connected to the gateway C, D or E, respectively, via the same bus. The gateway C, D or E packages the acquired slave station data into a data packet and uploads the data packet to the controller, wherein the data packet comprises the acquired slave station data and a timestamp, the controller only allocates one memory to each slave station, and the data acquired by the gateway C, D and the gateway E are stored in the same memory.
In this embodiment, the second gateway and the third gateway are configured to reply a response message after receiving the time synchronization information sent by the first gateway, where the response message includes a failure level, the number of slave stations that cannot normally communicate with the local gateway, and a slave station address, where the slave station address includes the connected bus information. Specifically, the slave devices are respectively connected with the gateways C, D and E through buses, the gateway C is used as a master gateway to collect slave device data and upload the slave device data to the controller, and the gateway C periodically sends local time information to the gateways D and E, and the gateways D and E respond. The response content of the gateways D and E comprises own fault level information, and the gateways D and E correct own time by receiving the time information of the gateway C, wherein the correction mode is specifically that the gateways D and E use the received time information in the data packet sent by the gateway C, the theoretical communication time consumption and the time of the interrupt response delay as the time of the gateways D and E. The gateways D and E as the standby gateways only monitor the bus state, diagnose the bus fault and do not receive the bus data.
After the gateway C finishes one period of data acquisition, the failure level of the gateway C is analyzed according to the data acquisition condition, and time synchronization information can be sent to the gateways D and E to wait for response messages sent by the gateways D and E to the gateway C, wherein the specific response messages include the failure level of the gateway D, E, the number of slave stations and slave station addresses which cannot normally communicate with the gateway D, E, the failure level includes the data acquisition condition of the slave stations of the same bus, and the slave station addresses include the information of the connected bus. The gateway C judges whether to switch from the first working state to the second working state according to the data acquisition condition of the slave stations positioned on the same bus or the number of the communication failure slave stations of each gateway, or judges whether to switch from the first working state to the second working state according to the data acquisition condition of the slave stations positioned on the same bus and the number of the communication failure slave stations of each gateway, namely the gateway C is switched from the main gateway to the standby gateway, and the gateway D or E is switched to the main gateway.
In this embodiment, after the gateway C serving as the master gateway fails, the own failure level is analyzed. Classifying the fault levels according to the levels in embodiment 1, if the fault levels are the first-level fault, continuing the operation of the gateway C, if the fault levels are the second-level fault, acquiring slave device data by the gateway C, polling and acquiring the slave devices with failed acquisition by the gateway C again, and if the fault levels are still in a failure state, synchronizing the slave device information with failed acquisition to the gateway D or E, wherein the slave device information comprises the virtual addresses of the slave devices; and the gateway D or E analyzes the slave equipment information sent by the gateway C, acquires the slave equipment data failed to be acquired by the gateway C according to the slave equipment address, uploads the acquired slave equipment data and the state to the controller, and correspondingly, the data issued to the slave equipment by the controller through the gateway C is issued through the gateway D or E.
Therefore, when the number of faults generated by the slave devices connected to the master gateway increases, the data acquisition time is prolonged, which is not beneficial to the effectiveness of data acquisition, and therefore, when the acquisition time is too long, appropriate gateway switching is required. Specifically, the first gateway is configured to analyze a self fault level according to a data acquisition condition, receive fault level information sent by the second gateway and the third gateway, and switch to the second working state when all slave station data located under the same bus cannot be acquired and the self fault level is higher than the fault level of the second gateway or the third gateway.
When the gateway C is in the third-level fault, if the fault level of the gateway C is greater than the fault level of the received gateway D or the received gateway E, the main gateway is switched, the gateway with the lower fault level in the gateways D and E is switched into the main gateway, and if the fault level is the same, the gateway with the lower communication fault number of the slave stations is switched into the main gateway, and the gateway C is switched into the standby gateway. Through the switching mode, when the whole RS485 bus fails, the polling time of the bus is prolonged, and the corresponding data acquisition period is prolonged, so that in order to avoid the situation, under the condition that the main gateway has a heavier failure, and a normal failure, a light failure or a common failure exists in the standby gateway, the redundancy switching is triggered, and the gateway with a lower failure level in the standby gateway is switched to the main gateway, so that the problem that the communication of the whole system is influenced due to overlong bus polling time is avoided.
In this embodiment, the first gateway is further configured to switch to the second operating state when the number of the slave stations failing in acquisition is greater than a preset value and the number of the slave stations in normal communication is less than the number of the slave stations in normal communication with the second gateway or the third gateway, when both the failure levels of the second gateway and the third gateway are lower than the third level. Specifically, the preset value may be set according to specific requirements, and in this embodiment, the preset value is set to be half of the number of the slave stations, that is, when more than half of the slave stations connected to the gateway C have failed, the number of the normally operating slave stations connected to the gateway C is smaller than that of the gateway D or E, and the gateway C and the slave device connected to the gateway D or E do not have the same communication failure of the slave device, the master gateway is switched, the gateway D or E is switched to the master gateway, and the gateway C is switched to the standby gateway, preferably, a website with a larger number of normally connected slave stations in the gateways D and E can be switched to the master gateway.
In this embodiment, the first gateway is configured to determine whether the number of slave stations in normal communication with the first gateway is smaller than the number of slave stations in normal communication with the second or third gateway when a bus connected to the slave stations fails and another bus connected to the slave stations of the second and third gateways also fails, and if so, switch to the second operating state, and switch to the master gateway the gateway having the larger number of normal communication slave stations connected to each of the second gateway and the third gateway. Specifically, if the failure levels of the gateways C, D, E are all the third-level failures, and the failure buses are not the same, that is, the connected slave devices are different, in such a case, whether switching is determined according to the number of the slave stations capable of normally communicating with each gateway, if the number of the slave stations normally communicating with the gateway C is less than the number of the gateway D or E normal communication slave stations, switching is performed on the master gateway, the gateway with the largest number of the normal communication slave stations is switched to the master gateway, and the gateway C is switched to the standby gateway, and if the number of the normal communication slave stations of the gateway C is more than or equal to the number of the gateway D and E normal communication slave stations, switching is not performed, and the gateway C still operates as the master gateway.
After the main gateway is judged to be required to be switched, the first gateway switches the first working state to the second working state and sends a gateway switching instruction to the second gateway or the third gateway, and the second gateway or the third gateway switches the second working state to the first working state after confirming the gateway switching instruction.
In other specific embodiments, when the failure distribution rate of the first gateway is greater than the preset failure threshold and greater than the failure distribution rate of the second gateway or the third gateway, the redundancy switching is triggered, the first gateway is switched to the second working state, and the gateway with the smaller failure distribution rate in the second gateway and the third gateway is set to the first working state. Wherein the fault distribution rate is represented by the variance of the fault rates of the buses connected with the gateways, the first gateway fault distribution rate is The second gateway failure distribution rate is Wherein For the average failure rate of the bus to which each gateway is connected,N1、N2number of buses, W, connected to the first gateway and the second gateway, respectively11、W12…W1nNumber of slave stations, W, connected for each bus connected to the first gateway21、W22…W2nNumber of slave stations, M, connected for each line connected to the second gateway11、M12…M1n、M21、M22…M2nThe failure distribution rate of the third gateway is also the same for the number of failures of the slave stations on each bus, and the description will not be repeated.
And when the first gateway cannot acquire all slave station data connected to the first bus and the second gateway cannot acquire all slave station data connected to the second bus but can acquire at least one slave station data connected to the first bus, judging whether the fault distribution rate of the first gateway is greater than that of the second gateway, if so, switching, and switching the first gateway to a second working state. Wherein the first bus and the second bus may be any different bus.
In some embodiments, after receiving the redundant switching signal, the second gateway in the second operating state delays for a predetermined time to perform multiple acknowledgements on the switching signal, and then converts the second operating state into the first operating state. Specifically, after receiving the redundant switching signal, the gateway D serving as the standby gateway needs to delay a period of time to confirm the switching signal, and once receiving the switching signal, the gateway D reads the switching state once every 0.2ms, and if the switching signals are all switching signals for 5 consecutive times, the gateway D confirms that the switching signals are valid switching signals, and switches the gateway D to the master gateway, and meanwhile, in order to avoid bus collision, the gateway D enters the working state after delaying a certain time, preferably 1 s. And after the gateway D is used as a main gateway, the gateway C is used as a standby gateway, and the working mode of the gateway D is the same as that of the gateway C. After the second gateway is switched to the first working state, redundant switching is not carried out within preset time. For example, within 60 seconds after the occurrence of the redundancy switching, the redundancy switching does not occur due to the comparison of fault levels, the number of communication fault slave stations or the distribution situation of the communication fault slave stations, so that frequent switching caused by time break and time break in the wiring process is avoided.
In some embodiments, when the first, second or third gateway analyzes that its failure level is a fourth level or fifth level failure, its operation is aborted. That is, when the gateway C, D, E analyzes its own failure level as a serious failure or a fatal failure, the hardware device of the gateway needs to be replaced or repaired. Further, for the same slave station, when no data is collected by the gateway C, D, E, the hardware device of the gateway needs to be replaced or repaired. The second gateway and the third gateway in the second working state are further configured to switch the second gateway or the third gateway to the first working state when the first gateway in the first working state cannot receive the transmission time information, the acquisition failure information or the synchronous acquisition information.
The industrial gateway redundancy system disclosed by the embodiment realizes the maximum redundancy of a plurality of gateways by judging the fault level, and under the condition that the first gateway serving as the main gateway cannot independently complete data acquisition, the second gateway and the third gateway serving as the standby gateways perform auxiliary acquisition without directly maintaining or replacing the first gateway, so that the reliability and the workability of the system are improved, and the risk of shutdown is reduced; in practical use, more than three gateways can be arranged, and the specific scheme is similar to the above scheme and is not repeatedly discussed.
Example 3
Fig. 4 is a control method for an industrial gateway redundancy system disclosed in this embodiment, which can be used in each industrial gateway, for example, an industrial gateway in an industrial gateway redundancy system as described in the foregoing embodiments, for clarity of description, the following embodiment will be described by taking the industrial gateway redundancy system in embodiment 1 as an example, but of course, the data processing method can be applied to industrial gateways in embodiment 2 and other various industrial redundancy systems, and the data processing method mainly includes the following steps:
and step S1, after the master gateway finishes one cycle of slave station data acquisition, analyzing the fault level of the master gateway according to the acquired slave station data.
And the master gateway A acquires the data of the slave station and reports the data to the controller, and after one period of data acquisition is finished, the fault level of the master gateway A is analyzed according to the data acquisition condition. The fault level is divided into a first-level fault and a fifth-level fault according to specific conditions, wherein the first-level fault is a light fault, and particularly is a local light fault which does not influence the current operation, such as a single-network fault of a redundant control network. The second-stage fault is a general fault, particularly a fault affecting local control output, such as a communication fault of a part of slave equipment on an RS485 bus. The third level fault is a heavy fault, specifically a fault affecting the whole bus, such as a whole RS485 bus fault. The fourth-level fault is a serious fault, specifically a fault affecting all control outputs, such as a redundant control network dual-network fault. The fifth-level fault is a fatal fault, in particular to an unrecoverable hardware fault, such as a Flash, DDR RAM and SRAM unrecoverable hardware fault, and the degree of the first-level fault to the fifth-level fault is increased in sequence.
And step S2, the standby gateway replies a response message after receiving the synchronization message sent by the main gateway, wherein the response message comprises the fault level of the gateway, the number of slave stations which can not normally communicate with the gateway and the slave station address, and the slave station address comprises the connected bus information.
The master gateway A sends time synchronization information to the standby gateway B to wait for a response message sent by the gateway B to the gateway A, wherein the specific response message comprises the fault level of the gateway B, the number of faults of slave stations connected with the gateway B and the address of the slave station. And after receiving the time information of the gateway A, the gateway B calculates the time of the gateway B as the sum of the time in the time synchronization information of the gateway A and the time of the theoretical communication transmission time and the interrupt response delay.
And step S3, the main gateway judges whether the gateway switching is needed according to the number and/or the distribution of the communication failure slave stations of the standby gateway, if not, the successfully acquired slave station data is reported to the controller, and a supplementary acquisition notice containing the failed slave station address is sent to the standby gateway. Specifically, as shown in fig. 5, the step S3 includes the following specific steps:
and step S31, the main gateway receives the fault level information sent by the standby gateway, and if all slave station data under the same bus cannot be collected and the fault level of the main gateway is higher than the fault level of the standby gateway, a redundancy switching signal is sent to the standby gateway.
And the master gateway switches to a second working state when the master gateway cannot collect all slave station data under the same bus and the fault level of the master gateway is higher than that of other gateways. When the number of faults generated by the slave devices connected with the master gateway increases, the data acquisition time is prolonged, which is not beneficial to the effectiveness of data acquisition, so that when the acquisition time is too long, the gateway needs to be switched properly. Specifically, the first gateway is configured to analyze a self fault level according to a data acquisition condition and receive fault level information sent by the second gateway, and when all slave station data located under the same bus cannot be acquired and the self fault level is higher than the fault level of the second gateway, the first gateway is switched to the second working state.
When the gateway A is in the third-level fault, if the fault level of the gateway A is larger than the received fault level of the gateway B, the switching of the main gateway is carried out, the switching of the gateway B is carried out to be the main gateway, and the switching of the gateway A to be the standby gateway is carried out. Through the switching mode, after the whole RS485 bus fails, the polling time of the bus is prolonged, and the corresponding data acquisition period is prolonged, so that in order to avoid the situation, under the condition that the gateway A has a heavier fault, and the gateway B has a normal fault, a light fault or a common fault, the redundant switching is triggered, and the influence on the communication of the whole system due to overlong bus polling time is avoided.
S32, if the master gateway cannot collect all slave station data connected to the first bus, and the standby gateway cannot collect all slave station data connected to the second bus but can collect at least one slave station data connected to the first bus, determining whether the number of slave stations in normal communication with the master gateway is less than the number of slave stations in normal communication with the standby gateway, if so, the master gateway sends a redundancy switching signal to the standby gateway.
In this embodiment, when a bus connected to a slave station fails and another bus connected to a slave station by a second gateway also fails, it is determined whether the number of slave stations normally communicating with the first gateway is smaller than the number of slave stations normally communicating with the second gateway, and if so, the network switches to the second operating state. Specifically, the failure levels of the gateway a and the gateway B are both the third level failure, the failure buses are not the same bus, and the connected slave stations are different, under such a situation, whether switching is determined according to the number of the slave stations capable of normally communicating with each gateway, if the number of the slave stations capable of normally communicating with the gateway a is less than the number of the slave stations capable of normally communicating with the gateway B, switching is performed on the master gateway, the gateway B is switched to the master gateway, the gateway a is switched to the standby gateway, and if the number of the slave stations capable of normally communicating with the gateway a is more than or equal to the number of the slave stations capable of normally communicating with the gateway B, switching is not performed, and the gateway.
Step S33, when the failure levels of the first gateway and the second gateway are both smaller than the third level failure, if the number of the slave stations failing in the acquisition of the main gateway is larger than the preset value and the number of the slave stations communicating normally is less than the number of the slave stations communicating normally with the standby gateway, the main gateway sends a redundancy switching signal to the standby gateway
Specifically, when the number of the slave stations failing in acquisition is greater than a preset value and the number of the slave stations communicating normally is less than the number of the slave stations communicating normally with other gateways, the master gateway switches to the second working state. The preset value may be set according to specific requirements, and in this embodiment, the preset value is set to be half of the number of the slave stations for explanation, that is, when the failure levels of the gateway a and the gateway B are both smaller than the third level, which may be a normal failure, a light failure, or a general failure, more than half of the slave stations connected to the gateway a have failed, and the number of the normally operating slave stations connected to the gateway a is smaller than that of the gateway B, and the slave devices connected to the gateway a and the gateway B do not have the same slave device communication failure, a master gateway is switched, the gateway B is switched to a master gateway, and the gateway a is switched to a standby gateway.
In some embodiments, step S3 further includes the following gateway redundancy switching determination step, which is described in detail below.
Step S34, if the failure distribution rate of the primary gateway is greater than the preset failure threshold and greater than the failure distribution rate of the standby gateway, the primary gateway sends a redundancy switching signal to the standby gateway when the failure levels of the gateways are lower than the third level failure.
Specifically, in this embodiment, the main gateway a connects three buses, which are a bus a1, a bus a2, and a bus A3, the standby gateway B connects three buses, which are a bus B1, a bus B2, and a bus B3, the plurality of slaves connect a plurality of buses of the gateway a and the gateway B, and the buses a1, a2, and A3 connect a plurality of buses of the gateway a and the gateway B, respectivelyA1、WA2、WA3W is respectively connected with the slave stations, buses B1, B2 and B3B1、WB2、WB3A slave station, and the number of faults of the slave station on each bus is MA1、MA2、MA3、MB1、MB2、MB3Then the failure rate of each bus isMean failure rate of gateway a Mean failure rate of gateway BThe fault distribution rate of the gateway A is expressed by the variance of the fault rates of all buses of the gateway A The fault distribution rate of the gateway B is represented by the variance of the fault rates of the buses of the gateway BWherein N isA、NBRespectively, gateway a and gatewayThe number of buses connected to B is equal to 3 in this embodiment. Wherein the first gateway failure distribution rate isThe second gateway failure distribution rate is Wherein For the average failure rate of the bus to which each gateway is connected, NA、NBnumber of buses, W, connected to the first gateway A and the second gateway B, respectivelyA1、WA2、WAnThe number of slave stations connected to each of the buses A1, A2, An connected to the first gateway, WB1、WB2、WBnThe number of slave stations connected to each of buses B1, B2, Bn connected to the second gateway, WA1、WA2、MAn、MB1、MB2、MBnFor the number of faults corresponding to the slave on each bus. In a specific embodiment, the preset failure threshold may be set to 0.1, when the failure distribution rate ρ of the gateway a is greater than or equal to pA> 0.1, and ρA>ρBThe larger the failure distribution rate of the gateway a, the more concentrated the communication failure distribution of the slave stations of the bus connected to the gateway a, and for example, if 3, 4 slave stations are connected to the buses a1, a2, A3, respectively, and the number of failed slave stations of the bus connected to the gateway a is 0, 2, 3, respectively, the failure of the gateway a may occurBarrier distribution ratio ρAWhen the number of slave stations in a bus connected to the gateway a with a failure is 1, 2, and 2, respectively, 0.113, the failure distribution rate ρ isBWhen the failure distribution rate of the gateway a is greater than 0.1 and greater than the failure distribution rate of the gateway B, the gateway switching should be performed, which is 0.0185. The fault distribution rate represents the density degree of the faults of the slave stations, the larger the fault distribution rate is, the more concentrated the fault slave stations are, and when the fault distribution rate rho of the gateway A isA> 0.1, and ρA>ρBIn case of (3), the gateway is switched.
Step S35, if the master gateway cannot acquire all slave station data connected to the first bus, and the standby gateway cannot acquire all slave station data connected to the second bus but can acquire at least one slave station data connected to the first bus, determining whether the failure distribution rate of the master gateway is greater than the failure distribution rate of the second gateway, if so, performing a switching operation, and the master gateway sending a redundancy switching signal to the standby gateway. The primary gateway also switches the first gateway to the second operational state. Wherein the first bus and the second bus may be any different bus. That is, the failure grades of the gateway A and the gateway B are both serious failures, the failure buses are not the same, and according to the failure distribution rate of the gateway, if the failure distribution rate rho of the gateway A is larger than the failure distribution rate rho of the gateway BAIf the number of the normal communication equipment of the gateway A is more than or equal to that of the gateway B, the switching is not carried out.
The order of the operation state switching conditions of the main gateways from the step S31 to the step S35 may be determined sequentially from high to low in the switching priorities of the steps S31 to S35, may be performed in the steps S31 to S33 or the steps S31 and S34 to S35, or may be performed in another preset priority order of the switching conditions.
And step S4, the standby gateway responds to the supplementary acquisition notice, performs supplementary acquisition on the failed acquisition slave station and reports the data to the controller.
Specifically, if the gateway a is in the second-level fault and does not need to be switched, the gateway a acquires slave device data, the gateway a performs polling acquisition again on slave devices which fail to acquire the slave devices, and if the slave devices still fail to acquire the slave devices, the slave device information which fails to acquire the slave devices is synchronized to the gateway B, and the slave device information includes virtual addresses of the slave devices; and the gateway B analyzes the slave equipment information sent by the gateway A, acquires the slave equipment data failed to be acquired by the gateway A according to the slave equipment address, and uploads the acquired slave equipment data and the state to the controller, and correspondingly, the controller issues the data to the slave equipment through the gateway A and then issues the data through the gateway B.
And the master gateway reports the successfully acquired slave station data to the controller and sends a supplementary acquisition notice with the failed slave station address to the standby gateway in the second working state. And the standby gateway is in a second working state, only monitors the bus state, diagnoses bus faults and does not receive bus data. And after receiving the supplementary acquisition notice sent by the main gateway, the slave station which fails in acquisition carries out supplementary acquisition and reports the data to the controller, and the controller is forwarded to transmit the data sent to the slave station by the controller.
In step S5, if a gateway switch is required, the primary gateway sends a redundancy switch signal to a backup gateway. Namely, the main gateway is switched to the standby gateway, namely, the main gateway is switched to the second working state.
And after the switching of the main gateway is judged to be needed, the first working state is switched to a second working state and a gateway switching instruction is sent to the second gateway, and the original standby gateway switches the second working state to the first working state after confirming the gateway switching instruction. Specifically, after the main gateway is switched, the switched gateway B serves as a working gateway, the gateway a performs maintenance or serves as a standby gateway, the gateway a stops the output of each bus, and notifies the gateway B through a serial port that the redundancy is switched to the main gateway, and after the switching, the gateway B still operates according to the working modes of the main gateway in the first working state and the standby gateway in the second working state.
In some embodiments, when the failure level is analyzed as a fourth-level or fifth-level failure, the operation is suspended. That is, when the gateway a or the gateway B analyzes that the failure level thereof is a serious failure or a fatal failure, the hardware device of the gateway needs to be replaced or repaired. Further, for the same slave station, when neither the gateway a nor the gateway B can acquire data, the hardware device of the gateway needs to be replaced or maintained.
And when the main gateway is switched to the second working state, waiting for responding to the time synchronization information or the supplementary acquisition notice sent by the original standby gateway switched to the first working state. In some embodiments, in the second operating state, if the redundant switching signal is received, after delaying for a predetermined time to perform multiple acknowledgements on the switching signal, the second operating state is converted into the first operating state. Specifically, after receiving the redundant switching signal, the gateway B serving as the standby gateway needs to delay a period of time to confirm the switching signal, and once receiving the switching signal, the gateway B reads the switching state once every 0.2ms, and if the switching signals are all switching signals for 5 consecutive times, the gateway B confirms that the switching signals are valid switching signals, switches the gateway B to the master gateway, and meanwhile, in order to avoid bus collision, the gateway B enters the working state after delaying a certain time, and preferably 1 s. After the gateway B is used as a main gateway, the gateway A is used as a standby gateway, and the working mode of the gateway B is the same as that of the gateway A. After the second gateway is switched to the first working state, redundant switching is not carried out within preset time. For example, within 60 seconds after the occurrence of the redundancy switching, the redundancy switching does not occur due to the comparison of fault levels, the number of communication fault slave stations or the distribution situation of the communication fault slave stations, so that frequent switching caused by time break and time break in the wiring process is avoided.
And if the standby gateway cannot receive the time information, the acquisition failure information or the synchronous acquisition information of the main gateway in the first working state, switching the standby gateway to the first working state. Specifically, if the redundant communication between the gateway a and the gateway B is interrupted, the gateway B cannot receive the time information, the acquisition failure information, the synchronous acquisition information, and the like of the gateway a, and then the gateway B enters the master gateway mode, acquires all slave device data, and reports the data to the controller, and the controller retains the latest data to be stored in the memory allocated to the slave station according to the timestamp in the reported slave device data packet.
The control method for the industrial gateway redundancy system disclosed by the embodiment realizes the maximum redundancy of a plurality of gateways by judging the fault conditions of the main gateway and the standby gateway, the standby gateway can perform auxiliary acquisition under the condition that the main gateway is in slight fault and cannot independently complete data acquisition, the first gateway does not need to be directly maintained or replaced, and the main gateway can be switched to the standby state according to the fault condition when in specific heavy fault, so that the switching flexibility of the industrial gateway redundancy system is increased, the reliability and the workability of the system are improved, and the risk of shutdown is reduced.
Fig. 4 is a schematic diagram of an industrial gateway according to an embodiment of the present invention, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of the control method for the industrial gateway redundancy system described in the embodiments.
The industrial gateway may include, but is not limited to, a processor, a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of an industrial gateway and is not intended to be limiting and may include more or fewer components than those shown, or some components in combination, or different components, for example, the industrial gateway may also include input output devices, network access devices, buses, etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is the control center of the industrial gateway and connects the various parts of the overall industrial gateway device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the industrial gateway by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like, and the memory may include a high speed random access memory, and may further include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The control device data management method for the industrial gateway redundancy system can be stored in a computer readable storage medium if the control device data management method is realized in the form of a software functional unit and is sold or used as an independent product. Based on such understanding, all or part of the flow in the method according to the above embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of the above embodiments of the control method for an industrial gateway redundancy system. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
In summary, the above-mentioned embodiments are only preferred embodiments of the present invention, and all equivalent changes and modifications made in the claims of the present invention should be covered by the claims of the present invention.
Claims (10)
1. An industrial gateway redundancy system, comprising:
a first gateway and a second gateway connected to each other;
the slave stations are respectively connected with the first gateway and the second gateway through at least one bus;
the first gateway is configured to collect data of each slave station and judge whether the slave station needs to be switched from the first working state to the second working state according to the number and/or distribution of communication failure slave stations of each gateway;
a second gateway configured to switch from the second operating state to the first operating state after receiving the state switching notification or interrupting communication with the first gateway;
the first working state is configured to report successfully acquired slave station data to the controller, and send a supplementary acquisition notification containing a slave station address failed in acquisition to the gateway in the second working state; the second operating state is configured to respond to a supplemental acquisition notification, perform supplemental acquisition on a secondary station that fails in acquisition, and report data to the controller.
2. The industrial gateway redundancy system of claim 1, wherein:
the first gateway is configured to analyze the own fault level according to the slave station data acquisition condition and receive fault level information sent by the second gateway, and when all slave station data located under the same bus cannot be acquired and the own fault level is higher than the fault level of the second gateway, the first gateway is switched to a second working state.
3. The industrial gateway redundancy system of claim 2, wherein:
the first gateway is configured to switch to the second working state when the number of the slave stations which fail to collect is larger than a preset value and the number of the slave stations which normally communicate is smaller than the number of the slave stations which normally communicate with the second gateway.
4. The industrial gateway redundancy system of claim 3, wherein: the second gateway is configured to reply a response message after receiving the time synchronization information sent by the first gateway, wherein the response message comprises the fault level and the number of the slave stations which can not normally communicate with the second gateway.
5. The industrial gateway redundancy system according to any of claims 1 to 4, wherein:
the first gateway is configured to judge whether the number of the slave stations in normal communication with the first gateway is smaller than the number of the slave stations in normal communication with the second gateway when the first gateway cannot acquire all the slave station data connected to the first bus and the second gateway cannot acquire all the slave station data connected to the second bus but can acquire at least one piece of slave station data connected to the first bus, and if so, the first gateway is switched to a second working state.
6. A control method for an industrial gateway redundancy system, comprising:
s1, after the master gateway finishes one period of slave station data acquisition, analyzing the fault level of the master gateway according to the acquired slave station data;
s2, the standby gateway replies response information after receiving the synchronization information sent by the main gateway, wherein the response information comprises the fault level of the gateway and the number of the slave stations which can not normally communicate with the gateway;
s3, the main gateway judges whether gateway switching is needed according to the number and/or distribution of communication failure slave stations of the standby gateway, if not, the slave station data which are successfully collected are reported to the controller, and a supplementary collection notice containing the slave station address which is failed in collection is sent to the standby gateway;
and S4, the standby gateway responds to the supplementary acquisition notice, performs supplementary acquisition on the failed acquisition slave station and reports the data to the controller.
7. The control method for the industrial gateway redundancy system according to claim 6, wherein the step S3 further comprises:
and S31, the main gateway receives the fault level information sent by the standby gateway, and if all slave station data under the same bus cannot be collected and the fault level of the main gateway is higher than that of the standby gateway, a redundancy switching signal is sent to the standby gateway.
8. The control method for the industrial gateway redundancy system according to claim 7, wherein the step S3 further comprises:
s32, if the master gateway cannot collect all slave station data connected to the first bus, and the standby gateway cannot collect all slave station data connected to the second bus but can collect at least one slave station data connected to the first bus, determining whether the number of slave stations in normal communication with the master gateway is less than the number of slave stations in normal communication with the standby gateway, if so, the master gateway sends a redundancy switching signal to the standby gateway.
9. The control method for the industrial gateway redundancy system according to claim 8, wherein:
and S33, if the number of the slave stations which fail to collect by the main gateway is larger than the preset value and the number of the slave stations which normally communicate is less than the number of the slave stations which normally communicate with the standby gateway, the main gateway sends a redundancy switching signal to the standby gateway.
10. A computer-readable storage medium storing a computer program, characterized in that: the computer program when being executed by a processor realizes the steps of the method as claimed in any one of the claims 6-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110079796.4A CN112650048B (en) | 2021-01-21 | 2021-01-21 | Industrial gateway redundancy system and control method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110079796.4A CN112650048B (en) | 2021-01-21 | 2021-01-21 | Industrial gateway redundancy system and control method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112650048A true CN112650048A (en) | 2021-04-13 |
CN112650048B CN112650048B (en) | 2021-09-17 |
Family
ID=75370937
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110079796.4A Active CN112650048B (en) | 2021-01-21 | 2021-01-21 | Industrial gateway redundancy system and control method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112650048B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113950168A (en) * | 2021-10-14 | 2022-01-18 | 成都锦城学院 | High-reliability redundant backup 4G/5G safe edge computing gateway |
CN114563946A (en) * | 2022-04-28 | 2022-05-31 | 深圳斯凯达控制技术有限公司 | Control method and system for industrial monitoring redundant system with cooperation of gateway and PLC |
CN115001898A (en) * | 2022-05-07 | 2022-09-02 | 通号城市轨道交通技术有限公司 | Network equipment redundant communication system and method |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050050379A1 (en) * | 2001-12-07 | 2005-03-03 | Invensys Systems, Inc. | Method and apparatus for network fault correction via adaptive fault router |
CN101122798A (en) * | 2007-09-17 | 2008-02-13 | 浙江中控技术有限公司 | Method for implementing working main station and standby main station synchronous recording |
US20100128599A1 (en) * | 2008-11-21 | 2010-05-27 | Satoshi Nishiyama | Telephone system, gateway for telephone system, and redundancy switching method |
CN103167543A (en) * | 2011-12-19 | 2013-06-19 | 中国科学院沈阳自动化研究所 | Redundance gateway based on windows image acquisition (WIA) network |
CN107453913A (en) * | 2017-08-14 | 2017-12-08 | 深圳通业科技股份有限公司 | Possesses the gateway redundancy method of high-speed communication between processor |
US20180006876A1 (en) * | 2015-01-28 | 2018-01-04 | Nec Corporation | Network relay apparatus, gateway redundancy system, program, and redundancy method |
CN108289050A (en) * | 2018-01-25 | 2018-07-17 | 北京海智元科技有限公司 | A kind of transmitter loop network control system and control method |
CN109905279A (en) * | 2019-03-01 | 2019-06-18 | 北京龙鼎源科技股份有限公司 | Communication means and device, storage medium, electronic device |
CN110515295A (en) * | 2019-07-25 | 2019-11-29 | 南京南瑞继保电气有限公司 | A kind of method of the redundancy I/O module of dynamic and configurable |
-
2021
- 2021-01-21 CN CN202110079796.4A patent/CN112650048B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050050379A1 (en) * | 2001-12-07 | 2005-03-03 | Invensys Systems, Inc. | Method and apparatus for network fault correction via adaptive fault router |
CN101122798A (en) * | 2007-09-17 | 2008-02-13 | 浙江中控技术有限公司 | Method for implementing working main station and standby main station synchronous recording |
US20100128599A1 (en) * | 2008-11-21 | 2010-05-27 | Satoshi Nishiyama | Telephone system, gateway for telephone system, and redundancy switching method |
CN103167543A (en) * | 2011-12-19 | 2013-06-19 | 中国科学院沈阳自动化研究所 | Redundance gateway based on windows image acquisition (WIA) network |
US20180006876A1 (en) * | 2015-01-28 | 2018-01-04 | Nec Corporation | Network relay apparatus, gateway redundancy system, program, and redundancy method |
CN107453913A (en) * | 2017-08-14 | 2017-12-08 | 深圳通业科技股份有限公司 | Possesses the gateway redundancy method of high-speed communication between processor |
CN108289050A (en) * | 2018-01-25 | 2018-07-17 | 北京海智元科技有限公司 | A kind of transmitter loop network control system and control method |
CN109905279A (en) * | 2019-03-01 | 2019-06-18 | 北京龙鼎源科技股份有限公司 | Communication means and device, storage medium, electronic device |
CN110515295A (en) * | 2019-07-25 | 2019-11-29 | 南京南瑞继保电气有限公司 | A kind of method of the redundancy I/O module of dynamic and configurable |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113950168A (en) * | 2021-10-14 | 2022-01-18 | 成都锦城学院 | High-reliability redundant backup 4G/5G safe edge computing gateway |
CN114563946A (en) * | 2022-04-28 | 2022-05-31 | 深圳斯凯达控制技术有限公司 | Control method and system for industrial monitoring redundant system with cooperation of gateway and PLC |
CN114563946B (en) * | 2022-04-28 | 2022-07-15 | 深圳斯凯达控制技术有限公司 | Control method and system for industrial monitoring redundant system with cooperation of gateway and PLC |
CN115001898A (en) * | 2022-05-07 | 2022-09-02 | 通号城市轨道交通技术有限公司 | Network equipment redundant communication system and method |
Also Published As
Publication number | Publication date |
---|---|
CN112650048B (en) | 2021-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112887133B (en) | Redundancy switching method for industrial gateway, industrial gateway and storage medium | |
CN112650048B (en) | Industrial gateway redundancy system and control method | |
CN110750480B (en) | Dual-computer hot standby system | |
CN109344014B (en) | Main/standby switching method and device and communication equipment | |
CN110601945A (en) | Dual-redundancy CAN bus communication system and communication method | |
CN107248933A (en) | A kind of method of the double main protection of rail traffic signal system | |
CN104485738A (en) | Dual computer switchover alarming non-disturbance processing method for intelligent substation monitoring system | |
CN112346925A (en) | Process-level dual-computer hot standby redundancy system and method | |
CN105095008A (en) | Distributed task fault redundancy method suitable for cluster system | |
KR100976710B1 (en) | Gateway device for car | |
CN113225207A (en) | Method and device for synchronizing active and standby messages of power system | |
CN111698136B (en) | Data transmission method and data transmission system of high-reliability PLC | |
GB2237907A (en) | Information handling system | |
JP3867047B2 (en) | Fault tolerant computer array and method of operation thereof | |
CN115396752A (en) | Redis-based biplane data acquisition method and system | |
CN112821980B (en) | Clock synchronization system, method and device for industrial automation system | |
JP3884643B2 (en) | Process control device | |
JPH05225161A (en) | Network monitoring system | |
CN111064608A (en) | Master-slave switching method and device of message system, electronic equipment and storage medium | |
JP7306983B2 (en) | Controller and facility monitoring system | |
JP2633351B2 (en) | Control device failure detection mechanism | |
JPH05304528A (en) | Multiplex communication node | |
JP7431034B2 (en) | Controller and facility monitoring system | |
JP3706332B2 (en) | Process control device | |
CN114039695A (en) | Time synchronization method of redundant network, redundant network system and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |