Digital twin sandbox verification method for power dispatch ai decision

CN123013079APending Publication Date: 2026-10-30STATE GRID HENAN INFORMATION & TELECOMM CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611186701.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]与现有技术相比,本申请提供的一种电力调度AI决策的数字孪生沙箱验证方法,来针对传统仿真引擎不可微导致验证场景无法对AI决策进行对抗性反向寻优的核心瓶颈,通过物理信息神经网络替代传统方程求解器构建可微数字孪生代理模型,从而在沙箱内部建立起从系统响应到场景变量及决策变量的完整梯度传导通路

Benefits of technology

[0006]与现有技术相比,本申请提供的一种电力调度AI决策的数字孪生沙箱验证方法,来针对传统仿真引擎不可微导致验证场景无法对AI决策进行对抗性反向寻优的核心瓶颈,通过物理信息神经网络替代传统方程求解器构建可微数字孪生代理模型,从而在沙箱内部建立起从系统响应到场景变量及决策变量的完整梯度传导通路。在此基础上,将调度指令中的断路器开合等离散信号通过连续松弛化映射转化为可参与梯度运算的连续张量,使离散决策空间与连续物理仿真空间实现统一的可微表征。进而,以最小化电网安全裕度为对抗目标,冻结模型权重并对场景扰动参数执行梯度上升迭代寻优,主动且定向地搜索出针对当前特定调度指令最具威胁性的最劣边界工况,彻底摆脱传统穷举式场景遍历的盲目性。最终,将最劣对抗场景与决策张量联合注入可微代理模型进行瞬态推演,依据越限惩罚值沿梯度下降方向对决策张量实施安全修正,从而实现调度指令在下发前的闭环验证与自适应纠偏,有效解决现有技术中沙箱无法定向暴露AI决策安全边界弱点的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

The application relates to the field of power dispatch, and specifically discloses a digital twin sandbox verification method for power dispatch AI decision, and a differentiable digital twin agent model is constructed through a physical information neural network. On this basis, discrete signals such as opening and closing of circuit breakers in the dispatch instruction are converted into continuous tensors that can participate in gradient operation through continuous relaxation mapping. Further, the minimum power grid safety margin is taken as the confrontation target, the model weight is frozen, and gradient ascent iterative optimization is performed on the scene disturbance parameters, so that the most threatening worst boundary working condition for the current specific dispatch instruction is actively and directionally searched. Finally, the worst confrontation scene and the decision tensor are jointly injected into the differentiable agent model for transient deduction, and safety correction is performed on the decision tensor in the gradient descent direction according to the out-of-limit penalty value, so that the problem that the sandbox cannot directionally expose the safety boundary weakness of the AI decision is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power dispatching, and more specifically, to a digital twin sandbox verification method for power dispatching AI decision-making. Background Technology

[0002] With the widespread application of deep reinforcement learning and large-scale neural networks in power dispatching, AI decision-making systems such as automatic generation control and load transfer strategy generation have gradually participated in the direct control of key power grid equipment. However, the inherent high nonlinearity and lack of interpretability of AI decision-making models make it difficult to predict failure modes. Once a decision is made incorrectly, it may trigger a chain of failures or even a large-scale power outage. Directly verifying AI decisions in a production environment is extremely risky. Therefore, building a digital twin sandbox verification system that can fully verify the safety of decisions before they are issued, and realizing a closed-loop control mechanism of "verification before execution", has become an urgent need to ensure the safe operation of the power grid.

[0003] In existing technologies, offline verification of power dispatch decisions mainly relies on electromagnetic transient or electromechanical transient simulation software to construct a digital twin environment. After inputting the dispatch command to be executed into the simulation model, the system response is calculated forward under several preset extreme scenarios to evaluate the safety and stability of the decision. However, this approach has a fundamental flaw: its physical simulation engine is essentially a non-differentiable equation solver, and there is no gradient propagation path between the generation of the verification scenario and the AI ​​decision feature space. This means that the sandbox system can only serve as a passive "black box testbed," relying on exhaustive methods or fixed-script scenario injection for forward calculation, unable to use mathematical means to reverse-engineer the most threatening combination of boundary conditions for the current specific decision command. Since the vulnerabilities of AI decisions are often hidden in extremely tricky multi-dimensional feature coupling regions, the traditional forward traversal method has extremely low search efficiency in high-dimensional scene spaces, easily overlooking low-probability fatal scenarios that could actually trigger power grid over-limits or even collapse. In other words, existing sandboxes lack the ability to proactively and adversarially optimize AI decisions, failing to expose the safety boundary weaknesses of the decisions, thus rendering the verification process meaningless as a safety barrier.

[0004] Therefore, we hope to find a digital twin sandbox verification method for power dispatching AI decision-making that can establish a differentiable gradient transmission path from the verification scenario to the decision variables, actively search for the worst boundary conditions of the current dispatching command through adversarial reverse optimization, and make safe corrections to the decision accordingly. Summary of the Invention

[0005] To address the aforementioned technical challenges, this application is proposed. According to this application, a digital twin sandbox verification method for power dispatch AI decision-making includes: S1, fusing and training multi-source measurement data and power grid physical topology data based on a physical information neural network to obtain a differentiable digital twin proxy model; S2, performing continuous relaxation mapping on discrete circuit breaker opening and closing signals in the dispatch instruction set to be verified and concatenating them with continuous values ​​of unit output adjustment in the same set to obtain a relaxation decision tensor; S3, inputting the relaxation decision tensor and initial scenario disturbance parameters into the differentiable digital twin proxy model, and using the minimization of the power grid safety margin prediction as the adversarial objective, performing gradient ascent backpropagation iterative optimization on the scenario disturbance parameters to obtain the worst-case adversarial scenario tensor; S4, jointly injecting the worst-case adversarial scenario tensor and the relaxation decision tensor into the differentiable digital twin proxy model for transient simulation to obtain a comprehensive over-limit penalty value; S5, determining whether the relaxation decision tensor needs correction based on the comprehensive over-limit penalty value to output an executable safe dispatch instruction.

[0006] Compared with existing technologies, this application provides a digital twin sandbox verification method for power dispatch AI decision-making. This method addresses the core bottleneck of traditional simulation engines' non-differentiability, which prevents adversarial reverse optimization of AI decisions in verification scenarios. It constructs a differentiable digital twin proxy model by replacing the traditional equation solver with a physical information neural network, thereby establishing a complete gradient propagation path from system response to scenario and decision variables within the sandbox. Based on this, discrete signals such as circuit breaker opening and closing in dispatch instructions are transformed into continuous tensors that can participate in gradient calculations through continuous relaxation mapping, enabling a unified differentiable representation of the discrete decision space and the continuous physical simulation space. Furthermore, with minimizing the power grid safety margin as the adversarial objective, the model weights are frozen, and gradient ascent iterative optimization is performed on the scenario disturbance parameters. This proactively and purposefully searches for the most threatening worst-case boundary conditions for the current specific dispatch instruction, completely eliminating the blindness of traditional exhaustive scenario traversal. Finally, the worst-case adversarial scenario and the decision tensor are jointly injected into the differentiable proxy model for transient extrapolation. Based on the penalty value for exceeding the limit, the decision tensor is safely corrected along the gradient descent direction. This enables closed-loop verification and adaptive correction of scheduling instructions before issuance, effectively solving the problem that sandboxes cannot expose the weaknesses of AI decision security boundaries in existing technologies. Attached Figure Description

[0007] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0008] Figure 1 This is a flowchart of a digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application.

[0009] Figure 2 This is a schematic diagram of data flow for a digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application.

[0010] Figure 3 This is a flowchart of step S1 in the digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application.

[0011] Figure 4 This is a flowchart of step S3 in the digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application. Detailed Implementation

[0012] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure may be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure.

[0013] Due to the remaining shortcomings in the aforementioned technical fields, a digital twin sandbox verification method for AI decision-making in power dispatching is proposed. For example... Figure 1 and Figure 2 As shown, Figure 1 This is a flowchart of a digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application. Figure 2 This is a schematic diagram of data flow for a digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application.

[0014] In detail, step S1 involves fusing and training multi-source measurement data and physical topology data of the power grid based on a physical information neural network to obtain a differentiable digital twin surrogate model. It is understandable that traditional power dispatch sandbox verification relies on electromagnetic transient or electromechanical transient simulation software as the physical equation solver. These solvers iteratively solve differential-algebraic equations using discretized numerical integration, and their internal calculation process lacks analytical differentiability for external input variables. When it is necessary to trace back which scenario disturbance combination is most likely to trigger a safety violation of the current dispatch command, the verification system cannot efficiently locate the vulnerable boundaries of the decision through backpropagation because there is no continuous differentiable gradient propagation path between the simulation engine output and input. To establish a complete gradient path from system response to scenario variables and decision variables within the sandbox, step S1 is introduced to provide a mathematical basis for subsequent adversarial scenario optimization and decision gradient correction.

[0015] Figure 3This is a flowchart of step S1 in the digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application. Figure 3 As shown, in one optional implementation of this application, step S1 includes: S11, extracting node connection relationship edge tables from the power grid physical topology data to construct a global adjacency matrix of the power grid, and injecting the generator node active power sequence, bus voltage amplitude vector, and line phase angle difference matrix from the multi-source measurement data of the power grid into the global adjacency matrix of the power grid according to the spatial node mapping rules to obtain the spatiotemporal feature map data of the power grid; S12, inputting the spatiotemporal feature map data of the power grid into the physical information neural network in batches for forward propagation and physical constraint loss calculation to obtain a loss function with physical constraints; S13, taking the derivative of the loss function with physical constraints based on the backpropagation algorithm and iteratively updating the network weights along the gradient descent direction until convergence to obtain a differentiable digital twin surrogate model.

[0016] The specific implementation process of step S1: The multi-source measurement data of the power grid comes from various sensing terminals deployed in the wide-area measurement system of the power system. Specifically, the multi-source measurement data of the power grid in this application includes the active power sequence of generator nodes, the bus voltage amplitude vector, and the line phase angle difference matrix. Among them, the active power sequence of generator nodes is continuously collected by power transmitters distributed in each power plant at a fixed sampling period and sent to the dispatch master station through the remote control channel, recording the active power output change trajectory of each generator within a continuous time window. The bus voltage amplitude vector is obtained by real-time measurement by voltage transformers installed at the bus of each substation, reflecting the voltage level distribution of each voltage node in the entire network at the same time. The line phase angle difference matrix is ​​synchronously collected by synchronous phasor measurement devices deployed at both ends of the transmission line and calculated by timestamp alignment, characterizing the voltage phase angle deviation relationship between the nodes at both ends of each transmission branch. The power grid physical topology data comes from the power grid model database of the dispatch master station. It includes the electrical connection relationships of primary equipment such as bus sections, circuit breakers, and disconnect switches in substations, as well as the information on the ownership of the first and last nodes of transmission lines. This data is updated in real time according to the equipment commissioning and decommissioning status and is stored in the form of a node-branch association table.

[0017] When constructing the spatiotemporal feature map data of the power grid, the node connection relationship edge table is first extracted from the power grid physical topology data. Specifically, all circuit breaker and transmission line records in the power grid model database that are in closed operation are traversed, and the first and last node numbers of each valid electrical path are extracted into an ordered pair of nodes. The set of all ordered node pairs constitutes the node connection relationship edge table. Taking a regional power grid as an example, if the power grid contains 118 electrical nodes and 186 valid transmission branches, the node connection relationship edge table contains 186 ordered node pairs. Based on this edge table, a global adjacency matrix of the power grid is constructed. This matrix is ​​a square matrix with a dimension equal to the total number of nodes, i.e., a binary matrix of 118 rows by 118 columns. If there is a valid electrical connection between node i and node j, the corresponding element is set to 1; otherwise, it is set to 0.

[0018] Subsequently, the multi-source measurement data of the power grid is injected into the global adjacency matrix of the power grid according to the spatial node mapping rules. The spatial node mapping rules refer to mapping each measurement signal to the node index of the adjacency matrix according to its physical installation location. For the active power sequence of generator nodes, the active power output time-series data vector collected by each generator in the most recent time window is mapped to the row index position corresponding to the bus node it is connected to. For the bus voltage amplitude vector, the voltage amplitude scalar of each node is directly filled into the corresponding node index position. For the line phase angle difference matrix, the phase angle difference between the nodes at both ends of each branch is filled into the corresponding matrix position according to the first and last node index relationship in the side table. Taking the above 118-node power grid as an example, since this method needs to support transient-level extrapolation, the multi-source measurement data of the power grid adopts transient time-series waveform data based on high-frequency sampling of a wide-area measurement system. If the sampling time window contains 250 time steps (e.g., a simulation time step of 0.02 seconds corresponds to a 5-second time window), then each generator node corresponds to an active power time-series vector of length 250, each node corresponds to a voltage amplitude scalar at each time step, and each branch corresponds to a phase angle difference scalar at each time step. After performing multi-frame time-series aggregation processing on the above measurement data and the adjacency matrix, the resulting spatiotemporal feature map data of the power grid can be represented as a set of graph sequences with the adjacency matrix as the structural skeleton and the multi-dimensional measurement features of each node as attributes. The node feature dimension of each frame of the graph includes three channels: active power, voltage amplitude, and phase angle difference. The time-series direction contains 250 frames, and the overall structure constitutes structured data that integrates topological constraints and dynamic time-series features.

[0019] The specific architecture of the physical information neural network consists of three cascaded parts: a graph convolutional feature extraction layer, a temporal aggregation layer, and a fully connected prediction layer. The graph convolutional feature extraction layer employs a multi-layer graph convolutional network structure, with each layer containing trainable weight matrices and bias vectors. Neighborhood aggregation operations guided by adjacency matrices spatially correlate and encode the multi-dimensional measurement features of each node. The temporal aggregation layer uses a gated recurrent unit structure to perform sequential modeling of the multi-frame node embedding vectors output by the graph convolutional layer along the time dimension, extracting the temporal evolution law of the power grid state. The fully connected prediction layer maps the output of the temporal aggregation layer to a state prediction tensor for all nodes in the power grid, including predicted voltage amplitude, active power injection, and reactive power injection values ​​for each node. The initial values ​​of all trainable weight matrices and bias vectors in the network are set using a uniformly distributed random initialization method. The specific range is determined by the inverse square root of the input and output dimensions of each layer. For example, for the first-layer graph convolutional weight matrix with an input dimension of 3 and an output dimension of 64, its initialization range is set to uniformly random values ​​between -0.2 and +0.2.

[0020] The spatiotemporal feature map data of the power grid is input into the physical information neural network in batches according to a fixed batch size for forward propagation. Taking a batch size of 32 as an example, 32 frames of spatiotemporal feature map data are fed into the network each time. After spatial feature extraction by the graph convolutional layer, time series modeling by the temporal aggregation layer, and mapping by the fully connected layer, the output is a prediction state tensor with dimensions of 32 x 118 x 3. Based on this, a loss function with physical constraints is calculated. This loss function is composed of a weighted sum of the data-driven error term and the physical soft constraint error term, and its mathematical expression is:

[0021] in, This represents the total scalar value of the loss function with physical constraints; This is a weighted hyperparameter for the data-driven error term, used to adjust the contribution ratio of the fitting accuracy term to the total loss. Its value is determined through cross-validation, such as taking a value of 1.0. This is a weighted hyperparameter for the physical soft constraint error term, used to control the strength of the physical violation penalty, such as a value of 0.01; This represents the total number of node samples participating in the calculation in the current batch; This is the state prediction vector output by the network for the i-th node, which includes the voltage magnitude and power prediction values. This is the vector of actual measurement values ​​extracted from the spatiotemporal feature map data of the power grid for the i-th node; This represents the square operation of the second norm of a vector, which is the sum of the squares of the differences between its components; The active power balance violation residual of the i-th node is the unbalanced quantity calculated after substituting the predicted state into the Kirchhoff active power flow equation. Let represent the reactive power balance violation residual of the i-th node, which is the difference between the reactive power injection predicted by the network and the theoretical reactive power calculated by substituting into the expanded Kirchhoff reactive power flow analytical equations. The Kirchhoff active power flow equations and Kirchhoff reactive power flow equations involved are nodal power analytical equations rigorously derived from Kirchhoff's current law for power systems. The specific derivation process is as follows: Based on the global adjacency matrix and branch parameters of the power grid, a complex admittance matrix for each node is constructed. The injected complex power of any node is expressed as the product of the predicted voltage phasor of that node and the conjugate of the predicted current phasors of all associated branches flowing out of that node. This is then expanded using Euler's formula and the real and imaginary parts are separated. Therefore, the aforementioned active power balance violation residual is the difference in imbalance obtained by subtracting the predicted active power injection from the i-th node output by the physical information neural network from the predicted voltage amplitude, predicted line phase angle difference, and conductance and susceptance elements of the admittance matrix of the entire network's adjacent nodes, and then substituting these values ​​into the theoretical active power calculated by the aforementioned expanded Kirchhoff active power flow analytical equation.

[0022] Taking a system baseline capacity of 100 MVA as an example, if the physical information neural network directly predicts that the active power injection of a power plant node is 1.25 per unit (equivalent to 125 MW), and using the voltage amplitude of the node (1.02 per unit), the voltage amplitude of its adjacent receiving-end node (0.98 per unit), and the phase angle difference, etc., predicted by the network simultaneously, and substituting these into Kirchhoff's active power flow equations, the theoretical active power injection obtained is 1.23 per unit. Then, the active power balance violation residual of this node... With a per-unit value of 0.02, this non-zero residual precisely quantifies the extent to which the current network prediction violates the law of energy conservation in the power grid. The first term in this loss function drives the network output to approximate the actual measured data to ensure fitting accuracy, while the second term forces the network prediction results to satisfy the physical laws of power flow to avoid outputting irrational results that violate basic physical laws. The joint optimization of these two terms enables the trained model to possess both data fitting ability and physical consistency.

[0023] The loss function with physical constraints is trained by calculating its derivative based on the backpropagation algorithm. Specifically, the chain rule is used to analytically calculate the loss function layer by layer from the output layer to the input layer. The first-order partial derivatives of all trainable weight parameters in the network are used to form a gradient vector matrix with the same dimension as the weight parameters. An adaptive moment estimation optimizer is then used to update the weight parameters along the gradient descent direction. The initial learning rate is set to 0.001 and gradually decays with each training epoch using a cosine annealing strategy. After each epoch of forward and backward computation on the full dataset, the loss value on the validation set is evaluated. Training is considered converged when the decrease in validation loss is less than a preset convergence threshold of 0.0001 for 50 consecutive epochs. At this point, the weight parameters of all graph convolutional layers, temporal aggregation layers, and fully connected layers in the network are frozen, and the overall network structure and fixed weights are encapsulated and output as a differentiable digital twin surrogate model.

[0024] In detail, step S2 involves continuously relaxing the discrete circuit breaker opening and closing signals in the set of dispatch instructions to be verified and concatenating them with the continuous values ​​of unit output adjustment in the same set to obtain a relaxed decision tensor. Correspondingly, the set of dispatch instructions to be verified generated by the power dispatch AI contains two distinct types of control signals: one is the discrete circuit breaker opening and closing signal, whose value is only 0 or 1, representing the open or closed state of a branch; the other is the continuous value of unit output adjustment, whose value is the active power adjustment amount in the continuous real number domain. The differentiable digital twin surrogate model constructed in step S1 operates based on the automatic differentiation mechanism of a neural network, requiring all input variables to be in a continuously differentiable space before backpropagation gradient calculation can be performed. However, the non-zero or one-valued characteristic of the discrete circuit breaker opening and closing signal means that its gradient is zero or non-existent at the switching boundary. If directly input into the differentiable surrogate model, the gradient propagation path will break at the discrete variables, preventing subsequent adversarial scenario optimization and decision correction from reaching these control variables through the chain rule. Step S2 is to eliminate the blocking effect of discrete variables on gradient propagation, so that all decision dimensions in the scheduling instruction set are included in the differentiable computation graph.

[0025] In one optional implementation of this application, step S2 includes: performing decision feature decoupling and discrete signal continuous mapping on the scheduling instruction set to be verified to obtain continuous values ​​of unit output adjustment and continuous virtual admittance variables; based on the grid topology node space index, aligning and filling the continuous virtual admittance variables and continuous values ​​of unit output adjustment with channel layers respectively, and performing tensor splicing and fusion along the depth feature channel dimension to obtain relaxed decision tensors.

[0026] The specific implementation process of step S2: The set of dispatch instructions to be verified comes from the output interface of the power dispatch AI decision model. Its content is a set of control actions to be executed generated by the dispatch AI for the current power grid operating conditions. The instruction set consists of two parts in data structure: The first part is the discrete signal of circuit breaker opening and closing, which is stored in the form of a binary matrix. Each row of the matrix corresponds to a circuit breaker device. A value of 1 indicates that the circuit breaker is in the closed state, that is, the corresponding branch is conducting, and a value of 0 indicates that the circuit breaker is in the open state, that is, the corresponding branch is disconnected. The second part is the continuous value of unit output adjustment, which is stored in the form of a real number vector. Each component of the vector corresponds to the active power adjustment increment of a generator unit. Positive values ​​indicate increased output and negative values ​​indicate decreased output. The unit is megawatts. Using the 118-node power grid example from step S1, the power grid contains 54 generator units and 186 circuit breakers arranged on 186 transmission branches. The discrete signal of circuit breaker opening and closing is a binary column vector of 186 rows and 1 column, and the continuous value of generator output adjustment is a real number column vector of 54 rows and 1 column.

[0027] When decoupling decision features from the dispatch instruction set to be verified, the instruction set is structurally decomposed according to the control semantics of the power grid physical equipment. Continuous values ​​of unit output adjustment are directly extracted as bypass outputs, as they inherently possess continuous differentiability and require no additional transformation. Discrete circuit breaker opening and closing signals are extracted synchronously to form an intermediate-state discrete switching signal matrix. Taking the aforementioned 118-node power grid as an example, this discrete switching signal matrix has a dimension of 186 rows and 1 column, where each element takes a strictly 0 or 1 value.

[0028] To ensure that the discrete switching signal matrix meets the mathematical requirement of global differentiability and derivativeability, a steep sigmoid function is used for continuous relaxation mapping, the mathematical expression of which is:

[0029] in, The virtual admittance continuous variable obtained after mapping has the same dimension as the discrete switching signal matrix, that is, a real number column vector with 186 rows and 1 column, and each element takes a value between 0 and 1 in the open interval. It is a discrete switching signal matrix composed of discrete circuit breaker opening and closing signals, where each element takes the value of 0 or 1; The temperature coefficient hyperparameter controls the steepness of the sigmoid function. A larger value results in the mapped continuous variable more closely approximating the 0 or 1 boundaries of the original discrete value, while maintaining a non-zero gradient in the intermediate region. This hyperparameter is determined by observing the numerical stability of the gradient during the training phase, and its value ranges from 10 to 50; in this embodiment, it is set to 20. The value 0.5 represents the center offset of the sigmoid function, used to align the decision boundary of the discrete signal to the symmetric center point of the function. When the value is 20, for a circuit breaker signal with an original value of 1, the output value after mapping is approximately 0.9999; for a circuit breaker signal with an original value of 0, the output value after mapping is approximately 0.0001. Both are extremely close to the original discrete values ​​but maintain continuous differentiability. Their derivatives at any point are non-zero finite values, thus ensuring that the gradient can be propagated completely along the variable. The physical meaning of the virtual admittance continuous variable is the equivalent conduction degree of the corresponding branch. A value close to 1 indicates that the branch is almost fully conductive, and a value close to 0 indicates that the branch is almost completely disconnected.

[0030] After obtaining the continuous variables of virtual admittance and unit output adjustment, channel layer alignment and tensor splicing are performed on both based on the grid topology node spatial index. The grid topology node spatial index table is derived from the grid model database used in step S1 when constructing the global adjacency matrix of the grid. This index table records the unified number of all 118 electrical nodes in the network and the mapping relationship between each device (generator, circuit breaker) and its associated node number. Specifically, the index table contains the bus node number to which each generator is connected, as well as the first and last node numbers of the branch where each circuit breaker is located.

[0031] The specific process of channel layer alignment and filling is as follows: A first characteristic channel layer is constructed to accommodate the virtual admittance continuous variable. This channel layer has a dimension of 118 rows and 1 column, corresponding to 118 nodes in the entire network. Each element in the 186-dimensional virtual admittance continuous variable is mapped to the corresponding row position of the first channel layer according to the starting node number of the branch where its corresponding circuit breaker is located. For nodes associated with multiple branches, the average value is used for filling; for pure load nodes not associated with any circuit breaker, zero values ​​are used for filling. A second characteristic channel layer is constructed to accommodate the unit output adjustment continuous value. This channel layer also has a dimension of 118 rows and 1 column. Each component in the 54-dimensional unit output adjustment continuous value is mapped to the corresponding row position of the second channel layer according to the bus node number to which its corresponding generator is connected. For non-power supply nodes without generators, zero values ​​are used for filling. After the above alignment and filling, both channel layers have a unified dimension of 118 rows and 1 column, and their row indices are completely consistent with the node indices of the global adjacency matrix of the power grid in step S1.

[0032] Next, tensor concatenation and fusion are performed on the two aligned channel layers along the depth feature channel dimension. The first and second channel layers are concatenated in the column direction to obtain a two-dimensional tensor with a dimension of 118 rows and 2 columns. The first column stores the node mapping values ​​of the virtual admittance continuous variable, and the second column stores the node mapping values ​​of the unit output adjustment continuous value. This 118-row, 2-column two-dimensional tensor is the relaxation decision tensor. All its elements are continuous real values ​​and differentiable everywhere. The row dimension is aligned with the node input dimension of the differentiable digital twin agent model, and the channel dimension fully encodes the two types of decision information in the scheduling instruction set: topology control and output adjustment.

[0033] In detail, step S3 involves inputting the relaxed decision tensor and the initial scenario disturbance parameters into the differentiable digital twin surrogate model. The scenario disturbance parameters are then iteratively optimized using gradient ascent and backpropagation with the goal of minimizing the predicted grid safety margin, to obtain the worst-case adversarial scenario tensor. It should be understood that the relaxed decision tensor output in step S2 has encoded all the control intentions of the scheduling AI into a continuously differentiable unified representation. However, it remains unknown under what external disturbance scenarios this decision is most likely to trigger grid safety exceedances. External disturbances faced in actual power system operation include multi-dimensional uncertainties such as fluctuations in new energy output, sudden load changes, and random equipment failures. Their combination space grows exponentially, and traditional exhaustive or fixed-script scenario enumeration methods cannot cover truly threatening boundary conditions within a limited verification time. The differentiable digital twin surrogate model constructed in step S1 provides a complete differentiable computational graph path between scenario variables and grid safety responses, making the directional search for the most dangerous scenario along the gradient direction via backpropagation a mathematically feasible operation. Step S3 can proactively and efficiently locate the worst-case boundary condition that is most likely to cause the decision to fail, given the current scheduling decision, by using gradient information. This replaces blind search with mathematical optimization, ensuring that sandbox verification can accurately cover the security weaknesses of the current decision.

[0034] Figure 4 This is a flowchart of step S3 in the digital twin sandbox verification method for power dispatch AI decision-making according to an embodiment of this application. Figure 4 As shown, in one optional implementation of this application, step S3 includes: S31, jointly injecting the relaxed decision tensor and the initialization scene perturbation parameters into the differentiable digital twin agent model for joint simulation and deduction to obtain the adversarial target loss scalar; S32, freezing the network weights of the differentiable digital twin agent model, and extracting the perturbation gradient tensor by backpropagating the adversarial target loss scalar with respect to the initialization scene perturbation parameters using the chain rule; S33, performing multiple rounds of iterative updates on the initialization scene perturbation parameters along the rising direction of the perturbation gradient tensor, and using the physical feasible region projection function to perform amplitude truncation constraints after each round of updates until convergence to obtain the worst adversarial scenario tensor.

[0035] The specific implementation process of step S3 is as follows: Obtain the initial scenario disturbance parameters characterizing the uncertainty of the external operating environment of the power grid. These initial scenario disturbance parameters are a set of adjustable variables characterizing the uncertainty of the external operating environment of the power grid. Their data structure is consistent with the node feature dimension of the power grid spatiotemporal characteristic map data in step S1, being a 118-row, 3-column real number matrix. The first column corresponds to the active power output disturbance increment of each generator node, the second column corresponds to the voltage amplitude disturbance increment of each node, and the third column corresponds to the phase angle difference disturbance increment of each branch. The initial value of this parameter is filled with small-amplitude uniform random numbers centered at zero, with a specific range set within ±1% of the rated value of each physical quantity. Using the aforementioned 118-node power grid example, the initial values ​​for the active power output disturbance series at generator nodes are randomly generated within the range of -1 MW to +1 MW; the initial values ​​for the bus voltage amplitude disturbance series are randomly generated within the range of -0.01 per unit to +0.01 per unit; and the initial values ​​for the line phase angle difference disturbance series are randomly generated within the range of -0.01 radians to +0.01 radians. This small-amplitude initialization strategy ensures that iterative optimization starts from a physically reasonable near-equilibrium point, avoiding excessively large initial values ​​that could cause the surrogate model to enter the extrapolation distortion region.

[0036] When constructing the joint input stimulus, to strictly match the input feature dimension of the surrogate model solidified after the pre-training convergence in step S1, and to avoid the mismatch of the computational graph matrix dimension when the weight parameters are frozen, it is necessary to perform differentiable mapping and reconstruction of the relaxed decision tensor and the initial scenario disturbance parameters in accordance with the basic physical mechanism of the power grid. Specifically, firstly, the baseline operating section before the power grid is controlled is retrieved, and a baseline state feature tensor with a dimension of 118 rows and 3 columns is extracted. Subsequently, the second column (continuous value of unit output adjustment) is extracted from the relaxed decision tensor with a dimension of 118 rows and 2 columns output in step S2, and the first column (active power output disturbance) is extracted from the initial scenario disturbance parameters. These two are linearly added linearly along the node index and superimposed as the active power increment to the first column (active power channel) of the baseline state feature tensor. At the same time, the second column (voltage disturbance) and the third column (phase angle difference disturbance) of the initial scenario disturbance parameters are accumulated and injected into the second and third columns of the baseline state feature tensor, respectively, to generate a joint update feature tensor with a dimension of 118 rows and 3 columns that remains unchanged and retains the original network interface form. Simultaneously, the first column of the relaxed decision tensor (the continuous variable of the virtual admittance node) is extracted, and it is inversely expanded into a 186-dimensional branch connectivity equivalent weight buffer vector based on the node-branch mapping index. Then, element-wise Hadamard products are performed with the corresponding edge attributes of the global adjacency matrix of the power grid constructed in step S1. The forward tracking state of the computation graph of the differentiable digital twin agent model trained in step S1 is activated, and the joint update feature tensor with a 118-row, 3-column structure and the updated weighted adjacency graph structure are simultaneously injected into the input port of the graph convolutional feature extraction layer. Guided by the updated weighted adjacency graph structure containing differentiated connection features, the joint update feature tensor diffuses the effects of topology changes and power adjustments across the entire network through neighborhood feature aggregation operations. After node neighborhood feature aggregation by the graph convolutional layer, dynamic evolution deduction by the temporal aggregation layer, and state mapping by the fully connected prediction layer, a 118-row, 3-column full-node state prediction matrix is ​​output, containing the predicted voltage amplitude, predicted active power injection, and predicted reactive power injection for each node. Based on this, the predicted value of the power grid safety margin is calculated as follows: The predicted voltage amplitude of each node is extracted from the full node state prediction matrix, and the minimum distance between it and the corresponding node voltage safety upper and lower limits is calculated; the predicted power flow value of each branch is extracted, and the minimum distance between it and the corresponding line thermal stability limit is calculated; the minimum value among all the above distance values ​​is taken as the predicted value of the power grid safety margin. A positive value indicates that the power grid is operating within the safety domain, and a negative value indicates that a limit breach has occurred. Taking the negative sign of the safety margin prediction value yields the scalar of the adversarial target loss, which mathematically means that the smaller the safety margin, i.e., the closer the power grid is to the collapse boundary, the larger the scalar of the adversarial target loss. This transforms the engineering problem of finding the most dangerous scenario into a mathematical optimization problem of maximizing the loss scalar.

[0037] When extracting the perturbation gradient tensor, all network weight parameters of the graph convolutional layer, temporal aggregation layer, and fully connected prediction layer in the differentiable digital twin agent model are first frozen, so that they do not participate in the update during subsequent backpropagation and only serve as fixed computational paths. Simultaneously, the initialization scene perturbation parameters are marked as active leaf node variables in the computation graph, i.e., the only adjustable parameters allowed to receive gradient backpropagation. The automatic differentiation engine is invoked to propagate the adversarial target loss scalar backwards from the output layer to the input layer along the topological computation graph of the differentiable agent model, calculating the first-order partial derivative of the adversarial target loss scalar with respect to the initialization scene perturbation parameters according to the chain rule of differentiation. The mathematical expression of this partial derivative is:

[0038] in, For the perturbation gradient tensor, its dimensions are exactly the same as the initialization scene perturbation parameters, i.e., a real matrix of 118 rows and 3 columns; To counteract the target loss scalar, i.e., the negative value of the safety margin prediction; This initializes the scenario perturbation parameters. The physical meaning of each element in the perturbation gradient tensor is: the rate of change of the scalar of the adversarial target loss when the perturbation of the corresponding physical quantity at the corresponding node increases slightly near its current value; that is, the sensitivity of this perturbation dimension to reducing the power grid security margin. The larger the absolute value of the gradient, the more significant the contribution of the perturbation to the deterioration of the power grid security state.

[0039] The initial scene perturbation parameters are updated iteratively in multiple rounds along the ascending direction of the perturbation gradient tensor. The mathematical expression for a single round of update is:

[0040] in, These are the scene perturbation parameters updated in the current round; The learning rate step size for scenario adversarial evolution is used to control the magnitude of the perturbation parameter moving along the gradient direction in each iteration. This value is determined through pre-experiment adjustment and needs to achieve a balance between search efficiency and numerical stability. In this embodiment, it is set to 0.01. This is the perturbation gradient tensor calculated in the current round; This is the projection function of the physical feasible region, used to limit and truncate the superimposed disturbance parameters to ensure that the updated scenario parameters do not exceed the actual physical feasible range of the power grid.

[0041] The physical feasible region projection function is implemented as an element-wise amplitude truncation operation, and its constraint boundary is derived from the actual grid disturbance boundary. The actual grid disturbance boundary is determined by the grid's historical operating statistics and equipment nameplate parameters: For the active power output disturbance series of generator nodes, its upper and lower limits are set at ±30% of the node's installed capacity. Taking a wind farm node with a rated capacity of 200 MW as an example, the allowable range of active power output disturbance for this node is -60 MW to +60 MW, corresponding to extreme conditions where wind power output drops from the rated value to 40% or rises to 130%; For the bus voltage amplitude disturbance series, its upper and lower limits are set at ±10% of the rated voltage, i.e., ±0.1 per unit value; For the line phase angle difference disturbance series, its upper and lower limits are set at ±0.3 radians, corresponding to an extreme phase angle offset of approximately ±17 degrees. When an element exceeds its corresponding upper or lower bound after gradient superposition, the physical feasible region projection function truncates it to the boundary value, thereby ensuring that the generated adversarial scenario is physically feasible, rather than a fictional extreme that is mathematically possible but engineering impossible.

[0042] During the multi-round iterative update process, each round repeats the complete loop of forward inference to calculate the adversarial target loss scalar, backpropagation to extract the perturbation gradient tensor, superimposing and updating along the gradient ascent direction, and projecting and truncating. The iteration termination condition is set as follows: convergence is determined when the absolute value of the difference between the adversarial target loss scalars of two adjacent rounds is less than a preset convergence threshold, such as 0.001, or when the cumulative number of iterations reaches a preset maximum number of rounds, such as 200, it is forcibly terminated. In this embodiment, the adversarial target loss scalar tends to stabilize after about 80 to 120 iterations. The scenario perturbation parameter at the convergence time is the worst adversarial scenario tensor, which has a dimension of 118 rows and 3 columns. It encodes the combination of external operating environment perturbations that are most likely to cause the power grid safety margin to drop to the minimum or even trigger over-limit under the action of the scheduling command represented by the current relaxation decision tensor.

[0043] In detail, step S4 involves jointly injecting the worst-case adversarial scenario tensor and the relaxed decision tensor into a differentiable digital twin surrogate model for transient simulation to obtain a comprehensive limit-crossing penalty value. It is understandable that step S3, through adversarial gradient ascent optimization, has identified the worst-case boundary condition most threatening to the current dispatch decision. However, this scenario tensor only characterizes the extreme combination of external disturbance conditions and does not reveal the actual dynamic response process and the degree of limit crossing of each node and branch of the power grid under the combined effect of this extreme condition and the current dispatch decision. The core criterion for power dispatch safety verification is not the severity of the scenario itself, but whether the dispatch decision under this scenario will lead to specific physical limit-crossing consequences such as node voltage drops exceeding allowable ranges or line power flow exceeding thermal stability limits. The safety margin scalar value used for gradient optimization in step S3 alone is insufficient to complete accurate safety judgment and quantitative assessment, because this scalar only serves as a directional guide rather than a rigorous physical verification result during the iteration process. Step S4 can perform a rigorous physical safety quantification assessment of scheduling decisions under the locked most dangerous working conditions, and output a comprehensive over-limit penalty value that can be directly used for safety judgment and decision correction.

[0044] In one optional implementation of this application, step S4 includes: injecting the worst-case adversarial scenario tensor and the relaxed decision tensor as joint incentives into a differentiable digital twin agent model for transient simulation and response matrix extraction to obtain a full node state response matrix; and performing physical index analysis and comprehensive limit evaluation on the full node state response matrix to obtain a comprehensive limit penalty value.

[0045] The specific implementation process of step S4 is as follows: The differentiable digital twin surrogate model, which was trained and converged and had its weights frozen in step S1, is reset to a pure forward physical temporal extrapolation mode. That is, the gradient accumulation function used for parameter updates in its backpropagation graph is turned off, and only the forward propagation path is retained to perform state extrapolation calculations for continuous time steps. The internal architecture of this model is still the three-layer cascaded structure of graph convolutional feature extraction layer, temporal aggregation layer and fully connected prediction layer described in step S1. All network weight parameters are the values ​​that were fixed after training and convergence in step S1 and do not change in this step.

[0046] The relaxed decision tensor with a dimension of 118 rows and 2 columns, output from step S2, is injected into the differentiable digital twin agent model as an internal control incentive condition. This tensor encodes the topology control and output adjustment commands of the scheduling AI for all nodes in the network. Simultaneously, the worst-case scenario tensor with a dimension of 118 rows and 3 columns, output from step S3, is injected into the model as an external environment deterioration boundary condition. This tensor encodes the combination of external disturbances most likely to trigger safety exceedances under the current scheduling decision. To ensure that the dynamic transient simulation path also adheres to the strict computational graph dimension rules, these two are seamlessly fused using a physical overlay mapping paradigm completely consistent with step S3. That is, the relaxed action commands and the worst-case scenario disturbances are simultaneously applied to the baseline working condition section, and the fused computation generates a joint update feature tensor for the extreme working condition with a dimension of 118 rows and 3 columns. The relaxed tensor is then used to modify the structural edge weights to generate a dynamically updated weighted adjacency graph structure used during the simulation period. Both are used as the joint incentive input group entering the differentiable agent model environment.

[0047] The driver, a differentiable digital twin agent model, performs continuous time-step state extrapolation covering a preset transient simulation window. The transient simulation window is determined based on engineering specifications for power dispatch safety and stability analysis, and must cover the complete period from the moment the disturbance is applied to the end of the power grid's dynamic transition process. In this embodiment, the transient simulation window is set to 0 to 5 seconds, and the simulation time step is set to 0.02 seconds, corresponding to 250 discrete time steps. The selection of this window is based on the fact that the typical decay time constant of the electromechanical transient process of the power system is in the range of 1 to 3 seconds, and a 5-second window can completely cover the transient oscillation process and observe the steady-state recovery trend. At each independent discrete time step interface, the graph convolution feature extraction layer, guided by weighted routing of the dynamically updated weighted adjacency graph structure, performs graph space aggregation of the node state information of the jointly updated feature tensor under extreme operating conditions. Each node aggregates the state information of its neighboring nodes through a message passing mechanism guided by the adjacency matrix, and outputs the node embedding vector at the current moment after multi-layer graph convolution operations. The gated loop unit of the temporal aggregation layer receives the node embedding vector at the current time and the hidden state at the previous time, updates the internal memory state, and outputs a temporal embedding vector that incorporates historical evolution information. The fully connected prediction layer maps the temporal embedding vector to the predicted electrical state of all nodes in the network at the current time, including the predicted voltage magnitude of 118 nodes and the predicted active power flow and reactive power flow of 186 branches.

[0048] After 250 consecutive time steps of simulation, the predicted electrical state of the entire network output at each time step is concatenated in chronological order to form a full-node state response matrix. The specific dimensional structure of this matrix is ​​as follows: the voltage amplitude response submatrix has a dimension of 250 rows by 118 columns, with each row corresponding to a time step and each column corresponding to a node. The element value is the predicted voltage amplitude of that node at that moment, in per-unit values. The active power flow response submatrix has a dimension of 250 rows by 186 columns, with each row corresponding to a time step and each column corresponding to a branch. The element value is the predicted active power flow of that branch at that moment, in megawatts. The reactive power flow response submatrix has a dimension of 250 rows by 186 columns, with the same structure as the active power flow response submatrix. The element value is the predicted reactive power flow, in megavars. These three submatrices together constitute a full-node state response matrix containing spatiotemporal dynamic evolution characteristics, completely recording the entire response trajectory of the power grid from the moment of disturbance to the end of the dynamic transition under the combined effects of the worst-case scenario and the current dispatch decision.

[0049] When performing physical index analysis on the state response matrix of all nodes, the voltage dynamic trajectory of each node within 250 time steps is first extracted from the voltage amplitude response submatrix. The minimum value is then taken along the time dimension for each node, resulting in a 118-dimensional node voltage minimum vector, representing the deepest voltage drop experienced by each node during the entire transient process. Taking a 220 kV bus node in this power grid as an example, its rated voltage per unit is 1.0. If the voltage drops to a minimum of 0.82 per unit during the transient process, the voltage drop depth of this node is 0.18 per unit. Subsequently, the power dynamic trajectory of each branch within 250 time steps is extracted from the active power flow response submatrix and reactive power flow response submatrix. The apparent power value (the square root of the sum of the squares of active power and reactive power) is calculated for each branch at each moment, and then the maximum value is taken along the time dimension, resulting in a 186-dimensional branch apparent power maximum vector. The power flow load factor is obtained by dividing the maximum apparent power of each branch by the corresponding thermal stability rated capacity of the line. Taking a 220 kV transmission line with a rated capacity of 500 MW as an example, if the maximum apparent power during the transient process reaches 480 MW, then the power flow load factor of the branch is 0.96.

[0050] When conducting a comprehensive over-limit assessment of the above physical indicators, it is necessary to set voltage sag depth threshold and power flow load rate threshold. The voltage sag depth threshold is determined based on the allowable range of transient voltage deviation in the power grid safety operation regulations. In this embodiment, it is set to 0.15 per unit, meaning that an over-limit is determined when the node voltage sags by more than 15% of the rated value during a transient process. The power flow load rate threshold is determined based on the thermal stability safety margin requirements of transmission lines. In this embodiment, it is set to 0.90, meaning that an over-limit is determined when the branch power flow load exceeds 90% of the rated capacity. The formula for calculating the comprehensive over-limit penalty value is:

[0051] in, The total penalty value for exceeding the limit is a non-negative scalar. This represents the total number of voltage monitoring nodes; in this embodiment, it represents all 118 nodes. The voltage drop depth of the i-th node is the difference between the rated voltage per unit value of 1.0 and the minimum voltage value of that node. The preset voltage drop depth threshold is set to 0.15 in this embodiment; The total number of transmission lines is 186 in this embodiment; Let be the power flow load rate of the j-th line; The preset power flow load rate threshold is 0.90 in this embodiment; This is a nonlinear rectification function. When the value within the parentheses is negative, the output is zero; when the value within the parentheses is positive, the output is the original value. Its function is to precisely filter out normal fluctuations that do not exceed the safety threshold, retaining only the positive values ​​exceeding the limit for accumulation. The voltage exceedances of all nodes and the power flow exceedances of all lines are linearly accumulated and aggregated to obtain a single scalar indicator reflecting the severity of the safety consequences of the scheduling decision under the worst-case scenario. When the comprehensive exceedance penalty value is zero, it indicates that the current scheduling decision did not cause any node voltage or line power flow exceedances under the worst-case scenario, and the safety of the decision is verified. When the comprehensive exceedance penalty value is greater than zero, its magnitude directly quantifies the severity of the exceedance; a larger value indicates a wider range or greater depth of exceedances. Taking the specific example above, if the voltage drop depth of a node is 0.18 per unit, then the over-limit penalty contributed by that node is max(0, 0.18-0.15) = 0.03; if the power flow load rate of a line is 0.96, then the over-limit penalty contributed by that line is max(0, 0.96-0.90) = 0.06. The total over-limit penalty value is obtained by summing the over-limit penalties of all nodes and lines in the entire network.

[0052] In detail, step S5 determines whether the relaxed decision tensor needs modification to output an executable safe scheduling instruction based on the comprehensive over-limit penalty value. That is, the comprehensive over-limit penalty value output in step S4 quantifies the safety consequences of the scheduling decision under the worst-case scenario into a single scalar indicator, but this indicator only has an evaluation function and no corrective capability. If the comprehensive over-limit penalty value is greater than zero, it indicates that the decision instruction generated by the current scheduling AI will cause the voltage of the grid nodes or the power flow of the lines to exceed the limits under extreme conditions. If the decision is directly rejected and the scheduling AI is forced to regenerate it, it not only prolongs the decision verification cycle, but also makes it difficult for the scheduling AI to guarantee that the regenerated decision can avoid the same safety hazards without guidance from over-limit direction information. The differentiable computation graph constructed in steps S1 to S4 completely preserves the entire gradient path from the decision input to the over-limit penalty output, allowing the first-order partial derivative of the comprehensive over-limit penalty value with respect to the relaxed decision tensor to be directly obtained through backpropagation. This gradient accurately indicates the contribution direction and sensitivity of each decision dimension to the over-limit consequences. Step S5 is to implement adaptive safety correction and closed-loop output of decisions within the sandbox, ensuring that the instructions finally issued to the real power grid do not trigger any safety limits under the verified worst-case conditions.

[0053] In one optional implementation of this application, step S5 includes: determining whether the comprehensive over-limit penalty value is greater than zero; if it is greater than zero, activating the backpropagation engine of the differentiable digital twin agent model; calculating the first-order partial derivative of the comprehensive over-limit penalty value with respect to the relaxed decision tensor using the chain rule of differentiation to obtain the decision correction gradient tensor; performing parameter translation and updating on the relaxed decision tensor along the descent direction of the decision correction gradient tensor to obtain the safety correction decision tensor; and performing inverse discretization and analysis on the safety correction decision tensor to obtain the executable safety scheduling instruction.

[0054] The specific implementation process of step S5 is as follows: A numerical verification judgment is performed on the comprehensive over-limit penalty value output in step S4. The comprehensive over-limit penalty value is a non-negative scalar, and its physical meaning is the linear sum of the total network voltage and power flow over-limit caused by the current scheduling decision in the worst-case scenario. If this value is strictly equal to zero, it indicates that under the most dangerous operating condition identified in step S3, the current scheduling decision did not cause any node voltage drop to exceed the 0.15 per-unit threshold and did not cause any line power flow load rate to exceed the 0.90 threshold. The safety verification of the decision is passed. At this time, no correction is needed for the relaxed decision tensor; the original relaxed decision tensor in step S2 is directly passed to the subsequent reverse discretization and analysis stage. If the comprehensive over-limit penalty value is greater than zero, it indicates that the current scheduling decision caused a physical over-limit under the worst-case scenario, requiring the triggering of a reverse correction calculation mechanism to perform safety correction on the decision.

[0055] Using the aforementioned 118-node power grid example, the comprehensive over-limit penalty value calculated in step S4 is 0.27, which is greater than zero, indicating that there are several nodes with voltage over-limits and line power flow over-limits, triggering the reverse correction mechanism. At this time, the backpropagation engine of the differentiable digital twin proxy model trained and converged in step S1 is activated, restoring the computation graph from the purely forward deduction mode in step S4 to a fully differentiable mode that supports back-gradient differentiation. All network weight parameters of the graph convolutional layer, temporal aggregation layer, and fully connected prediction layer in the differentiable digital twin proxy model are frozen. At the same time, the worst-case adversarial scenario tensor output in step S3 is frozen so that it does not participate in gradient updates. Only the relaxed decision tensor with a dimension of 118 rows and 2 columns output in step S2 is set as the differentiable target node in the computation graph, that is, the only active variable that receives gradient backpropagation.

[0056] By using the chain rule of differentiation, the first partial derivative of the comprehensive over-limit penalty value with respect to the relaxed decision tensor is calculated, thus obtaining the decision correction gradient tensor. Its mathematical expression is:

[0057] in, The decision correction gradient tensor has the same dimensions as the relaxation decision tensor, i.e., a real matrix with 118 rows and 2 columns. The comprehensive over-limit penalty value calculated in step S4 is a scalar, which is 0.27 in this embodiment; This is the relaxed decision tensor output from step S2. The specific computational path of backpropagation is as follows: First, the derivative of the out-of-limit component in the full node state response matrix is ​​calculated using the comprehensive out-of-limit penalty scalar to obtain the sensitivity of the out-of-limit penalty to the node state; then, it propagates backward layer by layer along the fully connected prediction layer, temporal aggregation layer, and graph convolutional layer of the differentiable surrogate model, finally reaching the channel position where the relaxed decision tensor at the input end is located, and extracting the complete first-order partial derivative matrix. The physical meaning of each element in the decision correction gradient tensor is: the rate of change of the comprehensive out-of-limit penalty value when the decision variable at the corresponding position in the relaxed decision tensor increases slightly. Positions with positive gradient values ​​and large absolute values ​​indicate that the increase in the decision dimension contributes significantly to the out-of-limit consequence and should be corrected in the negative direction to reduce the out-of-limit; positions with negative gradient values ​​indicate that the increase in the decision dimension helps to alleviate the out-of-limit.

[0058] The relaxed decision tensor is updated by parameter translation along the descent direction of the decision correction gradient tensor to obtain the safe correction decision tensor, whose mathematical expression is:

[0059] in, To ensure safe correction of the decision tensor, the dimension is 118 rows and 2 columns; For the original relaxed decision tensor; Adjust the learning rate for decision-making; The decision correction gradient tensor is used. The decision correction learning rate is a positive real scalar that controls the magnitude of the shift of the decision parameters along the gradient descent direction. Its setting needs to strike a balance between the effectiveness of safe correction and minimizing decision deviation. If the learning rate is too large, the corrected decision may deviate too far from the original intent of the scheduling AI and lose its economy; if the learning rate is too small, the correction magnitude is insufficient to eliminate the limit violation. The value is determined by selecting a learning rate that reduces the limit violation penalty value to 30% to 50% of the original value after a single step correction based on the statistical distribution relationship between the limit violation penalty value and the magnitude of the decision gradient in historical verification data. This initial setting is then dynamically fine-tuned according to the correction effect during actual operation. In this embodiment, the decision correction learning rate is set to 0.05. Taking the output adjustment value of a generator node in the relaxed decision tensor as 35 MW and its corresponding decision correction gradient value as 1.2, after parameter translation and update, the safe correction output value of the node is 35 - 0.05 × 1.2 = 34.94 MW, that is, the output command of the generator has been fine-tuned in the direction of reducing the limit violation contribution. For a branch in the virtual admittance channel with a relaxation value of 0.9998 and a gradient value of 0.8, the corrected virtual admittance value of this branch is 0.9998 - 0.05 × 0.8 = 0.9598, which is still in the high conduction range close to 1. After translating and updating all 118 rows and 2 columns, a dimension-invariant safety correction decision tensor is obtained. If there is still a possibility of exceeding the limit after correction, the safety correction decision tensor can be reinjected into step S4 for verification. If the overall limit violation penalty value is still greater than zero, gradient descent correction is performed again. This process is repeated until the limit violation penalty value drops to zero or the number of iterations reaches the preset upper limit of 10.

[0060] The safety correction decision tensor is inversely discretized to obtain executable safety dispatch instructions. The safety correction decision tensor has a dimension of 118 rows and 2 columns, where the first column channel represents the correction value of the virtual admittance continuous variable, and the second column channel represents the correction value of the unit output adjustment continuous value. First, feature layer dimensionality reduction and decoupling are performed on the safety correction decision tensor, separating two independent 118-row, 1-column vectors along the channel dimension. For the unit output adjustment continuous value correction vector in the second column channel, based on the mapping relationship between generator nodes and equipment numbers in the power grid topology node space index table, the values ​​corresponding to the positions of 54 generator nodes are extracted, and their continuous real number characteristics are retained as the final generator active power adjustment instructions, in megawatts. For the virtual admittance continuous variable correction vector in the first column channel, an inverse discretization mapping is performed using a hard threshold truncation function to strictly project the intermediate state values ​​in the continuous relaxation space back to the zero-one-binary control domain. Its mathematical expression is:

[0061] in, This is the final discrete circuit breaker control signal vector, where each element strictly takes the value of 0 or 1; The 186-dimensional branch-level virtual admittance correction vector is obtained by inverse mapping of the virtual admittance channels in the safety correction decision tensor through node index; The function is a unit step function. It outputs 1 when the value within the parentheses is greater than or equal to zero, and 0 when the value within the parentheses is less than zero. The value 0.5 is the discretization threshold, corresponding to the center offset of the sigmoid function in step S2. Taking a branch's virtual admittance correction value of 0.9598 as an example, 0.9598 - 0.5 = 0.4598 > 0, therefore the final circuit breaker control signal for this branch is 1, i.e., closed and conducting. Taking another branch's virtual admittance correction value of 0.0003 as an example, 0.0003 - 0.5 = -0.4997 < 0, therefore the final circuit breaker control signal for this branch is 0, i.e., open and disconnected. After the above reverse discretization process, the 186-dimensional continuous virtual admittance vector is strictly restored to a 186-dimensional zero-one binary circuit breaker control signal vector.

[0062] The 54-dimensional generator active power regulation command and the 186-dimensional circuit breaker opening and closing control signal are assembled and packaged according to the standardized communication protocol message format of the power grid dispatch master station. The generator power regulation command is encoded in the form of analog setpoint message, and the circuit breaker control signal is encoded in the form of remote control command message. Together, they constitute an executable and safe dispatch command that can be directly issued to the real power grid for execution. This command set has undergone security verification under worst-case scenarios and gradient-guided directional correction. While maintaining the original economic intention of the dispatch AI decision, it eliminates the potential safety over-limit risks under extreme operating conditions, realizing closed-loop control of dispatch decision verification before execution.

[0063] Specifically, in the digital twin sandbox verification scenario of power dispatch AI decision-making, when the comprehensive over-limit penalty value is greater than zero and triggers the decision correction process, the basic implementation method uses a single scalar learning rate to perform isotropic uniform scaling and translation on all dimensions of the decision correction gradient tensor, in order to push the relaxed decision tensor into the safe and feasible region along the gradient descent direction. However, the relaxed decision tensor is not a homogeneous set of single physical quantities. It encapsulates two types of control signal dimensions with completely different physical natures and strictly constrained by Kirchhoff's laws: one is the topology control dimension, corresponding to the continuous virtual admittance variable of the circuit breaker's on / off state. Small changes in its value will cause a global structural reconstruction of the grid admittance matrix, which in turn leads to a severe network-wide interlocking response in the power flow distribution; the other is the power regulation dimension, corresponding to the continuous value of generator output adjustment, which belongs to the local continuous node injection power regulation operation. There is a strong physical coupling between these two dimensions, determined by the power flow equations. The topology determines the sparse structure of the grid admittance matrix, which in turn directly constrains the feasible domain boundary of the power dimension. If the virtual admittance value of a branch is changed during the correction process, causing it to tend towards disconnection or closure, the power injection of all nodes electrically associated with that branch must be synchronously coordinated and adjusted. Otherwise, a new power flow violation will occur under the corrected new topology. The basic implementation applies a uniform scalar learning rate to all gradient dimensions, which essentially assumes that the sensitivity of each dimension is uniform and that the correction operations of each dimension are independent of each other. This assumption is seriously distorted in power dispatch scenarios: even if the gradient component of the topology dimension is extremely small, the physical consequences it causes are far greater than the local effects produced by the gradient component of the power dimension of the same magnitude. That is, there is an order of magnitude difference in the physical sensitivity of the two dimensions. At the same time, independently performing descent along each dimension is equivalent to cutting off the causal transmission path between topology adjustment and power adjustment, which is very likely to produce a safety correction failure phenomenon that eliminates line overload but introduces node voltage collapse. The quantitative parameter translation update based on second-order cross partial derivatives aims to calculate the cross sensitivity relationship between the topology and power dimensions, assign differentiated adaptive correction step sizes to different physical dimensions, and apply feedforward cross-dimensional coupling compensation. This ensures that decision correction eliminates the original over-limits without introducing new safety risks due to neglecting physical coupling, thereby achieving coordinated correction of topology and power.

[0064] In another preferred implementation of this application, the relaxed decision tensor is updated by parameter translation along the descent direction of the decision correction gradient tensor to obtain the safe correction decision tensor, including: Based on the channel labeling of the relaxed decision tensor, the decision correction gradient tensor is decoupled in terms of dimension to obtain the topological gradient component and the power gradient component. The decision correction gradient tensor with dimensions of 118 rows and 2 columns has already been obtained in the preceding calculation of step S5. The first column of channels corresponds to the virtual admittance control dimension, and the second column corresponds to the unit output adjustment dimension. According to the channel labeling definition used when constructing the relaxed decision tensor in step S2, the decision correction gradient tensor is separated along the column direction: the 118-dimensional vector of the first column is extracted as the topological gradient component, denoted as... Only the node locations associated with the circuit breaker have non-zero gradient values, while the other pure load node locations have zero gradient values; the 118-dimensional vector in the second column is extracted as the power dimension gradient component, denoted as... Of these, only 54 generator nodes have non-zero gradient values, while the remaining non-power node locations have zero gradient values. Using the aforementioned 118-node power grid example, the gradient value of a 220 kV tie-line terminus node in the topology gradient component is 0.85, indicating that an increase in the virtual admittance of this branch significantly contributes to the overall over-limit penalty value. In the power gradient component, the gradient value of a thermal power unit connection node is 1.2, indicating that an increase in the unit's output has a positive aggravating effect on the over-limit penalty. The purpose of this dimensional decoupling operation is to separate the hybrid encoded gradient information according to physical semantics, providing independent gradient inputs for subsequent application of differentiated correction strategies for different dimensions. This allows for separate sensitivity assessments of the topology and power dimension corrections, rather than mixing them together.

[0065] The coupling sensitivity matrix is ​​generated by calculating the second-order cross partial derivatives of the comprehensive over-limit penalty value with respect to the topological and power dimensions of the relaxed decision tensor using a differentiable digital twin surrogate model. This operation utilizes the complete differentiable computation graph within the converged differentiable digital twin surrogate model trained in step S1, performing second-order partial derivative calculations at the current operating point of the relaxed decision tensor. Specifically, the coupling sensitivity matrix is ​​generated by calculating the second-order cross partial derivatives of the comprehensive over-limit penalty value with respect to the topological and power dimensions of the relaxed decision tensor. First, calculate the first-order partial derivative with respect to the k-th topological dimension component of the relaxation decision tensor. Then, calculate the second-order partial derivative with respect to the m-th power dimension component, thus obtaining each element in the coupling sensitivity matrix. Its mathematical expression is:

[0066] in, Coupling sensitivity matrix The value of the element in the k-th row and m-th column; The scalar value of the comprehensive over-limit penalty calculated in step S4; Let be the virtual admittance component at the k-th node position in the topological control channel of the relaxation decision tensor. The value range is from 1 to 118; The unit output component at the m-th node in the relaxation decision tensor power regulation channel. The value range is from 1 to 118 (of which only 54 generator node positions are valid). This represents the second-order cross-partial derivative operation, which takes the partial derivatives of two variables with respect to different physical dimensions. (Coupling sensitivity matrix) The overall dimensions are 118 rows and 118 columns, and its physical meaning is: elements This study quantifies the extent to which a small change in the virtual admittance of the k-th branch alters the sensitivity of the combined over-limit penalty value to the power injection at the m-th node, i.e., the second-order causal propagation strength of the topology adjustment's response to the power dimension over-limit. Taking a critical 220 kV tie line (corresponding to node 37) and its adjacent thermal power unit (corresponding to node 42) in this power grid as an example, the results are calculated... =3.6, indicating that fine-tuning the virtual admittance of this tie line will significantly change the impact of Unit 42's output on the over-limit penalty, and the two are physically coupled very closely. Furthermore, the tie line is connected to a distant wind farm node (corresponding to node 98). =0.02, indicating that the two are electrically far apart and the coupling is extremely weak.

[0067] The coupling sensitivity matrix is ​​aggregated by taking the absolute value of each row to obtain the coupling strength vector. A conservative step size is assigned to the topological dimension based on inverse scaling, and a normalized step size is assigned to the power dimension based on the gradient components of the power dimension to obtain the anisotropic step size matrix. The absolute values ​​of all columns in the k-th row are summed to obtain the coupling strength scalar of the k-th topological dimension. All 118 coupling strength scalars of the topological dimensions form a 118-dimensional coupling strength vector. Based on this coupling strength vector, a conservative step size is assigned to each component of the topological dimension according to an inverse scaling rule. Its mathematical expression is:

[0068] in, The adaptive correction step size for the k-th component of the topological dimension; The base learning rate is consistent with the decision correction learning rate set in step S5, and in this embodiment, the value is 0.05. This is the coupling sensitivity adjustment coefficient, used to control the sensitivity of coupling strength to step size compression. This value is determined through offline simulation calibration, with the calibration target being to compress the step size of high coupling dimensions to one-tenth to one-twentieth of the base learning rate. In this embodiment, it is set to 0.5. The total number of power dimension nodes participating in the calculation is 118 in this embodiment (of which there are 54 effective generator nodes, and the column elements of the remaining nodes are close to zero). Let $\frac{k}{m}$ be the absolute value of the element in the $k$-th row and $m$-th column of the coupling sensitivity matrix; $\sum$ represents the linear summation of the absolute values ​​of all elements in the $k$-th row and all columns. Taking the aforementioned 37th link node as an example, its row-wise absolute value aggregation result is... =12.8, substituting into the formula, we get =0.05 / (1+0.5×12.8)=0.0068, which is much smaller than the base learning rate of 0.05, indicating that topology modifications to this highly coupled link will be significantly suppressed to prevent drastic changes in the entire network's power flow. The row aggregation result for a certain distribution network's end branch (corresponding to node 105) is 0.3. Substituting this into the formula yields... =0.05 / (1+0.5×0.3)=0.0435, which is close to the base learning rate, allowing it to perform relatively fast local corrections.

[0069] For the step size allocation in the power dimension, it is based on the power dimension gradient components. The absolute values ​​of each component are normalized and scaled. Specifically, the maximum absolute value of the gradient component in the power dimension is used as the normalization benchmark. The absolute value of each component is divided by this benchmark to obtain a normalized weight between 0 and 1, which is then multiplied by the base learning rate. This serves as the adaptive step size for each power dimension component. Power dimensions with larger absolute gradient values ​​receive larger correction step sizes, while dimensions with smaller absolute gradient values ​​receive smaller step sizes to avoid overcorrection. Arranging the 118 adaptive step sizes of the topological dimensions and the 118 adaptive step sizes of the power dimensions diagonally forms a diagonal matrix of 236 rows and 236 columns, which is the anisotropic step size matrix. Its diagonal elements are the differentiated step size values ​​specific to each dimension, while all off-diagonal elements are zero. The purpose of this step is to allocate differentiated correction magnitudes according to the physical importance and coupling degree of each dimension. The effect is that highly coupled and highly sensitive topological dimensions are automatically subject to conservative constraints, while low-coupling local dimensions maintain a normal correction rate. The overall correction process achieves fine-grained risk control across each physical dimension.

[0070] The main correction increment is obtained by scaling the decision correction gradient tensor based on the anisotropic step size matrix, and the feedforward compensation is calculated based on the coupling sensitivity matrix and the topological gradient components. Since the relaxed decision tensor has a dimension of 118 rows and 2 columns, with the first column channel representing the topology control dimension and the second column channel representing the power adjustment dimension, the calculation of the main correction increment and the feedforward compensation needs to be performed separately for each channel and then reassembled into a matrix with the same dimension as the relaxed decision tensor.

[0071] For topology control channels, the diagonal matrix with adaptive step size is used in relation to the topology dimension. (A 118-order diagonal matrix, where the diagonal elements represent the positions of each node) ) and topological gradient components Performing matrix-vector multiplication on a (118-dimensional column vector) yields a 118-dimensional topological principal correction vector. For the power adjustment channel, an adaptive step-size diagonal matrix is ​​used. (A 118-order diagonal matrix, where the diagonal elements are the normalized and scaled power step sizes at each node position) and the gradient components in the power dimension. Performing matrix-vector multiplication on the (118-dimensional column vector) yields a 118-dimensional principal power correction vector. The feedforward compensation is obtained by transposing the coupling sensitivity matrix. (118 rows and 118 columns) and topological gradient components The 118-dimensional power feedforward compensation vector is calculated by matrix-vector multiplication of (118-dimensional column vectors), and then multiplied by the coupling compensation strength coefficient. This compensation amount applies only to the power regulation channel to counteract the disturbance to power balance caused by topology correction.

[0072] The main correction increment and feedforward compensation are recombined along the channel to obtain the comprehensive correction matrix. The comprehensive correction matrix is ​​then subtracted from the relaxed decision tensor to obtain the safety correction decision tensor. The topology main correction vector is used as the first column of the correction matrix, and the sum of the power main correction vector and the power feedforward compensation vector is used as the second column. Since only 54 of the 118 nodes in the entire network are actual generators, and the remaining 64 pure load or hub substation nodes do not have the hardware capability to respond to active power regulation commands at the physical level, a generator node mask vector is generated based on the grid topology node spatial index during the channel recombining process. This mask vector is set to 1 at the positions corresponding to the 54 generator nodes, and strictly 0 at the other positions. Before concatenating the topology main correction vector in the first column with the comprehensive power correction vector in the second column, an element-wise Hadamard product operation with the generator node mask vector is performed on the second column to force the virtual power correction amount generated by the feedforward compensation mapping at non-power node positions to be strictly set to zero. Subsequently, the matrix is ​​concatenated and recombined along the channel dimension to form a 118-row, 2-column comprehensive correction matrix. The calculation process of the safety correction decision tensor is expressed as follows:

[0073] in, To safely correct the decision tensor, the dimension is 118 rows and 2 columns, consistent with the dimension of the relaxed decision tensor. The original relaxed decision tensor output from step S2; This is a topologically adaptive step-size diagonal matrix of order 118, where the k-th element on the diagonal is the value calculated using the inverse scaling rule mentioned above. ; The topological gradient components are 118-dimensional column vectors, obtained by decoupling the first column channel of the decision correction gradient tensor. This is a power-dimensional adaptive step-size diagonal matrix of order 118. The m-th element on the diagonal is the result of normalizing the absolute values ​​of the power-dimensional gradient components and multiplying by the base learning rate. The obtained power step size; The gradient component in the power dimension is a 118-dimensional column vector, obtained by decoupling the second column channel of the decision correction gradient tensor. The coupling compensation strength coefficient is set to 0.03 in this embodiment; This is the transpose of the coupling sensitivity matrix, with dimensions of 118 rows and 118 columns. It maps the topology dimension correction to the feedforward compensation to be applied in the power dimension. The two comma-separated parts within the square brackets correspond to the first column (topology channel correction) and the second column (power channel correction including feedforward compensation) of the correction matrix, respectively. In the formula, the first column within the square brackets to the right of the minus sign is the main correction increment for the topology channel, which, after anisotropic conservative step scaling, ensures that the virtual admittance of highly coupled branches undergoes only minor adjustments. The second column is the main correction increment for the power channel, which, after normalized step scaling, allows for differentiated adjustment of generator output according to gradient sensitivity. As the feedforward compensation, the physical disturbances in the power dimension expected to be caused by the topology correction action are pre-superimposed on the power channel correction through the transpose mapping of the coupling sensitivity matrix, thereby achieving synchronous coordination between the topology and power. After the two columns are calculated separately, they are recombined into a comprehensive correction matrix of 118 rows and 2 columns.

[0074] Taking the aforementioned example, the topological gradient value of the 37th connection node is 0.85, after anisotropic step size... After scaling to 0.0068, the principal correction for this dimension is only 0.0068 × 0.85 = 0.0058, which is compressed by about 7 times compared to 0.05 × 0.85 = 0.0425 in the basic method, effectively avoiding drastic changes in the virtual admittance of this critical connection line. Meanwhile, the feedforward compensation term... The 37th column (i.e., the transpose of the 37th row of the original matrix) propagates the topology correction effect of this tie line to the power dimension of the strongly coupled No. 42 thermal power unit node, generating a preventative output compensation of approximately 0.03 × 3.6 × 0.85 = 0.092 MW. This proactively coordinates and adjusts the output of adjacent units while fine-tuning the topology, avoiding secondary limit violations caused by power imbalances under the new topology. In this way, the safety correction decision tensor not only eliminates the original limit violations along the gradient descent direction but also avoids over-correction in highly coupled dimensions through anisotropic step size control. Furthermore, feedforward compensation ensures that the topology and power maintain physical consistency at the new operating point after correction, thus achieving a high success rate and engineering reliability for a single correction.

[0075] After the anisotropic collaborative correction based on the second-order cross partial derivatives, the virtual admittance component of the topology control channel in the safety correction decision tensor is always strictly constrained by a conservative step size to fluctuate within a narrow range extremely close to 0 or 1, rather than being pushed to a fuzzy intermediate state between 0.3 and 0.7 due to an excessively large uniform step size. This characteristic allows for the use of a hard threshold truncation function in the subsequent inverse discretization analytical stage. When performing zero-one projection, a sufficient safety margin is maintained between the virtual admittance value of each branch and the judgment threshold of 0.5. This prevents branches that should remain closed from being mistakenly judged as open, or vice versa, due to excessive correction. In other words, the conservative step size ensures from the source that the correction trajectory in the continuous relaxation space does not exceed the discretization judgment boundary, making the inverse discretization result strictly consistent with the topology intention before correction, and eliminating the risk of topology mis-switching caused by discretization jumps.

[0076] In summary, the digital twin sandbox verification method for power dispatch AI decision-making based on the embodiments of this application is elucidated. It addresses the core bottleneck of traditional simulation engines' non-differentiability, which prevents adversarial reverse optimization of AI decisions in verification scenarios. By replacing traditional equation solvers with physical information neural networks, a differentiable digital twin proxy model is constructed, thereby establishing a complete gradient propagation path from system response to scenario variables and decision variables within the sandbox. Furthermore, discrete signals such as circuit breaker opening and closing in dispatch instructions are transformed into continuous tensors capable of participating in gradient calculations through continuous relaxation mapping, enabling a unified differentiable representation of the discrete decision space and the continuous physical simulation space. Then, with minimizing the power grid safety margin as the adversarial objective, the model weights are frozen, and gradient ascent iterative optimization is performed on the scenario disturbance parameters. This proactively and purposefully searches for the most threatening worst-case boundary conditions for the current specific dispatch instruction, completely eliminating the blindness of traditional exhaustive scenario traversal. Finally, the worst-case adversarial scenario and the decision tensor are jointly injected into the differentiable proxy model for transient extrapolation. Based on the penalty value for exceeding the limit, the decision tensor is safely corrected along the gradient descent direction. This enables closed-loop verification and adaptive correction of scheduling instructions before issuance, effectively solving the problem that sandboxes cannot expose the weaknesses of AI decision security boundaries in existing technologies.

Claims

1. A digital twin sandbox verification method for power dispatch AI decision-making, characterized in that, include: S1, based on the physical information neural network, fuses and trains multi-source measurement data of the power grid and physical topology data of the power grid to obtain a differentiable digital twin proxy model; S2, continuously relax the discrete circuit breaker opening and closing signals in the scheduling instruction set to be verified and concatenate them with the continuous values ​​of unit output adjustment in the scheduling instruction set to be verified to obtain the relaxed decision tensor. S3, the relaxed decision tensor and the initial scenario perturbation parameters are input into the differentiable digital twin agent model, and the scenario perturbation parameters are iteratively optimized by gradient ascent backpropagation with the goal of minimizing the power grid security margin prediction value to obtain the worst adversarial scenario tensor. S4, the worst-case adversarial scenario tensor and the relaxed decision tensor are jointly injected into the differentiable digital twin agent model for transient simulation to obtain the comprehensive limit violation penalty value; S5 determines whether the relaxation decision tensor needs to be modified to output an executable and safe scheduling instruction based on the comprehensive over-limit penalty value.

2. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 1, characterized in that, The multi-source measurement data of the power grid includes the active power sequence of generator nodes, the bus voltage amplitude vector, and the line phase angle difference matrix.

3. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 2, characterized in that, Step S1 includes: The node connection relationship edge table is extracted from the power grid physical topology data to construct the global adjacency matrix of the power grid. The generator node active power sequence, bus voltage amplitude vector and line phase angle difference matrix from the multi-source measurement data of the power grid are injected into the global adjacency matrix of the power grid according to the spatial node mapping rules to obtain the spatiotemporal feature map data of the power grid. The spatiotemporal feature map data of the power grid is input into the physical information neural network in batches for forward propagation and physical constraint loss calculation to obtain the loss function with physical constraints. The differentiable digital twin agent model is obtained by taking the derivative of the loss function with physical constraints based on the backpropagation algorithm and iteratively updating the network weights along the gradient descent direction until convergence.

4. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 1, characterized in that, Step S2 includes: To obtain continuous values ​​of unit output adjustment and continuous virtual admittance variables, decision feature decoupling and discrete signal continuous mapping are performed on the scheduling instruction set to be verified. Based on the grid topology node space index, the continuous variables of virtual admittance and the continuous values ​​of unit output adjustment are respectively aligned and filled with channel layers, and tensor splicing and fusion are performed along the depth feature channel dimension to obtain the relaxed decision tensor.

5. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 1, characterized in that, Step S3 includes: The relaxed decision tensor and the initial scenario perturbation parameters are jointly injected into a differentiable digital twin agent model for joint simulation to obtain the adversarial target loss scalar. The network weights of the differentiable digital twin agent model are frozen, and the perturbation gradient tensor is extracted by backpropagation of the adversarial target loss scalar with respect to the initial scene perturbation parameters through the chain rule. The initial scenario perturbation parameters are iteratively updated multiple times along the rising direction of the perturbation gradient tensor, and a truncation constraint is applied using the physical feasible region projection function after each update until the worst adversarial scenario tensor converges.

6. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 1, characterized in that, Step S4 includes: The worst-case scenario tensor and the relaxed decision tensor are injected as joint incentives into a differentiable digital twin agent model for transient simulation and response matrix extraction to obtain the state response matrix of all nodes. Physical index analysis and comprehensive over-limit evaluation are performed on the state response matrix of all nodes to obtain the comprehensive over-limit penalty value.

7. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 1, characterized in that, Step S5 includes: Determine whether the comprehensive over-limit penalty value is greater than zero. If it is greater than zero, activate the backpropagation engine of the differentiable digital twin agent model. Calculate the first-order partial derivative of the comprehensive over-limit penalty value with respect to the relaxed decision tensor using the chain rule of differentiation to obtain the decision correction gradient tensor. The relaxed decision tensor is updated by parameter translation along the descent direction of the decision correction gradient tensor to obtain the safe correction decision tensor; The safety correction decision tensor is inversely discretized and analyzed to obtain executable safety scheduling instructions.

8. The digital twin sandbox verification method for power dispatch AI decision-making according to claim 7, characterized in that, The relaxed decision tensor is updated by parameter translation along the descent direction of the decision correction gradient tensor to obtain the safe correction decision tensor, including: Based on the channel labeling of the relaxed decision tensor, the topological gradient component and the power gradient component are obtained by dimensional decoupling the decision correction gradient tensor. The coupling sensitivity matrix is ​​generated by calculating the second-order cross-partial derivatives of the comprehensive over-limit penalty value with respect to the topological and power dimensions in the relaxed decision tensor using a differentiable digital twin agent model. The coupling sensitivity matrix is ​​aggregated by taking the absolute value of each row to obtain the coupling strength vector. Conservative step size is assigned to the topology dimension based on inverse scaling, and normalized step size is assigned to the power dimension based on the gradient components of the power dimension to obtain the anisotropic step size matrix. The decision correction gradient tensor is scaled based on the anisotropic step size matrix to obtain the main correction increment, and the feedforward compensation is calculated based on the coupling sensitivity matrix and the topological gradient components. The main correction increment and feedforward compensation are reorganized by channel to obtain the comprehensive correction matrix. The comprehensive correction matrix is ​​then subtracted from the relaxed decision tensor to obtain the safe correction decision tensor.