Power-off quick response and power backup linkage method and device
Patent Information
- Application Number
- CN202611118325.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-27
- Publication Date
- 2026-09-01
AI Technical Summary
[0005]本发明旨在克服上述现有技术的不足,提供一种断电快速响应与备电联动方法及装置,以解决现有技术中物联网门禁设备断电时缺乏硬件切换与业务联动一体化响应机制的技术问题
[0016]本发明提供了一种断电快速响应与备电联动方法及装置,在断电瞬间通过硬件比较器快速完成主备电源切换,同时同步产生中断触发信号唤醒微控制器执行应急业务逻辑,实现了硬件切换与软件联动的紧耦合;依据门禁当前锁定状态和进出请求动态决策临时解锁,既避免顾客被困,又防止无授权情况下的安全风险;通过推估剩余工作时长并分级预警,在低电量时主动终止非核心任务并进入深度休眠保电模式,延长关键操作窗口;此外,通过云端平台收集多次断电日志并分析电压跌落速率及备用储能链路老化趋势,输出预测性维护提醒,提升了物联网门禁设备的运维智能化水平。
Smart Images

Figure CN122678291A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power management technology for Internet of Things (IoT) devices, and more specifically, to a method and apparatus for rapid power outage response and backup power linkage. Background Technology
[0002] In IoT-driven smart store management systems, access control boxes, as core edge nodes, require 24 / 7 uninterrupted operation to ensure personnel access safety and operational data closure. These devices are typically powered by AC mains electricity via an adapter, and their operational continuity is directly linked to critical business processes such as access control, entry / exit record uploading, and remote maintenance and diagnostics.
[0003] Currently, for power outage protection of such equipment, existing technology mainly uses uninterruptible power supplies (UPS) as external backup power. Their basic working principle is: the UPS continuously monitors the mains power input; when a mains power interruption is detected, it switches the load to internal battery power within milliseconds via a static transfer switch, thereby maintaining power continuity for the equipment. This solution is widely used in server rooms, industrial control, and other fields.
[0004] However, existing uninterruptible power supply (UPS) solutions have the following inherent drawbacks when applied to IoT access control devices: First, UPS systems only perform passive power restoration, and their switching actions are completely independent of the internal business logic of the equipment. When a power outage occurs, the access control equipment itself is unaware that the mains power has been interrupted and continues to operate normally until the backup power is exhausted. This prevents the equipment from proactively triggering targeted business processing, such as reporting "power outage offline" to the cloud to distinguish it from equipment failure, or timely persisting the runtime context (such as access control status and incomplete event queues) in volatile memory to prevent data corruption. Second, in access control scenarios, power outages may cause electromagnetic locks to lose power and unlock automatically, or the equipment may shut down, resulting in the loss of lock control signals, thus causing security risks such as access control failure or customer entrapment. Existing solutions cannot detect whether the access control is currently in a "someone is entering or exiting" or "idle and locked" state, and therefore cannot make differentiated emergency decisions. Third, when the equipment is offline, the cloud-based operation and maintenance platform cannot distinguish whether the shutdown is due to a mains power outage, a hardware failure, or a network anomaly. The equipment usually sends logs only after power-on, and in a power outage scenario, the equipment has no opportunity to report the "offline due to power outage" status, increasing the cost of on-site troubleshooting for maintenance personnel. Finally, existing UPS systems only provide a rough indication of remaining power (such as a buzzer or indicator light), and the equipment cannot know how long the backup power can last. Therefore, it cannot dynamically adjust its behavior based on the remaining time—for example, fully executing emergency tasks when there is sufficient power, or proactively terminating non-core tasks and entering deep sleep mode to protect critical data when power is insufficient. Summary of the Invention
[0005] The present invention aims to overcome the shortcomings of the prior art and provide a method and device for rapid power outage response and backup power linkage, so as to solve the technical problem that the existing Internet of Things access control devices lack an integrated response mechanism for hardware switching and business linkage when power is lost.
[0006] In a first aspect, the present invention provides a method for rapid power outage response and backup power linkage, the method comprising: The power continuity parameter at the mains power supply terminal is monitored in real time. When the rate of change of the power continuity parameter exceeds a preset safety threshold, a power outage event is determined to have occurred. Based on the power outage event, a power switching command and an interrupt trigger signal are generated synchronously. The power switching command is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in the standby state. After the microcontroller is woken up, it invokes the emergency response strategy pre-stored in the storage medium according to the interrupt trigger signal. The emergency response strategy includes: sending an offline alarm message to the cloud monitoring platform, persisting the runtime context in the volatile memory to the non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control mechanism and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. After the power switch is completed, the remaining working time for continuous power supply is estimated based on the real-time remaining charge of the backup energy storage link and the current load consumption rate. When the remaining working time is lower than the preset warning time threshold, a low battery warning signal is pushed to the cloud monitoring platform again, and non-core background tasks are terminated, guiding the device into a deep sleep power-saving mode.
[0007] Preferably, the real-time monitoring of power continuity parameters at the mains power supply end includes: The DC bus voltage after mains power rectification is acquired through a voltage divider resistor network, and the voltage value is continuously read at a fixed sampling period using the analog-to-digital converter of the microcontroller. Calculate the voltage difference between adjacent sampling periods, divide the voltage difference by the sampling period to obtain the voltage drop rate, and use the voltage drop rate as the rate of change of the power continuity parameter. When the voltage drop rate exceeds a preset voltage change threshold per millisecond, the power outage event is determined to have occurred.
[0008] Preferably, the step of synchronously generating power switching commands and interrupt trigger signals based on the power outage event includes: The DC bus voltage after mains power rectification is monitored using a hardware comparator. When the DC bus voltage is lower than the first voltage threshold, the hardware comparator directly outputs a high-level power switching command to the control terminal of the power switching switch within the preset power switching response delay, switching the main power receiving link to the backup energy storage link. Meanwhile, the output of the hardware comparator is connected to the external interrupt pin of the microcontroller, and the level transition of the hardware comparator output serves as the interrupt trigger signal.
[0009] Preferably, the step of dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control mechanism and the entry / exit request queue includes: Read the lock status register and entry / exit request register of the access control actuator; If the current lock status is locked and the entry / exit request queue indicates that there are incomplete entry / exit requests, then the temporary unlock authorization is issued; If the current locking state is locked and the entry / exit request queue indicates that there are no incomplete entry / exit requests, then the temporary unlock authorization will not be issued, and the locked state will be maintained. If the current locked state is unlocked, the temporary unlock authorization will not be issued.
[0010] Preferably, the backup energy storage link is a double-layer capacitor array or a small-capacity lithium battery pack, whose discharge characteristics meet the following requirements: providing an output power of not less than 10W at the moment of power failure and a continuous power supply time of not less than 30 seconds, so as to allow the emergency response strategy to be fully executed; then the estimation of the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate includes: The voltage-charge curves of the backup energy storage link under different load currents are pre-calibrated. Sample the output voltage and output current of the current backup energy storage link, and determine the real-time remaining charge based on the corresponding curve; The remaining operating time is determined by dividing the real-time remaining charge by the average load current.
[0011] Preferably, sending an offline alarm message to the cloud monitoring platform includes: A short connection is established with the cloud monitoring platform through the cellular communication module built into the IoT device, and an alarm message containing the device identifier, power outage timestamp, and the current remaining charge of the backup energy storage link is sent. If no confirmation response is received from the cloud monitoring platform within the preset alarm confirmation waiting timeout period, the alarm message will be resent, and the number of resentments will not exceed the preset number. If no acknowledgment is received after a preset number of retransmissions, the alarm message will be stored in the non-volatile storage medium and retransmitted after the main power receiving link is restored.
[0012] Preferably, it further includes: Collect the voltage drop rate, the locking status and entry / exit request queue of the access control mechanism, the remaining working time of the backup energy storage link, and the complete logs before the equipment enters the deep sleep power-saving mode for each power outage event, and upload the complete logs to the cloud monitoring platform. The cloud-based monitoring platform determines the quality of the main power supply and the aging trend of the backup energy storage link based on the logs of multiple power outage events. When the voltage drop rate of the same device shows an increasing trend or the remaining working time shows a decreasing trend exceeding the preset fluctuation range, a predictive maintenance reminder is output.
[0013] Secondly, the present invention provides a power outage rapid response and backup power linkage device, comprising: The power outage event determination module is used to monitor the power continuity parameters of the mains power supply terminal in real time. When the rate of change of the power continuity parameters exceeds a preset safety threshold, a power outage event is determined to have occurred. The instruction and signal generation module is used to synchronously generate a power switching instruction and an interrupt trigger signal according to the power failure event. The power switching instruction is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in the standby state. An emergency response strategy invocation module is used to invoke an emergency response strategy pre-installed in the storage medium according to the interrupt trigger signal after the microcontroller is woken up. The emergency response strategy includes: sending an offline alarm message to the cloud monitoring platform, persisting the runtime context in the volatile memory to the non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control actuator and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. The remaining working time estimation module is used to estimate the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate after the power switch is completed. The power-saving mode guidance module is used to push a low-battery warning signal to the cloud monitoring platform again when the remaining working time is lower than the preset warning time threshold, and terminate non-core background tasks to guide the device into a deep sleep power-saving mode.
[0014] Thirdly, the present invention provides a readable medium including executable instructions, which, when executed by a processor of an electronic device, cause the electronic device to perform any of the methods described in the first aspect.
[0015] Fourthly, the present invention provides an electronic device including a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor performs the method as described in any of the first aspects.
[0016] This invention provides a method and device for rapid power outage response and backup power linkage. At the moment of power failure, a hardware comparator quickly completes the switching between primary and backup power supplies, while simultaneously generating an interrupt trigger signal to wake up the microcontroller and execute emergency business logic, achieving tight coupling between hardware switching and software linkage. Based on the current lock status of the access control system and entry / exit requests, it dynamically decides on temporary unlocking, preventing customers from being trapped and mitigating security risks in unauthorized situations. By estimating the remaining working time and providing tiered warnings, it proactively terminates non-core tasks and enters a deep sleep power-saving mode when the battery is low, extending the critical operation window. Furthermore, by collecting multiple power outage logs through a cloud platform and analyzing the voltage drop rate and the aging trend of the backup energy storage link, it outputs predictive maintenance reminders, improving the intelligent operation and maintenance level of IoT access control devices.
[0017] The further effects of the aforementioned non-conventional preferred method will be explained below in conjunction with specific embodiments. Attached Figure Description
[0018] To more clearly illustrate the embodiments of the present invention or the existing technical solutions, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of a method for rapid power outage response and backup power linkage according to an embodiment of the present invention; Figure 2 This is a schematic diagram of another method for rapid power outage response and backup power linkage provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a power outage rapid response and backup power linkage device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0021] See Figure 1 The image shows a specific embodiment of a power outage rapid response and backup power linkage method provided by the present invention. In this embodiment, the power outage rapid response and backup power linkage method includes:
[0022] Step 101: Monitor the power continuity parameters at the mains power supply end in real time. When the rate of change of the power continuity parameters exceeds the preset safety threshold, a power outage event is determined to have occurred. Specifically, in smart store scenarios, access control boxes are typically deployed near store entrances and exits, powered by 220V AC mains electricity converted to 12V DC via a power adapter. To monitor the AC mains power status in real time, a voltage divider resistor network is installed at the power input of the access control box. This network connects the positive and negative terminals of the DC bus after rectification by a rectifier bridge, reducing the 12V bus voltage to the acceptable 0-3.3V range of the microcontroller's analog-to-digital converter (ADC). The microcontroller uses an STM32F103 series chip, whose built-in ADC continuously reads the divided voltage values at a fixed sampling period (e.g., once every 50 microseconds), obtaining a series of discrete voltage sampling sequences. The microcontroller calculates the voltage difference between two adjacent sampling periods, divides this difference by the sampling period length, and obtains the voltage drop rate per unit time. This voltage drop rate serves as a specific representation of the rate of change of the power continuity parameter. The microcontroller's internal flash memory stores a voltage drop threshold, which is set according to the store's power grid environment, for example, a drop of 0.3 volts per millisecond. When the calculated voltage drop rate exceeds this preset voltage drop threshold per millisecond, the microcontroller determines that a power outage has occurred at the mains power supply. This voltage drop rate-based judgment method can effectively filter out normal voltage fluctuations caused by the start-up and shutdown of high-power equipment such as air conditioners and freezers in the store, avoiding false triggering.
[0023] Step 102: Generate a power switching command and an interrupt trigger signal synchronously based on the power failure event. The power switching command is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in the standby state. Furthermore, in the access control box device, the power switching function is completed by an independent hardware comparator circuit, without relying on the microcontroller's software polling. This ensures that the switching is completed within microseconds after a mains power outage, preventing the access control box device from restarting or shutting down due to voltage drops. Specifically, a hardware comparator (e.g., LM393) is set up, with its non-inverting input connected to the voltage divider sampling point of the DC bus voltage, and its inverting input connected to a reference voltage generated by a TL431 precision reference source. This reference voltage value is set as the first voltage threshold. For a 12V DC bus, the first voltage threshold is set to 10.8V, which is higher than the minimum operating voltage of the access control box device (usually 9V), allowing sufficient time margin for switching. The hardware comparator compares the DC bus voltage with the first voltage threshold in real time. When the DC bus voltage is higher than 10.8V, the comparator outputs a low level; when a mains power outage causes the DC bus voltage to drop rapidly below 10.8V, the comparator output immediately flips to a high level. After a preset power switching response delay (e.g., 10 microseconds to eliminate comparator output jitter), the high-level signal is directly output as a power switching command to the control terminal of the power switching switch. The power switching switch uses an ideal diode circuit composed of back-to-back P-channel MOSFETs (e.g., IRF7416). Upon receiving the high level, its control terminal disconnects the main power receiving link of the access control box device from the AC adapter output within 5 microseconds and simultaneously connects to the backup energy storage link. Meanwhile, the output of the hardware comparator is also directly connected to the microcontroller's external interrupt pin (e.g., PA0 pin) via a separate signal line. The level transition (from low to high) of the comparator output directly serves as an interrupt trigger signal. This signal undergoes no software processing or debouncing filtering, waking up the microcontroller in standby mode (i.e., stop mode, power consumption approximately 2 microamps) through a pure hardware transition.
[0024] Step 103: After the microcontroller is woken up, it invokes the emergency response strategy pre-stored in the storage medium according to the interrupt trigger signal. The emergency response strategy includes: sending an offline alarm message to the cloud monitoring platform, persisting the runtime context in the volatile memory to the non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control actuator and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. Furthermore, after the microcontroller is woken up from stop mode by an interrupt trigger signal, it first reads the external interrupt flag register to confirm that the wake-up source is a power-off interrupt, rather than other external events. Then, it jumps to the entry point of the emergency response strategy function pre-programmed into the internal flash memory. This emergency response strategy consists of three parallel tasks, coordinated by the microcontroller's real-time operating system or bare-metal polling scheduling mechanism.
[0025] The first task is to send an offline alarm message to the cloud-based monitoring platform. The cloud-based monitoring platform is an access control device management server deployed on a public cloud (such as Alibaba Cloud IoT Platform), responsible for receiving online status and alarm information from all access control boxes in the store. The microcontroller establishes a connection with the cloud-based monitoring platform using the MQTT protocol through the 4G cellular communication module (e.g., EC200U) built into the access control box. An alarm message is encapsulated according to the agreed-upon subject and payload format. This message includes: a unique device identifier (IMEI number or device serial number), a power outage event timestamp (obtained from the microcontroller's real-time clock, accurate to milliseconds), the store number, and the current remaining charge of the backup energy storage link. After the microcontroller sends this message, it starts a timer.
[0026] Furthermore, this step also involves a complete retransmission mechanism for sending offline alarm messages to the cloud monitoring platform. After sending an alarm message, the microcontroller waits for a preset alarm confirmation timeout period, which is set to 3 seconds. If an acknowledgment response is received from the cloud monitoring platform via a PUBACK message using the MQTT protocol within 3 seconds, the alarm message is confirmed to have been successfully delivered, and the microcontroller clears the sending buffer. If no response is received after 3 seconds, the same alarm message is retransmitted, with a maximum of 3 retransmissions. If no acknowledgment response is received after 3 retransmissions, it is determined that the 4G network signal at the current store is poor or the cloud is temporarily unreachable. At this time, the microcontroller appends a current timestamp to the alarm message and stores it in the alarm backlog area of non-volatile storage media in a circular queue. After the main power link is restored, the access control box device first checks the alarm backlog area during the power-on startup process. If there are any alarm messages that were not successfully sent, they are retransmitted in chronological order. This mechanism ensures that even in a store environment where the network is temporarily interrupted, power outage alarm information will never be lost.
[0027] The second task is to persist the runtime context from volatile memory to non-volatile storage. Runtime context refers to the business data being processed by the access control device at the moment of power failure. This data is stored in the microcontroller's static random access memory (SRAM) and is immediately lost upon power failure. Specifically, it includes: the current lock status (locked or unlocked) of the access control actuator, the queue of incomplete entry / exit requests (e.g., entry / exit records where cards were successfully swiped but the door has not yet been opened within the last 30 seconds), the current operating mode of the device (e.g., normal mode, inspection mode, or nighttime arming mode), and the last 20 event logs (including card swipe events, door opening events, timeout alarms, etc.). The microcontroller reads this data from the SRAM and writes it to an external serial flash memory chip (e.g., W25Q64) via the SPI interface according to a predefined TLV (Type-Length-Value) data structure. After the persistence operation is complete, a flag is set so that this critical data will not be lost even if the backup energy storage link subsequently runs out of power. When the main power receiving link is restored next time, the microcontroller reads this flag during the power-on initialization phase and restores or reports this data.
[0028] The third task is to dynamically decide whether to issue a temporary unlocking authorization based on the current locking status of the access control mechanism and the entry / exit request queue. The access control mechanism refers to the electromagnetic lock or electric bolt lock installed at the store entrance / exit. Its controller communicates with the microcontroller via a serial bus. The microcontroller reads the status register inside the access control mechanism controller via the I2C bus to obtain the current lock status (0 indicates locked, 1 indicates unlocked). Simultaneously, it reads the entry / exit request register, which records whether anyone is currently waiting to open the door. In a smart store scenario, entry / exit requests can originate from: customer card swiping, QR code scanning, pressing the exit button, or facial recognition. For example, if a customer successfully swipes their card at the moment of a power outage, before the electromagnetic lock opens, the corresponding bit in the entry / exit request register is set to 1. The decision-making logic is as follows: If the current lock status register value is 0 (locked) and there is at least one bit set to 1 in the access request register (indicating an incomplete access request), the microcontroller outputs a high-level pulse with a width of a valid time window (e.g., 800 milliseconds) to the motor drive circuit of the access control actuator through a general-purpose output port as a temporary unlock authorization. This pulse de-energizes the electromagnetic lock, allowing the customer to push the door open. After the 800-millisecond valid time window expires, the microcontroller automatically issues a locking command to the access control actuator, restoring the door to the locked state. Conversely, if the current lock status is locked but the access request register is all 0 (indicating no one is requesting access), the microcontroller does not issue a temporary unlock authorization, maintaining the locked state to avoid the risk of accidental door opening and property security when the store is unoccupied. If the current lock status is already unlocked (e.g., the door was opened before the power outage and has not yet been closed), a temporary unlock authorization is also not issued, maintaining the status quo to avoid repeated unlocking operations.
[0029] Step 104: After the power switch is completed, estimate the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate. In this embodiment, the backup energy storage link is preferably a double-layer capacitor array (also known as a supercapacitor array), specifically designed for the short-term emergency needs of smart store access control box devices. Specifically, it uses six 2.7V / 100F individual supercapacitors connected in series to form a capacitor array with a rated voltage of 16.2V and an equivalent capacitance of approximately 16.67F. A high-efficiency synchronous buck converter (e.g., TPS54360) then stabilizes the voltage to the required operating voltage of 5V or 3.3V for the access control box device. The discharge characteristics of this capacitor array are carefully designed to provide at least 10W of output power during power failure and to provide continuous power for at least 30 seconds under full load current (approximately 2A). This characteristic is sufficient to support the microcontroller in fully executing all tasks in the aforementioned emergency response strategy (including sending alarm messages, persisting data, deciding to unlock, and subsequent low battery warnings). In cost-sensitive scenarios, small-capacity lithium battery packs (such as lithium polymer batteries with a nominal voltage of 3.7V and a capacity of 1200mAh, coupled with a boost circuit to output 5V) can also be used. These lithium battery packs also meet the requirements of no less than 10W output power and 30 seconds of continuous power supply, but their cycle life is lower than that of supercapacitors.
[0030] The specific method for estimating the remaining operating time is as follows: During the factory calibration phase of the access control box device, the backup energy storage link is discharged and calibrated using automated testing equipment. Specifically, the capacitor array is discharged with constant currents of 100mA, 200mA, 500mA, 1A, 1.5A, and 2A, with the voltage value recorded every 10 milliseconds until the voltage drops below the device's minimum operating voltage (e.g., 4.5V). Based on this data, a voltage-time curve is established for each current, which is then converted into a voltage-remaining charge mapping table (e.g., the voltage range is discretized into 100 levels, each level corresponding to a remaining charge value). This mapping table is pre-stored in the microcontroller's internal flash memory. During actual power-off operation, the microcontroller uses an analog-to-digital converter to sample the output voltage of the backup energy storage link in real time, and simultaneously uses a current sensing chip (e.g., INA219, read via I2C interface) to sample the output current. Based on the currently sampled output voltage and current, the corresponding real-time remaining charge is obtained by looking up the table. The microcontroller then divides the real-time remaining charge by the moving average of the current from the last 10 sampled currents (i.e., the current average load consumption rate) to obtain the remaining operating time. This remaining operating time is updated every 100 milliseconds.
[0031] Step 105: When the remaining working time is lower than the preset warning time threshold, push the low battery warning signal to the cloud monitoring platform again, terminate non-core background tasks, and guide the device into a deep sleep power-saving mode.
[0032] Further, in step 104, the microcontroller updates the estimated remaining operating time every 100 milliseconds. An internally pre-stored warning duration threshold is set based on the characteristics of the backup energy storage link and the complete execution time of the emergency response strategy; in this embodiment, this threshold is set to 5 seconds. When the remaining operating time first decreases from above 5 seconds to below or equal to 5 seconds, the microcontroller immediately constructs a low-power warning message. This message is an MQTT protocol message with a subject of " / device / low_power" and a payload including: device identifier, current remaining operating time, current backup energy storage link voltage value, and a text message "The device will enter sleep mode in X seconds." The microcontroller sends this low-power warning message to the cloud monitoring platform via the 4G cellular communication module. The sending process also uses the retransmission mechanism described in step 103 (3-second wait timeout, maximum 3 retransmissions), but no further storage is performed because the remaining power is insufficient to support complex storage operations. If retransmission is not completed when the low-power warning is triggered, retransmission is terminated and the low-power warning is sent first. After transmission is complete, the microcontroller executes a resource pruning process: sequentially shutting down all non-core background tasks and peripherals. In a typical hardware configuration of an access control box device, non-core tasks include: breathing LED status indicator (off), buzzer drive (off), periodic polling of temperature and humidity sensors (off), serial port debug log output (off), and clocking of unused general-purpose input / output pins (off). Only the following minimal function set is retained: maintaining microcontroller core operation (clock frequency reduced to 2MHz), maintaining the responsiveness of external interrupt pins (to cope with unexpected mains power restoration), and maintaining single-transaction analog-to-digital conversion monitoring of backup energy storage link voltage (sampled once every 1 second). Finally, the microcontroller executes a deep sleep command, putting itself into stop mode. In this mode, the power consumption of the entire access control box device is reduced from approximately 2 watts during normal operation to approximately 50 microwatts, a reduction of approximately 40,000 times. This extremely low-power power-saving mode can extend the remaining 5 seconds of normal operation time to approximately 55 hours, which is sufficient to ensure that critical persistent data is not lost due to power depletion during the period from a power outage at night to the resumption of business the next day.
[0033] As can be seen from the above technical solutions, the beneficial effects of this embodiment are as follows: For smart store access control box devices, by detecting power failure through voltage drop rate, switching power supply in microseconds with hardware comparators and simultaneously waking up the microcontroller, dynamically deciding whether to temporarily unlock based on the access control lock status and entry / exit requests, estimating the remaining working time and providing graded warnings and hibernation, a full-link power failure linkage response from the power layer to the business layer is realized, effectively solving the problems of customers being trapped, data loss, and unknown reasons for offline operations when the store is powered off.
[0034] Figure 1The embodiments shown are merely basic examples of the method of the present invention. Other preferred embodiments of the method can be obtained by making certain optimizations and extensions based on them.
[0035] like Figure 2 The image shows another specific embodiment of the power outage rapid response and backup power linkage method of the present invention. This embodiment is a further description based on the foregoing embodiments. In this embodiment, the method includes the following steps:
[0036] Step 201: Collect the voltage drop rate, the locking status of the access control mechanism and the entry / exit request queue, the remaining working time of the backup energy storage link and the complete logs before the equipment enters the deep sleep power-saving mode for each power outage event, and upload the complete logs to the cloud monitoring platform. In the actual operation of smart stores, access control boxes in the same store may experience multiple power outages, such as frequent power outages caused by aging power lines, property maintenance, thunderstorms, etc. To extract trends in device health status from these historical power outages, this embodiment adds a feature parameter recording function to the emergency response strategy of the previous embodiment. Specifically, after each power outage event is triggered, the microcontroller, while executing the emergency response strategy, additionally records the following key feature parameters in a circular log buffer. This buffer is located in non-volatile storage media and has a capacity of the most recent 50 power outage events. The recorded characteristic parameters include: the voltage drop rate calculated in step 101, which reflects the severity of the mains power outage and indirectly indicates the impedance characteristics of the main power supply line; a snapshot of the access control actuator lock status register and entry / exit request queue read in step 103, recorded as two 16-bit mask values, representing the lock status at the moment of power failure and whether there are any incomplete entry / exit requests, respectively; the initial remaining working time estimated in step 104 (i.e., the value immediately after the power switch is completed), which directly reflects the current healthy capacity of the backup energy storage link; and the last segment of the operating log before the device enters the deep sleep power-saving mode in step 105, such as the contents of the circular buffer of the last 10 event records, including the timestamp of each card swipe, the duration of each door opening action, and the code of any abnormal alarm events. When the access control box device subsequently restores power through the main power receiving link, the microcontroller detects the restoration of the main power receiving link during the power-on initialization process and then reads all unuploaded power failure event records from the aforementioned circular log buffer in the non-volatile storage medium. The microcontroller packages these records into a multi-record message in chronological order and uploads the packaged data to the cloud monitoring platform via the 4G cellular communication module using the MQTT or HTTPS protocol. After the upload is complete, the microcontroller marks these records as "synchronized" locally and waits for the next power outage event to overwrite the old records.
[0037] Step 202: Based on the logs of multiple power outage events, the cloud monitoring platform determines the quality of the main power supply and the aging trend of the backup energy storage link. When the voltage drop rate of the same device shows an increasing trend or the remaining working time shows a decreasing trend exceeding the preset fluctuation range, a predictive maintenance reminder is output.
[0038] Furthermore, the cloud-based monitoring platform receives power outage event logs from thousands of access control boxes located throughout the city, and independently analyzes the health status evolution trend of each device. To accurately capture aging trends, this embodiment deploys a predictive model based on time series analysis in the cloud.
[0039] Model Architecture: This embodiment employs a lightweight Long Short-Term Memory (LSTM) network as the foundation of the prediction model. LSM is a variant of recurrent neural networks suitable for time series prediction tasks. Through a unique gating mechanism, it effectively captures long-term dependencies in time series, overcoming the gradient vanishing problem in traditional recurrent neural networks during long-sequence training. The specific model architecture is as follows: an input layer that receives a tensor of shape (sequence length, feature dimension); a LSM layer with 64 hidden units, whose output returns the complete time series (i.e., the output at each time step); a Dropout layer with a dropout rate of 0.2, used to randomly drop 20% of the neuron outputs during training to prevent overfitting; a fully connected layer that maps the 64-dimensional output of the LSM layer to a 2-dimensional output space; and finally, a linear activation function is used to output two consecutive predicted values. The entire model uses mean squared error as the loss function and is trained using the Adam optimizer.
[0040] Training Samples: The dataset used in the model training phase comes from power outage event logs collected from 200 access control boxes in 50 smart stores over the past 18 months of actual operation. After cleaning and labeling, approximately 150,000 valid samples were obtained. Each training sample corresponds to one power outage event for one device. The sample is constructed as follows: feature parameters of the five most recent power outage events for that device are extracted in chronological order to form a feature sequence. The features of each power outage event include two dimensions: voltage drop rate and initial remaining working time. Therefore, the shape of the input feature tensor is (5, 2). The label (target value) of each sample is the rate of change of voltage drop rate and the rate of change of remaining working time of the sixth power outage event. The rate of change is calculated by dividing the difference between the values of the sixth and fifth events by the time interval between the two events. Manual maintenance records were also incorporated during sample labeling. Device events that actually involved backup energy storage link replacement or main power supply line maintenance were marked as positive samples (i.e., abnormal trends). The training set, validation set, and test set were randomly divided in an 8:1:1 ratio.
[0041] Input / Output: During the inference phase, for a specific access control box device in a particular store, the cloud monitoring platform extracts the voltage drop rate sequence and remaining working time sequence of the device's five most recent power outage events, denoted as R1, R2, R3, R4, R5 (mV / ms) and T1, T2, T3, T4, T5 (seconds), respectively. These two sequences are concatenated into a tensor of shape (5, 2), which serves as the input to the Long Short-Term Memory (LSTM) network model. After forward propagation, the model outputs two predicted values: the next slope of the voltage drop rate ΔR and the next slope of the remaining working time ΔT. The cloud monitoring platform compares these two predicted slopes with preset fluctuation range thresholds. In this embodiment, the preset thresholds are as follows: an increase in the voltage drop rate exceeding 0.05 mV / ms per day is considered an abnormal increasing trend; an absolute value of the decrease in the remaining working time exceeding 0.2 seconds per day (i.e., a decrease of more than 0.2 seconds per day) is considered an abnormal decreasing trend. If ΔR exceeds the normal range, it indicates a problem with the main power supply quality of the store, which may be due to aging power lines, loose connections, or insufficient transformer capacity. If ΔT exceeds the normal range, it indicates that the backup energy storage link (double-layer capacitor array or lithium battery pack) of the access control box device is aging, with increased equivalent series resistance or decreased capacity. At this time, the cloud monitoring platform automatically generates a predictive maintenance reminder. This reminder is pushed to the store's maintenance personnel through various channels, such as through WeChat official account template messages, SMS messages to the store manager's mobile phone, and by creating a medium-priority inspection work order in the maintenance work order system via API interface. The following is a specific example of a reminder: "[Smart Store Operation & Maintenance] The backup energy storage link of the access control box device (SN: 12345678) at the XX Road store shows a clear aging trend. The remaining working time has decreased by an average of 0.35 seconds per day in the past 5 power outages, exceeding the threshold of 0.2 seconds / day. It is recommended to replace the supercapacitor array within 7 days to avoid emergency response failure during power outages." For a reminder regarding abnormal main power supply quality, the example is: "[Smart Store Operation & Maintenance] The main power supply quality of the access control box device (SN: 87654321) at the YY business district store has deteriorated, with the voltage drop rate showing an increasing trend, increasing by an average of 0.08mV / ms per day. It is recommended that the property management check the power supply line of this store." If the equipment has fewer than 5 historical power outages, prediction will not be made until sufficient data is accumulated.
[0042] Through the above steps, this embodiment realizes a closed-loop management system that ranges from rapid response to a single power outage to intelligent prediction of multiple power outages, upgrading passive post-event maintenance to proactive pre-event maintenance.
[0043] As can be seen from the above technical solutions, the beneficial effects of this embodiment are: by collecting the characteristic parameter logs of multiple power outage events of the access control box device, and combining them with the long short-term memory time series prediction model to analyze the evolution trend of voltage drop rate and remaining working time, it is possible to identify the deterioration of the main power supply quality and the aging of the backup energy storage link in advance, and output accurate predictive maintenance reminders, thereby reducing the sudden failure rate and operation and maintenance costs of the smart store access control system.
[0044] This invention also provides a device for rapid power outage response and backup power linkage. See also: Figure 3 The image shows a specific embodiment of a power outage rapid response and backup power linkage device provided by the present invention. This embodiment of the device is used to perform... Figures 1-2 The physical apparatus of the method. Its technical solution is essentially the same as the above embodiments, and the corresponding descriptions in the above embodiments also apply to this embodiment. The apparatus includes:
[0045] The power outage event determination module 301 is configured to monitor the power continuity parameters of the mains power supply in real time. When the rate of change of the power continuity parameters exceeds the preset safety threshold, a power outage event is determined to have occurred. The instruction and signal generation module 302 is configured to synchronously generate a power switching instruction and an interrupt trigger signal based on a power failure event. The power switching instruction is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in standby mode. The emergency response strategy invocation module 303 is configured to invoke the emergency response strategy pre-stored in the storage medium according to the interrupt trigger signal after the microcontroller is woken up. The emergency response strategy includes: sending offline alarm messages to the cloud monitoring platform, persisting the runtime context in the volatile memory to the non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control actuator and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. The remaining working time estimation module 304 is configured to estimate the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate after the power switch is completed. The power preservation mode guidance module 305 is configured to push a low power warning signal to the cloud monitoring platform again when the remaining working time is lower than the preset warning time threshold, and terminate non-core background tasks to guide the device into a deep sleep power preservation mode.
[0046] Figure 4This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include main memory, such as high-speed random-access memory (RAM), or it may also include non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include other hardware required for other services.
[0047] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0048] Memory is used to store instructions for execution. Specifically, instructions for execution are computer programs that can be executed. Memory can include main memory and non-volatile memory, and it provides the processor with execution instructions and data.
[0049] In one possible implementation, the processor reads the corresponding execution instructions from non-volatile memory into main memory and then executes them. Alternatively, it can obtain the corresponding execution instructions from other devices to form a power failure rapid response and backup power linkage device at the logical level. The processor executes the execution instructions stored in the memory to implement the power failure rapid response and backup power linkage method provided in any embodiment of the present invention through the executed execution instructions.
[0050] The above is as described in the present invention. Figure 3The method for rapid power outage response and backup power linkage provided in the illustrated embodiment can be applied to or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor.
[0051] The steps of the method disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0052] This invention also proposes a readable medium storing execution instructions. When these instructions are executed by the processor of an electronic device, the electronic device can perform a power failure rapid response and backup power linkage method provided in any embodiment of this invention, specifically for executing, for example... Figure 1 , Figure 2 The method shown.
[0053] The electronic devices in the foregoing embodiments may be computers.
[0054] Those skilled in the art will understand that embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention can be implemented in a completely hardware embodiment, a completely software embodiment, or a combination of software and hardware.
[0055] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0056] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0057] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. A method for rapid power outage response and backup power linkage, characterized in that, The method includes: The power continuity parameter at the mains power supply terminal is monitored in real time. When the rate of change of the power continuity parameter exceeds a preset safety threshold, a power outage event is determined to have occurred. Based on the power outage event, a power switching command and an interrupt trigger signal are generated synchronously. The power switching command is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in the standby state. After the microcontroller is woken up, it invokes the emergency response strategy pre-stored in the storage medium according to the interrupt trigger signal. The emergency response strategy includes: sending an offline alarm message to the cloud monitoring platform, persisting the runtime context in the volatile memory to the non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control mechanism and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. After the power switch is completed, the remaining working time for continuous power supply is estimated based on the real-time remaining charge of the backup energy storage link and the current load consumption rate. When the remaining working time is lower than the preset warning time threshold, a low battery warning signal is pushed to the cloud monitoring platform again, and non-core background tasks are terminated, guiding the device into a deep sleep power-saving mode.
2. The method according to claim 1, characterized in that, The real-time monitoring parameters for power continuity at the mains power supply end include: The DC bus voltage after mains power rectification is acquired through a voltage divider resistor network, and the voltage value is continuously read at a fixed sampling period using the analog-to-digital converter of the microcontroller. Calculate the voltage difference between adjacent sampling periods, divide the voltage difference by the sampling period to obtain the voltage drop rate, and use the voltage drop rate as the rate of change of the power continuity parameter. When the voltage drop rate exceeds a preset voltage change threshold per millisecond, the power outage event is determined to have occurred.
3. The method according to claim 1, characterized in that, The step of synchronously generating power switching commands and interrupt trigger signals based on the power outage event includes: The DC bus voltage after mains power rectification is monitored using a hardware comparator. When the DC bus voltage is lower than the first voltage threshold, the hardware comparator directly outputs a high-level power switching command to the control terminal of the power switching switch within the preset power switching response delay, switching the main power receiving link to the backup energy storage link. Meanwhile, the output of the hardware comparator is connected to the external interrupt pin of the microcontroller, and the level transition of the hardware comparator output serves as the interrupt trigger signal.
4. The method according to claim 1, characterized in that, The dynamic decision-making process based on the current locking status of the access control mechanism and the entry / exit request queue, including: Read the lock status register and entry / exit request register of the access control actuator; If the current lock status is locked and the entry / exit request queue indicates that there are incomplete entry / exit requests, then the temporary unlock authorization is issued; If the current locking state is locked and the entry / exit request queue indicates that there are no incomplete entry / exit requests, then the temporary unlock authorization will not be issued, and the locked state will be maintained. If the current locked state is unlocked, the temporary unlock authorization will not be issued.
5. The method according to claim 1, characterized in that, The backup energy storage link is a double-layer capacitor array or a small-capacity lithium battery pack, whose discharge characteristics meet the following requirements: providing an output power of not less than 10W at the moment of power failure and a continuous power supply time of not less than 30 seconds, so as to enable the complete execution of the emergency response strategy; then, the estimation of the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate includes: The voltage-charge curves of the backup energy storage link under different load currents are pre-calibrated. Sample the output voltage and output current of the current backup energy storage link, and determine the real-time remaining charge based on the corresponding curve; The remaining operating time is determined by dividing the real-time remaining charge by the average load current.
6. The method according to claim 1, characterized in that, The process of sending offline alert messages to the cloud monitoring platform includes: A short connection is established with the cloud monitoring platform through the cellular communication module built into the IoT device, and an alarm message containing the device identifier, power outage timestamp, and the current remaining charge of the backup energy storage link is sent. If no confirmation response is received from the cloud monitoring platform within the preset alarm confirmation waiting timeout period, the alarm message will be resent, and the number of resentments will not exceed the preset number. If no acknowledgment is received after a preset number of retransmissions, the alarm message will be stored in the non-volatile storage medium and retransmitted after the main power receiving link is restored.
7. The method according to any one of claims 1 to 6, characterized in that, Also includes: Collect the voltage drop rate, the locking status and entry / exit request queue of the access control mechanism, the remaining working time of the backup energy storage link, and the complete logs before the equipment enters the deep sleep power-saving mode for each power outage event, and upload the complete logs to the cloud monitoring platform. The cloud-based monitoring platform determines the quality of the main power supply and the aging trend of the backup energy storage link based on the logs of multiple power outage events. When the voltage drop rate of the same device shows an increasing trend or the remaining working time shows a decreasing trend exceeding the preset fluctuation range, a predictive maintenance reminder is output.
8. A power outage rapid response and backup power linkage device, characterized in that, include: The power outage event determination module is used to monitor the power continuity parameters of the mains power supply terminal in real time. When the rate of change of the power continuity parameters exceeds the preset safety threshold, a power outage event is determined to have occurred. The instruction and signal generation module is used to synchronously generate a power switching instruction and an interrupt trigger signal according to the power failure event. The power switching instruction is used to switch the main power receiving link of the device to the backup energy storage link, and the interrupt trigger signal is used to wake up the microcontroller in the standby state. An emergency response strategy invocation module is used to invoke an emergency response strategy pre-stored in the storage medium according to the interrupt trigger signal after the microcontroller is woken up. The emergency response strategy includes: sending offline alarm messages to the cloud monitoring platform, persisting the runtime context in the volatile memory to a non-volatile storage medium, and dynamically deciding whether to issue a temporary unlocking authorization based on the current locking status of the access control mechanism and the entry / exit request queue, and automatically restoring the locking command after the effective time window of the temporary unlocking authorization expires. The remaining working time estimation module is used to estimate the remaining working time of sustainable power supply based on the real-time remaining charge of the backup energy storage link and the current load consumption rate after the power switch is completed. The power-saving mode guidance module is used to push a low-battery warning signal to the cloud monitoring platform again when the remaining working time is lower than the preset warning time threshold, and terminate non-core background tasks to guide the device into a deep sleep power-saving mode.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.
10. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.