A 3D modeling method and device based on substation GIM engineering files

By cached GIM project files data in the global context and modeled in parallel, the file read, write and repeat modeling performance problems during three-dimensional modeling of substation GIM project files are solved, which significantly improves modeling efficiency and performance.

CN118918291BActive Publication Date: 2025-03-07POWERCHINA JIANGXI ELECTRIC POWER ENGINEERING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411376634.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-03-07
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

In the prior art, when performing three-dimensional modeling based on substation GIM engineering files, the file read and write performance overhead is large, and there is a large amount of repeated modeling overhead, resulting in slow modeling performance.

Method used

By establishing a global context containing multiple caches, obtaining and decompressing GIM project files, creating corresponding domain models on a file-by-file node and generating GIM project trees, loading data into component caches, basic element caches, boolean element lists and reference model caches, traversing the basic element caches and boolean element lists for parallel and orderly modeling, and performing flat hierarchical matrix and material merging to obtain the engineering three-dimensional model.

Benefits of technology

Directly process the decompressed file stream, remove file read and write performance overhead, improve file read performance, and remove duplicate modeling overhead through the caching mechanism of the global context, significantly improve the performance of three-dimensional modeling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918291B_ABST
    Figure CN118918291B_ABST
Patent Text Reader

Abstract

The present invention discloses a three-dimensional modeling method and device based on a substation GIM engineering file, the method comprising: establishing a global context including multiple buffers, and initializing the parameters of the global context to open up data space for the buffer; obtaining the substation GIM engineering file and decompressing the substation GIM engineering file to obtain a file stream, and loading the file stream into the file cache, creating a corresponding domain model and generating a GIM engineering tree by file node, and loading data into a component cache, a basic primitive cache, a Boolean primitive list, and a reference model cache at the same time; traversing the basic primitive cache and the Boolean primitive list to perform parallel and ordered modeling respectively, traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to organize and render data according to the components, and then merging materials to obtain an engineering three-dimensional model. The present invention solves the problem of high performance overhead when performing three-dimensional modeling based on a substation GIM engineering file in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of GIM three-dimensional modeling, and in particular to a three-dimensional modeling method and device based on a substation GIM engineering file. Background Art

[0002] The State Grid GIM engineering file is a parametric expression format file. In addition to referencing the model, it does not store the vertices and material information of the three-dimensional model that can be directly rendered. It is necessary to parse the text data and convert the engineering file into a three-dimensional model through three-dimensional modeling before it can be applied in a three-dimensional platform or three-dimensional system.

[0003] In the prior art, the GIM project file is obtained and decompressed to obtain parameter information, wherein the parameter information includes header information, primitive information and vertex information, the GIM type is obtained according to the header information, the project hierarchy relationship is constructed according to the GIM specification and the GIM type, the project hierarchy relationship is traversed, the matrix relationship of each level is superimposed according to the vertex information to obtain the rendering position, the primitive information of each level is added to the rendering position, and the Unity engine is used for rendering and presentation, thus completing the 3D modeling of GIM. However, decompressing the file directory through the GIM project file and then reading each file one by one will cause a large overhead in file reading and writing performance, and there is a large amount of repeated modeling overhead, resulting in slow modeling performance. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a three-dimensional modeling method and device based on substation GIM engineering files, aiming to solve the problem in the prior art that when performing three-dimensional modeling based on substation GIM engineering files, the file reading and writing performance overhead is large, and there is a large amount of repeated modeling overhead, resulting in slow modeling performance.

[0005] The embodiment of the present invention is implemented as follows:

[0006] A three-dimensional modeling method based on a substation GIM engineering file, the method comprising:

[0007] Establishing a global context including multiple buffers, and initializing the parameters of the global context to open up data space for the buffers, wherein the buffers include a file cache, a component cache, a basic primitive cache, a Boolean primitive list, and a reference model cache;

[0008] Obtain the substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, then create the corresponding domain model and generate the GIM project tree for each file node, and load data into the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time;

[0009] The basic primitive cache and Boolean primitive list are traversed to perform parallel and ordered modeling respectively, the GIM engineering tree is traversed to execute a flattened hierarchical matrix, the component cache is traversed to organize the rendering data by component, and then the materials are merged to obtain the engineering 3D model.

[0010] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the expression of the global context is:

[0011] GC={MS, MP, FM, NT, PM, EM, BL, RM};

[0012] Among them, MS is the size scale factor relative to meters, MP is the meshing accuracy, FM is the file cache, NT is the GIM project tree, PM is the part cache, EM is the basic primitive cache, BL is the Boolean primitive list, and RM is the reference model cache.

[0013] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the expression of the file cache is:

[0014] FM=[F 1 ,F 2 ,F 3 ,…,F n ];

[0015] Where n is the number of files, a single file record is denoted as F, F={path1,content}, path1 is the file path name, content is the file stream;

[0016] The expression of the component cache is:

[0017] DM=[P 1 ,P 2 ,P 3 ,…,P m ];

[0018] Where m is the number of parts, a single part record is denoted as P, P={path2,Part}, path2 is the path name of the part file, and Part is the part domain model;

[0019] The expression of the basic primitive cache is:

[0020] EM=[E 1 ,E 2 ,E 3 ,…,E k ];

[0021] Where k is the number of basic primitives, E is a single basic primitive record, E={key,Mesh}, where key is the geometric parameter encoding corresponding to the basic primitive record, and Mesh is the basic primitive mesh model;

[0022] The expression of the Boolean primitive list is:

[0023] BL=[B 1 ,B 2 ,B 3 ,…,B l ];

[0024] in, l is the number of Boolean primitives, B is a single Boolean primitive record, B={type,Q 1 ,Q 2}, where type is the Boolean primitive type, Q 1 is the Boolean object primitive domain model, Q 2 It is a domain model of Boolean operation primitives;

[0025] The expression of the reference model cache is:

[0026] RM=[R 1 ,R 2 ,R 3 ,…,R s ];

[0027] Where s is the number of referenced models, R is a single referenced model record, R={path3,Model}, where path3 is the referenced model file path name, and Model is the 3D model of the referenced model.

[0028] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the steps of obtaining the substation GIM engineering file and decompressing the substation GIM engineering file to obtain a file stream, and loading the file stream into the file cache include:

[0029] The substation GIM project file is decompressed by the 7z algorithm to obtain multiple file streams, and key-value pairs are formed according to the file path name and the corresponding file stream, and added to the file cache of the global context.

[0030] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the steps of reading the file stream according to the data hierarchy and data definition defined in the GIM specification, creating the corresponding domain model and generating the GIM engineering tree one by one file node, and loading data into the component cache, basic primitive cache, Boolean primitive list and reference model cache include:

[0031] Defining a preset text loader to load different types of file streams in the substation GIM project file;

[0032] Starting from the entry file, the file stream is recursively read layer by layer and file by file according to the next level reference file path defined inside the file;

[0033] In the process of reading file streams, a domain model is created for each file stream, and the domain models corresponding to each file stream are associated based on the parent-child reference relationship of other file streams in the file stream, and finally a GIM project tree is generated;

[0034] Before reading the component file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the component cache of the global context according to the component file path name;

[0035] If it does not exist, create a component domain model, and combine the component file path name and the component domain model into a key-value pair, and add it to the component cache of the global context;

[0036] Before reading the reference model file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the reference model cache of the global context according to the reference model file path name;

[0037] If it exists, assign the grid model pointer in the reference model cache of the global context to the reference model domain model;

[0038] If it does not exist, the text loader corresponding to the referenced model is used to load the data to generate a grid model, and the referenced model file path name and the grid model are combined into a key-value pair and added to the referenced model cache of the global context. The grid model pointer in the global context referenced model cache is then assigned to the referenced model domain model.

[0039] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the steps of traversing the basic primitive cache and the Boolean primitive list for parallel and ordered modeling respectively include:

[0040] Using the preset modeling algorithm and taking the geometric parameters of the primitive as input, the boundary expression of the primitive is created to obtain the primitive topological model;

[0041] The primitive topology model is meshed using the Delaunay triangulation algorithm, and the corresponding data is updated one-to-one to the basic primitive cache and the Boolean primitive list in the global context to model the basic primitive cache and the Boolean primitive list.

[0042] Furthermore, in the above-mentioned three-dimensional modeling method based on the substation GIM engineering file, the steps of traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to organize the rendering data by component, and then merging the materials to obtain the engineering three-dimensional model also include:

[0043] Traverse the GIM project tree and calculate the accumulated matrix of the scene tree nodes layer by layer until the leaf node;

[0044] Traverse the component cache of the global context, recursively traverse the child nodes of each component, filter out all the primitive nodes under each component, and organize to obtain the component 3D model data;

[0045] The materials of the component three-dimensional models are merged to output the final engineering three-dimensional model.

[0046] Another object of the present invention is to provide a three-dimensional modeling device based on a substation GIM engineering file, the device comprising:

[0047] An establishment module is used to establish a global context including multiple buffers, and initialize the parameters of the global context to open up data space for the buffers, wherein the buffers include a file cache, a component cache, a basic primitive cache, a Boolean primitive list, and a reference model cache;

[0048] An acquisition module is used to acquire a substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, and then create a corresponding domain model for each file node and generate a GIM project tree, and load data into the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time;

[0049] The traversal module is used to traverse the basic primitive cache and the Boolean primitive list to perform parallel and ordered modeling respectively, traverse the GIM engineering tree to execute a flattened hierarchical matrix, traverse the component cache to organize the rendering data by component, and then merge the materials to obtain the engineering three-dimensional model.

[0050] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of any one of the methods described above.

[0051] Another object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0052] The present invention establishes a global context including multiple buffers, and initializes the parameters of the global context to open up data space for the buffer; obtains the substation GIM engineering file and decompresses the substation GIM engineering file to obtain a file stream, and loads the file stream into the file cache, creates a corresponding domain model and generates a GIM engineering tree by file node, and loads data to the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time; traverses the basic primitive cache and Boolean primitive list to perform parallel and ordered modeling respectively, traverses the GIM engineering tree to execute a flattened hierarchical matrix, traverses the component cache to organize the rendering data according to the component, and then merges the materials to obtain the engineering three-dimensional model. Directly process the decompressed file stream, remove the file read and write performance overhead, improve the file reading performance, remove the repeated modeling overhead through the cache mechanism of the global context, and solve the problem that the file read and write performance overhead is large when performing three-dimensional modeling based on the substation GIM engineering file in the prior art, and there is a large amount of repeated modeling overhead, resulting in slow modeling performance.

[0053] In addition, the embodiments of the present invention have at least the following beneficial effects:

[0054] 1. Perform parallel modeling for basic graphics elements, so that the modeling work of basic graphics elements does not interfere with each other, improving modeling efficiency;

[0055] 2. Organize 3D model data by component units, and reduce rendering performance overhead caused by rendering levels and excessive data division by flattening hierarchical matrices and merging material processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A flowchart of a three-dimensional modeling method based on a substation GIM engineering file provided by an embodiment of the present invention;

[0057] Figure 2 A schematic diagram of each node of a GIM engineering tree in a three-dimensional modeling method based on a substation GIM engineering file provided by an embodiment of the present invention;

[0058] Figure 3 A schematic diagram of the organization of component 3D model data in a 3D modeling method based on a substation GIM engineering file provided by an embodiment of the present invention;

[0059] Figure 4 A schematic diagram of the organization of component 3D model data after merging materials in a 3D modeling method based on a substation GIM engineering file provided in an embodiment of the present invention;

[0060] Figure 5 It is a structural block diagram of a three-dimensional modeling device based on a substation GIM engineering file in a second embodiment of the present invention.

[0061] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0062] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0063] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0065] The following will explain in detail how to reduce the performance overhead of three-dimensional modeling based on the substation GIM engineering file in conjunction with specific embodiments and drawings.

[0066] Embodiment 1

[0067] See also Figure 1 , shown is a three-dimensional modeling method based on a substation GIM engineering file in a first embodiment of the present invention, the method includes steps S10 to S12.

[0068] Step S10, establishing a global context including multiple buffers, and initializing the parameters of the global context to open up data space for the buffers, wherein the buffers include file cache, component cache, basic primitive cache, Boolean primitive list and reference model cache.

[0069] The embodiment of the present invention utilizes the global context mechanism to allow the loading module, modeling module, and assembly module of the GIM project file to share the 3D modeling process information of the GIM project file, so as to achieve the process collaboration of 3D modeling. Specifically, a variety of data buffers are designed in the global context to remove duplicate data definitions, reduce the 3D modeling performance overhead, and improve the 3D modeling efficiency.

[0070] More specifically, let the global context be GC, then:

[0071] GC={MS,MP,FM,NT,PM,EM,BL,RM};

[0072] Among them, MS is the size scale factor relative to meters, which is generally a fixed value of 0.001; MP is the meshing precision, which ranges from 0.02 to 0.1. The smaller the value, the higher the mesh model precision and the smoother the surface mesh. FM is the file cache, NT is the GIM project tree, PM is the component cache, EM is the basic primitive cache, BL is the Boolean primitive list, and RM is the reference model cache.

[0073] The expression for file cache is:

[0074] FM=[F 1 ,F 2 ,F 3 ,…,F n ];

[0075] Where n is the number of files, a single file record is denoted as F, F={path1,content}, path1 is the file path name, content is the file stream, each file record in the file cache is unique, and a hash table can be established based on the hash algorithm with the file path name as the index. The hash search algorithm can be used to quickly extract the corresponding file stream based on the file path name.

[0076] NT is the GIM project tree, which is a tree-shaped data structure that stores all domain model nodes in the GIM project file. In the embodiment of the present invention, 12 GIM domain models are defined. For example, the description of each domain model is shown in Table 1 below:

[0077] Table 1

[0078]

[0079] The expression for the component cache is

[0080] DM=[P 1 ,P 2 ,P 3 ,…,P m ];

[0081] Among them, m is the number of parts, a single part record is recorded as P, P = {path2, Part}, path2 is the part file path name, Part is the part domain model, which contains the business information and sub-node information corresponding to the part. Each part record in the part cache is unique, and based on the hash algorithm, the hash table is established with the part file path name as the index. The hash search algorithm can be used to quickly extract the part domain model based on the part file path name.

[0082] The expression of basic primitive cache is:

[0083] EM=[E 1 ,E 2 ,E 3 ,…,E k ];

[0084] Among them, k is the number of basic primitives, E is a single basic primitive record, E={key,Mesh}, where key is the geometric parameter code corresponding to the basic primitive record, and Mesh is the basic primitive mesh model. Each basic primitive record in the primitive cache is unique, and based on the hash algorithm, a hash table is established with the basic primitive geometric parameter code as the index. The hash search algorithm can be used to quickly extract the basic primitive mesh model based on the basic primitive geometric parameter code.

[0085] Among them, the basic primitive geometric parameter code is a unique code generated according to the geometric parameters of the basic primitive. The embodiment of the present invention adopts a string to UUID algorithm to generate the basic primitive geometric parameter code.

[0086] The expression for a Boolean primitive list is:

[0087] BL=[B 1 ,B 2 ,B 3 ,…,B l ];

[0088] in, l is the number of Boolean primitives, B is a single Boolean primitive record, B={type,Q 1 ,Q 2}, where type is the Boolean primitive type, Q 1 is the Boolean object primitive domain model, Q 2 Q is the domain model of Boolean operation primitives. 1 and Q 2 It may be a primitive in the basic primitive cache EM, or it may still be a Boolean primitive.

[0089] The expression for referencing the model cache is:

[0090] RM=[R 1,R 2 ,R 3 ,…,R s ];

[0091] Where s is the number of referenced models, R is a single referenced model record, R={path3,Model}, where path3 is the referenced model file path name, and Model is the 3D model of the referenced model, including the material, matrix, and mesh model. Each referenced model record in the referenced model cache is unique, and a hash table is established based on the hash algorithm, using the referenced model file path name as an index. The hash search algorithm can be used to quickly extract the 3D model of the referenced model based on the referenced model file path name.

[0092] Step S11, obtain the substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, and then create the corresponding domain model for each file node and generate a GIM project tree, and load data to the component cache, basic primitive cache, Boolean primitive list and reference model cache.

[0093] Among them, the substation GIM project file is a compressed file in 7z format. Before loading data, the substation GIM project file is decompressed using the 7z algorithm, and the decompressed file streams are composed of key-value pairs according to the file path name and file character stream, and added to the file cache FM of the global context.

[0094] Subsequently, according to the data hierarchy and data definition defined in the GIM specification, the file stream in the file cache is read, the corresponding domain model is created for each file node, and a GIM project tree is generated; wherein, according to the GIM specification definition, it contains 4 file directories, and there is a reference relationship between each file. Specifically, a preset text loader is defined to load different types of file streams in the substation GIM project file. Exemplarily, 6 types of text loaders are defined: CBMReader, DEVReader, PHMReader, MODReader, IFCReader, STLReader, which are used to load CBM, DEV, PHM, MOD, IFC, and STL file streams in the GIM project file, respectively;

[0095] Among them, the first four types of text loaders can be implemented according to the definitions of data nodes, levels and bytes in the GIM specification; the IFCReader text loader is encapsulated based on the IFCPlusPlus component, which can take IFC file stream as input and grid model as output; the STLReader text loader is encapsulated based on the osgdb_stl component, which can take STL file stream as input and grid model as output. Start from the entry file cbm / project.cbm, and then recursively read the file stream layer by layer and file by file according to the next level reference file path defined inside the file.

[0096] In the process of reading the file stream, a domain model is created for each file stream. The domain model records information such as node type, attributes, hierarchical position matrix, and child node list. In IFC and STL reference models, material and mesh model information are also recorded. In ENTITY primitive models, 3D modeling parameters, materials, and mesh model information are also recorded. Among them, the 3D modeling parameters need to be converted according to the relative meter size scale factor MS in the global context to ensure that the geometric modeling parameters are in meters.

[0097] In order to generate a GIM project tree, in the process of reading the file stream, the domain models corresponding to each file stream are associated based on the parent-child reference relationship of other file streams in the file stream, and finally the GIM project tree can be generated.

[0098] Furthermore, in the process of creating a domain model, for the component model, the primitive model, and the reference model, the corresponding data needs to be loaded into the global context according to the following rules, which are described in detail as follows:

[0099] For the component model, before reading the component file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the component cache of the global context according to the component file path name;

[0100] If it exists, no processing will be done;

[0101] If it does not exist, create a component domain model, and form a key-value pair with the component file path name and the component domain model, and add it to the component cache of the global context.

[0102] For the primitive model, when reading the MOD file stream, the ENTITY data will be read in sequence, and different operations will be performed according to the primitive type.

[0103] If the primitive type is a basic primitive, that is, the 25 basic primitives and 18 steel components defined in the GIM specification, the geometric parameter code is generated using the geometric parameters of ENTITY, and the hash search algorithm is used to find out whether there is a corresponding data record in the basic primitive cache of the global context; if it exists, the corresponding mesh model pointer in the basic primitive cache is assigned to the mesh model in the current primitive domain model; if it does not exist, a mesh model is created, and the primitive geometric parameter code and the mesh model are combined into a key-value pair, added to the basic primitive cache of the global context, and then the corresponding mesh model pointer in the basic primitive cache is assigned to the mesh model in the current primitive domain model.

[0104] If the primitive type is a Boolean primitive, the Boolean primitive domain model is added to the Boolean primitive list in the global context. When reading a MOD file stream, the Boolean primitives need to be added to the global context in order to avoid subsequent modeling errors due to disrupted order.

[0105] For the reference model, before reading the reference model file stream, use the hash search algorithm to find out whether there is a corresponding data record in the reference model cache of the global context based on the reference model file path name;

[0106] If it exists, assign the grid model pointer in the reference model cache of the global context to the reference model domain model;

[0107] If it does not exist, use the corresponding text loading tool of the reference model to load the data, generate a grid model, and form a key-value pair of the reference model file path name and the grid model, and add it to the reference model cache of the global context; then assign the grid model pointer in the reference model cache of the global context to the reference model domain model.

[0108] Step S12, traverse the basic primitive cache and Boolean primitive list to perform parallel and ordered modeling respectively, traverse the GIM engineering tree to execute a flattened hierarchical matrix, traverse the component cache to organize the rendering data by component, and then merge the materials to obtain the engineering three-dimensional model.

[0109] Among them, GIM modeling is performed in two steps, namely, parallel modeling of basic primitives and sequential modeling of Boolean primitives. Among them, the global context basic primitive cache is traversed, and 2n-1 threads are opened according to the number of computer cores n to perform parallel modeling on these basic primitives. Since the parameters of Boolean primitives are basic primitives or Boolean primitives, they have mutual influences and are not suitable for parallel modeling, so they are modeled sequentially in the order of the list. Since the basic primitive cache and Boolean primitive list in the global context contain the 3D modeling data of the smallest unit in the entire GIM project. Therefore, primitive modeling is also 3D modeling.

[0110] Specifically, when modeling each specific primitive, for any primitive, its 3D modeling includes:

[0111] By using the modeling algorithm API in the OCC modeling kernel and taking the geometric parameters of the primitives as input, the boundary expression of the primitives, that is, the topological model, is created.

[0112] The Delaunay triangulation algorithm is used to mesh the topological model of the primitive. The meshing accuracy is the MP parameter in the global context, and then the mesh model of the primitive is obtained. The data is updated one-to-one to the basic primitive cache and Boolean primitive list in the global context.

[0113] After the modeling is completed, GIM assembly is required, in which the GIM project tree is traversed and the cumulative matrix of the scene tree nodes is calculated layer by layer until the leaf nodes (IFC, ENTITY, STL model nodes). Figure 2 As shown, N(i) is the i-th node, M(i) is the level matrix of the i-th node, AM(i) is the cumulative matrix of the i-th node, N(j) is the j-th node, M(j) is the level matrix of the j-th node, AM(j) is the cumulative matrix of the j-th node, N(k) is the k-th node, M(k) is the level matrix of the k-th node, AM(k) is the cumulative matrix of the k-th node, N(i) is the parent node of N(j) and N(k), then:

[0114] AM(j) = M(j)*AM(i);

[0115] AM(k) = M(k)*AM(i);

[0116] Further, the global context component cache is traversed, and for each component, its child nodes are recursively traversed to filter out all the primitive nodes under the component, and then the nodes are sorted according to the order. Figure 3 As shown, the component 3D model data is organized. The component 3D model data consists of all the primitive 3D model data under the component. The primitive 3D model data includes: primitive material, primitive accumulation matrix and primitive mesh model. Among them, the primitive material is created when GIM is loaded and stored in the primitive domain model; the primitive accumulation matrix is ​​calculated when GIM assembles the flattened hierarchical matrix;

[0117] The primitive mesh model is obtained from the global context primitive buffer according to the primitive geometry parameter encoding. A mesh model may be reused in multiple primitives (such as Figure 3 The mesh model 1) may also be reused in multiple components.

[0118] Furthermore, the materials of the component 3D models are merged, such as Figure 4As shown in the figure, the materials of the component 3D models are merged, and only one copy of the same material is retained, which can be applied to multiple mesh model renderings, and finally the engineering 3D model is output. Specifically, the engineering 3D model includes two types of model component 3D models and civil engineering reference models (IFC). After the engineering 3D model is output, the 3D modeling of the GIM project is completed, and the engineering 3D model data can be directly added to the rendering engine for rendering.

[0119] In summary, the three-dimensional modeling method based on the substation GIM engineering file in the above embodiment of the present invention, by establishing a global context containing multiple buffers, and initializing the parameters of the global context to open up data space for the buffer; obtaining the substation GIM engineering file and decompressing the substation GIM engineering file to obtain a file stream, and loading the file stream into the file cache, creating a corresponding domain model and generating a GIM engineering tree by file node, and loading data to the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time; traversing the basic primitive cache and Boolean primitive list to perform parallel and ordered modeling respectively, traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to render data according to component organization, and then merging materials to obtain the engineering three-dimensional model. Directly process the decompressed file stream, remove the file read and write performance overhead, improve the file reading performance, and remove the repeated modeling overhead through the cache mechanism of the global context, solving the problem of large file read and write performance overhead and a large amount of repeated modeling overhead in the prior art when performing three-dimensional modeling based on the substation GIM engineering file, resulting in slow modeling performance.

[0120] Embodiment 2

[0121] See also Figure 5 , shown is a three-dimensional modeling device based on a substation GIM engineering file proposed in a second embodiment of the present invention, the device comprising:

[0122] Establishing module 100, used to establish a global context including multiple buffers, and initialize the parameters of the global context to open up data space for the buffers, wherein the buffers include file buffer, component buffer, basic primitive buffer, Boolean primitive list and reference model buffer;

[0123] The acquisition module 200 is used to acquire the substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, and then create a corresponding domain model for each file node and generate a GIM project tree, and load data into the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time;

[0124] The traversal module 300 is used to traverse the basic primitive cache and the Boolean primitive list to perform parallel and ordered modeling respectively, traverse the GIM engineering tree to execute a flattened hierarchical matrix, traverse the component cache to organize the rendering data by component, and then merge the materials to obtain the engineering 3D model.

[0125] Furthermore, in the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, the expression of the global context is:

[0126] GC={MS, MP, FM, NT, PM, EM, BL, RM};

[0127] Among them, MS is the size scale factor relative to meters, MP is the meshing accuracy, FM is the file cache, NT is the GIM project tree, PM is the part cache, EM is the basic primitive cache, BL is the Boolean primitive list, and RM is the reference model cache.

[0128] Furthermore, in the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, the expression of the file cache is:

[0129] FM=[F 1 ,F 2 ,F 3 ,…,F n ];

[0130] Where n is the number of files, a single file record is denoted as F, F={path1,content}, path1 is the file path name, content is the file stream;

[0131] The expression of the component cache is:

[0132] DM=[P 1 ,P 2 ,P 3 ,…,P m ];

[0133] Where m is the number of parts, a single part record is denoted as P, P={path2,Part}, path2 is the path name of the part file, and Part is the part domain model;

[0134] The expression of the basic primitive cache is:

[0135] EM=[E 1 ,E 2 ,E 3 ,…,E k ];

[0136] Where k is the number of basic primitives, E is a single basic primitive record, E={key,Mesh}, where key is the geometric parameter encoding corresponding to the basic primitive record, and Mesh is the basic primitive mesh model;

[0137] The expression of the Boolean primitive list is:

[0138] BL=[B 1 ,B 2 ,B 3 ,…,B l ];

[0139] in, l is the number of Boolean primitives, B is a single Boolean primitive record, B={type,Q 1 ,Q 2}, where type is the Boolean primitive type, Q 1 is the Boolean object primitive domain model, Q 2 It is a domain model of Boolean operation primitives;

[0140] The expression of the reference model cache is:

[0141] RM=[R 1 ,R 2 ,R 3 ,…,R s ];

[0142] Where s is the number of referenced models, R is a single referenced model record, R={path3,Model}, where path3 is the referenced model file path name, and Model is the 3D model of the referenced model.

[0143] Furthermore, in the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, the steps of obtaining the substation GIM engineering file and decompressing the substation GIM engineering file to obtain a file stream, and loading the file stream into the file cache include:

[0144] The substation GIM project file is decompressed by the 7z algorithm to obtain multiple file streams, and key-value pairs are formed according to the file path name and the corresponding file stream, and added to the file cache of the global context.

[0145] Furthermore, the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, wherein the file stream is read according to the data hierarchy and data definition defined in the GIM specification, and then the corresponding domain model is created one by one for each file node and the GIM engineering tree is generated, and the steps of loading data into the component cache, basic primitive cache, Boolean primitive list and reference model cache include:

[0146] Defining a preset text loader to load different types of file streams in the substation GIM project file;

[0147] Starting from the entry file, the file stream is recursively read layer by layer and file by file according to the next level reference file path defined inside the file;

[0148] In the process of reading file streams, a domain model is created for each file stream, and the domain models corresponding to each file stream are associated based on the parent-child reference relationship of other file streams in the file stream, and finally a GIM project tree is generated;

[0149] Before reading the component file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the component cache of the global context according to the component file path name;

[0150] If it does not exist, create a component domain model, and combine the component file path name and the component domain model into a key-value pair, and add it to the component cache of the global context;

[0151] Before reading the reference model file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the reference model cache of the global context according to the reference model file path name;

[0152] If it exists, assign the grid model pointer in the reference model cache of the global context to the reference model domain model;

[0153] If it does not exist, the text loader corresponding to the referenced model is used to load the data to generate a grid model, and the referenced model file path name and the grid model are combined into a key-value pair and added to the referenced model cache of the global context. The grid model pointer in the global context referenced model cache is then assigned to the referenced model domain model.

[0154] Furthermore, in the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, the steps of traversing the basic primitive cache and the Boolean primitive list for parallel and ordered modeling respectively include:

[0155] Using the preset modeling algorithm and taking the geometric parameters of the primitive as input, the boundary expression of the primitive is created to obtain the primitive topological model;

[0156] The primitive topology model is meshed using the Delaunay triangulation algorithm, and the corresponding data is updated one-to-one to the basic primitive cache and the Boolean primitive list in the global context to model the basic primitive cache and the Boolean primitive list.

[0157] Furthermore, in the above-mentioned three-dimensional modeling device based on the substation GIM engineering file, the steps of traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to organize the rendering data by component, and then merging the materials to obtain the engineering three-dimensional model also include:

[0158] Traverse the GIM project tree and calculate the cumulative matrix of the scene tree nodes layer by layer until the leaf node;

[0159] Traverse the component cache of the global context, recursively traverse the child nodes of each component, filter out all the primitive nodes under each component, and organize to obtain the component 3D model data;

[0160] The materials of the component three-dimensional models are merged to output the final engineering three-dimensional model.

[0161] The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and will not be repeated here.

[0162] Embodiment 3

[0163] Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of the method described in the above-mentioned embodiment 1.

[0164] Embodiment 4

[0165] Another aspect of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first embodiment when executing the program.

[0166] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0167] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0168] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0169] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0170] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0171] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A three-dimensional modeling method based on substation GIM engineering files, characterized in that: The method comprises: Establishing a global context including multiple buffers, and initializing the parameters of the global context to open up data space for the buffers, wherein the buffers include a file cache, a component cache, a basic primitive cache, a Boolean primitive list, and a reference model cache; Obtain the substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, then create the corresponding domain model and generate the GIM project tree for each file node, and load data into the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time; Traversing the basic primitive cache and the Boolean primitive list to perform parallel and ordered modeling respectively, traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to organize rendering data by component, and then merging materials to obtain an engineering three-dimensional model; The step of traversing the GIM engineering tree to execute a flattened hierarchical matrix, traversing the component cache to organize the rendering data by component, and then merging the materials to obtain the engineering three-dimensional model also includes: Traverse the GIM project tree and calculate the accumulated matrix of the scene tree nodes layer by layer until the leaf node; Traverse the component cache of the global context, recursively traverse the child nodes of each component, filter out all the primitive nodes under each component, and organize to obtain the component 3D model data; The materials of the component three-dimensional models are merged to output the final engineering three-dimensional model.

2. The three-dimensional modeling method based on the substation GIM engineering file according to claim 1 is characterized in that: The expression of the global context is: GC={MS, MP, FM, NT, PM, EM, BL, RM}; Among them, MS is the size scale factor relative to meters, MP is the meshing accuracy, FM is the file cache, NT is the GIM project tree, PM is the part cache, EM is the basic primitive cache, BL is the Boolean primitive list, and RM is the reference model cache.

3. The three-dimensional modeling method based on the substation GIM engineering file according to claim 2 is characterized in that: The expression of the file cache is: <h2 style=";text-align:left;direction:ltr">FM=[F1,F2,F3,…,F<h2 style=";text-align:left;direction:ltr"> n <h2 style=";text-align:left;direction:ltr"> ]; Where n is the number of files, a single file record is denoted as F, F={path1,content}, path1 is the file path name, content is the file stream; The expression of the component cache is: DM=[P1,P2,P3,…,P m ]; Where m is the number of parts, a single part record is denoted as P, P={path2,Part}, path2 is the path name of the part file, and Part is the part domain model; The expression of the basic primitive cache is: <h2 style=";text-align:left;direction:ltr">EM=[E1,E2,E3,…,E<h2 style=";text-align:left;direction:ltr"> k <h2 style=";text-align:left;direction:ltr"> ]; Where k is the number of basic primitives, E is a single basic primitive record, E={key,Mesh}, where key is the geometric parameter encoding corresponding to the basic primitive record, and Mesh is the basic primitive mesh model; The expression of the Boolean primitive list is: <h2 style=";text-align:left;direction:ltr">BL=[B1,B2,B3,…,B<h2 style=";text-align:left;direction:ltr"> l <h2 style=";text-align:left;direction:ltr"> ]; in, l is the number of Boolean primitives, B is a single Boolean primitive record, B={type,Q1,Q2}, where type is the Boolean primitive type, Q1 is the Boolean object primitive domain model, and Q2 is the Boolean operation primitive domain model; The expression of the reference model cache is: RM=[R1,R2,R3,…,R s ]; Where s is the number of referenced models, R is a single referenced model record, R={path3,Model}, where path3 is the referenced model file path name, and Model is the 3D model of the referenced model.

4. The three-dimensional modeling method based on the substation GIM engineering file according to claim 3 is characterized in that: The step of obtaining the substation GIM engineering file, decompressing the substation GIM engineering file to obtain a file stream, and loading the file stream into the file cache comprises: The substation GIM project file is decompressed by the 7z algorithm to obtain multiple file streams, and key-value pairs are formed according to the file path name and the corresponding file stream, and added to the file cache of the global context.

5. The three-dimensional modeling method based on the substation GIM engineering file according to claim 4 is characterized in that: The steps of reading the file stream according to the data hierarchy and data definition defined in the GIM specification, creating the corresponding domain model and generating the GIM engineering tree for each file node, and loading data to the component cache, basic primitive cache, Boolean primitive list and reference model cache include: Defining a preset text loader to load different types of file streams in the substation GIM project file; Starting from the entry file, the file stream is recursively read layer by layer and file by file according to the next level reference file path defined inside the file; In the process of reading file streams, a domain model is created for each file stream, and the domain models corresponding to each file stream are associated based on the parent-child reference relationship of other file streams in the file stream, and finally a GIM project tree is generated; Before reading the component file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the component cache of the global context according to the component file path name; If it does not exist, create a component domain model, and combine the component file path name and the component domain model into a key-value pair, and add it to the component cache of the global context; Before reading the reference model file stream, a hash search algorithm is used to find out whether there is a corresponding data record in the reference model cache of the global context according to the reference model file path name; If it exists, assign the grid model pointer in the reference model cache of the global context to the reference model domain model; If it does not exist, the text loader corresponding to the referenced model is used to load the data to generate a grid model, and the referenced model file path name and the grid model are combined into a key-value pair and added to the referenced model cache of the global context. The grid model pointer in the global context referenced model cache is then assigned to the referenced model domain model.

6. The three-dimensional modeling method based on the substation GIM engineering file according to claim 1 is characterized in that: The steps of traversing the basic primitive cache and the Boolean primitive list for parallel and ordered modeling respectively include: Using the preset modeling algorithm and taking the geometric parameters of the primitive as input, the boundary expression of the primitive is created to obtain the primitive topological model; The primitive topology model is meshed using the Delaunay triangulation algorithm, and the corresponding data is updated one-to-one to the basic primitive cache and the Boolean primitive list in the global context to model the basic primitive cache and the Boolean primitive list.

7. A three-dimensional modeling device based on a substation GIM engineering file, characterized in that: The device is used to implement the three-dimensional modeling method based on the substation GIM engineering file as described in any one of claims 1 to 6, comprising: An establishment module is used to establish a global context including multiple buffers, and initialize the parameters of the global context to open up data space for the buffers, wherein the buffers include a file cache, a component cache, a basic primitive cache, a Boolean primitive list, and a reference model cache; An acquisition module is used to acquire a substation GIM project file and decompress the substation GIM project file to obtain a file stream, and load the file stream into the file cache, read the file stream according to the data hierarchy and data definition defined in the GIM specification, and then create a corresponding domain model for each file node and generate a GIM project tree, and load data into the component cache, basic primitive cache, Boolean primitive list and reference model cache at the same time; The traversal module is used to traverse the basic primitive cache and the Boolean primitive list to perform parallel and ordered modeling respectively, traverse the GIM engineering tree to execute a flattened hierarchical matrix, traverse the component cache to organize the rendering data by component, and then merge the materials to obtain the engineering three-dimensional model.

8. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • GIM analysis method and device, equipment and storage medium

    CN113065180A

  • Method and system for converting power grid information model into FBX format and electronic equipment

    CN117634113A