A method and related device for saving and restoring snapshots of electromagnetic transient simulation operation state

By building a memory management module and a shared memory mechanism, the complexity of data snapshot storage and recovery in electromagnetic transient simulation software is solved, and the effect of simplifying the operation process, improving versatility and data security is achieved.

CN119179605BActive Publication Date: 2025-09-23ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411568853.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-09-23
Estimated Expiration
2044-11-05

AI Technical Summary

Technical Problem

Existing electromagnetic transient simulation software has high requirements for data snapshot storage and recovery and has poor versatility. Third-party plug-ins do not support related operations, resulting in the inability to meet data snapshot integrity requirements.

Method used

By building a memory management module, using shared memory and memory manager to replace the libc library interface, setting data backup points, and implementing data backup and recovery, including the initialization of the memory management module, data backup and recovery operations, efficient memory utilization and data integrity are ensured.

Benefits of technology

It simplifies the operational process of data snapshot saving and recovery, improves versatility and data security, is applicable to electromagnetic transient simulation software of various sizes, ensures data integrity and consistency, and is easy to maintain and expand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179605B_ABST
    Figure CN119179605B_ABST
Patent Text Reader

Abstract

The present application discloses a method for saving and restoring snapshots of electromagnetic transient simulation operation and related devices. The method includes: applying for a first shared memory according to simulation requirements and mapping it to a specified virtual address to construct a memory management module; replacing the interface provided by the libc library through the interface of the memory management module; and setting a unique global variable in the process to save the context data of each module of the process. A data backup point is set in the program, and when a data backup instruction is received, a data backup operation is triggered, including: backing up the context information of each module of the process and backing up the data of the first shared memory to a specified file. A second shared memory with the same data size as the first shared memory is applied and mapped to a specified virtual address; and during the recovery phase of each module, the context data of each module saved in the backup file is read and restored to the context of each module. This solves the problem that the existing technology has high requirements for software development and poor versatility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electromagnetic transient simulation, and in particular to a method for saving and restoring snapshots of electromagnetic transient simulation operation states and related devices. Background Art

[0002] Electromagnetic transient simulation is a key method for power system simulation analysis. It is primarily used to study transient processes within power systems, such as lightning surges, switching overvoltages, and resonant overvoltages. During electromagnetic transient simulation, operational data snapshot storage and recovery technology is particularly important. This technology records critical simulation data in real time and quickly restores this data when needed, ensuring the continuity and stability of the simulation process.

[0003] Currently, operational data snapshot preservation and recovery technology is primarily based on existing electromagnetic transient simulation software and hardware platforms, achieved through improvements to the algorithms and mechanisms for data snapshot preservation and recovery. A common implementation involves periodically or on-demand recording of the simulation system's state information during the simulation process, including parameters such as voltage, current, and power at each node, as well as the state and parameters of each component. This information is saved as a data snapshot and stored on a designated storage medium. When data recovery is required, the user can select a specific data snapshot for recovery. The recovery process primarily involves the following steps: first, reading the data snapshot file from the storage medium; second, parsing the data snapshot file to extract the state information and parameters; and finally, reloading the extracted state information and parameters into the simulation system, thereby restoring the simulation process to a specific point in time.

[0004] However, existing electromagnetic transient simulation software has several major shortcomings in data snapshot storage and recovery: Saving data snapshots requires the software's native support for snapshot serialization and deserialization, and also requires defining the snapshot storage format, placing high demands on software development. Furthermore, data snapshot integrity cannot be guaranteed if third-party plug-ins do not support these operations. Therefore, it is important to develop a simple, universal method for saving and restoring operational snapshots of electromagnetic transient simulations. Summary of the Invention

[0005] The present application provides a method and related device for saving and restoring snapshots of an electromagnetic transient simulation operation state, which are used to solve the problem that the existing technology has high requirements for software development and poor versatility.

[0006] In view of this, the first aspect of the present application provides a method for saving and restoring snapshots of an electromagnetic transient simulation operation state, the method comprising:

[0007] According to the simulation requirements, a first shared memory including a memory manager is applied for and mapped to a specified virtual address, thereby constructing a memory management module; an interface provided by the memory management module is used to replace the interface provided by the libc library; a unique global variable is set in the process to store context data of each module of the process;

[0008] A data backup point is set in the program for receiving and processing data backup instructions. When the data backup instruction is received, a data backup operation is triggered. The data backup operation includes: backing up context information of each module of the process and backing up data in the first shared memory to a designated file to obtain a backup file;

[0009] Apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery phase of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

[0010] Optionally, the memory manager is used to manage the first shared memory based on a SLAB algorithm and provide an interface for memory application and release.

[0011] Optionally, replacing the memory application and release interface provided by the libc library by providing an interface through the memory management module includes:

[0012] The memory application and release interface provided by the libc library is replaced with the interface provided by the memory management module by using the piling technology.

[0013] Optionally, the reading of the context data of each module stored in the backup file and restoring the data to the context of each module further includes:

[0014] After the module completes data recovery, a verification operation is performed on the module, and the verification operation includes: checking the module status, variable values, and data in the shared memory.

[0015] A second aspect of the present application provides a system for saving and restoring snapshots of an electromagnetic transient simulation operation state, the system comprising:

[0016] A memory management unit is used to apply for a first shared memory containing a memory manager according to simulation requirements and map it to a specified virtual address, thereby constructing a memory management module; replace the interface provided by the libc library with an interface provided by the memory management module; and set a unique global variable in the process to store context data of each module of the process;

[0017] a data backup unit, configured to set a data backup point in the program for receiving and processing a data backup instruction, and trigger a data backup operation upon receiving the data backup instruction, wherein the data backup operation includes backing up context information of each module of the process and backing up data in the first shared memory to a designated file to obtain a backup file;

[0018] The data recovery unit is used to apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery stage of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

[0019] Optionally, the memory manager is used to manage the first shared memory based on a SLAB algorithm and provide an interface for memory application and release.

[0020] Optionally, replacing the memory application and release interface provided by the libc library by providing an interface through the memory management module includes:

[0021] The memory application and release interface provided by the libc library is replaced with the interface provided by the memory management module by using the piling technology.

[0022] Optionally, the reading of the context data of each module stored in the backup file and restoring the data to the context of each module further includes:

[0023] After the module completes data recovery, a verification operation is performed on the module, and the verification operation includes: checking the module status, variable values, and data in the shared memory.

[0024] A third aspect of the present application provides a device for saving and restoring snapshots of an electromagnetic transient simulation operation state, the device comprising a processor and a memory:

[0025] The memory is used to store program code and transmit the program code to the processor;

[0026] The processor is configured to execute the steps of the electromagnetic transient simulation running state snapshot saving and recovery method as described in the first aspect above according to the instructions in the program code.

[0027] In a fourth aspect, the present application provides a computer-readable storage medium for storing program code, wherein the program code is used to execute the electromagnetic transient simulation running state snapshot saving and recovery method described in the first aspect.

[0028] It can be seen from the above technical solutions that this application has the following advantages:

[0029] 1) Simplify the operation process:

[0030] This application significantly simplifies the user's workflow for saving and restoring data snapshots by optimizing memory management and data backup and recovery mechanisms. Users can easily back up and restore data without complex setup and configuration, improving work efficiency.

[0031] 2) Improve versatility:

[0032] The technical solution of this application is highly versatile and applicable to electromagnetic transient simulation software of various sizes. Whether it is a small experimental project or a large and complex system, this application can provide stable and efficient data snapshot storage and recovery functions to meet the needs of different users.

[0033] 3) Enhanced data security:

[0034] Through sophisticated memory management and an efficient data backup mechanism, this application ensures data integrity and consistency. During the data backup process, all key information is accurately recorded and saved to the designated file, eliminating the risk of data loss or corruption. Furthermore, during the data recovery process, this application can accurately restore the backup data to its original state, ensuring data reliability and security.

[0035] 4) Easy to maintain and expand:

[0036] The technical solution of this application is well designed, clearly structured, and easy to maintain and expand. With the continuous development of electromagnetic transient simulation technology, users can expand the functions or optimize the performance of the present invention according to actual needs to meet higher-level needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A schematic flow chart of a method for saving and restoring snapshots of an electromagnetic transient simulation operation state provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of a shared memory provided in an embodiment of the present application;

[0039] Figure 3 This is a structural diagram of an electromagnetic transient simulation running state snapshot storage and recovery system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0041] See also Figure 1 , a method for saving and restoring an electromagnetic transient simulation running state snapshot provided in an embodiment of the present application includes:

[0042] Step 101: Apply for the first shared memory including the memory manager according to the simulation requirements and map it to the specified virtual address, thereby building a memory management module; replace the interface provided by the libc library with the interface provided by the memory management module; set a unique global variable in the process to save the context data of each module of the process.

[0043] In one embodiment, the memory manager in step 101 is used to manage the first shared memory based on the SLAB algorithm and provide an interface for memory application and release.

[0044] In one embodiment, in step 101, replacing the memory request and release interface provided by the libc library with the interface provided by the memory management module includes:

[0045] The memory allocation and release interfaces provided by the libc library are replaced with the interfaces provided by the memory management module using the piling technology.

[0046] It should be noted that step 101 includes the following steps in specific implementation:

[0047] Step 1011: Initialize the memory management module;

[0048] During the process initialization phase, a large block of shared memory is requested to meet the simulation requirements.

[0049] Map the shared memory to the specified virtual address to ensure the consistency of the memory address during data backup and recovery.

[0050] The front area of ​​the shared memory is used by the memory manager, which is responsible for managing and allocating shared memory and providing interfaces for memory application and release. Figure 2 shown.

[0051] All memory used by the memory manager comes from shared memory. It is recommended to use the SLAB algorithm for memory management to improve the efficiency of memory allocation and release.

[0052] Step 1012: Replace the memory request and release interface provided by libc;

[0053] Using stubbing technology, the memory allocation and release interfaces provided by the libc library are replaced with those provided by the memory management module. It should be noted that the libc library is a function library that complies with the ANSI C standard and provides macros, type definitions, string manipulation functions, mathematical calculation functions, and input and output functions used in the C language.

[0054] After the stub replacement is completed, when the module in the program calls the memory interface of libc, it actually calls the interface provided by the memory management module, thereby realizing unified management of shared memory.

[0055] Step 1013: Initialize the program module.

[0056] The process sets a unique global variable to save the context data of each module of the process.

[0057] The memory required for the operation of each module (including the memory pointed to by the pointer variables defined in the module context) is applied for and released using the interface provided by the memory management module to ensure the uniformity of memory management.

[0058] Step 102: Set a data backup point in the program for receiving and processing data backup instructions. When the data backup instruction is received, the data backup operation is triggered. The data backup operation includes: backing up the context information of each module of the process and backing up the data of the first shared memory to a specified file to obtain a backup file.

[0059] It should be noted that step 102 includes the following steps in specific implementation:

[0060] A data backup point is set in the program to receive and process data backup instructions.

[0061] Step 1021: Set a data backup point;

[0062] A data backup point is set in the program to receive and process data backup instructions.

[0063] Data backup points can be set at key nodes in the simulation process so that the simulation status can be quickly restored when needed.

[0064] Step 1022: Receive a data backup instruction;

[0065] Receive data backup instructions from users or systems at the data backup point.

[0066] When a data backup instruction is received, a data backup operation is triggered.

[0067] Step 1023: Data backup;

[0068] The data backup operation is divided into two parts:

[0069] a. Back up the context information of each process module to a specified file. This includes key information such as module status and variable values.

[0070] b. Back up the entire shared memory data (including the shared memory data of the memory manager) to the specified file.

[0071] Step 103: Apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery phase of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

[0072] In one embodiment, in step 103, the context data of each module stored in the backup file is read and restored to the context of each module, and then the following steps are further included:

[0073] After the module completes data recovery, a verification operation is performed on the module. The verification operation includes: checking the module status, variable values, and data in the shared memory.

[0074] It should be noted that step 103 includes the following steps in specific implementation:

[0075] Step 1031: Apply for shared memory;

[0076] During the process initialization phase, a second shared memory with the same size as the backup shared memory data is requested.

[0077] Map the requested second shared memory to the specified virtual address so that the restored module can access it.

[0078] Step 1032: Restore module context;

[0079] During the recovery phase of each module, the context data of each module saved in the backup file is read.

[0080] Restore the read context data to the context of each module, including the module status, variable values, etc.

[0081] Ensure that the restored module can correctly identify and use the data in the shared memory.

[0082] Step 1033: Verify the recovery result;

[0083] After the data is restored, perform necessary verification operations to ensure that the restored simulation state is consistent with the state before the backup.

[0084] Verification operations can include checking the module's status, variable values, and data in shared memory.

[0085] The embodiment of the present application provides a method for saving and restoring snapshots of the running state of electromagnetic transient simulation, and designs a unique memory management module, including: initialization of shared memory, application of memory management algorithm, and replacement of libc memory interface, to ensure efficient use and unified management of memory, and avoid memory fragmentation and conflict. In addition, improvements are made to the data backup and recovery method, including: setting of data backup points, reception and processing of backup instructions, and data backup and recovery operations, to ensure the integrity and consistency of data backup and recovery. Furthermore, the present application ensures the collaborative work between various modules such as memory management, data backup and recovery in the overall design of the technical solution; in the compatibility design of the technical solution, the technical solution can be applied to electromagnetic transient simulation software of various sizes, thereby improving its versatility and applicability.

[0086] The above is a method for saving and restoring an electromagnetic transient simulation running state snapshot provided in an embodiment of the present application. The following is a system for saving and restoring an electromagnetic transient simulation running state snapshot provided in an embodiment of the present application.

[0087] See also Figure 3 , an electromagnetic transient simulation running state snapshot storage and recovery system provided in an embodiment of the present application includes:

[0088] The memory management unit 201 is used to apply for the first shared memory containing the memory manager according to the simulation requirements and map it to the specified virtual address, thereby building a memory management module; replace the interface provided by the libc library through the interface provided by the memory management module; set a unique global variable in the process to save the context data of each module of the process.

[0089] In one embodiment, the memory manager in the memory management unit 201 is used to manage the first shared memory based on the SLAB algorithm and provide an interface for memory application and release.

[0090] The data backup unit 202 is used to set a data backup point in the program for receiving and processing data backup instructions. When a data backup instruction is received, a data backup operation is triggered. The data backup operation includes: backing up the context information of each module of the process and backing up the data of the first shared memory to a specified file to obtain a backup file.

[0091] In one embodiment, the memory management unit 202 replaces the memory allocation and release interface provided by the libc library with an interface provided by the memory management module, including:

[0092] The memory allocation and release interfaces provided by the libc library are replaced with the interfaces provided by the memory management module using the piling technology.

[0093] The data recovery unit 203 is used to apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery phase of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

[0094] In one embodiment, the context data of each module stored in the backup file is read and restored to the context of each module, and then the following steps are further included:

[0095] After the module completes data recovery, a verification operation is performed on the module. The verification operation includes: checking the module status, variable values, and data in the shared memory.

[0096] Furthermore, an embodiment of the present application also provides an electromagnetic transient simulation running state snapshot storage and recovery device, the device comprising a processor and a memory:

[0097] The memory is used to store program code and transmit the program code to the processor;

[0098] The processor is configured to execute the steps of the electromagnetic transient simulation running state snapshot saving and recovery method as described in the above method embodiment according to the instructions in the program code.

[0099] Furthermore, a computer-readable storage medium is provided in an embodiment of the present application, and the computer-readable storage medium is used to store program code, and the program code is used to execute the electromagnetic transient simulation running state snapshot saving and recovery method described in the above method embodiment.

[0100] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0101] The terms "first," "second," "third," "fourth," and the like (if any) in the specification of the present application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or apparatus.

[0102] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.

[0103] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0104] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0105] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0106] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name: Read-Only Memory, English abbreviation: ROM), random access memory (full name: Random Access Memory, English abbreviation: RAM), disk or optical disk, and other media that can store program code.

[0107] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for saving and restoring snapshots of electromagnetic transient simulation operation, characterized in that: include: Apply for the first shared memory containing the memory manager according to the simulation requirements and map it to the specified virtual address, thereby building a memory management module; The interface provided by the libc library is replaced by the interface provided by the memory management module; a unique global variable is set in the process to save the context data of each module of the process; A data backup point is set in the program for receiving and processing data backup instructions. When the data backup instruction is received, a data backup operation is triggered. The data backup operation includes: backing up context information of each module of the process and backing up data in the first shared memory to a designated file to obtain a backup file; Apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery phase of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

2. The method for saving and restoring an electromagnetic transient simulation running state snapshot according to claim 1, characterized in that: The memory manager is used to manage the first shared memory based on the SLAB algorithm and provide an interface for memory application and release.

3. The method for saving and restoring an electromagnetic transient simulation running state snapshot according to claim 1, characterized in that: The memory management module provides an interface to replace the memory application and release interface provided by the libc library, including: The memory application and release interface provided by the libc library is replaced with the interface provided by the memory management module by using the piling technology.

4. The method for saving and restoring an electromagnetic transient simulation running state snapshot according to claim 1, characterized in that: The process of reading the context data of each module stored in the backup file and restoring the context data to the context of each module further includes: After the module completes data recovery, a verification operation is performed on the module, and the verification operation includes: checking the module status, variable values, and data in the shared memory.

5. An electromagnetic transient simulation running state snapshot storage and recovery system, characterized in that: include: A memory management unit is used to apply for a first shared memory including a memory manager according to simulation requirements and map it to a specified virtual address, thereby constructing a memory management module; The interface provided by the libc library is replaced by the interface provided by the memory management module; a unique global variable is set in the process to save the context data of each module of the process; a data backup unit, configured to set a data backup point in the program for receiving and processing a data backup instruction, and trigger a data backup operation upon receiving the data backup instruction, wherein the data backup operation includes backing up context information of each module of the process and backing up data in the first shared memory to a designated file to obtain a backup file; The data recovery unit is used to apply for a second shared memory with the same data size as the first shared memory and map it to a specified virtual address; and in the recovery stage of each module, read the context data of each module saved in the backup file and restore it to the context of each module.

6. The electromagnetic transient simulation running state snapshot storage and recovery system according to claim 5, characterized in that: The memory manager is used to manage the first shared memory based on the SLAB algorithm and provide an interface for memory application and release.

7. The electromagnetic transient simulation running state snapshot storage and recovery system according to claim 5, characterized in that: The memory management module provides an interface to replace the memory application and release interface provided by the libc library, including: The memory application and release interface provided by the libc library is replaced with the interface provided by the memory management module by using the piling technology.

8. The electromagnetic transient simulation running state snapshot storage and recovery system according to claim 5, characterized in that: The process of reading the context data of each module stored in the backup file and restoring the context data to the context of each module further includes: After the module completes data recovery, a verification operation is performed on the module, and the verification operation includes: checking the module status, variable values, and data in the shared memory.

9. An electromagnetic transient simulation running state snapshot storage and recovery device, characterized in that: The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the electromagnetic transient simulation running state snapshot saving and recovery method according to any one of claims 1 to 4 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store program code, and the program code is used to execute the electromagnetic transient simulation running state snapshot saving and recovery method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Multi-machine backup method and system

    CN105302662A

  • Data processing method and device, electronic equipment and readable storage medium

    CN116954991A