System and method for online upgrading of real-time library model

By adopting three-layer shared memory structures of table-paging-subcontracting and mapping file management modules and other technical means, the online upgrade of the real-time library model is achieved, solving the problems affecting the operation of real-time libraries in the existing technology, and ensuring the continuity and stability of the system.

CN119938102APending Publication Date: 2025-05-06GUODIAN NANJING AUTOMATION
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510027501.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

It is difficult for the existing technology to complete the online upgrade of the real-time library model without affecting the operation of the real-time library, resulting in adverse consequences such as loss of real-time data.

Method used

The three-layer shared memory structure of table-paging-subcontracting is adopted. By mapping file management modules, model management tool modules and model upgrade operation modules, the online upgrade of real-time library models is realized to avoid affecting the running real-time library.

Benefits of technology

The online upgrade of the real-time library model is realized, ensuring the continuity and stability of system operation, avoiding data loss and system interruption, and improving the high efficiency, low occupation and easy operation of the online upgrade of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938102A_ABST
    Figure CN119938102A_ABST
Patent Text Reader

Abstract

The invention discloses a system and a method for online upgrading of a real-time library model, and relates to the technical field of data processing of a power monitoring system, the system comprises a mapping file management module used for establishing a corresponding relation between a memory space and a disk file by adopting a mapping file; the layered shared memory module is used for constructing a three-layer shared memory structure of table division, paging and subpackage; the real-time library class combination module is used for defining a real-time library class, a real-time library table class, a real-time library page class and a real-time library package class; the model management tool module is used for providing operable model browsing, model modification, model release and model import and export functions; and the model upgrading operation module is used for reading the model change information from the commercial library and storing the model change information to the model change information array. When the model online upgrading task is processed, real-time library operation is not affected, a new transition real-time library is not introduced, original state data does not need to be migrated, and high efficiency and low occupation of model online upgrading are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing of electric power monitoring systems, and in particular to a system and method for online upgrading of real-time library models. Background Art

[0002] In key infrastructure fields such as power monitoring systems, the real-time library is a core component that supports efficient operation, precise scheduling and rapid response of the system. Its performance and stability are directly related to the safety and efficiency of the entire system. When recording real-time data, the real-time library usually stores it according to the preset model. The model library is a collection of models that defines the basic framework architecture for storing data in the real-time library. It is usually configured before the real-time library is started. However, due to changes in on-site requirements, business needs and other factors, the model library of the real-time library sometimes needs to be changed.

[0003] Object-oriented real-time libraries need to follow a specific framework structure when recording data. As business needs continue to evolve and technical standards continue to be updated, the model library also needs to flexibly adjust its structure to adapt to new data object types, attribute definitions or relationship rules, thereby ensuring that the real-time library can continue to efficiently support complex business scenarios.

[0004] Normally, when the model library of the real-time library changes, in order to upgrade the original model library to the new model library, the real-time library needs to be stopped, the model library is replaced, and then the real-time library is restarted. However, in some control systems, the operation of the real-time library is usually continuous and uninterrupted, and any downtime or interruption may have serious consequences. This also shows that the online upgrade of the real-time library model is of great significance to ensure the continuity and stability of system operation.

[0005] For example, Chinese patent number CN104932925B discloses a real-time library update method for a power grid monitoring system, in which a configuration tool module, an online update service module, and a real-time library application module cooperate with each other to complete the model upgrade; the configuration tool module writes the model change information into the record change table, after which the real-time library application suspends the real-time library access operation, and the online update service completes the model change and updates the real-time library. It can be seen that during the model update, the real-time library application module needs to suspend the real-time library access operation. This offline update solution has a greater impact on the real-time library system that needs to run continuously and uninterruptedly, and may cause adverse consequences such as the loss of real-time data.

[0006] Therefore, for real-time control systems that need to run continuously and have model changes, there is currently no good solution to complete the online upgrade of the model without affecting the real-time library. Summary of the invention

[0007] Based on this, it is necessary to provide a system and method for online upgrading of real-time library models in response to the above technical problems.

[0008] In a first aspect, the present invention provides a system for online upgrading of a real-time library model, the system comprising: A mapping file management module is used to establish a corresponding relationship between memory space and disk files by using a mapping file, and realize data sharing between multiple processes by allowing all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space; Hierarchical shared memory module, used to build a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning, providing multiple independent shared memories, and using the three-layer structure of table partitioning, page partitioning, and package partitioning to implement the expansion tasks of object type, storage object, and attribute type respectively; The real-time library class combination module is used to define the real-time library class, the real-time library table class, the real-time library page class and the real-time library package class. The members of each class store the object pointer array of the next level, and allocate the corresponding memory allocator class and head pointer class according to the functional distinction of each class; The model management tool module is used to provide operational model browsing, model modification, model publishing, and model import and export functions, and apply the modified models to the real-time library; The model upgrade operation module is used to read model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, an update signal is sent to prompt all real-time processes to update the relevant head pointers.

[0009] Further, the hierarchical shared memory module includes: a sub-table storage unit, a sub-page storage unit and a sub-packet storage unit; The sub-table storage unit is used to store objects in different tables in a regular manner through sub-table storage, and when the object type changes, perform an update operation at the table level to achieve scalability of object type storage; The paging storage unit is used to store objects by page, with each page storing a fixed number of objects. When the number of pages is insufficient, the number of pages is expanded to continue storing new objects in the new pages. The sub-package storage unit is used to store the attribute value matrix of the object by package. When the attribute type of the object type of the model is increased, a new package is created under the page where the object type is located, mapped to the memory space, and the new package is used to store the attribute value matrix of the newly added attribute type.

[0010] Furthermore, the storage content of the table includes the object type flag, page pointer array and object index information; the storage content of the page includes the package pointer array, object id array and information about the package where the attribute type query is located; the storage content of the package includes the attribute value matrix of the attribute type.

[0011] Furthermore, according to the functional distinction of each class, the corresponding memory allocator class and head pointer class are allocated, including: For a class that needs to store data on a mapping file, a corresponding memory allocator class and a head pointer class are configured for the class, wherein the memory allocator class is used to associate a specific mapping file, and the head pointer class is used to store a pointer offset of a memory address.

[0012] Furthermore, the model management tool module includes: a model browsing module, a model modification module, a model publishing module and a model import and export module; Among them, the model browsing module is used to provide a tree-like relationship diagram to intuitively display model information; Model modification module, used to provide creation and deletion options. By selecting creation or deletion, the model can be modified accordingly. The modifications include adding new object types, deleting object types, adding new attribute types, deleting attribute types, and changing corresponding relationships. The model publishing module is used to apply the current model to the real-time library when the model is confirmed to be changed, and then store the model change information in the commercial library; Model import and export module, used to spread model libraries between different computers.

[0013] Furthermore, the model upgrade operation module includes: an object type adding unit, an object type deleting unit, an attribute type adding unit, an attribute type deleting unit, and a corresponding relationship changing unit; Among them, the object type addition unit is used to read the newly added object type and attribute type in the model change information, submit it to the real-time library, and perform the object type addition operation; The object type deletion unit is used to read the deleted object type and attribute type in the model change information, submit it to the real-time library, and execute the object type deletion operation; The attribute type addition unit is used to read the newly added attribute type in the model change information, submit it to the real-time library, and perform the attribute type addition operation; The attribute type deletion unit is used to read the attribute type to be deleted in the model change information, submit it to the real-time library, and execute the attribute type deletion operation; The corresponding relationship changing unit is used to call the real-time library to perform the corresponding relationship changing operation.

[0014] Furthermore, the newly added object type and attribute type in the model change information are read and submitted to the real-time library, and the newly added operations of the object type are performed, including: The real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space; In the process of creating an object, the real-time library table is used to record the object index information, the real-time library page is used to store the object ID and attribute index information, and the real-time library package is used to store the object attribute value; After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to perform mapping file loading and address binding of the newly added object type.

[0015] Furthermore, the newly added attribute type in the model change information is read and submitted to the real-time library, and the newly added operations of the attribute type are performed, including: The real-time library processes each object attribute with a newly added attribute type one by one. For the object type currently being processed, a new package is added under the page of the object type, and the new attribute type is stored in the new package. An index variable is stored on the page, and memory is created on the new package and the new data is written. After the current process completes the addition and storage of the attribute type, an update signal is sent to prompt all real-time processes to perform the corresponding loading operation.

[0016] In a second aspect, the present invention further provides a method for online upgrading of a real-time library model, the method comprising the following steps: S1. Use a mapping file to establish a corresponding relationship between the memory space and the disk file, and enable all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space to achieve data sharing between multiple processes; S2. Build a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning to provide multiple independent shared memories. Use the three-layer structure of table partitioning, page partitioning, and package partitioning to implement the expansion tasks of object type, storage object, and attribute type respectively. S3, define the real-time library class, the real-time library table class, the real-time library page class and the real-time library package class, the members of each class store the object pointer array of the next level, and allocate the corresponding memory allocator class and head pointer class according to the functional distinction of each class; S4. Based on the model browsing, model modification, model publishing, and model import and export functions of the model modification tool, set the model change information and apply the models involved in the modification to the real-time library; S5. Read the model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, send an update signal to prompt all real-time processes to update related head pointers.

[0017] Furthermore, a three-layer shared memory structure of table partitioning, paging, and sub-packaging is constructed to provide multiple independent shared memories. The following steps are included to implement the expansion tasks of object type, storage object, and attribute type respectively by means of the three-layer structure of table partitioning, paging, and sub-packaging: S21. Based on the table storage method, objects are stored in different tables in a regular manner, and when the object type changes, update operations are performed at the table level to achieve scalability of object type storage; S22, storing objects by page, storing a fixed number of objects per page, and when the number of pages is insufficient, expanding the number of pages and continuing to store new objects in the new pages; S23. The attribute value matrix of the object is stored in packages. When the attribute type of the object type of the model increases, a new package is created under the page where the object type is located, mapped to the memory space, and the attribute value matrix of the newly added attribute type is stored in the new package.

[0018] Further, the model change information is read from the commercial library, stored in the model change information array, and then the records in the model change information array are processed one by one. After the model online upgrade is completed, an update signal is sent to prompt all real-time processes to update the relevant head pointers, including the following steps: S51, read the newly added object type and attribute type in the model change information, submit it to the real-time library, and perform the new operation of the object type; S52, read the deleted object type and attribute type in the model change information, submit it to the real-time library, and execute the object type deletion operation; S53, read the newly added attribute type in the model change information, submit it to the real-time library, and perform the new attribute type addition operation; S54, read the deleted attribute type in the model change information, submit it to the real-time library, and execute the deletion operation of the attribute type; S55. Call the real-time library to perform the change operation of the corresponding relationship.

[0019] Further, the newly added object type and attribute type in the model change information are read and submitted to the real-time library, and the operation of adding the object type is performed, including the following steps: S511, the real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space; S512, in the process of creating an object, using the real-time library table to record object index information, using the real-time library page to store object ID and attribute index information, and using the real-time library package to store object attribute values; S513: After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to execute mapping file loading and address binding of the newly added object type.

[0020] Further, reading the newly added attribute type in the model change information, submitting it to the real-time library, and performing the newly added attribute type operation include the following steps: S531, the real-time library processes each object attribute with a newly added attribute type one by one, and for the object type currently being processed, adds a package under the page of the object type, uses the new package to store the newly added attribute type, stores an index variable on the page, creates memory on the newly added package and writes the newly added data; S532: After the current process completes adding and storing the attribute type, an update signal is sent to prompt all real-time processes to perform corresponding loading operations.

[0021] The beneficial effects of the present invention are as follows: by adopting a table-page-package memory structure, that is, a database contains multiple tables, a table contains multiple pages, and a page contains multiple packages, the three-layer storage structure realizes the object type expansion, object quantity expansion and attribute type expansion tasks of the real-time library respectively; in order to facilitate the management of each level of memory space, a data structure of a database (table / page / package) class + memory allocator class + head pointer class is designed for each layer; based on this architecture, when the model is upgraded, only the original real-time library memory is expanded, and the existing memory is not modified, thereby avoiding the impact on the running real-time library. When processing the model online upgrade task, the present invention can achieve no impact on the real-time library operation, no introduction of a new transitional real-time library, and no need to migrate the original state data, thereby ensuring the high efficiency, low occupancy and easy operability of the model online upgrade. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a principle block diagram of a system for online upgrading of a real-time library model according to an embodiment of the present invention; Figure 2 is a flow chart of a method for online upgrading of a real-time library model according to an embodiment of the present invention; Figure 3 It is a diagram of a mapping file system and a shared memory structure of table-page-packet according to an embodiment of the present invention; Figure 4 It is a mapping file-memory structure diagram after the model is upgraded (a new attribute type is added to a certain object type) according to an embodiment of the present invention; Figure 5 is the organizational structure of the real-time library memory management related classes according to an embodiment of the present invention; Figure 6 It is the main data stored in each layer by the specific object (id: 1234) according to the embodiment of the present invention; Figure 7 A model management tool according to an embodiment of the present invention displays model relationships; Figure 8 4 is a diagram of a model online upgrade process according to an embodiment of the present invention.

[0023] Figure numbers: 1. Mapping file management module; 2. Hierarchical shared memory module; 3. Real-time library class combination module; 4. Model management tool module; 5. Model upgrade operation module. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0025] See also Figure 1 , provides a system for online updating of real-time library models, the system comprising, The mapping file management module 1 is used to establish the corresponding relationship between the memory space and the disk file by using the mapping file, and realize data sharing between multiple processes by allowing all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space.

[0026] Specifically, in order to achieve high-performance access to the real-time database, the real-time database data needs to be stored in the memory. However, since the read and write operations on the real-time database are usually not the behavior of a certain process, the memory space should be able to be accessed and operated by multiple processes. The present invention uses a mapping file to realize the correspondence between the memory space and the disk file. All processes that need to access the real-time database should map this mapping file into the address space of the process for easy access, thereby realizing data sharing among multiple processes.

[0027] When a mapping file is loaded into the address space of multiple processes, if a pointer in this address space is accessed, the address access may fail because different processes map the file to different address ranges; if the configuration file is specified to load at a specific starting position in the address space, address interference may occur. When storing addresses in a shared memory, the present invention does not directly store its absolute address, but only stores its offset relative to a specific pointer, thereby ensuring accurate access to the address. Specifically, for example, if the starting address of the shared memory in process A is 0x0100, if a pointer is stored in the shared memory, pointing to 0x0200, then if the starting address of the shared memory is 0x0110 when process B loads the mapping file, an error will occur when accessing the pointer; if it is stored as an offset in the shared memory, that is, 100 (relative to the starting address of the shared memory), then no matter what the starting address of process B loading the shared memory is, the data can be correctly accessed.

[0028] The storage mechanism of shared memory-mapped files requires the designer to manage the shared memory completely independently. For each dynamically created space, it must be placed in a specific position in the shared memory according to specific rules to facilitate access by other processes. This leads to poor scalability of the memory space, and the size of the mapped memory cannot be expanded. Therefore, for each array or data matrix that may be expanded, either a sufficiently large reserved space needs to be given when it is created to cope with subsequent expansion requirements, which will lead to memory waste and limited expansion; or a larger space needs to be reapplied when expanding, and the original data is copied to the new space, which will cause the original memory space to be changed, the complexity of memory management is increased, and a large amount of data copying and migration will also lead to high occupancy of system resources. For this reason, the present invention proposes a table-paging-packeting memory structure, so that the expansion of the memory no longer depends on the reserved space during allocation, and does not need to affect the original memory.

[0029] The hierarchical shared memory module 2 is used to build a three-layer shared memory structure of table partitioning, page partitioning and package partitioning, provide multiple independent shared memories, and use the three-level structure of table partitioning, page partitioning and package partitioning to implement the expansion tasks of object type, storage object and attribute type respectively.

[0030] Specifically, the present invention adopts a three-layer shared memory structure of table partitioning, page partitioning and packet partitioning in the memory architecture, such as Figure 3 The hierarchical storage structure is a commonly used design method. The present invention applies it to the memory structure. The constructed hierarchical memory structure is shared and can be accessed by multiple processes. Such a structure can well make up for the problem of insufficient scalability of ordinary shared memory.

[0031] It should be noted that the hierarchical shared memory structure does not store data in a hierarchical manner on the shared memory, but has multiple independent shared memories that are linked together through a hierarchical structure. This granular shared memory has high flexibility and is also the key to supporting online model upgrades, such as Figure 4 .

[0032] In the description of the present invention, the hierarchical shared memory module 2 includes: a table storage unit (not shown in the figure), a page storage unit (not shown in the figure) and a packet storage unit (not shown in the figure).

[0033] The sub-table storage unit is used to store objects in different tables in a regular manner through sub-table storage, and when the object type changes, an update operation is performed at the table level to achieve scalability of object type storage.

[0034] Specifically, the goal of sub-table storage is to achieve scalability of object types. Since the model library defines fixed object types, objects of the same object type exist in the same table when actually storing data. By using sub-table storage, complex objects are organized in different tables in a regular manner, which facilitates process processing and maintenance. When the object type of the model library changes, corresponding operations need to be performed at the table level. The table stores an object type flag, a page pointer array, and the index information of the object, so that the page where the object is stored and the specific location of the page can be found based on the object id.

[0035] The paging storage unit is used to store objects by page. Each page stores a fixed number of objects. When the number of pages is insufficient, the number of pages is expanded to continue storing new objects in the new pages.

[0036] Specifically, the goal of paging storage is to achieve the scalability of stored objects. Since objects are frequently added, modified or deleted during actual use, the storage of objects is required to be scalable. The present invention stores objects by page, and each page can store a fixed number of objects (to facilitate the pre-allocation of memory space). When the number of pages is insufficient, the number of pages is directly expanded, and the newly added pages can continue to store new objects. The page stores the package pointer array, the object id array, and the information of the package to which it belongs, which is queried from the attribute type.

[0037] The sub-package storage unit is used to store the attribute value matrix of the object by package. When the attribute type of the object type of the model is increased, a new package is created under the page where the object type is located, mapped to the memory space, and the new package is used to store the attribute value matrix of the newly added attribute type.

[0038] Specifically, the goal of sub-package storage is to achieve the scalability of attribute types. The attribute value matrix of the object is stored in the package. When the attribute type of some object types of the model is added, a new package is directly re-established under all pages of the object type and mapped into the memory space. The new package stores the value of the newly added attribute type, and the original attribute value matrix is ​​not affected in any way. From the storage structure, support for online upgrades of the real-time library model is achieved.

[0039] In addition, corresponding to this storage structure, the mapping file system is also divided into three levels, each level is managed by a file in the previous level, for example, multiple page mapping files are managed by a table mapping file. When a process accesses the real-time library, it can use the mapping file of the level as a bridge to read any attribute value of any object.

[0040] The real-time library class combination module 3 is used to define the real-time library class, the real-time library table class, the real-time library page class and the real-time library package class. The members of each class store the object pointer array of the next level, and according to the functional distinction of each class, the corresponding memory allocator class and the head pointer class are allocated.

[0041] In the description of the present invention, according to the functional distinction of each class, the allocation of the corresponding memory allocator class and the head pointer class includes: For a class that needs to store data on a mapping file, a corresponding memory allocator class and a head pointer class are configured for the class, wherein the memory allocator class is used to associate a specific mapping file, and the head pointer class is used to store a pointer offset of a memory address.

[0042] Specifically, the present invention defines a real-time library class, a real-time library table class, a real-time library page class and a real-time library package class during implementation, and each class member includes an object pointer array of a class at a lower level, for example, an object pointer array of a real-time library table class is defined in the real-time library class, and the capacity of the array corresponds to an expandable upper limit. Since the pointer array is preset to be large, it will not occupy too much address space, and will not occupy physical memory when not in use, so it can be approximately considered that the expansibility of this structure is unlimited.

[0043] For classes that need to store data on the mapping file, they are equipped with corresponding memory allocator classes and head pointer classes to store the pointer offset of the relevant memory address. Figure 5For example, the real-time library page class contains pointers to objects of the page memory allocator class and the page memory header pointer class. During the initialization of the real-time library page, the memory allocator associates a specific mapping file and allocates an object of the page memory header pointer class in the address space corresponding to the mapping file. The memory header pointers of the object array allocated later, such as the object array, are stored in the page memory header pointer class object in the form of pointer offsets. The table, page, and package levels all use the above combination relationship, so that the private memory and shared memory of the process are separated from each other during storage, the logic is clear, and it is easy to locate when used.

[0044] The model management tool module 4 is used to provide operational model browsing, model modification, model publishing, and model import and export functions, and apply the models involved in the modification to the real-time library.

[0045] Specifically, in order to facilitate the management of models, a model management tool has been developed, with the main functions including model browsing, model modification, model publishing, and model import and export. The model browsing function provides users with a tree-like relationship diagram, allowing users to easily understand model information, such as Figure 6 ; The model modification function allows users to modify the model (add or delete object types or attribute types, or change corresponding relationships) by clicking buttons such as create or delete. The changes at this time do not affect the real-time library (shared memory); when it is determined that the model needs to be changed, use the model publishing function to apply the current model to the real-time library; in order to facilitate the spread of model libraries between different computers, model import and export functions are provided.

[0046] In the description of the present invention, the model management tool module 4 includes: a model browsing module (not shown in the figure), a model modification module (not shown in the figure), a model publishing module (not shown in the figure) and a model import and export module (not shown in the figure).

[0047] The model browsing module is used to provide a tree diagram to intuitively display model information, such as Figure 7 .

[0048] The model modification module is used to provide creation and deletion options. By selecting create or delete, the model can be modified accordingly. The modifications include adding new object types, deleting object types, adding new attribute types, deleting attribute types, and changing corresponding relationships.

[0049] The model publishing module is used to apply the current model to the real-time library when the model is confirmed to have changed, and then store the model change information in the commercial library.

[0050] Model import and export module, used to spread model libraries between different computers.

[0051] It should be noted that after the model management tool modifies and publishes the model, the model change information will be stored in the commercial library. When the real-time library process starts to execute the model online upgrade task, the model change information will be read from the commercial library and stored in the model change information array. The model change information array is shown in the following code. After that, each record in the array is processed one by one, such as Figure 8 After the model online upgrade is completed, a signal will be sent to prompt all real-time processes to update the relevant head pointers to ensure that the new model data can take effect in all real-time processes.

[0052] The code for the model change information structure and array structure is as follows: typedef struct_ATypeChInfo{ AType _at; int_addorDel; }ATypeChInfo; typedef struct_OMSupgradeInfo{ OType _otype; int _optType; std::vector <atypechinfo>_atypeVec; }OMSUpgradeInfo; typedef std: :list <omsupgradeinfo>OMSModelUpdateList; The model upgrade operation module 5 is used to read the model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, an update signal is sent to prompt all real-time processes to update the relevant head pointers.

[0053] In the description of the present invention, the model upgrade operation module 5 includes: an object type adding unit (not shown in the figure), an object type deleting unit (not shown in the figure), an attribute type adding unit (not shown in the figure), an attribute type deleting unit (not shown in the figure), and a corresponding relationship changing unit (not shown in the figure).

[0054] The object type addition unit is used to read the newly added object types and attribute types in the model change information, submit them to the real-time library, and perform the object type addition operation.

[0055] In the description of the present invention, the newly added object type and attribute type in the model change information are read, submitted to the real-time library, and the newly added operation of the object type is performed, including: Step S101: The real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space.

[0056] Step S102: In the process of creating an object, the real-time library table is used to record the object index information, the real-time library page is used to store the object ID and attribute index information, and the real-time library package is used to store the object attribute value.

[0057] Step S103: After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to execute mapping file loading and address binding of the newly added object type.

[0058] Specifically, the operation of adding an object type can be summarized as follows: add an object type and its attribute type through the model management tool, submit it to the real-time library, and the real-time library creates a corresponding real-time library table for the new object type. During the generation process of the real-time library table, a corresponding mapping file will be created and mapped to the address space, and memory storage data will be created on it, mainly including object index information. The real-time library table will contain at least one real-time library page, and the creation of the page will be completed in the newly created real-time library table. The object data stored in the real-time library page managed by the newly created real-time library table is empty. When creating an object later, the real-time library table will record the object index information, the real-time library page will store its object id and attribute index information, and the real-time library package will store the object attribute value. After completing all operations, a notification is issued. All real-time processes receive the notification, and perform operations such as loading the mapping file and binding the address of the newly added object type in the callback function, and can access the data of the new object type normally later. It can be seen that the whole process is an extension of the original mapping file system and memory, and has no effect on any existing memory data.

[0059] The object type deletion unit is used to read the deleted object type and attribute type in the model change information, submit it to the real-time library, and execute the object type deletion operation.

[0060] The attribute type addition unit is used to read the newly added attribute type in the model change information, submit it to the real-time library, and perform the attribute type addition operation.

[0061] In the description of the present invention, reading the newly added attribute type in the model change information, submitting it to the real-time library, and performing the newly added operation of the attribute type include: Step S201, the real-time library processes each object attribute with a newly added attribute type one by one. For the object type currently being processed, a new package is added under the page of the object type, the new package is used to store the newly added attribute type, and an index variable is stored on the page. Memory is created on the newly added package and the newly added data is written.

[0062] Step S202: After the current process completes adding and storing the attribute type, an update signal is sent to prompt all real-time processes to perform corresponding loading operations.

[0063] Specifically, the operation of adding new attribute types can be summarized as follows: using the model management tool to add new attribute types to the object types that need to be modified, and submitting the increments to the real-time library, the real-time library processes each object type with the new attribute types one by one. For the object type currently being processed, a package is added under each page, and the new package stores the new attribute types. In order to clarify the storage location of the attribute type when reading data, an index variable is stored on the page to find the package location from each attribute. Memory is created on the newly added package and data is written. After completing various operations, a notification is issued to enable all processes to perform corresponding loading operations. It can be seen that the entire process is an independent extension of the original mapped file system and memory, and has no impact on any existing memory data.

[0064] The attribute type deletion unit is used to read the deleted attribute type in the model change information, submit it to the real-time library, and execute the attribute type deletion operation.

[0065] The corresponding relationship changing unit is used to call the real-time library to perform the corresponding relationship changing operation.

[0066] Specifically, whether it is deletion of object type or attribute type, it can be simplified to invalidating the valid flag of the corresponding object and notifying all real-time processes, and skipping it in subsequent accesses; whether it is modification of object type or attribute type, it can be simplified to one deletion and one addition operation.

[0067] In a second aspect, the present invention further provides a method for online upgrading of a real-time library model, the method comprising the following steps: S1. Use mapping files to establish the correspondence between memory space and disk files. By allowing all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space, data sharing between multiple processes is achieved.

[0068] S2. Build a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning to provide multiple independent shared memories. Use the three-layer structure of table partitioning, page partitioning, and package partitioning to implement the expansion tasks of object type, storage object, and attribute type.

[0069] In the description of the present invention, a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning is constructed to provide multiple independent shared memories. By means of the three-layer structure of table partitioning, page partitioning, and package partitioning, the expansion tasks of object type, storage object, and attribute type are respectively implemented, including the following steps: S21. Based on the table-splitting storage method, objects are regularly stored in different tables, and when the object type changes, update operations are performed at the table level to achieve scalability of object type storage.

[0070] S22. Objects are stored by page, with each page storing a fixed number of objects. When the number of pages is insufficient, the number of pages is expanded, and newly added objects continue to be stored in the newly added pages.

[0071] S23. The attribute value matrix of the object is stored in packages. When the attribute type of the object type of the model increases, a new package is created under the page where the object type is located, mapped to the memory space, and the attribute value matrix of the newly added attribute type is stored in the new package.

[0072] S3. Define the real-time library class, real-time library table class, real-time library page class and real-time library package class. The members of each class store the object pointer array of the next level, and allocate the corresponding memory allocator class and head pointer class according to the functional distinction of each class.

[0073] S4. Based on the model browsing, model modification, model publishing, and model import and export functions of the model modification tool, set the model change information and apply the models involved in the modification to the real-time library.

[0074] S5. Read the model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, send an update signal to prompt all real-time processes to update related head pointers.

[0075] In the description of the present invention, the model change information is read from the commercial library, stored in the model change information array, and then the records in the model change information array are processed one by one. After the model online upgrade is completed, an update signal is sent to prompt all real-time processes to update the relevant head pointers, including the following steps: S51. Read the newly added object type and attribute type in the model change information, submit it to the real-time library, and perform the new operation of the object type.

[0076] In the description of the present invention, reading the newly added object type and attribute type in the model change information, submitting it to the real-time library, and performing the newly added operation of the object type include the following steps: S511. The real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space.

[0077] S512. In the process of creating an object, the real-time library table is used to record the object index information, the real-time library page is used to store the object ID and attribute index information, and the real-time library package is used to store the object attribute value.

[0078] S513: After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to execute mapping file loading and address binding of the newly added object type.

[0079] S52, reading the deleted object type and attribute type in the model change information, submitting it to the real-time library, and executing the object type deletion operation.

[0080] S53. Read the newly added attribute type in the model change information, submit it to the real-time library, and execute the new attribute type addition operation.

[0081] In the description of the present invention, reading the newly added attribute type in the model change information, submitting it to the real-time library, and performing the newly added operation of the attribute type include the following steps: S531. The real-time library processes each object attribute with a newly added attribute type one by one. For the object type currently being processed, a new package is added under the page of the object type, the new package is used to store the newly added attribute type, and an index variable is stored on the page. Memory is created on the newly added package and the newly added data is written.

[0082] S532: After the current process completes adding and storing the attribute type, an update signal is sent to prompt all real-time processes to perform corresponding loading operations.

[0083] S54, read the deleted attribute type in the model change information, submit it to the real-time library, and execute the deletion operation of the attribute type.

[0084] S55. Call the real-time library to perform the change operation of the corresponding relationship.

[0085] In summary, with the help of the above technical solution of the present invention, by adopting the memory structure of table-page-package, that is, the database contains multiple tables, one table contains multiple pages, and one page contains multiple packages, the three-layer storage structure realizes the object type expansion, object quantity expansion and attribute type expansion tasks of the real-time library respectively; in order to facilitate the management of the memory space of each level, a data structure of database (table / page / package) class + memory allocator class + head pointer class is designed for each layer; on the basis of this architecture, when the model is upgraded, only the original real-time library memory is expanded, and the existing memory is not modified, thus avoiding the impact on the running real-time library. When processing the online upgrade task of the model, the present invention can achieve the goal of not affecting the operation of the real-time library, not introducing a new transitional real-time library, and not requiring any migration of the original state data, thereby ensuring the high efficiency, low occupancy and easy operability of the online upgrade of the model.

[0086] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.< / omsupgradeinfo> < / atypechinfo>

Claims

1. A system for online updating of real-time library models, characterized in that: The system includes: A mapping file management module is used to establish a corresponding relationship between memory space and disk files by using a mapping file, and realize data sharing between multiple processes by allowing all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space; Hierarchical shared memory module, used to build a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning, providing multiple independent shared memories, and using the three-layer structure of table partitioning, page partitioning, and package partitioning to implement the expansion tasks of object type, storage object, and attribute type respectively; The real-time library class combination module is used to define the real-time library class, the real-time library table class, the real-time library page class and the real-time library package class. The members of each class store the object pointer array of the next level, and allocate the corresponding memory allocator class and head pointer class according to the functional distinction of each class; The model management tool module is used to provide operational model browsing, model modification, model publishing, and model import and export functions, and apply the modified models to the real-time library; The model upgrade operation module is used to read model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, an update signal is sent to prompt all real-time processes to update the relevant head pointers.

2. A system for online updating of real-time library models according to claim 1, characterized in that: The hierarchical shared memory module includes: a sub-table storage unit, a paging storage unit and a sub-packet storage unit; The sub-table storage unit is used to store objects in different tables in a regular manner through sub-table storage, and when the object type changes, perform an update operation at the table level to achieve scalability of object type storage; The paging storage unit is used to store objects by page, with each page storing a fixed number of objects, and when the number of pages is insufficient, the number of pages is expanded to continue storing new objects in the new pages; The sub-package storage unit is used to store the attribute value matrix of the object by package. When the attribute type of the object type of the model increases, a new package is created under the page where the object type is located, mapped to the memory space, and the new package is used to store the attribute value matrix of the newly added attribute type.

3. A system for online updating of real-time library models according to claim 2, characterized in that: The storage content of the table includes object type flag, page pointer array and object index information; the storage content of the page includes packet pointer array, object ID array and information of the packet where the attribute type query is located; the storage content of the packet includes attribute value matrix of attribute type.

4. A system for online updating of real-time library models according to claim 1, characterized in that: The allocation of corresponding memory allocator classes and head pointer classes according to the functional distinction of each class includes: For a class that needs to store data on a mapping file, a corresponding memory allocator class and a head pointer class are configured for the class, wherein the memory allocator class is used to associate a specific mapping file, and the head pointer class is used to store a pointer offset of a memory address.

5. A system for online updating of real-time library models according to claim 1, characterized in that: The model management tool module includes: a model browsing module, a model modification module, a model publishing module and a model import and export module; The model browsing module is used to provide a tree-like relationship diagram to intuitively display model information; The model modification module is used to provide creation and deletion options. By selecting creation or deletion, the model is modified accordingly. The modification includes adding new object types, deleting object types, adding new attribute types, deleting attribute types, and changing corresponding relationships. The model publishing module is used to apply the current model to the real-time library and then store the model change information in the commercial library after the model is determined to be changed; The model import and export module is used to spread the model library between different computers.

6. A system for online updating of real-time library models according to claim 5, characterized in that: The model upgrade operation module includes: an object type adding unit, an object type deleting unit, an attribute type adding unit, an attribute type deleting unit, and a corresponding relationship changing unit; The object type adding unit is used to read the newly added object type and attribute type in the model change information, submit it to the real-time library, and perform the object type adding operation; The object type deletion unit is used to read the object type and attribute type to be deleted from the model change information, submit it to the real-time library, and execute the object type deletion operation; The attribute type adding unit is used to read the newly added attribute type in the model change information, submit it to the real-time library, and perform the attribute type adding operation; The attribute type deletion unit is used to read the attribute type to be deleted from the model change information, submit it to the real-time library, and execute the attribute type deletion operation; The corresponding relationship changing unit is used to call the real-time library to perform the corresponding relationship changing operation.

7. A system for online updating of real-time library models according to claim 6, characterized in that: The newly added object type and attribute type in the reading model change information, submitting to the real-time library, and performing the newly added operation of the object type include: The real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space; In the process of creating an object, the real-time library table is used to record the object index information, the real-time library page is used to store the object ID and attribute index information, and the real-time library package is used to store the object attribute value; After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to perform mapping file loading and address binding of the newly added object type.

8. A system for online updating of real-time library models according to claim 7, characterized in that: The newly added attribute type in the reading model change information, submitting it to the real-time library, and performing the newly added attribute type operation include: The real-time library processes each object attribute with a newly added attribute type one by one. For the object type currently being processed, a new package is added under the page of the object type, and the new attribute type is stored in the new package. An index variable is stored on the page, and memory is created on the new package and the new data is written. After the current process completes the addition and storage of the attribute type, an update signal is sent to prompt all real-time processes to perform the corresponding loading operation.

9. A method for online upgrading of a real-time library model, using the system for online upgrading of a real-time library model according to any one of claims 1 to 8, characterized in that: The method comprises the following steps: S1. Use a mapping file to establish a corresponding relationship between the memory space and the disk file, and enable all processes that need to access the real-time library to read the mapping file and map the mapping file to the address space to achieve data sharing between multiple processes; S2. Build a three-layer shared memory structure of table partitioning, page partitioning, and package partitioning to provide multiple independent shared memories. Use the three-layer structure of table partitioning, page partitioning, and package partitioning to implement the expansion tasks of object type, storage object, and attribute type respectively. S3, define the real-time library class, the real-time library table class, the real-time library page class and the real-time library package class, the members of each class store the object pointer array of the next level, and allocate the corresponding memory allocator class and head pointer class according to the functional distinction of each class; S4. Based on the model browsing, model modification, model publishing, and model import and export functions of the model modification tool, set the model change information and apply the models involved in the modification to the real-time library; S5. Read the model change information from the commercial library, store it in the model change information array, and then process the records in the model change information array one by one. After the model online upgrade is completed, send an update signal to prompt all real-time processes to update related head pointers.

10. A method for online updating of a real-time library model according to claim 9, characterized in that: The three-layer shared memory structure of table-sub-page-sub-packet is constructed to provide multiple independent shared memories, and the expansion tasks of object type, storage object and attribute type are realized respectively by means of the three-layer structure of table-sub-page-sub-packet, including the following steps: S21. Based on the table storage method, objects are stored in different tables in a regular manner, and when the object type changes, update operations are performed at the table level to achieve scalability of object type storage; S22, storing objects by page, storing a fixed number of objects per page, and when the number of pages is insufficient, expanding the number of pages and continuing to store new objects in the new pages; S23. The attribute value matrix of the object is stored in packages. When the attribute type of the object type of the model increases, a new package is created under the page where the object type is located, mapped to the memory space, and the attribute value matrix of the newly added attribute type is stored in the new package.

11. A method for online updating of real-time library model according to claim 9, characterized in that: The method of reading model change information from the commercial library, storing it in the model change information array, and then processing the records in the model change information array one by one, and sending an update signal after the model online upgrade is completed to prompt all real-time processes to update related head pointers includes the following steps: S51, read the newly added object type and attribute type in the model change information, submit it to the real-time library, and perform the new operation of the object type; S52, read the deleted object type and attribute type in the model change information, submit it to the real-time library, and execute the object type deletion operation; S53, read the newly added attribute type in the model change information, submit it to the real-time library, and perform the new attribute type addition operation; S54, read the deleted attribute type in the model change information, submit it to the real-time library, and execute the deletion operation of the attribute type; S55. Call the real-time library to perform the change operation of the corresponding relationship.

12. A method for online updating of a real-time library model according to claim 11, characterized in that: The newly added object type and attribute type in the reading model change information, submitting to the real-time library, and performing the newly added operation of the object type include the following steps: S511, the real-time library creates a corresponding real-time library table for the newly added object type, creates a corresponding mapping file and maps it to the address space, and creates memory storage data on the address space; S512, in the process of creating an object, using the real-time library table to record object index information, using the real-time library page to store object ID and attribute index information, and using the real-time library package to store object attribute values; S513: After the current process completes the storage of objects in different hierarchical structures, an update signal is sent to call all real-time processes to execute mapping file loading and address binding of the newly added object type.

13. A method for online updating of real-time library model according to claim 12, characterized in that: The newly added attribute type in the reading model change information, submitting it to the real-time library, and performing the newly added attribute type operation include the following steps: S531, the real-time library processes each object attribute with a newly added attribute type one by one, and for the object type currently being processed, adds a package under the page of the object type, uses the new package to store the newly added attribute type, stores an index variable on the page, creates memory on the newly added package and writes the newly added data; S532: After the current process completes adding and storing the attribute type, an update signal is sent to prompt all real-time processes to perform corresponding loading operations.

Citation Information

Patent Citations

  • A real-time database update method for power grid monitoring system

    CN104932925B