Automatic construction method and system for digital twin topology of power distribution network

By using object-oriented modeling and graph theory computation, combined with OpenDSS simulation, a digital twin of the distribution network is automatically constructed, which solves the problems of low efficiency and low accuracy caused by manual operation in the existing technology, and realizes the functions of efficient and accurate construction and in-depth analysis of digital twins of the distribution network.

CN121859527APending Publication Date: 2026-04-14NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing digital twin construction technologies for distribution networks rely on manual operation, resulting in severe data heterogeneity, semantic inconsistency, large workload, long time consumption, and easy error. Furthermore, they lack in-depth topology analysis and visualization functions, making it difficult to provide effective support for distribution network planning, design, and fault diagnosis.

Method used

Using object-oriented modeling principles, standardized device classes and connection mapping rules are defined. Electrical topology networks are automatically generated through graph theory calculations. A format converter is used to convert the digital twin model into an OpenDSS-compatible format. Combined with the OpenDSS simulation engine, power flow calculations and topology analysis are performed to generate multi-dimensional visualization charts and reports.

Benefits of technology

It enables the automated construction of digital twins for distribution networks, improving construction efficiency and accuracy, reducing human error, supporting in-depth topology analysis and visualization, and enhancing the support capabilities for distribution network planning, design, and fault diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859527A_ABST
    Figure CN121859527A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic construction method for a digital twin topology of a power distribution network, and the method comprises the steps: obtaining original data of the power distribution network, and carrying out the preprocessing of the original data; based on the preprocessed power distribution network data, an object-oriented modeling thought is adopted, and a standardized equipment class and a connection relation mapping rule are defined; an electrical topology network of the power distribution network is automatically generated, a digital twin model is constructed, and connectivity verification and hierarchical relation calculation are carried out by utilizing graph theory calculation; automatically converting the digital twin model into a DSS script format compatible with OpenDSS by using a format converter; load flow calculation and topology analysis are carried out based on an OpenDSS simulation engine, and a multi-dimensional visual chart and an HTML interactive report are generated. According to the method, through the unified connection relation mapping standard, the connection relation mapping standard facing the power distribution network is improved, and automatic conversion from the power distribution network data to the standard digital twinborn model is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart grid technology, and more particularly to power system digital twin technology and distribution network automation modeling technology. Specifically, it relates to a method and system for automatically constructing the topology of a distribution network digital twin. Background Technology

[0002] With the rapid development of the energy internet and smart grids, the large-scale integration of distributed energy resources, the rapid growth of electric vehicle charging loads, and the increasingly complex electricity consumption patterns on the user side, the distribution network, as an important component of the power system, faces increasingly urgent needs for operational status monitoring, fault diagnosis, and optimized dispatching. Digital twin technology, as a key enabling technology for the digital transformation of the distribution network, can construct a digital mirror that is synchronized with the physical power grid in real time in virtual space, providing strong support for power grid operation analysis.

[0003] Among the existing methods for constructing digital twins of distribution networks, the construction of digital twins of distribution networks mainly relies on manual operation. Designers need to manually input equipment, configure parameters, connect topologies, and verify relationships in modeling software based on various heterogeneous data sources (such as CAD drawings, equipment ledgers, SCADA data, GIS geographic information, etc.). The specific process includes: (1) exporting Excel or database files from various business systems; (2) manually identifying equipment types and parameters; (3) creating equipment objects one by one in the modeling tool; (4) manually drawing or configuring electrical connection relationships between equipment; and (5) performing topology consistency verification and parameter debugging. Some semi-automated methods may use scripts to import some data in batches, but still require a lot of manual intervention to complete the unified processing of heterogeneous data formats, semantic recognition of equipment connection relationships, verification of the correctness of topology structure, and data format conversion with simulation analysis tools.

[0004] Existing power distribution network data sources contain a wide variety of equipment types (transformers, lines, switches, loads, capacitors, voltage regulators, etc.), and different data formats describe equipment connection relationships in different ways, lacking a unified standardized representation method. This leads to severe data heterogeneity and semantic inconsistencies, making it difficult to achieve cross-system data sharing and model reuse. Traditional methods mainly rely on manual modeling, requiring the input of equipment parameters one by one and the manual drawing of topological connection relationships, which is labor-intensive, time-consuming, and prone to errors. Even with the use of partially automated tools, they are mostly targeted at specific data sources or specific equipment types, lacking versatility and scalability, and unable to adapt to power distribution network systems of different sizes and types. Manual methods are inefficient, time-consuming, labor-intensive, prone to errors, and have low accuracy. OpenDSS is the mainstream tool for power distribution system simulation and analysis, but there is a lack of an effective data conversion mechanism between existing digital twin models and OpenDSS. Engineers need to manually write DSS scripts or use commercial software with limited functionality for format conversion, which not only increases the workload but may also introduce errors due to manual operation, affecting the accuracy of simulation results. Existing systems mostly focus on data storage and simple display, lacking in-depth topology analysis functions (such as connectivity detection, path search, and island identification) and intuitive visualization (such as multi-level topology diagrams, voltage distribution curves, and dynamic power flow rendering), making it difficult to provide effective support for distribution network planning and design, operation optimization, and fault diagnosis.

[0005] Therefore, there is an urgent need for an automated, accurate, and scalable digital twin topology construction technology for distribution networks to solve the above problems. Summary of the Invention

[0006] The present invention aims to at least partially solve one of the technical problems existing in the related art.

[0007] One objective of this invention is to provide an automated, efficient, high-precision, and scalable method for automatically constructing the digital twin topology of a distribution network, enabling seamless integration with mainstream power system simulation tools such as OpenDSS.

[0008] Another objective of this invention is to provide an automatic topology construction system for a digital twin of a power distribution network.

[0009] To achieve the above objectives, the present invention provides a method for automatically constructing a digital twin topology of a distribution network, comprising the following steps:

[0010] S1. Obtain the raw data of the distribution network and preprocess it;

[0011] S2. Based on the original data of the distribution network, adopt the object-oriented modeling concept to define standardized equipment classes and connection relationship mapping rules;

[0012] S3. Based on the preprocessed distribution network data and the established equipment connection relationship mapping, the electrical topology network of the distribution network is automatically generated, a digital twin model is constructed, and graph theory is used to perform connectivity verification and hierarchical relationship calculation.

[0013] S4. Use a format converter to automatically convert the digital twin model into an OpenDSS-compatible DSS script format;

[0014] S5 performs power flow calculations and topology analysis based on the OpenDSS simulation engine, extracts key parameters, and generates multi-dimensional visualization charts and interactive HTML reports.

[0015] A further preferred technical solution of the present invention is that the original data of the distribution network in step S1 includes line configuration data, load data, transformer data, capacitor data, voltage regulator data, and switch data.

[0016] Preferably, the preprocessing in step S1 includes data parsing and standardization, specifically: automatic file identification, tabular data parsing, data cleaning and validation, unit standardization, and phase information extraction; wherein...

[0017] Automatic file recognition: Through pattern matching algorithms, it automatically identifies data files with different naming conventions, adapting to the format differences of different feeder datasets;

[0018] Table data parsing: Using the pandas library to read Excel files, automatically skipping header rows, identifying the start and end positions of data, and extracting device parameters row by row;

[0019] Data cleaning and validation: Perform null value detection, data type conversion, and outlier filtering on the read data to ensure data quality;

[0020] Unit standardization: converting physical quantities with different units into standard units;

[0021] Phase information extraction: Extract phase information from line configuration data, automatically remove neutral line identifier, and generate standard phase string.

[0022] Preferably, the device data structures defined in step S2 include: node class, line class, line configuration class, load class, transformer class, capacitor class, voltage regulator class, switch class, distributed load class, and distribution network container class;

[0023] The defined connection mapping rules include: establishing conductive connection between the nodes at both ends of the line equipment, with the phase configuration determined by the line configuration; establishing transformation connection between the high and low voltage side nodes of the transformer, with connection methods supporting star and delta; establishing consumption connection between the load and the node, with the connection method determined by the load model; establishing regulation connection between the input and output nodes of the voltage regulator; establishing connection between the nodes at both ends of the switch, with the state being closed or open; and automatic source node identification rules: (a) extracted from voltage regulator data; (b) identifying nodes with an in-degree of zero from the topology; and (c) inferred from common naming patterns.

[0024] Preferably, step S3 automatically generates the electrical topology of the distribution network based on the preprocessed distribution network data and the established equipment connection relationship mapping, constructs a digital twin model, and uses graph theory computation to perform connectivity verification and hierarchical relationship calculation, specifically as follows:

[0025] S31. Automatic Topology Graph Construction: Using the NetworkX graph computing library, nodes are mapped to graph vertices, and lines, transformers, and switches are mapped to graph edges, automatically constructing the topology graph; the attributes of the edges contain various metadata.

[0026] S32. Connectivity check: Use depth-first search or breadth-first search algorithm to detect connected components of the graph, identify isolated nodes or broken subnetworks, and output warning messages.

[0027] S33. Path analysis from source node to load node: Based on the BFS algorithm, traverse from the source node, calculate the level and distance of each node, and provide spatial information for subsequent visualization and analysis;

[0028] S34. Topology Consistency Check: Verify the uniqueness of node names, check if the endpoints of edges exist in the node set, detect self-loops and duplicate edges, and ensure the correctness of topology logic.

[0029] S35, Hierarchical Layout Algorithm: Implements a hierarchical layout algorithm based on BFS, placing the source node at the top level and then layering downwards sequentially to provide a clear hierarchical structure for topology visualization; for unconnected nodes, they are automatically placed at the maximum level + 1.

[0030] Preferably, the format converter in S4 includes: a translation engine and a file management module, wherein,

[0031] The translation engine has a set of syntax rules organized according to the OpenDSS command format. It translates basic information and specific devices item by item in a fixed order in this table. The specific steps are as follows:

[0032] S401, DSS Circuit Definition Generation: Based on the source node, reference voltage, and reference frequency, the "NewCircuit" command is automatically generated to define the global parameters of the simulation circuit;

[0033] S402, Line Configuration Code Generation: Converts the LineConfig object into a "New LineCode" command, automatically configuring positive sequence impedance, zero sequence impedance, and capacitance parameters based on the number of phases; using simplified typical parameters or extracting actual parameters from the configuration data;

[0034] S403, Line segment code generation: Converts the Line object into a "New Line" command, including start and end nodes, phase string, line configuration reference, and length;

[0035] S404, Transformer Code Generation: Convert the Transformer object into a "New Transformer" command, using a dual-winding configuration, and define the busbars, connection methods, voltage levels, capacity, and impedance parameters for the high and low voltage sides respectively;

[0036] S405 Load Code Generation: Converts Load objects into "New Load" commands, automatically mapping load models, connection methods, phase configurations, and power parameters;

[0037] S406, Capacitor Code Generation: Convert the Capacitor object into a "New Capacitor" command to configure reactive power capacity and connection method;

[0038] S407, Voltage Regulator Code Generation: The voltage regulator is simulated by a combination of a transformer and a voltage regulator controller, and control parameters are automatically generated.

[0039] S408, Switch Code Generation: A short-circuit simulation switch is used, and the enabled parameter is set according to the switch status;

[0040] S409, Solver Command Generation: Automatically adds commands and configures the simulation solver;

[0041] S410, Phase Format Conversion Method: Enables automatic conversion from internal phase representation to OpenDSS phase representation;

[0042] S411, Modular code organization: Generate DSS code in segments according to device type and add comments;

[0043] The file management module is used to save the translated content as a DSS script file.

[0044] Preferably, the OpenDSS simulation execution in step S5 is as follows: using the opendssdirect.py library or the dss_python library, load the DSS script file generated in step S4, call the Solve command to perform power flow calculation, and check the convergence status.

[0045] Preferably, the extraction of key parameters in step S5 includes bus voltage extraction, line power flow extraction, and load power extraction, specifically:

[0046] Bus voltage extraction: Traverse all buses, extract the per-unit value of node voltage, actual voltage, phase angle, number of nodes and distance, and store it as structured data;

[0047] Line power flow extraction: Traverse all lines and extract line power, current and loss;

[0048] Load power extraction: Traverse all loads and extract the actual active and reactive power consumed.

[0049] Preferably, step S5, which generates multi-dimensional visualization charts and interactive HTML reports, includes:

[0050] Topology plotting: The layout algorithm of NetworkX is used to calculate the two-dimensional coordinates of the nodes; the matplotlib plotting library is used to draw the nodes as dots and the connections as lines; it supports coloring the nodes according to the voltage value and using color bars to display the voltage distribution.

[0051] Voltage distribution curve plotting: Sort nodes by distance from source node, plot voltage-distance curve, mark upper and lower voltage limits, and highlight nodes whose voltage exceeds the limit;

[0052] Power distribution diagram drawing: Use bar charts to show the distribution of active and reactive power for each load;

[0053] HTML Visualization Report Generation: Automatically generates HTML web pages containing network statistics, topology diagrams, voltage curves, and power distribution maps. It adopts a responsive layout and supports interactive browsing. Statistical information is displayed in card format, including the number of nodes, lines, loads, total power, and total losses. Bus voltage data is presented in tabular format and supports sorting and filtering.

[0054] Another aspect of the present invention provides an automatic topology construction system for a digital twin of a distribution network, comprising:

[0055] Data parsing module: used to connect to multiple data sources and perform automatic data parsing and standardization processing; built-in file pattern matching engine, Excel reading interface, data cleaning and verification logic; supports IEEE PES Test Feeder standard dataset and user-defined format extensions;

[0056] Connection mapping module: used to define the standard for device connection mapping; adopts object-oriented design pattern to define various device classes; among them, the distribution network container class serves as the central container, maintaining the collection of all devices and automatically managing the connection relationships between devices; provides a device adding interface, which automatically creates relevant nodes and establishes associations when adding devices;

[0057] OpenDSS format conversion module: used for OpenDSS format conversion; built-in DSS code generator, supporting DSS command generation for all mainstream power distribution equipment types; provides a template engine to automatically populate DSS scripts based on equipment parameters; supports DSS file export and network summary information export.

[0058] Topology Analysis and Simulation Module: Integrates the OpenDSS simulation engine interface for simulation analysis: By calling the calculation kernel, it performs power flow calculations and short-circuit analysis; automatically extracts bus voltage, line power flow, load power, and system loss results; and provides a result export interface supporting CSV and text summary formats.

[0059] Visualization module: Integrates visualization functions of matplotlib and NetworkX for chart generation and report publishing; supports automatic drawing of topology diagrams, voltage curves, and power distribution diagrams; generates interactive visualization reports in HTML format, embedding charts and data tables; supports Chinese font configuration to ensure correct display of Chinese information.

[0060] Beneficial Effects: This invention improves the connection relationship mapping standard for distribution networks by using a unified connection relationship mapping standard and a flexible data parsing interface, enabling automatic conversion from distribution network data to a standard digital twin model. Automated data parsing and topology mapping avoid human error and ensure a high degree of consistency between the digital twin model and the original data. A fully functional OpenDSS conversion tool was independently developed, achieving full automation from data parsing, model building, simulation conversion to visualization analysis, significantly improving the efficiency and accuracy of constructing digital twins for distribution networks.

[0061] It adopts a modular design with clear responsibilities for each functional module, which facilitates secondary development; the data parser supports flexible format expansion, the connection relationship mapping standard can easily add new device types, the OpenDSS Converter can be expanded to support more DSS objects, and the visualization module can integrate new chart types. Attached Figure Description

[0062] Figure 1 The above is a flowchart of the automatic construction method for digital twin topology of distribution network provided in Embodiment 1 of the present invention.

[0063] Figure 2 This is a functional module block diagram of the automatic topology construction system for digital twin of distribution network provided in Embodiment 2 of the present invention.

[0064] Figure 3 The power distribution network topology diagram generated for an embodiment of the present invention.

[0065] Figure 4 The voltage distribution curve generated for an embodiment of the present invention.

[0066] Figure 5 The power flow distribution diagram generated for an embodiment of the present invention. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, embodiments of this invention, and should not be construed as limiting the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention. In the description of this invention, it should be understood that the terminology used is for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0068] The following is combined Figures 1-5 This invention describes the automatic construction method and system for digital twin topology of power distribution networks.

[0069] Example 1: As Figure 1 As shown, this embodiment provides a method for automatically constructing a digital twin topology for a distribution network, including:

[0070] Step S1: Data parsing and standardization

[0071] Automatically reads and parses line configuration data, load data, transformer data, capacitor data, voltage regulator data, switch data, etc. from the original data source of the distribution network (such as the Excel file of the IEEE PES Test Feeder dataset).

[0072] Specifically, this is implemented using a data parser (IEEE FeederParser):

[0073] (a) Automatic file recognition function: Through pattern matching algorithm, it automatically recognizes data files with different naming conventions (such as "config.xls", "config data.xls", "Line Data.xls", "line data.xls", etc.) to adapt to the format differences of different feeder datasets;

[0074] (b) Table data parsing: Use the pandas library to read the Excel file, automatically skip the header row, identify the start position of the data, and extract the device parameters row by row;

[0075] (c) Data cleaning and validation: Perform null value detection, data type conversion, and outlier filtering on the read data to ensure data quality;

[0076] (d) Unit standardization: Convert physical quantities with different units into standard units (e.g., length is standardized to kilometers or feet, voltage to kV, and power to kW / kVar).

[0077] (e) Phase information extraction: Extract phase information (such as "ABCN") from the line configuration data, automatically remove the neutral line identifier, and generate standard phase strings (such as "ABC", "AB", "C").

[0078] Step S2: Constructing a device connection relationship mapping method based on object-oriented approach

[0079] Establish a unified digital twin data model for the power distribution network, adopt object-oriented modeling approach, and define standardized equipment classes and connection relationship mapping rules.

[0080] Specifically, the following core data structures are defined:

[0081] (a) Node class: Attributes include node name, voltage level (voltage_kV), and phase configuration (phases);

[0082] (b) Line: Attributes include line name, starting node (from_node), ending node (to_node), length (length_ft), configuration number (config_id), and phases; automatically maintains connection relationships and automatically creates relevant nodes when adding a line;

[0083] (c) Line Configuration Class (LineConfig): Attributes include configuration identifier (config_id), phase configuration (phasing), conductor type (conductor), neutral specification (neutral), and spacing identifier (spacing_id);

[0084] (d) Load: Attributes include load name, connected node, load model, phases, active power of each phase (kW_a / b / c), and reactive power of each phase (kvar_a / b / c); supports 6 load models (Y-PQ, D-PQ, YI, DI, YZ, DZ);

[0085] (e) Transformer: Attributes include name, high and low voltage side nodes, capacity (kVA), high and low voltage side voltages (kV_high / low), connection method (connection_high / low), and impedance parameters (r_percent, x_percent);

[0086] (f) Capacitors, regulators, switches, distributed loads, etc.;

[0087] (g) Distribution Network: As the central container of the digital twin, it contains a list of all devices, source node information, reference voltage and frequency and other global parameters; it provides methods for adding devices (add_node, add_line, add_load, etc.) and automatically maintains the topology connection relationship when adding devices.

[0088] Supplement the following connection mapping rules:

[0089] Rule 1: The line equipment establishes a "conductive connection" between the two ends of the node, and the phase configuration is determined by the line configuration;

[0090] Rule 2: Transformers establish a "transformation connection" relationship between high-voltage and low-voltage side nodes, and the connection method supports star (wye) and delta (delta);

[0091] Rule 3: Loads establish "consumption connections" with nodes, and the connection method is determined by the load model;

[0092] Rule 4: The voltage regulator establishes a "regulation connection" relationship between the input and output nodes;

[0093] Rule 5: The switch establishes a "disconnectable connection" between the two nodes, and the state can be closed or open;

[0094] Rule 6: Source node automatic identification rules: (a) Extract from voltage regulator data; (b) Identify nodes with an in-degree of zero from the topology; (c) Infer from common naming patterns (650, 800, 701, etc.).

[0095] Step S3: Automatic generation and verification of topology relationships

[0096] Based on the device connection relationship mapping established in step S2, the electrical topology network of the distribution network is automatically generated, and graph theory algorithms are used to perform connectivity verification and hierarchical relationship calculation.

[0097] Specifically:

[0098] (a) Automatic topology graph construction: Using the NetworkX graph computing library, nodes are mapped to graph vertices, and lines, transformers, and switches are mapped to graph edges, automatically constructing undirected graphs (Graph) or directed graphs (DiGraph); the attributes of the edges include metadata such as device type and name;

[0099] (b) Connectivity check: Use depth-first search (DFS) or breadth-first search (BFS) algorithms to detect connected components of the graph, identify isolated nodes or broken subnetworks, and output warning messages;

[0100] (c) Path analysis from source node to load node: Based on the BFS algorithm, traverse from the source node and calculate the level and distance of each node to provide spatial information for subsequent visualization and analysis;

[0101] (d) Topology consistency check: Verify the uniqueness of node names, check whether the endpoints of edges exist in the node set, detect self-loops and duplicate edges, and ensure the correctness of topology logic;

[0102] (e) Hierarchical layout algorithm: Implement a BFS-based hierarchical layout algorithm, placing the source node at the top level (level 0) and then layering downwards to provide a clear hierarchical structure for topology visualization; for unconnected nodes, they are automatically placed at the maximum level + 1.

[0103] Step S4: Automatic conversion of OpenDSS simulation format

[0104] Develop a format converter (OpenDSSConverter) to automatically convert digital twin models into OpenDSS-compatible DSS script formats, enabling seamless integration with power system simulation tools.

[0105] The format converter includes a translation engine (OpenDSSConverter) and a file management module (OpenDSSExporter). OpenDSSConverter uses a set of syntax rules organized according to the OpenDSS command format, translating item by item in a fixed order: first converting basic information (circuit definitions), then converting specific equipment (wires, transformers, electrical equipment, etc.). For example, it translates "ABC three-phase" into ".1.2.3", "constant power load" into "model=1", and complex equipment (voltage regulator) into combinations that OpenDSS can understand (transformer + controller), etc. OpenDSSExporter saves the translated content as a DSS script file and additionally generates a "read-friendly" summary report (statistical information, equipment list).

[0106] The specific conversion method is as follows:

[0107] (a) DSS circuit definition generation: Based on the source node, reference voltage, and reference frequency, the "NewCircuit" command is automatically generated to define the global parameters of the simulation circuit;

[0108] (b) Line configuration code generation: Convert the LineConfig object into a "New LineCode" command, and automatically configure the positive sequence impedance (r1, x1), zero sequence impedance (r0, x0), and capacitance parameters (c1, c0) according to the number of phases (1 / 2 / 3); use simplified typical parameters or extract actual parameters from the configuration data;

[0109] (c) Line segment code generation: Convert the Line object into a "New Line" command, including start and end nodes, phase string (using OpenDSS format such as ".1.2.3"), line configuration reference, length and other parameters;

[0110] (d) Transformer code generation: Convert the Transformer object into a "New Transformer" command, using a dual-winding configuration (windings=2), and define the bus (bus), connection method (conn), voltage level (kV), capacity (kVA), and impedance parameters (%r, xhl) for the high and low voltage sides respectively;

[0111] (e) Load code generation: Convert the Load object into a "New Load" command and automatically map the load model (PQ→1, Z→2, I→5), connection method (wye / delta), phase configuration, and power parameters (kw, kvar);

[0112] (f) Capacitor code generation: Convert the Capacitor object into a "New Capacitor" command and configure the reactive power capacity and connection method;

[0113] (g) Voltage regulator code generation: The voltage regulator is simulated by a combination of transformer and voltage regulator controller, and the control parameters (vreg, band, ptratio, ctprim) are automatically generated;

[0114] (h) Switch code generation: A short line (Line with impedance close to 0) is used to simulate a switch, and the enabled parameter is set according to the switch state;

[0115] (i) Solver command generation: Automatically add commands such as "Set voltagebases", "Calcvoltagebases", and "Solve" to configure the simulation solver;

[0116] (j) Phase format conversion method: Implement automatic conversion from internal phase representation ("ABC") to OpenDSS phase representation (".1.2.3"), with phase mapping rules of A→1, B→2, C→3;

[0117] (k) Modular code organization: DSS code is generated in segments according to device type, and comments are added to facilitate manual review and debugging.

[0118] Step S5: Topology Analysis and Visualization

[0119] Power flow calculations and topology analysis are performed using the OpenDSS simulation engine, extracting key parameters such as voltage, power, and loss, and generating multi-dimensional visualization charts and interactive HTML reports.

[0120] Specifically:

[0121] (a) OpenDSS simulation execution: Load the DSS script file generated in step S4 using the opendssdirect.py library or dss_python library, call the Solve command to execute power flow calculation, and check the convergence status;

[0122] (b) Bus voltage extraction: Traverse all buses and extract parameters such as per-unit voltage (pu), actual voltage (kV), phase angle, number of nodes, and distance, and store them as structured data;

[0123] (c) Line power flow extraction: Traverse all lines and extract parameters such as line power, current, and losses;

[0124] (d) Load power extraction: Traverse all loads and extract the actual active power (kW) and reactive power (kVar) consumed;

[0125] (e) Topology drawing: Use NetworkX layout algorithms (spring, circular, hierarchical, etc.) to calculate the two-dimensional coordinates of nodes; use the matplotlib plotting library to draw nodes as dots (source nodes in red, load nodes in blue), and draw connections as lines (solid lines for lines, dashed lines for transformers, and dotted lines for switches); support coloring nodes according to voltage values ​​and use color bars to display voltage distribution;

[0126] (f) Voltage distribution curve plotting: Sort the nodes by distance from the source node, plot the voltage-distance curve, mark the upper and lower voltage limits (1.05 / 0.95 pu), and highlight the nodes whose voltage exceeds the limit;

[0127] (g) Power distribution diagram drawing: Use bar charts to show the distribution of active and reactive power for each load;

[0128] (h) HTML Visualization Report Generation: Automatically generates HTML web pages containing network statistics, topology diagrams, voltage curves, and power distribution diagrams. It adopts a responsive layout and supports interactive browsing. Statistical information is displayed in card format, including the number of nodes, lines, loads, total power, and total losses. Bus voltage data is presented in tabular format and supports sorting and filtering.

[0129] Example 2: As Figure 2 As shown, this embodiment provides an automatic digital twin topology construction system for a distribution network, including: a data parsing module, a connection relationship mapping module, an OpenDSS format conversion module, a topology analysis and simulation module, and a visualization module;

[0130] Data parsing module: used to connect to multiple data sources and perform automatic data parsing and standardization processing; built-in file pattern matching engine, Excel reading interface, data cleaning and verification logic; supports IEEE PES Test Feeder standard dataset and user-defined format extensions;

[0131] Connection mapping module: used to define the standard for device connection mapping; adopts object-oriented design pattern to define various device classes; among them, the distribution network container class serves as the central container, maintaining the collection of all devices and automatically managing the connection relationships between devices; provides a device adding interface, which automatically creates relevant nodes and establishes associations when adding devices;

[0132] OpenDSS format conversion module: used for OpenDSS format conversion; built-in DSS code generator, supporting DSS command generation for all mainstream power distribution equipment types; provides a template engine to automatically populate DSS scripts based on equipment parameters; supports DSS file export and network summary information export.

[0133] Topology Analysis and Simulation Module: Integrates the OpenDSS simulation engine interface for simulation analysis: By calling the calculation kernel, it performs power flow calculations and short-circuit analysis; automatically extracts bus voltage, line power flow, load power, and system loss results; and provides a result export interface supporting CSV and text summary formats.

[0134] Visualization module: Integrates visualization functions of matplotlib and NetworkX for chart generation and report publishing; supports automatic drawing of topology diagrams, voltage curves, and power distribution diagrams; generates interactive visualization reports in HTML format, embedding charts and data tables; supports Chinese font configuration to ensure correct display of Chinese information.

[0135] It also includes a main control module and a data storage and management module, among which,

[0136] Main control module: coordinates various functional modules to achieve full-process automation, provides command line interface, supports parameter configuration, supports single feeder processing and batch processing modes, and integrates exception handling and log output;

[0137] Data storage and management module: responsible for the persistence of intermediate and result data, supports serialized storage of digital twin models, manages the output directory structure, and automatically creates analysis and visualization subdirectories.

[0138] Based on the above embodiments, in order to verify the automatic construction method and system for digital twin topology of distribution networks of the present invention, in the face of situations such as Figure 2 To demonstrate the effectiveness of the system shown, a simulation experiment was conducted.

[0139] Taking the IEEE 13-node test feeder as an example, the working process of the method and system of the present invention is described in detail: The data of the IEEE 13-node test feeder is stored in the "feeder13" directory and contains the following Excel files:

[0140] "config.xls": Line configuration data, containing 7 configurations from 601 to 607. Each configuration defines the phase (e.g., "BACN"), conductor type (e.g., "556,500 26 / 7 ACSR"), neutral conductor specification (e.g., "4 / 0 6 / 1 ACSR"), and spacing identifier (e.g., "500").

[0141] "Line Data.xls": Line segment data, containing 17 line segments, each defining node A (e.g., "632"), node B (e.g., "645"), length (e.g., "500 feet"), and configuration (e.g., "603").

[0142] "Spot Load Data.xls": Centralized load data, containing 9 load points, each defining a node (e.g., "634"), load model (e.g., "Y-PQ"), and three-phase power (kW and kVar);

[0143] "Transformer Data.xls": Transformer data, containing one main transformer (Substation) and one distribution transformer (XFM-1);

[0144] "Cap Data.xls": Capacitor data, containing two capacitor banks;

[0145] "Regulator Data.xls": Voltage regulator data, containing one three-phase voltage regulator.

[0146] The "feeder13.dss" file generated by this system was compared with the standard DSS file provided by IEEE. The error of the power flow calculation results (bus voltage, line power, system loss) was less than 0.5%, which verified the accuracy of the method and system of this invention.

[0147] The entire build process (from data reading to report generation) took approximately 1 second (tested on a PC with an Intel Core i7 CPU and 16GB RAM), representing an efficiency improvement of over 100 times compared to the several hours required for manual modeling.

[0148] like Figure 3 As shown, the generated power distribution network topology diagram displays the specific nodes and edges, where nodes are represented by green, lines by solid black lines, transformers by dashed blue lines, and switches by dashed green lines.

[0149] like Figure 4 As shown, the generated voltage distribution curve displays the voltage variation along the feeder and the upper and lower voltage limits. Add horizontal reference lines: y=1.05 (upper limit, red dashed line), y=0.95 (lower limit, red dashed line), y=1.00 (rated value, green dotted line).

[0150] like Figure 5 As shown, the kW and kVar data of the first 20 loads were extracted, and two side-by-side bar charts were drawn. The left side shows the active power (blue), and the right side shows the reactive power (orange), which shows the active and reactive power bar charts of each load.

[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for automatically constructing a digital twin topology for a distribution network, characterized in that, Includes the following steps: S1. Obtain the raw data of the distribution network and preprocess it; S2. Based on the original data of the distribution network, adopt the object-oriented modeling concept to define standardized equipment classes and connection relationship mapping rules; S3. Based on the preprocessed distribution network data and the established equipment connection relationship mapping, the electrical topology network of the distribution network is automatically generated, a digital twin model is constructed, and graph theory is used to perform connectivity verification and hierarchical relationship calculation. S4. Use a format converter to automatically convert the digital twin model into an OpenDSS-compatible DSS script format; S5 performs power flow calculations and topology analysis based on the OpenDSS simulation engine, extracts key parameters, and generates multi-dimensional visualization charts and interactive HTML reports.

2. The automatic construction method for digital twin topology of distribution networks according to claim 1, characterized in that, The raw data of the distribution network in step S1 includes line configuration data, load data, transformer data, capacitor data, voltage regulator data, and switch data.

3. The automatic construction method for digital twin topology of distribution networks according to claim 2, characterized in that, The preprocessing described in step S1 includes data parsing and standardization, specifically: automatic document recognition, tabular data parsing, data cleaning and validation, unit standardization, and phase information extraction; among which, Automatic file recognition: Through pattern matching algorithms, it automatically identifies data files with different naming conventions, adapting to the format differences of different feeder datasets; Table data parsing: Using the pandas library to read Excel files, automatically skipping header rows, identifying the start and end positions of data, and extracting device parameters row by row; Data cleaning and validation: Perform null value detection, data type conversion, and outlier filtering on the read data to ensure data quality; Unit standardization: converting physical quantities with different units into standard units; Phase information extraction: Extract phase information from line configuration data, automatically remove neutral line identifier, and generate standard phase string.

4. The automatic construction method for digital twin topology of distribution networks according to claim 3, characterized in that, The device data structures defined in step S2 include: node class, line class, line configuration class, load class, transformer class, capacitor class, voltage regulator class, switch class, distributed load class, and distribution network container class; The defined connection mapping rules include: establishing conductive connection between the nodes at both ends of the line equipment, with the phase configuration determined by the line configuration; establishing transformation connection between the high and low voltage side nodes of the transformer, with connection methods supporting star and delta; establishing consumption connection between the load and the node, with the connection method determined by the load model; establishing regulation connection between the input and output nodes of the voltage regulator; establishing connection between the nodes at both ends of the switch, with the state being closed or open; automatic source node identification rules: (a) extracted from voltage regulator data; (b) identifying nodes with an in-degree of zero from the topology; (c) inferred based on common naming patterns.

5. The automatic construction method for digital twin topology of distribution networks according to claim 4, characterized in that, Step S3, based on the preprocessed distribution network data and the established equipment connection mapping, automatically generates the electrical topology of the distribution network, constructs a digital twin model, and uses graph theory computation to perform connectivity verification and hierarchical relationship calculation, specifically: S31. Automatic Topology Graph Construction: Using the NetworkX graph computing library, nodes are mapped to graph vertices, and lines, transformers, and switches are mapped to graph edges, automatically constructing the topology graph; the attributes of the edges contain various metadata. S32. Connectivity check: Use depth-first search or breadth-first search algorithm to detect connected components of the graph, identify isolated nodes or broken subnetworks, and output warning messages. S33. Path analysis from source node to load node: Based on the BFS algorithm, traverse from the source node, calculate the level and distance of each node, and provide spatial information for subsequent visualization and analysis; S34. Topology Consistency Check: Verify the uniqueness of node names, check if the endpoints of edges exist in the node set, detect self-loops and duplicate edges, and ensure the correctness of topology logic. S35, Hierarchical Layout Algorithm: Implements a hierarchical layout algorithm based on BFS, placing the source node at the top level and then layering downwards sequentially to provide a clear hierarchical structure for topology visualization; for unconnected nodes, they are automatically placed at the maximum level + 1.

6. The automatic construction method for digital twin topology of distribution networks according to claim 5, characterized in that, The format converter mentioned in step S4 includes: a translation engine and a file management module, wherein, The translation engine has a set of syntax rules organized according to the OpenDSS command format. It translates basic information and specific devices item by item in a fixed order in this table. The specific steps are as follows: S401, DSS Circuit Definition Generation: Based on the source node, reference voltage, and reference frequency, automatically generate the "New Circuit" command to define the global parameters of the simulation circuit; S402, Line Configuration Code Generation: Converts the LineConfig object into a "New LineCode" command, automatically configuring positive sequence impedance, zero sequence impedance, and capacitance parameters based on the number of phases; using simplified typical parameters or extracting actual parameters from the configuration data; S403, Line segment code generation: Converts the Line object into a "New Line" command, including start and end nodes, phase string, line configuration reference, and length; S404, Transformer Code Generation: Convert the Transformer object into a "New Transformer" command, using a dual-winding configuration, and define the busbars, connection methods, voltage levels, capacity, and impedance parameters for the high and low voltage sides respectively; S405 Load Code Generation: Converts Load objects into "New Load" commands, automatically mapping load models, connection methods, phase configurations, and power parameters; S406, Capacitor Code Generation: Convert the Capacitor object into a "New Capacitor" command to configure reactive power capacity and connection method; S407, Voltage Regulator Code Generation: The voltage regulator is simulated by a combination of a transformer and a voltage regulator controller, and control parameters are automatically generated. S408, Switch Code Generation: A short-circuit simulation switch is used, and the enabled parameter is set according to the switch status; S409, Solver Command Generation: Automatically adds commands and configures the simulation solver; S410, Phase Format Conversion Method: Enables automatic conversion from internal phase representation to OpenDSS phase representation; S411, Modular code organization: Generate DSS code in segments according to device type and add comments; The file management module is used to save the translated content as a DSS script file.

7. The automatic construction method for digital twin topology of distribution networks according to claim 6, characterized in that, The OpenDSS simulation execution in step S5 specifically involves: loading the DSS script file generated in step S4 using the opendssdirect.py library or the dss_python library, calling the Solve command to perform power flow calculations, and checking the convergence status.

8. The method for automatically constructing a digital twin topology of a distribution network according to claim 7, characterized in that, The extraction of key parameters in step S5 includes bus voltage extraction, line power flow extraction, and load power extraction, specifically: Bus voltage extraction: Traverse all buses, extract the per-unit value of node voltage, actual voltage, phase angle, number of nodes and distance, and store it as structured data; Line power flow extraction: Traverse all lines and extract line power, current and loss; Load power extraction: Traverse all loads and extract the actual active and reactive power consumed.

9. The method for automatically constructing a digital twin topology of a distribution network according to claim 8, characterized in that, Step S5, which generates multi-dimensional visualizations and interactive HTML reports, includes: Topology plotting: The layout algorithm of NetworkX is used to calculate the two-dimensional coordinates of the nodes; the matplotlib plotting library is used to draw the nodes as dots and the connections as lines; it supports coloring the nodes according to the voltage value and using color bars to display the voltage distribution. Voltage distribution curve plotting: Sort nodes by distance from source node, plot voltage-distance curve, mark upper and lower voltage limits, and highlight nodes whose voltage exceeds the limit; Power distribution diagram drawing: Use bar charts to show the distribution of active and reactive power for each load; HTML Visualization Report Generation: Automatically generates HTML web pages containing network statistics, topology diagrams, voltage curves, and power distribution maps. It adopts a responsive layout and supports interactive browsing. Statistical information is displayed in card format, including the number of nodes, lines, loads, total power, and total losses. Bus voltage data is presented in tabular format and supports sorting and filtering.

10. An automatic topology construction system for a digital twin of a power distribution network, characterized in that, include: Data parsing module: Used to connect to multiple data sources and perform automatic data parsing and standardization processing. Built-in file pattern matching engine, Excel reading interface, data cleaning and validation logic; Supports the IEEE PES Test Feeder standard dataset and user-defined format extensions; Connection mapping module: used to define the standard for device connection mapping; adopts object-oriented design pattern to define various device classes; among them, the distribution network container class serves as the central container, maintaining the collection of all devices and automatically managing the connection relationships between devices; provides a device adding interface, which automatically creates relevant nodes and establishes associations when adding devices; OpenDSS format conversion module: used for OpenDSS format conversion; It features a built-in DSS code generator that supports DSS command generation for all mainstream power distribution equipment types; it provides a template engine that automatically populates DSS scripts based on equipment parameters; and it supports DSS file export and network summary information export. Topology Analysis and Simulation Module: Integrates the OpenDSS simulation engine interface for simulation analysis: By calling the calculation kernel, it performs power flow calculations and short-circuit analysis; automatically extracts bus voltage, line power flow, load power, and system loss results; Provides a results export interface, supporting CSV and text summary formats; Visualization module: Integrates visualization capabilities from matplotlib and NetworkX for chart generation and report publishing; Supports automatic drawing of topology diagrams, voltage curves, and power distribution diagrams; Generates interactive visual reports in HTML format, embedding charts and data tables; supports Chinese font configuration to ensure correct display of Chinese information.