Digital twin model two-way interaction method, system and device based on data structure table and medium
By designing a two-way interactive method of digital twin model based on data structure tables, the problem of real-time synchronization between power digital twin model and entity and advanced analysis decision support is solved, and the rapid update of the three-dimensional model and state feedback is realized, and the user interaction experience and power grid are enhanced. Management ability.
Patent Information
- Application Number
- CN202411271095.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art is difficult to achieve real-time synchronization and advanced analytical decision support between the power digital twin model and entity, especially in three-dimensional visualization and interactive scenarios.
Design a two-way interactive method of digital twin model based on data structure tables. By building a dynamic update mechanism and the main foreign key association, it realizes rapid update and state feedback of three-dimensional models, supports user operations to write data tables in reverse, and standardizes the model through API modules .
Real-time state synchronization and advanced analytical decision support of the power digital twin model are realized, which enhances user interaction experience and seamless connection between models and entities, and provides strong technical support for intelligent management of the power grid.
Smart Images

Figure CN119167634A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital twin technology, and in particular to a two-way interactive method, system, device and medium for a digital twin model based on a data structure table. Background Art
[0002] IoT technology enables real-time monitoring and data collection of the power grid's operating status by deploying a large number of sensors and actuators in power equipment and systems. These data can be transmitted to a central system or cloud platform for analysis and decision support. The IoT focuses on monitoring and data collection of equipment status, but generally lacks the ability to synchronize and feedback the status of three-dimensional models. Although real-time data collection can be achieved, IoT solutions often focus on data-level integration rather than real-time interaction and visualization at the model level.
[0003] Simulation software technology simulates the operating status and behavior of the power grid by building a mathematical model of the power system. These software tools can be used to predict the performance of the power grid under different conditions, conduct fault analysis and optimize the design; traditional simulation software may not be able to achieve online calculation and analysis, and most simulation processes are offline, which limits their application in real-time systems. Simulation software usually does not directly interact with the physical devices of the actual power grid, so it is difficult to achieve real-time synchronization between the model and the entity. In addition, simulation software may lack the ability to integrate with a large range of scenarios, especially in scenarios that require three-dimensional visualization and interaction.
[0004] Industrial automation systems achieve precise control and automated operation of power equipment by integrating control logic and communication protocols. These systems can respond to changes in the power grid in real time and perform necessary control actions; industrial automation systems usually focus on the control level and do not provide a three-dimensional visualization interface, which limits operators' intuitive understanding of the power grid status. Although real-time synchronization of data and entities can be achieved, these systems do not have advanced analysis and decision support capabilities at the model level. Summary of the invention
[0005] In view of the problems that it is difficult to achieve real-time synchronization between models and entities during the above-mentioned interactions and that there is no advanced analysis and decision support functions at the model level, the present invention proposes a two-way interactive method, system, device and medium for a digital twin model based on a data structure table; by designing the core data structure table of the model, the rapid update of the model's status in a three-dimensional scene, real-time synchronization of the status and data-driven status change feedback of the three-dimensional model are realized, which can accurately reflect the real-time status of the power grid, and support the reverse writing of the user's operations on the model in the three-dimensional environment back to the data table, which can be called by other systems; it solves the technical difficulties of power digital twin models in data drive and real-time interaction; it not only improves the practicability of the construction of power digital twin systems, but also enhances the user interaction experience, realizes seamless docking and two-way interaction between models and power grid entities, and provides strong technical support for the intelligent management, operation and maintenance, and decision-making of the power grid.
[0006] The specific implementation contents of the present invention are as follows:
[0007] A two-way interactive method of a digital twin model based on a data structure table specifically includes the following steps:
[0008] Step S1: construct a dynamic update mechanism based on the acquired power equipment operation data and preset logical rules to obtain a three-dimensional model attribute table;
[0009] Step S2: updating the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables;
[0010] Step S3: calling the primary and foreign key technology to associate the primary key and foreign key of the data structure table;
[0011] Step S4: According to the API module of the digital twin platform, set the supplementary fields, inherit and standardize the digital twin model;
[0012] Step S5: Map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid;
[0013] Step S6: Reversely write the three-dimensional model operation into the structural data table to achieve two-way interaction of the digital twin model.
[0014] In order to better implement the present invention, further, the multiple three-dimensional model data structure tables in step S2 include a basic information data structure table, a rule parameter data structure table, an operating status data structure table, a surface status data structure table, a logical rule data structure table, a maintenance and log data structure table, an operating environment condition data structure table, an extended attribute data structure table, and a three-dimensional controlled interface data structure table.
[0015] In order to better implement the present invention, further, the step S3 specifically includes the following steps:
[0016] Step S31: Obtain a unique identifier of the data structure table, and use the obtained unique identifier as a primary key;
[0017] Step S32: determining the logical relationship between different three-dimensional model data structure tables to obtain associated three-dimensional model data structure tables;
[0018] Step S33: creating a foreign key field corresponding to the primary key value in the associated three-dimensional model data structure table.
[0019] According to a two-way interactive method of a digital twin model based on a data structure table according to claim 3, it is characterized in that step S4 specifically comprises the following steps:
[0020] Step S41: according to the API module content of the digital twin platform, set the supplementary fields in the three-dimensional data structure table, and construct an independent supplementary field data structure table;
[0021] Step S42: defining a parent table structure according to the common attributes of the power equipment;
[0022] Step S43: defining a sub-table structure according to the type of the power equipment;
[0023] Step S44: Use the primary key of the parent table as a foreign key to establish an inheritance relationship;
[0024] Step S45: Standardize the model according to the established inheritance relationship.
[0025] In order to better implement the present invention, further, the common attributes in step S42 include a unique identifier of the power equipment, a name of the power equipment, a type of the power equipment, a name of a manufacturer of the power equipment, and an installation date of the power equipment.
[0026] In order to better implement the present invention, further, step S5 specifically includes the following steps:
[0027] Step S51: creating a parent class containing common attributes of all power equipment;
[0028] Step S52: creating a subclass according to the type of the electric power equipment, and inheriting the properties and methods of the parent class in the subclass;
[0029] Step S53: assigning a unique identifier to each power device instance;
[0030] Step S54: Create a physical table structure to store the status information and historical data of the power equipment, and create a physical table mapping;
[0031] Step S55: Create an object instance of the power equipment class, and map the object instance attributes with the records of the physical table to instantiate the power equipment object.
[0032] In order to better implement the present invention, further, step S6 specifically includes the following steps:
[0033] Step S61: call the get_db_connection function to create and return a database connection;
[0034] Step S62: Call the requests database to initiate an http request, obtain real-time data from the external system API module, and call the update_transformer_status function to update the obtained real-time data into the database.
[0035] In order to better implement the present invention, further, the digital twin model two-way interaction method based on the data structure table also includes:
[0036] Step S7: Establish a synchronization and sharing mechanism between systems through message queues and API interfaces to synchronize data between different systems in real time.
[0037] Based on the above-mentioned digital twin model two-way interaction method based on data structure table, in order to better realize the present invention, further, a digital twin model two-way interaction system based on data structure table is proposed, which is used to execute the above-mentioned digital twin model two-way interaction method based on data structure table; including a construction unit, an association unit, an inheritance unit, a mapping unit, and a two-way interaction unit;
[0038] The construction unit is used to construct a dynamic update mechanism according to the acquired power equipment operation data and the preset logic rules to obtain a three-dimensional model attribute table; and update the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables;
[0039] The association unit is used to call the primary and foreign key technology to associate the primary key and the foreign key of the data structure table;
[0040] The inheritance unit is used to set supplementary fields according to the API module of the digital twin platform, inherit and standardize the digital twin model;
[0041] The mapping unit is used to map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid;
[0042] The two-way interaction unit is used to reversely write the three-dimensional model operation into the structure data table to realize two-way interaction of the digital twin model.
[0043] Based on the above-mentioned digital twin model two-way interaction method based on data structure table, in order to better realize the present invention, further, an electronic device is proposed, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned digital twin model two-way interaction method based on data structure table is implemented.
[0044] Based on the above-mentioned digital twin model two-way interaction method based on data structure table, in order to better realize the present invention, further, a computer-readable storage medium is proposed, on which computer instructions are stored; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned digital twin model two-way interaction method based on data structure table is implemented.
[0045] The present invention has the following beneficial effects:
[0046] (1) The present invention not only stores basic information about the equipment, such as the model, rated power, and voltage level of the transformer, but also includes dynamic status information, such as load percentage, temperature, and oil level, by constructing a core data structure table of the digital twin model. Through a carefully designed data structure table, the consistency, accuracy, and ease of access to the data can be ensured, providing strong data support for the model. This design enables the digital twin model to accurately reflect the real-time status of power equipment and support complex queries and analysis, providing a data basis for monitoring and optimization of the power grid.
[0047] (2) The present invention realizes the inheritance and standardization of the power digital twin model through the primary and foreign key association technology of the database; it allows power equipment models of different levels and types, such as transformers, circuit breakers, etc., to share common data structures and behavioral characteristics through inheritance relationships; it not only reduces the complexity of model maintenance, but also improves the reusability of the model. Standardized model design promotes consistency and interoperability across systems, making it easier to integrate model services into existing power systems and support the digital transformation and intelligent upgrade of power grids.
[0048] (3) The present invention develops a data-driven three-dimensional controlled interface that allows the power digital twin model to be dynamically updated and visualized based on real-time data. This interface combines three-dimensional graphics technology with real-time data processing, allowing users to intuitively observe and interact with the operating status of power equipment in three-dimensional space; it not only enhances the user experience, but also improves the ability to perceive the state of the power grid, providing an intuitive visualization tool for monitoring and decision-making of the power grid.
[0049] (4) The present invention realizes the service-oriented digital twin model of electric power, and provides a series of functions including data collection, processing, analysis and visual display. By opening up rich APIs, developers are allowed to call model data and functions as needed to implement customized applications. These APIs support real-time monitoring of the operating status of the power grid, fault diagnosis, and optimization of the operation and maintenance strategies of power equipment. The realization of service-orientedness promotes the integration of models with different systems and applications, improves the flexibility and response speed of power grid management, and provides strong technical support for the intelligence and automation of power systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of the overall process of the digital twin model two-way interactive method based on the data structure table provided for the invention.
[0051] Figure 2 A schematic diagram of synchronous changes in the states of a driving model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.
[0053] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "disposed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0054] The professional terms and explanations involved in the embodiments of the present invention are as follows:
[0055] Digital twin software: A general term for a type of 3D visualization software or an information system built around a 3D technology system. Generally speaking, this type of software or system simulates, analyzes, and predicts the behavior of physical entities in the real world by creating virtual copies of physical entities. This software is highly interactive and real-time, allowing users to test different scenarios and conditions in a 3D virtual environment, thereby optimizing product design, improving operational efficiency, and reducing risks.
[0056] Power digital twin model: Focuses on the accurate digital representation of the power system, which covers the equipment, components, general operations and processes of the power grid. This model uses real-time data to reflect the status of the power grid and supports the information system of the power grid to perform fault diagnosis, predictive maintenance and energy management, thereby improving the reliability and efficiency of the power grid.
[0057] Model data structure table: Originated from the field of BIM, it is a tool used to describe and organize model elements in detail. In the process of forward engineering modeling, the modeling software not only generates a three-dimensional view of the project, but also creates a structured database, namely the model data structure table. This table contains the attribute information of each element in the model, such as parameters such as size, material, cost and time. Through this structure tree and attribute table, model data can be efficiently managed and queried to ensure the accuracy and consistency of information. In digital twin technology, the concept of model data structure table is further expanded and applied. It is not only used to store and retrieve static data of the model, but also to dynamically interact with real-time data to achieve real-time monitoring and control of physical entities. This data structure table is usually combined with a model visualization controlled interface.
[0058] Model Visualization Controlled Interface: allows programmatic control of the behavior and appearance of the digital twin model. This interface not only provides feedback on the user interaction interface, but more importantly, provides a control layer that allows developers and users to drive the model to perform specific actions, such as changing surface materials, applying special effects, or updating the model's geometry. This interface is the core component for achieving dynamic model interaction and real-time feedback.
[0059] Inter-system message synchronization technology: ensures data consistency and real-time communication between different components in a distributed system. It is implemented through message queues, event buses or other middleware, allowing system components to exchange information and stay synchronized, regardless of whether they are located on the same platform or geographical location. This is crucial for implementing complex digital twin applications, especially in power systems that require a high degree of coordination.
[0060] Embodiment 1:
[0061] This embodiment proposes a two-way interactive method of a digital twin model based on a data structure table, which specifically includes the following steps:
[0062] Step S1: construct a dynamic update mechanism based on the acquired power equipment operation data and preset logical rules to obtain a three-dimensional model attribute table.
[0063] Step S2: According to the set category, the three-dimensional model attribute table is updated to obtain multiple three-dimensional model data structure tables.
[0064] The multiple three-dimensional model data structure tables described in step S2 include a basic information data structure table, a rule parameter data structure table, an operating status data structure table, a surface status data structure table, a logical rule data structure table, a maintenance and log data structure table, an operating environment condition data structure table, an extended attribute data structure table, and a three-dimensional controlled interface data structure table.
[0065] Step S3: Call the primary and foreign key technology to associate the primary key and foreign key of the data structure table.
[0066] Furthermore, the step S3 specifically includes the following steps:
[0067] Step S31: Obtain a unique identifier of the data structure table, and use the obtained unique identifier as a primary key;
[0068] Step S32: determining the logical relationship between different three-dimensional model data structure tables to obtain associated three-dimensional model data structure tables;
[0069] Step S33: creating a foreign key field corresponding to the primary key value in the associated three-dimensional model data structure table.
[0070] Step S4: According to the API module of the digital twin platform, set the supplementary fields, inherit and standardize the digital twin model.
[0071] The step S4 specifically comprises the following steps:
[0072] Step S41: according to the API module content of the digital twin platform, set the supplementary fields in the three-dimensional data structure table, and construct an independent supplementary field data structure table;
[0073] Step S42: defining a parent table structure according to the common attributes of the power equipment;
[0074] Furthermore, the common attributes in step S42 include a unique identifier of the power equipment, a name of the power equipment, a type of the power equipment, a name of a manufacturer of the power equipment, and an installation date of the power equipment.
[0075] Step S43: defining a sub-table structure according to the type of the power equipment;
[0076] Step S44: Use the primary key of the parent table as a foreign key to establish an inheritance relationship;
[0077] Step S45: Standardize the model according to the established inheritance relationship.
[0078] Step S5: Map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid;
[0079] The step S5 specifically comprises the following steps:
[0080] Step S51: creating a parent class containing common attributes of all power equipment;
[0081] Step S52: creating a subclass according to the type of the electric power equipment, and inheriting the properties and methods of the parent class in the subclass;
[0082] Step S53: assigning a unique identifier to each power device instance;
[0083] Step S54: Create a physical table structure to store the status information and historical data of the power equipment, and create a physical table mapping;
[0084] Step S55: Create an object instance of the power equipment class, and map the object instance attributes with the records of the physical table to instantiate the power equipment object.
[0085] Step S6: Reversely write the three-dimensional model operation into the structural data table to achieve two-way interaction of the digital twin model.
[0086] Furthermore, the step S6 specifically includes the following steps:
[0087] Step S61: call the get_db_connection function to create and return a database connection;
[0088] Step S62: Call the requests database to initiate an http request, obtain real-time data from the external system API module, and call the update_transformer_status function to update the obtained real-time data into the database.
[0089] Step S7: Establish a synchronization and sharing mechanism between systems through message queues and API interfaces to synchronize data between different systems in real time.
[0090] Working principle: This embodiment targets the electric power digital twin model. By designing the core data structure table of the model, it realizes the rapid update of the model's status in the three-dimensional scene, real-time synchronization of the status, and data-driven status change feedback of the three-dimensional model. It can accurately reflect the real-time status of the power grid, and supports reverse writing of the user's operations on the model in the three-dimensional environment back to the data table, which can be called by other systems.
[0091] This embodiment solves the technical difficulties of data-driven and real-time interaction of the power digital twin model through innovative data structure table design. The core model capabilities include rapid update of model data, real-time synchronization of status, and dynamic feedback of three-dimensional model status changes. This system not only improves the practicality of power digital twin system construction, but also enhances the user interaction experience, realizes seamless connection and two-way interaction between the model and the power grid entity, and provides strong technical support for the intelligent management, operation and maintenance, and decision-making of the power grid.
[0092] Embodiment 2:
[0093] This embodiment is based on the above embodiment 1. Figure 1 , Figure 2 As shown, a specific embodiment is described in detail.
[0094] Step S1: construct a dynamic update mechanism based on the acquired power equipment operation data and preset logical rules to obtain a three-dimensional model attribute table.
[0095] This embodiment takes the combination rules of data table content changes and models, posture rules, and surface state change rules as the core, and combines the operation data of power equipment, including key parameters such as current, voltage, power, and temperature, with preset logic rules to form a dynamic update mechanism. These logic rules are set according to the operation standards and safety thresholds of the power system, and can automatically adjust the model state to respond to real-time changes in the power grid.
[0096] Taking the three-dimensional model of a substation main transformer as an example, its own model attribute table is shown in Table 1 below.
[0097] Table 1 Original attributes of the main transformer 3D model
[0098]
[0099]
[0100] The logical rules that the transformer needs to follow during operation include the following:
[0101] Transformers need to comply with a series of business rules during operation to ensure their safe, efficient and stable operation.
[0102] The following are some common transformer operation business rules:
[0103] 1. Business rules that the main transformer needs to be bound to:
[0104] (1) Load management rules:
[0105] The operating load of the transformer should not exceed its rated capacity to avoid equipment damage or failure caused by overload. Add the CurrentLoad field in the attribute table to record the current load and compare it with the RatedPower field to ensure that it does not exceed the rated capacity.
[0106] (2) Temperature monitoring rules:
[0107] The operating temperature of the transformer needs to be continuously monitored to ensure that the oil temperature and winding temperature remain within the manufacturer's specified range. Add a TemperatureAlert field to flag a warning when the temperature exceeds a preset threshold.
[0108] (3) Oil level monitoring rules:
[0109] Check the transformer oil level regularly to ensure that it is within the appropriate range to ensure good insulation and cooling. Add the OilLevelStatus field to record whether the oil level is within the normal range and associate it with the OilLevel field.
[0110] (4) Maintenance and repair rules:
[0111] According to the manufacturer's recommendations and operating conditions, establish a regular maintenance and overhaul plan, including cleaning, inspection, and replacement of parts. The MaintenanceStatus field will reflect the maintenance status of the transformer, combined with the LastMaintenanceDate field to guide maintenance planning.
[0112] (5) Fault response rules:
[0113] Establish a rapid response mechanism to take immediate action once a fault or anomaly is detected, such as disconnecting the power supply, diagnosing the fault, and repairing it. Add a new FaultStatus field to record the fault status and time.
[0114] (6) Voltage and current monitoring rules:
[0115] Continuously monitor the input and output voltage and current of the transformer to ensure that they are within the specified operating range to avoid reduced efficiency or equipment damage. Add the VoltageCurrentStatus field to record whether the voltage and current are within the normal range.
[0116] (7) Protection device verification rules:
[0117] Regularly check the transformer's protection devices, such as overload protection, short-circuit protection, and differential protection, to ensure that they can operate correctly when needed. Add the ProtectionDeviceStatus field to record the status of the protection device and the last check date.
[0118] (8) Rules for adapting to environmental conditions:
[0119] Ensure that the transformer operates under specified environmental conditions, such as avoiding extreme temperature, humidity, or other environmental factors that may affect the performance of the transformer. Add a new EnvironmentalConditions field to record the environmental parameters of the transformer operation, such as temperature, humidity, etc.
[0120] (9) Operation log recording rules:
[0121] Record the transformer's operation log, including load changes, maintenance activities, fault events, etc., to facilitate analysis and improve operation strategies. The attribute table can be associated with a log database or log file through the OperationLog field to record all operation and maintenance activities.
[0122] Step S2: updating the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables;
[0123] After binding, the new model attribute table, that is, the new physical table, is shown in Table 2 below.
[0124]
[0125]
[0126] The data structure table defines in detail the data attributes and relationships of each component in the model. This technology organizes model data by designing a structure table, including device type, specification parameters, runtime surface status, and the aforementioned logical rules, to ensure data consistency and accessibility. The design of the structure table also takes into account scalability to accommodate future grid technology upgrades and the integration of new equipment.
[0127] Continuing with the previous example, the three-dimensional model attribute table of the transformer is transformed and redesigned. Based on the design concept of class, more general categories are abstracted to adapt to the digital twin models of different types of power equipment. The following is the redesigned table structure:
[0128] (1) Basic information, as shown in Table 3 below.
[0129] Used to store static information about the device, such as name, model, manufacturer, etc.
[0130] Table 3 Basic information data structure table
[0131] Property Name Data Types describe DeviceID varchar Unique device identifier DeviceName varchar Device Name DeviceType varchar Device Type ModelNumber varchar Device Model Manufacturer varchar Manufacturer Name InstallationDate date Installation Date
[0132] (2) Specification parameter category, as shown in Table 4 below, includes the electrical specifications and physical parameters of the equipment.
[0133] Table 4 Specification parameter data structure table
[0134] Property Name Data Types describe RatedPower float Rated Power VoltageLevels varchar Voltage level ConnectionStatus int Connection Status
[0135] (3) Operation status class, as shown in Table 5, records the real-time operation data and status of the equipment.
[0136] Table 5 Operation status data structure table
[0137] Property Name Data Types describe LoadPercentage float Current load percentage CurrentLoad float Current load Temperature float Operating temperature OilLevel float Oil level (if applicable) MaintenanceStatus int Maintenance status
[0138] (4) Surface state class, as shown in Table 6, is used to describe the visual or physical state of the device surface.
[0139] Table 6 Surface state data structure table
[0140] Property Name Data Types describe SurfaceCondition varchar Surface condition description Visual Indicators text Visual indicators (such as color changes)
[0141] (5) Logical rule class, as shown in Table 7, stores business rules and constraints related to device operation.
[0142] Table 7 Logical rule data structure table
[0143] Property Name Data Types describe LoadManagementRules text Load Management Rules TemperatureAlertRules text Temperature Alert Rules OilLevelMonitoringRules text Oil level monitoring rules
[0144] (6) Maintenance log class, as shown in Table 8, records the maintenance history and operation log of the equipment.
[0145] Table 8 Maintenance log data structure table
[0146]
[0147]
[0148] (7) Operating environment conditions, as shown in Table 9, record the environmental conditions of equipment operation and the status of protection devices.
[0149] Table 9 Operation environment condition data structure table
[0150] Property Name Data Types describe Environmental Conditions text Environmental condition recording (temperature, humidity, etc.) ProtectionDeviceStatus bool Protection device status
[0151] (8) Extended attribute class, as shown in Table 10, provides space for new attributes or custom attributes that may be added in the future.
[0152] Table 10 Extended attribute class data structure table
[0153] Property Name Data Types describe ExtensionAttributes text Extended attributes are stored in JSON format
[0154] (8) Three-dimensional controlled interface class, as shown in Table 11 below, this class defines how to control and update the state of the three-dimensional model in a data-driven manner to achieve synchronization between the model and the physical entity.
[0155] Table 11 Three-dimensional controlled interface class data structure table
[0156]
[0157]
[0158] Data BindingRules example:
[0159] {"LoadPercentage":"VisualFeedbackSettings.Color","Temperature":"VisualFeedbackSettings.
[0160] Transparency","OperationalStatus":"AnimationSettings.ActiveAnimation"};
[0161] This example shows that the load percentage is bound to the color feedback setting, the temperature is bound to the transparency setting, and the operation state is bound to the activated animation effect.
[0162] VisualFeedbackSettings example:
[0163] {"Color":{"Normal":"Green","Warning":"Yellow","Critical":"Red"},"Transparency":{"Low":0.2,"Medium":0.5,"High":0.8}};
[0164] This setting defines how the color and transparency of the model changes at different load percentages and temperatures.
[0165] Step S3: Call the primary and foreign key technology to associate the primary key and foreign key of the data structure table.
[0166] First, determine the primary key, determine a unique identifier for each table as the primary key. The primary key is a combination of multiple fields whose values are unique in the table.
[0167] Transformer data table Transformers:
[0168] Sql:
[0169] TransformerID: Serves as the primary key to uniquely identify each transformer.
[0170] CREATE TABLE Transformers(
[0171] TransformerID VARCHAR(50)PRIMARY KEY,
[0172] Name VARCHAR(100),
[0173] Model VARCHAR(50),
[0174] RatedPower FLOAT,
[0175] VoltageLevels VARCHAR(100),
[0176] ConnectionStatus INT,
[0177] LoadPercentage FLOAT,
[0178] Temperature FLOAT,
[0179] OilLevel FLOAT,
[0180] MaintenanceStatus INT,
[0181] LastMaintenanceDate DATE,
[0182] Manufacturer VARCHAR(100),
[0183] Installation Date DATE,
[0184] Comments TEXT
[0185] ).
[0186] Identify associations and determine the logical relationships between different tables. A transformer is associated with multiple sensor data records, while each sensor data record corresponds to only one transformer.
[0187] Design foreign keys and create foreign key fields in related tables. The values of these fields should correspond to the primary key values of the main table.
[0188] Real-time data table RealTimeData:
[0189] TransformerID: Serves as a foreign key, referencing the primary key of the transformer data table.
[0190] Sql:
[0191] CREATE TABLE RealTimeData(
[0192] RecordID INT AUTO_INCREMENT PRIMARY KEY,
[0193] TransformerID VARCHAR(50),
[0194] CurrentLoad FLOAT,
[0195] LoadTimestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
[0196] FOREIGN KEY(TransformerID)REFERENCES Transformers(TransformerID) );
[0198] Define reference actions. When creating a foreign key, define how the corresponding data in the foreign key table (RealTimeData) should respond when the data in the primary key table Transformers is deleted or updated.
[0199] ON DELETE CASCADE: If transformer data is deleted, cascade delete all related real-time data records.
[0200] ON UPDATE CASCADE: If the transformer ID is updated, cascade update the transformer ID in all related real-time data records.
[0201] Sql:
[0202] ALTER TABLE RealTimeData
[0203] ADD CONSTRAINT fk_transformer
[0204] FOREIGN KEY(TransformerID)
[0205] REFERENCES Transformers(TransformerID)
[0206] ON DELETE CASCADE
[0207] ON UPDATE CASCADE.
[0208] Avoid updating the primary key. Once a primary key is created, avoid updating it, as this will cause all foreign key records related to the primary key to be updated, which may cause a large amount of data changes. Ensure that the primary key TransformerID is not updated in the transformer data table. This can be achieved through database constraints or application logic.
[0209] Design scalability and data consistency maintenance. When designing primary and foreign key relationships, using foreign keys makes it easier to add new tables and relationships without affecting the existing data structure. Ensure that the setting of foreign key constraints can maintain data consistency and do not allow foreign key values in child tables that do not exist in the parent table.
[0210] Use indexes to optimize performance. Use indexes on primary key and foreign key fields to improve query and update performance.
[0211] Sql:
[0212] CREATE INDEX idx_transformer_id ON Transformers(TransformerID);
[0213] CREATE INDEX idx_realtime_transformer ON RealTimeData(TransformerID).
[0214] Step S4: According to the API module of the digital twin platform, set the supplementary fields, inherit and standardize the digital twin model.
[0215] Since the model needs to be driven by the digital twin platform, the content of the model physical table alone is not enough, and supplementary fields need to be set according to the content of the platform API module. The reasons why the supplementary fields are listed separately in the new data structure table instead of being fully integrated into the physical table are mainly based on the following aspects:
[0216] 1. System operation requirements: Supplementary fields are usually runtime requirements unique to the digital twin platform and are not completely related to the direct properties of the physical device. They need to be listed separately to clearly distinguish between the fields required for system operation and the actual properties of the physical device.
[0217] 2. Data model clarity: Keep the data model clear so that the data structure table is easy to understand and maintain. Listing the supplementary fields separately helps to quickly identify which fields are directly related to physical devices and which are used for system operation and control.
[0218] 3. Functional separation: Physical tables usually contain the physical properties and static information of the equipment, while supplementary fields may involve dynamic control and visual display. The functional differences need to be separated in the data structure.
[0219] 4. Data integration flexibility: Supplementary fields may need to be associated with multiple physical entities or used in different contexts. Listing them separately provides greater flexibility and facilitates integration with other data sources or systems.
[0220] 5. Scalability and maintainability: As the system develops, it may be necessary to add more supplementary fields or make adjustments. Listing these fields separately makes it easier to expand and maintain without affecting the structure of the physical table, as shown in Table 12 below.
[0221] Table 12 Supplementary field data structure table
[0222]
[0223]
[0224] These additional fields will enhance the monitoring, control, maintenance and safety capabilities of the transformer model, while providing deeper data analysis and system interaction capabilities. Through these fields, the digital twin platform can simulate and manage the operation of the transformer.
[0225] The primary and foreign key association technology of the database is used to realize the standardized inheritance of the power digital twin model. These power equipment models of different levels and types can share common data structures and behavioral characteristics through inheritance relationships while maintaining their own specific properties. Standardized inheritance reduces the complexity of model maintenance and improves the reusability of the model.
[0226] Implementing model inheritance and normalization in a database involves creating a parent table, or base class table, and a child table, or derived class table. The parent table contains common fields shared by all child tables, while the child table contains fields specific to that table. In a relational database, this is usually achieved through foreign key constraints, which ensure the referential integrity of the data.
[0227] The following is the algorithmic idea for implementing model inheritance and standardization:
[0228] 1. First, design a parent table that contains the common attributes of all power equipment, such as DeviceID, DeviceName, DeviceType, Manufacturer, InstallationDate, etc.
[0229] In database design, the logical relationship between the parent table containing the common attributes of all devices and the tables that define multiple categories is the relationship of inheritance and extension. It can also be understood that the parent table is a common attribute, and the tables of each category need to inherit the attributes of the parent table and further define new personalized attributes.
[0230] Common attributes: Common attributes refer to some basic attributes that all types of power equipment, such as transformers, circuit breakers, switchgear, etc., have. These attributes are common to all types of equipment, for example:
[0231] DeviceID: Unique device identifier.
[0232] DeviceName: device name.
[0233] DeviceType: device type.
[0234] Manufacturer: Manufacturer name.
[0235] InstallationDate: Installation date.
[0236] Parent table is the base class table: The parent table is a table that contains the common attributes of all devices. It defines a common data structure, and all child tables, or derived class tables, will inherit these common attributes. The parent table is designed to provide a unified data model to share common information between different device types.
[0237] Subtables are derived class tables: Subtables are tables designed for specific equipment types. They inherit the common attributes of the parent table and add attributes specific to the equipment type. For example, a transformer subtable may contain transformer-specific attributes such as rated power and voltage level.
[0238] Logical relationship: The relationship between the parent table and the child table is realized through foreign key constraints. The foreign key field in the child table points to the primary key field in the parent table, thus establishing an inheritance relationship. This relationship ensures the consistency and integrity of the data, and also allows the parent table and the child table to be combined during the query to obtain all the information of the device.
[0239] Design purpose: The purpose of this design pattern is to reduce data redundancy and improve data consistency and maintainability. By sharing common attributes, different device types can reuse the same data structure, while extending specific attributes through sub-tables to achieve data standardization and customization.
[0240] 2. Secondly, define the sub-table structure. For each specific type of power equipment, such as transformers, circuit breakers, etc., design a sub-table that contains the common attributes of the parent table and the attributes unique to the equipment.
[0241] 3. Establish foreign key relationship: In the child table, use the primary key of the parent table as the foreign key to establish an inheritance relationship between tables.
[0242] 4. Data operation: when inserting or updating data, ensure that the foreign key field in the child table corresponds to the primary key field in the parent table.
[0243] In database operations, ensuring that the foreign key field in the child table corresponds to the primary key field in the parent table is achieved by executing SQL statements during INSERT or UPDATE operations. In the Python code examples provided later, we use the SQLite database to demonstrate this process. The specific technical operation steps are as follows, which is equivalent to the explanation of the Python code later:
[0244] Connect to the database: Use the sqlite3.connect function to establish a connection to the database. If the database file does not exist, SQLite will automatically create it.
[0245] Create table: Use cursor.execute function to execute SQL statement to create parent table PowerDevices and child table Transformers. The DeviceID field in the child table is defined as a foreign key, pointing to the DeviceID primary key of the parent table.
[0246] Inserting parent table data: Before inserting child table data, you need to insert data into the parent table first. This is because the foreign key value must already exist in the parent table.
[0247] Insert child table data: When inserting data in the child table Transformers, the value of the DeviceID field must correspond to a DeviceID value in the parent table PowerDevices.
[0248] Commit the transaction: Use the conn.commit function to commit the transaction to ensure that all insert operations are saved to the database.
[0249] Close the connection: After the operation is completed, use the cursor.close and conn.close functions to close the cursor and database connection.
[0250] Specific implementation:
[0251] Create tables: In the Python code, we first created the parent table PowerDevices and the child table Transformers.
[0252] The DeviceID field of the child table is defined as a foreign key, pointing to the primary key of the parent table:
[0253] Python
[0254] cursor.execute("'
[0255] CREATE TABLE IF NOT EXISTS PowerDevices(
[0256] DeviceID INTEGER PRIMARY KEY,
[0257] DeviceName TEXT,
[0258] DeviceType TEXT,
[0259] Manufacturer TEXT,
[0260] Installation Date DATE )
[0262] ”')
[0263] cursor.execute("'
[0264] CREATE TABLE IF NOT EXISTS Transformers(
[0265] DeviceID INTEGER,
[0266] ModelNumber TEXT,
[0267] RatedPower REAL,
[0268] VoltageLevels TEXT,
[0269] FOREIGN KEY(DeviceID)REFERENCES PowerDevices(DeviceID) )
[0271] ”').
[0272] Inserting data: When inserting data, we first insert a record into the parent table PowerDevices, and then insert a record into the child table Transformers, making sure that the DeviceID in the child table corresponds to the DeviceID in the parent table:
[0273] Python
[0274] #Insert parent table data
[0275] cursor.execute("'
[0276] INSERT INTO PowerDevices(DeviceID,DeviceName,DeviceType,Manufacturer,InstallationDate)
[0277] VALUES(1,'Main Transformer','Transformer','Transformer Co.','2021-06-01')
[0278] ”')
[0279] #Insert subtable data
[0280] cursor.execute("'
[0281] INSERT INTO Transformers(DeviceID,ModelNumber,RatedPower,VoltageLevels)
[0282] VALUES(1,'T123',500.0,'115kV / 35kV')
[0283] ”')
[0284] Commit the transaction: In the Python code, we use conn.commit() to commit the transaction to ensure that the inserted data is formally written to the database. This process ensures the referential integrity of the data, that is, each record in the child table corresponds to a record in the parent table. If a non-existent DeviceID is inserted into the child table, the database will report an error because the foreign key constraint is violated. This mechanism is a key part of maintaining database data consistency.
[0285] 5. Query optimization: Design queries to facilitate joint retrieval of data from parent and child tables, while obtaining common and specific attributes.
[0286] 6. Maintain data integrity: Use database foreign key constraints and triggers to maintain data integrity and consistency.
[0287] Here is the code implementation using Python and SQL:
[0288] SQL parent table creation:
[0289] CREATE TABLE PowerDevices(
[0290] DeviceID INT PRIMARY KEY,
[0291] DeviceName VARCHAR(255),
[0292] DeviceType VARCHAR(100),
[0293] Manufacturer VARCHAR(100),
[0294] Installation Date DATE );
[0296] SQL subtable creation:
[0297] CREATE TABLE Transformers(
[0298] DeviceID INT,
[0299] ModelNumber VARCHAR(255),
[0300] RatedPower FLOAT,
[0301] VoltageLevels VARCHAR(255),
[0302] --Other transformer-specific fields
[0303] FOREIGN KEY(DeviceID)REFERENCES PowerDevices(DeviceID) );
[0305] Python code to insert data:
[0306] import sqlite3#Connect to SQLite database
[0307] #If the file does not exist, a database file will be automatically created in the current directory conn = sqlite3.connect('power_equipment.db')
[0308] cursor = conn.cursor()
[0309] #Create table
[0310] cursor.execute("'
[0311] CREATE TABLE IF NOT EXISTS PowerDevices(
[0312] DeviceID INTEGER PRIMARY KEY,
[0313] DeviceName TEXT,
[0314] DeviceType TEXT,
[0315] Manufacturer TEXT,
[0316] InstallationDate DATE )
[0318] ”')
[0319] cursor.execute(”'
[0320] CREATE TABLE IF NOT EXISTS Transformers(
[0321] DeviceID INTEGER,
[0322] ModelNumber TEXT,
[0323] RatedPower REAL,
[0324] VoltageLevels TEXT,
[0325] FOREIGN KEY(DeviceID)REFERENCES PowerDevices(DeviceID) )
[0327] ”')
[0328] # Insert data into the parent table
[0329] cursor.execute(”'
[0330] INSERT INTO PowerDevices(DeviceID,DeviceName,DeviceType,Manufacturer,InstallationDate)
[0331] VALUES(1,'Main Transformer','Transformer','Transformer Co.','2021-06-01')
[0332] ”')
[0333] # Insert data into the child table
[0334] cursor.execute(”'
[0335] INSERT INTO Transformers(DeviceID,ModelNumber,RatedPower,VoltageLevels)
[0336] VALUES(1,'T123',500.0,'115kV / 35kV')
[0337] ”')
[0338] #Commit transaction
[0339] conn.commit()
[0340] #Close the connection
[0341] cursor.close()
[0342] conn.close()
[0343] Step S5: Map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid.
[0344] Physical table and entity mapping: The physical table is the table in the database that actually stores data, and it corresponds one-to-one with the entity of the power digital twin model. Each digital twin of power equipment has a corresponding physical table to store its status information and historical data. This mapping ensures the synchronous update of the model and the actual power equipment, providing a solid data foundation for the model.
[0345] Define common class properties: Create a base class or parent class that contains the common properties of all power equipment.
[0346] Create specific equipment classes: Create subclasses for each specific power equipment, such as the main transformer, and inherit the properties and methods of the base class.
[0347] Determine unique mapping: Assign a unique identifier to each device instance to ensure that it can uniquely correspond to the data record in the physical table.
[0348] Create physical table mapping: Design the physical table structure to store the status information and historical data of the device.
[0349] Instantiate device objects: Create object instances of specific device classes and map their instance attributes to records in the physical table.
[0350] The Python code implementation process is as follows:
[0351] #Define the base class of power equipment
[0352] class PowerEquipment:
[0353] def__init__(self, equipment_id, name, device_type, manufacturer, installation_date):
[0354] self.equipment_id=equipment_id
[0355] self.name = name
[0356] self.device_type=device_type
[0357] self.manufacturer=manufacturer
[0358] self.installation_date=installation_date
[0359] #You can add more general methods
[0360] #Define the main transformer class, inheriting from the base class
[0361] class MainTransformer(PowerEquipment):
[0362] def__init__(self, equipment_id, name, manufacturer, installation_date, rated_power, voltage_levels):
[0363] super().__init__(equipment_id,name,'Transformer',manufacturer,installation_date)
[0364] self.rated_power=rated_power
[0365] self.voltage_levels=voltage_levels
[0366] # Initialize other transformer-specific properties
[0367] #define transformer-specific methods
[0368] def update_transformer_data(self,current_load,load_percentage,temperature,oil_level):
[0369] #Here is the logic for updating the transformer status
[0370] pass
[0371] #Create a database connection and table (if the table does not exist)
[0372] import sqlite3
[0373] conn=sqlite3.connect('electric_power.db')
[0374] cursor = conn.cursor()
[0375] cursor.execute("'
[0376] CREATE TABLE IF NOT EXISTS transformers(
[0377] equipment_id INTEGER PRIMARY KEY,
[0378] name TEXT,
[0379] device_type TEXT,
[0380] manufacturer TEXT,
[0381] installation_date DATE,
[0382] rated_power REAL,
[0383] voltage_levels TEXT )
[0385] ”')
[0386] #Commit transaction
[0387] conn.commit()
[0388] #Instantiate transformer object
[0389] transformer=MainTransformer(
[0390] equipment_id=1,
[0391] name = 'Main Transformer 1',
[0392] manufacturer='Transformer Inc.',
[0393] installation_date=datetime.date(2023,1,15),
[0394] rated_power=500,#Assume the unit is MVA
[0395] voltage_levels='230kV / 132kV' )
[0397] #Synchronize the data of the transformer object to the physical table
[0398] def sync_to_physical_table(transformer):
[0399] cursor.execute("'
[0400] INSERT INTO transformers(equipment_id,name,device_type,manufacturer,installation_date,rated_power,voltage_levels)
[0401] VALUES(?,?,?,?,?,?,?)
[0402] ”',(transformer.equipment_id,transformer.name,transformer.device_type,
[0403] transformer.manufacturer,transformer.installation_date,transformer.rated_power,
[0404] transformer.voltage_levels)
[0405] #Commit transaction
[0406] conn.commit()
[0407] #Close the database connection
[0408] cursor.close()
[0409] conn.close().
[0410] From the above process, we can know that firstly, the base class PowerEquipment of power equipment is defined. The PowerEquipment class is a base class used to represent the common properties and methods of all power equipment.
[0411] The constructor init initializes the device's unique identifier equipment_id, name name, device type device_type, manufacturer manufacturer, and installation date installation_date.
[0412] Define the main transformer class MainTransformer: The MainTransformer class inherits from PowerEquipment and represents a specific type of power equipment - the main transformer. It adds transformer-specific properties based on the base class constructor: rated power rated_power and voltage level voltage_levels.
[0413] The update_transformer_data method is a placeholder for future implementation of logic for updating the transformer state.
[0414] Create database connection and table: Use sqlite3 library to connect to the SQLite database electric_power.db.
[0415] If it does not exist, create a table called transformers with fields corresponding to the MainTransformer class.
[0416] Instantiate the transformer object: Create an instance of the MainTransformer class and initialize its properties, including the transformer's unique identifier, name, manufacturer, installation date, power rating, and voltage level.
[0417] Define the synchronization function sync_to_physical_table: This function is responsible for inserting the data of the transformer object into the transformers table of the database. Use cursor.execute to execute the SQL insert statement and pass the attributes of the transformer object as parameters.
[0418] Commit the transaction and close the database connection: Use conn.commit to commit the transaction to ensure that the inserted data is saved to the database. Finally, use cursor.close and conn.close to close the cursor and database connection.
[0419] Data uniqueness mapping: In this process, the equipment_id field is used as the primary key to ensure the uniqueness of each power equipment in the database. Whenever a new instance of the MainTransformer class is created, a new record with a unique equipment_id is generated, thereby uniquely mapping the power equipment in the physical table. In this way, the code implements the encapsulation of the properties of the power equipment in the class and persists these properties through the database table. This not only provides a structured approach to processing the data of power equipment, but also can be easily extended to other types of power equipment through the inheritance mechanism, while keeping the code maintainable and extensible.
[0420] The fields of the database table not only store static information about the equipment, but also dynamically update the real-time status information of the equipment. For example, key indicators such as the temperature and load rate of the transformer are collected in real time through sensors and updated to the corresponding fields. This supplement of status information enables the digital twin model to accurately reflect the current working status of the equipment.
[0421] Code implementation for accessing external system data:
[0422] Logical explanation for accessing external operation data:
[0423] External system data access: Use the requests library to initiate HTTP requests to obtain real-time data from external system APIs. This requires a normal network connection and the availability of the API service.
[0424] Data parsing: The acquired data is usually returned in JSON format. Use the json.loads function to parse the JSON format string into a Python dictionary for further processing.
[0425] Database connection management: Create and return a database connection through the get_db_connection function. This connection is used for subsequent data operations.
[0426] Data update logic: The update_transformer_status function is responsible for updating the real-time data obtained from the external system into the database. It first obtains the database connection and then executes the SQL update statement in the try block.
[0427] Parameterized queries: When executing SQL update statements, use parameterized queries to prevent SQL injection attacks and improve query efficiency.
[0428] Transaction processing: Use db.commit() to commit database transactions to ensure that data updates are formally saved in the database.
[0429] Error handling: In the try-except block, catch and handle exceptions that may occur, such as database connection errors or SQL execution errors.
[0430] Resource management: Use finally blocks to ensure that database connections are closed after operations are completed, freeing resources even in the event of an exception.
[0431] Main process control: The main function is the entry point of the program, calling the fetch_real_time_data and update_transformer_status functions to complete data acquisition and update.
[0432] The following is the original code implementation process:
[0433] First, we need to install a library to help us handle HTTP requests:
[0434] pip install requests;
[0435] Then the following code is used to access the structure table information:
[0436]
[0437]
[0438] In this example, the fetch_real_time_data function is responsible for obtaining real-time data from an external system. Here, it is assumed that the external system provides an API endpoint that returns data in JSON format. The update_transformer_status function updates the obtained data to the database. The main function is the entry point of the entire process, and it calls the above two functions to complete data acquisition and update.
[0439] The structure table after creating the instance to access external system data is shown in Table 13 below.
[0440] Table 13 Structure table after creating an instance to access external system data
[0441] Property Name Data Types Data content example TransformerID varchar T123456 Name varchar Main transformer 1 Model varchar TRX-500KVA RatedPower float 500 VoltageLevels varchar 115kV / 35kV / 10kV ConnectionStatus int 1 LoadPercentage float 75.3 Temperature float 45.6 OilLevel float 89.0 MaintenanceStatus int 0 LastMaintenanceDate date 2024-01-10 Manufacturer varchar Transformer Manufacturer A InstallationDate date 2020-05-20 Comments text No special instructions CurrentLoad float Dynamically updated based on real-time data TemperatureAlert bool Dynamically updated based on the Temperature field OilLevelStatus bool Dynamically updated according to the OilLevel field FaultStatus varchar No trouble VoltageCurrentStatus bool Dynamically updated based on real-time data ProtectionDeviceStatus bool Dynamically updated based on real-time data Environmental Conditions text Dynamically updated based on real-time data OperationLog text Dynamically updated based on real-time logs
[0442] Step S6: Reversely write the three-dimensional model operation into the structural data table to achieve two-way interaction of the digital twin model.
[0443] Development of automated model database construction technology route: In order to quickly deploy and configure digital twin model services, a set of automated model database construction technology routes has been developed. The initialization work such as database creation, table generation, and data type setting is automated to ensure the consistency and replicability of model services. The database construction script also takes into account compatibility with existing database products to achieve seamless integration.
[0444] The following technical means are used to quickly and automatically deploy and configure digital twin model services:
[0445] Database creation: Use the CREATE DATABASE IF NOT EXISTS statement to create a new database DigitalTwinService. The database will be created only if it does not exist.
[0446] Table structure definition: Three tables are defined using the CREATE TABLE IF NOT EXISTS statement: Transformers, RealTimeData, and MaintenanceLogs. Each table has its specific fields and data types to store different data of the transformer.
[0447] Data integrity constraints: Use a CHECK constraint on the Transformers table to ensure that the ConnectionStatus field contains only valid values (0 or 1).
[0448] Foreign key constraints: Use FOREIGN KEY constraints in the RealTimeData and MaintenanceLogs tables to ensure referential integrity with the TransformerID field of the Transformers table.
[0449] Index optimization: Create indexes idx_transformer_name, idx_realtime_transformer, and idx_maintenance_transformer to improve query performance, especially queries on transformer name, real-time data, and maintenance logs.
[0450] View creation: A view vw_TransformerStatus is created using the CREATE VIEW statement, which provides a joint view of the real-time status and maintenance information of the transformer, making it easy to quickly obtain a snapshot of the status of the transformer.
[0451] Stored procedure: A stored procedure UpdateTransformerLoad is defined to update the transformer load information in the RealTimeData table, ensuring that each update is based on the latest timestamp record.
[0452] Trigger Automation: Create a trigger trg_UpdateLoadAfterInsert, which is automatically triggered after inserting a new record into the Transformers table, inserting the corresponding initialization load data into the RealTimeData table.
[0453] Data Comments: Comments are added to tables and fields using COMMENT ON TABLE and COMMENT ON COLUMN statements to improve the readability and maintainability of the database.
[0454] Compatibility considerations: The script is designed with compatibility with existing database products in mind, ensuring that it can be seamlessly integrated into the existing database environment.
[0455] Transaction management: Change statement terminators through the DELIMITER statement to write and execute longer database operations, such as stored procedures and triggers.
[0456]
[0457]
[0458]
[0459]
[0460] In the above script, this embodiment creates three tables: Transformers, RealTimeData, and MaintenanceLogs. The Transformers table stores basic information of the transformer, the RealTimeData table stores real-time load data of the transformer, and the MaintenanceLogs table records maintenance activities of the transformer.
[0461] This example also creates an index to optimize query performance, defines a view vw_TransformerStatus to provide a joint view of the real-time status and maintenance information of the transformer. In addition, a stored procedure UpdateTransformerLoad is defined to update the real-time load information of the transformer, and a trigger trg_UpdateLoadAfterInsert is defined to automatically update the RealTimeData table after inserting a new transformer record into the Transformers table.
[0462] Inter-system synchronization and sharing mechanism: An efficient inter-system synchronization and sharing mechanism has been established, which realizes real-time synchronization of data between different systems through technical means such as message queues and API interfaces. This mechanism not only ensures data consistency, but also supports complex cross-system queries and analysis, providing support for comprehensive monitoring and decision-making of the power grid.
[0463] Message Queue: Message queues act as an intermediary for data transmission between systems and can asynchronously transmit data change events. When a system updates data (such as a change in the load rate of a transformer), it sends event messages to the queue instead of directly updating other systems.
[0464] Pub / Sub Model: With the Pub / Sub model, a system can send messages as a publisher and receive messages as a subscriber. In this way, when data changes, all systems that have subscribed to the relevant topic can receive updates, thereby keeping the data synchronized.
[0465] API interface: System synchronization not only relies on message queues, but also requires more complex data interaction and query through API interfaces. API provides a standardized method to access and manipulate data, supporting cross-system data requests and responses.
[0466] Data consistency guarantee: Through transaction management and data verification mechanisms, the consistency and integrity of data during transmission are ensured. If there is a problem with the data during transmission, the system can roll back the transaction and resynchronize the data.
[0467] Real-time: The system design focuses on real-time, by optimizing the processing capacity of the message queue and the response speed of the API to ensure that data updates can be quickly propagated in the system.
[0468] Use message queues such as RabbitMQ to asynchronously handle data synchronization. The following is a simple Python example showing how to use the pika library to publish and subscribe to messages. The specific implementation process is as follows:
[0469]
[0470]
[0471] Data synchronization mechanism:
[0472] Write functions to implement data synchronization logic, including receiving data from the message queue and updating the database:
[0473]
[0474]
[0475] Exception handling and transaction management:
[0476] Make sure you have proper exception handling and transaction management when updating the database:
[0477]
[0478] Note that these examples provide a base.
[0479] Model service and application implementation: On the basis of ensuring data structure design and synchronization mechanism, the specific functions of model service are realized. This includes data collection, processing, analysis and visualization. Model service provides a rich API, allowing developers to call model data and functions as needed to implement customized applications. Through these services, users can monitor the operation status of the power grid in real time, perform fault diagnosis, and optimize the operation and maintenance strategy of power equipment.
[0480] The list of external APIs is shown in Table 14 below.
[0481] Table 14 External API List
[0482]
[0483] Working Principle: This embodiment designs a core data structure table of the power digital twin model, which is the key to effectively organize and manage model attributes and status information. The data structure table not only stores basic information about the equipment, such as the model, rated power, and voltage level of the transformer, but also includes dynamic status information, such as load percentage, temperature, and oil level. Through a carefully designed data structure table, the consistency, accuracy, and ease of access of the data can be ensured, providing strong data support for the model. This design enables the digital twin model to accurately reflect the real-time status of power equipment, and supports complex queries and analysis, providing a data basis for monitoring and optimization of the power grid.
[0484] This embodiment realizes the inheritance and standardization of the power digital twin model through the primary and foreign key association technology of the database. This technology allows power equipment models of different levels and types, such as transformers, circuit breakers, etc., to share common data structures and behavioral characteristics through inheritance relationships. This not only reduces the complexity of model maintenance, but also improves the reusability of the model. Standardized model design promotes consistency and interoperability across systems, making it easier to integrate model services into existing power systems and support the digital transformation and intelligent upgrade of power grids.
[0485] This embodiment develops a data-driven three-dimensional controlled interface that allows the power digital twin model to be dynamically updated and visualized based on real-time data. This interface combines three-dimensional graphics technology with real-time data processing, allowing users to intuitively observe and interact with the operating status of power equipment in three-dimensional space. For example, the load rate of the transformer can be represented by the color change of the model, and when the temperature is too high, it can be warned by flashing or special markings. This three-dimensional controlled interface not only enhances the user experience, but also improves the perception of the power grid status, providing an intuitive visualization tool for monitoring and decision-making of the power grid.
[0486] This embodiment realizes the service-oriented digital twin model of the power system, and provides a series of functions including data collection, processing, analysis and visualization. By opening up rich APIs, this patent allows developers to call model data and functions as needed to implement customized applications. These APIs support real-time monitoring of the operating status of the power grid, fault diagnosis, and optimization of the operation and maintenance strategies of power equipment. The realization of service-orientedness promotes the integration of models with different systems and applications, improves the flexibility and response speed of power grid management, and provides strong technical support for the intelligence and automation of power systems.
[0487] The other parts of this embodiment are the same as those of the above-mentioned embodiment 1, and thus will not be described in detail.
[0488] Embodiment 3:
[0489] Based on any one of the above-mentioned embodiments 1-2, this embodiment proposes a digital twin model two-way interactive system based on a data structure table, which is used to execute the above-mentioned digital twin model two-way interactive method based on a data structure table; including a construction unit, an association unit, an inheritance unit, a mapping unit, and a two-way interactive unit;
[0490] The construction unit is used to construct a dynamic update mechanism according to the acquired power equipment operation data and the preset logic rules to obtain a three-dimensional model attribute table; and update the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables;
[0491] The association unit is used to call the primary and foreign key technology to associate the primary key and the foreign key of the data structure table;
[0492] The inheritance unit is used to set supplementary fields according to the API module of the digital twin platform, inherit and standardize the digital twin model;
[0493] The mapping unit is used to map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid;
[0494] The two-way interaction unit is used to reversely write the three-dimensional model operation into the structure data table to realize two-way interaction of the digital twin model.
[0495] This embodiment also proposes an electronic device, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned digital twin model two-way interaction method based on the data structure table is implemented.
[0496] This embodiment also proposes a computer-readable storage medium, on which computer instructions are stored; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned digital twin model two-way interaction method based on the data structure table is implemented.
[0497] The other parts of this embodiment are the same as any one of the above-mentioned embodiments 1-2, so they will not be repeated here.
[0498] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A two-way interactive method of digital twin model based on data structure table, It is characterized in that The specific steps include: Step S1: construct a dynamic update mechanism based on the acquired power equipment operation data and preset logical rules to obtain a three-dimensional model attribute table; Step S2: updating the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables; Step S3: calling the primary and foreign key technology to associate the primary key and foreign key of the data structure table; Step S4: According to the API module of the digital twin platform, set the supplementary fields, inherit and standardize the digital twin model of the power equipment; Step S5: Map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid; Step S6: Reversely write the three-dimensional model operation into the structural data table to achieve two-way interaction of the digital twin model.
2. According to the digital twin model two-way interaction method based on the data structure table of claim 1, It is characterized in that The multiple three-dimensional model data structure tables described in step S2 include a basic information data structure table, a rule parameter data structure table, an operating status data structure table, a surface status data structure table, a logical rule data structure table, a maintenance and log data structure table, an operating environment condition data structure table, an extended attribute data structure table, and a three-dimensional controlled interface data structure table.
3. According to claim 1, a digital twin model bidirectional interaction method based on a data structure table, It is characterized in that The step S3 specifically comprises the following steps: Step S31: Obtain a unique identifier of the data structure table, and use the obtained unique identifier as a primary key; Step S32: determining the logical relationship between different three-dimensional model data structure tables to obtain associated three-dimensional model data structure tables; Step S33: creating a foreign key field corresponding to the primary key value in the associated three-dimensional model data structure table.
4. According to claim 3, a digital twin model two-way interaction method based on a data structure table, It is characterized in that The step S4 specifically comprises the following steps: Step S41: according to the API module content of the digital twin platform, set the supplementary fields in the three-dimensional data structure table, and construct an independent supplementary field data structure table; Step S42: defining a parent table structure according to the common attributes of the power equipment; Step S43: defining a sub-table structure according to the type of the power equipment; Step S44: Use the primary key of the parent table as a foreign key to establish an inheritance relationship; Step S45: Standardize the model according to the established inheritance relationship.
5. According to claim 4, a two-way interactive method of a digital twin model based on a data structure table, It is characterized in that The step S5 specifically comprises the following steps: Step S51: creating a parent class containing common attributes of all power equipment; Step S52: creating a subclass according to the type of the electric power equipment, and inheriting the properties and methods of the parent class in the subclass; Step S53: assigning a unique identifier to each power device instance; Step S54: Create a physical table structure to store the status information and historical data of the power equipment, and create a physical table mapping; Step S55: Create an object instance of the power equipment class, and map the object instance attributes with the records of the physical table to instantiate the power equipment object.
6. According to claim 5, a two-way interactive method of a digital twin model based on a data structure table, It is characterized in that The step S6 specifically comprises the following steps: Step S61: call the get_db_connection function to create and return a database connection; Step S62: Call the requests database to initiate an http request, obtain real-time data from the external system API module, and call the update_transformer_status function to update the obtained real-time data into the database.
7. According to claim 1, a two-way interactive method of a digital twin model based on a data structure table, It is characterized in that The digital twin model bidirectional interaction method based on the data structure table also includes: Step S7: Establish a synchronization and sharing mechanism between systems through message queues and API interfaces to synchronize data between different systems in real time.
8. A digital twin model bidirectional interaction system based on a data structure table, used to execute the digital twin model bidirectional interaction method based on a data structure table as claimed in claim 1; It is characterized in that It includes construction unit, association unit, inheritance unit, mapping unit and two-way interaction unit; The construction unit is used to construct a dynamic update mechanism according to the acquired power equipment operation data and the preset logic rules to obtain a three-dimensional model attribute table; and update the three-dimensional model attribute table according to the set category to obtain multiple three-dimensional model data structure tables; The association unit is used to call the primary and foreign key technology to associate the primary key and the foreign key of the data structure table; The inheritance unit is used to set supplementary fields according to the API module of the digital twin platform, inherit and standardize the digital twin model; The mapping unit is used to map the three-dimensional model data structure table with the standardized digital twin model to obtain the real-time status of the power grid; The two-way interaction unit is used to reversely write the three-dimensional model operation into the structure data table to realize two-way interaction of the digital twin model.
9. An electronic device, It is characterized in that It comprises a memory and a processor; a computer program is stored in the memory; when the computer program is executed on the processor, a two-way interactive method of a digital twin model based on a data structure table as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device as described in claim 9, the digital twin model bidirectional interaction method based on the data structure table as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Mobile terminal digital twin model construction method and system
CN120144595A
Garden engineering BIM plant forward design and data linkage method and system
CN121436915A
A landscape engineering BIM plant forward design and data linkage method and system
CN121436915B
