Electromagnetic transient simulation method, system and equipment based on error compensation variational algorithm and medium
By employing a hybrid architecture combining quantum and classical computing and utilizing an error-compensated variational algorithm, quantized node voltage quantum states are constructed. This addresses the issues of high computational complexity and slow speed in electromagnetic transient simulation caused by the expansion of power grid scale and the integration of renewable energy, achieving efficient and accurate electromagnetic transient simulation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUIZHOU POWER GRID CO LTD
- Filing Date
- 2025-12-18
- Publication Date
- 2026-05-08
AI Technical Summary
As the scale of the power grid expands and the uncertainty of renewable energy output increases, the model size of the power system grows exponentially, leading to huge computational loads and limited simulation speed in electromagnetic transient simulations.
An error-compensated variational algorithm is adopted, and a hybrid architecture of quantum computing and classical computing is used to construct quantized node voltage quantum states. By utilizing the parallelism and superposition characteristics of quantum computing and combining them with the error compensation mechanism, the line parameters are iteratively updated to make the loss function converge and obtain high-precision electromagnetic transient simulation results.
It effectively reduces the computational load caused by large-scale power grid and renewable energy access, improves simulation speed, solves the problem of simulation efficiency limitations caused by power grid expansion and new energy access, and ensures the accuracy and stability of simulation results.
Smart Images

Figure CN121997540A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electromagnetic transient simulation technology, specifically to electromagnetic transient simulation methods, systems, equipment, and media based on error-compensated variational algorithms. Background Technology
[0002] In recent years, the surge in renewable energy at power converter interfaces in power systems has led to so-called low-inertia power systems. Therefore, electromagnetic transient (EMT) simulation and analysis have become increasingly important for understanding how power electronics-based power systems operate, interpreting equipment failures, and testing protection devices. However, even with powerful commercial simulators equipped with multi-core processors, comprehensive EMT simulation of large-scale power systems remains a significant challenge. Electromagnetic transient simulation (EMT) is a core tool for analyzing rapid electromagnetic transient processes (typically on the microsecond to millisecond scale) in power systems. By establishing transient mathematical models of power system components and numerically solving electromagnetic transient equations, it reproduces the dynamic changes in voltage and current under scenarios such as faults (e.g., short circuits, lightning strikes) and operations (e.g., switching actions, load switching), providing a basis for system design, fault analysis, and protection configuration.
[0003] With the expansion of power grid scale and the increase in uncertainty of renewable energy output, the model size of power system is growing exponentially, which makes electromagnetic transient simulation face problems such as huge computational load and limited simulation speed. Summary of the Invention
[0004] In view of the above-mentioned problems, the present invention provides an electromagnetic transient simulation method, system, device and medium based on an error compensation variational algorithm.
[0005] Therefore, the technical problem solved by this invention is: how to address the problem that electromagnetic transient simulation faces huge computational load and limited simulation speed due to the exponential growth in the model size of the power system as the power grid scale expands and the uncertainty of renewable energy output increases.
[0006] To address the aforementioned technical problems, this invention provides the following technical solution: an electromagnetic transient simulation method based on an error-compensated variational algorithm, comprising: acquiring discrete node electrical parameters of a power system; establishing an electromagnetic transient equivalent model based on the parameters; constructing a loss function to measure the deviation between the node voltage after passing through a target equivalent admittance matrix and the injected current of the node; preparing quantum states characterizing the node voltage using a parametric quantum circuit, and calculating the function value of the loss function using the measurement results of the prepared quantum states; iteratively updating the variational parameters in the parametric quantum circuit using the function value; obtaining the measurement results of the quantum states that cause the loss function to converge, and obtaining the solved voltage; calculating the residual for error compensation using the target equivalent admittance matrix, the injected current of the node, and the solved voltage, and correcting the solved voltage using the residual, obtaining the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0007] As a preferred embodiment of the electromagnetic transient simulation method based on the error-compensated variational algorithm described in this invention, the steps of obtaining the discretized node electrical parameters of the power system, establishing an electromagnetic transient equivalent model based on the parameters, and constructing a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the node's injected current include: determining the electrical relationship between nodes based on the discretized node electrical parameters of the power system; establishing a node admittance matrix of the electromagnetic transient equivalent model based on the electrical relationship; forming a linear equation system based on the relationship between the node admittance matrix and the node's injected current, and constructing a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the node's injected current.
[0008] As a preferred embodiment of the electromagnetic transient simulation method based on error compensation variational algorithm described in this invention, the target equivalent admittance matrix is obtained by normalizing and expanding the dimensions of the equivalent admittance matrix.
[0009] As a preferred embodiment of the electromagnetic transient simulation method based on the error compensation variational algorithm described in this invention, the step of calculating the residual for error compensation using the target equivalent admittance matrix, the injected current of the node, and the solved voltage includes calculating the product of the target equivalent admittance matrix and the solved voltage; and using the difference between the injected current of the node and the calculated product as the residual for error compensation.
[0010] As a preferred embodiment of the electromagnetic transient simulation method based on the error-compensated variational algorithm described in this invention, the step of correcting the solved voltage using the residual to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment includes: calculating the correction amount for the solved voltage using the residual, the error correction step size, and the solved voltage components, wherein the calculated injection current is the product of the target equivalent admittance matrix and the solved voltage; and correcting the solved voltage using the calculated correction amount to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0011] This preferred solution introduces an error correction mechanism based on solving voltage components, which can effectively compensate for noise and gate errors in quantum computing, ensuring that accurate simulation results can still be obtained on quantum devices in the NISQ era.
[0012] As a preferred embodiment of the electromagnetic transient simulation method based on the error-compensated variational algorithm described in this invention, the step of correcting the solved voltage with the calculated correction amount to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment includes: correcting the solved voltage with the calculated correction amount; if the currently corrected voltage is not less than a preset threshold, then the currently corrected voltage is used as the solved voltage, and the correction continues until the currently corrected voltage is less than the preset threshold, at which point the currently corrected voltage is used as the electromagnetic transient simulation result at the current moment.
[0013] This preferred scheme ensures that the final electromagnetic transient simulation results meet the preset accuracy requirements by iteratively correcting until the residuals converge, thus avoiding the accumulation of calculation errors caused by insufficient correction in a single step.
[0014] As a preferred embodiment of the electromagnetic transient simulation method based on the error compensation variational algorithm described in this invention, the error correction step size is based on... The values selected within a defined range, where, It is the error correction step size. denoted as eigenvalues of the target admittance matrix.
[0015] This preferred scheme determines the effective range of error correction step size through theoretical derivation, which mathematically guarantees the convergence of the iterative correction process and avoids algorithm divergence caused by improper step size selection.
[0016] This invention provides an electromagnetic transient simulation system based on an error-compensated variational algorithm.
[0017] To address the aforementioned technical problems, this invention provides the following technical solution: an electromagnetic transient simulation system based on an error-compensated variational algorithm, comprising: a loss function construction module, an iterative update module, a solution module, and a simulation result acquisition module; the loss function construction module is used to acquire discrete node electrical parameters of the power system, establish an electromagnetic transient equivalent model based on the parameters, and construct a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node; the iterative update module is used to prepare quantum states characterizing the node voltage through a parametric quantum circuit, and calculate the function value of the loss function using the measurement results of the prepared quantum states, and iteratively update the variational parameters in the parametric quantum circuit using the function value; the solution module is used to obtain the measurement results of the quantum states that cause the loss function to converge, and obtain the solved voltage; the simulation result acquisition module is used to calculate the residual for error compensation using the target equivalent admittance matrix, the injected current of the node, and the solved voltage, and use the residual to correct the solved voltage, obtaining the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0018] The present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the electromagnetic transient simulation method based on the error compensation variational algorithm.
[0019] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the electromagnetic transient simulation method based on the error compensation variational algorithm.
[0020] The beneficial effects of this invention are as follows: This invention breaks through the bottleneck of traditional electromagnetic transient simulation in terms of both computational efficiency and problem scale adaptation by using a hybrid architecture of quantum variational solution and residual error compensation. On the one hand, it uses the parameterized quantum circuit to encode the node voltage quantum states and takes advantage of the parallelism and superposition characteristics of quantum computing to obtain more voltage combinations. It then solves the problem efficiently through the corresponding loss function, without having to directly handle the matrix operations that grow exponentially with the grid size in traditional simulations, thus significantly reducing the computational load caused by large-scale grids and renewable energy access. On the other hand, the variational algorithm converges the loss function by iteratively updating the line parameters, avoiding the need for full solutions of high-dimensional equations in traditional numerical methods. Moreover, the residual compensation mechanism ensures simulation accuracy without adding a large amount of additional computational overhead, effectively adapting to the increased model complexity caused by the uncertainty of renewable energy output. Ultimately, it improves the simulation speed while controlling the computational load, solving the problem of simulation efficiency limitations caused by grid expansion and new energy access. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 The above is a flowchart of an electromagnetic transient simulation method based on an error-compensated variational algorithm, provided as an embodiment of the present invention.
[0023] Figure 2 The diagram shows the basic components of the EMTP (Electromagnetic Transient Simulation) method based on an error-compensated variational algorithm, as provided in an embodiment of the present invention.
[0024] Figure 3 This is a schematic diagram of an efficient hardware simulation circuit for an electromagnetic transient simulation method based on an error-compensated variational algorithm, provided as an embodiment of the present invention. Detailed Implementation
[0025] To make the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0026] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides an electromagnetic transient simulation method based on an error-compensated variational algorithm, including: S1. Obtain the discrete node electrical parameters of the power system, establish an electromagnetic transient equivalent model based on the parameters, and construct a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node.
[0027] S2. Prepare a quantum state characterizing the node voltage using a parametric quantum circuit, and use the measurement results of the prepared quantum state to calculate the function value of the loss function, and use the function value to iteratively update the variational parameters in the parametric quantum circuit.
[0028] S3. Obtain the measurement results of the quantum state that makes the loss function converge, and obtain the voltage for solving.
[0029] S4. Using the target equivalent admittance matrix, the injected current of the node, and the solved voltage, calculate the residual for error compensation, and use the residual to correct the solved voltage to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0030] In power systems, solving large-scale electromagnetic transients typically requires repeatedly constructing linear equation systems and performing high-frequency iterations. Quantum computing can improve solution efficiency when the number of nodes is large. However, current quantum devices suffer from noise and decoherence issues, resulting in amplitude deviations in the node voltage quantum states output by quantum circuits. This embodiment solves the linear equation system formed by electromagnetic transients using quantization. Based on the quantum solution, scalar construction and error compensation iteration are introduced in a noisy quantum environment. This improves the accuracy of node voltage solutions in noisy quantum environments. Relying on repeated runs of quantum hardware, it can be executed on classical computers. By using quantum output correction results, the NISQ quantum solution approximates the theoretical solution. Under current quantum hardware conditions, node voltage results closer to the theoretical solution can be obtained, significantly reducing the impact of quantum noise and improving the stability and reliability of electromagnetic transient simulation. This invention obtains voltage through quantum state encoding, reduces the depth of quantum circuits, and improves resistance to noise interference. Therefore, quantum computing-based electromagnetic transient simulation shows significant improvements in accuracy and stability compared to traditional quantum solution methods.
[0031] Through steps S1-S4 in this invention, the quantization construction of the electromagnetic transient linear equation system, the training of the parametric simulation circuit, the classical recovery of the nodal voltage quantum state, and the error compensation solution based on the approximation operator can be completed, achieving high-precision solution of the nodal voltage, and enabling electromagnetic transient simulation to have higher stability and effectiveness under current quantum hardware conditions.
[0032] Example 2, refer to Figure 2 and Figure 3 As one embodiment of the present invention, based on the previous embodiment, an electromagnetic transient simulation method based on an error-compensated variational algorithm is provided, comprising: In this embodiment, the loss function in step S1 can be constructed using a projection operator. The degree of deviation is measured by calculating the difference between the projection of the quantum state prepared by the parametric quantum circuit after the action of the target equivalent admittance matrix and the quantum state of the injected current at the node. When the quantum state prepared by the parametric quantum circuit is equal to the actual node voltage quantum state, the loss function value is zero.
[0033] In an alternative implementation, the loss function can also be a loss function constructed in the form of the square of the Euclidean distance, which directly calculates the square of the Euclidean distance between the quantum state prepared by the target equivalent admittance matrix and the quantum state of the node injection current after the quantum state is prepared by the parameterized quantum circuit, thereby measuring the degree of deviation between the two.
[0034] In another alternative implementation, the loss function can also be a loss function constructed in the form of fidelity, which measures the degree of deviation between the quantum state prepared by the target equivalent admittance matrix and the quantum state of the node injection current after the target equivalent admittance matrix is applied to the quantum state prepared by the parametric quantum circuit.
[0035] This invention constructs a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node. This function can accurately quantify the difference between the quantum state prepared by the parametric quantum circuit and the true solution. By continuously optimizing the variational parameters in the parametric quantum circuit through the gradient descent method, the solution of the linear equation system can be obtained when the loss function approaches zero. This enables electromagnetic transient simulation and solution based on the variational quantum algorithm.
[0036] Furthermore, in step S1, the discretized node electrical parameters of the power system are obtained, an electromagnetic transient equivalent model is established based on the parameters, and a loss function is constructed to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node, including the following steps A1-A3: A1. Determine the electrical relationships between nodes based on the discrete node electrical parameters of the power system.
[0037] A2. The nodal admittance matrix of the electromagnetic transient equivalent model based on electrical relationships.
[0038] A3. Based on the relationship between the node admittance matrix and the node injection current, a set of linear equations is formed, and a loss function is constructed to measure the degree of deviation between the node voltage after passing through the target equivalent admittance matrix and the node injection current.
[0039] The target equivalent admittance matrix is obtained by normalizing and expanding the dimensions of the equivalent admittance matrix.
[0040] In this embodiment of the application, the node admittance matrix in step A2 can be a matrix constructed based on the equivalent conductance of each electrical component in the power system. Each electrical component, whether a simple resistive, inductive, or capacitive element or a complex rotating motor, is uniformly converted into an equivalent resistance form by introducing a compensation current source. The equivalent conductance is filled into the node admittance matrix according to the connection relationship between nodes. The diagonal element is the sum of the equivalent conductance of all branches connected to the node, and the off-diagonal element is the negative value of the equivalent conductance of the branches between nodes.
[0041] In one alternative implementation, the node admittance matrix can also be based on the augmented admittance matrix constructed by the modified node analysis method. The basic node admittance matrix is supplemented with constraint equations for voltage source branches and controlled sources to form an augmented matrix form that includes node voltages and branch currents, in order to handle complex power systems containing ideal voltage sources and controlled sources.
[0042] In another alternative implementation, the node admittance matrix can also be based on the system matrix constructed by the state-space method, which converts the dynamic equations of the power system into state-space form. The equivalent admittance matrix obtained after discretization can simultaneously consider the dynamic and steady-state characteristics of the system.
[0043] This invention establishes a node admittance matrix for an electromagnetic transient equivalent model based on electrical relationships, which can accurately describe the electrical connection relationships and component characteristics between nodes in a power system, and transform the complex dynamic equations of power networks into algebraic equations.
[0044] Specifically, the Electromagnetic Transients Program (EMTP) studies the transient processes of power systems based on numerical integration rules (e.g., trapezoidal discretization) and nodal analysis. By introducing compensating current sources, every electrical component, whether a simple RLC element or a complex rotating machine, can be uniformly converted into an equivalent resistance. (1) in, and These represent the component's current and voltage, respectively. Indicates equivalent conductance. The compensation current represents the historical state. For time. The detailed expression for a basic RLC element is as follows: Figure 2 As shown. Component resistance. of yes , The inductance of the component is 0. of yes , for Component capacitor of yes , for ,in, This represents the time step size for single-step integration.
[0045] Accordingly, at each time step, the dynamic equations of the power network can be replaced by the algebraic equations of the equivalent resistive network using numerical methods, as follows: (2) in, A vector representing node voltages; This represents the vector of node current injection, which aggregates currents from the source (…). ) and historical items (i.e. The current of ) express The equivalent conductance matrix of dimension ( (Number of unknown voltage nodes).
[0046] Specifically, the injected current in equation (2) can be expressed in quantum state form: (3) in, express The One element; The quantum state form of the injected current; This is the base number for calculation, corresponding to the node index.
[0047] Equivalent conductance matrix Reconstructing to the normalized form of the filled form, we get: (4) in, For the normalized conductance matrix, Indicates by A vector constructed from the diagonal elements; The diagonal matrix constructed for the input vector; The dimension is The identity matrix; 0 represents the zero matrix.
[0048] The goal of the Quantum-Enhanced Magnetic Transient Program (QEMTP) is to prepare a quantized node voltage state. , making and Proportional: (5) To achieve this goal, the proposed route is designed, and connections are generated. and corresponding : (6) in, For a set of variational parameters (i.e.) Quantum logic gates, This is a vector of line parameters.
[0049] Specifically, VQLS defines the following loss function: (7) in, Let be the value of the loss function. Clearly, is true if and only if hour, VQLS uses parameterized circuitry. structure ,have ,in These are the circuit parameters. Therefore, the goal of VQLS is to continuously train the parametric circuit until L... Thus we obtain The proposed route is as follows: Figure 3 As shown.
[0050] In this embodiment, the variational parameters in step S2 can be the rotation angle parameters of the rotating gate in a parametric quantum circuit. These rotation angle parameters are iteratively optimized and updated using the gradient descent method. Differential gradients are used instead of differential gradients to calculate the gradient component of the loss function with respect to each rotation angle parameter. Then, the parameters are updated based on the learning rate and gradient values until the loss function converges.
[0051] In one alternative implementation, the variational parameter can also be a combination of the rotation angle parameter of the controlled rotating gate and the phase angle parameter of the phase gate in the parametric quantum circuit. By simultaneously optimizing these two types of parameters, the quantum state preparation process can be adjusted to obtain a more accurate representation of the node voltage quantum state.
[0052] In another alternative implementation, the variational parameters can also be the parameter set of each layer in a hierarchical parametric quantum circuit, including single-qubit rotation gate parameters and two-qubit entanglement gate parameters. The parameters of all layers are updated by layer-by-layer optimization or global optimization to improve the expressive power and convergence speed of the quantum circuit.
[0053] This invention utilizes the gradient descent method to iteratively update the variational parameters in a parametric quantum circuit, thereby continuously optimizing the quantum state prepared by the quantum circuit and gradually approximating the actual node voltage quantum state. When the loss function converges, the optimized variational parameters can be obtained, thus achieving high-precision electromagnetic transient simulation solutions with significantly reduced computational complexity compared to classical algorithms.
[0054] Furthermore, in step S2, a quantum state characterizing the node voltage is prepared using a parametric quantum circuit, and the value of the loss function is calculated using the measurement results of the prepared quantum state. The variational parameters in the parametric quantum circuit are then iteratively updated using the function value, including the following steps: Then, gradient descent is used to refine the variational parameters. Optimize and update the function to minimize the loss function.
[0055] (8) in, For the first Variational parameters of the next iteration For the first Variational parameters of the next iteration For learning rate, For about The gradient of the loss function, when When the parameter approaches 0, the optimized variational parameter can be obtained, denoted as . .
[0056] The Variational Quantum Linear Solver (VQLS) algorithm utilizes quantum circuitry to obtain the loss function. Regarding variational parameters Differential gradient : (9) in, Let be the set of differential gradients of the variational parameters. loss function Regarding the first Parameters The gradient components.
[0057] This invention uses the difference gradient instead of the differential gradient, and thus: (10) in, It is a tiny perturbation.
[0058] The advantage of this approach is that for each gradient component, only one VQLS circuit setup is needed to obtain the current gradient component, and the total number of circuit calls required to calculate the complete gradient is strictly the same as the number of bits. After executing the circuit setup, the quantum state... Direct sampling acquisition; sampling-based acquisition The loss function is obtained using classical calculation. When the loss function approaches 0, at this point... This is the solution to the system of linear equations.
[0059] Furthermore, in step S3, the measurement result of the quantum state that makes the loss function converge is obtained, and the voltage to be solved is obtained, including the following steps: Specifically, when the loss function is less than the given convergence criterion, C The algorithm will determine the quantum state under the variational parameters at this time. By multiplying by a scalar It is possible to restore quantum data to classical data: (11) in, This is a classic node voltage vector. As a scalar, Let be the Euclidean norm of the vector.
[0060] In the absence of error, scalar It has a theoretical value, but in the presence of quantum errors, the scalar... The value needs to be constructed. Clearly, Only when satisfied Only time-iterative linear algorithms can succeed; the problem is transformed into solving: (12) in, This is the criterion for the optimal scalar.
[0061] set up Solve The final solution can be obtained (13) Furthermore, in step S4, the residuals used for error compensation are calculated using the target equivalent admittance matrix, the injected current at the node, and the solved voltage. The solved voltage is then corrected using the residuals to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment. This includes the following steps D1-D4: D1. Calculate the product of the target equivalent admittance matrix and the solved voltage.
[0062] D2. The difference between the injected current at the node and the calculated product is used as the residual for error compensation.
[0063] D3. Using the residual, error correction step size, and the solved voltage components, calculate the correction amount for the solved voltage. The calculated injection current is the product of the target equivalent admittance matrix and the solved voltage.
[0064] D4. Correct the solved voltage using the calculated correction amount, and obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0065] In this embodiment, the residual in step D2 can be calculated by multiplying the target equivalent admittance matrix and the voltage solved in the current iteration step, and the difference between the injected current at the node and this product is used as the residual. This residual reflects the deviation between the voltage solved in the current iteration step and the actual injected current after being substituted into the original linear equations, and is used for subsequent error compensation iteration correction processes.
[0066] In an alternative implementation, the residuals can also be in the form of weighted residuals. By weighting the difference between the injected current of the node and the product of the target equivalent admittance matrix and the solved voltage, different weighting coefficients are assigned to the residuals of different nodes to more accurately reflect the degree of influence of the voltage error of each node on the overall accuracy of the system.
[0067] In another alternative implementation, the residual can also be in the form of normalized residual, which is obtained by dividing the difference between the injected current at the node and the product of the target equivalent admittance matrix and the solved voltage by the norm of the injected current at the node. This allows for the setting of a unified convergence criterion and the comparison of the solution accuracy of systems of different scales.
[0068] This invention uses the difference between the injected current of the calculation node and the product of the target equivalent admittance matrix and the solved voltage as a residual for error compensation. This can accurately quantify the solution error caused by quantum device noise and gate error, and continuously update the voltage value using this residual through an iterative correction process until the residual converges to a preset accuracy range.
[0069] Furthermore, in step D4, the calculated correction amount is used to correct the voltage, and the corrected voltage is obtained as the electromagnetic transient simulation result at the current moment, including the following steps D41-D42: D41. Correct the solved voltage using the calculated correction amount.
[0070] D42. If the current corrected voltage is not less than the preset threshold, then the current corrected voltage is used as the voltage to be solved, and the correction continues until the current corrected voltage is less than the preset threshold. Then the current corrected voltage is used as the electromagnetic transient simulation result at the current moment.
[0071] Error correction step size is based on The values selected within a defined range, where, It is the error correction step size. denoted as eigenvalues of the target admittance matrix.
[0072] Specifically, given the linear problem to be solved as G Without loss of generality, we assume The dimension is Its basic idea is to decompose the right-hand side of the term into... Then solve for the solution corresponding to each basis: (14) in, and They represent the first Each basis and its corresponding solution. Therefore, the final node voltage For a linear combination of the base voltages: (15) in, For the final node voltage, It is by Obtained by measurement.
[0073] The basic solution scheme requires solving all computational bases, totaling... A linear system problem, as shown in equation (14). A natural idea is to take advantage of the superposition of quantum computing to solve these linear systems simultaneously. The following will introduce how to solve these linear equations in batches. Expanding equation (14) into a large linear problem, we have: (16) Rewrite equation (4) as: (17) in, and All are needed One qubit. It is worth noting that in Hilbert space, the batch solution (16) only requires an additional... 100 qubits, which in Euclidean space is the size of the primordial problem. This demonstrates once again that quantum computing can reduce computational resources logarithmically.
[0074] Since current quantum devices are still in the NISQ era, gate errors and short decoherence times inevitably interfere with them, making it impossible to accurately output theoretical values on noisy quantum computers. The following presents an error compensation scheme for a parallel solver to ensure the accuracy of quantum algorithm solutions in noisy quantum environments.
[0075] set up For each basis equation system measured by a quantum computer, the fundamental solutions can then be deduced. It is close to Therefore, there are ,in This represents a small error. The following iterative process yields the system of linear equations. Solution: (18) in, For the first In the next iteration The value (i.e.) ; For residuals (i.e. ; The error correction step size is set; the formula (18) is executed recursively until the convergence accuracy is reached, and the solution with the preset accuracy can be obtained.
[0076] The convergence proof of the above error compensation is as follows: Equation (18) can be rewritten as: (19) make , The error during iteration is ,in for The theoretical solution.
[0077] Therefore, the error term satisfies the following relationship: (20) Correspondingly, there are: (twenty one) Scenario 1: Consider a special case, namely Sometimes: (twenty two) The spectral radius is the maximum absolute value of its eigenvalues, i.e. The set of solutions to a system of linear equations obtained by quantum algorithms. yes A good approximation, therefore It is typically smaller than the identity matrix, which usually leads to .Notice Equivalent to for any vector ,when hour, Therefore, the iteration will eventually converge to .
[0078] Scenario 2: Even due to disturbances in the noisy quantum environment It can be achieved by setting appropriate The convergence of the algorithm can still be guaranteed. Any eigenvalue of is denoted as The corresponding eigenvector is denoted as : (twenty three) Then there is: (twenty four) This indicates yes The eigenvalues of . Correspondingly, when satisfy Convergence is guaranteed.
[0079] Through Define a range, and then select a value within that range.
[0080] The batch solution algorithm process includes the following steps s1-s5: s1. Initialization: System parameters, simulation time step Discrete time step , Convergence Criteria .
[0081] S2, for each time step If the power grid configuration changes or is initialized, then update. , And construct .
[0082] S3, VQLS solves the linear equation system: The linear equation system to be solved is reconstructed according to equation (16) as follows: Randomly initialize the proposed parameters Training the proposed parameters based on gradient descent When L approaches 0, the optimized proposed parameters can be obtained, denoted as... ,Right now Find the scalar P, and convert the quantum state into a classical solution. .
[0083] S4. Error Compensation: Initialization , , Update according to equation (18) , ,if ,but Continue executing this process until... Proceed to step s5.
[0084] S5. Convert the node base voltage into the node voltage according to equation (15). Update node voltage. ,if If the condition is met, proceed to step s2; otherwise, output the node voltage. .
[0085] Example 3 is an embodiment of the present invention, which provides an electromagnetic transient simulation method based on an error compensation variational algorithm. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.
[0086] The linear equation system has a dimension of 2, as shown in Table 1.
[0087] Table 1 Comparison Table
[0088] The test results show that the error-compensated solution is consistent with the classical solution.
[0089] Example 4 is an embodiment of the present invention. This embodiment provides an electromagnetic transient simulation system based on an error-compensated variational algorithm, including a loss function construction module, an iterative update module, a solution module, and a simulation result acquisition module. The loss function construction module is used to obtain the discrete node electrical parameters of the power system, establish an electromagnetic transient equivalent model based on the parameters, and construct a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node.
[0090] The iterative update module is used to prepare quantum states characterizing node voltages through parametric quantum circuits, and to calculate the function value of the loss function using the measurement results of the prepared quantum states, and to iteratively update the variational parameters in the parametric quantum circuits using the function value.
[0091] The solver module is used to obtain the measurement results of the quantum state that makes the loss function converge, and to obtain the voltage to be solved.
[0092] The simulation result acquisition module is used to calculate the residual for error compensation using the target equivalent admittance matrix, the injected current of the node and the solved voltage, and to correct the solved voltage using the residual, so as to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
[0093] This embodiment also provides an electronic device applicable to the electromagnetic transient simulation method based on the error compensation variational algorithm, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the electromagnetic transient simulation method based on the error compensation variational algorithm proposed in the above embodiment.
[0094] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements the electromagnetic transient simulation method based on the error compensation variational algorithm proposed in the above embodiment.
[0095] The storage medium proposed in this embodiment and the electromagnetic transient simulation method based on error compensation variational algorithm proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0096] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0097] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. An electromagnetic transient simulation method based on an error-compensated variational algorithm, characterized in that: include, Discrete node electrical parameters of the power system are obtained, an electromagnetic transient equivalent model is established based on the parameters, and a loss function is constructed to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node. A quantum state characterizing the node voltage is prepared by using a parametric quantum circuit. The measurement results of the prepared quantum state are used to calculate the function value of the loss function, and the variational parameters in the parametric quantum circuit are iteratively updated using the function value. Obtain the measurement results of the quantum state that makes the loss function converge, and obtain the voltage for the solution; Using the target equivalent admittance matrix, the injected current of the node, and the solved voltage, the residual for error compensation is calculated, and the solved voltage is corrected using the residual to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
2. The electromagnetic transient simulation method based on error compensation variational algorithm as described in claim 1, characterized in that: The process involves acquiring discrete node electrical parameters of the power system, establishing an electromagnetic transient equivalent model based on these parameters, and constructing a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current at the node. This includes... Determine the electrical relationships between nodes based on the discrete node electrical parameters of the power system; The nodal admittance matrix of the electromagnetic transient equivalent model is established based on the aforementioned electrical relationship; Based on the relationship between the node admittance matrix and the node injection current, a set of linear equations is formed, and a loss function is constructed to measure the degree of deviation between the node voltage after passing through the target equivalent admittance matrix and the node injection current.
3. The electromagnetic transient simulation method based on error compensation variational algorithm as described in claim 2, characterized in that: The target equivalent admittance matrix is obtained by normalizing and expanding the dimensions of the equivalent admittance matrix.
4. The electromagnetic transient simulation method based on error compensation variational algorithm as described in claim 3, characterized in that: The method of calculating the residual for error compensation using the target equivalent admittance matrix, the injected current at the node, and the solved voltage includes: Calculate the product of the target equivalent admittance matrix and the solved voltage; The difference between the injected current at the node and the calculated product is used as the residual for error compensation.
5. The electromagnetic transient simulation method based on error-compensated variational algorithm as described in claim 4, characterized in that: The step of correcting the solved voltage using the residual to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment includes: Using the residual, error correction step size, and the solved voltage component, the correction amount for the solved voltage is calculated, wherein the calculated injection current is the product of the target equivalent admittance matrix and the solved voltage. The calculated correction amount is used to correct the voltage, and the corrected voltage is used as the electromagnetic transient simulation result at the current moment.
6. The electromagnetic transient simulation method based on error-compensated variational algorithm as described in claim 5, characterized in that: The calculated correction amount is used to correct the solved voltage, and the corrected voltage is used as the electromagnetic transient simulation result at the current moment. This includes: The calculated correction amount is used to correct the voltage. If the current corrected voltage is not less than the preset threshold, then the current corrected voltage is used as the voltage to be solved, and the correction continues until the current corrected voltage is less than the preset threshold. Then the current corrected voltage is used as the electromagnetic transient simulation result at the current moment.
7. The electromagnetic transient simulation method based on error compensation variational algorithm as described in claim 6, characterized in that: The error correction step size is based on The values selected within a defined range, where, It is the error correction step size. denoted as eigenvalues of the target admittance matrix.
8. An electromagnetic transient simulation system based on an error-compensated variational algorithm, employing the electromagnetic transient simulation method based on an error-compensated variational algorithm as described in any one of claims 1 to 7, characterized in that, include: The module includes a loss function construction module, an iterative update module, a solution module, and a simulation result acquisition module. The loss function construction module is used to obtain the discrete node electrical parameters of the power system, establish an electromagnetic transient equivalent model based on the parameters, and construct a loss function to measure the deviation between the node voltage after passing through the target equivalent admittance matrix and the injected current of the node. The iterative update module is used to prepare a quantum state characterizing the node voltage through a parametric quantum circuit, and to calculate the function value of the loss function using the measurement results of the prepared quantum state, and to iteratively update the variational parameters in the parametric quantum circuit using the function value. The solution module is used to obtain the measurement results of the quantum state that makes the loss function converge, and to obtain the voltage to be solved; The simulation result acquisition module is used to calculate the residual for error compensation using the target equivalent admittance matrix, the injected current of the node and the solved voltage, and to use the residual to correct the solved voltage, so as to obtain the corrected voltage as the electromagnetic transient simulation result at the current moment.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the electromagnetic transient simulation method based on the error-compensated variational algorithm as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the electromagnetic transient simulation method based on the error compensation variational algorithm as described in any one of claims 1 to 7.