A method for enabling regional power grid safety and resilience evaluation by a large language model

CN122968913APending Publication Date: 2026-10-23STATE GRID ELECTRIC POWER ECONOMIC RES INST IN NORTHERN HEBEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610916986.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

基于数值仿真的方法虽然物理意义明确,但在面对复杂的连锁故障和未知扰动场景时,难以通过逻辑推理快速定位故障根源,且计算效率限制了其应用范围

Benefits of technology

1.本发明通过构建包含物理规则约束的提示词模板以及思维链修正机制,实现了评估过程的可解释性,并确保了评估结果严格符合电网物理定律。系统利用大语言模型的语义理解能力生成包含故障传播路径分析和恢复策略规划的推理序列,在推理的关键节点引入外部物理计算引擎进行潮流计算与校验。这种设计使得大语言模型不再单纯依赖统计相关性进行输出,而是将物理计算结果作为修正逻辑的依据,对初始推理中可能存在的违背物理规律的判断进行实时纠偏。这种机制克服了纯数据驱动模型缺乏物理一致性的弊端,保证了输出的韧性量化指标和薄弱环节定位结果在物理层面的准确性,为电网调度人员提供了既具备逻辑透明度又符合物理现实的评估依据。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122968913A_ABST
    Figure CN122968913A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data processing, in particular to a kind of big language model empowerment regional power grid safety and flexibility evaluation method.The method collects power grid multi-source heterogeneous data to construct time series database;Based on the physical law, prompt word template is constructed to convert data;Big language model is used to generate inference thought chain containing fault propagation analysis;Inference node calls physical computing engine to carry out power flow calculation verification;The result is fed back to correct the logic of big language model, and the flexibility index is output.The present application solves the problem that the evaluation result lacks explainability and physical consistency in the prior art by physical rule constraint and thought chain correction.The present application uses physical engine to verify the inference process in real time, realizes the unity of evaluation explainability and physical consistency, improves the evaluation accuracy of power grid under complex disturbance, and provides the basis conforming to physical law for safety dispatch.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, specifically to a method for assessing the security resilience of regional power grids using a large language model. Background Technology

[0002] Existing regional power grid resilience assessments primarily rely on physical mechanism-based numerical simulation methods. This approach accurately simulates the physical characteristics of the power grid by establishing mathematical models containing differential and algebraic equations. The assessment process typically employs Monte Carlo simulations to randomly sample pre-defined fault scenarios and iteratively calculates the system state under each scenario, including power flow calculations and transient stability analysis. This method is built upon rigorous physical laws and can accurately reflect the dynamic response process of the power grid under specific fault conditions. However, this technique is highly dependent on accurate power grid physical parameters and complete topology information, and requires massive numerical computations when dealing with large-scale, complex power grids, resulting in long computation times and making it difficult to meet the needs of online real-time assessment.

[0003] With the massive accumulation of power grid measurement data, data-driven machine learning methods are increasingly being applied to resilience assessment. Existing technologies utilize algorithms such as deep learning or graph neural networks to directly learn the mapping relationship between input features and system resilience indicators from massive amounts of historical operational data and fault records. These methods do not require explicit solution of complex physical equations; instead, they directly output assessment results through a pre-trained black-box model, thus improving processing speed to some extent. This approach focuses on uncovering statistical patterns within the data, attempting to use features from historical data to predict the future performance of the system, thereby avoiding the problems of high computational cost and complex modeling in traditional numerical calculations.

[0004] Existing technical solutions have shortcomings in terms of the logical interpretability and physical consistency of evaluation results. While numerical simulation-based methods have clear physical meaning, they struggle to quickly locate the root cause of faults through logical reasoning when facing complex cascading failures and unknown disturbances, and their computational efficiency limits their application. Data-driven methods, although computationally fast, are essentially black-box models; their internal decision-making logic is opaque and cannot provide operators with the reasoning process of fault evolution paths. More importantly, purely data-driven models lack rigid constraints on the physical laws of the power grid. When faced with extreme scenarios not covered in the training data, they are prone to outputting evaluation results that violate the fundamental physical laws of the power system, leading to unreliable evaluation results that cannot support safe dispatch decisions for the power grid. Summary of the Invention

[0005] The purpose of this invention is to provide a method for assessing the security resilience of regional power grids using a large language model, which can solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for assessing the security resilience of regional power grids using a large language model includes: collecting multi-source heterogeneous operation data of the regional power grid and constructing a time-series database; Based on the physical topology constraints and physical law rules of the power grid, a prompt word template is constructed to transform the operation data into structured semantic input; A reasoning chain containing fault propagation path analysis and resilience assessment strategies is generated using a large language model; At key nodes of the reasoning chain, an external physical calculation engine is invoked to perform power flow calculation and physical verification. The physical calculation results are fed back to the large language model to correct the reasoning logic and generate the final resilience quantification index.

[0007] Preferably, the process of collecting multi-source heterogeneous operation data of the regional power grid and constructing a time-series database specifically includes: deploying distributed data acquisition probes to synchronously acquire historical operation data, equipment ledger data, real-time monitoring data, and external environmental data; The acquired data is cleaned, timestamp aligned, and normalized. The processed data is mapped to a unified time-series database architecture to build a node-edge associated topological index. The historical operation data includes fault recording data, and the equipment ledger data includes equipment physical parameters and connection relationships.

[0008] Preferably, the step of constructing the prompt word template based on the physical topology constraints and physical law rules of the power grid specifically includes: extracting the node connection relationships and branch parameters in the power grid topology; Transform Kirchhoff's laws, thermal stability constraints, and voltage stability limits into logical constraint expressions; The logical constraint expression is combined with the current power grid operating status data to construct a prompt word template containing physical rule verification instructions. The prompt word template is used to guide the large language model to strictly follow the physical laws of the power grid during the reasoning process.

[0009] Preferably, the step of generating a reasoning chain that includes fault propagation path analysis and resilience assessment strategies using a large language model specifically includes: the large language model generating a sequence of reasoning steps that includes fault initiation point determination, fault propagation path deduction, affected area identification, and load loss prediction based on the structured semantic input. In the inference step sequence, key verification nodes that need to be numerically verified are marked, and the key verification nodes include at least power flow calculation nodes and short-circuit current verification nodes.

[0010] Preferably, the step of feeding back the physical calculation results to the large language model to correct the reasoning logic and generate the final resilience quantification index specifically includes: parsing the power flow convergence status, node voltage over-limit information and line overload information returned by the external physical calculation engine; The parsed numerical verification information is converted into correction feedback text in natural language form; The corrected feedback text is input into the context window of the large language model, triggering the large language model to re-execute subsequent inference steps or adjust the evaluation strategy until a resilience index that conforms to physical laws is output.

[0011] Preferably, the step of converting Kirchhoff's laws, thermal stability constraints, and voltage stability limits into logical constraint expressions further includes: discretizing continuous physical law parameters into logical rules in a semantic space based on the power grid operation characteristics at different voltage levels. A prompt word structure containing a dynamic mask is constructed. The dynamic mask is used to automatically replace the running parameter part in the prompt word when the real-time data is updated, ensuring that the large language model always performs logical deduction based on the latest power grid section data during inference.

[0012] Preferably, marking the key verification nodes that need to be numerically verified in the reasoning step sequence further includes: triggering an external physical calculation engine through a function call mechanism during the thought chain reasoning process; The function call mechanism parses the natural language parameters generated by the large language model into the input file format required by the physical computing engine; The input file format is passed to the physical computing engine for calculation, and an asynchronous listening thread is established to obtain the calculation results, ensuring that the large language model maintains its context state while waiting for the calculation results.

[0013] Preferably, the step of outputting a resilience index that conforms to physical laws specifically includes: calculating the performance degradation curve and recovery trajectory of the system after being subjected to a preset disturbance; Based on the performance degradation curve and recovery trajectory, calculate the comprehensive evaluation value of the system's absorption, adaptation, and recovery capabilities; The comprehensive evaluation value is combined with the weak link location information to generate a structured evaluation report. The evaluation report includes a list of physical equipment that leads to reduced toughness and details of the corresponding physical parameters exceeding the limit.

[0014] Preferably, before generating the reasoning chain containing fault propagation path analysis and resilience assessment strategies using the large language model, the method further includes: constructing a vector knowledge base containing historical power grid fault cases, typical equipment failure modes, and defense control strategies. Vector retrieval technology is used to perform similarity matching on the structured semantic input to retrieve the historical reference case most similar to the current running state; The historical reference cases are injected into the prompt word template as background knowledge to enhance the reasoning accuracy of the large language model in rare fault scenarios.

[0015] Preferably, after outputting the corrected resilience quantification index and weak link location results, the method also includes: obtaining the geographical wiring diagram data of the regional power grid; The weak link location results are mapped to the corresponding layer of the geographic connection map data to generate a resilience thermal distribution map with spatial location information; The interactive front-end interface displays the toughness thermal distribution map and, in response to user clicks, shows the detailed physical parameter correction process and verification deviation value of the corresponding node, assisting technicians in verifying the credibility of the evaluation results.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention achieves interpretability of the evaluation process and ensures that the evaluation results strictly conform to the physical laws of the power grid by constructing prompt word templates containing physical rule constraints and a thought chain correction mechanism. The system utilizes the semantic understanding capability of a large language model to generate inference sequences that include fault propagation path analysis and recovery strategy planning. At key nodes of the inference, an external physical calculation engine is introduced to perform power flow calculation and verification. This design allows the large language model to no longer rely solely on statistical correlation for output, but instead uses physical calculation results as the basis for correcting logic, correcting judgments that may violate physical laws in the initial inference in real time. This mechanism overcomes the drawback of the lack of physical consistency in purely data-driven models, ensuring the accuracy of the output resilience quantification indicators and weak link location results at the physical level, and providing power grid dispatchers with an evaluation basis that is both logically transparent and conforms to physical reality.

[0017] 2. This invention improves the inference accuracy and verifiability of the assessment system in rare failure scenarios by introducing vector knowledge base retrieval and geographic visualization mapping technology. The system constructs a vector knowledge base containing historical failure cases and equipment failure modes. Through similarity matching, relevant reference cases are injected into the inference process, assisting the model in making logical judgments in complex scenarios with scarce data, thus overcoming the lack of experience caused by relying solely on real-time data. Simultaneously, the solution maps the quantitative assessment results onto a geographic wiring diagram to generate a heat map, and supports displaying the correction process and deviation values ​​of node physical parameters. This approach transforms abstract resilience indicators into intuitive spatial location information, enabling technicians to quickly locate physical weaknesses and intuitively verify the logical correctness of the assessment process, enhancing the practical value of the assessment results in real-world engineering applications. Attached Figure Description

[0018] Figure 1 The overall flowchart of the method for assessing the security resilience of regional power grids using the large language model of this invention; Figure 2 This is a flowchart illustrating the process of acquiring multi-source heterogeneous data from regional power grids and constructing a time-series database according to the present invention. Figure 3 Flowchart of the process for constructing the power grid physical constraint prompt word template with dynamic mask according to the present invention; Figure 4 This is a flowchart illustrating the asynchronous interaction and verification process between the large language model and the external physical computing engine in this invention. Figure 5 This is a flowchart illustrating the process of quantitative assessment of regional power grid resilience and location of weak links in this invention. Figure 6 The flowchart illustrates the process of enabling the visualization output of reasoning and evaluation results for the vector knowledge base of this invention. Detailed Implementation

[0019] refer to Figure 1 In one embodiment, the present invention discloses a method for assessing the safety resilience of regional power grids using a large language model. This method fully realizes the entire process of regional power grid multi-source data acquisition and storage, physical rule constraint prompt word construction, large language model thinking chain reasoning, physical engine real-time verification, reasoning logic correction, and resilience index quantitative output. It can be adapted to the routine safety resilience assessment work of regional power grids at various voltage levels. First, distributed collection and standardized processing of full-dimensional regional power grid operation data are completed, and a time-series database with topology association indexes is built to achieve unified storage and rapid retrieval of dynamic and static power grid operation data. Second, based on the inherent topological constraints of the power grid and the physical laws of the power system, standardized and dynamically updatable prompt word templates are constructed to transform unstructured raw power grid operation data into structured semantic input adapted to the reasoning of the large language model. Subsequently, the large language model autonomously generates a complete reasoning chain based on the structured semantic input, including fault evolution, regional impact, load loss, and assessment strategies, and accurately marks the key nodes that need numerical verification during the reasoning process. Through an external physical calculation engine, power flow calculation and physical compliance verification are carried out on the key nodes, and the quantitative calculation results are transformed into semantic correction information and fed back to the large language model to iteratively correct the model's reasoning logic, ultimately outputting standardized resilience quantitative indicators that fully conform to the physical laws of the power grid.

[0020] refer to Figure 2Specifically, in the regional power grid data acquisition and time-series database construction phase, this embodiment employs a distributed architecture to deploy multiple sets of data acquisition probes, overcoming the shortcomings of traditional centralized data acquisition, such as single-point delays and data omissions, and achieving synchronous parallel acquisition of multiple types of power grid data. The acquired data sources include four core heterogeneous data categories: historical operation data of the regional power grid, equipment ledger data, real-time monitoring data, and external environment data. Among them, historical operation data includes power grid fault waveform data, steady-state operation curve data, and disturbance event record data over the years, completely preserving the past fault evolution characteristics and operating patterns of the power grid; equipment ledger data includes the inherent physical parameters, equipment models, commissioning times, insulation parameters, and fixed connection relationships between various types of power equipment in the entire network, providing a static basis for power grid topology modeling and physical rule verification; real-time monitoring data includes second-level sampling data of voltage at each node, branch current, line power, equipment temperature rise, and switch status, reconstructing the instantaneous operating section of the power grid in real time; external environment data includes regional meteorological data, geological condition data, and external force construction monitoring data, used to support the resilience scenario assessment of external disturbance-induced faults.

[0021] After completing the raw data acquisition, this embodiment performs standardized preprocessing operations on the heterogeneous raw data, specifically including three core processing steps: data cleaning, timestamp alignment, and data normalization. The data cleaning stage primarily removes abnormal jump data, null data, duplicate and redundant data, and invalid sampling data caused by equipment failures. It supplements short-term missing valid operational data through neighborhood data interpolation, ensuring the integrity and validity of the data source. The timestamp alignment stage uses a unified power system standard clock as a benchmark, mapping multi-source data with different acquisition frequencies and transmission delays to the same time dimension, eliminating timing misalignment issues in heterogeneous data and ensuring the timing accuracy of subsequent timing analysis and fault inference. The data normalization stage performs interval normalization processing for power operation parameters of different dimensions and orders of magnitude, avoiding subsequent semantic conversion deviations and inference errors caused by differences in parameter magnitudes.

[0022] Furthermore, this embodiment maps the preprocessed standardized data to a unified time-series database architecture. Unlike traditional single-time-series storage structures, this architecture specifically builds a node-edge associated topology index structure. Using buses and substations in the power grid topology as topology nodes and transmission lines, transformers, and switch branches as topology edges, a bidirectional association mapping relationship between nodes and edges is established. The voltage and load data of each node, and the power and current data of each branch, are bound and stored with the topology structure, achieving a deep association between power grid operation data and the physical topology. This storage method can support the rapid retrieval of real-time and historical data of the corresponding topology units during subsequent topology constraint verification and fault propagation path deduction, providing efficient data support for the entire process of reasoning and evaluation.

[0023] In the step of constructing prompt word templates based on power grid physical rules, this embodiment first parses the power grid topology index data stored in the time-series database to accurately extract core topology and equipment parameters such as the connection topology of all network nodes, impedance parameters of each branch, rated capacity parameters, and voltage level parameters. Based on this, the core physical laws and operational constraints of the power system are transformed into computer-recognizable logical constraint expressions, specifically including four types of core constraint rules: Kirchhoff's Current Law, Kirchhoff's Voltage Law, line thermal stability constraints, and node voltage stability limit constraints. This locks in the compliance boundaries of power grid operation from the physical level.

[0024] This embodiment achieves standardized transformation of power grid physical constraints through quantification formulas, providing a precise quantitative basis for rule embedding of prompt word templates. First, based on Kirchhoff's current law, a nodal current balance constraint formula is constructed:

[0025] in, This represents the total current difference at the i-th topology node, in A. The current flowing from the i-th node to the adjacent j-th node is expressed in amperes (A). Let be the current input from the external power source to the i-th node, in amperes (A); n be the total number of output branches of the i-th node; and m be the total number of input power branches of the i-th node. This formula is used to ensure that the total current inflow and outflow of any topological node remains balanced during normal operation and fault transients of the power grid, and is a core fundamental constraint for power flow simulation.

[0026] Construct a loop voltage balance constraint formula based on Kirchhoff's voltage law: in, The voltage difference of the l-th topology loop is expressed in volts (V). The rated voltage of each power supply branch in the l-th circuit is given in volts (V). The operating current of each load branch in the l-th loop is expressed in amperes (A). Let be the equivalent resistance of each branch in the l-th loop, in Ω; p be the number of power supply branches in the loop; and q be the number of load branches in the loop. This formula is used to ensure that the algebraic sum of voltages in any closed loop of the power grid is zero, thus guaranteeing the physical compliance of loop power flow calculations.

[0027] A quantitative formula for line thermal stability constraints is constructed to limit the upper limit of power for long-term operation of branches: in, The apparent power of the transmission branch in real time, in MVA; This refers to the rated thermal stability apparent power of the transmission branch, expressed in MVA. When the real-time power of the branch exceeds the rated limit, the line is deemed to have an overload and overheating risk, constituting an illegal operating condition.

[0028] Construct node voltage stability constraint formulas to standardize the operating range of nodes at each voltage level: in, This refers to the real-time operating voltage of a power grid node, in kV. This represents the minimum allowable operating voltage for the corresponding voltage level node, in kV. This represents the maximum permissible operating voltage for the corresponding voltage level node, expressed in kV. This formula is used to determine whether the node voltage exceeds its limit and is a core indicator for assessing grid voltage stability.

[0029] After completing the quantization and conversion of physical constraint formulas, this embodiment structurally combines standardized logical constraint expressions with real-time operating section data and topology data of the current power grid to generate a standardized prompt template containing physical rule verification instructions, topology information, and real-time operating parameters. This prompt template differs from general large-scale model prompts; it incorporates power system-specific physical constraint logic, which can force the large language model to strictly adhere to the physical operating laws of the power grid during the entire reasoning process of subsequent fault deduction and resilience assessment, eliminating subjective reasoning results that deviate from physical mechanisms.

[0030] In the generation of the reasoning thought chain for the large language model, the structured semantic input, encapsulated by prompt word templates in this embodiment, fully includes three core types of information: real-time power grid operating status, topological connectivity, and physical constraint boundaries. Relying on its deep semantic understanding and logical reasoning capabilities, the large language model parses the structured semantic input layer by layer, autonomously generating a continuous sequence of reasoning steps. This sequence of reasoning steps constitutes a complete fault and resilience assessment thought chain. The specific reasoning logic includes four progressive levels: accurate determination of the fault initiation point, layer-by-layer deduction of the fault time-series propagation path, comprehensive identification of the fault-affected area, and quantitative prediction of system load loss.

[0031] In the fault initiation point determination stage, the large language model combines parameter jump characteristics from real-time monitoring data, abnormal equipment status information, and historical fault waveform characteristics to locate the topological node or branch where the disturbance initially occurred, thus determining the fault trigger source. In the fault propagation path deduction stage, the model, based on the node-edge relationships in the power grid topology and combined with parameters such as branch impedance and power transmission direction, deduces the temporal propagation path of fault current and voltage disturbances in the power grid topology, clarifying the complete process of the fault spreading from its initial location to the surrounding area. In the affected area identification stage, the model delineates topological areas of voltage exceedances, line overloads, and equipment outages based on the fault propagation range, distinguishing between core fault areas, indirectly affected areas, and unaffected areas. In the load loss prediction stage, the model, combining the fault impact range, the load level of each node, and power supply reliability requirements, predicts the total power grid load loss and significant load losses during the fault's duration and recovery phases.

[0032] Furthermore, during the generation of the inference step sequence, the large language model simultaneously marks key verification nodes. In this embodiment, the marked key verification nodes are the core steps involved in numerical calculation and physical compliance determination during the inference process, including at least two types of core nodes: network power flow calculation nodes and short-circuit current verification nodes. Additionally, voltage stability verification nodes and power balance verification nodes can be added based on the complexity of the fault scenario. The marked key nodes provide a precise interface for subsequent external physical engine intervention in verification, enabling precise linkage between logical inference and physical numerical calculation.

[0033] In the physics engine verification and thought chain correction phase, this embodiment calls an external professional power physics calculation engine to perform precise numerical calculations for all marked key verification nodes. Based on standard power system calculation algorithms, the physics calculation engine completes iterative calculations of AC / DC power flow across the entire network, fault short-circuit current calculations, node voltage deviation calculations, and line overload calculations. Finally, it returns quantitative calculation results including power flow convergence status, node voltage over-limit details, branch overload information, and short-circuit current amplitude.

[0034] This embodiment does not directly use physical calculation results to overwrite the model's inference results. Instead, it performs semantic parsing and transformation on the quantized calculation results, converting machine-readable numerical results and status codes into natural language correction feedback text. The text content accurately corresponds to the deviation points of each inference step of the large language model, clearly marking specific problems existing in the initial inference of the model, such as voltage judgment deviation, power balance error, and misjudgment of fault propagation range. The generated correction feedback text is input into the context window of the large language model, completely preserving the original inference context state of the model, triggering the large language model to re-iterate and execute subsequent inference steps based on the real physical calculation results, and simultaneously adjusting the resilience assessment strategy and fault evolution judgment logic.

[0035] The iterative correction process continues until the fault deduction results and system state determination results output by the large language model completely match the quantification results of the physical calculation engine, and all reasoning conclusions satisfy the physical constraints of the power system. Finally, based on the corrected complete reasoning chain, the comprehensive safety resilience index of the regional power grid is quantified and output, completing a single complete resilience assessment process. This embodiment solves the industry pain points of lacking physical constraints in pure large model reasoning and lacking logical interpretability in pure numerical simulation through a closed-loop mechanism of model logical reasoning + physical numerical verification + iterative correction.

[0036] This embodiment, as a core basic embodiment, fully covers the core evaluation process of the present invention. Through standardized storage of multi-source heterogeneous data, accurate construction of physical constraint prompts, interpretable reasoning of large model thinking chains, and real-time verification and correction of the physics engine, it achieves logical traceability, physical compliance of results, and iterative optimization of process for regional power grid resilience assessment. It solves the defects of low computational efficiency of numerical simulation and unreliable data-driven model reasoning in the prior art, and adapts to the resilience assessment needs of various conventional power grid operation scenarios.

[0037] refer to Figure 3 In another embodiment, based on the overall architecture of the aforementioned basic embodiment, the discretization processing of physical constraint expressions and the dynamic mask prompt word construction technology are further refined to achieve real-time adaptive updating of prompt word templates according to the power grid operating status, thereby improving the inference accuracy in dynamic operating scenarios. The insulation capacity, thermal stability limits, and allowable voltage fluctuation ranges of equipment at different voltage levels of the power grid vary significantly. Fixed-parameter physical constraint rules cannot adapt to the dynamic operating scenarios of power grids at all voltage levels. If uniform constraint parameters are used, it will lead to overly strict constraints on low-voltage power grids and insufficient constraints on high-voltage power grids, thus causing inference bias.

[0038] This embodiment addresses this problem by performing semantic space discretization on the continuous physical law parameters. Discrete rule intervals are divided according to the grid voltage level, specifically into three core voltage level intervals: 10kV and below distribution network, 35kV~110kV high-voltage distribution network, and 220kV and above transmission network. For each voltage level interval, corresponding Kirchhoff's law adaptation parameters, thermal stability threshold parameters, and voltage fluctuation limit parameters are separately discretized to form a hierarchical discrete physical rule base. The discretization process employs an interval quantization mapping method, decomposing the continuous variation interval of physical parameters into a finite number of semantically identifiable rule nodes. Each rule node corresponds to a set of standardized logical constraint statements, achieving accurate conversion from continuous physical quantities to discrete semantic rules.

[0039] This embodiment uses a discretization-quantization formula to achieve hierarchical parameter mapping: in, This is a discrete rule-level encoding, without units; The rated voltage of the current power grid topology unit is expressed in kV. The preset voltage level classification standard step size, in kV; This is the floor function operator. This formula can automatically map power grid units of different voltage levels to their corresponding rule levels, matching them with specific discrete physical constraint rules.

[0040] After completing the discretization and hierarchical classification of physical parameters, this embodiment constructs a prompt word structure with dynamic mask update capability. This prompt word structure adopts a layered modular design, consisting of a fixed rule layer and a dynamic parameter layer. The fixed rule layer permanently stores the discretized logical constraint expressions of physical laws at each level and inference specification instructions, remaining unchanged with power grid operation data. The dynamic parameter layer is used to load the current operating section data and temporary topology state data of the power grid in real time, providing real-time basis for model inference. The core function of the dynamic mask mechanism is automatic parameter replacement and update. When the real-time monitoring data of the power grid in the time-series database is refreshed and iterated, the system automatically identifies the topology node and parameter type corresponding to the data update, accurately replacing the corresponding content of the prompt word dynamic parameter layer through mask overlay, without needing to rebuild the complete prompt word template.

[0041] The execution logic of dynamic mask update is as follows: The system monitors data update events in the time-series database in real time, captures the timestamp, parameter type, topology location, and parameter value of the data update, and generates parameter update instructions; based on the update instructions, it locates the corresponding fields of the dynamic parameter layer of the prompt word template, completes the mask overwriting of the old parameters and the writing of the new parameters, and retains all physical constraint logic of the fixed rule layer throughout the process, updating only the real-time running variables. This mechanism ensures that every inference process of the large language model is based on the latest real-time cross-sectional data of the power grid, completely avoiding the inference failure problem caused by the lag of static prompt word parameters, and adapting to complex operating scenarios such as dynamic disturbances of the power grid, load fluctuations, and equipment state switching.

[0042] Table 1 below is a comparison table of discretized physical constraint rules for power grids of different voltage levels in this embodiment, which clarifies the discrete threshold of the core constraint parameters of each power grid level, and provides a standardized basis for the construction of dynamic prompt words.

[0043] As shown in Table 1, the higher the voltage level of the power grid, the higher the accuracy requirements of physical operation constraints and the smaller the allowable fluctuation range of parameters. This embodiment achieves precise adaptation of the prompt word rules to the power grid operation scenario by combining discretized hierarchical rules with dynamic mask prompt words, ensuring that the reasoning logic of the large language model at any time and under any operating state conforms to the physical operation characteristics of the corresponding power grid level.

[0044] This embodiment achieves the adaptation of general physical laws to differentiated power grid operation scenarios through physical parameter discretization. At the same time, it realizes the real-time updating of the inference data source through dynamic mask prompt word structure, which solves the problem that fixed prompt word templates cannot adapt to the dynamic operation changes of the power grid, and further improves the accuracy and timeliness of resilient inference in complex dynamic scenarios.

[0045] refer to Figure 5 In a preferred embodiment, based on the thought chain reasoning and physical verification architecture of the aforementioned embodiments, the function call mechanism and asynchronous data interaction logic of key verification nodes are refined to achieve efficient and stable linkage between the large language model and the external physical computing engine, and solve the technical problems of context loss, data format mismatch and synchronous blocking when the model is waiting for calculation results.

[0046] In this embodiment, after the large language model completes the marking of key verification nodes during the thought chain reasoning process, it immediately triggers a preset function call mechanism without manual intervention or external command triggering. The function call mechanism has a built-in bidirectional parsing module for natural language and physical computation formats. First, it performs structured parsing on the natural language parameter information output by the marked nodes of the large language model, accurately extracting four types of core information to be verified: topological range, computation type, parameter boundaries, and iteration precision. Redundant semantics, modifiers, and invalid descriptions in the natural language text are removed, retaining only the core quantization parameters and computation instructions required for physical computation.

[0047] Furthermore, the function call mechanism automatically converts the parsed and refined core parameters into a standardized input file format recognizable by the external physics calculation engine. Specifically, it adapts to the general data interaction format of the power simulation engine, including four types of standardized files: topology parameter files, load parameter files, fault condition files, and constraint condition files. During the format conversion process, parameter type verification, dimensional unification, parameter completion, and abnormal parameter removal are performed to ensure that the input files fully match the calling specifications of the physics calculation engine, preventing calculation interruptions or deviations caused by format errors.

[0048] This embodiment innovatively constructs an asynchronous listening thread to achieve non-blocking acquisition of computation results. Unlike traditional synchronous call modes, after the large language model triggers a function call and passes the input file, it does not need to enter a blocking waiting state. Instead, it continuously retains the current inference context window state, with an independent asynchronous listening thread fully responsible for data interaction and result reception with the physical computing engine. The asynchronous listening thread monitors the computation progress of the physical computing engine in real time. After the engine completes all computational processes, including power flow iteration, short-circuit calculation, and stability verification, it immediately captures the output quantization calculation results, while simultaneously verifying the integrity and validity of the result file and eliminating abnormal computational data.

[0049] By employing an asynchronous thread listening mechanism, the problems of model context loss, inference process interruption, and idle computing resources in synchronous call mode are resolved. The large language model can maintain a complete inference state during the physics engine calculation process. Once the listening thread obtains a valid calculation result, it immediately sends the result data back to the model context, seamlessly connecting subsequent inference correction steps and achieving efficient collaboration between logical inference and physical calculation.

[0050] Table 2 below shows the mapping relationship between the large language model and the physical computing engine function call parameters in this embodiment, clearly demonstrating the corresponding conversion rules between natural language parameters and physical computing input parameters.

[0051] This embodiment achieves seamless integration between the semantic reasoning module and the physical computing module through standardized function call parameter conversion rules and asynchronous listening thread mechanism, ensuring the accuracy, stability and efficiency of cross-module data interaction, and providing technical support for the precise iterative correction of the thought chain.

[0052] This embodiment solves the cross-system adaptation problem between large models and physics engines by standardizing parameter parsing and transformation and using an asynchronous non-blocking interaction architecture. It stably preserves the model inference context, ensures the continuity and accuracy of the entire evaluation process, and improves the system's operational stability in complex verification scenarios.

[0053] In another preferred embodiment, based on the aforementioned iterative correction architecture, the calculation logic of resilience quantification indicators and the evaluation report generation mechanism are refined to achieve quantitative assessment of power grid resilience and precise location of weak links. This embodiment abandons the traditional single-indicator evaluation mode and constructs a multi-dimensional resilience quantification evaluation system from three dimensions: performance degradation after system disturbance, recovery process, and comprehensive adaptability.

[0054] This embodiment first collects full-time-series operational data of the power grid under a preset disturbance scenario, and plots system performance degradation curves and fault recovery trajectory curves. Using power grid supply capacity, load guarantee rate, voltage stability, and power flow balance as core performance dimensions, it records full-time-series performance parameters before the disturbance, at the moment of the disturbance, during the fault duration, in the initial recovery phase, and during the steady-state recovery phase, forming complete time-series performance change curves. The performance degradation curve reflects the rate and maximum degree of performance degradation after the power grid is subjected to a disturbance, while the recovery trajectory curve reflects the self-healing speed and steady-state recovery level of the power grid after a fault.

[0055] Based on time-series curve data, this embodiment calculates the comprehensive evaluation value of power grid resilience using a quantitative formula, first calculating the system performance degradation degree: in, This represents the system performance degradation rate, which is dimensionless and ranges from 0 to 1. This represents the steady-state baseline performance value before the occurrence of a power grid disturbance. This represents the minimum performance value of the system during a disturbance. This parameter characterizes the degree of performance degradation of the power grid after a disturbance; the smaller the value, the stronger the system's disturbance resistance.

[0056] Calculate the system performance recovery rate: in, The system performance recovery rate is expressed in performance units per second. This represents the final performance value of the system after it has recovered to a steady state. This is the total time, expressed in seconds, for the system to recover from its lowest performance value to a steady state. This parameter characterizes the self-healing capability after a power grid fault; a higher value indicates higher recovery efficiency.

[0057] Further construct the formula for the comprehensive evaluation value of power grid security resilience: in, This is a comprehensive evaluation value for power grid resilience, ranging from 0 to 100. The steady-state fit coefficient represents the long-term operational stability of the power grid. These are preset weighting coefficients, corresponding to the weights for disturbance rejection capability, self-healing recovery capability, and steady-state adaptation capability, respectively. The sum of the weighting coefficients is 1, and they can be adaptively adjusted according to the grid voltage level and the importance of power supply.

[0058] After calculating the comprehensive resilience evaluation value, this embodiment combines the parameter limit violation information and equipment anomaly information located during the physical verification process to accurately pinpoint the weak links in the power grid's resilience. By comparing the frequency, magnitude, and fault induction probability of parameter limits for each topology node and branch, the core physical devices that reduce system resilience are identified, generating a standardized structured assessment report. The assessment report clearly lists the weak devices, their inherent parameters, real-time operating parameters, parameter limit violation types, limit violation magnitudes, and corresponding resilience impact levels, making the resilience assessment results quantifiable, traceable, and locatable.

[0059] Table 3 below shows the classification of power grid resilience levels and the corresponding indicators in this embodiment. The standardized determination of resilience levels is completed based on the comprehensive evaluation value.

[0060] This embodiment achieves accurate quantification and rating of power grid resilience through multi-dimensional quantitative formulas, and completes the source tracing of weak links by combining equipment over-limit information. The generated structured assessment report can directly support power grid operation and maintenance decision-making and hidden danger management.

[0061] This embodiment constructs a standardized toughness quantitative assessment system, which obtains accurate comprehensive toughness indicators through multi-dimensional parameter coupling calculation. At the same time, it realizes physical equipment traceability of toughness defects, solves the problems of traditional toughness assessment being unable to quantify and locate the root cause of weakness, and improves the engineering practicality of the assessment results.

[0062] refer to Figure 6 In a preferred embodiment, based on the aforementioned end-to-end evaluation architecture, a new vector knowledge base retrieval empowerment mechanism is added to improve the model inference accuracy in rare scenarios such as rare faults and extreme disturbances. Existing data-driven and large-model inference solutions are prone to inference logic deviations and scenario judgment errors when facing rare fault scenarios with missing historical samples. This embodiment compensates for the lack of model scenario experience by injecting prior fault knowledge.

[0063] This embodiment first constructs a dedicated vector knowledge base for the power grid domain. The core data source of the knowledge base includes three types of core knowledge samples: complete historical fault cases of the regional power grid over the years, typical failure modes of various power equipment across the entire network, and mature defense and control strategies under various disturbance scenarios of the power grid. Among them, the historical fault cases completely preserve the fault occurrence scenario, disturbance type, propagation path, scope of impact, handling plan, and recovery result; the typical equipment failure modes include the aging failure, instantaneous failure, and cascading failure characteristics of core equipment such as transformers, circuit breakers, transmission lines, and instrument transformers; the defense and control strategies include standardized handling plans for load transfer, equipment shutdown, power flow adjustment, and fault isolation corresponding to various fault scenarios.

[0064] During the knowledge base construction process, all knowledge samples undergo structured vectorization. Using a power industry-specific coding model, unstructured fault texts, equipment failure characteristics, and control strategies are transformed into high-dimensional vector features, which are then uniformly stored in the vector knowledge base. Simultaneously, feature indexes and scene tags are established to enable rapid retrieval and matching. The vector features fully preserve the topological, parameter, and disturbance characteristics of the fault scene, ensuring the accuracy of similar scene matching.

[0065] Before the large language model performs inference, the system synchronously inputs the currently generated structured semantic input into the vector retrieval module. The cosine similarity algorithm is then used to match the current running scenario with historical samples in the knowledge base. The similarity calculation formula is as follows: in, This is the scene similarity coefficient, with a value ranging from 0 to 1. The closer the value is to 1, the higher the scene similarity. This represents the high-dimensional feature vector of the current power grid operation scenario. This is a high-dimensional feature vector of historical fault cases in the knowledge base; It is the inner product of two vectors; These are the magnitudes of the two vectors, respectively.

[0066] The system selects Top-N similar historical reference cases with similarity coefficients higher than a preset threshold, prioritizing the matching of highly similar cases with consistent perturbation types, similar topological scenes, and matching operating parameters. The selected historical reference cases are used as prior background knowledge and fully injected into the fixed rule layer of the prompt word template, forming a fused semantic input with physical constraint rules and real-time operating data.

[0067] The injected historical case knowledge can provide large language models with evolutionary experience and handling logic for rare failure scenarios. This guides the model to reason based on the propagation patterns and evaluation logic of similar historical failures in extreme scenarios where there is insufficient real-time data support, thus avoiding erroneous judgments that contradict engineering experience. Simultaneously, mature defense strategies from historical cases can assist the model in optimizing resilience assessment strategies, improving the rationality and completeness of the assessment results.

[0068] This embodiment achieves deep integration of historical fault experience and real-time reasoning process through vector knowledge base and similarity retrieval mechanism, making up for the reasoning shortcomings of large language model in scarce fault scenarios, and improving the accuracy and reliability of resilience assessment in extreme, complex and rare power grid disturbance scenarios.

[0069] In the final embodiment, based on the aforementioned complete resilience assessment and quantitative output architecture, a new geographic visualization mapping and interactive verification mechanism are added to realize the spatial visualization display and refined manual verification of the assessment results, thereby improving the verifiability of the results and their engineering application value.

[0070] In this embodiment, after generating the final resilience quantification index and the location results of equipment weaknesses, high-precision geographic wiring map data corresponding to the regional power grid is immediately retrieved. This data includes spatial information such as the geographic coordinates, topological spatial distribution, regional power supply boundaries, and line routes of all network equipment, which can accurately map the actual geographical location of the power grid physical equipment. The system establishes a mapping relationship between the resilience assessment results and the geographic layer, accurately matching the located weak equipment, fault-affected areas, and areas with low resilience to the corresponding layer coordinate positions on the geographic wiring map.

[0071] A thermal grading rendering algorithm is used to generate a regional power grid resilience thermal distribution map. The map uses different color gradients to distinguish the resilience level and defect severity of different areas; the lower the resilience level and the weaker the equipment, the darker the thermal rendering color, intuitively presenting the spatial distribution characteristics of the entire network's resilience and areas with concentrated potential hazards. During the rendering process, unique equipment numbers and geographical coordinates are bound to each device, ensuring that each thermal anomaly point corresponds to a real physical power grid device, thus transforming abstract resilience indicators into concrete spatial locations.

[0072] Furthermore, the system builds an interactive front-end display interface to complete the visualization output of the heat map. The front-end interface supports interactive operations such as free zooming, area selection, and point clicking. When the user clicks on any device node or line point in the heat map, the system automatically retrieves the full-process evaluation data corresponding to that point and displays the node's original real-time physical parameters, initial model inference parameters, physics engine verification parameters, parameter correction deviation values, inference logic adjustment process, and final toughness determination criteria in a pop-up window.

[0073] Through this interactive display mechanism, technicians can fully trace the entire process of generating, verifying, and correcting every resilience assessment result, intuitively compare the deviations between the initial model inference and physical verification, accurately verify the rationality of the inference logic and the credibility of the assessment results, and completely solve the problems of opaque, untraceable, and difficult-to-verify results of traditional assessment methods.

[0074] This embodiment transforms abstract resilience quantification data into intuitive spatial thermal distribution images through geospatial mapping and interactive visualization technology. This enables rapid location and full-process traceability of weak links in the power grid, improving the engineering practicality and verifiability of resilience assessment technology. It can provide intuitive and accurate decision-making basis for power grid safety dispatch, hidden danger management, and equipment upgrading.

Claims

1. A method for assessing the security resilience of regional power grids using a large language model, characterized in that, include: Collect multi-source heterogeneous operation data of the regional power grid and construct a time-series database; Based on the physical topology constraints and physical law rules of the power grid, a prompt word template is constructed to transform the operation data into structured semantic input; A reasoning chain containing fault propagation path analysis and resilience assessment strategies is generated using a large language model; At key nodes of the reasoning chain, an external physical calculation engine is invoked to perform power flow calculation and physical verification. The physical calculation results are fed back to the large language model to correct the reasoning logic and generate the final resilience quantification index.

2. The method according to claim 1, characterized in that, The process of collecting multi-source heterogeneous operation data of the regional power grid and constructing a time-series database specifically includes: deploying distributed data acquisition probes to synchronously acquire historical operation data, equipment ledger data, real-time monitoring data, and external environment data; The acquired data is cleaned, timestamp aligned, and normalized. The processed data is mapped to a unified time-series database architecture to build a node-edge associated topological index. The historical operation data includes fault recording data, and the equipment ledger data includes equipment physical parameters and connection relationships.

3. The method according to claim 1, characterized in that, The construction of prompt word templates based on power grid physical topology constraints and physical law rules specifically includes: extracting node connection relationships and branch parameters in the power grid topology; Transform Kirchhoff's laws, thermal stability constraints, and voltage stability limits into logical constraint expressions; The logical constraint expression is combined with the current power grid operating status data to construct a prompt word template containing physical rule verification instructions. The prompt word template is used to guide the large language model to strictly follow the physical laws of the power grid during the reasoning process.

4. The method according to claim 1, characterized in that, The method of generating a reasoning chain that includes fault propagation path analysis and resilience assessment strategies using a large language model specifically includes: the large language model generating a sequence of reasoning steps that includes fault initiation point determination, fault propagation path deduction, affected area identification, and load loss prediction based on the structured semantic input. In the inference step sequence, key verification nodes that need to be numerically verified are marked, and the key verification nodes include at least power flow calculation nodes and short-circuit current verification nodes.

5. The method according to claim 4, characterized in that, The step of feeding back the physical calculation results to the large language model to correct the reasoning logic and generate the final resilience quantification index specifically includes: parsing the power flow convergence status, node voltage over-limit information and line overload information returned by the external physical calculation engine; The parsed numerical verification information is converted into correction feedback text in natural language form; The corrected feedback text is input into the context window of the large language model, triggering the large language model to re-execute subsequent inference steps or adjust the evaluation strategy until a resilience index that conforms to physical laws is output.

6. The method according to claim 3, characterized in that, The process of converting Kirchhoff's laws, thermal stability constraints, and voltage stability limits into logical constraint expressions further includes: discretizing continuous physical law parameters into logical rules in a semantic space based on the grid operation characteristics at different voltage levels. A prompt word structure containing a dynamic mask is constructed. The dynamic mask is used to automatically replace the running parameter part in the prompt word when the real-time data is updated, ensuring that the large language model always performs logical deduction based on the latest power grid section data during inference.

7. The method according to claim 5, characterized in that, The step of marking key verification nodes that need to be numerically verified in the reasoning step sequence further includes: triggering an external physical calculation engine through a function call mechanism during the thought chain reasoning process. The function call mechanism parses the natural language parameters generated by the large language model into the input file format required by the physical computing engine; The input file format is passed to the physical computing engine for calculation, and an asynchronous listening thread is established to obtain the calculation results, ensuring that the large language model maintains its context state while waiting for the calculation results.

8. The method according to claim 5, characterized in that, The process of outputting a resilience index that conforms to physical laws specifically includes: calculating the performance degradation curve and recovery trajectory of the system after being subjected to a preset disturbance; Based on the performance degradation curve and recovery trajectory, calculate the comprehensive evaluation value of the system's absorption, adaptation, and recovery capabilities; The comprehensive evaluation value is combined with the weak link location information to generate a structured evaluation report. The evaluation report includes a list of physical equipment that leads to reduced toughness and details of the corresponding physical parameters exceeding the limit.

9. The method according to claim 1, characterized in that, Before generating a reasoning chain that includes fault propagation path analysis and resilience assessment strategies using a large language model, the process also includes: constructing a vector knowledge base that includes historical power grid fault cases, typical equipment failure modes, and defense control strategies. Vector retrieval technology is used to perform similarity matching on the structured semantic input to retrieve the historical reference case most similar to the current running state; The historical reference cases are injected into the prompt word template as background knowledge to enhance the reasoning accuracy of the large language model in rare fault scenarios.

10. The method according to claim 1, characterized in that, After outputting the corrected resilience quantification indicators and weak link location results, the method also includes: obtaining the geographical wiring diagram data of the regional power grid; The weak link location results are mapped to the corresponding layer of the geographic connection map data to generate a resilience thermal distribution map with spatial location information; The interactive front-end interface displays the toughness thermal distribution map and, in response to user clicks, shows the detailed physical parameter correction process and verification deviation value of the corresponding node, assisting technicians in verifying the credibility of the evaluation results.