Symbolic modeling of equipment for power system transient simulation and its application method
Automatically deriving the Jacques matrix through symbolic calculation and sparse matrix technology solves the difficulties in establishing and maintaining dynamic models of diversified power generation equipment, and improves the efficiency and accuracy of transient simulation of power systems.
Patent Information
- Application Number
- CN202111244498.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-17
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-10-17
AI Technical Summary
In the power system with high proportion of grid-connected new energy, diversified types of power generation equipment make it difficult to establish and maintain their dynamic models, especially the derivation and calculation of the Jacques matrix are cumbersome and prone to errors, which affects transient simulation and stable analysis. Validity.
Symbol computing technology and sparse matrix technology are used to automatically deduce and generate symbolized Jacqueline matrices, simplify the calculation of differential algebraic equations, and improve the convenience and accuracy of model maintenance.
It significantly improves the convenience and accuracy of equipment modeling, uses sparse matrix structure to improve computing efficiency, and simplifies the transient simulation process of large-scale power systems.
Smart Images

Figure CN113987781B_ABST
Abstract
Description
Technical field:
[0001] The invention relates to an equipment modeling method for transient simulation of an electric power system, and belongs to the technical field of electric power system stability analysis. Background technology:
[0002] With the continuous development and widespread application of renewable energy power generation technology, the types of power generation equipment in power systems are becoming increasingly diverse, and the dynamic behaviors of various types of equipment are significantly different. For power systems with a high proportion of renewable energy connected to the grid, how to establish and maintain dynamic models for various types of power generation equipment is an important issue to ensure the effectiveness of transient stability analysis of power systems and their safe operation.
[0003] In view of the transient simulation needs of power systems, the establishment and maintenance of dynamic models of renewable energy power generation equipment mainly face the following problems: 1) The operating mechanisms of different types of equipment are quite different (such as doubly-fed wind turbines and photovoltaic power stations), which leads to significantly different mathematical models, manifested as different differential algebraic equation structures and parameters; 2) Renewable energy power generation equipment is usually based on power converters for grid connection, and the control methods and control modes of power converters have great flexibility (such as virtual synchronization mode, constant power / constant voltage mode, etc.), which will also lead to changes in their differential algebraic equations; 3) In transient stability analysis and other stability analysis work, the Jacobian matrix of the above differential algebraic equations is usually required. For multi-dimensional nonlinear differential algebraic equations, the derivation and calculation of the Jacobian matrix is a very tedious and error-prone task, which increases the difficulty of establishing and maintaining its dynamic model. For transient simulation and stability analysis of high-proportion renewable energy power systems, the above problems need to be solved urgently in practical applications and academic research.
[0004] For transient simulation of power systems, the Implicit Euler method is usually used to solve the differential algebraic equations of the system as a whole. In the solution process, it is necessary to calculate the Jacobian matrix of the differential algebraic equation, that is, the first-order gradient of the differential algebraic equation relative to the system variables. The Jacobian matrix formed has a highly sparse structure, so the use of sparse matrix technology can significantly improve the computational efficiency and reduce the storage requirements of the calculation. For new energy power generation equipment with various types and variable models, the main difficulty in establishing and maintaining its differential algebraic model lies in the derivation and calculation of the Jacobian matrix. In view of this difficulty, symbolic computing technology can be used as the basis for obtaining the symbolic Jacobian matrix, thereby avoiding tedious and error-prone manual derivation, and improving the convenience and accuracy of equipment modeling and model maintenance. Summary of the invention:
[0005] Aiming at the modeling and maintenance requirements of dynamic models of multiple types of power generation equipment in transient simulation of high-proportion renewable energy power systems, the present invention proposes symbolic modeling of differential algebraic equations based on symbolic computing technology and sparse matrix technology and its application method. Based on the symbolic description of differential algebraic equations of the equipment dynamic model, the sparse, symbolic Jacobian matrix is automatically derived, and further the calculation functions of differential algebraic equations and their Jacobian matrices are automatically generated, which can be called by upper-level transient simulation programs or other stability analysis programs.
[0006] In order to achieve the above-mentioned invention object, the device symbolic modeling and application method for power system transient simulation proposed in the present invention include the following steps:
[0007] (1) Establish symbolic expressions of differential equations and algebraic equations of the differential-algebraic model of the equipment, and determine the set of differential variables, algebraic variables, input variables, and auxiliary variables contained in the symbolic expressions;
[0008] (2) Sequentially number the differential equations and algebraic equations in the previous step, and sequentially number the differential variables, algebraic variables, and input variables in the previous step;
[0009] (3) Using symbolic scanning technology, search for a subset of differential variables, algebraic variables, and input variables contained in each differential equation / algebraic equation, and create a search record;
[0010] (4) Based on the search records in the previous step, use symbolic differentiation techniques to calculate the symbolic expression of the sparse Jacobian matrix elements corresponding to each differential equation / algebraic equation;
[0011] (5) Based on the symbolic expression of the sparse Jacobian matrix elements in the previous step, a text processing and writing method is used to generate the source code of the Jacobian matrix calculation function in the required programming language;
[0012] (6) Based on the symbolic expressions of differential equations and algebraic equations, the source code of the differential-algebraic equation calculation function in the required programming language is generated using text processing and writing methods.
[0013] 2. As a further solution of the present invention: In step (1), for the device to be modeled, according to the operating mechanism of the device and its dynamic process at the time scale of interest, the differential variable x, algebraic variable y, input variable u, and auxiliary variable z contained in its differential algebraic model are determined, and symbolic variable sets of the above four types of variables are established respectively; based on the established symbolic variable sets, symbolic expressions of differential equations and algebraic equations are formed for the differential equations f and algebraic equations g of the differential algebraic model. Among them, the algebraic variable y includes the device injection current (i x 、i y ) and equipment grid-connected bus voltage (vx 、v y ), injected current and bus voltage (i x 、i y 、v x 、v y ) is used as the interface variable between the grid-connected equipment and the power network, and the auxiliary variable z is a function expression of (x, y, u). Through variable substitution, the auxiliary variable z is eliminated in the differential equation f and the algebraic equation g;
[0014] 3. As a further solution of the present invention: in step (3), based on the sequentially numbered symbolic variables (x, y, u) and the sequentially numbered symbolic equations (f, g) in step (2), the differential variables, algebraic variables, and input variables contained in each equation are found through symbol scanning and searching to form a search record. Each record contains the number of the equation and the number of the variables contained in the equation, and the record determines the position of the non-zero elements in the Jacobian matrix;
[0015] 4. As a further solution of the present invention: In step (4), based on the search records formed in step (3), the symbolic differential technique is used to calculate the first-order symbolic differential expression of the equation corresponding to each record relative to the variables it contains, that is, the symbolic expression of the non-zero elements of the Jacobian matrix, and then establish a symbolic sparse Jacobian matrix in a triple format, and the triple format of each matrix element is: (equation number, variable number, symbolic differential expression). The Jacobian matrix contains 6 sub-matrices, namely (differential equation relative differential variable), (Differential equations relative to algebraic variables), (differential equation relative input variables), (algebraic equations relative to differential variables), (algebraic equations relative to algebraic variables) and (algebraic equations relative to input variables);
[0016] 5. As a further solution of the present invention: In step (5), according to the symbolized Jacobian matrix obtained in step (4): As well as the development language of the upper-level simulation program, text processing and writing technology are used to generate the source code of the corresponding Jacobian matrix calculation function. When generating the source code file, vectorization operations are used so that the generated Jacobian matrix calculation function can process multiple devices of the same type at the same time;
[0017] 6. As a further solution of the present invention: in step (6), based on the symbolic variables (x, y, u, z), symbolic equations (f, g) and the development language of the upper-layer simulation program established in step (1), the source code of the differential algebraic equation calculation function is generated by using text processing and writing technology. When generating the source code file, vectorization operation is used so that the generated differential algebraic equation calculation function can process multiple similar devices at the same time.
[0018] The present invention can be applied to the symbolic modeling of dynamic models of various types of equipment in power systems, and conveniently generates the source code of differential equations and their sparse form Jacobian matrix calculation functions, significantly improving the maintainability of model codes and the development efficiency of transient simulation applications. At the same time, the Jacobian matrix is directly generated in the form of a sparse matrix, which effectively utilizes the sparse structure characteristics of the power system dynamic model, and helps to improve the computational efficiency of large-scale power system transient simulation. Description of the drawings:
[0019] Figure 1 :Flowchart of symbolic modeling of equipment dynamic model and its application method
[0020] Figure 2 :Symbolic differential algebraic equations for doubly-fed wind turbine generators (f, g)
[0021] Figure 3 : Symbolic variable set of doubly-fed wind turbine generator (x, y, u, z)
[0022] Figure 4 :Flowchart of symbolic search and record generation for differential algebraic equations
[0023] Figure 5 : Automatically generated Jacobian matrix calculation function part of the source code
[0024] Figure 6 : Automatically generated source code for differential algebraic equation calculation functions
[0025] Figure 7 :The calling relationship between differential algebraic equations and their Jacobian matrix calculation functions and upper-level transient simulation applications
[0026] Figure 8 :Topology diagram of a 3-machine 9-bus system with a doubly-fed wind turbine
[0027] Fig. 9 :3-machine 9-bus system transient simulation results Specific implementation method:
[0028] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0029] The implementation process of equipment symbolic modeling and its application method for power system transient simulation is as follows Figure 1 As shown, the specific steps include:
[0030] (1) Establish symbolic expressions of differential equations and algebraic equations of the differential-algebraic model of the equipment, and determine the set of differential variables, algebraic variables, input variables, and auxiliary variables contained in the symbolic expressions;
[0031] (2) Sequentially number the differential equations and algebraic equations in the previous step, and sequentially number the differential variables, algebraic variables, and input variables in the previous step;
[0032] (3) Using symbolic scanning technology, search for a subset of differential variables, algebraic variables, and input variables contained in each differential equation / algebraic equation, and create a search record;
[0033] (4) Based on the search records in the previous step, use symbolic differentiation techniques to calculate the symbolic expression of the sparse Jacobian matrix elements corresponding to each differential equation / algebraic equation;
[0034] (5) Based on the symbolic expression of the sparse Jacobian matrix elements in the previous step, a text processing and writing method is used to generate the source code of the Jacobian matrix calculation function in the required programming language;
[0035] (6) Based on the symbolic expressions of differential equations and algebraic equations, the source code of the differential-algebraic equation calculation function in the required programming language is generated using text processing and writing methods.
[0036] In step (1), for the device to be modeled, according to the operating mechanism of the device and its dynamic process at the time scale of interest, the differential variables x, algebraic variables y, input variables u, and auxiliary variables z contained in its differential algebraic model are determined, and symbolic variable sets of the above four types of variables are established respectively; based on the established symbolic variable sets, symbolic expressions of differential equations and algebraic equations are formed for the differential equations f and algebraic equations g of the differential algebraic model. Among them, the algebraic variable y contains the device injection current (i x 、i y ) and the equipment grid-connected bus voltage (vx, vy), injected current and bus voltage (i x 、i y 、v x 、v y ) is used as the interface variable between the grid-connected equipment and the power network, and the auxiliary variable z is a function expression of (x, y, u). Through variable substitution, the auxiliary variable z is eliminated in the differential equation f and the algebraic equation g;
[0037] In step (3), based on the sequentially numbered symbolic variables (x, y, u) and the sequentially numbered symbolic equations (f, g) in step (2), the differential variables, algebraic variables, and input variables contained in each equation are found through symbol scanning and searching to form a search record. Each record contains the number of the equation and the number of the variables contained in the equation, and the record determines the position of the non-zero elements in the Jacobian matrix;
[0038] In step (4), based on the search records formed in step (3), the symbolic differentiation technique is used to calculate the first-order symbolic differential expression of the equation corresponding to each record relative to the variables it contains, that is, the symbolic expression of the non-zero elements of the Jacobian matrix, and then establish a symbolic sparse Jacobian matrix in a triple format. The triple format of each matrix element is: (equation number, variable number, symbolic differential expression). The Jacobian matrix contains 6 sub-matrices, namely (differential equation relative differential variable), (Differential equations relative to algebraic variables), (differential equation relative input variables), (algebraic equations relative to differential variables), (algebraic equations relative to algebraic variables) and (algebraic equations relative to input variables);
[0039] In step (5), the symbolic Jacobian matrix obtained in step (4) is As well as the development language of the upper-level simulation program, text processing and writing technology are used to generate the source code of the corresponding Jacobian matrix calculation function. When generating the source code file, vectorization operations are used so that the generated Jacobian matrix calculation function can process multiple devices of the same type at the same time;
[0040] In step (6), based on the symbolic variables (x, y, u, z), symbolic equations (f, g) and the development language of the upper-level simulation program established in step (1), the source code of the differential algebraic equation calculation function is generated by using text processing and writing technology. When generating the source code file, vectorization operation is used so that the generated differential algebraic equation calculation function can process multiple similar devices at the same time.
[0041] Implementation case: Symbolic modeling and transient simulation application of doubly-fed wind turbines
[0042] This implementation case uses MATLAB as the programming environment and a doubly-fed wind turbine as the object to establish its symbolic differential algebraic model and generate the calculation function of the differential algebraic equation and its Jacobian matrix. Furthermore, the calculation function of the differential algebraic equation and its Jacobian matrix is combined with the transient simulation program to simulate the electromechanical transient time scale of a 3-machine 9-node power system including a doubly-fed wind turbine to verify the effectiveness of the method proposed in the present invention.
[0043] In the electromechanical transient time scale, the differential equations (eqn_f) and algebraic equations (eqn_g) of the dynamic model of the doubly fed wind turbine generator are as follows: Figure 2 As shown, the differential variables (var_state), algebraic variables (var_algeb_local, var_algeb_net), input variables (var_given), and auxiliary variables (var_auxiliary) are as follows Figure 3 As shown, isx and isy are the stator injection currents of the doubly fed wind turbine, igx and igy are the grid-side converter injection currents, and vgx and vgy are the grid-connected voltages. Using the MATLAB symbolic calculation toolbox, we first establish a symbolic set of variables, and then calculate the symbolic expressions of the differential equations (f1, f2, ..., f15) and algebraic equations (g1, g2, ..., g10).
[0044] use Figure 4 The method shown searches for the variables contained in each equation, records the equation number and variable number, and uses the diff function to calculate the first-order symbolic differential of the equation relative to the variable. The resulting record contains the row and column positions of each non-zero element in the Jacobian matrix and its symbolic expression.
[0045] The Jacobian matrix of a single device is formed based on the search records and is stored in a sparse format of triplets. For example, Figure 2 The third equation f3 contains the first state variable wt, and the corresponding triplet of non-zero elements is (3, 1, 120*pi). Through vectorization operation (using vectorize function), the symbolic expression of each element of the Jacobian matrix is expanded to the symbolic expression of the element in the case of multiple devices. Then, the text processing and writing method is used to generate the MATLAB function for calculating the Jacobian matrix. The generated part of the source code is as follows: Figure 5 Based on the symbolic differential algebraic equation, the same vectorization operation, text processing and writing method are used to generate the MATLAB function for calculating the differential algebraic equation. The generated part of the source code is shown in Figure 6 shown.
[0046] The differential algebraic equation and its Jacobian matrix calculation function are calculated according to Figure 7The framework shown is integrated with the upper transient simulation program and Figure 8 The transient simulation of the 3-machine 9-bus system shown in the figure is performed. The system includes 2 synchronous generator sets and 1 double-fed wind turbine generator. The differential algebraic equations of the synchronous generator model and its Jacobian matrix calculation function are also generated by the method proposed in the present invention and integrated into Figure 7 The transient simulation scenario is set as follows: the speed reference value of the No. 1 synchronous generator set is increased by 0.1 at 0.5 seconds, and the original speed reference value is restored at 1 second. The total simulation time is 20 seconds. Fig. 9 The simulation results are shown, where (a) is the speed of generator set 1, and (b) is the speed of the doubly fed wind generator. After the disturbance is applied, the speed of generator set 1 increases due to the increase in the reference value. After the disturbance disappears, the speeds of generator set 1 and the doubly fed wind generator both return to their original steady-state values. It can be seen that by applying the method proposed in the present invention, the generated differential algebraic equations of the synchronous generator and doubly fed wind generator and their Jacobian matrix calculation functions are correct and available, and the method proposed in the present invention is feasible.
Claims
1. Symbolic modeling of equipment for power system transient simulation and its application method, characterized by The following steps are involved: (1) Establish symbolic expressions of differential equations and algebraic equations of the equipment differential-algebraic model, and determine the set of differential variables, algebraic variables, input variables, and auxiliary variables contained in the symbolic expressions; (2) Sequentially number the differential equations and algebraic equations in the previous step, and sequentially number the differential variables, algebraic variables, and input variables in the previous step; (3) Use symbolic scanning technology to search for a subset of differential variables, algebraic variables, and input variables contained in each differential equation / algebraic equation, and create a search record; (4) Based on the search records in the previous step, use symbolic differentiation techniques to calculate the symbolic expression of the sparse Jacobian matrix elements corresponding to each differential equation / algebraic equation; (5) Based on the symbolic expression of the sparse Jacobian matrix elements in the previous step, use text processing and writing methods to generate the source code of the Jacobian matrix calculation function in the required programming language; (6) Based on the symbolic expressions of differential equations and algebraic equations, use text processing and writing methods to generate the source code of the differential algebraic equation calculation function in the required programming language; In step (1), for the device to be modeled, the differential variables included in its differential algebraic model are determined according to the device's operating mechanism and its dynamic process at the time scale of interest. x , Algebraic variables y , input variables u , auxiliary variables z , respectively establish the symbolic variable sets of the above four types of variables; based on the established symbolic variable sets, for the differential equations of the differential algebraic model f , Algebraic equations g , forming symbolic expressions of differential equations and algebraic equations; among them, algebraic variables y Includes device injection current ( i x , i y ) and equipment grid-connected bus voltage ( v x , v y ), injection current and bus voltage ( i x , i y , v x , v y ) as the interface variable between the grid-connected equipment and the power network, and the auxiliary variable z for( x , y , u ) function expression, through variable substitution, the auxiliary variable z In differential equations f , Algebraic equations g eliminate; In step (4), based on the search records formed in step (3), the symbolic differentiation technique is used to calculate the first-order symbolic differential expression of the equation corresponding to each record relative to the variables it contains, that is, the symbolic expression of the non-zero elements of the Jacobian matrix, and then a symbolic sparse Jacobian matrix in a triple format is established. The triple format of each matrix element is: (equation number, variable number, symbolic differential expression); the Jacobian matrix contains 6 sub-matrices, which are the differential equation relative to the differential variable ▽ x f , differential equation relative algebraic variables ▽ y f , differential equation relative input variable ▽ z f , algebraic equation relative differential variable ▽ x g , Algebraic equations relative to algebraic variables ▽ y g and algebraic equations relative to input variables ▽ z g .
2. The device symbolic modeling and application method for power system transient simulation according to claim 1 is characterized by: In step (3), based on the symbolic variables ( x , y , u ) and sequentially numbered symbolic equations ( f , g ), through symbol scanning and searching, find out the differential variables, algebraic variables, and input variables contained in each equation to form a search record; each record contains the number of the equation and the number of the variables contained in the equation, and the record determines the position of the non-zero elements in the Jacobian matrix.
3. The device symbolic modeling and application method for power system transient simulation according to claim 1 is characterized by: In step (5), according to the symbolic Jacobian matrix (▽ x f ,▽ y f ,▽ z f ,▽ x g ,▽ y g ,▽ z g ) and the development language of the upper-level simulation program, using text processing and writing technology to generate the source code of the corresponding Jacobian matrix calculation function; When generating source code files, vectorized operations are used so that the generated Jacobian matrix calculation function can process multiple devices of the same type at the same time.
4. The device symbolic modeling and application method for power system transient simulation according to claim 1 is characterized by: In step (6), the symbolic variable ( x , y , u , z ), symbolic equations ( f , g ) and the development language of the upper-level simulation program, using text processing and writing technology to generate the source code of the differential algebraic equation calculation function; when generating the source code file, vectorization operation is used to enable the generated differential algebraic equation calculation function to process multiple similar devices at the same time.
