Function module initialization management method and device for relay protection device

By generating a configuration table of priorities and dependencies, asynchronous loading, and fault diagnosis, the problem of data loss and system anomalies caused by improper initialization order of functional modules in relay protection devices is solved, and stable and reliable initialization management is achieved.

CN121560409APending Publication Date: 2026-02-24NANJING GUODIAN NANZI POWER GRID AUTOMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511711953.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

In the embedded application software of relay protection devices, the initialization sequence and process of functional modules have not been given enough attention, leading to problems such as data loss, memory abnormalities and system resets. Existing solutions suffer from problems such as module coupling, uncontrollable waiting time, and inability to resolve circular dependencies.

Method used

By generating a first configuration table including priority information and a second configuration table including dependencies, asynchronously loading the initialization function of the module instance, and utilizing the registration interface and fault diagnosis mechanism, we can ensure the visual management of module dependencies and the handling of exceptions.

Benefits of technology

It achieves stable and reliable initialization of functional modules, ensures the availability of data and services, avoids module coupling and wasted waiting time, solves circular dependency problems, and improves the stability and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121560409A_ABST
    Figure CN121560409A_ABST
Patent Text Reader

Abstract

The invention discloses a functional module initialization management method and device for a relay protection device, and relates to the technical field of relay protection, and the method comprises the steps: generating a first configuration table comprising priority information and a second configuration table comprising dependencies based on an actual dependency relationship between module instances of the relay protection device; on the basis of the first configuration table, starting interfaces of the first service category are called one by one according to priority information, and initialization functions of module instances of the first service category are asynchronously loaded for initialization; on the basis of the second configuration table, calculating a pre-dependency condition of the module instance of the second service category according to the dependency item; and if the preposition dependency condition is established and is not overtime, calling the initialization function of the module instance of the second service category to carry out initialization. According to the invention, the problem of function module initialization dependence in the existing relay protection device is relieved, and the availability of data and services can be correctly maintained when the system loads functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of relay protection technology, specifically to a method and apparatus for initializing and managing functional modules of a relay protection device. Background Technology

[0002] In the embedded application software of relay protection devices, the logic is divided into multiple modules with functional boundaries, each providing specific functional services. The startup of some modules depends on the complete services provided by other modules. For example, the five-prevention function of the station control layer depends on the GOOSE service of the station control layer to start, and the human-machine interface can only work normally after the internal communication module is initialized and a data refresh is completed.

[0003] In early embedded relay protection applications, the initialization sequence and process of functional modules were not given sufficient attention because much data lacked quality or time stamps. With the advancement and improvement of digital standards, design flaws in the initialization process have gradually become apparent. For example, after the device powers on or the HMI software restarts, the on-site backend communication service receives a series of jumps from zero to non-zero values ​​(including quality and time). If the event notification service interface is called before the event notification module's initialization is complete, it can lead to issues such as lost event status or memory errors causing system resets. The essence of these problems is that the system, during function loading, failed to pay attention to and maintain the availability of data or services, and instead called "dirty" data or services that were "temporarily unavailable."

[0004] In the past, the following two methods were commonly used to solve this type of problem: 1. Directly adjust the order of calling module initialization interfaces: This method requires that all related initialization functions be called synchronously (without starting a separate thread for initialization). Its drawbacks are twofold: first, it can create unnecessary coupling between modules (requiring the inclusion of header files for the corresponding module initialization methods), and it demands high standards of programming habits, requiring the initialization process to be placed within a single function; second, it is difficult to control deep dependencies, such as A depending on B, and B depending on C. If C is initialized asynchronously, or if C also depends on data generated by A, "dirty" data may still be generated. 2. Waiting using empirical values: Data accessed directly through pointers or data structures is difficult to determine whether initialization is complete due to the lack of attributes or methods, and can only rely on setting a wait time. The drawbacks of this method are: first, it may cause unnecessary waiting waste, increasing the system's initialization time; second, when the configuration or operating environment changes, the wait time may be insufficient, making it impossible to control the initialization result. For example, if the IEC61850 model file becomes larger and the parsing time increases, modules that depend on IEC61850 services may malfunction; third, it also cannot solve the problem of circular dependencies. Summary of the Invention

[0005] The purpose of this invention is to provide a method and apparatus for initializing and managing functional modules of a relay protection device in order to solve at least one of the above-mentioned technical problems.

[0006] In a first aspect, embodiments of the present invention provide a method for initializing and managing functional modules of a relay protection device, applied to the relay protection device; the method includes: generating a first configuration table including priority information and a second configuration table including dependencies based on the actual dependencies between module instances of the relay protection device; the priority information is the priority of module instances of a first service category, and the dependencies are the completion and return of the initialization function of module instances of a second service category; based on the first configuration table, calling the startup interface of the first service category one by one according to the priority information, and asynchronously loading the initialization function of the module instances of the first service category for initialization; based on the second configuration table, calculating the pre-dependency conditions of the module instances of the second service category according to the dependencies; if the pre-dependency conditions are met and have not timed out, calling the initialization function of the module instances of the second service category for initialization.

[0007] Optionally, the first configuration table includes the module instance name, initialization function name, service description, and priority information; the second configuration table includes the module instance name, initialization function name, service description, dependencies, and dependency timeout information.

[0008] Optionally, the method further includes: obtaining resource configuration information of the relay protection device, and constructing module instances of a first service category and a second service category based on the resource configuration information; each module instance includes an initialization function with a return value of type bool; and registering each initialization function based on the registration interface of the relay protection device.

[0009] Optionally, the method further includes: performing integrity and consistency verification on the data in the first configuration table and the second configuration table, respectively.

[0010] Optionally, the method further includes: if an exception occurs during the execution of the corresponding initialization function during the initialization process of the module instance, then perform fault diagnosis on the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

[0011] Optionally, the method further includes: recording a startup log during the initialization process of the module instance, the startup log including the service startup time, whether it was successful, and the reason for failure.

[0012] Secondly, embodiments of the present invention also provide a functional module initialization management system for a relay protection device, applied to the relay protection device; comprising: a configuration module, an initialization management module, a verification module, and a recording module; wherein, the configuration module is used to generate a first configuration table including priority information and a second configuration table including dependencies based on the actual dependencies between module instances of the relay protection device; the priority information is the priority of module instances of a first service category, and the dependencies are the return of the initialization function of module instances of a second service category; the initialization management module is used to, based on the first configuration table, call the startup interface of the first service category one by one according to the priority information, and asynchronously load the initialization function of the module instances of the first service category for initialization; based on the second configuration table, calculate the pre-dependency conditions of the module instances of the second service category according to the dependencies; if the pre-dependency conditions are met and have not timed out, call the initialization function of the module instances of the second service category for initialization; the verification module is used to perform integrity and consistency verification on the data in the first configuration table and the second configuration table respectively; the recording module is used to record the startup log during the initialization process of the module instances, the startup log including service startup time, success or failure, and failure reason.

[0013] Optionally, the initialization management module is further configured to: if an exception occurs during the execution of the corresponding initialization function during the initialization process of the module instance, perform fault diagnosis on the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

[0014] Thirdly, embodiments of the present invention also provide an electronic device, including: a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the method provided in the embodiments of the present invention.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the method provided in the embodiments of the present invention.

[0016] This invention provides a method and apparatus for initializing and managing functional modules in relay protection devices. By defining dependencies, implementing a visual representation of dependencies, configuring dependencies, checking dependencies, and designing exception logic, the invention solves the problem of functional module initialization dependencies in relay protection devices, ensuring that the system can correctly maintain the availability of data and services when functions are loaded. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 A flowchart of a functional module initialization management method for a relay protection device provided in an embodiment of the present invention; Figure 2 A flowchart illustrating another method for initializing and managing functional modules of a relay protection device, provided in an embodiment of the present invention; Figure 3 A schematic diagram of dependency detection provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of a functional module initialization management system for a relay protection device, provided as an embodiment of the present invention. Detailed Implementation

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

[0020] Example 1 Figure 1 This is a flowchart illustrating a functional module initialization management method for a relay protection device according to an embodiment of the present invention. The method is applied to a relay protection device. Figure 1 As shown, the method specifically includes the following steps: Step S102: Based on the actual dependency relationship between module instances of the relay protection device, generate a first configuration table including priority information and a second configuration table including dependencies; the priority information is the priority of the module instance of the first service category, and the dependencies are the return of the initialization function of the module instance of the second service category.

[0021] Specifically, the initialization of a module instance is completed when the module instance's initialization function returns true.

[0022] Step S104: Based on the first configuration table, the startup interface of the first service category is called one by one according to the priority information, and the initialization function of the module instance of the first service category is loaded asynchronously for initialization.

[0023] Step S106: Based on the second configuration table, calculate the prerequisite dependencies of the module instances of the second service category according to the dependencies.

[0024] In step S108, if the prerequisite dependency conditions are met and the timeout has not occurred, the initialization function of the module instance of the second service category is called to perform initialization.

[0025] Specifically, the method provided in this embodiment of the invention further includes: obtaining resource configuration information of the relay protection device, and constructing module instances of a first service category and a second service category based on the resource configuration information; each module instance includes an initialization function with a return value of type bool; and registering each initialization function based on the registration interface of the relay protection device.

[0026] In this embodiment of the invention, the initialization function of a module instance is defined as a dependency; a unique identifier is defined for each dependency, expressed as "module instance name + initialization function name". Specifically, a module instance may provide multiple initialization functions. Simultaneously, the input dependencies of this dependency, the output results that can be referenced by other modules as input dependencies, and the functionality provided by these results must also be defined. In implementation, a static method is needed to register the class service initialization member functions, function descriptions, and corresponding unique identifiers, as well as a method to export this information (InitInfo) for the configuration tool to import. An XML or JSON file can be exported via program startup parameters and then manually imported into the tool. Currently, dependency rules are configured by developers and released with the program package. Dependency configuration specifications also need to be written to guide relevant personnel in modifying dependencies when necessary. During this process, attention must be paid to the version matching issue between the tool's imported information and the program's actual information. When loading the configuration relationship table, the tool and program must check the availability of the unique identifier-related configuration information line by line.

[0027] Then, a two-level configuration table is established to manage the dependencies between module instances, so as to achieve visual management of dependencies: The first configuration table contains the module instance name, initialization function name, service description, and priority information, which are used to determine the startup order of module instances in the first service category.

[0028] Specifically, the initialization function name is generated by the module developers through code registration, and a module instance can be split into multiple initialization functions; the service description describes the capabilities provided by an initialization function; priority information determines the service startup order, with lower priority values ​​starting earlier. Services of the same priority are loaded asynchronously, with no guaranteed order. Once all services are completed, the next priority service is loaded. Such services cannot be added or removed online, but can be statically deleted in the device configuration.

[0029] The second configuration table includes the module instance name, initialization function name, service description, dependencies, and dependency timeout information. Service initialization is controlled based on dependencies and dependency timeout rules. Dependencies indicate that the initialization function of this entry will only be called if all dependent services are successfully initialized. If any dependent service fails, the failure information will be recorded and the function will not be called again. Dependency timeout information takes effect when dependencies are configured. If a timeout occurs, dependency identification and initialization function calls will stop.

[0030] Specifically, the method provided in this embodiment of the invention further includes: performing integrity and consistency verification on the data in the first configuration table and the second configuration table, respectively. The integrity verification includes checking whether there are any missing information such as the instance name of each module, the name of the initialization function, the service description, priority information, dependencies, and dependency timeout information.

[0031] Specifically, the registration process for each initialization function based on the registration interface of the relay protection device includes a unique identifier, member functions, and concise information about the function's functionality. This invention provides two types of registration functions, corresponding to the initialization function registration of the first service category and the second service category, respectively. The first service category corresponds to the relevant settings in the first configuration table, and its startup order is determined by the priority information in the first configuration table. The second service category corresponds to the relevant settings in the second configuration table and is controlled by the dependencies and dependency timeout information in the second configuration table. The initialization function can use a thread, and its return indicates that the initialization is complete.

[0032] Specifically, the method provided in this embodiment of the invention further includes: if an exception occurs in the execution of the corresponding initialization function during the initialization process of the module instance, then a fault diagnosis is performed on the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

[0033] Specifically, during device operation, if an exception occurs in the initialization function of a module instance, resulting in a return value other than true, the device will automatically trigger a fault diagnosis process for that module instance. The fault diagnosis process includes checking whether the module instance's dependencies are correctly initialized, checking for errors in the execution logic within the initialization function, and checking whether the relevant configuration parameters are correct. After determining the specific cause of the fault through fault diagnosis, the device performs corresponding processing according to a preset fault handling strategy. In this invention, a separate thread is used to handle the dependency calculations or initialization function calls of each startup process.

[0034] Specifically, the method provided in this embodiment of the invention further includes: recording the startup log during the initialization process of the module instance, wherein the startup log includes the service startup time, whether it was successful, and the reason for failure.

[0035] Example 2 Figure 2 This is a flowchart of another method for initializing and managing functional modules of a relay protection device according to an embodiment of the present invention. Figure 2 As shown, in one optional embodiment of the present invention, the following steps are included: 1. Configuration Dependencies: In relay protection devices, developers generate a first configuration table and a second configuration table using configuration tools based on the actual dependencies between module instances. For example, for a device containing multiple modules such as parameter setting loading service, IEC61850 module, and human-machine interface, the first configuration table configures the module instance name, initialization function name, service description, and priority for the CPU module instance; the second configuration table configures the initialization service of the human-machine interface to depend on the initialization completion of the CPU module instance and sets the corresponding timeout.

[0036] Table 1 First Configuration Table Table 2 Second Configuration Table 2. Dependency Configuration Initialization: During the parsing process, for the first configuration table, information such as module instance name, initialization function name, service description, and priority is extracted and stored in an in-memory data structure, such as a hash table or list, for quick lookup and use later. For the second configuration table, information such as module instance name, initialization function name, service description, dependencies, and dependency timeouts is parsed and similarly stored in an appropriate data structure.

[0037] 3. Dependency Check: After the device completes the initialization dependency configuration resolution, a dependency check is performed. This step includes two important aspects of the check. Figure 3 This is a schematic diagram of dependency detection provided by an embodiment of the present invention. Figure 3 As shown, on the one hand, set management and a depth-first recursive algorithm are used to check the dependency sets of all dependencies. Specifically, the dependency set data of each dependency is added to its own dependency set. If a dependency set contains itself, a circular dependency is identified. Once a circular dependency is detected, the device immediately issues an error message, informing developers to check and correct the configuration to avoid the initialization process from entering an infinite loop due to a circular dependency. On the other hand, the system checks the validity of the dependency configuration grammar and the enabled status of the corresponding device in the device configuration table to determine if there are any broken dependency chains. If a broken dependency chain exists, the system will also issue an error message, guiding developers to adjust the configuration to ensure the integrity and correctness of the dependency relationships. Only after confirming that there are no circular dependencies or broken dependency chains will the subsequent device initialization process continue. 3. Device Initialization Management: Based on the first configuration table, the startup interface of the first service category is called sequentially according to priority information. For services of the same priority, their initialization functions are loaded asynchronously. After the initialization of the first service category is completed, the module instance selects service dependencies based on its configuration information in the second configuration table. Prerequisite dependency conditions are calculated based on the configuration information. If the conditions are met and the timeout period has not expired, the startup function of the corresponding service is called. For example, if all prerequisite services dependent on the initialization service of the HMI module are successfully initialized and the configured timeout period has not exceeded, the initialization function of the HMI module is called. During the initialization process, if a service fails to start, the dependency management module records the failure log and handles subsequent services that depend on that service according to pre-designed exception logic.

[0038] 4. Handling Data Changes: Before the initialization function call completes, if there are any data changes, the module instance, in its data notification interface, maintains the relationship between the initialization function and the data according to pre-defined rules. For example, if a change in certain data affects the initialization process of a module, the module instance will handle it accordingly to ensure that the initialization process is not affected or can correctly respond to data changes.

[0039] 5. Record startup logs: Record startup logs for the entire initialization process, including the startup time of each service, whether it started successfully, and the reason for failure. This log information is helpful for subsequent analysis of the system initialization process and troubleshooting.

[0040] As can be seen from the above embodiments, the functional module initialization management method of the present invention can effectively solve the problem of functional module initialization dependency in relay protection devices, and ensure the stable and reliable operation of the system.

[0041] Example 3 Figure 4 This is a schematic diagram of a functional module initialization management system for a relay protection device according to an embodiment of the present invention. The system is applied to the relay protection device. Figure 4 As shown, the system includes: a configuration module 10, an initialization management module 20, a verification module 30, and a recording module 40.

[0042] Specifically, the configuration module 10 is used to generate a first configuration table including priority information and a second configuration table including dependencies based on the actual dependencies between module instances of the relay protection device; the priority information is the priority of the module instance of the first service category, and the dependencies are the return of the initialization function of the module instance of the second service category. The initialization management module 20 is used to call the startup interface of the first service category one by one according to priority information based on the first configuration table, and asynchronously load the initialization function of the module instance of the first service category for initialization; based on the second configuration table, it calculates the pre-dependency conditions of the module instance of the second service category according to the dependencies; if the pre-dependency conditions are met and have not timed out, it calls the initialization function of the module instance of the second service category for initialization. Verification module 30 is used to perform integrity and consistency verification on the data in the first configuration table and the second configuration table, respectively. The recording module 40 is used to record the startup log during the initialization process of the module instance. The startup log includes the service startup time, whether it was successful, and the reason for failure.

[0043] Specifically, the initialization management module 20 is also used to: perform fault diagnosis on the module instance if an exception occurs during the execution of the corresponding initialization function during the initialization process of the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

[0044] The present invention also provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor executes the computer program to implement the method provided in the embodiments of the present invention.

[0045] The present invention also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the method provided in the embodiments of the present invention.

[0046] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0047] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for initializing and managing functional modules in a relay protection device, characterized in that, Applied to relay protection devices; the method includes: Based on the actual dependencies between the module instances of the relay protection device, a first configuration table including priority information and a second configuration table including dependencies are generated; the priority information is the priority of the module instance of the first service category, and the dependencies are the return of the initialization function of the module instance of the second service category. Based on the first configuration table, the startup interface of the first service category is called one by one according to the priority information, and the initialization function of the module instance of the first service category is loaded asynchronously for initialization; Based on the second configuration table, calculate the prerequisite dependencies of the module instance of the second service category according to the dependencies; If the aforementioned prerequisite dependency conditions are met and the timeout has not occurred, the initialization function of the module instance of the second service category is invoked for initialization.

2. The method according to claim 1, characterized in that: The first configuration table includes the module instance name, initialization function name, service description, and priority information; The second configuration table includes the module instance name, initialization function name, service description, dependencies, and dependency timeout information.

3. The method according to claim 1, characterized in that: The method further includes: Obtain the resource configuration information of the relay protection device, and construct module instances of the first service category and the second service category based on the resource configuration information; each module instance contains an initialization function with a return value of type bool; Each initialization function is registered based on the registration interface of the relay protection device.

4. The method according to claim 1, characterized in that: The method further includes: performing integrity and consistency verification on the data in the first configuration table and the second configuration table, respectively.

5. The method according to claim 1, characterized in that: The method further includes: if an exception occurs during the execution of the corresponding initialization function during the initialization process of the module instance, then perform fault diagnosis on the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

6. The method according to claim 1, characterized in that: The method further includes: recording startup logs during the initialization process of the module instance, the startup logs including service startup time, whether it was successful, and the reason for failure.

7. A functional module initialization management system for relay protection devices, characterized in that, It is applied to relay protection devices; it includes: a configuration module, an initialization management module, a verification module, and a recording module; among which, The configuration module is used to generate a first configuration table including priority information and a second configuration table including dependencies based on the actual dependencies between the module instances of the relay protection device; the priority information is the priority of the module instance of the first service category, and the dependencies are the return of the initialization function of the module instance of the second service category. The initialization management module is used to call the startup interface of the first service category one by one according to the priority information based on the first configuration table, and asynchronously load the initialization function of the module instance of the first service category for initialization; calculate the pre-dependency conditions of the module instance of the second service category according to the dependencies based on the second configuration table; if the pre-dependency conditions are met and have not timed out, call the initialization function of the module instance of the second service category for initialization. The verification module is used to perform integrity and consistency verification on the data in the first configuration table and the second configuration table, respectively. The recording module is used to record the startup log during the initialization process of the module instance. The startup log includes the service startup time, whether it was successful, and the reason for failure.

8. The system according to claim 7, characterized in that: The initialization management module is further configured to: perform fault diagnosis on the module instance if an exception occurs during the execution of the corresponding initialization function during the initialization process of the module instance; the fault diagnosis includes checking whether the dependencies of the module instance are correctly initialized, checking whether there are errors in the execution logic inside the initialization function, and checking whether the configuration parameters are correct.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1-6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method as described in any one of claims 1-6.