A method and system for distributed master-slave monitoring with self-diagnostic capabilities.

CN122569310APending Publication Date: 2026-08-14SHAANXI TONGHE ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610694357.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-20
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]针对现有技术的不足,本发明提供了一种具备自诊断功能的分布式主备的主备监控的方法、系统,解决了现有主备监控系统仅支持整机级切换,在设备发生局部硬件故障时无法跨设备调度闲置资源与重组底层链路,导致硬件资源浪费且全局监控业务中断的问题

Benefits of technology

1.本发明利用主备监控内部主从定时器级联触发模数转换电路对齐采样,将求取的采样差值绝对值与引入温度及负载参数的动态设定范围上限进行比对,从而消除了采样时间差带来的判定误差,抑制环境漂移对比较逻辑的干扰,给出局部硬件故障的判定依据。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122569310A_ABST
    Figure CN122569310A_ABST
Patent Text Reader

Abstract

This invention relates to the field of industrial control and monitoring systems, and discloses a method and system for distributed primary / backup monitoring with self-diagnostic capabilities. Addressing the problem of resource idleness and service interruption in existing primary / backup systems during partial hardware failures, the system synchronizes underlying data through a primary / backup communication interface, utilizes internal timer cascading to trigger analog-to-digital conversion circuits for strict sampling alignment, and performs cross-comparison based on dynamic parameter calculations to set an upper limit. The primary and backup serial ports are physically connected in parallel, and the backup side calculates the effective interception rate by listening to bus messages to mutually verify its status. When a partial fault is diagnosed and anti-collision verification passes, the normal device takes over the tasks of the faulty device using resources of the same type, and writes data based on the shared memory base address and hardware index number using absolute physical address mapping. This invention achieves cross-device hardware resource reorganization and sharing, maintaining the continuity of monitoring services under partial faults.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial control and monitoring system technology, specifically to a method and system for distributed master-slave ... Background Technology

[0002] Current power system operation and management typically employs primary and backup monitoring equipment to maintain the continuity of control operations. Under a conventional hot standby mechanism, the primary monitoring equipment is responsible for handling lower-level machine data acquisition and bus communication scheduling tasks, while the backup monitoring equipment remains in hot standby mode. When the system detects a global fault in the primary monitoring equipment, such as a complete power failure or a core program crash, the hardware control logic will disconnect the output channel of the primary monitoring equipment and activate the backup monitoring equipment to take over global control.

[0003] The existing master-slave switchover mechanism suffers from insufficient decision-making dimensions. The system determines whether to perform a device-level overall switchover based solely on power status or software watchdog signals, which is insufficient to cover local hardware failures such as damaged serial ports or broken pins in analog-to-digital conversion circuits. During normal operation of the master monitoring device, the lower-level communication interface of the standby monitoring device is idle, and the analog sampling circuits of both operate independently without data exchange, resulting in idle hardware acquisition channel resources. When different parts of the master and standby devices experience local hardware failures, such as the downlink serial port of the master monitoring device failing and the analog acquisition circuit of the standby monitoring device failing, the existing control logic struggles to transfer the normally functioning analog acquisition data from the master monitoring device to the standby monitoring device, and also struggles to schedule the normally functioning serial port channel of the standby monitoring device to proxy message transmission. This system architecture lacks cross-device hardware resource sharing and underlying physical link reorganization mechanisms, causing both master and standby devices to simultaneously lose their complete monitoring capabilities of the power system under conditions of overlapping local hardware failures, leading to control service interruptions. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a method and system for distributed primary and backup monitoring with self-diagnostic capabilities. This solves the problem that existing primary and backup monitoring systems only support machine-level switching and cannot schedule idle resources and reassemble underlying links across devices when a device experiences a partial hardware failure, resulting in wasted hardware resources and interruption of global monitoring services.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a method and system for distributed primary / backup monitoring with self-diagnostic capabilities, applied to a distributed primary / backup monitoring system, wherein the distributed primary / backup monitoring system includes a primary monitoring system and a backup monitoring system, and the underlying acquisition and communication interfaces of the primary monitoring system and the backup monitoring system are connected in parallel to the same lower-level machine or target sampling node; the method includes: The underlying data obtained by the primary monitoring and the backup monitoring are synchronized through the primary and backup communication interfaces; The primary monitoring system and the backup monitoring system perform mutual self-diagnosis based on the underlying data and dynamic operating parameters to determine whether there are local hardware faults in the primary monitoring system and the backup monitoring system. When a partial hardware failure occurs in either the primary monitoring system or the backup monitoring system, the normal monitoring system uses its own corresponding normal hardware resources of the same type to perform the target acquisition and communication tasks and acquire the target data, and transmits the target data to the monitoring system that experienced the partial hardware failure through the primary / backup communication interface.

[0006] Furthermore, the communication interface between the primary monitoring system and the backup monitoring system is a serial communication port; the synchronization of the underlying data obtained by the primary monitoring system and the backup monitoring system through the primary and backup communication interfaces includes: When the main monitoring is working normally, the communication serial port of the backup monitoring is in a listening state; The backup monitoring analyzes and intercepts the detected communication messages to obtain the data required by the backup monitoring, so as to achieve data synchronization between the main monitoring and the backup monitoring regarding the lower-level machine communication serial port.

[0007] Furthermore, the underlying data includes analog sampling data; the mutual inspection and self-diagnosis based on the underlying data and dynamic operating parameters to determine whether there are local hardware faults in the main monitoring and the backup monitoring includes: Obtain the analog sample data synchronously collected by the main monitoring and the backup monitoring, and calculate the difference between the two; When the difference exceeds the set range, the current dynamic operating parameters are obtained, including temperature status, load status, and timed equalization charging status. Based on the difference and the dynamic operating parameters, determine whether the cause of the difference in the analog sampled data is a local hardware failure.

[0008] Furthermore, the method for determining the set range includes: providing a basic fixed threshold as the initial set range; performing trend analysis on the historical operating data of the main monitoring and the backup monitoring, and dynamically and adaptively adjusting the basic fixed threshold based on the analysis results to generate the real-time set range.

[0009] Specifically, to eliminate the interference of environmental temperature drift and operating condition fluctuations on the sampling accuracy of analog quantities and to improve the accuracy of local hardware fault diagnosis, the set range is adjusted in real time. The following adaptive compensation formula is used for calculation: ; in: The basic fixed threshold is set based on the factory-rated accuracy of the underlying ADC hardware or initial calibration experience data. Temperature change, i.e., the difference between the current ambient temperature of the equipment and the standard reference temperature, is collected in real time by the temperature sensor inside the monitoring system. Temperature drift coefficient, obtained by trend analysis and curve fitting of historical operating data of the main monitoring and the backup monitoring at different temperatures; Load status parameters, obtained in real time by the system, specify the current power or current load percentage; The load impact factor is calculated in advance based on a large amount of historical test experience data under different load conditions. Equalization charging compensation constant. When the system dynamic operating parameters show that it is in timed equalization charging state, this item takes the set empirical value due to the normal rise and fluctuation of the bus voltage; when it is not in timed equalization charging state, this item is zero.

[0010] Furthermore, the underlying data also includes the serial port operating status, which is categorized into inactive, normal, abnormal, and busy. The mutual inspection and self-diagnosis process includes: The main monitoring system periodically reports the serial port working status and transmit / receive status of the main monitoring system to the backup monitoring system through the main-backup communication interface. The backup monitoring analyzes the message content, transmission period, and baud rate acquired when in the listening state to determine whether the main monitoring's communication serial port has the local hardware fault. The backup monitor informs the main monitor of its serial port working status and receiving status, so as to realize mutual verification of the sending and receiving status of the main monitor and the backup monitor.

[0011] Furthermore, the normal hardware resource of the other party uses its own corresponding normal hardware resources of the same type to replace the faulty hardware resource to perform the target acquisition and communication tasks and obtain target data, including: When one party determines that the other party has an abnormal data interaction by analyzing the synchronized underlying data, it sends a hardware management request to the other party. Upon receiving the hardware management request, the other party determines whether it has any data loss anomalies. If a data loss anomaly is found, it is confirmed that a partial hardware failure has occurred on one side, and the hardware management request is agreed upon, allowing the normal party to take over the work corresponding to the faulty hardware resource using the same type of normal hardware resource.

[0012] Furthermore, the primary monitoring and the backup monitoring correspond to the same monitoring program in terms of program architecture, and both are configured with shared memory; the transmission of the target data to the party experiencing a partial hardware failure through the primary / backup communication interface includes: After the normal party obtains the target data, it sends the target data to the party experiencing a partial hardware failure through the primary / backup communication interface. The party experiencing a partial hardware failure will store the received target data into the corresponding location of its own shared memory for the host computer to access.

[0013] Furthermore, all hardware resources in the primary monitoring and backup monitoring systems are uniformly addressed and uniquely identified by creating a one-dimensional array; wherein each address in the one-dimensional array corresponds to a uniquely identified hardware resource, so as to support the normal other party in accurately locating and replacing the faulty hardware resource.

[0014] Furthermore, both the primary monitoring and the backup monitoring are configured with at least two communication serial ports; if the first communication serial port of the primary monitoring is damaged and the second communication serial port of the backup monitoring is damaged, specifically including: The second communication serial port of the main monitoring and the first communication serial port of the backup monitoring constitute a distributed underlying communication link. The second communication serial port of the main monitoring system and the first communication serial port of the backup monitoring system respectively perform target acquisition and communication tasks, and perform global data synchronization through the main and backup communication interfaces to ensure the overall stable operation of the system communication.

[0015] The second aspect of the present invention provides a distributed primary and backup monitoring system with self-diagnostic function, including a primary monitoring system and a backup monitoring system. The underlying acquisition and communication interfaces of the primary monitoring system and the backup monitoring system are connected in parallel to the same lower-level machine or target sampling node, and the two are connected through a primary and backup communication interface. Both the main monitoring and the backup monitoring include a processor, a memory, and a computer program stored in the memory and capable of running on the processor; When the computer program is executed by the processor, it implements the steps of the distributed master-slave monitoring method with self-diagnostic function as described in the first aspect of the present invention.

[0016] This invention provides a method and system for monitoring distributed master-slave systems with self-diagnostic capabilities. It offers the following advantages: 1. This invention utilizes the cascaded master-slave timers within the master-slave monitoring system to trigger the analog-to-digital conversion circuit for aligned sampling. The absolute value of the obtained sampling difference is compared with the upper limit of the dynamic setting range of the temperature and load parameters, thereby eliminating the judgment error caused by the sampling time difference, suppressing the interference of environmental drift on the comparison logic, and providing a basis for judging local hardware faults.

[0017] 2. This invention physically connects the primary and backup monitoring serial ports of the same type to the lower-level machine node in parallel. The backup side uses network packets to listen to the network packets and calculates the effective interception rate and operation deviation rate of the packets in combination with the error penalty item. The backup serial port is converted into a data collection and diagnosis node, and a cross-verification mechanism for the transmission and reception status is established to locate the communication link failure point.

[0018] 3. Before responding to a resource takeover request, this invention requires the processor to read the error status register of the master-slave communication interface controller to detect the physical disconnection status of the bus, and refuses the takeover operation when a disconnection is determined, thereby blocking the dual-master intervention caused by the loss of communication between devices and preventing level conflicts caused by the master and slave simultaneously sending messages to the bus.

[0019] 4. After establishing that different local faults have occurred in the primary and backup monitoring, this invention writes an isolation control word to the serial port controller on the damaged end, and uses the same type of serial port on the normal end to perform polling and packet transmission. This process splices the remaining normal physical channels to maintain the issuance and reception of underlying data acquisition commands when both machines have some hardware damage.

[0020] 5. This invention parses the returned data packet to extract the target hardware index number as the address offset, adds it to the system's preset shared memory base address to obtain the absolute physical address, and performs data overwrite. This operation restores the takenover data stream to its original address, and the upper computer application layer software maintains the original variable addressing path, eliminating the need for lower-level link reorganization to modify upper-level business programs. Attached Figure Description

[0021] Figure 1 This is a diagram showing the overall hardware architecture topology of the distributed master-slave monitoring system of the present invention. Figure 2 This is the main flowchart of the distributed master-slave monitoring method of the present invention; Figure 3 This is a flowchart of the underlying serial port listening interception and message status mutual verification process of the present invention; Figure 4 This is a flowchart of the analog quantity cross-comparison and self-diagnosis process of the present invention; Figure 5 This is a flowchart illustrating the underlying communication link reassembly and cross-device hardware takeover process of the present invention. Figure 6 This is a diagram of the internal functional modules and resource pooling structure of the present invention. Detailed Implementation

[0022] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] Please see the appendix Figure 1 To be continued Figure 6 This invention provides a method and system for distributed primary and backup monitoring with self-diagnostic function, applicable to a distributed primary and backup monitoring system that includes primary monitoring and backup monitoring.

[0024] The primary and backup monitoring systems each run independent central processing units (CPUs). They establish a primary-backup communication interface via an internal communication bus. The underlying data acquisition and communication interfaces of the primary and backup monitoring systems are physically connected in parallel to the same lower-level machine or target sampling node. This parallel topology provides the hardware foundation for both systems to acquire data from the same source. Specifically, the communication ports of the primary and backup monitoring systems are simultaneously connected to the same fieldbus network, and the analog input pins of both systems are connected to the output of the same target sampling node.

[0025] The underlying data acquired by the primary and backup monitoring systems is synchronized through the primary and backup communication interfaces. During this synchronization process, the primary and backup monitoring systems exchange their independently acquired underlying data via the primary and backup communication interfaces according to a set time period. This underlying data includes analog sampled data and message data received from the serial communication port.

[0026] The primary and backup monitoring systems perform mutual self-diagnosis based on underlying data and dynamic operating parameters to determine if there are any localized hardware faults. During this process, the primary and backup monitoring systems cross-compare the synchronized underlying data with the system's current dynamic operating parameters. The system introduces dynamic operating parameters to eliminate common measurement deviations caused by environmental factors and changes in operating conditions. The system calculates the difference in underlying data obtained by the primary and backup monitoring systems for the same target sampling node; it then retrieves historical operating data to perform trend analysis and adaptive adjustments to the basic tolerance limits, generating a dynamic setting range that includes current temperature and load parameters. When the difference in the underlying data exceeds this dynamic setting range, the system determines that a localized hardware fault has occurred at the corresponding hardware node.

[0027] When a partial hardware failure occurs in either the primary or backup monitoring system, the healthy backup system uses its corresponding healthy hardware resources of the same type to perform the target acquisition and communication tasks and acquire the target data. This target data is then transmitted to the system experiencing the partial hardware failure via the primary / backup communication interface. Upon confirmation of a partial hardware failure, the system performs resource cross-takeover at the hardware interface level. The system experiencing the partial hardware failure ceases to call the damaged underlying acquisition and communication interface; the healthy backup system schedules its matching healthy hardware resources of the same type to perform the target acquisition and communication tasks across devices. After acquiring the target data, the healthy backup system encapsulates the data, attaches a source hardware address identifier, and transmits it to the system experiencing the partial hardware failure via the primary / backup communication interface. The system experiencing the partial hardware failure parses the received data packets and imports them into its own business processing logic.

[0028] In this embodiment, the system further implements a low-level data synchronization and serial port listening interception mechanism. The communication interface between the main monitoring and the backup monitoring is implemented as a serial port. The serial ports of the main monitoring and the backup monitoring are connected in parallel to the bus communication pin of the lower-level machine. The system configures the main monitoring serial port to enable data sending and receiving permissions, while the system configures the backup monitoring serial port to enter listening mode. The system writes a configuration word to the low-level serial port controller register of the backup monitoring, disables the data sending enable bit of the backup monitoring serial port, and keeps the data receiving enable bit in the working state, thereby restricting the backup monitoring from sending communication polling commands to the lower-level machine.

[0029] The main monitoring unit sends communication query messages to the lower-level machine according to a preset polling cycle. The lower-level machine responds to the communication query messages and returns communication response messages to the bus network. The backup monitoring unit's communication serial port synchronously captures the voltage transition sequence on the bus network based on the data receive enable bit, and parses the frame header bytes and address field of the communication response message according to the communication protocol. The backup monitoring unit extracts the data payload segment of the communication response message and performs a cyclic redundancy check operation on the data payload segment to verify the logical correctness of the data segment. The backup monitoring unit performs the operation of matching the address field of the built-in demand mapping table, filters the node parameters on which its own task depends, and completes the analysis and interception of the detected communication messages.

[0030] The backup monitor writes the captured node parameters into its local storage area, thereby achieving data synchronization between the primary and backup monitors regarding the lower-level machine's serial communication port and avoiding multi-master transmission conflicts on the bus network. To quantify the data synchronization quality of the message interception stage, the system introduces a message effective interception rate evaluation mechanism into the backup monitor's program flow. The backup monitor calculates the message effective interception rate within a set time window. The calculation formula is as follows: in: This represents the number of response message frames that passed verification within the time window. The underlying message parsing program of the backup monitoring obtains this value by counting the number of times the verification pass event is triggered. This represents the total number of bits occupied by a single frame of response message. The system reads the definition section of the communication protocol configuration file to obtain the number of bytes per frame, and converts it into the actual total number of transmitted bits based on the start bit, data bit, and stop bit configuration parameters of the underlying serial port, and assigns it to this constant. This parameter represents the baud rate of the current communication serial port. The system reads the baud rate configuration register of the serial port controller to obtain this parameter value. The span parameter representing the statistical time window is set by the system extracting the sending cycle duration of the main monitoring polling command; The error compensation penalty term is calculated as follows: ,in The system reads the preset error penalty coefficient based on the communication anti-interference level configuration table pre-written in flash memory; when the number of verification errors... When the threshold is increased, the system proportionally reduces the final output value of the effective packet interception rate according to the linear penalty term. Backup monitoring is based on the effective packet interception rate. The numerical trend monitors the working status of its own communication serial port receiving module. In this invention, the system executes a dynamic parameter-based judgment procedure on the analog sampled data during the mutual inspection and self-diagnosis process. The analog input pins of the main monitoring and backup monitoring are connected in parallel to the sensor signal output terminal of the target sampling node. To eliminate misjudgments caused by sampling time differences, the system establishes a hardware-level synchronization triggering mechanism across devices. The central processing unit of the main monitoring is equipped with a master timer. When the master timer overflows, it triggers the analog-to-digital conversion circuit of the main monitoring to start sampling. At the same time, the main monitoring broadcasts a high-priority synchronization trigger message to the bus through the master-backup communication interface. After receiving the synchronization trigger message, the communication controller of the backup monitoring immediately generates an external interrupt signal. This external interrupt signal directly cascades and triggers the slave timer inside the backup monitoring, which then starts the analog-to-digital conversion circuit of the backup monitoring to perform the sampling operation. This mechanism ensures that the main monitoring and backup monitoring strictly align the sampling of the same transient sensor signal, generating their respective analog sampled data.

[0031] The primary monitor retrieves analog sampled data from the backup monitor's memory via the primary / backup communication interface and also retrieves its own analog sampled data generated at the same timestamp. The system calls the arithmetic logic unit to perform subtraction and absolute value operations, calculating the difference between the analog sampled data synchronously collected by the primary and backup monitors for the same node. The formula for calculating this difference is set as follows: in: This represents the absolute value of the difference between the primary and backup samples. The system obtains this item by reading the output of the arithmetic register. This represents the local analog quantity sampling data extracted by the main monitoring system; This indicates that the main monitoring system acquires synchronous sampling data from the backup monitoring system via the bus. The system pre-writes a basic fixed threshold into the control register as the initial set range; the system compares... The relationship between the magnitude of the aforementioned basic fixed threshold. When When the set range is exceeded, the system triggers a dynamic parameter reading mechanism to investigate external disturbances.

[0032] The system addresses each functional chip via the internal bus to obtain current dynamic operating parameters. The system reads the digital voltage of the thermistor channel on the front end of the motherboard and maps it to generate temperature status parameters; the system reads the real-time digital output value of the Hall current sensor and converts it to generate load status parameters; the system queries the status register of the battery charge / discharge control module to extract the operating bit, thereby determining and outputting the timing equalization charging status flag parameters. The system then retrieves historical operating data from the main and backup monitoring systems recorded in non-volatile memory to perform trend analysis, and based on the analysis results, dynamically and adaptively adjusts the basic fixed threshold to generate a real-time upper limit for the set range. The calculation formula is as follows: in: This represents the basic fixed threshold. The system consults the datasheet of the underlying analog-to-digital converter chip to read the quantization error constant and assigns it to this item. The temperature change, representing the temperature state parameter, is calculated by subtracting the reference temperature value from the previously obtained temperature state parameter. The temperature drift coefficient is obtained by extracting the slope value of the error change curves of the main monitoring and backup monitoring during the factory temperature chamber test. This represents the load status parameter, which is the percentage of power load corresponding to the aforementioned digital current value. The load impact coefficient is calculated by the system based on the average historical interference deviation of the underlying hardware under multiple load conditions. This represents the equalization charging compensation constant. When the system determines that it is in a timed equalization charging state based on the aforementioned flag parameters, the system assigns a pre-determined bus ripple voltage tolerance compensation value to this item. When it is in other operating states, the system assigns zero to this item.

[0033] System combined difference and adaptive thresholds that include dynamic operating parameters Perform the final logical comparison operation. The system determines whether the discrepancy in the analog sampled data is due to a local hardware failure; when... Exceed When the values ​​are displayed, the system determines that the discrepancy is caused by a partial hardware failure in the analog-to-digital converter chip or the front-end conditioning circuit, and writes a partial hardware exception interrupt code to the system's state management machine; when Not exceeding When the values ​​are displayed, the system determines that the difference is caused by normal disturbances such as temperature drift or operating condition fluctuations. The system then performs a zeroing operation and continues the sampling and comparison work for the next cycle.

[0034] In this embodiment, during the mutual inspection and self-diagnosis process, the system further performs mutual verification of the serial port transmit and receive status and cross-device underlying communication link reassembly logic. The underlying data covers serial port operating status parameters. The system defines four enumeration types for this serial port operating status: disabled, normal, abnormal, and busy. The main monitoring CPU periodically accesses the controller register of its own communication serial port to read the current serial port operating status identifier and the transmitted / received data volume statistics. The main monitoring CPU encapsulates the operating status identifier and data volume statistics into a status reporting data frame and periodically sends this status reporting data frame to the backup monitoring CPU through the main / backup communication interface.

[0035] The backup monitoring serial port remains in listening mode, continuously capturing message sequences on the bus network. The backup monitoring receives status report data frames from the main monitoring and performs joint analysis based on the message content, transmission period, and baud rate parameters acquired by its own microcontroller while listening. To quantitatively analyze the operational status indicators of the main monitoring communication interface, the backup monitoring calls its internal processing unit to calculate the operational deviation rate of the main monitoring serial port. Its calculation formula is set as follows: in: The result representing the operational deviation rate is calculated and output by the arithmetic logic unit of the backup monitoring unit; This represents the actual transmission cycle duration, obtained by reading the time difference between two packet frame header captures recorded by the internal timer from the backup monitoring system. This represents the target transmission cycle duration, obtained by the system reading the preset communication interval parameter from the communication protocol configuration file; This represents the baud rate error weighting coefficient, which is obtained by reading the historical measurement results of the clock source frequency offset of the underlying baud rate generator. The number of frames that have format errors or checksum errors in the message content is obtained by the backup monitoring execution protocol stack parsing program through statistical analysis of the message data; This represents the total number of message frames captured within the statistical time window. The backup monitor extracts the pre-configured serial port operating deviation threshold value from its internal non-volatile memory; the arithmetic logic unit of the backup monitor then calculates the operating deviation rate. The calculation is performed by comparing the operating deviation rate with the serial port's operating deviation threshold; when the operating deviation rate... When the deviation value of the serial port is greater than or equal to the operating deviation threshold, the backup monitor determines that there is a local hardware fault in the communication serial port of the main monitor and throws an abnormal status identifier to the system bus.

[0036] After completing the deviation calculation and analysis, the processor of the backup monitoring reads its own underlying status register to generate serial port operating status and reception status statistics for the backup monitoring. The backup monitoring sends a feedback data packet containing the above statistics along with the aforementioned diagnostic results to the main monitoring; the main monitoring compares the historical transmission and reception status recorded in its internal registers to complete the mutual verification of the transmission and reception status between the main monitoring and the backup monitoring, thereby confirming the overall health of the communication nodes in the system.

[0037] When the system determines, based on the transmit / receive status verification results, that a local hardware failure occurs at the communication serial port, the system triggers the underlying communication link reassembly mechanism. At the hardware physical configuration level, the system ensures that both the primary and backup monitoring systems have at least two communication serial ports of the same type. The first communication serial port of the primary monitoring system and the first communication serial port of the backup monitoring system are physically connected in parallel to form the first communication branch and connect to the first group of lower-level machine nodes. The second communication serial port of the primary monitoring system and the second communication serial port of the backup monitoring system are physically connected in parallel to form the second communication branch and connect to the second group of lower-level machine nodes. If the diagnostic process determines that both the first communication serial port of the primary monitoring system and the second communication serial port of the backup monitoring system are damaged, the system writes isolation control words to the corresponding serial port controllers.

[0038] The primary monitoring unit disconnects its processor from the first communication serial port, while the backup monitoring unit disconnects its processor from the second communication serial port. The system activates and calls the second communication serial port of the primary monitoring unit and the first communication serial port of the backup monitoring unit. These two ports, bridging physical device boundaries, form a distributed underlying communication link. The system decomposes the bus polling list, and the second and first communication serial ports of the primary and backup monitoring units independently execute target acquisition and communication tasks according to the decomposed list. After obtaining the response data from their respective nodes, the system performs global data synchronization and exchange through the primary and backup communication interfaces, ensuring stable overall system communication.

[0039] In this embodiment, the system implements underlying hardware resource pooling management and a cross-device takeover handshake protocol. The system performs unified addressing on all underlying hardware resources in both the primary and backup monitoring systems. The central processing unit (CPU) of the primary monitoring system and the CPU of the backup monitoring system each allocate independent address spaces in their respective random access memories, creating a one-dimensional array. The system allocates contiguous logical memory addresses to this one-dimensional array; each address unit in this array corresponds to and maps to a uniquely identified hardware resource, covering the communication serial port, analog-to-digital converter channel, and digital input pins of both systems.

[0040] When one party's main control chip determines, by analyzing the synchronized underlying data, that the other party has a data interaction anomaly, it sends a hardware management request containing a specific control instruction frame. The data payload of this hardware management request carries the target hardware index number from the aforementioned one-dimensional array and a takeover action identifier. Upon receiving the hardware management request, the other party reads its own underlying hardware status register to determine if it has a data loss anomaly. The other party's processor performs a quantification judgment operation by calculating the severity of the data loss anomaly. The calculation formula is set as follows: in: The result represents the severity of the missing data exception; the arithmetic logic unit on the other side performs the calculation and outputs the value. This represents the number of unresponsive communication commands or the number of missing sampling points. The system queries its own data buffer overflow exception register and timeout status flag record to obtain this value. This represents the total number of scheduling requests within the statistical period. The system obtains this value from the task scheduler's request count register. To prevent division by zero overflow during microprocessor division operations that could cause program crashes, the system performs a non-zero check before substituting this value into the calculation. When the value in the request count register is zero, the system forces a division by zero. Assigning a constant value to mitigate the risk of bypass overflow; This represents the missing weight coefficient, which the system reads from the fault tolerance level configuration table of the underlying communication protocol; This represents the time difference between the most recent successful data interaction node and the current system time node. The system obtains this difference by subtracting the historical timestamp value from the current count value of the system tick timer. This represents the baseline data refresh cycle duration, which is obtained by the system from the system configuration parameter area. This represents the time delay weighting coefficient, which is a constant derived by fitting historical crash recovery test data from the R&D phase.

[0041] When the calculation yields When the pre-written exception threshold in the internal flash memory is exceeded, the other party's processor first triggers the bus anti-collision check procedure. The other party reads the error status register of the internal primary / backup communication interface controller to determine if there is a physical layer disconnection or if the bus is in a closed state. If there is a physical fault in the primary / backup communication interface, the system determines that it has entered a dual-master split-brain risk state, and the other party refuses to take over and only maintains local listening. If the physical status of the primary / backup communication interface is normal, the other party confirms that it has a low-level data loss anomaly. The system confirms that the party experiencing a partial hardware failure has replied with a takeover confirmation frame to the party that initiated the request, formally agreeing to the hardware management request. The normal party receives and parses the confirmation frame, schedules its own control logic, and uses normal hardware resources of the same type to take over the work tasks corresponding to the faulty hardware resources.

[0042] The other party, acting normally, uses the aforementioned normal hardware resources to perform the data acquisition task and obtain the target data. It then packages the target data and sends it to the party experiencing a partial hardware failure via the primary / backup communication interface. The party experiencing the partial hardware failure receives the target data through its internal high-speed bus controller, parses the address mapping information within the data packet to obtain the target hardware index number. The system uses this target hardware index number as the address offset, adds it to the shared memory base address pre-allocated to this hardware type, and calculates the original physical memory absolute address corresponding to the faulty hardware. The system then directly overwrites the extracted target data into this physical memory absolute address. Because both parties run the same program architecture, the application layer software on the host computer does not need to modify any underlying drivers; it can directly read data by addressing the physical memory absolute address using the original pointer variables, thus completing the business data call. This data pass-through and writing mechanism based on absolute address mapping achieves transparent processing of the underlying partial hardware failure to the application layer monitoring logic, ensuring the continuous operation of the global monitoring business.

[0043] In this embodiment, the system provides a distributed primary / backup monitoring system with self-diagnostic capabilities. The system architecture includes a primary monitoring unit and a backup monitoring unit. Both the primary and backup monitoring units have independently configured processors and memory. The underlying data acquisition and communication interfaces of both the primary and backup monitoring units are connected in parallel via wires to the same lower-level machine and target sampling node. The primary and backup monitoring units establish a primary / backup communication interface connection through an internal data bus. The processor establishes physical electrical connections with the memory, external communication controller, and analog-to-digital converter peripherals through the internal system bus, realizing the interaction mechanism between data flow and control flow.

[0044] The memory includes non-volatile flash memory and random access memory (RAM). The non-volatile flash memory stores the computer program and boot code that the system depends on; the RAM provides a dynamic data workspace for the computer program during execution. The processor reads the computer program instructions from the memory and executes the distributed master-slave monitoring method with self-diagnostic capabilities as described in the preceding embodiments. The processor schedules the arithmetic logic unit and related peripheral registers to execute a series of operation instructions for low-level data synchronization, mutual self-diagnosis, and local hardware resource compensation and takeover.

[0045] When the system performs a partial fault takeover task under a hardware-software co-architecture, the processor introduces a takeover timing evaluation mechanism to verify business continuity constraints. The processor executes internal timer instructions to calculate the overall system takeover response latency. The calculation formula is established as follows: in: This represents the overall system takeover response delay value. The processor records the time node when the hardware management request is sent and the time node when the target data is returned to complete, and calculates the difference to obtain this value. The total number of bits actually occupied at the physical layer represents the underlying data synchronization of the primary and backup communication interfaces and the takeover confirmation frame. The processor first reads the transmission byte count value from the direct memory access controller and calls the internal bit conversion function. Combining the frame header, checksum, and bit stuffing rules of the current bus protocol, the byte count value is converted into the total number of bits required by the transmission link layer to obtain this item. The physical bus transmission rate representing the primary and backup communication interfaces is obtained by the processor by querying the baud rate register of the internal communication bus controller. This represents the total number of instruction cycles consumed by the processor in executing mutual diagnostic logic operations and takeover handshake protocol. The system starts the hardware cycle counter in the data observation point and trace unit of the microprocessor kernel at the first line of code executing the self-diagnostic logic, and obtains this item by reading the accumulated value of the hardware cycle counter after the takeover handshake confirmation frame is sent. This represents the duration of the processor's main clock frequency. The system reads the internal phase-locked loop configuration register to extract the current operating main frequency and performs a reciprocal operation to obtain this value. This represents the wait delay constant for the processor to access shared memory and peripheral registers. The system obtains this value by reading the configuration parameters of the memory management unit. This represents the concurrent bus contention compensation coefficient, which is calculated by the system based on the memory access conflict record data under multi-task concurrent conditions in the pre-test verification stage.

[0046] The system uses the calculation result to verify the legality of the execution timing of the underlying control instructions in real time. The above-mentioned hardware and software physical architecture and instruction execution logic establish the physical implementation basis of the technical solution of this application. Those skilled in the art, in conjunction with general microprocessor selection manuals and embedded operating systems, can directly convert the above logic into printed circuit board design diagrams and executable code files. At the same time, the control logic and method steps described in this invention can be encapsulated and stored in a computer-readable storage medium, which includes, but is not limited to, electrically erasable programmable read-only memory, magnetic hard disk, solid-state hard disk, or optical disk media; when the computer instructions loaded on the medium are read and executed by the microcontroller of the monitoring system, the above-mentioned distributed master-slave monitoring method with self-diagnostic function can be completely reproduced.

Claims

1. A distributed master-slave monitoring method with self-diagnostic function, characterized in that, The method is applied to a distributed primary-backup monitoring system, which includes a primary monitoring system and a backup monitoring system. The underlying data acquisition and communication interfaces of both the primary and backup monitoring systems are connected in parallel to the same lower-level machine or target sampling node. The underlying data obtained by the primary monitoring and the backup monitoring are synchronized through the primary and backup communication interfaces; The primary monitoring system and the backup monitoring system perform mutual self-diagnosis based on the underlying data and dynamic operating parameters to determine whether there are local hardware faults in the primary monitoring system and the backup monitoring system. When a partial hardware failure occurs in either the primary monitoring system or the backup monitoring system, the normal monitoring system uses its own corresponding normal hardware resources of the same type to perform the target acquisition and communication tasks and acquire the target data, and transmits the target data to the monitoring system that experienced the partial hardware failure through the primary / backup communication interface.

2. The distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, The communication interface between the main monitoring system and the backup monitoring system is a serial communication port. The synchronization of underlying data obtained by the primary monitoring and the backup monitoring through the primary and backup communication interfaces includes: When the main monitoring is working normally, the communication serial port of the backup monitoring is in a listening state; The backup monitoring analyzes and intercepts the detected communication messages to obtain the data required by the backup monitoring, so as to achieve data synchronization between the main monitoring and the backup monitoring regarding the lower-level machine communication serial port.

3. The distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, The underlying data includes analog sampled data; the mutual inspection and self-diagnosis based on the underlying data and dynamic operating parameters to determine whether there are local hardware faults in the main monitoring and the backup monitoring includes: Obtain the analog sample data synchronously collected by the main monitoring and the backup monitoring, and calculate the difference between the two; When the difference exceeds the set range, the current dynamic operating parameters are obtained, including temperature status, load status, and timed equalization charging status. Based on the difference and the dynamic operating parameters, determine whether the cause of the difference in the analog sampled data is a local hardware failure.

4. A distributed master-slave monitoring method with self-diagnostic function as described in claim 3, characterized in that, The methods for determining the set range include: A basic fixed threshold is provided as the initial setting range; Trend analysis is performed on the historical operating data of the main monitoring and the backup monitoring, and the basic fixed threshold is dynamically and adaptively adjusted based on the analysis results to generate the real-time set range.

5. A distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, The underlying data also includes the serial port working status, which is categorized into disabled, normal, abnormal, and busy. The mutual self-diagnosis process includes: The main monitoring system periodically reports the serial port working status and transmit / receive status of the main monitoring system to the backup monitoring system through the main-backup communication interface. The backup monitoring analyzes the message content, transmission period, and baud rate acquired when in the listening state to determine whether the main monitoring's communication serial port has the local hardware fault. The backup monitor informs the main monitor of its serial port working status and receiving status, so as to realize mutual verification of the sending and receiving status of the main monitor and the backup monitor.

6. A distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, The normal hardware resource of the other party uses its own corresponding normal hardware resources of the same type to replace the faulty hardware resource to perform the target acquisition and communication tasks and obtain target data, including: When one party determines that the other party has an abnormal data interaction by analyzing the synchronized underlying data, it sends a hardware management request to the other party. Upon receiving the hardware management request, the other party determines whether it has any data loss anomalies. If a data loss anomaly is found, it is confirmed that a partial hardware failure has occurred on one side, and the hardware management request is agreed upon, allowing the normal party to take over the work corresponding to the faulty hardware resource using the same type of normal hardware resource.

7. A distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, The primary monitoring and the backup monitoring correspond to the same monitoring program in terms of program architecture, and both are configured with shared memory; the transmission of the target data to the party experiencing a partial hardware failure through the primary / backup communication interface includes: After the normal party obtains the target data, it sends the target data to the party experiencing a partial hardware failure through the primary / backup communication interface. The party experiencing a partial hardware failure will store the received target data into the corresponding location of its own shared memory for the host computer to access.

8. A distributed master-slave monitoring method with self-diagnostic function as described in claim 1, characterized in that, All hardware resources in the main monitoring system and the backup monitoring system are uniformly addressed and uniquely identified by creating a one-dimensional array. Each address in the one-dimensional array corresponds to a uniquely identified hardware resource, enabling the normal party to accurately locate and replace the faulty hardware resource.

9. A distributed master-slave monitoring method with self-diagnostic function as described in claim 2, characterized in that, Both the primary monitoring and the backup monitoring are configured with at least two communication serial ports; if the first communication serial port of the primary monitoring is damaged and the second communication serial port of the backup monitoring is damaged, specifically including: The second communication serial port of the main monitoring and the first communication serial port of the backup monitoring constitute a distributed underlying communication link. The second communication serial port of the main monitoring system and the first communication serial port of the backup monitoring system respectively perform target acquisition and communication tasks, and perform global data synchronization through the main and backup communication interfaces to ensure the overall stable operation of the system communication.

10. A distributed master-slave monitoring system with self-diagnostic function, characterized in that, It includes a main monitoring system and a backup monitoring system. The underlying acquisition and communication interfaces of the main monitoring system and the backup monitoring system are connected in parallel to the same lower-level machine or target sampling node, and the two are connected through the main and backup communication interfaces. Both the main monitoring and the backup monitoring include a processor, a memory, and a computer program stored in the memory and capable of running on the processor; When the computer program is executed by the processor, it implements the steps of the distributed master-slave monitoring method with self-diagnostic function as described in any one of claims 1 to 9.