NL2API-based power generation scheduling instruction intelligent analysis and API automatic calling system

CN122620491BActive Publication Date: 2026-09-18NANJING HUADUN ELECTRIC POWER INFORMATION SAFETY EVALUATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611097671.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-09-18
Estimated Expiration
2046-07-23

AI Technical Summary

Technical Problem

[0005]本发明的目的在于克服现有技术的不足,适应现实需要,提供一种基于NL2API的发电调度指令智能解析与API自动调用系统,以解决当前系统依赖语义逻辑图谱推理缺乏物理量化校验,无法区分业务关联与实际电气影响,导致调用路径偏离电网物理规律的技术问题

Benefits of technology

1、本发明通过设计潮流耦合约束计算模块,并结合功率转移分布因子计算函数和语义边约束潮流影响因子算法,实现将自然语言指令中的源实体、目标实体和候选API调用意图映射到电气拓扑图谱后进行潮流物理量化校验的效果,能够在业务语义关联之外进一步判断源物理节点对目标支路、目标断面或目标区域对象是否具有真实电气影响,解决当前系统依赖语义逻辑图谱推理缺乏物理量化校验,无法区分业务关联与实际电气影响,导致调用路径偏离电网物理规律的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122620491B_ABST
    Figure CN122620491B_ABST
Patent Text Reader

Abstract

The application discloses a power generation scheduling instruction intelligent analysis and API automatic calling system based on NL2API, relates to the technical field of power generation scheduling, and aims to solve the technical problems that current systems lack physical quantitative checking and cannot distinguish business association and actual electrical influence due to the dependence on semantic logic graph reasoning, so that the calling path deviates from the physical law of power grids, and the application comprises a power flow coupling constraint calculation module, a dynamic graph pruning module and an API calling constraint generation module. The power flow coupling constraint calculation module is designed, the power transfer distribution factor calculation function and the semantic edge constraint power flow influence factor algorithm are combined, the source entity, the target entity and the candidate API calling intention in the natural language instruction are mapped to the electrical topology graph, and the power flow physical quantitative checking effect is achieved, so that whether the source physical node has a real electrical influence on the target branch, the target section or the target regional object can be further judged based on the business semantic association.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power generation dispatching technology, and more specifically, to a power generation dispatching instruction intelligent parsing and API automatic invocation system based on NL2API. Background Technology

[0002] With the development of power dispatch automation platforms, intelligent data query systems, and NL2API natural language interface technology, dispatchers are increasingly inclined to directly trigger backend interface calls through natural language commands when performing unit output queries, line power flow tracking, cross-sectional margin verification, and operational status analysis. The system then automatically completes semantic parsing, entity recognition, parameter assembly, and result feedback.

[0003] Existing intelligent data query systems for power generation dispatch mostly rely on semantic logic graphs or interface registry for reasoning. They typically generate corresponding API call paths based on the business affiliation, spatial scope, or interface dependency relationships between objects such as power plants, generating units, substations, lines, sections, and regions.

[0004] However, in actual power generation dispatching scenarios, the grid topology, switch on / off status, line activation / deactivation status, cross-sectional operating boundaries, and power flow distribution relationships continuously change with the operating mode. Simply relying on semantic logic graphs to determine the existence of connections between devices can easily lead to misinterpreting business-related connections as actual electrical impacts. Especially when source and target entities have jurisdictional, affiliation, or spatial proximity relationships, or even closed paths in the electrical topology, the actual power flow impact of source-side power changes on target lines, cross-sections, or regions may still be weak. If the system still generates API call sequences according to these logical connections, it will result in invalid interface calls, query paths deviating from the current physical laws of the power grid, and even misjudgments by dispatchers regarding the scope of power generation output impact, cross-sectional risks, and line power flow changes. Therefore, we propose an intelligent parsing and automatic API calling system for power generation dispatching instructions based on NL2API. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the existing technology, adapt to the needs of reality, and provide a power generation dispatching instruction intelligent parsing and API automatic calling system based on NL2API. This system solves the technical problem that the current system relies on semantic logic graph reasoning, lacks physical quantification verification, cannot distinguish between business associations and actual electrical impacts, and causes the calling path to deviate from the physical laws of the power grid.

[0006] To solve the above technical problems, the present invention provides the following technical solution: a power generation dispatching instruction intelligent parsing and API automatic calling system based on NL2API, including a power flow coupling constraint calculation module, a dynamic graph pruning module, and an API call constraint generation module; The power flow coupling constraint calculation module receives the initial semantic query graph formed by pre-parsing the natural language instructions of the power generation dispatch and the electrical topology graph corresponding to the current power grid operation mode. It maps the source physical nodes and target entities to physical objects in the electrical topology graph, matches the candidate API call intent with the interface target of the corresponding physical object, and combines the reachability status of the closed path, line reactance, current power flow, operating limit and interface target matching status to generate the semantic edge constraint power flow influence factor of the logically related edge. The dynamic graph pruning module calculates the semantic edge callability of logically related edges based on the semantic edge constraint power flow influence factor, the target physical object's operating state, the graph conflict degree, and the missing call dependency degree. It then performs actions such as retaining, deleting, or writing uncallable markers on the logically related edges in the initial semantic query graph to generate an optimized semantic query graph. The API call constraint generation module generates an NL2API automatic call sequence based on the optimized semantic query graph, so that the data retrieval path and interface call order conform to the current power grid topology and power flow transmission rules.

[0007] Preferably, the power flow coupling constraint calculation module includes a physical object positioning unit, a power flow influence calculation unit, and a semantic edge influence factor generation unit; The physical object localization unit determines the source physical node and target physical object corresponding to the semantic entities at both ends of the logical association edge based on the pre-constructed entity mapping table. The power flow impact calculation unit calculates the power flow impact value of the source physical node's unit power change on the branches contained in the target physical object based on the operating branches, closed switches, line reactance, current power flow, and operating limits in the electrical topology map. The formula for calculating the power flow impact value is as follows: ; in, Represents the source physical node The effect of unit power change on the target branch The influence value of the trend, Indicates the target branch The associated row vectors in the branch-node association matrix This is the transpose of the corresponding associated vector. This represents the nodal susceptance matrix after removing the balancing nodes. Represents the source physical node The corresponding unit injection vector, Indicates the target branch The line reactance.

[0008] Preferably, the semantic edge influence factor generation unit fuses the power flow influence value, the reachability state of the closed path, the consistency state of the entity mapping, the interface target matching state, the current power flow margin, and the equivalent reactance path information, and generates the semantic edge constraint power flow influence factor corresponding to the logically related edge through the semantic edge constraint power flow influence factor algorithm. The calculation formula is as follows: ; in, logically related edges The semantic edge constraint of the power flow influence factor This serves as a reachability identifier for the closed path between the source physical node and the target entity. For entity mapping consistency identifier, The set of branches corresponding to the target entity. Match the identifier to the interface target. The current power flow value of the target branch. For the target branch road operating limit, It is the normalized minimum equivalent reactance between the source physical node and the target entity.

[0009] Preferably, the dynamic graph pruning module includes an edge attribute reading unit, a callable degree calculation unit, a pruning execution unit, and a pruning recording unit; The edge attribute reading unit reads the semantic edge constraint power flow influence factor, target physical object running status, candidate API call intent, graph conflict information and call dependency information corresponding to the logically associated edges; The callability calculation unit combines semantic edge constraint power flow influence factor, target physical object running status, candidate API call intent consistency with query target, graph conflict degree and call dependency missing degree to calculate the NL2API semantic edge callability of logically related edges. The pruning execution unit compares the callability with preset judgment conditions. If the conditions are met, the logical association edge is retained; otherwise, the logical association edge is deleted or an uncallable mark is written. The uncallable mark includes physical weak association mark, topology unreachable mark, running boundary conflict mark, interface target mismatch mark, or call dependency missing mark. The pruning record unit records the logically related edges that are deleted or marked, the corresponding reasons, and the intentions of related candidate API calls.

[0010] Preferably, the formula for calculating the callability degree of the NL2API semantic edge is: ; in, logically related edges Callability This serves as an identifier for the operational status of the target physical object. This serves as an indicator of the consistency between the candidate API call intent and the query target. The graph conflict degree of logically related edges. This represents the degree of missing call dependencies for logically related edges.

[0011] Preferably, the dynamic graph pruning module performs connectivity updates on the initial semantic query graph after completing the logical association edge processing; If the target entity corresponding to a candidate API call intent cannot be reached from the source physical node due to the deletion of logical associated edges, then the candidate API call intent is added to the prohibited call set. If the target entity can be reached through the remaining logically related edges, then retain the candidate API call intent and regenerate the node dependencies; The optimized semantic query graph includes the set of remaining entities, the set of remaining logically related edges, the set of uncallable markers, the set of prohibited calls, node dependencies, and the callability degree corresponding to each logically related edge.

[0012] Preferably, it also includes a semantic parsing and intent modeling module, which includes a word parsing unit, an entity slot extraction unit, a call intent recognition unit, and an initial semantic graph generation unit; The word parsing unit breaks down the natural language instructions for power generation dispatch into dispatch action words, equipment object words, time condition words, spatial condition words, and indicator condition words. The entity slot extraction unit writes the equipment object terms into the corresponding entity slots according to the power generation scheduling entity term list. The call intent recognition unit generates corresponding candidate API call intents based on scheduling action lexical units and indicator condition lexical units. The initial semantic graph generation unit uses entities in the slots as nodes and uses scheduling business affiliation, spatial range, indicator query, and call dependency relationships as logical association edges to generate the initial semantic query graph.

[0013] Preferably, it also includes a multimodal graph fusion module, which includes a semantic logic graph construction unit, an electrical topology graph construction unit, and an entity mapping unit; The semantic logic graph construction unit uses power generation scheduling business objects as semantic nodes and ownership relationships, jurisdiction relationships, scheduling relationships, query relationships, and interface dependency relationships as semantic edges to construct a semantic logic graph. The electrical topology graph construction unit uses generators, buses, main transformers, lines, switches, and sections as electrical nodes or electrical edges, and writes the line reactance, switch open / closed status, maintenance status, current power flow, node injected power, and operating limits into the attributes of the corresponding nodes or edges to construct the electrical topology graph. The entity mapping unit establishes an entity mapping table between business entities in the semantic logic graph and physical nodes, physical branches, or cross-section sets in the electrical topology graph.

[0014] Preferably, the API call constraint generation module includes an interface matching unit, an input parameter assembly unit, a call sorting unit, and a result feedback unit; The interface matching unit determines the matching interface object based on the candidate API call intent in the optimized semantic query graph and the interface registry. The interface registry records the interface object, name, input parameter fields, output parameter fields, applicable entity type, and prerequisite dependent interfaces. The input parameter assembly unit writes the entity identifier, time condition, space condition, operation mode identifier, cross section identifier and node dependency relationship in the optimized semantic query graph into the corresponding interface input parameter field. For the missing necessary input parameter query pruning record unit, if the reason for the missing cannot be eliminated, the corresponding interface task is marked as unexecutable. The call sorting unit generates an automatic NL2API call sequence based on node dependencies and preceding dependency interfaces, and prohibits intents in the call set from generating call tasks. The result feedback unit executes the call sequence and receives the interface return results, and generates power generation scheduling feedback results by combining the uncallable flag and pruning records.

[0015] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor: The system receives the initial semantic query graph formed by the pre-parsing of the natural language instructions for power generation dispatch and the electrical topology graph corresponding to the current power grid operation mode. It maps the source entities and target entities in the initial semantic query graph to physical objects in the electrical topology graph. It also calculates the semantic edge constraint power flow influence factor of logically related edges by combining the reachability status of closed paths, line reactance, current power flow, operating limits, and the matching status of candidate API call intentions with interface targets and interface input parameters. The NL2API semantic edge callability is calculated based on the semantic edge constraint power flow influence factor, target physical object running state, graph conflict degree, and call dependency missing degree. The callability of NL2API semantic edges is compared with the preset semantic edge callability criteria. Based on the comparison results, logically related edges in the initial semantic query graph are retained, deleted, or marked as uncallable. An optimized semantic query graph is generated, and an NL2API automatic call sequence is generated based on the optimized semantic query graph.

[0016] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention designs a power flow coupling constraint calculation module and combines it with a power transfer distribution factor calculation function and a semantic edge constraint power flow influence factor algorithm. This enables the mapping of source entities, target entities, and candidate API call intentions in natural language instructions to electrical topology graphs for power flow physical quantification verification. Beyond business semantic association, this invention can further determine whether the source physical node has a real electrical impact on the target branch, target section, or target area object. This solves the problem that current systems rely on semantic logic graph reasoning but lack physical quantification verification, making it impossible to distinguish between business associations and actual electrical impacts, resulting in call paths deviating from the physical laws of the power grid.

[0017] 2. This invention also designs a semantic edge influence factor generation unit and combines it with a semantic edge constraint power flow influence factor algorithm to achieve the effect of integrating the reachability state of closed paths, the consistency state of entity mapping, the matching state of interface targets, the current power flow margin, and the equivalent reactance path information into the logically associated edge attributes. This comprehensively expresses the physical validity of logically associated edges and solves the problem that it is difficult to accurately reflect the implicit weak association problem of insufficient electrical transmission influence even though a closed path exists, by relying solely on a single topological connectivity relationship or a single power flow influence result.

[0018] 3. This invention also designs a dynamic graph pruning module and combines it with the NL2API semantic edge callability algorithm to achieve the effect of judging the callability of each logical association edge in the initial semantic query graph, retaining, deleting, or marking it as uncallable, thereby controlling the running status of the target physical object and the candidate API call intention. Figure 1 Consistency, graph conflict degree, and missing call dependency degree are incorporated into the edge callability judgment process to solve the problem that logically related edges, although having a certain physical influence, are still incorrectly retained when there are abnormal running states, mismatched interface targets, missing call dependencies, or graph conflicts, thus causing invalid API calls.

[0019] 4. By designing pruning record units, prohibited call sets, and connectivity update mechanisms, the system records the reasons for deleted or marked logically related edges and regenerates optimized semantic query graphs based on the remaining logically related edges. This ensures that the remaining candidate API call intentions can form complete and traceable call paths, solving the problem that traditional NL2API systems lack path reconstruction and reason recording after pruning some semantic paths, leading to broken interface call chains, unclear call basis, and lack of interpretability in feedback results. Attached Figure Description

[0020] Figure 1 This is a flowchart illustrating the overall system operation method of the present invention; Figure 2 This is a flowchart of the semantic parsing and multimodal graph fusion process of the present invention; Figure 3This is a flowchart of the power flow coupling constraint calculation for the present invention; Figure 4 This is a flowchart of the dynamic graph pruning and API call constraint generation process of the present invention; Figure 5 This is a flowchart illustrating the uncallable flags and result feedback of the present invention; Figure 6 This is a graph showing the relationship between the semantic edge callability threshold and the precision, recall, and F1 score of the present invention. Figure 7 This is a graph showing the change in API error call rate before and after enabling physical constraint verification according to the present invention. Figure 8 This is a graph showing the relationship between the normalized minimum equivalent reactance and the semantic edge constraint power flow influence factor of this invention. Detailed Implementation

[0021] Example 1: As Figures 1 to 8 As shown, the present invention relates to an intelligent parsing and automatic API calling system for power generation dispatching instructions based on NL2API, including a semantic parsing and intent modeling module, a multimodal graph fusion module, a power flow coupling constraint calculation module, a dynamic graph pruning module, and an API calling constraint generation module; The semantic parsing and intent modeling module includes a word parsing unit, an entity slot extraction unit, an invocation intent recognition unit, and an initial semantic graph generation unit; The word segmentation unit adopts a word segmentation method based on a combination of dictionary and statistical model to break down the natural language instructions for power generation dispatch into dispatch action words, equipment object words, time condition words, spatial condition words, and indicator condition words. For example, dispatch action terms can include "query", "adjust", "control", "verify", etc.; equipment object terms can include "Unit #1", "AB line", "target substation", etc.; time condition terms can include "today", "current time", "specified time period", etc.; spatial condition terms can include "East China region", "target area", "target section", etc.; and index condition terms can include "active power", "voltage", "section margin", "line power flow", etc.

[0022] The entity slot extraction unit writes equipment object terms into the corresponding entity slots based on a pre-built generation dispatch entity terminology. Entity slots include power plant slots, unit slots, substation slots, busbar slots, line slots, cross-section slots, and regional slots. For example, "AB line" is written into a line slot, "#1 unit" into a unit slot, and "East China region" into a regional slot. The generation dispatch entity terminology can include the equipment's standard name, dispatch abbreviation, alias, and the correspondence between these and the equipment identifiers in the dispatch system. The API call intent recognition unit maps the combination of scheduling action terms and indicator condition terms to predefined candidate API call intents. For example, combining "query" and "active power" generates the intent "query real-time power," combining "query" and "section margin" generates the intent "query section operating margin," and combining "verify" and "over-limit status" generates the intent "operational risk verification." Each candidate API call intent is associated with a corresponding interface object, input parameter template, output parameter type, and result feedback format. The initial semantic graph generation unit uses entities in the slots as nodes and logical edges related to scheduling business affiliation, spatial scope, indicator query, and call dependency. This generates an initial semantic query graph, which is a directed graph. Nodes represent business entities, indicator entities, or interface intent entities identified in natural language instructions, and edges represent the semantic-level association paths. For example, phrases like "power plant includes generating units," "region includes substations," "line is associated with power flow indicators," and "obtain line status first, then query line limits" can all serve as logical edges.

[0023] The multimodal graph fusion module is used to simultaneously construct and maintain semantic logic graphs and electrical topology graphs, and establish the mapping relationship between the two. It includes a semantic logic graph construction unit, an electrical topology graph construction unit, and an entity mapping unit. The semantic logic graph construction unit uses power generation scheduling business objects as semantic nodes and ownership relationships, jurisdiction relationships, scheduling relationships, query relationships, and interface dependency relationships as semantic edges to construct a semantic logic graph; The electrical topology graph construction unit uses generating units, buses, main transformers, lines, switches, and sections as electrical nodes or electrical edges, and writes line reactance, switch open / closed status, maintenance status, current power flow, node injected power, and operating limits into the attributes of the corresponding nodes or edges to construct an electrical topology graph. This electrical topology graph is a dynamic graph, in which the attributes of each node or edge include line reactance, switch open / closed status, maintenance status, current power flow, node injected power, and operating limits; the current power flow can include active power flow and reactive power flow, and the operating limits can include line thermal stability limits, stable section limits, or equipment operating boundaries; The entity mapping unit establishes an entity mapping table between business entities in the semantic logic graph and physical nodes, physical branches, or cross-section sets in the electrical topology graph. For example, the semantic node "AB line" is mapped to the physical branch of the AB line in the electrical topology map; the semantic node "East China region" is mapped to the set of buses, lines, and cross-sections belonging to that region in the electrical topology map; and the semantic node "#1 unit" is mapped to the bus node connected to the generator. The mapping table supports one-to-one, one-to-many, or many-to-one mapping relationships.

[0024] The power flow coupling constraint calculation module receives the initial semantic query graph formed by pre-parsing the natural language instructions of the power generation dispatch and the electrical topology graph corresponding to the current power grid operation mode. It maps the source physical nodes and target entities to physical objects in the electrical topology graph, and matches the candidate API call intent with the interface target of the corresponding physical object. Combining the reachability status of the closed path, line reactance, current power flow, operating limit and interface target matching status, it generates the semantic edge constraint power flow influence factor of logically related edges. The power flow coupling constraint calculation module includes a physical object location unit, a power flow influence calculation unit, and a semantic edge influence factor generation unit; The physical object location unit determines the source physical node and target physical object corresponding to the semantic entities at both ends of the logical association edge based on the entity mapping table. The source physical node can be a unit access bus, a regional boundary bus, or an equivalent injection node corresponding to the source physical node. The target physical object can be a line, section, unit, substation associated bus, or a set of branches corresponding to a regional object. If the semantic entities at both ends of the logical association edge cannot be mapped to valid physical objects in the electrical topology graph, the entity mapping consistency flag of the logical association edge is set to an inconsistent state.

[0025] The power flow impact calculation unit calculates the active power flow impact of a unit power change at the source physical node on the branches contained in the target physical object based on a DC power flow model. Specifically, the power flow impact calculation unit generates a branch-node correlation matrix under the current operating mode based on the operating branches, closed switches, line connections, and line reactance in the electrical topology map. It then generates a node susceptance matrix after removing slack nodes based on the line reactance. Finally, it calculates the power flow response relationship of a unit power change at the source physical node on the target branch using a power transfer distribution factor calculation function to obtain the power flow impact value of the source physical node on the branches contained in the target physical object. The calculation formula is as follows: ; in, Represents the source physical node The effect of unit power change on the target branch The influence value of the trend, Indicates the target branch The associated row vectors in the branch-node association matrix Indicates the target branch The transpose of the correlation vector in the branch-node correlation matrix is ​​used to perform matrix multiplication with the inverse of the node susceptance matrix after removing the balancing node and the unit injection vector of the source physical node to obtain the response of the phase angle difference between the two nodes of the target branch. This represents the nodal susceptance matrix after removing the balancing nodes. Represents the source physical node The corresponding unit injection vector, Indicates the target branch The line reactance. This formula can quantify the power flow influence of the source physical node on the target branch, providing a power flow sensitivity basis for the subsequent generation of semantic edge-constrained power flow influence factors.

[0026] When the target entity corresponds to a single line, the power flow impact calculation unit calculates the impact of the unit power change of the source physical node on the power flow change of that line. Taking the query "Inquiry about the impact of power plant A's output change on the power flow of line AB" as an example, the system identifies the access bus corresponding to power plant A as the source physical node. AB line is determined as the target branch. And through calculation formula Calculate the impact of the unit power change at the source physical node on the power flow change along line AB; When the target entity corresponds to a cross section, the power flow impact calculation unit calculates the impact value of the unit power change of the source physical node on the power flow change of each branch in the cross section, and combines the power flow impact values ​​of each branch into the power flow impact value of the cross section according to the cross section direction. Taking "Analyzing the impact of power plant A on the target cross-sectional power flow" as an example, the system maps "power plant A" as a source physical node. This maps a "cross-regional section" to a set of cross-sectional branches consisting of multiple lines, for example: The power flow impact values ​​of the source physical node unit power change on each component branch are calculated separately and then synthesized into cross-sectional power flow impact values ​​according to the cross-sectional direction. When the target entity is a power station, unit, or area object, the power flow impact calculation unit determines its associated bus, associated branch, or associated section according to the entity mapping table, and uses the power flow impact value of the corresponding branch or section as the source of the power flow impact value of the target physical object.

[0027] Taking the query "Inquiry about the impact of power plant A's output changes on power flow in region B" as an example, the system maps "Power Plant A" to the source physical node. However, "Area B" is not a specific route or a single branch. First, the set of buses, routes, or sections associated with Area B is determined through an entity mapping table. For example, Area B may be associated with several routes. , , And a certain cross section, and then use the formula to calculate the impact value of the unit power change of power plant A on the power flow of each associated line, and use the power flow impact value of these branches or cross sections as the source of the power flow impact value of the comprehensive target object in area B; It should be noted that the tidal influence value Used to characterize source physical nodes The effect of unit power change on the target branch The degree of influence of tidal current changes is indicated by its positive or negative sign, representing the direction of the tidal current's influence, while its absolute value represents the intensity of the tidal current's influence. The tidal current influence calculation unit obtains... Afterwards, Compare with the preset power flow impact threshold: when When the preset power flow impact threshold is met, it is determined that there is an effective power flow coupling relationship between the source physical node and the target branch, indicating that the corresponding logically associated edge has a real electrical impact under the current power grid operation mode; when If the preset power flow impact threshold is not met, it is determined that there is a weak power flow impact or no actual power flow impact between the source physical node and the target branch. This indicates that although the corresponding logically related edge may be related in the business semantic graph, or even have a closed connection path in the electrical topology graph, its impact on the power flow transmission of the target branch is insufficient.

[0028] The specific methods for determining the threshold of tidal current influence include: Reference sensitivity data generation: Based on the current power grid topology, transmission channels with a significant impact on system power flow are automatically selected as reference objects according to the following rules, specifically including: Inter-regional tie lines: All inter-regional tie lines that undertake the task of power exchange between regions; Heavy-load lines and sections: Current load rate Greater than a preset threshold (e.g.) The preset threshold is taken as the lower limit of the load rate of heavy-load components as specified in the power grid operation procedure, or as the median of the load rate of all lines in the current power grid (the line or section), wherein the preset threshold can be adjusted according to the definition of heavy-load components in the power grid operation procedure; Hub node associated lines: In the electrical topology, select the nodes with the highest degree (i.e., the number of directly connected branches) (e.g., the top...). Hub nodes, and include all lines connected to these nodes into the base object set; Calculate the power flow impact of unit power change of the source physical node on all the above-mentioned benchmark objects to form benchmark sensitivity data; the same transmission channel may belong to multiple categories at the same time, and the selection is processed by union; Background disturbance level quantification: Determine the background disturbance level by combining the accuracy of the current power grid's measurement devices, the natural fluctuation characteristics of the load, and the convergence error of the power flow calculation; Threshold decision: The minimum value of the baseline sensitivity data that is greater than the background disturbance level is determined as the power flow impact threshold under the current operating mode; if there is no baseline sensitivity data that is greater than the background disturbance level, the background disturbance level is used as the power flow impact threshold.

[0029] Among them, the power transmission channels that have a significant impact on the power flow transmission of the system refer to electrical components that undertake the main power exchange or have a high load rate in the preset historical or typical operating modes.

[0030] The semantic edge influence factor generation unit integrates power flow influence value, closed path reachability state, entity mapping consistency state, interface target matching state, current power flow margin, and equivalent reactance path information. It then uses the semantic edge constrained power flow influence factor algorithm to calculate logically related edges. Corresponding semantic edge constraint power flow influence factor ; The formula for the semantic edge-constrained power flow influence factor algorithm is: ; in, Represents the logical association edges in the initial semantic query graph. Semantic edge constraint power flow influence factor; Represents the source physical node With the target entity The reachability flag indicates the closed path between corresponding physical nodes. A reachable state exists when a continuous electrical path consisting of a closed switch and an operational branch exists between the source physical node and the corresponding physical node of the target entity; an unreachable state exists when no continuous electrical path exists. The value selection logic is as follows: based on the electrical topology map, with the source physical node... Starting point, target entity The corresponding physical node is the endpoint. A breadth-first search algorithm is used to traverse the connected paths consisting of closed switches and operational branches. If at least one connected path exists, then... ,otherwise ; Represents logically related edges The consistency flag for entity mapping of semantic entities at both ends is defined as follows: a consistent state is achieved when both semantic entities at both ends of a logically related edge can be mapped to valid physical objects in the electrical topology graph; otherwise, an inconsistent state is achieved. The value retrieval logic is as follows: Query the entity mapping table; if the logically related edge... If the semantic entities at both ends can be uniquely and effectively matched with physical objects (nodes or sets of branches) in the electrical topology graph, then... ,otherwise ; Represents the target entity The corresponding set of target routes or the set of branch roads within the target section; Represents logically related edges With the target branch The interface target matching identifier between them is used to characterize whether the interface target of the candidate API call intent involves the target branch. , The value retrieval logic is as follows: Parse the interface target field of the candidate API call intent; if the interface target involves a target branch... For queries or operations, ,otherwise ; Represents the source physical node The effect of unit power change on the target branch of the corresponding physical node The influence value of the trend; Indicates the target branch The current trend value; Indicates the target branch Operating limits; Represents the source physical node With the target entity The normalized minimum equivalent reactance of the closed electrical path between corresponding physical nodes. The calculation method is as follows: First, based on the line reactance in the electrical topology diagram, Dijkstra's algorithm is used to calculate the source physical nodes. With the target entity Find the equivalent reactance of all closed paths and take the minimum value among them. Then, calculate the average reactance of all operational lines in the current electrical topology. Finally, through Perform normalization processing; In the above formula, This is used to characterize the margin state of the current power flow of the target branch relative to the operating limit. The closer the current power flow of the target branch is to the operating limit, the stronger the constraint effect of this item on the logically associated edge. When the current power flow of the target branch exceeds the operating limit, the semantic edge influence factor generation unit synchronously writes the operating boundary state into the logically associated edge attribute, so that the dynamic graph pruning module can trigger the uncallable flag or security warning feedback. Used to characterize the attenuation effect of the equivalent electrical distance between the source physical node and the target entity on the degree of electrical influence of the semantic edge; like Figure 8As shown, the horizontal axis represents the normalized minimum equivalent reactance, and the vertical axis represents the semantic edge constraint power flow influence factor. The solid line represents the curve under higher operating margin conditions, and the dashed line represents the curve under lower operating margin conditions. It can be seen that as the normalized minimum equivalent reactance gradually increases, the semantic edge constraint power flow influence factor gradually decreases, indicating that the greater the equivalent electrical distance between the source physical node and the target entity, the weaker its actual power flow coupling influence on the target physical object. Simultaneously, under lower operating margin conditions, the semantic edge constraint power flow influence factor is generally lower than under higher operating margin conditions, indicating that this invention can combine the operating boundary state of the target branch or target section to impose stricter physical constraints on logically related edges, thereby avoiding the generation of API call paths that do not conform to the actual operating rules of the power grid based solely on business semantic associations.

[0031] The dynamic graph pruning module calculates the semantic edge callability of logically related edges based on the semantic edge constraint power flow influence factor, the target physical object's running state, the graph conflict degree, and the missing call dependency degree. It then performs actions such as retaining, deleting, or writing uncallable markers on the logically related edges in the initial semantic query graph to generate an optimized semantic query graph. The dynamic graph pruning module includes an edge attribute reading unit, a callable degree calculation unit, a pruning execution unit, and a pruning record unit; The edge attribute reading unit traverses all logically related edges in the initial semantic query graph and reads the semantic edge constraint power flow influence factor bound to each logically related edge. Target physical object running status The information includes candidate API call intent, graph conflict information, and call dependency information. Graph conflict information may include inconsistencies between business association direction and power flow reachability direction, semantic entities mapping to multiple conflicting physical objects, and mismatches between the target object's runtime boundary state and the query intent. The callable degree calculation unit is based on the semantic edge constraint power flow influence factor. Target physical object running status The consistency between the candidate API call intent and the query target of the logically related edge, the graph conflict degree, and the missing call dependency degree are evaluated. The NL2API semantic edge callability degree of the logically related edge is calculated using the NL2API semantic edge callability algorithm. The formula for the callable algorithm for NL2API semantic edges is: ; in, Represents logically related edges NL2API semantic edge callability; Represents logically related edges Semantic edge constraint power flow influence factor; Represents the target entity The corresponding physical object's operating status identifier is valid when the target physical object is in operation and can participate in scheduling query or scheduling control, and invalid when the target physical object is in shutdown, maintenance, isolation or unavailable status. Indicates the candidate API call intent and logical association edge The query target consistency identifier is used when the interface object, interface input parameters, and return data type of the candidate API call intent are all consistent with the logically associated edge. The target entity is considered consistent when it matches; otherwise, it is considered inconsistent. The value selection logic is as follows: the interface registration information of the candidate API call intent (including applicable entity type and input parameter structure) and the logical association edge are used. The target entity type and attributes are matched; if a complete match is found, then... ,otherwise ; Represents logically related edges Spectral conflict degree; Represents logically related edges The degree of missing call dependencies.

[0032] Based on conflict type Assignments are made, and conflict types include direction conflicts, state conflicts, and boundary conflicts: Directional conflict refers to the business association direction in the semantic logic graph being opposite to the actual power flow direction, power flow reachable direction, or cross-sectional direction in the electrical topology graph; state conflict refers to the target physical object mapped to by the semantic entity being in a state of maintenance, shutdown, isolation, or unavailable, while the candidate API call intent is still to query, control, or constrain the target physical object; boundary conflict refers to the current power flow of the target branch or target cross-section exceeding the operating limit, or the operating margin term being negative.

[0033] The value is determined based on the severity of the conflict type. For example, when the above-mentioned conflicts do not exist, When a directional conflict exists, it is classified as a Level 1 conflict. When a state conflict exists, it is classified as a level two conflict. When a boundary conflict exists, or multiple conflicts exist simultaneously, it is classified as a Level 3 conflict. Those skilled in the art can adaptively adjust the aforementioned conflict levels according to the severity of the scheduling requirements; System statistical logic related edges The number of necessary conditions missing for the corresponding candidate API call intent, and the number of missing items as the basis for the determination. The value of , i.e. The calculation method is as follows: Initialization Iterate through all necessary input parameter fields required by the candidate API call intent (such as device identifier, time condition), and if any necessary input parameter is missing, then... Increase by 1; check if the results of all prerequisite API calls for this intent are ready. If any prerequisite result is missing, then... Increase by 1; Necessary conditions include necessary input parameters, upstream interface results, and entity mapping results. Necessary input parameters include equipment identifier, line identifier, unit identifier, cross-section identifier, area identifier, time condition, spatial condition, or operating mode identifier; upstream interface results refer to the upstream interface return results that must be obtained before the current candidate API call intent is executed; entity mapping results refer to whether the semantic entities at both ends of the logically related edge can be mapped to valid physical objects in the electrical topology graph.

[0034] For example: when all the necessary conditions required for a candidate API call intent are met. When one necessary condition is missing, When multiple necessary conditions are missing at the same time, This is the sum of the number of missing items. For example, when a candidate API call intent is missing both the device identifier and the result of the preceding interface, , The maximum value is determined by the number of necessary conditions required for the candidate API call intent.

[0035] The pruning execution unit sequentially checks the callability of NL2API semantic edges. Compare with the preset semantic edge callable criteria: When a logically related edge meets the semantic edge callability criteria, the pruning execution unit retains the logically related edge and allows it to participate in the generation of subsequent API call paths. When a logically related edge does not meet the semantic edge callable determination condition, the pruning execution unit deletes the logically related edge from the initial semantic query graph, or writes an uncallable mark in the logically related edge. Uncallable marks include physical weak association mark, topology unreachable mark, running boundary conflict mark, interface target mismatch mark, or call dependency missing mark. Specifically, when there is no closed electrical path between the source physical node and the target entity corresponding to the logically associated edge, or when the semantic entities at both ends cannot be mapped to valid physical objects in the electrical topology graph, the pruning execution unit can delete the logically associated edge; when there is a closed electrical path between the source physical node and the target entity corresponding to the logically associated edge, but the power flow influence is insufficient, the runtime margin is insufficient, the interface target does not match, or the call dependency is missing, the pruning execution unit can write an uncallable flag in the logically associated edge.

[0036] The methods for determining the callable judgment conditions for preset semantic edges are as follows: Construct a test set that includes various typical power grid operation modes and natural language commands; For each instruction in the test set, with physical constraint verification disabled (i.e., no pruning), execute the complete API call process and record the erroneous call results caused by invalid or conflicting physical constraints, along with the callability degree of the corresponding logically related edges. ; With physical constraint validation enabled, iterate through a candidate threshold range (e.g., from 0 to 1, with a step size of 0.05). For each candidate threshold, perform pruning and calculate the accuracy (number of correct calls / total number of calls) and recall (number of correct calls / number of calls that should have been made) of the API calls. The candidate threshold that maximizes the harmonic mean (F1 score) of precision and recall is selected as the preset semantic edge callability criterion, such as... Figure 6 As shown, the horizontal axis represents the semantic edge callability threshold, and the vertical axis represents performance metrics. The solid line represents precision, the dashed line represents recall, and the dotted line represents the F1 score. As the threshold increases, precision monotonically increases, while recall monotonically decreases. The F1 score reaches its maximum value in the middle threshold range, thus determining the optimal semantic edge callability criteria to balance accuracy and coverage.

[0037] The pruning record unit records detailed information for all deleted or marked logically related edges, including edge identifier, corresponding physical constraint reason, graph conflict reason, missing call dependency reason, and associated candidate API call intent. For example, for logically related edges deleted due to lack of a closed path, the pruning record unit records the reason for topology unreachability; for logically related edges marked due to line over-limit risk, the pruning record unit records the reason for operational boundary conflict; for logically related edges that cannot be called due to lack of preceding interface results, the pruning record unit records the reason for missing call dependency. These records are used to generate subsequent feedback information. After pruning, the dynamic graph pruning module also updates the connectivity of the initial semantic query graph, recalculating the reachability from the source physical nodes to each target entity. Candidate API call intentions that become unreachable due to the removal of key logical connection edges are moved to the prohibited call set; for target entities still reachable through the remaining logical connection edges, node dependencies are regenerated based on these edges. The final optimized semantic query graph includes the set of remaining entities, the set of remaining logical connection edges, the set of uncallable markers, the prohibited call set, the updated node dependencies, and the callability degree of each remaining logical connection edge corresponding to the NL2API semantic edge. The API call constraint generation module generates an NL2API automatic call sequence based on the optimized semantic query graph, so that the data retrieval path and interface call order conform to the current power grid topology and power flow transmission rules. The API call constraint generation module includes an interface matching unit, an input parameter assembly unit, a call sorting unit, and a result feedback unit. The interface matching unit determines the interface object that matches the remaining entity set based on the candidate API call intent in the optimized semantic query graph and the interface registry. The interface registry records the interface object, interface name, interface input parameter fields, interface output parameter fields, applicable entity type, and prerequisite dependent interfaces. The input parameter assembly unit writes entity identifiers, time conditions, spatial conditions, operation mode identifiers, section identifiers, and node dependencies from the optimized semantic query graph into the corresponding interface input parameter fields. For example, the line entity identifier is filled into the "lineId" field, the query time range is filled into the "timeRange" field, and the section entity identifier is filled into the "sectionId" field. For missing necessary input parameters, the input parameter assembly unit queries the pruning record unit to see if the missing parameter is caused by the pruning of upstream logical related edges; if the cause of the missing parameter cannot be eliminated, the corresponding interface call task is marked as unexecutable. The call sorting unit generates an automatic NL2API call sequence based on the node dependencies and prerequisite dependent interfaces in the optimized semantic query graph. For candidate API call intentions in the prohibited call set, no corresponding interface call tasks are generated. For example, the topology status service can be called first to obtain the equipment commissioning status, then the real-time data service can be called to obtain line power flow data, and finally the running quota service can be called to query the margin or over-limit status. For candidate API call intentions in the prohibited call set, the call sorting unit does not generate corresponding call tasks and writes the corresponding prohibited call path into the call constraint results. The result feedback unit executes the generated API call sequence, receives the data results returned by each interface, and combines the uncallable marker set in the optimized semantic query graph with the reasons recorded by the pruning record unit. It then merges the successfully callable data according to entity level, section level, and time conditions to form the power generation dispatch feedback result. For candidate API call intentions pruned due to physical constraints, the feedback result includes the name of the uncallable interface and the constraint reason, such as: "Unable to query AB line power, reason: AB line is under maintenance and there is no alternative path," or "Although the target section and source node have a business relationship, the power flow impact is insufficient, and no corresponding call task was generated." The final result is presented to the user in the form of natural language descriptions or visual charts that conform to the dispatch business specifications. To further illustrate the effectiveness of this invention in reducing invalid and erroneous calls, such as Figure 7As shown, the dashed line represents the API error call rate change curve when physical constraint verification is not enabled, and the solid line represents the API error call rate change curve when physical constraint verification is enabled. It can be seen that as the number of test commands gradually increases, the API error call rate after enabling physical constraint verification is always lower than that in the unenabled state, indicating that power flow coupling constraint calculation and dynamic graph pruning can effectively improve the accuracy of API calls.

[0038] Example 2: A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps: The system receives the initial semantic query graph formed by the pre-parsing of the natural language instructions for power generation dispatch and the electrical topology graph corresponding to the current power grid operation mode. It maps the source entities and target entities in the initial semantic query graph to physical objects in the electrical topology graph. It also calculates the semantic edge constraint power flow influence factor of logically related edges by combining the reachability status of closed paths, line reactance, current power flow, operating limits, and the matching status of candidate API call intentions with interface targets and interface input parameters. The NL2API semantic edge callability is calculated based on the semantic edge constraint power flow influence factor, target physical object running state, graph conflict degree, and call dependency missing degree. The callability of NL2API semantic edges is compared with the preset semantic edge callability criteria. Based on the comparison results, logically related edges in the initial semantic query graph are retained, deleted, or marked as uncallable. An optimized semantic query graph is generated, and an NL2API automatic call sequence is generated based on the optimized semantic query graph.

[0039] The embodiments disclosed in this invention are preferred embodiments, but are not limited thereto. Those skilled in the art can easily understand the spirit of this invention based on the above embodiments and make different extensions and variations, but as long as they do not depart from the spirit of this invention, they are all within the protection scope of this invention.

Claims

1. A power generation dispatching command intelligent parsing and API automatic invocation system based on NL2API, characterized in that, It includes a power flow coupling constraint calculation module, a dynamic graph pruning module, and an API call constraint generation module; The power flow coupling constraint calculation module receives the initial semantic query graph formed by pre-parsing the natural language instructions of the power generation dispatch and the electrical topology graph corresponding to the current power grid operation mode. It maps the source physical nodes and target entities to physical objects in the electrical topology graph, matches the candidate API call intent with the interface target of the corresponding physical object, and combines the reachability status of the closed path, line reactance, current power flow, operating limit, and interface target matching status to generate the semantic edge constraint power flow influence factor of the logically related edges. The power flow coupling constraint calculation module includes a physical object positioning unit, a power flow influence calculation unit, and a semantic edge influence factor generation unit. The physical object localization unit determines the source physical node and target physical object corresponding to the semantic entities at both ends of the logical association edge based on the pre-constructed entity mapping table. The power flow impact calculation unit calculates the power flow impact value of the source physical node's unit power change on the branches contained in the target physical object based on the operating branches, closed switches, line reactance, current power flow, and operating limits in the electrical topology map. The formula for calculating the power flow impact value is as follows: ; in, Represents the source physical node The effect of unit power change on the target branch The influence value of the trend, Indicates the target branch The associated row vectors in the branch-node association matrix This is the transpose of the corresponding associated vector. This represents the nodal susceptance matrix after removing the balancing nodes. Represents the source physical node The corresponding unit injection vector, Indicates the target branch The line reactance; The semantic edge influence factor generation unit integrates power flow influence value, closed path reachability state, entity mapping consistency state, interface target matching state, current power flow margin, and equivalent reactance path information. It then generates the semantic edge constraint power flow influence factor corresponding to the logically related edge using the semantic edge constraint power flow influence factor algorithm. The calculation formula is as follows: ; in, logically related edges The semantic edge constraint of the power flow influence factor This serves as a reachability identifier for the closed path between the source physical node and the target entity. For entity mapping consistency identifier, The set of branches corresponding to the target entity. Match the identifier to the interface target. The current power flow value of the target branch. For the target branch road operating limit, The normalized minimum equivalent reactance between the source physical node and the target entity; The dynamic graph pruning module calculates the callability of logically related edges based on the semantic edge constraint power flow influence factor, the target physical object's operating state, the graph conflict degree, and the missing call dependency degree. It then performs retention, deletion, or writes uncallable markers on the logically related edges in the initial semantic query graph to generate an optimized semantic query graph. The formula for calculating the callability degree of the NL2API semantic edge is as follows: ; in, logically related edges Callability This serves as an identifier for the operational status of the target physical object. This serves as an indicator of the consistency between the candidate API call intent and the query target. The graph conflict degree of logically related edges. The degree of missing call dependencies for logically related edges; The API call constraint generation module generates an NL2API automatic call sequence based on the optimized semantic query graph, so that the data retrieval path and interface call order conform to the current power grid topology and power flow transmission rules.

2. The intelligent parsing and automatic API invocation system for power generation dispatching commands based on NL2API according to claim 1, characterized in that, The dynamic graph pruning module includes an edge attribute reading unit, a callable degree calculation unit, a pruning execution unit, and a pruning recording unit. The edge attribute reading unit reads the semantic edge constraint power flow influence factor, target physical object running status, candidate API call intent, graph conflict information and call dependency information corresponding to the logically associated edges; The callability calculation unit combines semantic edge constraint power flow influence factor, target physical object running status, candidate API call intent consistency with query target, graph conflict degree and call dependency missing degree to calculate the NL2API semantic edge callability of logically related edges. The pruning execution unit compares the callability with preset judgment conditions. If the conditions are met, the logical association edge is retained; otherwise, the logical association edge is deleted or an uncallable mark is written. The uncallable mark includes physical weak association mark, topology unreachable mark, running boundary conflict mark, interface target mismatch mark, or call dependency missing mark. The pruning record unit records the logically related edges that are deleted or marked, the corresponding reasons, and the intentions of related candidate API calls.

3. The intelligent parsing and automatic API invocation system for power generation dispatching commands based on NL2API according to claim 2, characterized in that, The dynamic graph pruning module performs connectivity updates on the initial semantic query graph after completing the logical association edge processing. If the target entity corresponding to a candidate API call intent cannot be reached from the source physical node due to the deletion of logical associated edges, then the candidate API call intent is added to the prohibited call set. If the target entity can be reached through the remaining logically related edges, then retain the candidate API call intent and regenerate the node dependencies; The optimized semantic query graph includes the set of remaining entities, the set of remaining logically related edges, the set of uncallable markers, the set of prohibited calls, node dependencies, and the callability degree corresponding to each logically related edge.

4. The intelligent parsing and automatic API invocation system for power generation dispatching commands based on NL2API according to claim 3, characterized in that, It also includes a semantic parsing and intent modeling module, which includes a word parsing unit, an entity slot extraction unit, a call intent recognition unit, and an initial semantic graph generation unit; The word parsing unit breaks down the natural language instructions for power generation dispatch into dispatch action words, equipment object words, time condition words, spatial condition words, and indicator condition words. The entity slot extraction unit writes the equipment object terms into the corresponding entity slots according to the power generation scheduling entity term list. The call intent recognition unit generates corresponding candidate API call intents based on scheduling action lexical units and indicator condition lexical units. The initial semantic graph generation unit uses entities in the slots as nodes and uses scheduling business affiliation, spatial range, indicator query, and call dependency relationships as logical association edges to generate the initial semantic query graph.

5. The intelligent parsing and automatic API invocation system for power generation dispatching commands based on NL2API according to claim 4, characterized in that, It also includes a multimodal graph fusion module, which comprises a semantic logic graph construction unit, an electrical topology graph construction unit, and an entity mapping unit; The semantic logic graph construction unit uses power generation scheduling business objects as semantic nodes and ownership relationships, jurisdiction relationships, scheduling relationships, query relationships, and interface dependency relationships as semantic edges to construct a semantic logic graph. The electrical topology graph construction unit uses generators, buses, main transformers, lines, switches, and sections as electrical nodes or electrical edges, and writes the line reactance, switch open / closed status, maintenance status, current power flow, node injected power, and operating limits into the attributes of the corresponding nodes or edges to construct the electrical topology graph. The entity mapping unit establishes an entity mapping table between business entities in the semantic logic graph and physical nodes, physical branches, or cross-section sets in the electrical topology graph.

6. The intelligent parsing and automatic API invocation system for power generation dispatching commands based on NL2API according to claim 5, characterized in that, The API call constraint generation module includes an interface matching unit, an input parameter assembly unit, a call sorting unit, and a result feedback unit. The interface matching unit determines the matching interface object based on the candidate API call intent in the optimized semantic query graph and the interface registry. The interface registry records the interface object, name, input parameter fields, output parameter fields, applicable entity type, and prerequisite dependent interfaces. The input parameter assembly unit writes the entity identifier, time condition, space condition, operation mode identifier, cross section identifier and node dependency relationship in the optimized semantic query graph into the corresponding interface input parameter field. For the missing necessary input parameter query pruning record unit, if the reason for the missing cannot be eliminated, the corresponding interface task is marked as unexecutable. The call sorting unit generates an automatic NL2API call sequence based on node dependencies and preceding dependency interfaces, and prohibits intents in the call set from generating call tasks. The result feedback unit executes the call sequence and receives the interface return results, and generates power generation scheduling feedback results by combining the uncallable flag and pruning records.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a power generation dispatching instruction intelligent parsing and API automatic calling system based on NL2API as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Semantic enhancement and dynamic completion method and system for power market data graph

    CN120409495A

  • Semantized security verification method and system for power grid dispatching instruction

    CN121145872A