Object-oriented program design method for calculating electromagnetic transient characteristic value of large-scale power grid

Through object-oriented programming methods, a large-scale electromagnetic transient eigenvalue calculation system was established to solve the problems of low-frequency oscillation and sub-synchronous oscillation caused by the grid connection of new energy in the power system, simplifying the programming complexity, and providing stability analysis tools.

CN120335772APending Publication Date: 2025-07-18SICHUAN UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510351164.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively analyze electromagnetic transient problems such as low-frequency oscillation and sub-synchronous oscillation caused by the grid connection of new energy in large-scale power systems, and lacks efficient methods for calculating electromagnetic transient eigenvalues.

Method used

The object-oriented programming method is adopted to establish the continuous state space equation of the original, discrete processing and define historical current terms, and generate a discrete state matrix of the entire network, combine the node-branch correlation matrix, calculate the characteristic values, analyze the system stability, and simplify the programming complexity through component library design.

Benefits of technology

It simplifies programming complexity when component models change, can effectively analyze the stability of the power system, provides stability analysis tools, and simplifies the calculation of electromagnetic transient eigenvalues of large-scale grids.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335772A_ABST
    Figure CN120335772A_ABST
Patent Text Reader

Abstract

The invention discloses an object-oriented program design method for electromagnetic transient characteristic value calculation of a large-scale power grid, which belongs to the technical field of electromagnetic transient simulation of a power system and comprises the following steps of: establishing a continuous state space equation of an original to obtain a discrete state matrix of a whole network; the method comprises the following steps: preprocessing a main program, establishing a discrete state space equation of an original, obtaining a node-branch incidence matrix according to a discrete equivalent circuit of a network structure connecting element, generating a state space matrix of a system, calculating eigenvalues, mutually converting continuous and discrete eigenvalues, and analyzing the stability of the system according to different eigenvalues. According to the method, when the element model changes, a new model can be derived according to the original element base class, and the element model is directly connected with the original system through the global variable, so that the programming complexity is greatly simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of electromagnetic transient simulation of power systems, and specifically relates to an object-oriented programming method for calculating electromagnetic transient eigenvalues of large-scale power systems. Background Art

[0002] With the increasing scale of power systems, a series of new electromagnetic transient problems have emerged in power systems, such as low-frequency oscillations and subsynchronous oscillations caused by the integration of new energy. Calculating the electromagnetic transient eigenvalues of power systems is an effective method for analyzing the small-signal stability of power systems.

[0003] Therefore, at the present stage, it is necessary to design an object-oriented programming method, system, and storage medium for calculating the electromagnetic transient eigenvalues of large-scale power grids to solve the above problems. Summary of the Invention

[0004] The purpose of the present invention is to provide an object-oriented programming method, system, and storage medium for calculating the electromagnetic transient eigenvalues of large-scale power grids to solve the technical problems existing in the above-mentioned prior art.

[0005] To achieve the above purpose, the technical solution of the present invention is as follows:

[0006] An object-oriented programming method for calculating the electromagnetic transient eigenvalues of large-scale power grids includes the following steps:

[0007] S1. Establish the continuous state-space equation of the component, discretize it and define the historical current term, select the historical current term as the discrete state variable, organize the equation to eliminate the continuous-domain state variable, obtain the discrete state-space equation and the equivalent adjoint circuit of the component, connect each component and eliminate the voltage term to obtain the discrete state matrix of the entire network;

[0008] S2. Preprocess the main program, establish the discrete state-space equation of the component, connect the discrete equivalent circuits of the components according to the network structure to obtain the node-branch incidence matrix, generate the state-space matrix of the system, calculate the eigenvalues, convert the continuous and discrete eigenvalues mutually, and analyze the stability of the system according to different eigenvalues.

[0009] Further, step S1 is specifically as follows:

[0010] First, select the node bus voltage connected to each component as the input variable, and the current flowing into the component at this node as the output variable. The continuous-time state-space equation of a single-port component can always be expressed in the form shown in Equation (1);

[0011]

[0012] In the formula: D is the differential operator; X s is the continuous-domain state vector; umdq / i mdq are the input voltage / output current components of the component in the dq synchronous rotating coordinate system respectively; m indicates that the component is connected to the m-th node of the system; are all coefficient matrices, which can reflect information such as the electrical parameters, control parameters, and power flow initial values of the component;

[0013] Subsequently, according to the trapezoidal integration rule, the differential equation in Equation (1) is discretized, and the step size is set to Δt, then we can obtain

[0014]

[0015] In the formula: define h s (t) as the historical current term, which represents the quantity related to the state at the previous moment; are all coefficient matrices, and the expressions are as shown in Equation (3);

[0016]

[0017] In the formula, I n is the identity matrix, and the matrix order n is the order of the component model under study;

[0018] Next, to eliminate the continuous-domain state variables, substitute the first row in Equation (2) into the second rows of Equation (1) and Equation (2) respectively, then we can obtain the iterative expression of the historical current term and the output current expression:

[0019]

[0020] The expression of the coefficient matrix in Equation (4) is:

[0021]

[0022] Select the historical current term of the component as the discrete state variable. According to the relationship between the output current and the input voltage in the second row of Equation (4), represent the component with a discrete equivalent circuit, and this circuit only includes an equivalent conductance and an equivalent current source, where the conductance value is D ds , and the current source value is -C ds h s ;

[0023] The power system also includes components connected to other parts of the network through two nodes. For such components, the structured discrete state space modeling method based on the adjoint circuit is also adopted;

[0024] Similar to the modeling process of single-port components, first, the dq-axis components of the voltages at the two nodes where the two-port component is connected to the network are used as input variables, and the currents flowing into the component at the two nodes are used as output variables. Then, the general expression of the continuous-time state-space model of any two-port component is:

[0025]

[0026] In the formula: X t is the state vector of the two-port component in the continuous domain; u idq and u jdq are the dq-axis components of the voltages at the two nodes on both sides respectively; i idq and i jdq are the dq-axis components of the currents at the two nodes on both sides respectively; A t1 , B t1 , B t2 , C t1 , C t2 , D t1 , D t2 , D t3 , D t4 are all coefficient matrices;

[0027] Similarly, the discrete-time state-space model of the two-port component can be obtained:

[0028]

[0029] Among them:

[0030] The coefficient matrices are specifically:

[0031]

[0032] According to the second term of Equation (7), the discrete equivalent circuit of the two-port component can be obtained;

[0033] In a single-phase inductive component, the specific process of establishing the discrete state-space model of the component based on the adjoint circuit is as follows:

[0034] First, establish the relationship between the voltage across the inductor and the current flowing through it

[0035]

[0036] Taking Δt as the discretization time step and using the trapezoidal integration rule, we have

[0037]

[0038] Subsequently, define the historical current term h(t) as

[0039] h(t) = -[gvL (t - Δt) + i L (t - Δt)] (33)

[0040] Among them, is the equivalent conductance;

[0041] Next, select the historical current term as the state variable and organize the equation, and the complete expression of the discrete state - space model of the inductor can be obtained as

[0042]

[0043] Finally, according to Norton's equivalent principle, the discrete equivalent model of the inductor is obtained;

[0044] For any power grid, the adjoint circuits of each component can be connected based on the topological structure of the system to generate the discrete state - space equation of the entire network:

[0045] First, obtain the iterative equation of the historical current terms of the entire network according to the discrete state - space model of each component:

[0046] h(t) = A d h(t - Δt) + B d u dq (t - Δt) (35)

[0047] In the formula: h(t) is the matrix composed of the historical current terms of all components in the system; u dq (t - Δt) is the branch voltage of the branch where each component is located; the coefficient matrices A d , B d are the generalized diagonal matrices composed of the coefficient matrices in the discrete models of each component respectively;

[0048] Next, to obtain the state matrix of the discrete state - space model of the entire network, the relationship between h(t - Δt) and u dq (t - Δt) needs to be deduced according to each equation:

[0049]

[0050] Then there is

[0051] u dq (t - Δt) = L T (LD d L T ) -1 LC d h(t - Δt) (37)

[0052] In the formula: U node(t-Δt) is the voltage matrix of each node in the network; L is the node-branch association matrix obtained from the network topology; G is the augmented node conductance matrix obtained from the discrete circuit model of the system; i dq (t-Δt) is the current matrix injected into each node of the network; L T represents the transpose of the node-branch association matrix; the coefficient matrix C d It is a generalized diagonal matrix composed of coefficient matrices before the historical current source matrix in the discrete model of each component;

[0053] Finally, by combining the above equations, we can get the state matrix of the discrete state space model of the whole network:

[0054] h(t)=[A d +B d L T (LD d L T ) -1 LC d ]h(t-Δt)=A sys h(t-Δt) (38)

[0055] A sys =A d +B d L T (LD d L T ) -1 LC d (39)

[0056] From the above process, it can be seen that the discrete state matrix of the entire network can be directly obtained from the coefficient matrix node-branch association matrix of the local discrete model of each component.

[0057] Furthermore, step S2 is divided into two steps, main program design and component library design;

[0058] 3) Main program design

[0059] The main program in the electromagnetic transient discrete state space modeling program plays a core role in coordination and runs through the entire simulation process;

[0060] In the preprocessing stage, the main program configures the basic parameters of the system and sets global variables that are valid for the entire system, including the branch-node association matrix, discrete state space matrix, and continuous state space matrix, so that the components can be connected to the state space matrix of the entire power system through global variables; at the same time, global vectors or matrices are created to store calculation results;

[0061] On this basis, the main program calls the network initialization module to build a network model based on the system information input by the user, and assigns initial values to each node voltage and branch current based on the results of the power flow calculation;

[0062] To generate the system state matrix, first, the discrete and continuous state matrices of the entire network can be generated by diagonally splicing the local matrices of each component. The discrete and continuous state space models of each component are constructed through the state space equations obtained in the first step. At the same time, the component matrices are stored in the attributes of the component objects for subsequent simulation use. Subsequently, the node-branch incidence matrix is calculated to construct the connection relationship between the branches and the system through the starting and ending node numbers of the branches. Finally, the system state matrix can be calculated from Equation (18).

[0063] After obtaining the system state matrix, the eigenvalues of the system can be directly calculated.

[0064] 4) Component library design

[0065] The planning idea of the component library is as follows: First, create a category for storing basic attribute information applicable to all components, defined as the general component base class, which can hold the number of nodes, number of phases, and type of the component. Then, based on this general component base class, enrich the information of different component categories to construct various component base classes such as transmission line classes and motor classes. Finally, further inherit from the component base classes to generate various specific types of components.

[0066] In a continuous system, the asymptotic stability of the system depends on the real part of the eigenvalues; when the real parts of all eigenvalues are less than zero, some are equal to zero and their algebraic multiplicity does not exceed their geometric multiplicity, or all are greater than zero, it corresponds to the system being asymptotically stable, marginally stable, and unstable, respectively. Specifically, in the complex plane, when all eigenvalues are located in the left half-plane, the system is stable; if at least one eigenvalue is located in the right half-plane, the system is unstable.

[0067] For a discrete system, the stability of the system is related to the modulus of the eigenvalues; when the modulus of all eigenvalues is less than 1, the system is asymptotically stable; when the modulus of some eigenvalues is equal to 1 and no eigenvalue has a modulus greater than 1, the system may be in a marginally stable state. On the contrary, if there is any eigenvalue with a modulus greater than 1, the system is unstable; in the z-plane, if all discrete eigenvalues are located inside the unit circle, the system is in a stable state; if at least one eigenvalue is located outside the unit circle, the system is unstable.

[0068] To quantitatively analyze the system eigenvalue results, it is also necessary to convert the discrete eigenvalues into the continuous domain. The relationship between the continuous eigenvalues and the discrete eigenvalues is as follows:

[0069]

[0070] where λ i is the continuous eigenvalue of the system, Δt is the discrete time step, and z i is the discrete eigenvalue of the system.

[0071] Let σ = Re(λ) and ω = Im(λ). Then the oscillation frequency f and the damping ratio ζ can be calculated from Equations (20) and (21):

[0072]

[0073] The object-oriented programming system for calculating the electromagnetic transient eigenvalues of a large-scale power grid uses the object-oriented programming method for calculating the electromagnetic transient eigenvalues of a large-scale power grid as described above for object-oriented programming.

[0074] A storage medium stores a computer program that, when run, executes the object-oriented programming method for calculating the electromagnetic transient eigenvalues of a large-scale power grid as described above.

[0075] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0076] When the component model changes, a new model can be derived from the original component base class, and the component model can be directly connected to the original system through global variables, greatly simplifying the complexity of programming. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 It is a flowchart of the object-oriented programming for calculating electromagnetic transient eigenvalues.

[0078] Figure 2 It is a flowchart of the discrete state space modeling method based on the adjoint circuit.

[0079] Figure 3 It is the discrete equivalent circuit of a single-port component.

[0080] Figure 4 It is a schematic diagram of the structure of a two-winding transformer.

[0081] Figure 5 It is the discrete equivalent circuit of a two-port component.

[0082] Figure 6 It is the discrete equivalent circuit of an inductor.

[0083] Figure 7 It is a diagram of the main program module for electromagnetic transient simulation.

[0084] Figure 8 It is a schematic diagram of the class hierarchy and the establishment idea of the component library.

[0085] Figure 9 It is a schematic diagram of the stable intervals of the continuous and discrete eigenvalue methods. DETAILED DESCRIPTION OF THE INVENTION

[0086] The object-oriented programming flowchart for calculating the electromagnetic transient eigenvalue of a large-scale power grid is as follows Figure 1 shown

[0087] The specific content of each part of this method will be introduced separately below

[0088] 1. Structured Discrete State Space Modeling Method Based on Adjoint Circuit

[0089] First, select the bus voltage of the nodes connected to each component as the input variable, and the current flowing into the component at this node as the output variable. The continuous-time state space equation of a single-port component can always be expressed in the form shown in Equation (1).

[0090]

[0091] In the formula: D is the differential operator; X s is the state vector in the continuous domain; u mdq / i mdq are the input voltage / output current components of the component in the dq synchronous rotating coordinate system respectively; m indicates that the component is connected to the m-th node of the system are all coefficient matrices, which can reflect information such as the electrical parameters, control parameters, and power flow initial values of the component

[0092] Subsequently, according to the trapezoidal integration rule, discretize the differential equation in Equation (1), set the step size as Δt, and the following can be obtained

[0093]

[0094] In the formula: define h s (t) as the "historical current term", which represents the quantity related to the previous state are all coefficient matrices, and the expressions are as shown in Equation (3).

[0095]

[0096] In the formula, I n is the identity matrix, and the order n of the matrix is the order of the component model under study

[0097] Next, to eliminate the continuous-domain state variables, substitute the first row in Equation (2) into the second rows of Equation (1) and Equation (2) respectively, and the iterative expression of the historical current term and the output current expression can be obtained

[0098]

[0099] The expression of the coefficient matrix in Equation (4) is

[0100]

[0101] Select the "historical current term" of the component as the discrete state variable. According to the relationship between the output current and the input voltage in the second line of Equation (4), the component can be represented by a discrete equivalent circuit as shown in Figure 3 . This circuit only includes an equivalent conductance and an equivalent current source, where the conductance value is D ds , and the current source value is -C ds h s .

[0102] The power system also includes many components connected to other parts of the network through two nodes, such as two-winding transformers, transmission lines, etc., as shown in Figure 4 . Such components can also adopt the structured discrete state space modeling method based on the adjoint circuit.

[0103] Similar to the modeling process of single-port components, first, take the dq-axis components of the voltages of the two nodes where the two-port component is connected to the network as the input variables, and take the currents flowing into the component from the two nodes as the output variables. Then, the general formula of the continuous-time state space model of any two-port component can be expressed as:

[0104]

[0105] In the formula: X t is the state vector of the two-port component in the continuous domain; u idq and u jdq are the dq-axis components of the voltages of the two nodes on both sides respectively; i idq and i jdq are the dq-axis components of the currents on both sides respectively; A t1 , B t1 , B t2 , C t1 , C t2 , D t1 , D t2 , D t3 , D t4 are all coefficient matrices.

[0106] According to the method mentioned above, similarly, the discrete-time state space model of the two-port component can be obtained:

[0107]

[0108] Among them:

[0109] The coefficient matrices are specifically:

[0110]

[0111] According to the second term of Equation (7), the discrete equivalent circuit of the two-port element can be obtained as Figure 5 shown below.

[0112] Taking a single-phase inductive element as an example, the specific process of establishing the discrete state-space model of the element based on the adjoint circuit is described below.

[0113] First, establish the relationship between the voltage across the inductor and the current flowing through it

[0114]

[0115] Using the trapezoidal integration rule with Δt as the discretization time step, we have

[0116]

[0117] Subsequently, define the historical current term h(t) as

[0118] h(t) = -[gv L (t - Δt) + i L (t - Δt)] (54)

[0119] where is the equivalent conductance.

[0120] Next, select the historical current term as the state variable and rearrange the equation to obtain the complete expression of the discrete state-space model of the inductor as

[0121]

[0122] Finally, according to Norton's equivalent principle, the discrete equivalent model of the inductor is obtained as Figure 6 shown below.

[0123] For any power grid, the adjoint circuits of each element can be connected based on the topological structure of the system to generate the discrete state-space equations of the entire network:

[0124] First, obtain the iterative equation of the historical current terms of the entire network according to the discrete state-space models of each element:

[0125] h(t) = A d h(t - Δt) + B d u dq (t - Δt) (56)

[0126] where: h(t) is the matrix composed of the historical current terms of all elements in the system; u dq (t - Δt) is the branch voltage of the branch where each element is located; the coefficient matrices A d , B d are the generalized diagonal matrices composed of the coefficient matrices in the discrete models of each element, respectively;

[0127] Next, in order to obtain the state matrix of the discrete state space model of the entire network, it is necessary to derive h(t-Δt) and u according to each equation. dq The relationship between (t-Δt):

[0128]

[0129] Then there is

[0130] u dq (t-Δt)=L T (LD d L T ) -1 LC d h(t-Δt) (58)

[0131] Where: U node (t-Δt) is the voltage matrix of each node in the network; L is the node-branch association matrix obtained from the network topology; G is the augmented node conductance matrix obtained from the discrete circuit model of the system; i dq (t-Δt) is the current matrix injected into each node of the network; L T represents the transpose of the node-branch association matrix; the coefficient matrix C d It is a generalized diagonal matrix composed of the coefficient matrix before the historical current source matrix in the discrete model of each component.

[0132] Finally, by combining the above equations, we can get the state matrix of the discrete state space model of the whole network:

[0133] h(t)=[A d +B d L T (LD d L T ) -1 LC d ]h(t-Δt)=A sys h(t-Δt) (59)

[0134] A sys =A d +B d L T (LD d L T ) -1 LC d (60)

[0135] From the above process, it can be seen that the discrete state matrix of the entire network can be directly obtained from the coefficient matrix node-branch association matrix of the local discrete model of each component.

[0136] 2. Object - Oriented Design Method for Electromagnetic Transient Discrete State - Space Modeling Program

[0137] The following uses an object - oriented approach to design an electromagnetic transient discrete state - space modeling program. It mainly consists of two steps: main program design and component library design.

[0138] 5) Main Program Design

[0139] The main program in the electromagnetic transient discrete state - space modeling program plays a core coordinating role throughout the entire simulation process. The main program can be divided into 4 modules, as Figure 7 shown.

[0140] In the pre - processing stage, the main program configures the basic parameters of the system, sets global variables that are valid for the entire system, including the branch - node incidence matrix, discrete state - space matrix, and continuous state - space matrix, facilitating the connection of components to the state - space matrix of the entire power system through global variables; at the same time, it creates global vectors or matrices for storing calculation results.

[0141] On this basis, the main program calls the network initialization module to construct a network model according to the system information input by the user, and assigns initial values to the node voltages and branch currents based on the results of power flow calculations.

[0142] To generate the system state matrix, first, the discrete and continuous state matrices of the entire network can be generated by diagonally splicing the local matrices of each component. The discrete and continuous state - space models of each component are constructed through the state - space equations obtained in the first step, and at the same time, the component matrices are stored in the attributes of the component objects for subsequent simulation use; then, calculate the node - branch incidence matrix to construct the connection relationship between the branch and the system through the starting and ending node numbers of the branch; finally, the system state matrix can be calculated from Equation (18).

[0143] After obtaining the system state matrix, the eigenvalues of the system can be directly calculated.

[0144] 6) Component Library Design

[0145] Another key content of the design program is the construction and enrichment of the component library. The planning idea of the component library can be roughly summarized as follows: First, create a category for storing basic attribute information applicable to all components, defined as the general component base class, which can hold component information such as the number of nodes, number of phases, and type of the component; then, based on this general component base class, enrich the information of different component classes to construct various component base classes such as transmission line classes and motor classes; finally, further inherit the component base classes to generate various specific types of components. The establishment process of the component library is as Figure 8 shown.

[0146] Based on this method, when adding new components, there is no need to modify the circuit solver. One only needs to inherit the code of the new component from the branch class, which greatly improves the efficiency of programming. For example, if there is already a definition of a transmission line class for an RL branch in the original system, and if one wants to change the transmission line model and use a different model for simulating other lines, a new transmission line model class can be derived from the existing transmission line base class and directly connected to the system by splicing it into the global variables.

[0147] 3. Electromagnetic Transient Eigenvalue Calculation and Analysis Method

[0148] In a continuous system, the asymptotic stability of the system depends on the real part of the eigenvalues. When the real parts of all eigenvalues are less than zero, some are equal to zero and their algebraic multiplicity does not exceed the geometric multiplicity, or all are greater than zero, it corresponds to the system being asymptotically stable, marginally stable, and unstable respectively; specifically, in the complex plane, when all eigenvalues are located in the left half-plane, the system is stable; while if at least one eigenvalue is located in the right half-plane, the system is unstable.

[0149] For a discrete system, the stability of the system is related to the modulus of the eigenvalues. When the modulus of all eigenvalues is less than 1, the system is asymptotically stable; when the modulus of some eigenvalues is equal to 1 and no eigenvalue has a modulus greater than 1, the system may be in a marginally stable state. On the contrary, if there exists any eigenvalue with a modulus greater than 1, the system is unstable. In the z-plane, if all discrete eigenvalues are located inside the unit circle, the system is in a stable state; if at least one eigenvalue is located outside the unit circle, the system is unstable. Figure 9 Give a comparison of the stability intervals of the traditional continuous eigenvalue method and the discrete eigenvalue method.

[0150] Although the stability of the system can be directly and qualitatively judged according to the discrete eigenvalues, the oscillation frequency and damping ratio of the system that can be obtained from the continuous eigenvalues cannot be obtained. To quantitatively analyze the results of the system eigenvalues, the discrete eigenvalues need to be converted into the continuous domain. Since the trapezoidal integration rule is used in the modeling process of this paper, the relationship between the continuous eigenvalues and the discrete eigenvalues is:

[0151]

[0152] where λ i is the continuous eigenvalue of the system, Δt is the discrete step size, and z i is the discrete eigenvalue of the system.

[0153] Let σ = Re(λ), ω = Im(λ), then the oscillation frequency f and the damping ratio ζ can be calculated from Eqs. (20) and (21):

[0154]

[0155]

Claims

1. An object-oriented programming method for calculating electromagnetic transient eigenvalues of large-scale power grids, characterized in that The following steps are involved: S1. Establish the continuous state space equation of the original component, discretize and define the historical current term, select the historical current term as the discrete state variable, sort out the equation to eliminate the continuous domain state variable, obtain the discrete state space equation of the component and the equivalent adjoint circuit, connect each component and eliminate the voltage term, and obtain the discrete state matrix of the whole network; S2. Main program preprocessing, establish the discrete state space equation of the original component, obtain the node-branch association matrix according to the discrete equivalent circuit of the network structure connection elements, generate the state space matrix of the system, calculate the eigenvalues, convert continuous and discrete eigenvalues into each other, and analyze the stability of the system according to different eigenvalues.

2. The object-oriented programming method for calculating electromagnetic transient eigenvalue of large-scale power grid according to claim 1, characterized in that Step S1 is specifically as follows: First, the bus voltage of the node connected to each component is selected as the input variable, and the current flowing into the component at the node is selected as the output variable. The continuous time state space equation of the single-port component itself can always be expressed as shown in formula (1); Where: D is the differential operator; X s is the continuous-domain state vector; u mdq / i mdq are the input voltage / output current components of the element in the dq synchronous rotating coordinate system, respectively; m indicates that the component is connected to the m-th node of the system; Both are coefficient matrices, which can reflect information such as the electrical parameters, control parameters, and initial power flow values of the components; Then, according to the ladder integration rule, the differential equation in equation (1) is discretized and the step size is set to Δt, and we can get where: define h s (t) is the historical current term, representing a quantity related to the state at the previous moment; are both coefficient matrices, and the expressions are as shown in Equation (3); where I n is the identity matrix, and the order n of the matrix is the order of the component model under study; Next, to eliminate the continuous domain state variables, the first line of equation (2) is substituted into the second line of equation (1) and equation (2), respectively, to obtain the iterative expression of the historical current term and the output current expression: The expression of the coefficient matrix in formula (4) is: Select the historical current term of the component as the discrete state variable. According to the relationship between the output current and the input voltage in the second line of Equation (4), represent the component with a discrete equivalent circuit, which only includes an equivalent conductance and an equivalent current source. The conductance value is D ds , and the current source value is -C ds h s ; The power system also contains elements that are connected to the rest of the network through two nodes. Such elements are also modeled using a structured discrete state space approach based on adjoint circuits. The modeling process is the same as that of the single-port element. First, the dq-axis components of the voltages at the two nodes connecting the two-port element to the network are used as input variables, and the currents flowing into the element at the two nodes are used as output variables. The general formula of the continuous-time state-space model of any two-port element is expressed as follows: where: X t is the state vector of the two-port element in the continuous domain; u idq and u jdq are the dq-axis components of the node voltages on both sides respectively; i idq and i jdq are the dq-axis components of the currents on both sides respectively; A t1 , B t1 , B t2 , C t1 , C t2 , D t1 , D t2 , D t3 , D t4 are all coefficient matrices; Similarly, the discrete time state space model of the two-port element can be obtained: Wherein: The coefficient matrix is specifically: According to the second term of equation (7), the discrete equivalent circuit of the two-port element can be obtained; In a single-phase inductor component, the specific process of establishing a discrete state space model of the component based on the accompanying circuit is as follows: First establish the relationship between the voltage across the inductor and the current flowing through it Taking Δt as the discretization time step, using the trapezoidal integration rule, we have Then the historical current term h(t) is defined as h(t) = -[gv L (t - Δt) + i L (t - Δt)] (12) Among them, is the equivalent conductance; Then, the historical current term is selected as the state variable and the equation is sorted out to obtain the complete expression of the inductor discrete state space model: Finally, according to the Norton equivalent principle, the discrete equivalent model of inductance is obtained; For any power grid, the adjoint circuits of each element can be connected based on the topology of the system to generate the discrete state space equations of the entire network: First, the iterative equation of the historical current term of the entire network is obtained based on the discrete state space model of each component: h(t) = A d h(t - Δt) + B d u dq (t - Δt) (14) where: h(t) is a matrix composed of the historical current terms of all components in the system; u dq (t - Δt) is the branch voltage of the branch where each component is located; the coefficient matrix A d , B d are respectively generalized diagonal matrices composed of the coefficient matrix combinations in the discrete models of each component; Next, in order to obtain the state matrix of the discrete state space model of the entire network, it is necessary to derive h(t-Δt) and u according to each equation. dq The relationship between (t-Δt): Then there is u dq (t - Δt) = L T (LD d L T ) -1 LC d h(t - Δt) (16) Where: U node (t - Δt) is the voltage matrix of each node in the network; L is the node-branch incidence matrix obtained from the network topology; G is the augmented node conductance matrix obtained from the system discrete circuit model; i dq (t - Δt) is the injection current matrix of each node in the network; L T represents the transpose of the node-branch incidence matrix; the coefficient matrix C d is the generalized diagonal matrix composed of the coefficient matrices before the historical current source matrices in the discrete models of each component; Finally, by combining the above equations, we can get the state matrix of the discrete state space model of the whole network: h(t) = [A d + B d L T (LD d L T ) -1 LC d h(t - Δt) = A sys h(t - Δt) (17) A sys = A d + B d L T (LD d L T ) -1 LC d (18) From the above process, it can be seen that the discrete state matrix of the entire network can be directly obtained from the coefficient matrix node-branch association matrix of the local discrete model of each component.

3. The object-oriented programming method for calculating electromagnetic transient eigenvalues of large-scale power grids according to claim 2, wherein Step S2 is divided into two steps: main program design and component library design; 1) Main program design The main program in the electromagnetic transient discrete state space modeling program plays a core role in overall planning and runs through the entire simulation process; In the preprocessing stage, the main program configures the basic parameters of the system, sets global variables that are valid for the entire system, including the branch-node incidence matrix, discrete state space matrix, and continuous state space matrix, facilitating the connection of components to the state space matrix of the entire power system through global variables; at the same time, it creates global vectors or matrices for storing calculation results; On this basis, the main program calls the network initialization module to construct a network model according to the system information input by the user, and assigns initial values to the node voltages and branch currents based on the results of the power flow calculation; To generate the system state matrix, first, the discrete and continuous state matrices of the entire network can be generated through the diagonal splicing of the local matrices of each component. The discrete and continuous state space models of each component are constructed through the state space equations obtained in the first step, and at the same time, the component matrices are stored in the attributes of the component objects for subsequent simulation use; then calculate the node-branch incidence matrix, and construct the connection relationship between the branch and the system through the starting and ending node numbers of the branch; finally, the system state matrix can be calculated from Equation (18); After obtaining the system state matrix, the eigenvalues of the system can be directly calculated; 2) Component library design The planning idea of the component library is as follows: First, create a class for storing basic attribute information that is applicable to all components, defined as the general component base class, which can hold the number of nodes, number of phases, and type of the component; then, based on this general component base class, enrich the information of different component classes to construct various component base classes such as transmission line classes and motor classes; finally, further inherit the component base classes to generate various specific types of components; In a continuous system, the asymptotic stability of the system depends on the real part of the eigenvalues; When the real parts of all eigenvalues are less than zero, some are equal to zero and their algebraic multiplicity does not exceed the geometric multiplicity, and all are greater than zero, they correspond to the system being asymptotically stable, marginally stable, and unstable, respectively; specifically, in the complex plane, when all eigenvalues are located in the left half-plane, the system is stable; and if at least one eigenvalue is located in the right half-plane, the system is unstable; For a discrete system, the stability of the system is related to the modulus of the eigenvalues; when the modulus of all eigenvalues is less than 1, the system is asymptotically stable; when the modulus of some eigenvalues is equal to 1 and no eigenvalue has a modulus greater than 1, the system may be in a marginally stable state. On the contrary, if there is any eigenvalue with a modulus greater than 1, the system is unstable; in the z-plane, if all discrete eigenvalues are located inside the unit circle, the system is in a stable state; if at least one eigenvalue is located outside the unit circle, the system is unstable; To quantitatively analyze the results of the system eigenvalues, it is also necessary to convert the discrete eigenvalues into the continuous domain. The relationship between the continuous eigenvalues and the discrete eigenvalues is: Among them, λ i is the continuous eigenvalue of the system, Δt is the discrete step size, and z i is the discrete eigenvalue of the system; Let σ = Re(λ), ω = Im(λ), then the oscillation frequency f and damping ratio ζ can be calculated from Equations (20) and (21):

4. Object-oriented programming system for calculating electromagnetic transient eigenvalues of large-scale power grids, characterized in that Perform object-oriented programming using the object-oriented programming method for calculating the electromagnetic transient eigenvalues of large-scale power grids as described in any one of claims 1-3.

5. A storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is run, it executes the object-oriented programming method for calculating the electromagnetic transient eigenvalue of a large-scale power grid as described in any one of claims 1 to 3.