Alarm method and device of redundant master station system, electronic equipment and storage medium

By judging the abnormal communication status between the master and slave stations in the redundant master station system and setting a preset time threshold, the problem of unnecessary alarms during the master-support switching process is solved, and the effect of reducing user disturbances is achieved.

CN119676053APending Publication Date: 2025-03-21HANGZHOU HOLLYSYS AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411629142.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The redundant master station system may cause unnecessary communication interruption alarms during the main and standby switching process, causing disturbance to users.

Method used

By obtaining the communication status of the first master station and the second master station and the slave station, it is determined whether there is a communication exception between the master station and the slave station, and the duration of the communication exception is determined. If the duration reaches the preset time threshold, an alarm message is generated.

Benefits of technology

It reduces unnecessary communication interrupt alarms, effectively blocks the communication state jitter of the redundant master system during master-slave switching, and reduces psychological disturbance to users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676053A_ABST
    Figure CN119676053A_ABST
Patent Text Reader

Abstract

The invention discloses an alarm method and device of a redundant master station system, electronic equipment and a storage medium. According to the scheme, whether communication abnormity occurs between a master station and a slave station is judged through a first communication state and a second communication state, and under the condition that the communication abnormity occurs between the master station and the slave station, the duration time of the communication abnormity between the master station and the slave station is determined. And only when the duration time reaches a preset time threshold value, generating an alarm message to prompt that communication interruption occurs between the master station and the slave station. Therefore, unnecessary communication interruption alarms are reduced, and communication state jitter caused by master-slave switching of the redundant master station system can be effectively shielded to cause unnecessary psychological disturbance to users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to an alarm method and device, electronic equipment and storage medium for a redundant master station system. Background Art

[0002] The current data acquisition system usually adopts the redundant master station solution, that is, two mutually redundant master stations are set up at the master station end. One master station is used as the main master station to communicate with the slave station equipment, while the other is used as the backup master station and is in a silent state. When the communication between the main master station and the slave station equipment fails, the system will automatically perform the main and backup switching, that is, the backup master station takes over the communication task and becomes the new main master station.

[0003] However, during the master-slave switch, the system may be in a masterless state, that is, both master stations communicate abnormally with the slave station equipment, although this situation can usually be quickly resolved by master-slave switch. However, during the master-slave switch, a communication interruption alarm will be triggered. Since the communication between the master station and the slave station will be restored quickly, the communication interruption alarm will actually cause unnecessary disturbance to the user. Summary of the invention

[0004] In view of this, the embodiments of the present application are dedicated to providing an alarm method and device, an electronic device and a storage medium for a redundant master station system, which can reduce the disturbance to users caused by communication interruption alarms generated during the master-slave switching process.

[0005] According to a first aspect of an embodiment of the present application, there is provided an alarm method for a redundant master station system, comprising:

[0006] Acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station;

[0007] According to the first communication state and the second communication state, determining whether communication abnormality occurs between the master station and the slave station; the master station includes the first master station and the second master station;

[0008] In the case where communication abnormality occurs between the master station and the slave station, determining the duration of the communication abnormality between the master station and the slave station;

[0009] If the duration reaches a preset time threshold, an alarm message is generated.

[0010] Optionally, the first master station serves as a primary master station, and the second master station serves as a backup master station;

[0011] The determining, according to the first communication state and the second communication state, whether communication abnormalities occur between the master station and the slave station includes:

[0012] Determine whether the communication between the first master station and the slave station is normal at the current moment according to the first communication state;

[0013] According to the first communication state at the last moment and the second communication state at the last moment, determining whether both the first master station and the second master station communicate abnormally with the slave station at the last moment;

[0014] If communication between the first master station and the slave station is abnormal at the current moment, and at least one of the first master station and the second master station communicated normally with the slave station at the previous moment, it is determined that communication abnormality occurs between the master station and the slave station.

[0015] Optionally, the method further includes:

[0016] If the third communication status indicates that the communication between the active master station and the slave station is normal at the current moment, and the fourth communication status indicates that the communication between the first master station and the second master station and the slave station was abnormal at the previous moment, a prompt message is generated; the prompt message is used to notify that the communication between the master station and the slave station has returned to normal.

[0017] Optionally, before generating the alarm message, the method further includes:

[0018] The theoretical maximum time required for the master station to establish a communication connection with the slave station is calculated to obtain the preset time threshold.

[0019] Optionally, the calculating the theoretical maximum time required for the master station to establish a communication connection with the slave station includes:

[0020] The theoretical maximum time is calculated based on the maximum time required for the master station to establish a communication connection with each of the slave stations.

[0021] Optionally, the calculating the theoretical maximum time required for the master station to establish a communication connection with the slave station includes:

[0022] The theoretical maximum time is obtained according to historical time statistics of establishing a communication connection between the master station and the slave station.

[0023] Optionally, the calculating a theoretical maximum time required for the master station to establish a communication connection with the slave station to obtain the preset time threshold includes:

[0024] Calculating the theoretical maximum time required for the master station to establish a communication connection with each of the slave stations;

[0025] The sum of the theoretical maximum time and the fluctuation compensation time is calculated to obtain the preset time threshold.

[0026] According to a second aspect of an embodiment of the present application, an alarm device for a redundant master station system is provided, wherein the redundant master station system includes a slave station, and a first master station and a second master station that are redundant to each other; the device includes:

[0027] An acquisition module, used to acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station;

[0028] A state determination module, used for judging whether communication abnormality occurs between the master station and the slave station according to the first communication state and the second communication state; the master station includes the first master station and the second master station;

[0029] A timing module, used for determining the duration of the communication anomaly between the master station and the slave station when communication anomaly occurs between the master station and the slave station;

[0030] The alarm module is used to generate an alarm message if the duration reaches a preset time threshold.

[0031] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; and the processor is used to execute the method described in any one of the above embodiments.

[0032] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the method described in any of the above embodiments.

[0033] The embodiments of the present application provide an alarm method and device, electronic device and storage medium for a redundant master station system. In this scheme, the first communication state and the second communication state are used to determine whether communication anomalies occur between the master station and the slave station. In the case where communication anomalies occur between the master station and the slave station, the duration of the communication anomaly between the master station and the slave station is determined. Only when the duration reaches a preset time threshold, an alarm message is generated to prompt that communication interruption occurs between the master station and the slave station. This reduces unnecessary communication interruption alarms and can effectively shield the communication state jitter when the redundant master station system switches from master to slave, causing unnecessary psychological disturbances to users. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 Shown is a schematic diagram of an implementation environment provided by an embodiment of the present application.

[0035] Figure 2 The figure is a flow chart of an alarm method for a redundant master station system provided in one embodiment of the present application.

[0036] Figure 3 Shown is a block diagram of an alarm device for a redundant master station system provided by an embodiment of the present application.

[0037] Figure 4 Shown is a structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] Application Overview

[0040] The communication between the Supervisory Control And Data Acquisition (SCADA) and the underlying equipment is completed by the redundant master station system. The redundant master station system is a commonly used system solution for data acquisition systems. The main idea of ​​this solution is to build two master stations (Front-End Processor, FEP, also known as front-end processor) to communicate with the slave station (i.e. the underlying equipment) to avoid the situation where the monitoring system cannot obtain data due to a master station failure, thereby improving the robustness and stability of the system, and better providing customers with safer and more reliable services.

[0041] The two master stations in the redundant master station system are redundant to each other. One master station communicates with the slave station equipment as the main master station, and the other serves as the backup master station. When a communication failure occurs between the main master station and the slave station equipment, the system will automatically perform the main-backup switch, that is, the backup master station takes over the communication task and becomes the new main master station.

[0042] When the communication between the active master station and the slave device fails, it takes a certain amount of time for the standby master station to establish a communication connection with the slave device, and the redundant master station system will be in a masterless state, that is, both master stations communicate abnormally with the slave device, which will trigger a communication interruption alarm. In actual applications, the communication between the master station and the slave device will generally be restored quickly, and the communication interruption alarm is essentially unnecessary to disturb the user.

[0043] In order to solve the above problem, after the communication between the active master station and the slave station device fails, the embodiment of the present application does not immediately trigger the communication interruption alarm, but delays for a period of time before triggering the communication interruption alarm. If the communication returns to normal during this period of time, the communication interruption alarm will not be issued. This reduces unnecessary communication interruption alarms, and can effectively shield the communication state jitter when the redundant master station system switches from master to slave, causing unnecessary psychological disturbances to the user.

[0044] After introducing the basic principles of the present application, various non-limiting embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0045] Exemplary Systems

[0046] Figure 1 Shown is a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment includes a first master station FEP-A, a second master station FEP-B, and a slave station. The first master station FEP-A and the second master station FEP-B are redundant and backup for each other. Both can establish a communication connection with the slave station, one master station acts as the main master station to communicate with the slave station equipment, and the other acts as a backup master station to take over the communication task when necessary. At the same time, point-to-point communication is established between the two, that is, an Ethernet or dedicated serial port channel is set between the two master stations, or an Ethernet or dedicated serial port channel is set at the same time, which is called a heartbeat line. Through the heartbeat line, any master station can know the communication status of the other party with the slave station.

[0047] Exemplary Methods

[0048] Figure 2 It is a flowchart of an alarm method for a redundant master station system provided in an embodiment of the present application.

[0049] Figure 2 The method is executed by the first master station or the second master station.

[0050] like Figure 2 As shown, the method includes the following contents:

[0051] Step S210: Acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station.

[0052] In an embodiment of the present application, the first communication state is used to indicate whether a communication connection is established between the first master station and the slave station; if a communication connection is established between the first master station and the slave station, it can be recorded as FEPADevState=1, otherwise it can be recorded as FEPADevState=0.

[0053] Similarly, the second communication state is used to indicate whether a communication connection is established between the second master station and the slave station; if a communication connection is established between the second master station and the slave station, it can be recorded as FEPBDevState=1, otherwise it can be recorded as FEPBDevState=0.

[0054] In an embodiment of the present application, the first master station or the second master station may obtain the communication status between the other party and the slave station at a preset period, and may obtain the first communication status and the second communication status. For example, the communication status between the other party and the slave station may be obtained by periodic heartbeat using a heartbeat line.

[0055] In an embodiment of the present application, the first master station or the second master station can connect to and communicate with the slave station in TCP client single link mode, TCP client multi-link mode, serial port mode or UDP mode.

[0056] Step S220: judging whether communication abnormalities occur between the master station and the slave station according to the first communication status and the second communication status; the master station includes the first master station and the second master station.

[0057] In the embodiment of the present application, the communication abnormality between the master station and the slave station may refer to the communication abnormality between the first master station and the second master station and the slave station at the same time, that is, the redundant master station system is in a masterless state. The communication normality between the master station and the slave station may refer to the communication normality between at least one of the first master station and the second master station and the slave station at the same time.

[0058] Step S230: when communication anomalies occur between the master station and the slave station, determine the duration of the communication anomaly between the master station and the slave station.

[0059] In the embodiment of the present application, the duration may refer to the duration of the communication anomaly between the first master station and the second master station and the slave station. Specifically, when the redundant master station system is in a masterless state, the time between the start time when the communication anomaly between the two master stations and the slave station occurs simultaneously and the current time.

[0060] Step S240: If the duration reaches a preset time threshold, an alarm message is generated.

[0061] In the embodiment of the present application, the preset time threshold can be used to indicate the waiting time before triggering the communication interruption alarm after a communication anomaly occurs between two master stations and slave stations at the same time. The preset time threshold can be an empirical value set according to actual needs, or it can be calculated according to the communication mode between the master station and the slave station.

[0062] In the embodiment of the present application, the alarm message is used to prompt that a communication abnormality occurs between the master station and the slave station.

[0063] In an embodiment of the present application, the method also includes: after communication abnormalities occur between the master station and the slave station, before the duration reaches a preset time threshold, if any master station resumes communication with the slave station, a communication interruption alarm will not be triggered.

[0064] In an embodiment of the present application, the method further includes: after communication abnormalities occur between the master station and the slave station, if communication between any master station and the slave station is restored, generating a prompt message for notifying that communication between the master station and the slave station has returned to normal.

[0065] In the embodiment of the present application, the first communication state and the second communication state are used to determine whether communication anomalies occur between the master station and the slave station. In the case where communication anomalies occur between the master station and the slave station, the duration of the communication anomaly between the master station and the slave station is determined. Only when the duration reaches a preset time threshold, an alarm message is generated to prompt that communication interruption occurs between the master station and the slave station. This reduces unnecessary communication interruption alarms and can effectively shield the communication state jitter when the redundant master station system switches from the master to the slave station, causing unnecessary psychological disturbances to the user.

[0066] based on Figure 2 The method in this specification also provides some specific implementation plans of the method, which are described below.

[0067] Optionally, the first master station serves as a primary master station, and the second master station serves as a backup master station;

[0068] The determining, according to the first communication state and the second communication state, whether communication abnormalities occur between the master station and the slave station includes:

[0069] Determine whether the communication between the first master station and the slave station is normal at the current moment according to the first communication state;

[0070] According to the first communication state at the last moment and the second communication state at the last moment, determining whether both the first master station and the second master station communicate abnormally with the slave station at the last moment;

[0071] If communication between the first master station and the slave station is abnormal at the current moment, and at least one of the first master station and the second master station communicated normally with the slave station at the previous moment, it is determined that communication abnormality occurs between the master station and the slave station.

[0072] In an embodiment of the present application, the primary master station is used to communicate with the slave station, and the backup master station is used to back up the primary master station. If a communication failure occurs between the primary master station and the slave station device, the backup master station takes over the communication task and becomes the new primary master station.

[0073] In the embodiment of the present application, if the third communication state is used to indicate whether the communication between the primary master station and the slave station is normal at the current moment; when the first master station is the primary master station, the third communication state is the first communication state; when the second master station is the primary master station, the third communication state is the second communication state. The first master station and the second master station both record state information indicating whether the machine is the primary master station. According to the state information, as well as the first communication state and the second communication state, the third communication state can be determined.

[0074] If the communication between the active master station and the slave station is normal at the current moment, the third communication state may be recorded as HotDevState=1, otherwise it may be recorded as HotDevState=0.

[0075] In the embodiment of the present application, if the fourth communication state is used to indicate whether at least one of the first master station and the second master station communicates normally with the slave station at the previous moment; and the fifth communication state is used to indicate whether at least one of the first master station and the second master station communicates normally with the slave station at the current moment, then the fourth communication state is the fifth communication state at the previous moment. The fifth communication state FEPDevStateAB = FEPADevState|FEPBDevState, where FEPADevState is the first communication state, FEPBDevState is the second communication state, and | represents an OR operation.

[0076] The fifth communication state is essentially used to indicate whether the redundant master station system is in a masterless state. That is, if at least one of the first master station and the second master station communicates normally with the slave station at the current moment, that is, the redundant master station system is not in a masterless state, the fifth communication state is recorded as FEPDevStateAB=1; if at the current moment, both the first master station and the second master station communicate abnormally with the slave station, that is, the redundant master station system is in a masterless state, the fifth communication state is recorded as FEPDevStateAB=0. If at the last moment, at least one of the first master station and the second master station communicates normally with the slave station, the fourth communication state is recorded as LastFEPDevStateAB=1; if at the last moment, both the first master station and the second master station communicate abnormally with the slave station, the fourth communication state is recorded as LastFEPDevStateAB=0.

[0077] In the case of LastFEPDevStateAB=1, HotDevState=0, Tg≥Td (where Tg is the duration and Td is the preset time threshold), the alarm message is generated. That is, the fourth communication state indicates that at least one of the first master station and the second master station communicated normally with the slave station at the previous moment, the third communication state indicates that the communication between the active master station and the slave station is abnormal at the current moment, and the duration reaches the preset time threshold, the alarm message is generated.

[0078] When LastFEPDevStateAB=1、HotDevState=0、Tg<Td, wait for the program to execute and do not generate the alarm message temporarily. That is, when the fourth communication state indicates that the redundant master station system is not in a masterless state at the previous moment, and the third communication state indicates that the communication between the active master station and the slave station is abnormal at the current moment, and the duration has not reached the preset time threshold, continue to wait and do not generate the alarm message temporarily.

[0079] When LastFEPDevStateAB=1 and HotDevState=1, that is, the fourth communication state indicates that the redundant master station system was not in a masterless state at the previous moment, and the third communication state indicates that the communication between the active master station and the slave station is normal at the current moment, there are two situations at this time: one situation is that the redundant master station system operates normally, and the communication interruption alarm will not be triggered, and there is no need to generate the alarm message; the other situation is that since HotDevState is cyclically updated according to a preset period (for example, 1 second), and the time required for communication recovery is short (tens of ms), although a communication interruption occurred, the communication was restored in time. At this time, the communication interruption alarm will not be triggered, and there is no need to generate the alarm message.

[0080] When LastFEPDevStateAB=0 and HotDevState=1, the fourth communication state indicates that the redundant master station system was in a masterless state at the previous moment, and the third communication state indicates that the communication between the active master station and the slave station is normal at the current moment, that is, the redundant master station system has experienced a communication interruption, but the redundant master station system has now returned to normal. At this time, a prompt message is generated to report the communication recovery event between the master station and the device.

[0081] When LastFEPDevStateAB=0 and HotDevState=0, that is, the fourth communication state indicates that the redundant master station system is in a masterless state at the previous moment, and the third communication state indicates that the communication between the active master station and the slave station is abnormal at the current moment, the alarm message has been issued in this case. In order to avoid channel congestion due to the continuous and repeated issuance of the alarm message, there is no need to generate the alarm message at this time.

[0082] In an embodiment of the present application, the first master station or the second master station can obtain the communication status between the other party and the slave station at a preset period. After obtaining the communication status between the other party and the slave station, the third communication status and the fifth communication status are calculated cyclically, and the fifth communication status at the previous moment is updated to the fourth communication status at the current moment. It should be noted that when the preset time threshold is set to be greater than the preset period, the update of the fourth communication status is suspended before the duration reaches the preset time threshold.

[0083] LastFEPDevStateAB is used to prevent the alarm message from being sent out normally, that is, to prevent the redundant master station system from changing directly from the state of LastFEPDevStateAB=1, HotDevState=0, Tg<Td to the state of LastFEPDevStateAB=0, HotDevState=0.

[0084] In the embodiment of the present application, after LastFEPDevStateAB=0 or HotDevState=0 occurs, the first communication state, the second communication state, the third communication state and the fifth communication state may be continuously recorded in a time series manner. The duration of the abnormal communication between the master station and the slave station is determined only based on the third communication state or the fifth communication state.

[0085] In an embodiment of the present application, when communication anomalies occur between the master station and the slave station, determining the duration of the communication anomaly between the master station and the slave station includes: when the fourth communication state begins to appear, indicating that at least one of the first master station and the second master station communicates normally with the slave station at the previous moment, and the third communication state indicates that the communication between the main master station and the slave station at the current moment is abnormal (i.e., LastFEPDevStateAB=1, HotDevState=0), start timing to obtain the duration of the communication anomaly between the master station and the slave station. When the communication between the first master station or the second master station and the slave station returns to normal (i.e., FEPADevState=1 or FEPBDevState=1), stop timing; or stop timing after the alarm message is issued.

[0086] In an embodiment of the present application, based on the first communication state and the second communication state, a third communication state is obtained to indicate whether the communication between the main master station and the slave station is normal at the current moment, and a fourth communication state is obtained to indicate whether the communication between the master station and the slave station was abnormal at the previous moment; based on the third communication state and the fourth communication state, the abnormal start time of the communication abnormality between the master station and the slave station can be accurately determined.

[0087] Optionally, the method further includes:

[0088] If the communication between the active master station and the slave station is normal at the current moment, and the communication between the first master station and the second master station and the slave station was abnormal at the previous moment, a prompt message is generated; the prompt message is used to notify that the communication between the master station and the slave station has returned to normal.

[0089] In an embodiment of the present application, before the prompt message is generated, the duration of the abnormal communication between the master station and the slave station reaches a preset time threshold, and an alarm message has been issued. If the communication between any master station and the slave station is restored to normal, this master station will be determined as the new primary master station. At this time, a prompt message is issued to notify that the communication between the master station and the slave station has returned to normal.

[0090] Optionally, before generating the alarm message, the method further includes:

[0091] The theoretical maximum time required for the master station to establish a communication connection with the slave station is calculated to obtain the preset time threshold.

[0092] In the embodiment of the present application, the theoretical maximum time is the longest time theoretically required for the master station to establish a transport layer communication protocol connection with each of the slave stations.

[0093] In an embodiment of the present application, the preset time threshold is determined by the theoretical maximum time required for the master station to establish a communication connection with each of the slave stations, which helps to accurately determine the timing of sending the alarm message, that is, to avoid sending the alarm message before the communication between the master station and the slave station is likely to return to normal, thereby further reducing disturbance to the user; and to send the alarm message in a timely manner after the communication between the master station and the slave station is unlikely to return to normal.

[0094] Optionally, the calculating the theoretical maximum time required for the master station to establish a communication connection with the slave station includes:

[0095] The theoretical maximum time is calculated based on the maximum time required for the master station to establish a communication connection with each of the slave stations.

[0096] In the embodiment of the present application, the communication protocol may be any one of serial communication, UDP protocol, and TCP protocol.

[0097] In the embodiment of the present application, the number of the slave stations is generally multiple, and the master station needs to establish a communication connection with each slave station. The maximum time required for the master station to establish a communication connection with any of the slave stations can be the product of the maximum number of retries of the slave station and the reconnection timeout time.

[0098] In an embodiment of the present application, the theoretical maximum time is affected by multiple factors, such as the number of slave stations, the maximum number of retries, the reconnection timeout, the number of IP addresses, and the communication protocol and connection method between the master station and the slave station.

[0099] In practical applications, if the master station and the slave station establish a communication connection through a serial communication protocol (such as RS-232, RS-485), UDP protocol (User Datagram Protocol), or TCP protocol client multi-link mode, the theoretical maximum time can be the sum of the product of the maximum number of retries of each slave station and the response timeout time. Specifically, the calculation formula of the theoretical maximum time is:

[0100]

[0101] In the formula, Trc is the theoretical maximum time, N is the number of slaves, i is the slave serial number, n is the i represents the maximum number of retries for the ith device, T i Indicates the response timeout after sending a request to the i-th device and waiting for the device to respond. Usually 1≤n i ≤3, 100ms≤T i ≤10000ms.

[0102] For example, if the number of slaves is 1, the maximum number of retries of the slave is 2, and the response timeout is 500ms. Substituting into the above formula, the theoretical maximum time is 1000ms. If the number of slaves is 3, the maximum number of retries of each slave is 2, and the response timeout of each slave is 500ms. Substituting into the above formula, the theoretical maximum time is 3000ms.

[0103] In fact, it is often not necessary to retry repeatedly when the master station establishes a communication connection with each slave station. In most cases, it can be successful in one try. The normal time for the master station to establish a communication connection with each slave station can be calculated by the following formula:

[0104]

[0105] Where Tr is the normal time, N is the number of slaves, d is the rest time after the master successfully receives the slave's response and sends the next connection request, t i It represents the time interval from sending a request to the i-th device to receiving a response from the device.

[0106] The rest time d can be used to control the communication load. That is, the smaller d is, the greater the communication load is. In serial communication, the typical value of d is 100ms. iThe typical value of d is 50ms; in UDP mode and TCP client multi-link mode, the typical value of d is 10ms, i The typical value is 5ms.

[0107] If the master station and the slave station establish a communication connection through the serial communication standard, if the number of slave stations is 1, the normal time tr for the master station to establish a communication connection with each slave station is 50ms, which is much less than the theoretical maximum time of 1000ms; if the number of stations is 3, the normal time tr for the master station to establish a communication connection with each slave station is 350ms, which is much less than the theoretical maximum time of 1000ms.

[0108] If the master station and the slave station establish a communication connection through the UDP protocol and the TCP protocol client multi-link mode, if the number of slave stations is 1, the normal time tr for the master station to establish a communication connection with each slave station is 5ms, which is much less than the theoretical maximum time of 1000ms; if the number of slave stations is 3, the normal time tr for the master station to establish a communication connection with each slave station is 35ms, which is much less than the theoretical maximum time of 1000ms.

[0109] In practical applications, if the master station and the slave station establish a communication connection through the TCP protocol client but link mode, the theoretical maximum time includes not only the sum of the product of the maximum number of retries and the response timeout of each slave station, but also the sum of the number of reconnections and the reconnection timeout of each IP at each slave station. Specifically, the calculation formula of the theoretical maximum time is:

[0110]

[0111] Where M is the total number of IP addresses at the slave station, that is, the sum of the number of IP addresses from each slave station; j is the sequence number of the IP address, R j is the number of reconnections of the jth IP address, C j is the reconnection timeout of the jth IP address. Usually 1≤R i ≤3,500ms≤C i ≤10000ms. N represents the number of slaves, i is the slave serial number, n i represents the maximum number of retries for the ith device, T i Indicates the response timeout after sending a request to the i-th device and waiting for the device to respond. Usually 1≤n i ≤3, 100ms≤T i ≤10000ms.

[0112] For example, the total number of IP addresses at the slave station is 1 (ie, M=1), the number of reconnections for the IP address is 1, and the reconnection timeout is 1000ms. If the number of slave stations is 1, the maximum number of retries for the slave station is 2, and the response timeout is 500ms. Substituting into the above formula, we can get a theoretical maximum time of 2000ms.

[0113] In the disclosed embodiment, the theoretical maximum time is calculated based on the maximum time required for the master station to establish a communication connection with each of the slave stations, and the preset time threshold thus obtained can help to more accurately control the sending time of the alarm message.

[0114] Optionally, the calculating the theoretical maximum time required for the master station to establish a communication connection with the slave station includes:

[0115] The theoretical maximum time is obtained according to historical time statistics of establishing a communication connection between the master station and the slave station.

[0116] In the embodiment of the present application, the theoretical maximum time may be obtained by statistics of the historical time, for example, the theoretical maximum time may be the maximum value, average value, etc. of the historical time. The average value may refer to the historical time in the recent period calculated by a simple moving average algorithm, a weighted moving average algorithm, or an exponential moving average algorithm.

[0117] In some cases, the theoretical maximum time can be calculated by the standard deviation σ and the mean μ of the historical time, that is, the theoretical maximum time can be taken as μ+aσ (for example, μ+σ, μ+2σ, μ+3

[0118] σ).

[0119] In practical applications, during periodic switching, periodic diagnosis, etc., the master station may need to establish a communication connection with the slave station, and the time actually spent by the master station and the slave station to establish a communication connection is more valuable for reference. In the embodiment of the present disclosure, by counting the historical time of the master station and the slave station to establish a communication connection, the theoretical maximum time is obtained, and the preset time threshold thus obtained can help to more accurately control the sending time of the alarm message.

[0120] Optionally, the calculating a theoretical maximum time required for the master station to establish a communication connection with the slave station to obtain the preset time threshold includes:

[0121] Calculating the theoretical maximum time required for the master station to establish a communication connection with each of the slave stations;

[0122] The sum of the theoretical maximum time and the fluctuation compensation time is calculated to obtain the preset time threshold.

[0123] In the embodiment of the present application, the fluctuation compensation time can be set according to actual conditions.

[0124] In the embodiment of the present application, the preset time threshold Td=Trc+δT, where Trc is the theoretical maximum time and δT is the fluctuation compensation time. The range of the fluctuation compensation time can be set to 0≤δT≤500ms.

[0125] In the communication system, the actual communication connection time may fluctuate due to various unpredictable factors, such as network delay, signal interference, hardware performance differences, etc. In the embodiment of the present application, by introducing the fluctuation compensation time, these uncertainties are compensated and corrected to a certain extent, so that the preset time threshold is more in line with the actual communication situation, and the alarm timing is more in line with the on-site use requirements.

[0126] Exemplary Devices

[0127] The device embodiments of the present application can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0128] Figure 3 FIG. 1 is a block diagram of an alarm device for a redundant master station system provided by an embodiment of the present application. Figure 3 As shown, the device 300 includes:

[0129] An acquisition module 310 is used to acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station;

[0130] A state determination module 320, configured to determine whether communication abnormalities occur between the master station and the slave station according to the first communication state and the second communication state; the master station includes the first master station and the second master station;

[0131] The timing module 330 is used to determine the duration of the communication anomaly between the master station and the slave station when the communication anomaly occurs between the master station and the slave station;

[0132] The alarm module 340 is configured to generate an alarm message if the duration reaches a preset time threshold.

[0133] Optionally, the first master station serves as a primary master station, and the second master station serves as a backup master station;

[0134] The determining, according to the first communication state and the second communication state, whether communication abnormalities occur between the master station and the slave station includes:

[0135] Determine whether the communication between the first master station and the slave station is normal at the current moment according to the first communication state;

[0136] According to the first communication state at the last moment and the second communication state at the last moment, determining whether both the first master station and the second master station communicate abnormally with the slave station at the last moment;

[0137] If communication between the first master station and the slave station is abnormal at the current moment, and at least one of the first master station and the second master station communicated normally with the slave station at the previous moment, it is determined that communication abnormality occurs between the master station and the slave station.

[0138] Optionally, the alarm module 340 is further used for:

[0139] If the third communication status indicates that the communication between the active master station and the slave station is normal at the current moment, and the fourth communication status indicates that the communication between the first master station and the second master station and the slave station was abnormal at the previous moment, a prompt message is generated; the prompt message is used to notify that the communication between the master station and the slave station has returned to normal.

[0140] Optionally, the device 300 further includes:

[0141] The threshold calculation module is used to calculate the theoretical maximum time required for the master station to establish a communication connection with the slave station to obtain the preset time threshold.

[0142] Optionally, the threshold calculation module is used to calculate the theoretical maximum time based on the maximum time required for the master station to establish a communication connection with each of the slave stations.

[0143] Optionally, the threshold calculation module is used to obtain the theoretical maximum time based on historical time statistics of establishing a communication connection between the master station and the slave station.

[0144] Optionally, the threshold calculation module is used to:

[0145] Calculating the theoretical maximum time required for the master station to establish a communication connection with each of the slave stations;

[0146] The sum of the theoretical maximum time and the fluctuation compensation time is calculated to obtain the preset time threshold.

[0147] Exemplary Electronic Devices

[0148] Below, reference Figure 4 To describe an electronic device according to an embodiment of the present application. Figure 4 A block diagram of an electronic device according to an embodiment of the present application is illustrated.

[0149] like Figure 4 As shown, electronic device 400 includes one or more processors 410 and memory 420 .

[0150] The processor 410 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0151] The memory 420 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 410 may run the program instructions to implement the alarm method of the redundant master station system of each embodiment of the present application described above and / or other desired functions. Various contents such as category correspondences may also be stored in the computer-readable storage medium.

[0152] In one example, the electronic device 400 may further include: an input device 430 and an output device 440 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0153] In addition, the input device 430 may also include, for example, a keyboard, a mouse, etc. The output device 440 may output various information to the outside. The output device 440 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0154] Of course, to simplify, Figure 4 Only some of the components related to the present application in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 400 may also include any other appropriate components.

[0155] Exemplary computer program products and computer-readable storage media

[0156] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the alarm method for the redundant master station system according to various embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.

[0157] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and also conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0158] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the alarm method for the redundant master station system according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0159] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0160] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0161] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.

[0162] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0163] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0164] It should be understood that the qualifiers "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present application are only used to more clearly explain the technical solutions and cannot be used to limit the scope of protection of the present application.

[0165] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. An alarm method for a redundant master station system, characterized in that: The redundant master station system includes a slave station, and a first master station and a second master station which are redundant to each other; the method includes: Acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station; According to the first communication state and the second communication state, determining whether communication abnormality occurs between the master station and the slave station; the master station includes the first master station and the second master station; In the case where communication abnormality occurs between the master station and the slave station, determining the duration of the communication abnormality between the master station and the slave station; If the duration reaches a preset time threshold, an alarm message is generated.

2. The method according to claim 1, characterized in that The first master station is used as the main master station, and the second master station is used as the backup master station; The determining, according to the first communication state and the second communication state, whether communication abnormalities occur between the master station and the slave station includes: Determine whether the communication between the first master station and the slave station is normal at the current moment according to the first communication state; According to the first communication state at the last moment and the second communication state at the last moment, determining whether both the first master station and the second master station communicate abnormally with the slave station at the last moment; If communication between the first master station and the slave station is abnormal at the current moment, and at least one of the first master station and the second master station communicated normally with the slave station at the previous moment, it is determined that communication abnormality occurs between the master station and the slave station.

3. The method according to claim 2, characterized in that The method further comprises: If the communication between the active master station and the slave station is normal at the current moment, and the communication between the first master station and the second master station and the slave station was abnormal at the previous moment, a prompt message is generated; the prompt message is used to notify that the communication between the master station and the slave station has returned to normal.

4. The method according to claim 1, characterized in that Before generating the alarm message, the method further includes: The theoretical maximum time required for the master station to establish a communication connection with the slave station is calculated to obtain the preset time threshold.

5. The method according to claim 4, characterized in that The calculating of the theoretical maximum time required for the master station to establish a communication connection with the slave station comprises: The theoretical maximum time is calculated based on the maximum time required for the master station to establish a communication connection with each of the slave stations.

6. The method according to claim 4, characterized in that The calculating of the theoretical maximum time required for the master station to establish a communication connection with the slave station comprises: The theoretical maximum time is obtained according to historical time statistics of establishing a communication connection between the master station and the slave station.

7. The method according to any one of claims 4 to 6, characterized in that The calculating the theoretical maximum time required for the master station to establish a communication connection with the slave station to obtain the preset time threshold comprises: Calculating the theoretical maximum time required for the master station to establish a communication connection with each of the slave stations; The sum of the theoretical maximum time and the fluctuation compensation time is calculated to obtain the preset time threshold.

8. An alarm device for a redundant master station system, characterized in that: The redundant master station system includes a slave station, and a first master station and a second master station which are redundant to each other; the device includes: An acquisition module, used to acquire a first communication state between the first master station and the slave station, and a second communication state between the second master station and the slave station; A state determination module, used for judging whether communication abnormality occurs between the master station and the slave station according to the first communication state and the second communication state; the master station includes the first master station and the second master station; A timing module, used for determining the duration of the communication anomaly between the master station and the slave station when communication anomaly occurs between the master station and the slave station; The alarm module is used to generate an alarm message if the duration reaches a preset time threshold.

9. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to execute the method according to any one of claims 1 to 7. 10 . A computer-readable storage medium having computer program instructions stored thereon, wherein when the computer program instructions are executed by a processor, the processor is enabled to perform the method according to claim 1 .