Automatic construction method for electromagnetic transient discrete state space equation of power system
Through automated Jacobian matrix and algebraic variable elimination technology, the linearization and discretization of power system component models are achieved, solving the low efficiency problem of traditional power system electromagnetic transient analysis methods. It can quickly construct the discrete state space equations of the entire system and is suitable for large-scale complex power systems.
Patent Information
- Application Number
- CN202510755262.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-16
AI Technical Summary
Traditional power system electromagnetic transient analysis methods rely on manual derivation, which is inefficient and error-prone, and has difficulty handling multi-port components and complex topologies in large-scale complex systems.
By automatically deriving the small signal model of the component and using the Jacobian matrix and algebraic variable elimination technology, the power system component model is automatically linearized and discretized, and the discrete state space equation of the entire system is constructed.
It improves modeling efficiency and accuracy, can efficiently handle modeling problems of large-scale complex power systems, and supports automated processing of multi-port components and complex topologies.
Smart Images

Figure CN120653877A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power system electromagnetic transient modeling, and in particular relates to a method for automatically constructing a discrete state space equation of a power system electromagnetic transient. Background Art
[0002] Power systems are complex dynamic systems, and electromagnetic transient analysis is crucial for stable operation and fault diagnosis. Traditional electromagnetic transient analysis methods typically rely on detailed mathematical models and extensive manual calculations, which are not only time-consuming and labor-intensive but also prone to errors. With the rapid development of computer technology, automated modeling methods have gradually become a research hotspot in the field of power system analysis. Automated modeling methods can significantly improve modeling efficiency, reduce human error, and enhance model accuracy and reliability. However, existing automated modeling methods mostly focus on constructing continuous state-space equations, while relatively little research has been conducted on the automated construction of discrete state-space equations. Discrete state-space equations have important applications in digital simulation, real-time monitoring, and control strategy design for power systems. In power systems, electromagnetic transient processes involve a variety of physical phenomena and complex dynamic behaviors, such as generator rotor dynamics, transformer magnetization characteristics, and electromagnetic wave propagation on transmission lines. These phenomena are typically described by nonlinear differential and algebraic equations. Directly solving these equations often faces significant challenges in practical applications. To simplify analysis and computation, these nonlinear equations are often linearized near the equilibrium point to obtain a linearized state-space model. The Jacobian matrix plays a key role in this process. It approximates the complex nonlinear system into a linear system by calculating the first-order partial derivatives of the nonlinear equations, so that further analysis can be carried out using mature linear system theory.
[0003] Traditional power system electromagnetic transient simulation modeling is complex, relying on manual derivation and debugging, which is inefficient and prone to errors. As power systems expand in size and complexity, traditional modeling methods struggle to handle multi-port components and complex topologies.
[0004] This invention aims to automatically derive small-signal component models and utilize Jacobian matrices and algebraic variable elimination techniques to automatically linearize and discretize power system component models, significantly improving modeling efficiency and accuracy. By automatically processing complex power system topologies, supporting the modeling and discretization of multi-port components, generating node-branch correlation matrices, and rapidly constructing the discrete state-space equations for the entire system, it can efficiently handle the modeling of large-scale, complex power systems. Summary of the Invention
[0005] The purpose of the present invention is to provide a method for automatically constructing the electromagnetic transient discrete state space equations of the power system, so as to realize the automatic linearization and discretization of the power system component model, improve the modeling efficiency and accuracy, quickly construct the discrete state space equations of the whole system, and efficiently handle the modeling problems of large-scale complex power systems.
[0006] In order to solve the above technical problems, the technical solutions adopted by the present invention are as follows:
[0007] A method for automatically constructing discrete state-space equations of electromagnetic transients in a power system comprises the following steps:
[0008] S1: Import the nonlinear continuous state space model of the power elements in the power system and define the specified variables and equations of the power elements;
[0009] S2: linearizing the nonlinear continuous state space model to obtain a linearized continuous state space model of the element;
[0010] S3: Processing the linearized continuous state space model to obtain a linearized continuous state space model containing only state variables, that is, a small signal model of the element;
[0011] S4: discretizing the small signal model of the component according to the component type to obtain a discrete state space module, and constructing a corresponding discrete equivalent circuit;
[0012] S5: interconnect the discrete equivalent circuits of each component according to the grid topology to form a discrete network of the entire system;
[0013] S6: Obtain the discrete state space equations of the entire system by eliminating intermediate variables.
[0014] Preferably, the specific process in step S1 is as follows:
[0015] S11: Import the nonlinear continuous state space model of the component into the small signal analysis program;
[0016] S12: Define the state variables and algebraic variables, state equations and algebraic equations of the components;
[0017] The nonlinear continuous state space model of the element is expressed as follows:
[0018]
[0019] Where x is the state variable, y is the algebraic output variable, u is the input variable, f is the state equation, and g is the algebraic equation.
[0020] Preferably, the specific process of linearizing the nonlinear continuous state space model in step S2 to obtain the linearized continuous state space model of the element is as follows:
[0021] S21: Introduce the Jacobian matrix, which is expressed as follows:
[0022]
[0023] Among them, x is the state variable, y is the algebraic output variable, and u is the input variable;
[0024] S22: The Jacobian matrix can be divided into two parts:
[0025] The Jacobian matrix of the state equation is used to describe the partial derivatives of the state equation with respect to state variables and algebraic variables, and is expressed as follows:
[0026]
[0027] in, is the partial derivative of the state equation with respect to the state variable, is the partial derivative of the state equation with respect to the algebraic variable, is the partial derivative of the algebraic equation with respect to the state variable, is the partial derivative of an algebraic equation with respect to an algebraic variable;
[0028] The Jacobian matrix of an algebraic equation, which is used to describe the partial derivatives of the algebraic equation with respect to state variables and algebraic variables, is expressed as follows:
[0029]
[0030] in, is the partial derivative of the state equation with respect to the input variable, is the partial derivative of the algebraic equation with respect to the input variables;
[0031] S23: Calculate the Jacobian matrix J of the state equation and the Jacobian matrix B of the algebraic equation, and divide them into blocks as follows:
[0032]
[0033] Obtain a linearized continuous state-space model with algebraic variables:
[0034]
[0035] Preferably, in step S3, the linearized continuous state space model is processed to obtain a linearized continuous state space model containing only state variables, that is, the linearized continuous state space model containing algebraic variables is eliminated. The specific process is as follows:
[0036] S31: From Solve for y:
[0037] S32: Substitute the expression of y into This gives a linearized continuous state-space model containing only the state variable x:
[0038]
[0039] After sorting, we get:
[0040] S33: and Comparing the second line of
[0041]
[0042] S34: The continuous state space model of the linearized component, i.e. the small signal model of the component, is:
[0043]
[0044] Among them, x is the state variable, y is the algebraic output variable, and u is the input variable.
[0045] Preferably, the specific process of discretizing the small signal model of the power element according to the element type in step S4 to obtain a discrete state space module is as follows:
[0046] S41: Classify the power components and classify and discretely model each power component according to the interface relationship between each type of component and other parts of the network;
[0047] S42: Establish a discrete model of a single-port element;
[0048] S43: Establish a discrete model of a two-port component.
[0049] Preferably, the specific process of establishing the single-port element discrete model in step S42 is as follows:
[0050] S421: Using the bus voltage of the connected node as the input variable and the current flowing into the element at the connected node as the output variable, the continuous-time state-space equation of the single-port element itself is established, which is expressed as follows:
[0051]
[0052] Where D is the differential operator; X s is the state vector in the continuous domain inside the single-port element; u ixy and i ixyare the components of the input voltage / output current in the component model on the xy synchronous rotating coordinate axis; the subscript i indicates that the component is connected to the i-th node of the system; A s1 、B s1 、C s1 They are all coefficient matrices, which contain the electrical parameters, control parameters and initial value information of the target system;
[0053] S422: Ladder integration rule with step size Δt Discretize the differential equation in and get:
[0054]
[0055] Among them, h s (t) represents the quantity in the discretized equation related to the state at the previous calculation moment, which is defined as the “historical current term”; A s2 、B s2 、C s2 、D s2 Are coefficient matrices, expressed as follows:
[0056]
[0057] Among them, I n is the unit matrix, and the matrix order n is equal to the order of the component model under study;
[0058] S423: X s (t) = A s2 u ixy (t)+B s2 h s (t) respectively into and h s (t) = C s2 u ixy (t-Δt)+D s2 X s (t-Δt), the iterative expression of the historical current term and the output current expression are obtained:
[0059]
[0060] The expression of the coefficient matrix is:
[0061]
[0062] S423: Select the historical current item of the component as a discrete state variable, and establish a discrete equivalent circuit based on the relationship between the output current and the input voltage.
[0063] Preferably, the discrete model of the two-port element is established in step S43 as follows:
[0064] S431: Using the xy-axis components of the voltages at the two nodes connecting the two-port element to the network as input variables and the currents flowing into the element at the two nodes as output variables, the continuous-time state-space model of any two-port element is expressed as follows:
[0065]
[0066] Among them, X t is the state vector of the two-port element in the continuous domain; u kxy with u rxy are the components of the node voltage on both sides on the x and y axes respectively; i kxy / i rxy are the components of the current on both sides on the x and y axes respectively; A tl 、B tl 、B t2 、C t1 、C t2 、D t1 、D t2 、D t3 、D t4 are coefficient matrices, determined by the coefficients in the specific linearization model of the component established;
[0067] S432: Use the ladder integration rule with a step size of Δt to Discretize the differential equation in to obtain the intermediate equation:
[0068]
[0069] Where: h t (t) is the historical current term of the two-port element; the coefficient matrix A t2 、A t3 、B t3 、C t3 、C t4 、D t5 The expression is as follows:
[0070]
[0071] S433: X t (t) = A t2 u kxy (t)+A t3 u rxy (t)+B t3 h t (t) respectively into h t (t) = C t3 u kxy (t-Δt)+C t4 u rxy (t-Δt)+Dt5 X t (t-Δt) and The associated voltage and current are expressed as column vectors to obtain the discrete-time state-space model of the two-port element:
[0072]
[0073] Among them, u txy 、i txy are the node voltage vector associated with the two-port element and the current vector of the node injection element; the expressions of other coefficient matrices are:
[0074]
[0075] S434: Select the historical current term of the component as a discrete state variable to obtain a discrete equivalent circuit of the two-port component.
[0076] Preferably, the specific process of interconnecting the discrete equivalent circuits of each component to form a discrete network of the entire system according to the grid topology in step S5 is as follows:
[0077] S51: Assume that the j-th branch element contains m j ports, then the corresponding matrix block L of the element in the node-branch association matrix L j The dimension is 2n×2m j , expressed as follows:
[0078]
[0079] S52: The node-branch correlation matrix of any complex system is expressed as:
[0080] L=[L1 … L j … L b ];
[0081] S53: The discrete state space models of each component are arranged into a matrix form, and with the help of the discrete circuit network of the system, the node voltage equation is used to eliminate the intermediate variables to obtain the discrete state matrix of the entire system.
[0082] Preferably, in step S53, the specific process of eliminating intermediate variables using the node voltage equation to obtain the discrete state matrix of the entire system is as follows:
[0083] S531: Arrange the first term of the discrete state space equations of all components in the system in branch order into a matrix form as follows:
[0084] [h(t)]=[A d ] D [h(t-Δt)]+[Bd ] D [u xy (t-Δt)];
[0085] S532: Eliminate [h(t)] = [A d ] D [h(t-Δt)]+[B d ] D [u xy The node voltage column vectors associated with each component (t-Δt) are obtained based on the system topology. The relationship between the node voltage column vectors associated with each component and the node voltage column vectors of the entire system is expressed by the node-branch association matrix as follows:
[0086] [u xy (t-Δt)]=L T [U xy (t-Δt)] node ;
[0087] Among them, [U xy ] node is the column vector of the node voltage of the entire system;
[0088] S533: According to the node voltage equation in circuit theory, the relationship between the system node voltage and the node injection current is expressed as:
[0089] [U xy (t-Δt)] node =G -1 [I xy (t-Δt)] node ;
[0090] Among them, [I xy ] node Inject current column vector into each node;
[0091] S534: According to the node injection current in the whole network equivalent circuit, the equivalent current source (C dm h m ) composition, excluding other external power supplies, the actual node injection current of the power system is expressed as:
[0092] [I xy (t-Δt)] node =L[C d ] D [h(t-Δt)];
[0093] S535: Based on the system's correlation matrix and branch conductance matrix, the system's node conductance matrix G is obtained:
[0094] G=LY b LT =L[D d ] D L T ;
[0095] The discrete state space equation of the whole system is obtained:
[0096] [h(t)]={[A d ] D +[B d ] D L T (L[D d ] D L T ) -1 L[C d ] D}[h(t-Δt)]=A dis [h(t-Δt)];
[0097] Among them, A dis That is the discrete state matrix of any system to be solved.
[0098] The beneficial effects of the present invention include:
[0099] The method for automatically constructing the discrete state-space equations of electromagnetic transients in power systems provided by the present invention realizes automatic linearization and discretization of the power system component models by automatically deriving the small signal models of the components and utilizing the Jacobian matrix and algebraic variable elimination technology, thereby significantly improving the modeling efficiency and accuracy. By automatically processing the topological structure of complex power systems, supporting the modeling and discretization of multi-port components, generating a node-branch association matrix, and quickly constructing the discrete state-space equations of the entire system, it is possible to efficiently handle the modeling problems of large-scale complex power systems. This solves the technical problems that the traditional power system electromagnetic transient simulation modeling process is complex, relies on manual derivation and debugging, is inefficient and prone to errors, and that as the scale of the power system expands and the complexity increases, the traditional modeling method is difficult to cope with the processing of multi-port components and complex topological structures. BRIEF DESCRIPTION OF THE DRAWINGS
[0100] Figure 1 The figure is a flow chart of the method for automatically constructing the discrete state space equations of the electromagnetic transient state of the power system according to the present invention.
[0101] Figure 2 Schematic diagram of the process of automatically deriving the small signal model of a component according to the present invention.
[0102] Figure 3 Schematic diagram of the discrete state space modeling process of the present invention.
[0103] Figure 4 Schematic diagram of the discrete equivalent circuit of a single-port element of the present invention.
[0104] Figure 5 Schematic diagram of the discrete equivalent circuit of a single-port element of the present invention.
[0105] Figure 6 Schematic diagram of the discrete equivalent circuit of the two-port element of the present invention. DETAILED DESCRIPTION
[0106] The following is combined with Figures 1 to 6 The present invention is described in further detail:
[0107] See attached Figure 1 As shown, a method for automatically constructing the discrete state space equations of the electromagnetic transient state of a power system includes the following steps:
[0108] S1: Import the nonlinear continuous state space model of the power elements in the power system and define the specified variables and equations of the power elements;
[0109] S2: linearizing the nonlinear continuous state space model to obtain a linearized continuous state space model of the element;
[0110] S3: Processing the linearized continuous state space model to obtain a linearized continuous state space model containing only state variables, that is, a small signal model of the element;
[0111] S4: discretizing the small signal model of the component according to the component type to obtain a discrete state space module, and constructing a corresponding discrete equivalent circuit;
[0112] S5: interconnect the discrete equivalent circuits of each component according to the grid topology to form a discrete network of the entire system;
[0113] S6: Obtain the discrete state space equations of the entire system by eliminating intermediate variables.
[0114] In a method for automatically constructing discrete state-space equations for electromagnetic transients in a power system, the present invention first imports a nonlinear continuous state-space model of a component, defines state variables, algebraic variables, state equations, and algebraic equations, and linearizes the model using the Jacobian matrix to obtain a linearized continuous state-space model of the component. Next, by eliminating algebraic variables, a linearized continuous state-space model containing only the state variables, i.e., the small-signal model of the component, is obtained. Then, based on the component type (single-port component or two-port component), the continuous-time state-space model is discretized using the trapezoidal integration rule to obtain a discrete state-space model of the component, and a corresponding discrete equivalent circuit is constructed. Finally, based on the power grid topology, the discrete equivalent circuits of each component are interconnected to form a discrete network for the entire system. Intermediate variables are eliminated using node voltage equations to obtain the discrete state-space equations for the entire system. By automatically deriving the small-signal model of the component and utilizing the Jacobian matrix and algebraic variable elimination techniques, automatic linearization and discretization of the power system component model are achieved, significantly improving modeling efficiency and accuracy. By automatically processing complex power system topologies, supporting the modeling and discretization of multi-port components, generating node-branch association matrices, and rapidly constructing discrete state-space equations for the entire system, the system can efficiently handle the modeling of large-scale, complex power systems. This addresses the technical challenges of traditional power system electromagnetic transient simulation modeling, which is complex, relies on manual derivation and debugging, is inefficient, and prone to errors. Furthermore, as power systems expand in size and complexity, traditional modeling methods struggle to cope with multi-port components and complex topologies.
[0115] Example 2
[0116] Based on Example 1, the specific process in step S1 is as follows:
[0117] S11: Import the nonlinear continuous state space model of the component into the small signal analysis program;
[0118] S12: Define the state variables and algebraic variables, state equations and algebraic equations of the components;
[0119] The nonlinear continuous state space model of the element is expressed as follows:
[0120]
[0121] Where x is the state variable, y is the algebraic output variable, u is the input variable, f is the state equation, and g is the algebraic equation.
[0122] In this embodiment, the specific process of linearizing the nonlinear continuous state space model in step S2 to obtain the linearized continuous state space model of the element is as follows:
[0123] S21: Introduce the Jacobian matrix, which is expressed as follows:
[0124]
[0125] Among them, x is the state variable, y is the algebraic output variable, and u is the input variable.
[0126] The Jacobian matrix is the matrix of partial derivatives of the system equations with respect to the state variables and the input variables.
[0127] S22: For the state-space model, the Jacobian matrix can be divided into two parts:
[0128] The Jacobian matrix of the state equation is used to describe the partial derivatives of the state equation with respect to state variables and algebraic variables, and is expressed as follows:
[0129]
[0130] in, is the partial derivative of the state equation with respect to the state variable, is the partial derivative of the state equation with respect to the algebraic variable, is the partial derivative of the algebraic equation with respect to the state variable, is the partial derivative of an algebraic equation with respect to an algebraic variable;
[0131] The Jacobian matrix of an algebraic equation, which is used to describe the partial derivatives of the algebraic equation with respect to state variables and algebraic variables, is expressed as follows:
[0132]
[0133] in, is the partial derivative of the state equation with respect to the input variable, is the partial derivative of the algebraic equation with respect to the input variables;
[0134] S23: Calculate the Jacobian matrix J of the state equation and the Jacobian matrix B of the algebraic equation, and divide them into blocks as follows:
[0135]
[0136] Obtain a linearized continuous state-space model with algebraic variables:
[0137]
[0138] Example 3
[0139] On the basis of Example 1 or Example 2, in step S3, the linearized continuous state space model is processed to obtain a linearized continuous state space model containing only state variables, that is, the linearized continuous state space model containing algebraic variables is eliminated. The specific process is as follows:
[0140] S31: From Solve for y:
[0141] S32: Substitute the expression of y into This gives a linearized continuous state-space model containing only the state variable x:
[0142]
[0143] After sorting, we get:
[0144] S33: and Comparing the second line of
[0145]
[0146] S34: The continuous state space model of the linearized component, i.e. the small signal model of the component, is:
[0147]
[0148] Among them, x is the state variable, y is the algebraic output variable, and u is the input variable.
[0149] The specific process of discretizing the small signal model of the power element according to the element type in step S4 to obtain a discrete state space module is as follows:
[0150] S41: It is necessary to establish a linearized continuous-time state-space model of common power components in the system, classify the power components, and classify and discretely model each power component based on the interface relationship between each type of component and other parts of the network;
[0151] S42: Establish a discrete model of a single-port element;
[0152] S43: Establish a discrete model of a two-port component.
[0153] The specific process of establishing the single-port element discrete model in step S42 is as follows:
[0154] S421: Using the bus voltage of the connected node as the input variable and the current flowing into the element at the connected node as the output variable, the continuous-time state-space equation of the single-port element itself is established, which is expressed as follows:
[0155]
[0156] Where D is the differential operator; X s is the state vector in the continuous domain inside the single-port element; uixy and i ixy are the components of the input voltage / output current in the component model on the xy synchronous rotating coordinate axis; the subscript i indicates that the component is connected to the i-th node of the system; A s1 、B s1 、C s1 They are all coefficient matrices, which contain the electrical parameters, control parameters and initial value information of the target system;
[0157] S422: Ladder integration rule with step size Δt Discretize the differential equation in and get:
[0158]
[0159] Among them, h s (t) represents the quantity in the discretized equation related to the state at the previous calculation moment, which is defined as the “historical current term”; A s2 、B s2 、C s2 、D s2 Are coefficient matrices, expressed as follows:
[0160]
[0161] Among them, I n is the unit matrix, and the matrix order n is equal to the order of the component model under study;
[0162] S423: X s (t) = A s2 u ixy (t)+B s2 h s (t) respectively into and h s (t) = C s2 u ixy (t-Δt)+D s2 X s (t-Δt), the iterative expression of the historical current term and the output current expression are obtained:
[0163]
[0164] The expression of the coefficient matrix is:
[0165]
[0166] Select the "historical current term" of the component as the discrete state variable, according to i ixy (t) = -C ds h s (t)+D ds uixy The relationship between the output current and input voltage in (t) can be expressed as Figure 2 The discrete equivalent circuit shown in the figure shows that the circuit only includes an equivalent conductance and an equivalent current source, where the conductance value is D ds , the current source value is C ds h s .
[0167] S423: Select the historical current item of the component as a discrete state variable, and establish a discrete equivalent circuit based on the relationship between the output current and the input voltage.
[0168] Preferably, the discrete model of the two-port element is established in step S43 as follows:
[0169] S431: Using the xy-axis components of the voltages at the two nodes connecting the two-port element to the network as input variables and the currents flowing into the element at the two nodes as output variables, the continuous-time state-space model of any two-port element is expressed as follows:
[0170]
[0171] Among them, X t is the state vector of the two-port element in the continuous domain; u kxy with u rxy are the components of the node voltage on both sides on the x and y axes respectively; i kxy / i rxy are the components of the current on both sides on the x and y axes respectively; A tl 、B tl 、B t2 、C t1 、C t2 、D t1 、D t2 、D t3 、D t4 are coefficient matrices, determined by the coefficients in the specific linearization model of the component established;
[0172] S432: Use the ladder integration rule with a step size of Δt to Discretize the differential equation in to obtain the intermediate equation:
[0173]
[0174] Where: h t (t) is the historical current term of the two-port element; the coefficient matrix A t2 、A t3 、B t3 、C t3 、C t4 、D t5 The expression is as follows:
[0175]
[0176] S433: X t (t) = A t2 u kxy (t)+A t3 u rxy (t)+B t3 h t (t) respectively into h t (t) = C t3 u kxy (t-Δt)+C t4 u rxy (t-Δt)+D t5 X t (t-Δt) and The associated voltage and current are expressed as column vectors to obtain the discrete-time state-space model of the two-port element:
[0177]
[0178] Among them, u txy 、i txy are the node voltage vector associated with the two-port element and the current vector of the node injection element; the expressions of other coefficient matrices are:
[0179]
[0180] S434: Select the historical current item of the component as the discrete state variable, according to the formula , the discrete equivalent circuit of the two-port element can be obtained as Figure 5 As shown, the circuit consists of an equivalent branch conductance, which includes the self-conductance at the associated node and the mutual conductance between nodes and two equivalent current sources connected to the associated nodes respectively, where the conductance matrix value is D dt , the current source values are C dt1 h t and C dt2 h t .
[0181] Example 4
[0182] Based on Example 1, Example 2, or Example 3, after obtaining the linearized discrete state space model and discrete equivalent circuit of the component, the discrete equivalent circuits of each component are interconnected according to the grid topology to form a discrete network of the entire system, and a node-branch association matrix representing the system topology is obtained. The formation of the node-branch association matrix will be introduced below.
[0183] For a circuit with n nodes and b components, if the circuit is a single-phase system, its node-branch association matrix is an n×b dimensional matrix consisting of 1, -1, and 0. Considering that the equations in the discrete equivalent circuit of the complex system established in this paper are based on a two-dimensional xy synchronous rotating coordinate system, and the number of ports of each type of component is different, the corresponding node-branch association matrix form and dimension will be different. Without loss of generality, assume that the j-th branch element contains m j ports, then the corresponding matrix block L of the element in the node-branch association matrix L j The dimension is 2n×2m j , as shown in the formula in step S51. The numbers 1 to n in the left bracket represent the node numbers, and the numbers 1 to m in the lower bracket represent the node numbers. j Indicates the component port number. j In the example, the element value at the node where the component is associated with the network is the unit matrix I2 or -I2. If the direction of the historical current source is outflowing from the node, the element value is I2. If the direction of the historical current source is inflowing into the node, the element value is -I2. All other elements are 0. In this embodiment, it is assumed that the first port of the component coincides with the system node 1, and the mth port is j The ports coincide with system node n, and the directions of the historical current sources all flow out of the node. In actual calculations, the system node numbers can be freely selected without this restriction.
[0184] The specific process of interconnecting the discrete equivalent circuits of each component to form a discrete network of the entire system according to the grid topology in step S5 is as follows:
[0185] S51: Assume that the j-th branch element contains m j ports, then the corresponding matrix block L of the element in the node-branch association matrix L j The dimension is 2n×2m j , expressed as follows:
[0186]
[0187] S52: The node-branch correlation matrix of any complex system is expressed as:
[0188] L=[L1 … L j … L b ].
[0189] Obviously, the row dimension of L is 2n and the column dimension is
[0190] S53: The discrete state space models of each component are arranged into a matrix form, and with the help of the discrete circuit network of the system, the node voltage equation is used to eliminate the intermediate variables to obtain the discrete state matrix of the entire system.
[0191] In step S53, the specific process of eliminating intermediate variables using the node voltage equation to obtain the discrete state matrix of the entire system is as follows:
[0192] S531: Arrange the first term of the discrete state space equations of all components in the system in branch order into a matrix form as follows:
[0193] [h(t)]=[A d ] D [h(t-Δt)]+[B d ] D [u xy (t-Δt)];
[0194] S532: Eliminate [h(t)] = [A d ] D [h(t-Δt)]+[B d ] D [u xy The node voltage column vectors associated with each component (t-Δt) are obtained based on the system topology. The relationship between the node voltage column vectors associated with each component and the node voltage column vectors of the entire system is expressed by the node-branch association matrix as follows:
[0195] [u xy (t-Δt)]=L T [U xy (t-Δt)] node ;
[0196] Among them, [U xy ] node is the column vector of the node voltage of the entire system;
[0197] S533: According to the node voltage equation in circuit theory, the relationship between the system node voltage and the node injection current is expressed as:
[0198] [U xy (t-Δt)] node =G -1 [I xy (t-Δt)] node ;
[0199] Among them, [I xy ] node Inject current column vector into each node;
[0200] S534: According to the node injection current in the whole network equivalent circuit, the equivalent current source (C dm h m) composition, excluding other external power supplies, the actual node injection current of the power system is expressed as:
[0201] [I xy (t-Δt)] node =L[C d ] D [h(t-Δt)];
[0202] S535: Based on the system's correlation matrix and branch conductance matrix, the system's node conductance matrix G is obtained:
[0203] G=LY b L T =L[D d ] D L T ;
[0204] The discrete state space equation of the whole system is obtained:
[0205] [h(t)]={[A d ] D +[B d ] D L T (L[D d ] D L T ) -1 L[C d ] D}[h(t-Δt)]=A dis [h(t-Δt)];
[0206] Among them, A dis That is the discrete state matrix of any system to be solved.
[0207] See also Figure 6 As shown in FIG, the process of automatically constructing a small signal analysis example of the system in the present invention is as follows:
[0208] 1. Set up API authentication and connection
[0209] ① Get API token:
[0210] The API token is the identity credential for accessing the power system simulation platform. It must be applied for on the platform or generated through a developer account. The token is set in the code using xxx.setToken().
[0211] ②Configure the API service address
[0212] Specify the API server address of the power system simulation platform, set through environment variables.
[0213] 2. Request simulation model data
[0214] ①Get the model ID
[0215] Each simulation model has a unique identifier (such as model / w864273603 / IEEE3) on the power system simulation platform, which needs to be obtained from the platform in advance.
[0216] The code requests the model via Model.fetch().
[0217] ②Analytical model topology
[0218] After obtaining the model, its topological information (such as busbars, lines, generators and other components) is extracted.
[0219] 3. Processing model data
[0220] ① Extract key component parameters
[0221] Filter data by component type (e.g. busbar, line, generator) and extract parameters.
[0222] ② Dynamic correction parameters (such as line impedance)
[0223] Dynamically correct the parameters to be calculated (such as line impedance).
[0224] 4. Generate a small signal analysis script for the system: Generate an analysis script based on the extracted parameters according to the grammatical rules of the small signal analysis program of the target platform.
[0225] This method automatically derives a linearized continuous state-space model of a component by introducing the Jacobian matrix. By eliminating algebraic variables, a small-signal model containing only state variables is obtained. This fully automated process avoids the tedious manual derivation and linearization steps required in traditional methods. The continuous-time state-space model is discretized using the trapezoidal integration rule, and discrete equivalent circuits for single-port and two-port components are constructed. The introduction of a "historical current term" as a discrete state variable simplifies the derivation of the discrete model.
[0226] By automatically eliminating intermediate variables and generating the discrete state-space equations for the entire system through the node-branch correlation matrix and node voltage equations, this process is fully automated, requiring no manual intervention. It can handle complex power systems containing multiple types of components, including single-port and two-port components, and automatically handle the interconnections between components. The introduction of the Jacobian matrix and trapezoidal integration rule ensures the accuracy and stability of the model's linearization and discretization processes. The API interface automatically acquires simulation model data, extracts key component parameters, and generates a small-signal analysis script for the system, enabling automated small-signal analysis.
[0227] In summary, the method for automatically constructing the electromagnetic transient discrete state space equation of the power system provided by the present invention imports the nonlinear continuous state space model of the component, defines the variables and equations, and linearizes the model using the Jacobian matrix to obtain the linearized continuous state space model of the component. By eliminating algebraic variables, a linearized continuous state space model containing only state variables is obtained, that is, the small signal model of the component. According to the type of component (single-port component and dual-port component), the continuous-time state space model is discretized using the trapezoidal integration rule to obtain the discrete state space model of the component, and the corresponding discrete equivalent circuit is constructed. Finally, according to the power grid topology, the discrete equivalent circuits of each component are interconnected to form a discrete network of the entire system, and the intermediate variables are eliminated through the node voltage equation to obtain the discrete state space equation of the entire system.
Claims
1. A method for automatically constructing discrete state space equations for electromagnetic transients in power systems, characterized in that: The following steps are involved: S1: Import the nonlinear continuous state space model of the power elements in the power system and define the specified variables and equations of the power elements; S2: linearizing the nonlinear continuous state space model to obtain a linearized continuous state space model of the element; S3: Processing the linearized continuous state space model to obtain a linearized continuous state space model containing only state variables, that is, a small signal model of the element; S4: discretizing the small signal model of the component according to the component type to obtain a discrete state space module, and constructing a corresponding discrete equivalent circuit; S5: interconnect the discrete equivalent circuits of each component according to the grid topology to form a discrete network of the entire system; S6: Obtain the discrete state space equations of the entire system by eliminating intermediate variables.
2. The method for automatically constructing the electromagnetic transient discrete state space equation of a power system according to claim 1, characterized in that: The specific process in step S1 is as follows: S11: Import the nonlinear continuous state space model of the component into the small signal analysis program; S12: Define the state variables and algebraic variables, state equations and algebraic equations of the components; The nonlinear continuous state space model of the element is expressed as follows: Where x is the state variable, y is the algebraic output variable, u is the input variable, f is the state equation, and g is the algebraic equation.
3. The method for automatically constructing the electromagnetic transient discrete state space equation of a power system according to claim 2, characterized in that: The specific process of linearizing the nonlinear continuous state space model in step S2 to obtain the linearized continuous state space model of the element is as follows: S21: Introduce the Jacobian matrix, which is expressed as follows: Among them, x is the state variable, y is the algebraic output variable, and u is the input variable; S22: The Jacobian matrix can be divided into two parts: The Jacobian matrix of the state equation is used to describe the partial derivatives of the state equation with respect to state variables and algebraic variables, and is expressed as follows: in, is the partial derivative of the state equation with respect to the state variable, is the partial derivative of the state equation with respect to the algebraic variable, is the partial derivative of the algebraic equation with respect to the state variable, is the partial derivative of an algebraic equation with respect to an algebraic variable; The Jacobian matrix of an algebraic equation, which is used to describe the partial derivatives of the algebraic equation with respect to state variables and algebraic variables, is expressed as follows: in, is the partial derivative of the state equation with respect to the input variable, is the partial derivative of the algebraic equation with respect to the input variables; S23: Calculate the Jacobian matrix J of the state equation and the Jacobian matrix B of the algebraic equation, and divide them into blocks as follows: Obtain a linearized continuous state-space model with algebraic variables:
4. The method for automatically constructing the electromagnetic transient discrete state space equation of a power system according to claim 3, characterized in that: In step S3, the linearized continuous state space model is processed to obtain a linearized continuous state space model containing only state variables, that is, the linearized continuous state space model containing algebraic variables is eliminated. The specific process is as follows: S31: From Solve for y: S32: Substitute the expression of y into This gives a linearized continuous state-space model containing only the state variable x: After sorting, we get: S33: and Comparing the second line of S34: The continuous state space model of the linearized component, i.e. the small signal model of the component, is: Among them, x is the state variable, y is the algebraic output variable, and u is the input variable.
5. The method for automatically constructing the discrete state space equations of the electromagnetic transient state of the power system according to claim 1, characterized in that: The specific process of discretizing the small signal model of the power element according to the element type in step S4 to obtain a discrete state space module is as follows: S41: Classify the power components and classify and discretely model each power component according to the interface relationship between each type of component and other parts of the network; S42: Establish a discrete model of a single-port element; S43: Establish a discrete model of a two-port component.
6. The method for automatically constructing the electromagnetic transient discrete state space equation of a power system according to claim 5, characterized in that: The specific process of establishing the single-port element discrete model in step S42 is as follows: S421: Using the bus voltage of the connected node as the input variable and the current flowing into the element at the connected node as the output variable, the continuous-time state-space equation of the single-port element itself is established, which is expressed as follows: Where D is the differential operator; X s is the state vector in the continuous domain inside the single-port element; u ixy and i ixy are the components of the input voltage / output current in the component model on the xy synchronous rotating coordinate axis; the subscript i indicates that the component is connected to the i-th node of the system; A s1 、B s1 、C s1 They are all coefficient matrices, which contain the electrical parameters, control parameters and initial value information of the target system; S422: Ladder integration rule with step size Δt Discretize the differential equation in and get: Among them, h s (t) represents the quantity in the discretized equation related to the state at the previous calculation moment, which is defined as the "historical current term"; A s2 、B s2 、C s2 、D s2 Are coefficient matrices, expressed as follows: Among them, I n is the unit matrix, and the matrix order n is equal to the order of the component model under study; S423: Bring in separately and h s (t) = C s2 u ixy (t-△t)+D s2 X s (t-△t), the iterative expression of the historical current term and the output current expression are obtained: The expression of the coefficient matrix is: S423: Select the historical current item of the component as a discrete state variable, and establish a discrete equivalent circuit based on the relationship between the output current and the input voltage.
7. The method for automatically constructing the discrete state space equations of the electromagnetic transient state of the power system according to claim 5, characterized in that: The specific steps of establishing the two-port element discrete model in step S43 are as follows: S431: Using the xy-axis components of the voltages at the two nodes connecting the two-port element to the network as input variables and the currents flowing into the element at the two nodes as output variables, the continuous-time state-space model of any two-port element is expressed as follows: Among them, X t is the state vector of the two-port element in the continuous domain; u kxy with u rxy are the components of the node voltage on both sides on the x and y axes respectively; i kxy / i rxy are the components of the current on both sides on the x and y axes respectively; A tl 、B tl 、B t2 、C t1 、C t2 、D t1 、D t2 、D t3 、D t4 are coefficient matrices, determined by the coefficients in the specific linearization model of the component established; S432: Use the ladder integration rule with a step size of Δt to Discretize the differential equation in to obtain the intermediate equation: Where: h t (t) is the historical current term of the two-port element; the coefficient matrix A t2 、A t3 、B t3 、C t3 、C t4 、D t5 The expression is as follows: S433: X t (t) = A t2 u kxy (t)+A t3 u rxy (t)+B t3 h t (t) respectively into h t (t) = C t3 u kxy (t-Δt)+C t4 u rxy (t-Δt)+D t5 X t (t-Δt) and The associated voltage and current are expressed as column vectors to obtain the discrete-time state-space model of the two-port element: Among them, u txy 、i txy are the node voltage vector associated with the two-port element and the current vector of the node injection element; the expressions of other coefficient matrices are: S434: Select the historical current term of the component as a discrete state variable to obtain a discrete equivalent circuit of the two-port component.
8. The method for automatically constructing the electromagnetic transient discrete state space equation of a power system according to claim 1, characterized in that: The specific process of interconnecting the discrete equivalent circuits of each component to form a discrete network of the entire system according to the grid topology in step S5 is as follows: S51: Assume that the j-th branch element contains m j ports, then the corresponding matrix block L of the element in the node-branch association matrix L j The dimension is 2n×2m j , expressed as follows: S52: The node-branch correlation matrix of any complex system is expressed as: L=[L1 … L j … L b ]; S53: The discrete state space models of each component are arranged into a matrix form, and with the help of the discrete circuit network of the system, the node voltage equation is used to eliminate the intermediate variables to obtain the discrete state matrix of the entire system.
9. The method for automatically constructing the discrete state space equations of the electromagnetic transient state of the power system according to claim 8, characterized in that: In step S53, the specific process of eliminating intermediate variables using the node voltage equation to obtain the discrete state matrix of the entire system is as follows: S531: Arrange the first term of the discrete state space equations of all components in the system in branch order into a matrix form as follows: [h(t)]=[A d ] D [h(t-Δt)]+[B d ] D [u xy (t-Δt)]; S532: Eliminate [h(t)] = [A d ] D [h(t-Δt)]+[B d ] D [u xy The node voltage column vectors associated with each component (t-Δt) are obtained based on the system topology. The relationship between the node voltage column vectors associated with each component and the node voltage column vectors of the entire system is expressed by the node-branch association matrix as follows: [u xy (t-Δt)]=L T [U xy (t-Δt)] node ; Among them, [U xy ] node is the column vector of the node voltage of the entire system; S533: According to the node voltage equation in circuit theory, the relationship between the system node voltage and the node injection current is expressed as: [U xy (t-Δt)] node =G -1 [I xy (t-Δt)] node ; Among them, [I xy ] node Inject current column vector into each node; S534: According to the node injection current in the whole network equivalent circuit, the equivalent current source (C dm h m ) composition, excluding other external power supplies, the actual node injection current of the power system is expressed as: [I xy (t-Δt)] node =L[C d ] D [h(t-Δt)]; S535: Based on the system's correlation matrix and branch conductance matrix, the system's node conductance matrix G is obtained: G=LY b L T =L[D d ] D L T ; The discrete state space equation of the whole system is obtained: [h(t)]={[A d ] D +[B d ] D L T (L[D d ] D L T ) -1 L[C d ] D }[h(t-Δt)]=A dis [h(t-Δt)]; Among them, A dis That is the discrete state matrix of any system to be solved.