Abnormal power-off processing method and device for management system and medium

By using auxiliary power modules and multi-level recovery strategies in the management system, data loss and file system corruption caused by abnormal power outages are solved, and powerful power outage protection capabilities and rapid recovery functions are achieved, improving the reliability and stability of the system.

CN119806903APending Publication Date: 2025-04-11SUNWODA ENERGY TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411818015.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the case of abnormal power outage of management systems, the protection capability is poor, resulting in data loss and file system corruption. Repair depends on on-site engineers to maintain it, which is costly and has a long response time.

Method used

By introducing an auxiliary power module into the management system, the processor detects the main power state according to the preset cycle. When the main power is disconnected, the auxiliary power module supplies power and executes a power outage protection strategy, including saving data, exiting the process, recording power outage events, etc., and performing a multi-level recovery strategy after the main power is restored to restore the data and software system.

Benefits of technology

It effectively reduces the risks of data loss and file system corruption, provides data integrity protection at the hardware level, reduces dependence on field engineer maintenance, shortens system recovery time, and improves the reliability and stability of the management system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806903A_ABST
    Figure CN119806903A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal power-off processing method and device for a management system and a medium, is applied to the technical field of power-off protection, and is used for solving the problem that the protection capability of the management system is poor under the abnormal power-off condition. Specifically, the processor detects the working state of the main power supply according to a preset period, and the preset period is shorter than the endurance time of the auxiliary power supply module; and when the state of the main power supply is detected to be disconnected, executing a power-off protection strategy for the BMS or the EMS within the endurance time of the auxiliary power supply module. Therefore, when the main power supply is disconnected, a response is quickly made, and a power-off protection strategy is immediately started when the auxiliary power supply module is used for supplying power, so that the data is orderly stored and the process is closed when the main power supply of the management system is abnormally disconnected, the risks of data loss and file system damage are reduced, and data integrity protection is provided on the hardware level; a strong power-off protection capability is provided for a management system, and the problem of poor protection capability in the prior art is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of power failure protection, and in particular to an abnormal power failure processing method, device and medium of a management system. Background Art

[0002] In the BMS (Battery Management System) and EMS (Energy Management System) systems, the edge gateway serves as a bridge between the front-end and back-end servers, and undertakes important tasks such as data collection, processing, transmission, and storage. However, in actual applications, the edge gateway may encounter abnormal power outages due to power failures, equipment failures, and user violations. This will not only cause the loss of the data currently being processed, but may also affect the overall stability and reliability of the system.

[0003] At present, the existing abnormal power failure protection methods have the following disadvantages: although local backup can ensure that the data is reloaded after the system is restored, frequent writing will accelerate the wear of the storage medium, and the integrity of the latest data is difficult to guarantee in the event of a sudden power failure; although cloud backup can provide high fault tolerance and data recovery capabilities, it is susceptible to sudden power failures and network instability, resulting in incomplete or invalid backup data. In addition, the repair of the management system after it is damaged depends on after-sales maintenance by on-site engineers, which is not only costly and has a long response time, but may also affect the security, stability and user experience of the entire system due to the spread of faults. Therefore, how to provide an effective protection solution in the event of an abnormal power failure in the management system has become an urgent problem to be solved. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, device and medium for handling abnormal power failure of a management system, so as to solve the problem of poor protection capability in the event of abnormal power failure of the management system in the prior art.

[0005] In a first aspect, a method for handling abnormal power failure of a management system is provided, wherein the management system is located in a BMS or an EMS, the management system includes a first circuit and a second circuit, the first circuit includes a processor and an auxiliary power module, the management system is powered by a main power supply, and the auxiliary power module is used to power the first circuit when the main power supply is disconnected; the method includes:

[0006] The processor detects the working state of the main power supply according to a preset period, and the preset period is less than the endurance time of the auxiliary power supply module;

[0007] When it is detected that the state of the main power supply is disconnected, a power-off protection strategy for the BMS or EMS is executed within the life of the auxiliary power module.

[0008] Optionally, the abnormal power failure processing method of the management system proposed in the present application further includes:

[0009] After the main power supply is powered on, if it is detected in the history log that the last main power supply was abnormally disconnected and the power-off protection strategy for the BMS or EMS is triggered, the multi-level recovery strategy for the BMS or EMS is executed;

[0010] The multi-level recovery strategy includes a recovery strategy executed for the file system and software system in the data volume in the BMS or EMS.

[0011] Optional recovery policy for the file system in the data volume, including:

[0012] After the operating system of the management system is successfully started, check whether the file system in the data volume is abnormal;

[0013] When the file system in the data volume is abnormal, the file system in the data volume is repaired through the file repair function of the operating system;

[0014] When the repair fails, the file system in the data volume is formatted, and the data volume where the formatted file system is located is remounted through the operating system.

[0015] Optional recovery strategies for software systems, including:

[0016] Read the software system version upgrade file stored in the target file system; wherein the target file system is the file system in the data volume;

[0017] Based on the status mark and version identifier of the software system in the version upgrade file, the software system is version checked to obtain a version check result;

[0018] Based on the version detection result, determine the recovery strategy for the software system version.

[0019] Optionally, based on the status mark and version identifier of the software system in the version upgrade file, a version detection is performed on the software system to obtain a version detection result, including:

[0020] If the status mark indicates that the software system is in an upgrading state, and the current version identifier of the software system is the same as the historical version identifier, and it is detected that some updated files are missing in the file system, then it is determined that the version detection result is a first-category version upgrade failure of the software system;

[0021] If the status mark indicates that the software system is in an upgrading state, and it is detected that all updated files are missing in the file system, then it is determined that the version detection result is a second-type version upgrade failure of the software system.

[0022] Optionally, based on the version detection result, determine and execute a recovery strategy for the software system version, including:

[0023] If the version detection result is that the first type of version upgrade of the software system fails, then the download program is called to download the software system update package from the remote server or external device;

[0024] After the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

[0025] Optionally, based on the version detection result, determine and execute a recovery strategy for the software system version, including:

[0026] If the version detection result is that the second type version upgrade of the software system fails, then the update program is called to obtain the basic software environment package and install it to redeploy the operating environment of the software system;

[0027] Calling a download program to download a software system update package from a remote server or external device;

[0028] After the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

[0029] Optionally, the management system also includes a restore button;

[0030] When the operating system of the management system fails to start, the user is informed through the IoT alarm device;

[0031] After receiving the trigger operation of the user triggering the recovery button, the partition where the operating system is located is restored and the operating system is restarted.

[0032] Optionally, the power-off protection strategy includes one or more of the following:

[0033] Save process data and exit the process;

[0034] Record power outage events;

[0035] Report power outages;

[0036] Notify the lower-level equipment BMS or EMS to power off protection status;

[0037] Automatic shutdown.

[0038] In a second aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0039] Memory, used to store computer programs;

[0040] The processor is used to implement any one of the method steps in the above-mentioned first aspect when executing the program stored in the memory.

[0041] According to a third aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the method steps in the first aspect is implemented.

[0042] The present application uses a processor to periodically detect the working status of the main power supply according to a preset period that is less than the life of the auxiliary power module, to ensure a rapid response when the main power supply is disconnected, and to immediately initiate a power-off protection strategy during the power supply period using the auxiliary power module, so that the management system can save data and shut down processes in an orderly manner when the main power supply is abnormally disconnected, reducing the risk of data loss and file system damage, providing data integrity protection at the hardware level, providing the management system with powerful power-off protection capabilities, and effectively solving the problem of poor protection capabilities in the prior art. This is of great significance for improving the reliability and stability of the management system. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A management system provided in an embodiment of the present application;

[0045] Figure 2 A flowchart of a method for handling abnormal power failure in a management system provided in an embodiment of the present application;

[0046] Figure 3 A flowchart of a recovery strategy executed for a file system in a data volume provided in an embodiment of the present application;

[0047] Figure 4 A flowchart of a recovery strategy for a software system provided in an embodiment of the present application;

[0048] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. Unless otherwise defined, the technical terms or scientific terms used in this application should be the usual meanings understood by people with general skills in the field to which the present invention belongs. "Including" or "including" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect", "couple" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.

[0050] For ease of understanding, the terms involved in the embodiments of the present application are explained below:

[0051] The operating system is the system software that manages the computer hardware and software resources. It is the interface between the user and the computer hardware. The operating system is responsible for coordinating, managing and controlling the various hardware and software resources of the computer so that the user can use these resources efficiently.

[0052] A file system is a structure used to store, organize, access, and protect files and directories.

[0053] A software system is a collection of interrelated software components formed by the deployment of basic software environment packages and software system update packages, which is used to achieve specific functions or objectives and provide business functions.

[0054] A log file system records file operations in logs to reduce the risk of data corruption when the file system crashes.

[0055] The root file system contains the core files and directory structure of the operating system.

[0056] The fsck tool, or "file system check," is used to test the consistency and integrity of a file system and to repair file system errors.

[0057] The mkfs tool, which stands for "make new filesystem", is used to clear old data and create a new filesystem.

[0058] The abnormal power failure processing method of the management system provided in the embodiment of the present application can be applied in Figure 1In the management system shown, the management system is located in a BMS or an EMS. The management system 100 includes a first circuit 110 and a second circuit 120, the first circuit includes a processor 111 and an auxiliary power module 112, the management system 100 is powered by a main power supply, and the auxiliary power module 112 is used to power the first circuit 110 when the main power supply is disconnected.

[0059] Among them, the first circuit 110 includes a processor 111 and an auxiliary power supply module 112, which is the core part of the management system. The processor 111 is responsible for monitoring, calculation and decision-making, while the auxiliary power supply module 112 serves as a backup power supply to provide power support when the main power supply is disconnected. The auxiliary power supply module 112 can be composed of a supercapacitor and / or an uninterruptible power supply. According to actual use requirements, the first circuit 110 can also be additionally provided with necessary I / O interfaces, memory, flash memory and other core components on the core board. The second circuit 120 includes other components in the BMS or EMS other than the first circuit, such as expansion boards and expansion devices. Among them, the expansion device can be other functional devices such as backup interfaces, screens, keyboards and cameras.

[0060] The processor 111 in the first circuit 110 is responsible for executing various control algorithms, data processing tasks and system monitoring functions corresponding to the management system. The processor 111 in the first circuit 110 is also used for the processor to continuously detect the working status of the main power supply according to a preset cycle, and execute the power-off protection strategy when the main power supply is disconnected. The auxiliary power supply module 112 actively connects when the main power supply is disconnected to supply power to the processor 111. The second circuit 120 is responsible for executing functions such as security protection, data interaction and expansion device management of the management system.

[0061] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0062] Figure 2 The following is a flow chart of a method for handling abnormal power failure in a management system provided in an embodiment of the present application. Figure 2 As shown, a method for handling abnormal power failure of a management system, the management system is located in a BMS or an EMS, the management system includes a first circuit and a second circuit, the first circuit includes a processor and an auxiliary power module, the management system is powered by a main power supply, and the auxiliary power module is used to power the first circuit when the main power supply is disconnected, the method may include:

[0063] Step 210: The processor detects the working status of the main power supply according to a preset period, and the preset period is shorter than the battery life of the auxiliary power supply module.

[0064] Wherein, the processor detects the value of the power status file or the signal state of the preset virtual port according to the preset detection cycle. If the value of the power status file is 0 or the signal state of the preset virtual port is in a normal state, the working state of the main power supply is determined to be connected; if the value of the power status file is 1 or the signal state of the preset virtual port is in a warning state, the working state of the main power supply is determined to be disconnected. Wherein, the power status file is a file generated by the operating system collecting the voltage of the main power supply in real time and stored in the file system. The preset virtual port is a virtual port that represents the power-on state.

[0065] Since the auxiliary power module has a limited battery life, it is necessary to detect the disconnection state of the main power supply in time before it is exhausted. The preset period is set to be shorter than the battery life of the auxiliary power module to ensure that when the main power is disconnected, the processor can detect the abnormality in time and start the power-off protection strategy, leaving sufficient time for the execution of the power-off protection strategy, thereby protecting the data security, hardware integrity and overall stability of the management system.

[0066] Step 220: When it is detected that the state of the main power supply is disconnected, a power-off protection strategy for the BMS or EMS is executed within the life of the auxiliary power module.

[0067] In actual applications, when the main power supply is disconnected, the auxiliary power supply module automatically supplies power to the first circuit. When the processor determines that the main power supply is disconnected, it uses the power supply time of the auxiliary power supply module to shut down the operating system in an orderly manner, effectively preventing data loss and damage to the file system. The battery life of the auxiliary power supply module can be predetermined according to the duration of the power-off protection strategy.

[0068] The present application uses a processor to periodically detect the working status of the main power supply according to a preset period that is less than the life of the auxiliary power module, to ensure a rapid response when the main power supply is disconnected, and to immediately initiate a power-off protection strategy during the power supply period using the auxiliary power module, so that the management system can save data and shut down processes in an orderly manner when the main power supply is abnormally disconnected, reducing the risk of data loss and file system damage, providing data integrity protection at the hardware level, providing the management system with powerful power-off protection capabilities, and effectively solving the problem of poor protection capabilities in the prior art. This is of great significance for improving the reliability and stability of the management system.

[0069] In a possible implementation manner, the power failure protection strategy includes one or more of the following:

[0070] Save process data and exit the process;

[0071] Record power outage events;

[0072] Report power outages;

[0073] Notify the lower-level equipment BMS or EMS to power off protection status;

[0074] Automatic shutdown.

[0075] In practical applications, saving process data and exiting the process means that when the processor detects that the main power supply is disconnected, it will immediately save the data of the currently running process. After saving the data, the system will safely exit these processes, effectively preventing data loss or damage caused by sudden power outages, and ensuring that the process will not terminate abnormally due to sudden power outages, which may cause errors or data inconsistencies. The processor will record relevant information about the power outage event, such as the time, duration, and affected devices of the power outage. Recording the power outage event is beneficial for subsequent analysis of the cause of the power outage, evaluation of the impact of the power outage on the system, and formulation of preventive measures. Reporting the power outage event includes sending the information of the power outage event to the external device in the form of a message, which helps to promptly notify relevant personnel to respond to and handle the power outage event. Notify the lower-level device BMS or EMS of the power-off protection state, that is, send a notification of the power-off protection state to the lower-level device connected to it in the form of a message, and the lower-level device can take corresponding protection measures based on the received notification. Active shutdown is generally a strategy that is executed after other power-off protection strategies have been executed and the main power supply has not yet been restored. It protects the hardware in the management system from damage caused by voltage fluctuations or current shocks that may be caused by power outages.

[0076] In a possible implementation manner, in order to improve the recovery capability of the management system after an abnormal power outage and reduce the demand for on-site maintenance by engineers, the abnormal power outage processing method of the management system further includes:

[0077] After the main power supply is powered on, if it is detected in the history log that the last main power supply was abnormally disconnected and the power-off protection strategy for the BMS or EMS is triggered, the multi-level recovery strategy for the BMS or EMS is executed;

[0078] The multi-level recovery strategy includes a recovery strategy executed for the file system and software system in the data volume in the BMS or EMS.

[0079] In actual applications, the processor detects that the value of the power status file is 0 or the signal state of the preset virtual port is normal to determine that after the main power is powered on, it is determined from the historical log in the log file system that the last time the main power was abnormally disconnected and triggered the power-off protection strategy for the BMS or EMS. The recovery strategy of the file system in the data volume in the BMS or EMS and the recovery strategy executed by the software system in the BMS or EMS can be executed in sequence.

[0080] This application uses an automated power-off protection strategy and a multi-level recovery strategy to monitor the hardware's main power module, extend the life of the auxiliary power module, and restore the file system and software system execution in the data volume, reducing system damage and data loss caused by power outages, significantly reducing the need to rely on engineers for on-site maintenance, shortening system recovery time, and improving equipment reliability and user experience. The automated power-off protection strategy and multi-level recovery strategy simultaneously implement multi-level protection and automatic recovery functions in the event of a power outage, greatly improving the system's ability to resist risks.

[0081] For specific implementation, see Figure 3 As shown in the figure, the recovery strategy executed for the file system in the data volume includes:

[0082] Step 310: After the operating system of the management system is successfully started, check whether the file system in the data volume is abnormal.

[0083] In actual applications, the operating system of the management system will automatically perform automatic detection of the root file system and the file system in the data volume during the boot process after power-on. The automatic detection can be implemented by the fsck tool or by other detection tools. When the operating system detects that the data volume is damaged, it will use the fsck tool or other file repair tools to repair the file system in the data volume. Since the operating system fails to detect and repair the file system in the data volume, in order not to affect the boot process of the operating system, the data volume is mounted in asynchronous writable mode and the nofail mount strategy is adopted, that is, when the operating system fails to check and repair the data volume, the operating system will ignore the failure and continue the boot process. After the operating system successfully completes the boot operation including automatic inspection and a series of other operations, the processor performs the detection of the file system in the data volume again. The detection tool used by the processor to perform the detection of the file system in the data volume can be the same as or different from the tool used by the operating system to perform automatic detection during the boot process after power-on. When the processor detects that the file system in the data volume is abnormal, an error report can be obtained. The error report is divided into four types: super block error, index node error, data block error, and directory structure error.

[0084] Step 320: When the file system in the data volume is abnormal, the file system in the data volume is repaired by using the file repair function of the operating system.

[0085] In actual applications, when the processor receives an error report, it determines that the file system in the data volume is abnormal, and the processor calls the file repair function of the operating system for repair, that is, calls the operating system's repair tool to repair the file system in the data volume. Specifically, the processor calls the operating system's file repair function to perform corresponding repair operations according to the type of error report, where the repair operations include repairing damaged super blocks, restoring lost files or index nodes, restoring lost directories, and repairing damaged data blocks. The repair time depends on the size of the file system in the data volume and the severity of the error. The processor can receive the repair results fed back by the operating system's repair tool, and the repair results include two types: successful repair and failed repair.

[0086] Step 330: When the repair fails, the file system in the data volume is formatted, and the data volume where the formatted file system is located is remounted through the operating system.

[0087] In actual applications, when the processor receives a repair failure as the repair result, the processor clears all existing files and data structures on the data volume by calling a formatting tool, and reinitializes the data volume according to a specific file system format. The formatting tool may be a mkfs tool or other tools that can implement the formatting function. After the formatting is completed, the processor remounts the data volume where the formatted file system is located through the operating system so that it can be accessed by the operating system and application programs.

[0088] This application detects file system anomalies after the system is successfully powered on, and performs detailed repairs on the detected file system anomalies through the file repair function of the operating system, greatly improving the success rate of data recovery. In the event of a repair failure, the data volume is formatted and remounted to completely clear the file system errors and ensure the cleanliness and consistency of the data volume. In this way, not only does it reduce manual intervention, it also comprehensively improves the recovery capability of the data volume file system, providing strong support for the stable operation of the system and data security.

[0089] In order to further enhance the management and maintenance capabilities of the software system during implementation, refer to Figure 4 As shown in the figure, the recovery strategy implemented for the software system includes:

[0090] Step 410: Read the software system version upgrade file stored in the target file system; wherein the target file system is the file system in the data volume.

[0091] Step 420: Based on the status mark and version identifier of the software system in the version upgrade file, perform version detection on the software system to obtain a version detection result.

[0092] In actual applications, the version upgrade file is stored inside the file of the file system in the data volume. The version upgrade file records the current status of the software system and the version number of the software system. The status mark represents the current status of the software system. The current version status of the software system is either an upgrading status or a non-upgrading status. The version identifier represents the version number of the software system. Among them, the version identifier can be identified from the flag file, and the version identifier can be identified from the version file. When the software system starts to upgrade, the identifier in the flag file is adjusted from the non-upgrading status to the upgrading status, and the version number recorded in the version file is the version number before the upgrade. After the software system upgrade is completed, the upgraded version number is first recorded in the version file, and then the identifier in the flag file is adjusted from the upgrading status to the non-upgrading status.

[0093] In specific implementation, based on the status mark and version identifier of the software system in the version upgrade file, the software system is version checked to obtain version test results, which may include but are not limited to the following four types:

[0094] The first detection result: If the status mark indicates that the software system is in an upgrade state, and the current version identifier of the software system is the same as the historical version identifier, and it is detected that some updated files are missing in the file system, then the version detection result is determined to be a first-class version upgrade failure of the software system. The first-class version upgrade failure corresponds to the situation where the software system version upgrade is not completed when the main power supply is abnormally cut off.

[0095] The second test result: If the status mark indicates that the software system is in the state of being upgraded, and it is detected that all updated files are missing in the file system, then the version test result is determined to be the second type of version upgrade failure of the software system. The second type of version upgrade failure corresponds to the situation where the software system is formatted due to a fault or other reasons during the upgrade process.

[0096] The third test result: If the status mark indicates that the software system is in an upgrade state, and the current version identifier of the software system is different from the historical version identifier, and it is detected that there are no missing updated files in the file system, then the version detection result is determined to be a successful first-class version upgrade of the software system. The first-class version upgrade success corresponds to the situation where the version upgrade is completed when the main power supply is abnormally cut off, but the status mark has not changed.

[0097] The fourth detection result: if the status mark indicates that the software system is not in an unupgraded state, and the current version identifier of the software system is different from the historical version identifier or it is detected that there is no missing updated file in the file system, then the version detection result is determined to be the second type of successful version upgrade of the software system. The second type of successful version upgrade corresponds to the situation where the version upgrade is completed when the main power supply is abnormally powered off.

[0098] The fifth test result: If the status mark indicates that the software system is not in an unupgraded state, and the current version identifier of the software system is different from the historical version identifier or the updated file is detected to be missing in the file system, then the version test result is determined to be the third type of version upgrade failure of the software system. The third type of version upgrade failure corresponds to the situation that when the main power supply is abnormally cut off, the version upgrade has been completed, but during use, due to some errors, the updated file is lost or damaged.

[0099] Step 430: Based on the version detection result, determine and execute a recovery strategy for the software system version.

[0100] In actual applications, whether to perform recovery of the software system version and the corresponding recovery strategy can be determined based on the version detection result. The download program, update program and basic software environment package are stored in the read-only custom partition in the management system. Among them, the download program is used to download the software system update package from a remote server or an external device, wherein the download program can be an OTA download program, and the external device can be a USB flash drive, SD card or other storage device. The update program is used to apply the downloaded basic software environment package and software system update package to the software system of the management system. Among them, the update program can be an OTA update program that executes the OTA update script. The basic software environment package is used to deploy the most basic software system operating environment for the new operating system. The software system update package is used to further deploy complete application software on the existing basic software system operating environment to form a complete software system.

[0101] In specific implementation, if the version detection result is the first type of version upgrade failure, based on the version detection result, determine the recovery strategy for the software system version, which can be adopted but not limited to the following methods:

[0102] If the version detection result is that the first type of version upgrade of the software system fails, then the download program is called to download the software system update package from the remote server or external device;

[0103] After the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

[0104] Specifically, when the first type of version upgrade fails, the basic software system operating environment is not destroyed, only the software environment deployed by the software system update package is destroyed. In this case, there is no need to install the basic software environment package. The recovery strategy for the software system version is to re-download and install the software system update package, that is, the processor calls the built-in download program and tries to re-download the software system update package from a remote server or external device. After the software system update package is downloaded, the processor instructs the built-in update program to start installing the software system update package. The update program will deploy the new software version to the target system according to the preset steps and logic, replacing the files and configurations of the old version. At the same time, the processor will also record log information during the upgrade process to facilitate troubleshooting when problems arise.

[0105] In specific implementation, for the version detection result of the second type of version upgrade failure, based on the version detection result, determine the recovery strategy for the software system version, which can be adopted but not limited to the following methods:

[0106] First, if the version detection result is that the second type of version upgrade of the software system fails, the update program is called to obtain the basic software environment package and install it to redeploy the operating environment of the software system;

[0107] Then, calling the download program to download the software system update package from the remote server or external device;

[0108] Finally, after the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

[0109] Specifically, when the second type of version upgrade fails, the basic software system operating environment has been destroyed. In this case, the recovery strategy for the software system version is to first install the basic software environment package, and then re-download and install the software system update package, that is, call the update program to obtain the stored basic software environment package and install it to redeploy the software system's operating environment. After the basic software environment package is installed, the processor calls the built-in downloader and tries to re-download the software system update package from a remote server or external device. After the software system update package is downloaded, the processor instructs the built-in updater to start installing the software system update package. The updater will deploy the new software version to the target system according to the preset steps and logic, replacing the old version's files and configurations. Similarly, the processor will also record log information during the upgrade process to facilitate troubleshooting when problems arise.

[0110] In addition, if the version detection result is that the first type of version upgrade is successful, the status mark can be automatically updated to a state that is not in an upgrade state. If the version detection result is that the second type of version upgrade is successful, no additional operation is required. If the version detection result is that the third type of version upgrade fails, the update program is called to obtain the basic software environment package and install it to redeploy the operating environment of the software system; then, the download program is called to download the software system update package from a remote server or external device; finally, after the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

[0111] The recovery mechanism of the software system of the management system of the present application can automatically detect and complete unfinished upgrades after power failure recovery, ensure the consistency of the software environment, reduce the risk of system unavailability or data loss due to upgrade failure, and even in the case of upgrade failure or system reset, the system can still automatically recover to the latest version, enhancing system stability and reliability. In addition, based on the file system stored in the data volume based on the status mark and version identification, and the judgment logic based on the status mark and version identification is usually relatively simple, the processor can quickly obtain the current status and version information of the software system without adding almost any additional delay, and make an accurate judgment on the version detection result. By accurately judging the version detection result, the blind implementation of the recovery strategy of the software system version is avoided, and the pertinence and accuracy of the recovery strategy are improved. Differentiated recovery strategies are adopted for different version upgrade failures. This refined processing improves recovery efficiency and reduces unnecessary operations.

[0112] In a possible implementation, after the software system update package is downloaded, the processor verifies the downloaded software system update package to ensure its integrity and correctness. The specific verification method includes at least one of checking the file size, MD5 (Message Digest Algorithm 5) and SHA-1 (Secure Hash Algorithm 1) hash value.

[0113] In a possible implementation, after obtaining the software system after the version upgrade, the processor can perform version detection on the software system again based on the status mark and version identifier of the software system in the version upgrade file. If the version detection result is that the second type of version upgrade is successful, it means that the recovery strategy is successfully executed, and the user or system administrator can be notified to perform subsequent operations. If the version detection result is that the first type of version upgrade fails, the rollback mechanism is triggered, and the backed-up key data is used to restore the software system to the state before the upgrade, and the cause of the failure is recorded for subsequent analysis. Among them, the backed-up key data is the key data backed up before the software system is upgraded.

[0114] In a possible implementation, the management system further includes a restore button; and the operating system restore process based on the restore button includes but is not limited to the following methods:

[0115] First, after the management system's operating system fails to boot, the user is notified through the IoT alarm device;

[0116] Then, after receiving a trigger operation of the user triggering the restore button, the partition where the operating system is located is restored, and the operating system is restarted.

[0117] In actual applications, after the operating system of the management system fails to start up, the processor of the management system will immediately trigger the IoT alarm device and inform the user of the fault information through SMS, email or APP push. The trigger operation of the user triggering the recovery button generates a recovery instruction. After receiving the user's recovery instruction, the management system will enter the automatic recovery process. The partition where the operating system is located is a partition that includes all core files and directories required for the operation of the operating system, as well as a partition that stores the kernel image and boot loader required during the startup of the operating system. Specifically, the partition where the operating system is located includes a kernel partition, a root file system partition, and some partitions related to the operating system. Different recovery methods are used according to the different access rights of the partition where the operating system is located. If the access right of the partition where the operating system is located is a writable partition, the processor can call the formatting tool to format the partition where the operating system is located; if the access right of the partition where the operating system is located is a read-only partition, the processor can call the disk image tool to create a complete image of the read-only partition, call the image processing tool to analyze the content of the image file, generate an image file for recovery, and call the disk image tool to write the content of the image file to the read-only partition to replace the data in the original read-only partition. After the recovery is completed, the operating system will automatically restart.

[0118] In the operating system recovery process that introduces a recovery button in this application, when the management system encounters a failure to boot up the operating system, the system will immediately send a fault notification to the user through the IoT alarm device to ensure that the user can quickly learn and take action, thereby achieving a rapid response to fault discovery and recovery, effectively shortening the system downtime, and ensuring the continuous and stable operation of the management system. The user only needs to simply trigger the recovery button to start the automated recovery process, which includes formatting the partition where the operating system is located to thoroughly remove potential errors and damage and provide a clean environment for reinstalling the system. Subsequently, the system automatically restarts and attempts to reload the operating system without the user having to perform complex manual operations, simplifying the operating system recovery process, reducing the user's operating difficulty, and significantly improving recovery efficiency and accuracy.

[0119] In addition, the abnormal disconnection state of the main power supply, emergency shutdown of the system, updating the working state of the main power supply from the abnormal disconnection state to the normal working state, formatting of the data volume, repair of the data volume, recovery of the software system and other operations will be recorded by the log file system, and seek opportunities to report to the cloud platform and the user end. The log helps the operation and maintenance personnel to quickly locate and solve the fault; the management system can also work with the BMS and EMS in a timely manner through parallel or downward links to quickly adjust the state of the management system, such as: cutting off the normal power supply, starting the backup power supply, etc., to prevent the fault from further expanding. The external network of the management system can usually use a mobile wireless network; the parallel and downward communication of the management system can usually use RS485, CAN and Ethernet. When the management system has an abnormal power-off protection function, the software system can choose to send control instructions to the battery pack according to the actual situation to achieve control of the battery pack strategy adjustment or charge and discharge control.

[0120] In a possible implementation, the root file system partition uses an overlayfs cascade file system; wherein the read-only partition is used to store the original data of the operating system in the management system in a factory state, and the writable partition is used to store the dynamic data generated when the operating system in the management system is running.

[0121] In actual applications, storing original data in a read-only partition can prevent accidental modification or deletion of this data during system operation, thereby protecting the integrity of the root file system partition. Writable partitions are used to store dynamic data generated during the operation of the operating system within the management system, such as configuration changes, temporary files, etc. When the system needs to be updated or restored, only the data in the writable partition needs to be replaced or reset, which can easily implement system upgrades and rollbacks. This support makes the system easier to maintain and manage, reducing operation and maintenance costs. In addition, when the system fails or is abnormal, the normal operation of the system can be quickly restored by resetting or replacing the data in the writable partition. This rapid recovery capability reduces system downtime and maintenance costs, and improves system availability and stability.

[0122] In addition, the data volume uses the ext4 log file system. The software system uses a cache and transaction mechanism when writing data to the data volume, and reduces the number of write operations through regular sync. In this way, through the combined application of the overlay file system and the ext4 log file system, the file system self-protection and transaction management are realized, reducing the wear of the storage medium caused by frequent write operations.

[0123] The present application also provides an electronic device, such as Figure 5As shown, it includes a processor 510 , a communication interface 520 , a memory 530 and a communication bus 540 , wherein the processor 510 , the communication interface 520 , and the memory 530 communicate with each other via the communication bus 540 .

[0124] Memory 530, for storing computer programs;

[0125] The processor 510 is used to execute the program stored in the memory 530 to implement the following steps:

[0126] The processor detects the working state of the main power supply according to a preset period, and the preset period is less than the endurance time of the auxiliary power supply module;

[0127] When it is detected that the state of the main power supply is disconnected, a power-off protection strategy for the BMS or EMS is executed within the life of the auxiliary power module.

[0128] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0129] The communication interface is used for communication between the above electronic device and other devices.

[0130] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0131] The above-mentioned 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, discrete hardware components.

[0132] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 2 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0133] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes any of the abnormal power failure processing methods of the management system in the above embodiments.

[0134] In another embodiment provided in the present application, a computer program product including instructions is also provided. When the computer program product is executed on a computer, the computer executes any one of the abnormal power-off processing methods of the management system in the above embodiments.

[0135] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0137] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0139] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.

[0140] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A method for handling abnormal power failure in a management system, characterized in that: The management system is located in a BMS or an EMS, the management system includes a first circuit and a second circuit, the first circuit includes a processor and an auxiliary power module, the management system is powered by a main power supply, and the auxiliary power module is used to power the first circuit when the main power supply is disconnected; the method includes: The processor detects the working state of the main power supply according to a preset period, and the preset period is less than the endurance time of the auxiliary power supply module; When it is detected that the state of the main power supply is disconnected, a power-off protection strategy for the BMS or EMS is executed within the life time of the auxiliary power supply module.

2. The method according to claim 1, characterized in that The method further comprises: After the main power supply is powered on, if it is detected in the history log that the last main power supply was abnormally disconnected and the power-off protection strategy for the BMS or EMS was triggered, a multi-level recovery strategy for the BMS or EMS is executed; The multi-level recovery strategy includes a recovery strategy executed for the file system and software system in the data volume in the BMS or EMS.

3. The method according to claim 2, characterized in that The recovery strategy implemented for the file system in the data volume includes: After the operating system of the management system is successfully started, detecting whether the file system in the data volume is abnormal; When the file system in the data volume is abnormal, the file system in the data volume is repaired by using the file repair function of the operating system; When the repair fails, the file system in the data volume is formatted, and the data volume where the formatted file system is located is remounted through the operating system.

4. The method according to claim 2, characterized in that: Recovery strategies implemented for software systems, including: Reading a version upgrade file of a software system stored in a target file system; wherein the target file system is a file system in a data volume; Based on the status mark and version identifier of the software system in the version upgrade file, performing version detection on the software system to obtain a version detection result; Based on the version detection result, determine and execute the recovery strategy for the software system version.

5. The method according to claim 4, characterized in that Based on the status mark and version identifier of the software system in the version upgrade file, the software system is version checked to obtain a version check result, including: If the status mark indicates that the software system is in an upgrading state, and the current version identifier of the software system is the same as the historical version identifier, and it is detected that some updated files are missing in the file system, then it is determined that the version detection result is a first-category version upgrade failure of the software system; If the status mark indicates that the software system is in an upgrading state, and it is detected that all updated files are missing in the file system, then the version detection result is determined to be a second type version upgrade failure of the software system.

6. The method according to claim 5, characterized in that Based on the version detection results, determine the recovery strategy for the software system version, including: If the version detection result is that the first type of version upgrade of the software system fails, then the download program is called to download the software system update package from the remote server or external device; After the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

7. The method according to claim 5, characterized in that Based on the version detection results, determine the recovery strategy for the software system version, including: If the version detection result is that the second type version upgrade of the software system fails, then calling the update program to obtain the basic software environment package and install it to redeploy the operating environment of the software system; Calling a download program to download a software system update package from a remote server or external device; After the software system update package is downloaded, the update program is instructed to install the software system update package to obtain the software system after the version upgrade.

8. The method according to claim 1, characterized in that The management system also includes a restore button; When the operating system of the management system fails to start up, the user is informed through the IoT alarm device; After receiving a trigger operation of the user triggering the restore button, the partition where the operating system is located is restored, and the operating system is restarted.

9. The method according to claim 1, characterized in that: The power failure protection strategy includes one or more of the following: Save process data and exit the process; Record power outage events; reporting the power outage; Notify the lower-level equipment BMS or EMS to power off protection status; Automatic shutdown.

10. An electronic device, characterized in that: The electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-9 when executing a program stored in a memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • Method for handling abnormal power interruption of management system, and device and medium

    WO2026124237A1