A method and apparatus for lossless recording of device operation data and a gateway
Patent Information
- Application Number
- CN202611334481.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]针对现有技术存在的设备故障瞬态数据因主控失效或掉电而丢失、无法溯源的问题,本申请通过设备运行数据的无损记录方法、装置及网关,实现极端工况下运行数据的全天候无扰采集与无损持久化存储
本申请通过独立于目标设备主控的旁路采集通道被动监听控制台运行数据,实现了数据采集与目标设备业务系统的完全解耦,确保了在目标设备死机、程序跑飞等主控失效工况下,仍能持续、无扰地获取故障前后的关键运行状态信息,克服了传统内置日志机制随主控瘫痪而失效的缺陷。
Smart Images

Figure CN122985507A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power automation and embedded system data processing, specifically to a method, apparatus, and gateway for non-destructive recording of equipment operation data. Background Technology
[0002] In the fields of power secondary systems and industrial control, core equipment such as gateways need to operate continuously for extended periods. Existing equipment typically relies on the logging mechanism within the main control CPU to save its operational status. However, when the equipment experiences extreme failures such as system crashes, program malfunctions, or sudden power outages, the main control system often fails first or loses power, causing the internal logging mechanism to fail and resulting in the complete loss of critical transient data at the moment of the failure. Furthermore, while some external logging solutions use backup batteries, they lack hardware and software co-control logic for power outage transients. They can only maintain power supply and cannot guarantee the safe shutdown of the file system during the power outage window, making them highly susceptible to data corruption or loss. Therefore, there is an urgent need for a technical solution that can completely and losslessly record and save the equipment's operational data even when the target equipment's main control fails or experiences an abnormal power outage. Summary of the Invention
[0003] To address the problem that transient data from equipment failures is lost and cannot be traced due to main control failure or power outages in existing technologies, this application provides a non-destructive recording method, device, and gateway for equipment operation data, enabling 24 / 7 non-disruptive acquisition and non-destructive persistent storage of operation data under extreme operating conditions.
[0004] To achieve the above objectives, this application adopts the following technical solution: A method for lossless recording of equipment operation data includes: By using a bypass acquisition channel independent of the target device's main control, the system passively listens to and acquires the target device's console operation data. When powered by the main power supply, monitor the power supply status of the main power supply; In response to the detection that the power supply status of the main power supply meets the preset power failure conditions, the system switches to the backup power supply and, within the maintenance window of the backup power supply, forces the cached console running data to be persisted to a non-volatile storage medium and safely shuts down the file system of the non-volatile storage medium.
[0005] The above solution decouples data acquisition from the target device's main control in terms of both physical and logical aspects, ensuring continuous data acquisition even when the target device crashes or malfunctions. Simultaneously, by combining primary and backup power redundancy with emergency disk write control logic, the backup power supply maintains the window to force data write and safely shut down the file system, thus achieving lossless retention of fault data across all scenarios.
[0006] As one implementation method, the passive monitoring and acquisition of the target device's console operation data through a bypass acquisition channel independent of the target device's main control includes: dynamically monitoring the console output information of the target device's processor in a bypass-free manner based on a standard serial communication protocol, without occupying the target device's main control computing power.
[0007] This implementation uses a standardized serial communication protocol for passive monitoring, avoiding the complexity of adapting to proprietary protocols. At the same time, the design of "bypass without interference" and "no occupation of main control computing power" ensures that the data acquisition process has zero interference with the target device's native business, meeting the stringent requirements for high-reliability operation of power secondary equipment.
[0008] As one implementation, monitoring the power supply status of the main power supply while it is powered by the main power supply includes: monitoring the voltage status of the main power supply through a voltage detection mechanism; when the voltage of the main power supply is detected to drop to a preset threshold, triggering a power outage interruption and seamlessly switching to the backup power supply.
[0009] This implementation establishes a clear causal triggering chain of "voltage drop-power failure interruption-power switching", which converts the voltage anomaly of the analog quantity into an interrupt signal of the digital system, providing an accurate time reference and reliable energy guarantee for subsequent emergency disk drop operations.
[0010] As one implementation, the step of forcibly persisting the console running data in the cache to a non-volatile storage medium and safely shutting down the file system of the non-volatile storage medium during the maintenance window of the backup power supply includes: suspending non-critical tasks in response to the power failure interruption; forcibly flushing the console running data in the memory cache that has not been written to disk to the non-volatile storage medium; and safely unloading or shutting down the file system of the non-volatile storage medium after the flushing is completed.
[0011] This implementation details the specific software actions for emergency disk write-in in case of power failure. By pausing non-critical tasks to release processor resources, it prioritizes the forced write of core data and actively performs a safe unloading or shutdown operation of the file system after the write is completed. This fundamentally prevents file system metadata corruption or data fragmentation caused by unexpected power outages.
[0012] In one implementation, the backup power source is a 3V battery; in standby mode, the 3V battery can power the device for several months; in operating mode, the 3V battery can power the device continuously for tens of minutes, and the maintenance window period is the tens of minutes; the backup power source enables the device to continue working after the main power source fails, so as to complete the forced flashing and the safe unloading or shutdown.
[0013] This implementation specifies the exact voltage specifications and scenario-specific sustainment capabilities of the backup power supply. Using a 3V battery as the backup power source, it can maintain power for several months in standby mode, ensuring sufficient energy reserves during long-term unattended deployments. When the device resumes operation after a main power failure, it can maintain continuous power for several tens of minutes, providing ample time for emergency disk write operations. This ensures that even in scenarios with large data volumes or complex write conditions, the system can still smoothly complete the forced write of all critical data and the safe shutdown of the file system, significantly improving the reliability and robustness of power failure protection. As one implementation, the method further includes: overlaying timestamps onto the acquired console running data to generate a standardized log file; and storing the standardized log file in the non-volatile storage medium using a cyclic overwrite strategy.
[0014] This implementation method provides data traceability by overlaying high-precision timestamps, and solves the problem of long-term recording in fixed storage space with a cyclic overwrite strategy, ensuring that the system can run continuously without manual intervention and always retain the latest data before and after the failure.
[0015] As one implementation, the method further includes: configuring communication parameters through a debugging interface before recording, so that the bypass acquisition channel is compatible with the communication protocol of the target device.
[0016] This implementation provides a flexible parameter configuration mechanism, enabling the recording device to adapt to target devices of different models and firmware versions, thereby enhancing the system's versatility and ease of field deployment.
[0017] In addition, this application also provides a non-destructive recording device for equipment operation data, comprising: The bypass acquisition module is configured to passively listen to and acquire the console operation data of the target device through a bypass acquisition channel independent of the target device's main control. The processing and storage module is configured to monitor the power supply status of the main power supply when it is powered by the main power supply; in response to detecting that the power supply status of the main power supply meets the preset power failure conditions, switch to the backup power supply, and within the maintenance window of the backup power supply, force the console running data in the cache to be persisted to a non-volatile storage medium, and safely shut down the file system of the non-volatile storage medium. The dual-power supply module is configured to provide redundant power supply for the main power supply and the backup power supply.
[0018] The aforementioned device serves as the physical embodiment of the method. Through a modular hardware architecture, it achieves physical integration of data acquisition, processing, storage, and power management. The collaborative work among the modules ensures the reliable execution of the lossless recording method at the hardware level.
[0019] In one implementation, firmware for executing the lossless recording method is burned into the internal non-volatile memory of the microcontroller; the non-volatile storage medium is an external storage device independent of the microcontroller, dedicated to storing log files.
[0020] This implementation physically separates firmware storage from log data storage. The microcontroller's firmware is directly burned into the chip's internal non-volatile memory, ensuring firmware integrity and immutability. The non-volatile storage medium, as an independent external storage device, is solely responsible for persistent log data storage. This separation architecture allows maintenance personnel to retrieve the external storage medium for offline analysis at any time without affecting the device's firmware operation, while ensuring that firmware code is not lost in the event of power failure, enabling the microcontroller to immediately execute an emergency disk write procedure.
[0021] In addition, this application also provides a power secondary communication gateway, including: a gateway main control board, and a non-destructive recording device as described above; the non-destructive recording device operates independently of the gateway main control board, and the bypass acquisition module is connected to the console interface of the gateway main control board.
[0022] Deeply integrating the non-destructive recording device into the power secondary communication gateway not only retains the gateway's original business functions but also endows it with the ability to self-diagnose and retain data under extreme faults, directly improving the operational reliability of power information technology innovation equipment. This application achieves complete decoupling between data acquisition and the target device's business system by passively monitoring the console's operating data through a bypass acquisition channel independent of the target device's main control. This ensures that even when the target device crashes or the program malfunctions due to main control failure, key operational status information before and after the failure can still be continuously and without interference, overcoming the defect of traditional built-in log mechanisms that fail when the main control is paralyzed.
[0023] This application utilizes a hardware and software co-design of a primary and backup power redundancy architecture and an emergency power failure disk write control logic. When a drop in the primary power supply voltage is detected, a power failure interrupt is triggered and a seamless switch to the backup power supply is achieved. The backup power supply's maintenance window period is used to force the flushing of cached data and the safe shutdown of the file system. In principle, this eliminates the risk of data loss or file system corruption caused by sudden power outages and achieves lossless persistence of transient fault data.
[0024] This application constructs an unattended, all-weather, adaptive long-term recording mechanism by adopting a standardized log generation and cyclic overwrite storage strategy, combined with the parameter adaptation capability of the debugging interface. This significantly reduces on-site operation and maintenance costs, provides complete and reliable data support for accurate equipment fault location, hidden danger investigation and iterative optimization, and effectively improves the operational stability and maintainability of power secondary equipment and industrial control systems. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the logical architecture of the device operation data lossless recording system according to an embodiment of this application; Figure 2 This is a schematic diagram of the hardware connection structure of the device for non-destructive recording of device operation data according to an embodiment of this application.
[0026] Among them, 100-target device, 110-control console interface, 200-non-destructive recording device, 210-bypass acquisition module, 220-processing and storage module, 221-microcontroller, 222-non-volatile storage medium, 230-dual power supply module, 231-main power input terminal, 232-backup battery, 240-debugging interface, and 300-gateway main control board. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0029] Example 1: As Figure 1 As shown, this embodiment provides a method for lossless recording of device operating data. This method is applied to embedded devices or industrial control hosts and aims to solve the problem of loss of critical operating data under extreme conditions such as device crashes, program malfunctions, or sudden power outages. The method flow of this embodiment mainly includes the following steps.
[0030] Step S100 involves passively monitoring and acquiring the target device's console operation data through a bypass acquisition channel independent of the target device's main control. Specifically, the core of this step is to construct a data acquisition path that is completely physically isolated and logically decoupled from the target device's main control business link. For example... Figure 1As shown in the logical architecture, the bypass acquisition module 210 is directly connected to the console interface 110 of the target device 100. This connection method only receives the serial data stream output by the processor of the target device in one direction and does not send any response, request, or control signals to the target device. This passive monitoring mechanism ensures that the data acquisition process does not occupy the main control computing power of the target device at all, nor does it interfere with its native business process. For example, even if the main control system of the target device 100 enters an infinite loop or kernel crash state due to software failure, as long as its hardware serial port still maintains electrical connectivity, the bypass acquisition module 210 can still continuously capture and record the last output information at the moment the fault occurs. It should be understood that although this embodiment uses the console interface as an example for description, in other embodiments, this bypass acquisition channel can also be adapted to the debug interface, the dedicated log output port, or other standardized communication ports with status information output functions, as long as the requirements of independence and passivity are met. Through the above design, this application fundamentally overcomes the defect of the traditional built-in log mechanism failing when the main control fails, and realizes the "black box" retention of fault data.
[0031] Step S200: While powered by the main power supply, monitor the main power supply status. Specifically, this monitoring process is not a simple continuity test, but rather a real-time sensing of the voltage quality at the main power input terminal 231. The voltage detection unit inside the processing and storage module 220 or the dual-power supply module 230 continuously samples the main power supply voltage value to determine whether it is within a stable operating range. The purpose of this proactive monitoring mechanism is to identify power failure precursors such as voltage drops or abnormal ripple before the main power supply completely fails. For example, when the main power supply voltage is detected to drop from its rated value and reach a preset safety threshold, the system determines that the preset power failure condition has been met. This predictive mechanism provides a valuable millisecond-level time window for subsequent emergency data protection operations, avoiding data write interruptions caused by instantaneous power cut-off. It should be noted that the setting of the preset power failure condition needs to comprehensively consider the power characteristics of the target device and the response speed of the back-end energy storage components, both to prevent false triggering from affecting normal recording and to ensure timely response when a real power failure occurs.
[0032] In step S300, in response to the detection that the main power supply status meets the preset power failure conditions, the system switches to the backup power supply. During the backup power supply's maintenance window, the console operation data in the cache is forcibly persisted to non-volatile storage media, and the file system of the non-volatile storage media is safely shut down. Specifically, this is a tightly coordinated hardware and software timing control process. When step S200 confirms that the power failure conditions are met, the dual-power supply module 230 immediately and seamlessly switches to the backup battery 232 to ensure that the processing and storage module 220 does not power down and reset. Simultaneously, the microcontroller 221 is triggered to enter emergency disk write mode.
[0033] In this embodiment, the backup battery 232 is powered by a 3V battery, which can maintain the device's power supply for up to 12 months in standby mode and for 30 to 50 minutes in operating mode (i.e., when performing an emergency disk write operation after the main power supply fails). This several tens of minutes in operating mode constitutes the "sustainment window," within which all critical operations must be completed. This several tens of minutes of sustainment time provides ample time for emergency disk write operations; while the several months of power supply capability in standby mode ensures that the battery always has sufficient energy reserves during long-term unattended deployments. The microcontroller 221 first forces the unwritten console running data in the memory buffer to be written to the non-volatile storage medium 222 via direct memory access or high-priority batch tasks, bypassing the conventional operating system caching mechanism to reduce latency. After the data is written, the microcontroller 221 also actively calls the file system's synchronization and unloading interface to update metadata such as the file allocation table and directory entries, and marks the file system as clean. This step is crucial because if only data writing is guaranteed while the file system is safely shut down, problems such as file corruption, directory loss, or lengthy disk repairs are highly likely to occur upon the next power-on, resulting in a false sense of losslessness where "data exists but cannot be read." Through the complete timing chain of "monitoring-switching-flush-shutdown" described above, this application ensures that even in the extreme case of complete loss of external power, transient data before and after the fault can not only be saved, but also persistently stored in a complete, readable, and file system-consistent manner, truly achieving lossless recording of device operation data.
[0034] Example 2: Based on Example 1, as one implementation method, passively monitoring and acquiring the target device's console operation data through a bypass acquisition channel independent of the target device's main control, specifically including: dynamically monitoring the target device's processor's console output information in a bypass-free manner based on a standard serial communication protocol, without consuming the target device's main control computing power. Specifically, as follows... Figure 1 As shown, a physical unidirectional data path is established between the bypass acquisition module 210 and the console interface 110 of the target device 100. Electrically, the signal receiving end of the bypass acquisition module 210 is only coupled to the data transmitting pin (TX) of the console interface 110, while the data receiving pin (RX) and any flow control signal lines are completely disconnected or electrically disconnected. This hardware-level read-only connection method physically eliminates the possibility of the recording device feeding back any electrical signals to the target device, ensuring the absolute unidirectionality of the monitoring behavior. Regardless of the operating state of the bypass acquisition module 210, even if it experiences a short circuit due to its own malfunction, it will not cause electrical interference or logical blockage to the console interface 110 of the target device 100.
[0035] Regarding the selection of standard serial communication protocols, this application is not limited to a specific protocol type, as long as the protocol possesses industry-wide universality and standardization characteristics. For example, in a preferred embodiment, a UART / TTL level protocol can be used to directly interface with the debug serial port of the embedded processor; in another embodiment, RS232 or RS485 protocols can also be used to adapt to the anti-interference requirements of industrial sites; in other embodiments, serial signal acquisition after electrical isolation can also be achieved through optocoupler isolation devices. The commonality of these protocols lies in the public standardization of their timing and frame formats, which allows the bypass acquisition module 210 to complete data parsing without requiring the target device 100 to install any dedicated drivers or supporting software, only needing to configure its own baud rate, parity bits, and other parameters according to the protocol specifications. This adaptability based on standard protocols enables the same lossless recording device to be flexibly compatible with target devices of different architectures and manufacturers, significantly improving the versatility of the solution.
[0036] Furthermore, the so-called "not occupying the main control computing power of the target device" is essentially achieved by the fact that the data acquisition process is entirely handled by an independent hardware unit within the bypass acquisition module 210, completely decoupling it from the main processor of the target device 100 in terms of computing resources. Specifically, the bypass acquisition module 210 automatically completes the reception, shifting, and parallel conversion of the serial bit stream through a hardware serial port peripheral. The entire process does not require the main CPU of the target device 100 to execute any interrupt service routines, memory copy operations, or acknowledgment instructions. In contrast, traditional log recording schemes often rely on the main control CPU polling or interrupt triggering to write to local storage, which can easily lead to business lag or even system crashes due to resource contention under high system load or abnormal conditions. This embodiment, by completely offloading the monitoring load to independent bypass hardware, fundamentally eliminates the performance loss and timing interference of data recording on the target device's native business. Even under extreme conditions where the main CPU utilization of the target device reaches 100% or the kernel is on the verge of crashing, it can still ensure the complete capture of console output data, providing an objective data benchmark for fault tracing that is unaffected by the main control state.
[0037] Example 3: Based on Example 1, as one implementation method, when powered by the main power supply, the power supply status of the main power supply is monitored. Specifically, this includes: monitoring the voltage status of the main power supply through a voltage detection mechanism; when the voltage of the main power supply is detected to drop to a preset threshold, a power outage interruption is triggered, and the system seamlessly switches to backup power supply. Specifically, as follows... Figure 1As shown, the dual-power supply module 230 integrates a sophisticated voltage monitoring unit that continuously samples the voltage at the main power input terminal 231. Unlike simple continuity detection, the voltage detection mechanism used in this embodiment can identify gradual voltage drop trends. When the sampled voltage falls below a preset threshold, the hardware comparator or power management chip immediately sends a high-priority power-down interrupt signal to the microcontroller 221 in the processing and storage module 220. The preset threshold is carefully set to a value higher than the minimum operating voltage of the microcontroller 221 and lower than the normal fluctuation limit of the main power supply, ensuring that it can provide early warning of actual power failures without being falsely triggered by power ripple. At the same time, the power path manager inside the dual-power supply module 230 automatically switches on the discharge circuit of the backup battery 232 through hardware logic the moment it detects an anomaly in the main power supply. Since this switching process is completed entirely by analog circuitry within microseconds without software intervention, a truly seamless switching is achieved, ensuring the power supply continuity of the microcontroller 221 and the non-volatile storage medium 222, and providing a stable energy foundation for subsequent software emergency processing.
[0038] Furthermore, as one implementation, during the backup power supply's maintenance window, the console running data in the cache is forcibly persisted to non-volatile storage media, and the file system of the non-volatile storage media is safely shut down. Specifically, this includes: pausing non-critical tasks in response to a power failure; forcibly flushing the console running data in the memory cache that has not yet been written to disk to the non-volatile storage media; and safely unloading or shutting down the file system of the non-volatile storage media after the flush is complete. This process constitutes the core hardware-software co-control logic that distinguishes this application from conventional battery backup schemes. Specifically, when the microcontroller 221 enters the interrupt service routine (ISR) in response to a power failure, the system immediately enters the emergency disk persistence mode. First, the firmware suspends or terminates all non-critical tasks, such as log string formatting, timestamp overlay calculation, debug interface communication responses, and regular background heartbeat packet sending, concentrating all processor computing power and bus bandwidth to data storage tasks. In this embodiment, the backup battery 232 is powered by a 3V battery. In standby mode, it can maintain the power supply of the device for 12 months, and in working mode, it can maintain the power supply of the device for 30-50 minutes. The maintenance window in working mode allows emergency disk write operations to be completed in a more relaxed sequence. However, any unnecessary computational consumption may still shorten the effective write time. Therefore, core tasks still need to be prioritized.
[0039] Subsequently, the microcontroller 221 uses a direct memory access (DMA) controller or high-priority CPU instructions to batch and continuously force-write the console runtime data that has not yet been written to the RAM buffer to the non-volatile storage medium 222. During this stage, the data write operation bypasses the conventional caching layer of the operating system or file system, directly operating on the underlying storage driver to eliminate the additional latency and uncertainty caused by cache flushing. For example, if an SD card is used as the storage medium, the system will directly send a WRITE_BLOCK command and send the data stream to the SPI or SDIO bus, ensuring that every byte is physically written to disk in the shortest possible time.
[0040] Finally, and crucially, after confirming the data payload has been written, the microcontroller 221 must actively invoke the file system's synchronization and unmount interfaces. This step forces an update of metadata information such as the file allocation table, directory entries, and superblock, and marks the file system as "clean." Without this step, even if the data has been written to the flash memory, the file system may still be deemed corrupted due to inconsistent metadata upon the next power-on, requiring lengthy repairs or even becoming unreadable, resulting in a false lossless state where "data exists but is unusable." Through the rigorous timing chain of "interrupt triggering - task pruning - forced flushing - metadata synchronization," this embodiment ensures that within the extremely short window before complete power loss, not only can the operational data at the moment of failure be salvaged, but this data is also preserved in a complete, readable, and file system-consistent manner, thus achieving truly lossless recording of device operational data. It should be understood that although this embodiment uses DMA transfer and standard file system API as examples, in other implementations, CPU polling write, bare metal sector operation or other equivalent data persistence and metadata protection methods can also be used, as long as they follow the design principle of prioritizing data integrity and consistency within a limited energy window.
[0041] Example 4: Building upon Example 1, as one implementation method, the method further includes: overlaying timestamps onto the acquired console runtime data to generate a standardized log file; and using a cyclic overwrite strategy to store the standardized log file on a non-volatile storage medium. Specifically, this data post-processing mechanism aims to address the issues of data traceability and storage space management in long-term unattended scenarios. Figure 1As shown, before writing the console running data to the non-volatile storage medium 222, the microcontroller 221 first obtains the current high-precision absolute time from its integrated real-time clock (RTC) unit and injects it as metadata into each piece of raw data. The timestamp generation here relies entirely on the independent clock source inside the lossless recording device, rather than the system time of the target device 100. This effectively avoids timeline errors caused by target device system crashes, restarts, or manual time modifications, ensuring the objectivity and continuity of the fault tracing time base. Regarding data formatting, the microcontroller 221 encapsulates the timestamped running data into a structured text format, such as a JSON object or CSV row record. Compared to proprietary binary formats, this standardized text encapsulation allows maintenance personnel to perform offline analysis without relying on dedicated decoding software. They can simply use a general text editor or scripting tools to complete keyword searches and status backtracking, significantly reducing the technical threshold and tool costs for fault diagnosis.
[0042] Furthermore, regarding the space management of the non-volatile storage medium 222, this embodiment adopts a file-level circular overwrite strategy, which is fundamentally different from the traditional fixed-size ring buffer. Although the ring buffer has certain advantages in embedded low-level write efficiency, its data is a continuous and contiguous byte stream. When reading offline, it must be combined with specific start address marking and parsing algorithms to reconstruct meaningful log fragments, which is extremely unfriendly for rapid on-site evidence collection. In contrast, the file-level circular strategy adopted in this application divides the log into independent archive files according to time period or capacity. In specific implementation, the microcontroller 221 periodically checks whether the remaining space or the total number of files on the non-volatile storage medium 222 has reached a preset threshold, either periodically or before each write. When it is determined that space needs to be released, the system will accurately locate and delete the oldest historical log file based on the timestamp suffix in the file name or the creation time attribute recorded by the file system, and then create a new log file to continue writing. To ensure data security under abnormal operating conditions such as power outages, file deletion and creation operations are designed as atomic transactions. This means that the physical erasure of the old file is only performed after the new file handle has been successfully acquired, or the log characteristics of the file system are utilized to ensure metadata consistency. This design achieves both automatic recycling of storage space, ensuring the device can operate 24 / 7 without stopping recording due to storage saturation, and guarantees that every log file obtained when the non-volatile storage medium 222 is removed for offline analysis is complete, independent, and directly readable. It perfectly balances the resource constraints of embedded systems with the ease of maintenance required in industrial settings. It should be understood that although this embodiment uses file segmentation by time as an example, other file organization methods such as segmentation by file size or categorization by event type can be used in other embodiments. As long as they adhere to the core principles of "independent readability" and "automatic rotation," they all fall within the scope of this application.
[0043] Example 5: Based on Example 1, as one implementation method, the method further includes: configuring communication parameters through a debugging interface before recording to adapt the communication protocol of the bypass acquisition channel to the target device. Specifically, this configuration step constitutes the preparatory stage of the lossless recording method, and its execution sequence is strictly independent of the real-time data acquisition and disk writing main process described in Example 1. Figure 1As shown, the debug interface 240 serves as a dedicated configuration channel for human-machine or machine-machine interaction, allowing maintenance personnel or automated deployment tools to issue configuration commands containing communication protocol characteristics to the microcontroller 221 before the device is officially put into operation. This design, which separates configuration management from runtime business, avoids resource contention or timing interference of the parameter negotiation process on the real-time monitoring task of the bypass acquisition module 210. It ensures that the system can immediately start data acquisition with a definite and optimal parameter combination after entering the working state, eliminating the risk of data packet loss or parsing errors that may be caused by dynamic parameter adjustment during runtime.
[0044] Regarding the specific content and configuration methods of communication parameters, this application provides multiple implementation forms to adapt to different field deployment habits. In a preferred embodiment, the communication parameters at least cover the core elements of serial communication such as baud rate, data bit length, number of stop bits, and parity mode. For example, for some embedded processors using the standard UART protocol, it may be necessary to configure it as 115200bps, 8 data bits, 1 stop bit, and no parity; while for some industrial gateways using RS232 levels, it may be necessary to configure it as 9600bps, 8 data bits, 1 stop bit, and even parity. At the interaction protocol level, the microcontroller 221 can be configured to support the standard AT command set, enabling users to complete the setting by sending text commands such as "AT+BAUD=115200" through general serial terminal software; in other embodiments, a custom binary configuration frame protocol can also be used to adapt to the needs of automated batch programming or remote OTA configuration; an interactive configuration interface based on character menus can also be designed to facilitate on-site maintenance personnel to complete parameter adjustments by pressing buttons or simple text input without dedicated tools. These diverse interaction methods collectively support the essential meaning of the overarching feature "configuration via debugging interface," ensuring the operability of the solution in different operation and maintenance environments.
[0045] Furthermore, to ensure the long-term validity of the configuration results, after receiving and verifying new communication parameters, the microcontroller 221 persistently writes them to a dedicated configuration partition in the non-volatile storage medium 222. Each time the system powers on and restarts, the firmware bootloader prioritizes reading the preset communication parameters from this storage area and automatically initializes the hardware serial port peripheral of the bypass acquisition module 210, allowing it to directly enter a ready state without manual intervention. This automatic power-on loading mechanism is a key foundation for achieving unattended deployment. It should be understood that although this embodiment uses serial communication parameters as an example, this configuration mechanism is also applicable to setting other system-level parameters such as time synchronization sources, log filtering rules, and storage policy thresholds in other application scenarios. As long as it follows the principle of "pre-configuration, persistent storage, and automatic effect," it falls within the protection scope of this application.
[0046] Through the aforementioned adaptive configuration mechanism, the hardware platform of the same lossless recording device can be flexibly adapted to various target devices with different console output characteristics. For example, in the power information technology application scenario, the device can seamlessly connect to gateway devices based on the Phytium E2000Q processor by modifying the baud rate and parity bit. When the field is replaced with a similar device based on the Loongson 2K1000 or ARM Cortex-A series processor, only the corresponding parameters need to be reconfigured to continue normal operation, without replacing hardware or upgrading firmware. This hardware-software decoupling adaptation capability significantly reduces the management complexity of spare parts and the marginal cost of field deployment, enabling the technical solution of this application to transcend the limitations of a single chip architecture and achieve generalized application in a wider range of industrial control and embedded computing fields, providing highly flexible infrastructure support for lossless recording of device operation data.
[0047] Example 6: As Figure 2 As shown, this embodiment provides a non-destructive recording device 200 for device operation data, serving as a modular hardware entity carrier for the aforementioned method embodiment. The device is physically constructed as an independent functional unit, comprising a bypass acquisition module 210, a processing and storage module 220, and a dual-power supply module 230.
[0048] The bypass acquisition module 210 is configured to passively listen to and acquire the console operation data of the target device through a bypass acquisition channel independent of the target device's main control. Specifically, such as... Figure 2 As shown, the bypass acquisition module 210 has a dedicated serial communication interface in hardware, which is connected to the console interface 110 of the target device 100 via a physical cable. This connection only establishes an electrical signal reception path and does not access the internal system bus or shared memory area of the target device 100. In a preferred embodiment, the bypass acquisition module 210 integrates level conversion and signal conditioning circuitry, which can convert the raw electrical signal from the console interface 110 into a logic level that the microcontroller 221 can recognize. At the same time, through a hardware unidirectional isolation design, it completely blocks the transmission path of reverse signals. This physical architecture ensures that the data acquisition behavior is completely external to the main control system of the target device 100. Even if the main processor of the target device 100 experiences a hardware-level failure or bus deadlock, the bypass acquisition module 210 can still continuously capture the last status information output by the console through an independent hardware link, thereby achieving the technical effects of "independence from the target device's main control" and "passive monitoring".
[0049] The processing and storage module 220 is configured to monitor the power supply status of the main power supply when powered by the main power supply; in response to the detection that the power supply status of the main power supply meets preset power failure conditions, it switches to backup power supply, and during the backup power supply's maintenance window, it forcibly persists the console operation data in the cache to non-volatile storage media, and safely shuts down the file system of the non-volatile storage media. Specifically, this module constitutes the core computing and data center of the lossless recording device 200. Figure 2 As shown, the processing and storage module 220 mainly includes a microcontroller 221 and a non-volatile storage medium 222. The microcontroller 221, as an independent computing core, establishes a communication connection with the non-volatile storage medium 222 via a high-speed data bus (e.g., SDIO, SPI, or parallel bus), and is responsible for executing all control logic such as voltage monitoring, interrupt response, data writing, and file system management as described in the previous embodiments. The non-volatile storage medium 222 serves as the final physical destination for data and is used to permanently store log files. In this embodiment, the firmware program for executing the aforementioned lossless recording method is directly burned into the internal non-volatile memory (e.g., on-chip flash memory) of the microcontroller 221, while the non-volatile storage medium 222 is an external storage device (e.g., an SD card) independent of the microcontroller 221, dedicated to storing log files. This physical separation architecture of firmware and log data storage ensures the integrity and immutability of the firmware program—even if the external storage medium is removed or damaged, the firmware inside the microcontroller 221 can still operate normally; at the same time, log data read and write operations do not affect the security of the firmware code, providing reliable program execution protection for emergency disk writes in case of power failure. It should be understood that, although... Figure 2 The illustration shows the microcontroller 221 and the non-volatile storage medium 222 integrated on the same circuit board. However, in other embodiments, they can also be designed as separate boards or interconnected via standard connectors, as long as low latency and high reliability of the data transmission link are ensured. Crucially, the processing and storage module 220 possesses completely independent computing resources and storage space, independent of any computing power or storage unit of the target device 100. This provides a solid hardware foundation for independently performing emergency disk write operations under extreme conditions such as power failures.
[0050] The dual-power supply module 230 is configured to provide redundant power supply for both primary and backup power. Specifically, this module is the energy management center of the entire device, responsible for building an uninterrupted power distribution network (PDN). For example... Figure 2As shown, the dual-power supply module 230 includes a main power input terminal 231 and a backup battery 232. The main power input terminal 231 draws power from the motherboard power domain of the target device 100 via physical wires, serving as the energy source for the system's normal operation; the backup battery 232 acts as an independent energy storage unit, taking over the load when the main power supply fails. In terms of circuit implementation, the dual-power supply module 230 integrates a power path management chip or a discrete MOSFET switching circuit to monitor the voltage quality of the main power input terminal 231 in real time, and automatically activates the discharge circuit of the backup battery 232 when a voltage drop is detected, outputting a stable operating voltage to the bypass acquisition module 210 and the processing and storage module 220. This hardware-level redundant power supply design ensures that the internal digital logic circuits of the device remain within their effective operating range regardless of how deteriorating the external power supply environment becomes, thereby supporting the physical implementation of key timing actions such as "seamless switching" and "maintaining the window period" in the aforementioned method.
[0051] Through the modular hardware architecture described above, this embodiment transforms the abstract data recording method into a concrete physical entity. The modules interact through clearly defined electrical interfaces and data buses, forming clear signal and energy flow paths. In particular, the core feature of "independence from the target device's main control" is not merely a functional description in this embodiment, but is manifested in an independent MCU chip, independent memory chips, an independent power management unit, and physically isolated communication interfaces. This binary binding of structure and function not only enables the device to maintain its operational capability even in extreme scenarios where the target device completely fails, but also provides a standardized hardware platform for subsequent product integration, maintenance, replacement, and technological iteration, fully supporting the reliability and practicality of the technical solution in industrial field applications.
[0052] Example 7: This example provides a power secondary communication gateway device, which includes a gateway main control board 300 and a non-destructive recording device 200 as described in the previous examples. Specifically, as... Figure 2As shown, the non-destructive recording device 200, as a fully functional independent subsystem, is physically integrated inside the chassis of the power secondary communication gateway equipment. In a preferred embodiment, the non-destructive recording device 200 can be mounted on the inner wall of the chassis or on a dedicated bracket using standard DIN rail clips or screws. Its placement fully considers electromagnetic compatibility and heat dissipation design, avoiding interference with sensitive radio frequency modules or high-voltage areas on the gateway's main control board 300. This integration method allows the power secondary communication gateway equipment to retain its original service processing capabilities while natively possessing the ability to retain transient fault data. This eliminates the need for maintenance personnel to carry or temporarily connect external waveform recording instruments, significantly improving the intelligent operation and maintenance level of the equipment. It should be understood that although this embodiment uses chassis integration as an example, in other embodiments, the non-destructive recording device 200 can also be externally mounted, interconnected with the gateway body via an aviation plug or waterproof connector, as long as signal connectivity and power supply requirements are met.
[0053] In this power secondary communication gateway device, the non-destructive recording device 200 operates independently of the gateway main control board 300, and the bypass acquisition module 210 is connected to the console interface of the gateway main control board 300. Specifically, this independence is reflected in three dimensions: physical, electrical, and logical, and is the key foundation for ensuring reliable retention of fault data. At the physical level, the non-destructive recording device 200 has its own printed circuit board, microcontroller 221, and non-volatile storage medium 222, and does not share any chip, bus, or memory resources with the gateway main control board 300. At the electrical level, the bypass acquisition module 210 is coupled to the transmit pin (TX) of the console interface of the gateway main control board 300 only through a unidirectional signal line. At the same time, although the dual power supply module 230 can draw power from the gateway motherboard, it has an independent backup battery 232 as an energy buffer, cutting off the direct transmission path of power noise and power failure impact. At the logical level, the firmware of the non-destructive recording device 200 runs completely autonomously and does not rely on the operating system, driver, or clock synchronization service of the gateway main control board 300. Based on this triple independence design, even if the gateway main control board 300 crashes into an infinite loop due to kernel crashes, repeatedly restarts due to watchdog timeouts, or even completely loses power due to a burnt-out power module, the lossless recording device 200 can still continuously capture and save the last console output information before and after the fault occurs, thanks to its own reserved energy and independent processing logic. In contrast, traditional onboard logging solutions often lose their recording capability simultaneously due to the failure of the main control chip itself, making the most critical fault scene data a "black box." This embodiment fundamentally solves this industry pain point through an architecture-level decoupling design.
[0054] Furthermore, to verify the feasibility and value of the above technical solution in a real industrial environment, this embodiment also demonstrates the typical operation procedure for the power secondary communication gateway device by on-site maintenance personnel. When the gateway device experiences an abnormal alarm or service interruption, maintenance personnel do not need to apply for a power outage window or disassemble the chassis cover. They only need to open the maintenance door on the side of the chassis to directly perform a hot-swap operation on the non-volatile storage medium 222 on the non-volatile recording device 200. Since the non-volatile storage medium 222 adopts a standard file system format and a file-level circular overwrite strategy, maintenance personnel can directly browse and retrieve the log files at the time of the fault on a laptop after inserting it into a universal card reader, quickly locating the root cause of the problem. If the investigation finds that the fault is caused by a momentary power outage due to power grid fluctuations, and the backup battery 232 has been depleted in this event, maintenance personnel can also replace it with a new battery of the same specification on-site, so that the non-volatile recording device 200 can quickly return to a fully charged standby state, preparing for data protection for the next possible fault. The entire traceability and maintenance process is completed online without affecting the normal operation of the gateway main control board 300 (if it has been restored). It truly realizes all-weather fault monitoring and offline data traceability in unattended scenarios, effectively shortens the mean time to repair (MTTR) of power secondary equipment, and ensures the long-term stable operation of smart grid communication nodes.
[0055] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for non-destructive recording of equipment operation data, characterized in that, include: By using a bypass acquisition channel independent of the target device's main control, the system passively listens to and acquires the target device's console operation data. When powered by the main power supply, monitor the power supply status of the main power supply; In response to the detection that the power supply status of the main power supply meets the preset power failure conditions, the system switches to the backup power supply and, within the maintenance window of the backup power supply, forces the cached console running data to be persisted to a non-volatile storage medium and safely shuts down the file system of the non-volatile storage medium.
2. The method according to claim 1, characterized in that, The passive monitoring and acquisition of the target device's console operation data via a bypass acquisition channel independent of the target device's main control includes: Based on the standard serial communication protocol, the console output information of the processor of the target device is dynamically monitored in a bypass-free manner without occupying the main control computing power of the target device.
3. The method according to claim 1, characterized in that, The monitoring of the power supply status of the main power supply when powered by the main power supply includes: The voltage status of the main power supply is monitored through a voltage detection mechanism; When the voltage of the main power supply is detected to drop to a preset threshold, a power outage interrupt is triggered, and the power supply is seamlessly switched to the backup power supply.
4. The method according to claim 3, characterized in that, The step of forcibly persisting the console operation data in the cache to a non-volatile storage medium and safely shutting down the file system of the non-volatile storage medium during the backup power supply's maintenance window includes: In response to the power failure interruption, non-critical tasks are suspended; Force write the console runtime data that has not been written to disk in the memory cache to the non-volatile storage medium; After the flashing process is complete, safely unmount or shut down the file system of the non-volatile storage medium.
5. The method according to claim 4, characterized in that, The backup power source is a 3V battery; in standby mode, the 3V battery can power the device for several months; in operating mode, the 3V battery can power the device continuously for tens of minutes, and the maintenance window period is the tens of minutes; the backup power source enables the device to continue working after the main power source fails, so as to complete the forced flashing and the safe unloading or shutdown.
6. The method according to claim 1, characterized in that, The method further includes: Timestamps are overlaid on the acquired console runtime data to generate a standardized log file; The standardized log files are stored in the non-volatile storage medium using a circular overwrite strategy.
7. The method according to claim 1, characterized in that, The method further includes: Before recording, the communication parameters are configured through the debugging interface to make the communication protocol of the bypass acquisition channel compatible with that of the target device.
8. A non-destructive recording device for equipment operation data, characterized in that, include: The bypass acquisition module is configured to passively listen to and acquire the console operation data of the target device through a bypass acquisition channel independent of the target device's main control. The processing and storage module is configured to monitor the power supply status of the main power supply when powered by the main power supply. In response to the detection that the power supply status of the main power supply meets the preset power failure conditions, the system switches to the backup power supply and, within the maintenance window of the backup power supply, forces the cached console running data to be persisted to a non-volatile storage medium and safely shuts down the file system of the non-volatile storage medium. The dual-power supply module is configured to provide redundant power supply for the main power supply and the backup power supply.
9. The apparatus according to claim 8, characterized in that, The microcontroller's internal non-volatile memory contains firmware for executing the lossless recording method; the non-volatile storage medium is an external storage device independent of the microcontroller, dedicated to storing log files.
10. A power secondary communication gateway device, characterized in that, include: The gateway main control board, and the non-destructive recording device as described in claim 8; The non-destructive recording device operates independently of the gateway main control board, and the bypass acquisition module is connected to the console interface of the gateway main control board.
