PATENT ABSTRACT
A time-stacking method is disclosed. The time-stacking method simulates dynamics so as to obtain time-domain trajectories which correspond to a disturbance or event. The method includes providing a model for the system. The model includes differential equations and algebraic equations. The method also includes solving the differential equations and the algebraic equations over a predetermined number of time steps simultaneously using an implicit integration scheme.

PATENT DESCRIPTION
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application claims priority to U.S. Provisional Application Ser. No. 61/909,659, filed Nov. 27, 2013, titled “PARALLEL TIME-STACKING METHOD FOR LARGE-SCALE DYNAMIC SIMULATIONS,” hereby incorporated by reference in its entirety for all of its teachings. 
     
    
     STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT 
       [0002]    This invention was made with Government support under Contract DE-AC05-76RL01830 awarded by the U.S. Department of Energy. The Government has certain rights in the invention. 
     
    
     TECHNICAL FIELD 
       [0003]    This invention relates to dynamic simulations. More specifically, this invention relates to a time-stacking method of simulating dynamics of a system by solving multiple time steps simultaneously using an implicit integration scheme. 
       BACKGROUND 
       [0004]    Dynamic simulation plays a significant role in secure operations and planning of systems. In power networks, dynamic simulations solve a large set of differential algebraic equations for thousands of times that describe the electro-mechanical interaction of generators as well as power electronic devices and their controllers. The solutions of these equations determine the time-series trajectory of a power grid when subject to disturbances such as short-circuit faults, generator tripping, line switching or other severe contingencies. 
         [0005]    The dynamics of a power system can be represented by a set of first-order differential equations (1a) and algebraic equations (1b): 
         [0000]    
       
         
           
             
               
                 
                   { 
                   
                     
                       
                         
                           
                             x 
                             . 
                           
                           = 
                           
                             f 
                              
                             
                               ( 
                               
                                 x 
                                 , 
                                 y 
                               
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         
                           0 
                           = 
                           
                             
                               g 
                                
                               
                                 ( 
                                 
                                   x 
                                   , 
                                   y 
                                 
                                 ) 
                               
                             
                              
                             
                               ( 
                               
                                 1 
                                  
                                 b 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     1 
                      
                     a 
                   
                   ) 
                 
               
             
           
         
       
     
         [0006]    Where x represents a vector of state variables describing generator or load dynamics (e.g., generator rotor angle, rotor speed, sub-transient voltages or flux) and y represents a vector of algebraic variables (e.g., voltages from all or selected buses in the network and the current injections from generators or loads, which can be expressed as magnitudes and phase angles, or real and imaginary parts). 
         [0007]    A major obstacle of introducing dynamic simulation into online security assessment is the computationally intensive time-domain solution of numerous differential and algebraic equations involved in modeling the system dynamics and network. The traditional method for dynamic simulation is serial in nature and can only solve the network dynamics one step after another. This process is very slow for a larger-scale power network model, such as the Western or Eastern Interconnection in North America. 
         [0008]    A common serial dynamic simulation method is the partitioned or alternating solution. The partitioned-solution method is predominately used in industrial systems or commercial simulation software programs. In this method, the differential equation set of (1a) is discretized and then solved for x γ  (x at time step γ). The algebraic equation set (1b) is then solved for y γ . 
         [0009]    The partitioned-solution scheme includes an explicit integration method and an implicit integration for solving the equations, as shown in  FIG. 1 . 
         [0010]    A. Partitioned Method with Explicit Integration 
         [0011]    Using an explicit integration method, equation 1(a) is converted into an algebraic equation set 
         [0000]        x   γ   =F ( x   γ−1   ,y   γ−1 ).  (2)
 
         [0012]    which can be used to solve for x γ  using the previous step values. The value of x γ  is used to solve (3) for y γ . 
         [0000]      0= g ( x   γ   ,y   γ ).  (3)
 
         [0013]    B. Partitioned Method with Implicit Integration 
         [0014]    Using an implicit integration method, equation (1a) is converted into an algebraic equation set 
         [0000]        x   γ   =F ( x   γ   ,y   γ ).  (4)
 
         [0015]    The initial guess of x γ  can be obtained based on x γ−1  and y γ−1  using any explicit integration formula. The value of y γ  is then used in equation (4) to obtain x γ , which is used in equation (3) to solve y γ . This process will be repeated until the solution is converged. 
       SUMMARY 
       [0016]    The present invention describes methods of solving multiple time steps of system dynamics simultaneously so that the total computation time may be significantly reduced using parallel computing techniques. The method uses a single set of equations that models multiple time intervals simultaneously, which includes applying high-performance computing to solve the equations simultaneously in parallel. 
         [0017]    In one embodiment of the present invention, a time-stacking method is disclosed. The time-stacking method simulates dynamics of a system to obtain time-domain trajectories of the system that correspond to a disturbance or event. The method includes a model for testing the system. The model includes differential equations and algebraic equations. The method also includes solving the differential equations and the algebraic equations over a predetermined number of time steps simultaneously using an implicit integration scheme. The method may also include applying a numerical solver to compute a final result of the equations. A supercomputer or high-performance computer may be applied for solving the equations simultaneously in parallel. 
         [0018]    The implicit integration scheme includes, but is not limited to, at least one of the following: Backward Euler, Trapezoidal, Runge-Kutta, Newton, and Dishonest Newton. 
         [0019]    The differential equations may represent vectors of state variables, and the algebraic equations may represent vectors of algebraic variables. 
         [0020]    The vectors of state variables include, but are not limited to, generator and its controller dynamics. The generator dynamics may include rotor angle and generator speed. 
         [0021]    The vectors of algebraic variables include, but are not limited to, voltages from all or selected buses in the network and the current injections from generators or loads, which can be expressed as magnitudes and phase angles, or real and imaginary parts. 
         [0022]    In one embodiment, the time steps comprise intervals of at least 1 microsecond. The time steps of intervals may vary over a range of at least 1 microsecond so as to obtain a calculation that corresponds to the disturbance or event. 
         [0023]    In another embodiment of the present invention, a method of simulating power system dynamics of a system so as to obtain time-domain trajectories which correspond to a disturbance or event is disclosed. The method includes providing a model for the system. The model includes differential equations and algebraic equations. The method further includes solving the differential equations and the algebraic equations over a predetermined number of time steps simultaneously using an implicit integration scheme. The method also includes applying a numerical solver to compute a final result of the equations, and applying a supercomputer or high-performance computer for solving the equations simultaneously. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0024]      FIG. 1  is a flow chart of a prior art partitioned-solution method using implicit or explicit methods, for simulating dynamics of a system. 
           [0025]      FIG. 2  is a flow chart of a time-stacking method of simulating dynamics of a system so as to obtain time-domain trajectories which correspond to a disturbance or event, in accordance with one embodiment of the present invention. 
           [0026]      FIG. 3A  shows a Butcher tableau for an explicit Runge-Kutta integration method. 
           [0027]      FIG. 3B  shows a Butcher tableau for an implicit Runge-Kutta integration method. 
           [0028]      FIG. 4  shows a Butcher tableau for a classical explicit Runge-Kutta integration method. 
           [0029]      FIGS. 5A-5C  shows stability domains for (A) Forward Euler, (B) Backward Euler, and (C) Trapezoidal integration methods. 
           [0030]      FIG. 6  is a table showing the variables used in the code and the corresponding notation for a model for the system with a modified Euler integration method. 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
       [0031]    The present invention relates to time-stacking methods of solving multiple time steps of system dynamic performance simultaneously by using an implicit integration scheme. The present invention solves a single set of differential and algebraic equations simultaneously over a predetermined number of time steps. The parallel time-stacking methods solve multiple time steps simultaneously. As a result, the time-stacking methods of the present invention significantly speed up simulations of system performance. 
         [0032]    In the simultaneous time-stacking method of the present invention, as shown in  FIG. 2 , equation (1a) is converted into a set of algebraic equations, which are lumped together with equation (1b) to form a single larger algebraic equations set. Variables X γ and  y γ  are solved simultaneously over a predetermined number of times steps using an implicit integration scheme. As an example, writing equation (4) in the form of 
         [0000]      0= H ( x   γ   ,y   γ ),  (5)
 
         [0033]    and then combining equation (5) and equation (3), a single set of algebraic equations can be obtained. As one example, Newton&#39;s method can be used to solve the algebraic equation set, requiring the construction and solution at each iteration of the Jacobian matrix 
         [0000]    
       
         
           
             
               
                 
                   J 
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               J 
                               Fx 
                             
                           
                           
                             
                               J 
                               Fy 
                             
                           
                         
                         
                           
                             
                               J 
                               gx 
                             
                           
                           
                             
                               J 
                               gy 
                             
                           
                         
                       
                       ] 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
         [0034]    No matter which scheme is used, those non-linear algebraic equations need to be solved using, for example, Gauss or Newton type procedures. Dishonest Newton or very dishonest Newton methods are often used in industrial software to increase computation speed. When Newton-like method is used, linear solvers are included as well. 
         [0035]    Mathematic Formulation of Multi-Machine System with Classical Model 
         [0036]    When generators are represented using the classical model, the equations of motion for generator i in per unit are: 
         [0000]    
       
         
           
             
               
                 
                   { 
                   
                     
                       
                         
                           
                             
                               δ 
                               . 
                             
                             
                               ( 
                               i 
                               ) 
                             
                           
                           = 
                           
                             
                               ω 
                               b 
                             
                              
                             
                               ω 
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                     
                     
                       
                         
                           
                             
                               ω 
                               . 
                             
                             
                               ( 
                               i 
                               ) 
                             
                           
                           = 
                           
                             
                               1 
                               
                                 2 
                                  
                                 
                                     
                                 
                                  
                                 
                                   H 
                                   
                                     ( 
                                     i 
                                     ) 
                                   
                                 
                               
                             
                              
                             
                               ( 
                               
                                 
                                   P 
                                   
                                     m 
                                      
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                 
                                 - 
                                 
                                   P 
                                   
                                     e 
                                      
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                 
                                 - 
                                 
                                   
                                     D 
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                    
                                   
                                     ω 
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                 
                               
                               ) 
                             
                              
                             
                               ( 
                               
                                 7 
                                  
                                 b 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     7 
                      
                     a 
                   
                   ) 
                 
               
             
           
         
       
     
         [0037]    where ω (i)  is the per unit speed deviation for generator i, δ (i)  is the angular position of the rotor of generator i in electrical radians with respect to a synchronously rotating reference, H (i)  is the inertia constant of generator i using system base VA 2 , D (i)  is the damping factor or coefficient of generator i in pu torque/pu speed deviation, P m(i)  is the mechanical power input of generator i, and ω b  is the base rotor electrical speed in radians per second. In this case, state variables in (1) only include rotor speed and angle, i.e., 
         [0000]        x=[δ   (1) ,ω (1) , . . . ,δ (i) ,ω (i) , . . . ,δ (n) ,ω (n) ] T ,  (8)
 
         [0038]    where n is the number of generators. 
         [0039]    Using the classical model to study the transient stability for a multi-machine system, it is often assumed: 
         [0040]    1) Mechanical power input (P m(i) ) is constant. 
         [0041]    2) The mechanical rotor angle of a machine coincides with the angle of the voltage behind the transient reactance. 
         [0042]    3) The network is assumed to be in the sinusoidal stead state. 
         [0043]    4) Load is represented by the passive impedances, i.e., the dynamics of load is ignored. 
         [0044]    Therefore, let Y″ (with a dimension equal to m by m) denote the nodal admittance matrix of an m-bus system comprised of n generator buses and m−n load buses. One can add machine internal buses and include load impedance into the admittance matrix, resulting in an extended Y-bus—Y′ (with a dimension equal to m+n by m+n). The network equation becomes: 
         [0000]    
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             I 
                             E 
                           
                         
                       
                       
                         
                           0 
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       
                         Y 
                         ′ 
                       
                        
                       
                         [ 
                         
                           
                             
                               E 
                             
                           
                           
                             
                               V 
                             
                           
                         
                         ] 
                       
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   9 
                   ) 
                 
               
             
           
         
       
     
         [0045]    The network equation can be reduced to 
         [0000]        I   E   =YE,   (10)
 
         [0046]    where Y=Y nn −Y nm  Y −1   mm Y mn . Numerical evaluation of direct solvers for large sparse, symmetric linear equations could be used to solve Y −1   mm Y mn . For each generator internal voltage bus i, the injection current in system reference can be expressed as 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       I 
                       _ 
                     
                     
                       ( 
                       i 
                       ) 
                     
                     sys 
                   
                    
                   
                     = 
                     Δ 
                   
                    
                   
                     
                       
                         I 
                         
                           re 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                       + 
                       
                         j 
                          
                         
                             
                         
                          
                         
                           I 
                           
                             im 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                     
                     = 
                     
                       
                         ∑ 
                         
                           k 
                           = 
                           1 
                         
                         n 
                       
                        
                       
                           
                       
                        
                       
                         
                           
                             Y 
                             _ 
                           
                           
                             ( 
                             ik 
                             ) 
                           
                         
                          
                         
                           
                             E 
                             _ 
                           
                           
                             ( 
                             k 
                             ) 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
         [0047]    where a bar above the notation represents a complex number, Ī sys   (i)  is the injection current of bus i in system reference, and Ē(k) is the stator internal voltage of bus k in system reference. Let Ē(k)=E re(k) +jE im(k)  and  Y   (ik) =G (ik) +jB (ik) , resolving (11) into real and imaginary part yields, 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       I 
                       
                         re 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                     = 
                     
                       
                         ∑ 
                         
                           k 
                           = 
                           1 
                         
                         n 
                       
                        
                       
                           
                       
                        
                       
                         [ 
                         
                           
                             
                               E 
                               
                                 re 
                                  
                                 
                                   ( 
                                   k 
                                   ) 
                                 
                               
                             
                              
                             
                               G 
                               
                                 ( 
                                 ik 
                                 ) 
                               
                             
                           
                           - 
                           
                             
                               E 
                               
                                 im 
                                  
                                 
                                   ( 
                                   k 
                                   ) 
                                 
                               
                             
                              
                             
                               B 
                               
                                 ( 
                                 ik 
                                 ) 
                               
                             
                           
                         
                         ] 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   
                     12 
                      
                     a 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     I 
                     
                       im 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         k 
                         = 
                         1 
                       
                       n 
                     
                      
                     
                         
                     
                      
                     
                       
                         [ 
                         
                           
                             
                               E 
                               
                                 re 
                                  
                                 
                                   ( 
                                   k 
                                   ) 
                                 
                               
                             
                              
                             
                               B 
                               
                                 ( 
                                 ik 
                                 ) 
                               
                             
                           
                           - 
                           
                             
                               E 
                               
                                 im 
                                  
                                 
                                   ( 
                                   k 
                                   ) 
                                 
                               
                             
                              
                             
                               G 
                               
                                 ( 
                                 ik 
                                 ) 
                               
                             
                           
                         
                         ] 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   
                     12 
                      
                     b 
                   
                   ) 
                 
               
             
           
         
       
     
         [0048]    The transformation from machine dq0 reference frame to system reference frame is: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             re 
                           
                         
                         
                           
                             im 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       
                         [ 
                         
                           
                             
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 δ 
                               
                             
                             
                               
                                 cos 
                                  
                                 
                                     
                                 
                                  
                                 δ 
                               
                             
                           
                           
                             
                               
                                 
                                   - 
                                   cos 
                                 
                                  
                                 
                                     
                                 
                                  
                                 δ 
                               
                             
                             
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 δ 
                               
                             
                           
                         
                         ] 
                       
                        
                       
                         [ 
                         
                           
                             
                               d 
                             
                           
                           
                             
                               q 
                             
                           
                         
                         ] 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   13 
                   ) 
                 
               
             
           
         
       
     
         [0049]    In classic model, since E′ d =0, applying the above transformation to I re , I im , E re , and E im  in equation (12) and after manipulations, the following equations are obtained in machine reference frame: 
         [0000]    
       
         
           
             
               
                 
                   
                     0 
                     = 
                     
                       
                         sin 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                          
                         
                           I 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                       + 
                       
                         cos 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                          
                         
                           I 
                           
                             q 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                       - 
                       
                         
                           ∑ 
                           
                             k 
                             = 
                             1 
                           
                           n 
                         
                          
                         
                             
                         
                          
                         
                           [ 
                           
                             
                               
                                 
                                   
                                     
                                       ( 
                                       
                                         cos 
                                          
                                         
                                             
                                         
                                          
                                         
                                           δ 
                                           
                                             ( 
                                             k 
                                             ) 
                                           
                                         
                                          
                                         
                                           E 
                                           
                                             q 
                                              
                                             
                                               ( 
                                               k 
                                               ) 
                                             
                                           
                                           ′ 
                                         
                                       
                                       ) 
                                     
                                      
                                     
                                       G 
                                       
                                         ( 
                                         ik 
                                         ) 
                                       
                                     
                                   
                                   - 
                                 
                               
                             
                             
                               
                                 
                                   
                                     ( 
                                     
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           k 
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             k 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                     
                                     ) 
                                   
                                    
                                   
                                     B 
                                     
                                       ( 
                                       ik 
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                           ] 
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   
                     14 
                      
                     a 
                   
                   ) 
                 
               
             
             
               
                 
                   0 
                   = 
                   
                     
                       
                         - 
                         cos 
                       
                        
                       
                           
                       
                        
                       
                         δ 
                         
                           ( 
                           i 
                           ) 
                         
                       
                        
                       
                         I 
                         
                           d 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                     + 
                     
                       sin 
                        
                       
                           
                       
                        
                       
                         δ 
                         
                           ( 
                           i 
                           ) 
                         
                       
                        
                       
                         I 
                         
                           q 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                     - 
                     
                       
                         ∑ 
                         
                           k 
                           = 
                           1 
                         
                         n 
                       
                        
                       
                           
                       
                        
                       
                         
                           [ 
                           
                             
                               
                                 
                                   
                                     
                                       ( 
                                       
                                         cos 
                                          
                                         
                                             
                                         
                                          
                                         
                                           δ 
                                           
                                             ( 
                                             k 
                                             ) 
                                           
                                         
                                          
                                         
                                           E 
                                           
                                             q 
                                              
                                             
                                               ( 
                                               k 
                                               ) 
                                             
                                           
                                           ′ 
                                         
                                       
                                       ) 
                                     
                                      
                                     
                                       B 
                                       
                                         ( 
                                         ik 
                                         ) 
                                       
                                     
                                   
                                   + 
                                 
                               
                             
                             
                               
                                 
                                   
                                     ( 
                                     
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           k 
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             k 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                     
                                     ) 
                                   
                                    
                                   
                                     G 
                                     
                                       ( 
                                       ik 
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                           ] 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     14 
                      
                     b 
                   
                   ) 
                 
               
             
           
         
       
     
         [0050]    The active power at air gap can be expressed as: 
         [0000]        P   e(i)   =E′   q(i)   I   q(i) .  (15)
 
         [0051]    Replacing P e(i)  in equation (7) by equation (15) yields: 
         [0000]    
       
         
           
             
               
                 
                   { 
                   
                     
                       
                         
                           
                             
                               δ 
                               . 
                             
                             
                               ( 
                               i 
                               ) 
                             
                           
                           = 
                           
                             
                               ω 
                               b 
                             
                              
                             
                               ω 
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                     
                     
                       
                         
                           
                             
                               ω 
                               . 
                             
                             
                               ( 
                               i 
                               ) 
                             
                           
                           = 
                           
                             
                               1 
                               
                                 2 
                                  
                                 
                                     
                                 
                                  
                                 
                                   H 
                                   
                                     ( 
                                     i 
                                     ) 
                                   
                                 
                               
                             
                              
                             
                               ( 
                               
                                 
                                   P 
                                   
                                     m 
                                      
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                 
                                 - 
                                 
                                   
                                     E 
                                     
                                       q 
                                        
                                       
                                         ( 
                                         i 
                                         ) 
                                       
                                     
                                     ′ 
                                   
                                    
                                   
                                     I 
                                     
                                       q 
                                        
                                       
                                         ( 
                                         i 
                                         ) 
                                       
                                     
                                   
                                 
                                 - 
                                 
                                   
                                     D 
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                    
                                   
                                     ω 
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                 
                               
                               ) 
                             
                              
                             
                               ( 
                               
                                 16 
                                  
                                 b 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     16 
                      
                     a 
                   
                   ) 
                 
               
             
           
         
       
     
         [0052]    Combining equation (16) and equation (14) results in a set of differential-algebraic equations (DAE) in the same form as equation (1), where: 
         [0000]        x=[δ   (1) ,ω (1) , . . . ,δ (i) ,ω (i) , . . . ,δ (n) ,ω (n) ] T ,  (17)
 
         [0000]        y=[I   d(1)   ,I   q(1)   , . . . ,I   d(i)   ,I   q(i)   , . . . ,I   d(n)   ,I   q(n) ] T ,  (18)
 
         [0053]    and the other notations represent parameters. 
         [0054]    Numerical Integration Using Trapezoidal Method 
         [0055]    The trapezoidal integration method is used in many time-domain simulation software and can be used to solve the classical model multi-machine system described above. 
         [0056]    For time step γ, applying Trapezoidal rule to equation (16) and then combining the resulted algebraic equations with equation (14), yields: 
         [0000]    
       
         
           
               
             
               
                 
                   
                     { 
                     
                       
                         
                           
                             0 
                             = 
                             
                               
                                 δ 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     γ 
                                   
                                   ) 
                                 
                               
                               - 
                               
                                 δ 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     
                                       γ 
                                       - 
                                       1 
                                     
                                   
                                   ) 
                                 
                               
                               - 
                               
                                 
                                   h 
                                   2 
                                 
                                  
                                 
                                   ( 
                                   
                                     
                                       
                                         ω 
                                         b 
                                       
                                        
                                       
                                         ω 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             
                                               γ 
                                               - 
                                               1 
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                     + 
                                     
                                       
                                         ω 
                                         b 
                                       
                                        
                                       
                                         ω 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             0 
                             = 
                             
                               
                                 ω 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     γ 
                                   
                                   ) 
                                 
                               
                               - 
                               
                                 ω 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     
                                       γ 
                                       - 
                                       1 
                                     
                                   
                                   ) 
                                 
                               
                               - 
                               
                                 
                                   
                                     h 
                                     2 
                                   
                                    
                                   
                                     [ 
                                     
                                       
                                         
                                           
                                             
                                               
                                                 1 
                                                 
                                                   2 
                                                    
                                                   
                                                       
                                                   
                                                    
                                                   
                                                     H 
                                                     
                                                       ( 
                                                       i 
                                                       ) 
                                                     
                                                   
                                                 
                                               
                                                
                                               
                                                 ( 
                                                 
                                                   
                                                     
                                                       
                                                         
                                                           P 
                                                           
                                                             m 
                                                              
                                                             
                                                             ( 
                                                             
                                                             i 
                                                             , 
                                                             
                                                             γ 
                                                             - 
                                                             1 
                                                             
                                                             
                                                             ) 
                                                             
                                                           
                                                         
                                                         - 
                                                         
                                                           
                                                             E 
                                                             
                                                             q 
                                                              
                                                             
                                                             ( 
                                                             i 
                                                             ) 
                                                             
                                                             
                                                             ′ 
                                                           
                                                            
                                                           
                                                             I 
                                                             
                                                             q 
                                                              
                                                             
                                                             ( 
                                                             
                                                             i 
                                                             , 
                                                             
                                                             γ 
                                                             - 
                                                             1 
                                                             
                                                             
                                                             ) 
                                                             
                                                             
                                                           
                                                         
                                                         - 
                                                       
                                                     
                                                   
                                                   
                                                     
                                                       
                                                         
                                                           D 
                                                           
                                                             ( 
                                                             i 
                                                             ) 
                                                           
                                                         
                                                          
                                                         
                                                           ω 
                                                           
                                                             ( 
                                                             
                                                             i 
                                                             , 
                                                             
                                                             γ 
                                                             - 
                                                             1 
                                                             
                                                             
                                                             ) 
                                                           
                                                         
                                                       
                                                     
                                                   
                                                 
                                                 ) 
                                               
                                             
                                             + 
                                           
                                         
                                       
                                       
                                         
                                           
                                             
                                               1 
                                               
                                                 2 
                                                  
                                                 
                                                     
                                                 
                                                  
                                                 
                                                   H 
                                                   
                                                     ( 
                                                     i 
                                                     ) 
                                                   
                                                 
                                               
                                             
                                              
                                             
                                               ( 
                                               
                                                 
                                                   P 
                                                   
                                                     m 
                                                      
                                                     
                                                       ( 
                                                       
                                                         i 
                                                         , 
                                                         γ 
                                                       
                                                       ) 
                                                     
                                                   
                                                 
                                                 - 
                                                 
                                                   
                                                     E 
                                                     
                                                       q 
                                                        
                                                       
                                                         ( 
                                                         i 
                                                         ) 
                                                       
                                                     
                                                     ′ 
                                                   
                                                    
                                                   
                                                     I 
                                                     
                                                       q 
                                                        
                                                       
                                                         ( 
                                                         
                                                           i 
                                                           , 
                                                           γ 
                                                         
                                                         ) 
                                                       
                                                     
                                                   
                                                 
                                                 - 
                                                 
                                                   
                                                     D 
                                                     
                                                       ( 
                                                       i 
                                                       ) 
                                                     
                                                   
                                                    
                                                   
                                                     ω 
                                                     
                                                       ( 
                                                       
                                                         i 
                                                         , 
                                                         γ 
                                                       
                                                       ) 
                                                     
                                                   
                                                 
                                               
                                               ) 
                                             
                                           
                                         
                                       
                                     
                                     ] 
                                   
                                 
                                  
                                 
                                   ( 
                                   
                                     19 
                                      
                                     b 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             0 
                             = 
                             
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   I 
                                   
                                     d 
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         γ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                               + 
                               
                                 cos 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   I 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         γ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                               - 
                               
                                 
                                   ∑ 
                                   
                                     k 
                                     = 
                                     1 
                                   
                                   n 
                                 
                                  
                                 
                                     
                                 
                                  
                                 
                                   
                                     [ 
                                     
                                       
                                         
                                           
                                             
                                               
                                                 ( 
                                                 
                                                   cos 
                                                    
                                                   
                                                       
                                                   
                                                    
                                                   
                                                     δ 
                                                     
                                                       ( 
                                                       
                                                         k 
                                                         , 
                                                         γ 
                                                       
                                                       ) 
                                                     
                                                   
                                                    
                                                   
                                                     E 
                                                     
                                                       q 
                                                        
                                                       
                                                         ( 
                                                         k 
                                                         ) 
                                                       
                                                     
                                                     ′ 
                                                   
                                                 
                                                 ) 
                                               
                                                
                                               
                                                 G 
                                                 
                                                   ( 
                                                   
                                                     i 
                                                     , 
                                                     k 
                                                   
                                                   ) 
                                                 
                                               
                                             
                                             - 
                                           
                                         
                                       
                                       
                                         
                                           
                                             
                                               ( 
                                               
                                                 sin 
                                                  
                                                 
                                                     
                                                 
                                                  
                                                 
                                                   δ 
                                                   
                                                     ( 
                                                     
                                                       k 
                                                       , 
                                                       γ 
                                                     
                                                     ) 
                                                   
                                                 
                                                  
                                                 
                                                   E 
                                                   
                                                     q 
                                                      
                                                     
                                                       ( 
                                                       k 
                                                       ) 
                                                     
                                                   
                                                   ′ 
                                                 
                                               
                                               ) 
                                             
                                              
                                             
                                               B 
                                               
                                                 ( 
                                                 
                                                   i 
                                                   , 
                                                   k 
                                                 
                                                 ) 
                                               
                                             
                                           
                                         
                                       
                                     
                                     ] 
                                   
                                    
                                   
                                     ( 
                                     
                                       19 
                                        
                                       c 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             0 
                             = 
                             
                               
                                 
                                   - 
                                   cos 
                                 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   I 
                                   
                                     d 
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         γ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                               + 
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   I 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         γ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                               - 
                               
                                 
                                   ∑ 
                                   
                                     k 
                                     = 
                                     1 
                                   
                                   n 
                                 
                                  
                                 
                                     
                                 
                                  
                                 
                                   
                                     [ 
                                     
                                       
                                         
                                           
                                             
                                               
                                                 ( 
                                                 
                                                   cos 
                                                    
                                                   
                                                       
                                                   
                                                    
                                                   
                                                     δ 
                                                     
                                                       ( 
                                                       
                                                         k 
                                                         , 
                                                         γ 
                                                       
                                                       ) 
                                                     
                                                   
                                                    
                                                   
                                                     E 
                                                     
                                                       q 
                                                        
                                                       
                                                         ( 
                                                         k 
                                                         ) 
                                                       
                                                     
                                                     ′ 
                                                   
                                                 
                                                 ) 
                                               
                                                
                                               
                                                 B 
                                                 
                                                   ( 
                                                   
                                                     i 
                                                     , 
                                                     k 
                                                   
                                                   ) 
                                                 
                                               
                                             
                                             + 
                                           
                                         
                                       
                                       
                                         
                                           
                                             
                                               ( 
                                               
                                                 sin 
                                                  
                                                 
                                                     
                                                 
                                                  
                                                 
                                                   δ 
                                                   
                                                     ( 
                                                     
                                                       k 
                                                       , 
                                                       γ 
                                                     
                                                     ) 
                                                   
                                                 
                                                  
                                                 
                                                   E 
                                                   
                                                     q 
                                                      
                                                     
                                                       ( 
                                                       k 
                                                       ) 
                                                     
                                                   
                                                   ′ 
                                                 
                                               
                                               ) 
                                             
                                              
                                             
                                               G 
                                               
                                                 ( 
                                                 
                                                   i 
                                                   , 
                                                   k 
                                                 
                                                 ) 
                                               
                                             
                                           
                                         
                                       
                                     
                                     ] 
                                   
                                    
                                   
                                     ( 
                                     
                                       19 
                                        
                                       d 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
                 
                   
                     ( 
                     
                       19 
                        
                       a 
                     
                     ) 
                   
                 
               
             
           
         
       
     
         [0057]    where h is the integration step length. The first two are corresponding to equations in F in equation (4); the last two are corresponding to equations in g in equation (3). Combining these equations results in: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       0 
                       = 
                       
                         
                           H 
                            
                           
                             ( 
                             
                               
                                 x 
                                 γ 
                               
                               , 
                               
                                 y 
                                 γ 
                               
                             
                             ) 
                           
                         
                         = 
                         
                           [ 
                           
                             
                               
                                 
                                   
                                     F 
                                     1 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         x 
                                         γ 
                                       
                                       , 
                                       
                                         y 
                                         γ 
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 
                                   
                                     F 
                                     2 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         x 
                                         γ 
                                       
                                       , 
                                       
                                         y 
                                         γ 
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 … 
                               
                             
                             
                               
                                 
                                   
                                     g 
                                     1 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         x 
                                         γ 
                                       
                                       , 
                                       
                                         y 
                                         γ 
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 
                                   
                                     g 
                                     2 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         x 
                                         γ 
                                       
                                       , 
                                       
                                         y 
                                         γ 
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 … 
                               
                             
                           
                           ] 
                         
                       
                     
                     , 
                     
                       
 
                     
                      
                     where 
                   
                    
                   
                     
 
                   
                    
                   
                     
                       x 
                       γ 
                     
                     = 
                     
                       
                         [ 
                         
                           
                             δ 
                             
                               ( 
                               
                                 1 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           
                             ω 
                             
                               ( 
                               
                                 1 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           … 
                            
                           
                               
                           
                           , 
                           
                             δ 
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           
                             ω 
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           … 
                            
                           
                               
                           
                           , 
                           
                             δ 
                             
                               ( 
                               
                                 n 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           
                             ω 
                             
                               ( 
                               
                                 n 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                       T 
                     
                   
                    
                   
                     
 
                   
                    
                   and 
                    
                   
                     
 
                   
                    
                   
                     
                       y 
                       γ 
                     
                     = 
                     
                       
                         [ 
                         
                           
                             I 
                             
                               d 
                                
                               
                                 ( 
                                 
                                   1 
                                   , 
                                   γ 
                                 
                                 ) 
                               
                             
                           
                           , 
                           
                             I 
                             
                               q 
                                
                               
                                 ( 
                                 
                                   1 
                                   , 
                                   γ 
                                 
                                 ) 
                               
                             
                           
                           , 
                           … 
                            
                           
                               
                           
                           , 
                           
                             
                               I 
                               d 
                             
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           
                             
                               I 
                               q 
                             
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           … 
                            
                           
                               
                           
                           , 
                           
                             
                               I 
                               d 
                             
                             
                               ( 
                               
                                 n 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           , 
                           
                             
                               I 
                               q 
                             
                             
                               ( 
                               
                                 n 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   20 
                   ) 
                 
               
             
           
         
       
     
         [0058]    Both Newton and Gauss methods can be used to solve the equations. 
         [0059]    1) Newton: In order to solve the equation using Newton method, one needs to find the Jacobian Matrix first. The Jacobian matrix of equation (6), restated here for convenience, is: 
         [0000]    
       
         
           
             
               
                 
                   J 
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               J 
                               Fx 
                             
                           
                           
                             
                               J 
                               Fy 
                             
                           
                         
                         
                           
                             
                               J 
                               gx 
                             
                           
                           
                             
                               J 
                               gy 
                             
                           
                         
                       
                       ] 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   21 
                   ) 
                 
               
             
           
         
       
     
         [0060]    Each sub-matrix is calculated below: 
         [0000]    
       
         
           
             
               
                 
                   
                     J 
                     Fx 
                   
                   = 
                   
                     
                       
                         diag 
                          
                         
                           ( 
                           
                             J 
                             Fx 
                             i 
                           
                           ) 
                         
                       
                        
                       
                           
                       
                        
                       and 
                        
                       
                           
                       
                        
                       
                         J 
                         Fx 
                         i 
                       
                     
                     = 
                     
                       
                         [ 
                         
                           
                             
                               1 
                             
                             
                               
                                 
                                   - 
                                   h 
                                 
                                  
                                 
                                     
                                 
                                  
                                 
                                   
                                     ω 
                                     b 
                                   
                                   / 
                                   2 
                                 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 1 
                                 + 
                                 
                                   
                                     hD 
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                   / 
                                   
                                     ( 
                                     
                                       4 
                                        
                                       
                                           
                                       
                                        
                                       
                                         H 
                                         
                                           ( 
                                           i 
                                           ) 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                         ] 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   22 
                   ) 
                 
               
             
             
               
                 
                   
                     J 
                     Fy 
                   
                   = 
                   
                     
                       
                         diag 
                          
                         
                           ( 
                           
                             J 
                             Fy 
                             i 
                           
                           ) 
                         
                       
                        
                       
                           
                       
                        
                       and 
                        
                       
                           
                       
                        
                       
                         J 
                         Fy 
                         i 
                       
                     
                     = 
                     
                       
                         [ 
                         
                           
                             
                               0 
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 
                                   hE 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       i 
                                       ) 
                                     
                                   
                                   ′ 
                                 
                                 / 
                                 
                                   ( 
                                   
                                     4 
                                      
                                     
                                         
                                     
                                      
                                     
                                       H 
                                       
                                         ( 
                                         i 
                                         ) 
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         ] 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   23 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       J 
                       gx 
                     
                      
                     
                         
                     
                      
                     
                       J 
                       gx 
                     
                   
                   = 
                   
                     [ 
                     
                       
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 11 
                                 ) 
                               
                             
                           
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 12 
                                 ) 
                               
                             
                           
                         
                         
                           … 
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 
                                   1 
                                    
                                   
                                       
                                   
                                    
                                   n 
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 21 
                                 ) 
                               
                             
                           
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 22 
                                 ) 
                               
                             
                           
                         
                         
                           … 
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 
                                   2 
                                    
                                   
                                       
                                   
                                    
                                   n 
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           ⋮ 
                         
                         
                           ⋮ 
                         
                         
                           ⋱ 
                         
                         
                           ⋮ 
                         
                       
                       
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 
                                   n 
                                    
                                   
                                       
                                   
                                    
                                   1 
                                 
                                 ) 
                               
                             
                           
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 
                                   n 
                                    
                                   
                                       
                                   
                                    
                                   2 
                                 
                                 ) 
                               
                             
                           
                         
                         
                           … 
                         
                         
                           
                             J 
                             
                               gx 
                                
                               
                                 ( 
                                 nn 
                                 ) 
                               
                             
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   24 
                   ) 
                 
               
             
             
               
                 
                   
                     J 
                     
                       gx 
                        
                       
                         ( 
                         ii 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 
                                   
                                     
                                       
                                         I 
                                         
                                           d 
                                            
                                           
                                             ( 
                                             
                                               i 
                                               , 
                                               γ 
                                             
                                             ) 
                                           
                                         
                                       
                                        
                                       cos 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     - 
                                     
                                       
                                         I 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             
                                               i 
                                               , 
                                               γ 
                                             
                                             ) 
                                           
                                         
                                       
                                        
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     + 
                                   
                                 
                               
                               
                                 
                                   
                                     
                                       
                                         G 
                                         
                                           ( 
                                           ii 
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             i 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                        
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     + 
                                     
                                       
                                         B 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             i 
                                           
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             i 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                        
                                       cos 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                   
                                 
                               
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 
                                   
                                     
                                       
                                         I 
                                         
                                           d 
                                            
                                           
                                             ( 
                                             
                                               i 
                                               , 
                                               γ 
                                             
                                             ) 
                                           
                                         
                                       
                                        
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     + 
                                     
                                       
                                         I 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             
                                               i 
                                               , 
                                               γ 
                                             
                                             ) 
                                           
                                         
                                       
                                        
                                       cos 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     + 
                                   
                                 
                               
                               
                                 
                                   
                                     
                                       
                                         B 
                                         
                                           ( 
                                           ii 
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             i 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                        
                                       sin 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                     - 
                                     
                                       
                                         G 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             i 
                                           
                                           ) 
                                         
                                       
                                        
                                       
                                         E 
                                         
                                           q 
                                            
                                           
                                             ( 
                                             i 
                                             ) 
                                           
                                         
                                         ′ 
                                       
                                        
                                       cos 
                                        
                                       
                                           
                                       
                                        
                                       
                                         δ 
                                         
                                           ( 
                                           
                                             i 
                                             , 
                                             γ 
                                           
                                           ) 
                                         
                                       
                                     
                                   
                                 
                               
                             
                           
                           
                             0 
                           
                         
                       
                       ] 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   25 
                   ) 
                 
               
             
             
               
                 
                   
                     J 
                     
                       gx 
                        
                       
                         ( 
                         ik 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 
                                   G 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       k 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   E 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       k 
                                       ) 
                                     
                                   
                                   ′ 
                                 
                                  
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       k 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                               + 
                               
                                 
                                   B 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       k 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   E 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       k 
                                       ) 
                                     
                                   
                                   ′ 
                                 
                                  
                                 cos 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       k 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 
                                   B 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       k 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   E 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       k 
                                       ) 
                                     
                                   
                                   ′ 
                                 
                                  
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       k 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                               - 
                               
                                 
                                   G 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       k 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   E 
                                   
                                     q 
                                      
                                     
                                       ( 
                                       k 
                                       ) 
                                     
                                   
                                   ′ 
                                 
                                  
                                 cos 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       k 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             0 
                           
                         
                       
                       ] 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   26 
                   ) 
                 
               
             
             
               
                 
                   
                     J 
                     gy 
                   
                   = 
                   
                     
                       
                         diag 
                          
                         
                           ( 
                           
                             J 
                             gy 
                             i 
                           
                           ) 
                         
                       
                        
                       
                           
                       
                        
                       and 
                        
                       
                           
                       
                        
                       
                         J 
                         gy 
                         i 
                       
                     
                     = 
                     
                       
                         [ 
                         
                           
                             
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 cos 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             
                               
                                 
                                   - 
                                   cos 
                                 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                             
                               
                                 sin 
                                  
                                 
                                     
                                 
                                  
                                 
                                   δ 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       γ 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                         ] 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   27 
                   ) 
                 
               
             
           
         
       
     
         [0061]    Similarly, one can find the analytical expression of Jacobian matrix when higher order machine model and dynamic load model are used. Among the reviewed the references, no one suggests that there exists any difficulty to find the analytical expression of Jacobian matrix. The method to find Jacobian matrix in general case (rather than classic machine model and constant impedance) is described in equation [6]. In equations [26] and [27], the analytical expression of the Jacobian matrix is provided when transient machine model, exciter model, and dynamic load model are used. 
         [0062]    2) Gauss: Rearranging equation (19) in the form: 
         [0000]        X   γ   =G ( X   γ ),  (28)
 
         [0063]    the equation can be directly solved using Gauss or Gauss-Seidel method. 
         [0064]    Time Stacking Method—Parallel in Time 
         [0065]    In this method, in one embodiment, the equations in (20) are combined to form a large set of algebraic equations: 
         [0000]    
       
         
           
             
               
                 
                   { 
                   
                     
                       
                         
                           0 
                           = 
                           
                             H 
                              
                             
                               ( 
                               
                                 
                                   x 
                                   γ 
                                 
                                 , 
                                 
                                   y 
                                   γ 
                                 
                               
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         
                           0 
                           = 
                           
                             
                               H 
                               ′ 
                             
                              
                             
                               ( 
                               
                                 
                                   x 
                                   γ 
                                 
                                 , 
                                 
                                   y 
                                   γ 
                                 
                                 , 
                                 
                                   x 
                                   
                                     γ 
                                     + 
                                     1 
                                   
                                 
                                 , 
                                 
                                   y 
                                   
                                     γ 
                                     + 
                                     1 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         … 
                       
                     
                     
                       
                         
                           0 
                           = 
                           
                             
                               H 
                               ′ 
                             
                              
                             
                               ( 
                               
                                 
                                   x 
                                   
                                     γ 
                                     + 
                                     p 
                                     - 
                                     2 
                                   
                                 
                                 , 
                                 
                                   y 
                                   
                                     γ 
                                     + 
                                     p 
                                     - 
                                     2 
                                   
                                 
                                 , 
                                 
                                   x 
                                   
                                     γ 
                                     + 
                                     p 
                                     - 
                                     1 
                                   
                                 
                                 , 
                                 
                                   y 
                                   
                                     γ 
                                     + 
                                     p 
                                     - 
                                     1 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   29 
                   ) 
                 
               
             
           
         
       
     
         [0066]    where p represents the number of time steps in parallel, and H and H′ are comprised of equations similar to (19). In H, the previous time step variables are known and the only unknown are the current time step variables. In H′, variables of two future adjacent time steps are unknown. The variables to be determined are: 
         [0000]      [( x   γ   ,y   γ ),( x   γ+1   ,y   γ+1 ), . . . ,( x   γ+p−1   ,y   γ+p−1 )]. 
         [0067]    This equation set can be solved similarly as a conventional one-step approach. The corresponding Jacobian matrix is 
         [0000]    
       
         
           
             
               
                 
                   Λ 
                   = 
                   
                     [ 
                     
                       
                         
                           
                             J 
                             γ 
                           
                         
                         
                           0 
                         
                         
                           … 
                         
                         
                           0 
                         
                         
                           0 
                         
                       
                       
                         
                           
                             J 
                             
                               ( 
                               
                                 
                                   γ 
                                   + 
                                   1 
                                 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         
                           
                             J 
                             
                               γ 
                               + 
                               1 
                             
                           
                         
                         
                           … 
                         
                         
                           0 
                         
                         
                           0 
                         
                       
                       
                         
                           ⋮ 
                         
                         
                           ⋮ 
                         
                         
                           ⋱ 
                         
                         
                           ⋮ 
                         
                         
                           ⋮ 
                         
                       
                       
                         
                           0 
                         
                         
                           0 
                         
                         
                           … 
                         
                         
                           
                             J 
                             
                               ( 
                               
                                 
                                   γ 
                                   + 
                                   p 
                                   - 
                                   1 
                                 
                                 , 
                                 
                                   γ 
                                   + 
                                   p 
                                   - 
                                   2 
                                 
                               
                               ) 
                             
                           
                         
                         
                           
                             J 
                             
                               γ 
                               + 
                               p 
                               - 
                               1 
                             
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   30 
                   ) 
                 
               
             
           
         
       
     
         [0068]    where the diagonal sub-matrix is shown in equation (21). In the subscript of the off-diagonal matrix, the first number represents the equation set index, and the second number represents variable set index. 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       J 
                       
                         ( 
                         
                           
                             j 
                             + 
                             1 
                           
                           , 
                           i 
                         
                         ) 
                       
                     
                     = 
                     
                       [ 
                       
                         
                           
                             
                               J 
                               
                                 
                                   F 
                                   
                                     j 
                                     + 
                                     1 
                                   
                                 
                                  
                                 
                                   x 
                                   j 
                                 
                               
                             
                           
                           
                             
                               J 
                               
                                 
                                   F 
                                   
                                     j 
                                     + 
                                     1 
                                   
                                 
                                  
                                 
                                   y 
                                   j 
                                 
                               
                             
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                         
                       
                       ] 
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   31 
                   ) 
                 
               
             
           
         
       
     
         [0069]    where j=γ, γ+1, . . . , γ+p−2. Each sub-matrix is calculated below: 
         [0000]    
       
         
           
             
               
                 
                   
                       
                   
                    
                   
                     
                       
                         J 
                         
                           
                             F 
                             
                               j 
                               + 
                               1 
                             
                           
                            
                           
                             x 
                             j 
                           
                         
                       
                       = 
                       
                         diag 
                         ( 
                         
                           J 
                           
                             
                               F 
                               
                                 j 
                                 + 
                                 1 
                               
                             
                              
                             
                               x 
                               j 
                             
                           
                           i 
                         
                         ) 
                       
                     
                      
                     
                       
 
                     
                      
                     
                         
                     
                      
                     and 
                      
                     
                       
 
                     
                      
                     
                         
                     
                      
                     
                       
                         J 
                         
                           
                             F 
                             
                               j 
                               + 
                               1 
                             
                           
                            
                           
                             x 
                             j 
                           
                         
                         i 
                       
                       = 
                       
                         
                           [ 
                           
                             
                               
                                 
                                   - 
                                   1 
                                 
                               
                               
                                 
                                   
                                     - 
                                     h 
                                   
                                    
                                   
                                       
                                   
                                    
                                   
                                     
                                       ω 
                                       b 
                                     
                                     / 
                                     2 
                                   
                                 
                               
                             
                             
                               
                                 0 
                               
                               
                                 
                                   
                                     - 
                                     1 
                                   
                                   + 
                                   
                                     
                                       hD 
                                       
                                         ( 
                                         i 
                                         ) 
                                       
                                     
                                     / 
                                     
                                       ( 
                                       
                                         4 
                                          
                                         
                                             
                                         
                                          
                                         
                                           H 
                                           
                                             ( 
                                             i 
                                             ) 
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                           ] 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   32 
                   ) 
                 
               
             
             
               
                 
                   
                       
                   
                    
                   
                     
                       
                         J 
                         
                           
                             F 
                             
                               j 
                               + 
                               1 
                             
                           
                            
                           
                             y 
                             j 
                           
                         
                       
                       = 
                       
                         diag 
                         ( 
                         
                           J 
                           
                             
                               F 
                               
                                 j 
                                 + 
                                 1 
                               
                             
                              
                             
                               y 
                               j 
                             
                           
                           i 
                         
                         ) 
                       
                     
                      
                     
                       
 
                     
                      
                     
                         
                     
                      
                     and 
                      
                     
                       
 
                     
                      
                     
                         
                     
                      
                     
                       
                         J 
                         
                           
                             F 
                             
                               j 
                               + 
                               1 
                             
                           
                            
                           
                             y 
                             j 
                           
                         
                         i 
                       
                       = 
                       
                         
                           
                             [ 
                             
                               
                                 
                                   0 
                                 
                                 
                                   0 
                                 
                               
                               
                                 
                                   0 
                                 
                                 
                                   
                                     h 
                                      
                                     
                                       
                                         ? 
                                       
                                       / 
                                       
                                         ( 
                                         
                                           4 
                                            
                                           
                                               
                                           
                                            
                                           
                                             H 
                                             
                                               ( 
                                               i 
                                               ) 
                                             
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                 
                               
                             
                             ] 
                           
                           . 
                           
                             
 
                           
                            
                           
                             ? 
                           
                         
                          
                         
                           indicates text missing or illegible when filed 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   33 
                   ) 
                 
               
             
           
         
       
     
         [0070]    Numerical integration methods can be categorized by two attributes: 1) single-step or multi-step; 2) explicit or implicit. 
         [0071]    1) Single-step methods only utilize one previous point and its derivative to determine the value at current step. On the other hand, multi-step methods express the value at current step as a function of the previous points and their derivative values. Runge-Kutta (RK) methods are the most famous family of single-step methods, while Adams family is the best known multi-step methods. 
         [0072]    2) Explicit methods evaluate the value of current step explicitly as a function of values at previous steps, while implicit methods expresses the value at current step as a function of values at both current and previous steps. 
         [0073]    Runge-Kutta and Adams (both explicit and implicit) methods will be briefly described below. 
         [0074]    A. Runge-Kutta Methods 
         [0075]    For an ordinary differential equation {dot over (x)}=f(x), RK methods have the form: 
         [0000]    
       
         
           
             
               
                 
                   
                     x 
                     
                       n 
                       + 
                       1 
                     
                   
                   = 
                   
                     
                       x 
                       n 
                     
                     + 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         s 
                       
                        
                       
                           
                       
                        
                       
                         
                           b 
                           i 
                         
                          
                         
                           K 
                           
                             i 
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   34 
                   ) 
                 
               
             
           
         
       
     
         [0076]    The Butcher tableaus for explicit and implicit RK methods are shown in  FIGS. 3A and 3B , respectively. 
         [0077]    1) Examples of Explicit RK Methods:
       Forward Euler is the simplest explicit RK method with s=1 and b1=1. Its formula is x n+1 =x n +hf(x n ).   One of the family of Runge-Kutta methods is so commonly used that it is often referred to as “RK4”, “classical Runge-Kutta”, or simply as “the Runge-Kutta method”. Its Butcher tableau is shown in  FIG. 4 .       
 
         [0080]    2) Examples of Implicit RK Methods:
       The simplest example of an implicit RK method is the backward Euler method.   Trapezoidal method is the second order implicit RK method.       
 
         [0083]    B. Adams Methods 
         [0084]    Adams methods have the form: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∑ 
                       
                         k 
                         = 
                         0 
                       
                       s 
                     
                      
                     
                         
                     
                      
                     
                       
                         α 
                         k 
                       
                        
                       
                         x 
                         
                           n 
                           + 
                           k 
                         
                       
                     
                   
                   = 
                   
                     h 
                      
                     
                       
                         ∑ 
                         
                           k 
                           = 
                           0 
                         
                         s 
                       
                        
                       
                         
                           β 
                           k 
                         
                          
                         
                           
                             f 
                              
                             
                               ( 
                               
                                 x 
                                 
                                   n 
                                   + 
                                   k 
                                 
                               
                               ) 
                             
                           
                           . 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   35 
                   ) 
                 
               
             
           
         
       
     
         [0085]    For Adams-Bashforth (explicit Adams methods), β=0; for Adams-Moulton (implicit Adams methods), β≠0. 
         [0086]    Multi-step methods attempt to gain efficiency by keeping and using the information from previous steps rather than discarding it. For example, the formula of two-step Adams-Bashforth method is 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         
                           x 
                           
                             n 
                             + 
                             1 
                           
                         
                         = 
                           
                          
                         
                           
                             x 
                             n 
                           
                           + 
                           
                             
                               h 
                               2 
                             
                              
                             
                               [ 
                               
                                 
                                   3 
                                    
                                   
                                       
                                   
                                    
                                   
                                     f 
                                      
                                     
                                       ( 
                                       
                                         x 
                                         n 
                                       
                                       ) 
                                     
                                   
                                 
                                 - 
                                 
                                   f 
                                    
                                   
                                     ( 
                                     
                                       x 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                     
                                     ) 
                                   
                                 
                               
                               ] 
                             
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                          
                         
                           
                             x 
                             n 
                           
                           + 
                           
                             hf 
                              
                             
                               ( 
                               
                                 x 
                                 n 
                               
                               ) 
                             
                           
                           + 
                           
                             
                               
                                 h 
                                 2 
                               
                               2 
                             
                              
                             
                               
                                 
                                   
                                     f 
                                      
                                     
                                       ( 
                                       
                                         x 
                                         n 
                                       
                                       ) 
                                     
                                   
                                   - 
                                   
                                     f 
                                      
                                     
                                       ( 
                                       
                                         x 
                                         
                                           n 
                                           - 
                                           1 
                                         
                                       
                                       ) 
                                     
                                   
                                 
                                 h 
                               
                               
                                  
                                 
                                   
                                     
                                       f 
                                       ′ 
                                     
                                      
                                     
                                       ( 
                                       
                                         x 
                                         n 
                                       
                                       ) 
                                     
                                   
                                   + 
                                   
                                     O 
                                      
                                     
                                       ( 
                                       h 
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                          
                         
                           
                             x 
                             n 
                           
                           + 
                           
                             hf 
                              
                             
                               ( 
                               
                                 x 
                                 n 
                               
                               ) 
                             
                           
                           + 
                           
                             
                               
                                 h 
                                 2 
                               
                               2 
                             
                              
                             
                               
                                 f 
                                 ′ 
                               
                                
                               
                                 ( 
                                 
                                   x 
                                   n 
                                 
                                 ) 
                               
                             
                           
                           + 
                           
                             
                               O 
                                
                               
                                 ( 
                                 
                                   h 
                                   3 
                                 
                                 ) 
                               
                             
                             . 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   36 
                   ) 
                 
               
             
           
         
       
     
         [0087]    Therefore, two-step Adams-Bashforth is equivalent to considering up to the second derivative term in the Taylor series. It should be noted that idea of multi-step integration methods is not approximating the first-order derivative at current step by combination of first-order derivative at previous steps. Instead, the method utilizes the information at previous steps to obtain a higher order approximation of Taylor series. One disadvantage of multi-step methods is the integration process has to be restarted whenever a discontinuity occurs. 
         [0088]    Forward Euler, backward Euler, and Trapezoidal methods are degenerate cases of Adams methods, which only utilize one previous point and its derivate to determine the value at a current step. 
         [0089]    Numerical Instability and Hyper-Stability 
         [0090]    A numerical integration method is chosen so that:
       if the continuous system is stable, the discrete time system is also stable.   if the continuous time system is unstable, the discrete time system is also unstable.       
 
         [0093]    However, an integration method may create numerical instability, i.e., the continuous time system is stable, but the discrete time system is unstable. On the other hand, an integration method may also create hyper-stability, i.e., the continuous time system is unstable, but the discrete time is stable. Forward Euler, backward Euler, and Trapezoidal methods will be used to explain the idea of the above concepts. 
         [0094]    A. Forward Euler 
         [0095]    Let H(s) and H(z) denote the s-domain (corresponding to continuous time) and z-domain (corresponding to discrete time) transfer functions, respectively. Let s p =σ p +jω p  denote a pole of H(s). The continuous time system is stable if σ p &lt;0, for all the poles of H(s). The discrete system is stable when |z p |&lt;1 for all the poles of H(z). The z-domain transfer function using forward Euler integration can be obtained by 
         [0000]    
       
         
           
             
               
                 
                   
                     H 
                      
                     
                       ( 
                       z 
                       ) 
                     
                   
                   = 
                   
                     
                       H 
                        
                       
                         ( 
                         s 
                         ) 
                       
                     
                      
                     
                       | 
                       
                         s 
                         = 
                         
                           
                             x 
                             - 
                             1 
                           
                           h 
                         
                       
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   37 
                   ) 
                 
               
             
           
         
       
     
         [0096]    The poles of H(z) can be obtained by z p =1+hs p . 
         [0097]    When the continuous system is unstable, i.e., there exists at least one pole with σ p &gt;0, then: 
         [0000]      | z   p |=√{square root over ((1+ hσ   p ) 2 +( hω   p ) 2 )}{square root over ((1+ hσ   p ) 2 +( hω   p ) 2 )}≦1, ∀ h ≦0.  (38)
 
         [0098]    Therefore the discrete system is unstable, which means forward Euler does not create hyper-stability. 
         [0099]    When the continuous system is stable, i.e., σ p &lt;0 for all the poles H(s), then: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         
                           
                             
                               
                                  
                                 
                                   z 
                                   p 
                                 
                                  
                               
                               = 
                                 
                                
                               
                                 
                                   
                                     
                                       ( 
                                       
                                         1 
                                         + 
                                         
                                           h 
                                            
                                           
                                               
                                           
                                            
                                           
                                             σ 
                                             p 
                                           
                                         
                                       
                                       ) 
                                     
                                     2 
                                   
                                   + 
                                   
                                     
                                       ( 
                                       
                                         h 
                                          
                                         
                                             
                                         
                                          
                                         
                                           ω 
                                           p 
                                         
                                       
                                       ) 
                                     
                                     2 
                                   
                                 
                               
                             
                           
                         
                         
                           
                             
                               = 
                                 
                                
                               
                                 
                                   1 
                                   + 
                                   
                                     
                                       h 
                                        
                                       
                                         ( 
                                         
                                           
                                             σ 
                                             p 
                                             2 
                                           
                                           + 
                                           
                                             ω 
                                             p 
                                             2 
                                           
                                         
                                         ) 
                                       
                                     
                                      
                                     
                                       ( 
                                       
                                         h 
                                         + 
                                         
                                           
                                             2 
                                              
                                             
                                                 
                                             
                                              
                                             
                                               σ 
                                               p 
                                             
                                           
                                           
                                             
                                               σ 
                                               p 
                                               2 
                                             
                                             + 
                                             
                                               ω 
                                               p 
                                               2 
                                             
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                       &gt; 
                       1 
                     
                     , 
                     
                       
 
                     
                      
                     when 
                   
                    
                   
                     
 
                   
                    
                   
                     
                       h 
                       &gt; 
                       
                         
                           
                             
                               - 
                               2 
                             
                              
                             
                                 
                             
                              
                             
                               σ 
                               p 
                             
                           
                           
                             
                               σ 
                               p 
                               2 
                             
                             + 
                             
                               ω 
                               p 
                               2 
                             
                           
                         
                          
                         
                           ( 
                           
                             
                               i 
                               . 
                               e 
                               . 
                             
                             , 
                             
                               
                                  
                                 
                                   1 
                                   + 
                                   
                                     hs 
                                     p 
                                   
                                 
                                  
                               
                               &gt; 
                               1 
                             
                           
                           ) 
                         
                       
                     
                     , 
                   
                 
               
               
                 
                   ( 
                   39 
                   ) 
                 
               
             
           
         
       
     
         [0100]    which means when integration step length h is not small enough, forward Euler will cause numerical instability. 
         [0101]    Defining R(hs)          R as stability function of integration method, then the stability domain is 
         [0000]        S={μεC,|R (μ)|≦1}.  (40)
 
         [0102]    The stability function of forward Euler is 
         [0000]        R (μ)=1+μ.  (41)
 
         [0103]    Its stability domain is shown in  FIG. 5A . 
         [0104]    B. Backward Euler 
         [0105]    The stability function of backward Euler is 
         [0000]    
       
         
           
             
               
                 
                   
                     R 
                      
                     
                       ( 
                       μ 
                       ) 
                     
                   
                   = 
                   
                     
                       1 
                       
                         1 
                         - 
                         μ 
                       
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   42 
                   ) 
                 
               
             
           
         
       
     
         [0106]    Its stability domain is shown in  FIG. 5B . 
         [0107]    When the continuous system is stable, i.e., σ p &lt;0 for all the poles of H(s), μ falls in the stability region for any integration time step length. Therefore, the discrete time system is stable, which means backward Euler method does not create numerical instability. 
         [0108]    When the continuous system is unstable, i.e., there exists at least one pole with σ p &gt;0, the corresponding μ p =hs p  falls in the stability region when h&gt;2σ p /(σ 2   p +w 2   p ) (i.e., |h s p −1|&gt;1), which means the discrete time system is stable. Therefore, backward Euler may create hyper-stability. 
         [0109]    C. Trapezoidal 
         [0110]    The stability function of forward Euler is 
         [0000]    
       
         
           
             
               
                 
                   
                     R 
                      
                     
                       ( 
                       μ 
                       ) 
                     
                   
                   = 
                   
                     
                       
                         1 
                         + 
                         
                           μ 
                           / 
                           2 
                         
                       
                       
                         1 
                         - 
                         
                           μ 
                           / 
                           2 
                         
                       
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   43 
                   ) 
                 
               
             
           
         
       
     
         [0111]    Its stability domain is shown in  FIG. 5C . As can be seen, the stability property of the discrete time system is exactly the same as the continuous time system for all the time step length, i.e., the Trapezoidal method avoids both numerical instability and hyper-stability. 
         [0112]    Classical Model with Modified Euler Method 
         [0113]    The variables used in the code and the corresponding notation herein are listed in the table of  FIG. 6 . The equations are provided based on which existing code is developed. 
         [0114]    A. Equations Translated Back from Existing Code 
         [0115]    For each generator at time step 1 (main): 
         [0000]    
       
         
           
             
               
                 
                     
                 
               
               
                 
                   
                     GEN 
                     
                       MVA 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   ← 
                   
                     
                       S 
                       MVA 
                     
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     V 
                     _ 
                   
                   = 
                   
                     
                       E 
                       
                         T 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                      
                     
                        
                       
                         j 
                          
                         
                             
                         
                          
                         
                           θ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                   I 
                   = 
                   
                     
                       
                         
                           
                             P 
                             
                               e 
                                
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   1 
                                 
                                 ) 
                               
                             
                             2 
                           
                           + 
                           
                             Q 
                             
                               e 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                             2 
                           
                         
                       
                       / 
                       
                         E 
                         
                           T 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                     × 
                   
                 
               
               
                 
                   φ 
                   = 
                   
                     
                       tan 
                       
                         - 
                         1 
                       
                     
                     ( 
                     
                       
                         Q 
                         
                           e 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                       
                         P 
                         
                           e 
                            
                           
                             ( 
                             
                               i 
                               , 
                               1 
                             
                             ) 
                           
                         
                       
                     
                     ) 
                   
                 
               
               
                 
                   
                     I 
                     _ 
                   
                   = 
                   
                     I 
                      
                     
                         
                     
                      
                     
                        
                       
                         j 
                          
                         
                           ( 
                           
                             
                               θ 
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                             - 
                             φ 
                           
                           ) 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   GEN 
                   
                     MVA 
                      
                     
                       ( 
                       i 
                       ) 
                     
                   
                 
               
               
                 
                     
                 
               
               
                 
                     
                 
               
             
             
               
                 
                   
                     E 
                     _ 
                   
                   = 
                   
                     
                       
                         V 
                         _ 
                       
                        
                       
                         + 
                         
                             
                           
                             jX 
                             
                               d 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                             ′ 
                           
                         
                       
                     
                      
                     
                       I 
                       _ 
                     
                   
                 
               
               
                 
                   
                     E 
                     im 
                   
                   = 
                   
                     imag 
                      
                     
                       ( 
                       
                         E 
                         _ 
                       
                       ) 
                     
                   
                 
               
               
                 
                   
                     E 
                     re 
                   
                   = 
                   
                     real 
                      
                     
                       ( 
                       
                         E 
                         _ 
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                   
                     
                       δ 
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         tan 
                         
                           - 
                           1 
                         
                       
                       ( 
                       
                         
                           imag 
                            
                           
                             ( 
                             
                               E 
                               _ 
                             
                             ) 
                           
                         
                         
                           real 
                            
                           
                             ( 
                             
                               E 
                               _ 
                             
                             ) 
                           
                         
                       
                       ) 
                     
                   
                    
                   
                       
                   
                 
               
               
                 
                   
                     ω 
                     
                       ( 
                       
                         i 
                         , 
                         1 
                       
                       ) 
                     
                     p 
                   
                   = 
                   1 
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                    
                   = 
                   
                     
                       j 
                       
                         - 
                         
                           jδ 
                           
                             ( 
                             
                               i 
                               , 
                               1 
                             
                             ) 
                           
                         
                       
                     
                      
                     
                       = 
                       Δ 
                     
                      
                     
                        
                       
                         j 
                          
                         
                           ( 
                           
                             
                               90 
                                
                               ° 
                             
                             - 
                             
                               δ 
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   1 
                                 
                                 ) 
                               
                             
                           
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                   
                     
                       E 
                       _ 
                     
                     ′ 
                   
                   = 
                   
                     
                       E 
                       _ 
                     
                      
                     
                         
                     
                      
                      
                   
                 
               
               
                 
                   
                     E 
                     
                       d 
                        
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                     ′ 
                   
                   = 
                   
                     real 
                      
                     
                       ( 
                       
                         E 
                         ′ 
                       
                       ) 
                     
                   
                 
               
               
                 
                   
                     E 
                     
                       q 
                        
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                     ′ 
                   
                   = 
                   
                     imag 
                      
                     
                       ( 
                       
                         E 
                         ′ 
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                   
                     I 
                     _ 
                   
                   ← 
                   
                     
                       I 
                       _ 
                     
                      
                     
                         
                     
                      
                      
                   
                 
               
               
                 
                   
                     I 
                     
                       dg 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     real 
                      
                     
                       ( 
                       I 
                       ) 
                     
                   
                 
               
               
                 
                   
                     I 
                     
                       qg 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     imag 
                      
                     
                       ( 
                       I 
                       ) 
                     
                   
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     I 
                     
                       d 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       real 
                        
                       
                         ( 
                         I 
                         ) 
                       
                     
                     / 
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     I 
                     
                       q 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       imag 
                        
                       
                         ( 
                         I 
                         ) 
                       
                     
                     / 
                   
                 
               
             
             
               
                 
                     
                 
               
               
                 
                     
                 
               
               
                 
                   GEN 
                   
                     MVA 
                      
                     
                       ( 
                       i 
                       ) 
                     
                   
                 
               
             
             
               
                 
                   
                     V 
                     _ 
                   
                   ← 
                   
                     
                       V 
                       _ 
                     
                      
                     
                         
                     
                      
                      
                   
                 
               
               
                 
                   
                     E 
                     
                       d 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     real 
                      
                     
                       ( 
                       
                         V 
                         _ 
                       
                       ) 
                     
                   
                 
               
               
                 
                   
                     E 
                     
                       q 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     imag 
                      
                     
                       ( 
                       
                         V 
                         _ 
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     V 
                     
                       ex 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     E 
                     
                       q 
                        
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                     ′ 
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     P 
                     
                       m 
                        
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       P 
                       
                         e 
                          
                         
                           ( 
                           
                             i 
                             , 
                             1 
                           
                           ) 
                         
                       
                     
                      
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
         [0116]    For each time step γ, for each generator i: 
         [0000]    
       
      
       P 
       m(i,γ+1) 
       =P 
       m(i,γ)  
      
     
         [0117]    mac_em1 (machine to system reference frame): 
         [0000]        E   re(i,γ) =sin δ (i,γ)   E′   d(i,γ) +cos δ (i,γ)   E′   q(i,γ)           real[    E ′   (i,γ)   /R   (i,γ) ]
 
         [0000]        E   im(i,γ) =−cos δ (i,γ)   E′   d(i,γ) +sin δ (i,γ)   E′   q(i,γ)           imag[    E ′   (i,γ)   /R   (i,γ) ]
 
         [0118]    After terminal voltage Ē( i,γ ) is obtained for all the buses, for each generator i: 
         [0119]    i_simu_innerloop2 (system reference frame): 
         [0000]    
       
         
           
             
               
                 I 
                 _ 
               
               
                 ( 
                 
                   i 
                   , 
                   γ 
                 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 k 
               
                
               
                   
               
                
               
                 
                   
                     Y 
                     _ 
                   
                   
                     ( 
                     ik 
                     ) 
                   
                 
                  
                 
                   
                     E 
                     _ 
                   
                   
                     ( 
                     
                       k 
                       , 
                       γ 
                     
                     ) 
                   
                 
               
             
           
         
       
       
         
           
             
               I 
               
                 re 
                  
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
             = 
             
               real 
                
               
                 [ 
                 
                   
                     I 
                     _ 
                   
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                 ] 
               
             
           
         
       
       
         
           
             
               I 
               
                 im 
                  
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
             = 
             
               imag 
                
               
                 [ 
                 
                   
                     I 
                     _ 
                   
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                 ] 
               
             
           
         
       
     
         [0120]    mac_em2 (system to machine reference frame): 
         [0000]    
       
         
           
             
               
                   
               
                
               
                 
                   
                     I 
                     
                       d 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       
                         sin 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             
                               i 
                               , 
                               γ 
                             
                             ) 
                           
                         
                          
                         
                           I 
                           
                             re 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                       
                       - 
                       
                         cos 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             
                               i 
                               , 
                               γ 
                             
                             ) 
                           
                         
                          
                         
                           I 
                           
                             im 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                       
                     
                      
                     
                       = 
                       Δ 
                     
                      
                     
                       real 
                        
                       
                         [ 
                         
                           
                             
                               I 
                               _ 
                             
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                            
                           
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                   
                 
                  
                 
                   
 
                 
                  
                 
                     
                 
                  
                 
                   
                     I 
                     
                       q 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       
                         cos 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             
                               i 
                               , 
                               γ 
                             
                             ) 
                           
                         
                          
                         
                           I 
                           
                             re 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                       
                       + 
                       
                         sin 
                          
                         
                             
                         
                          
                         
                           δ 
                           
                             ( 
                             
                               i 
                               , 
                               γ 
                             
                             ) 
                           
                         
                          
                         
                           I 
                           
                             im 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                       
                     
                      
                     
                       = 
                       Δ 
                     
                      
                     
                       imag 
                        
                       
                         [ 
                         
                           
                             
                               I 
                               _ 
                             
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                            
                           
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                   
                 
                  
                 
                   
 
                 
                  
                 
                   
                     
                       
                         
                           I 
                           
                             dg 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         = 
                         
                           
                             I 
                             
                               d 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                            
                           
                             GEN 
                             
                               MVA 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                     
                     
                       
                         
                           I 
                           
                             qg 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         = 
                         
                           
                             I 
                             
                               q 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                            
                           
                             GEN 
                             
                               MVA 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                     
                     
                       
                           
                       
                     
                   
                   
                     
                       
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         = 
                         
                           
                             E 
                             
                               d 
                                
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   γ 
                                 
                                 ) 
                               
                             
                             ′ 
                           
                           + 
                         
                       
                     
                     
                       
                         
                           E 
                           
                             q 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         = 
                         
                           
                             E 
                             
                               q 
                                
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   γ 
                                 
                                 ) 
                               
                             
                             ′ 
                           
                           - 
                         
                       
                     
                     
                       
                         
                           E 
                           
                             T 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         = 
                         
                           
                             
                               E 
                               
                                 d 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                               2 
                             
                             + 
                             
                               E 
                               
                                 q 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                               2 
                             
                           
                         
                       
                     
                   
                   
                     
                       
                         
                           X 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                           ′ 
                         
                          
                         
                           I 
                           
                             qg 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         
                           X 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                           ′ 
                         
                          
                         
                           I 
                           
                             dg 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                     
                     
                       
                           
                       
                     
                   
                   
                     
                       
                         
                           P 
                           
                             e 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         = 
                         
                           
                             
                               E 
                               
                                 q 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                             
                              
                             
                               I 
                               
                                 q 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                             
                           
                           + 
                         
                       
                     
                     
                       
                         
                           Q 
                           
                             e 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         = 
                         
                           
                             
                               E 
                               
                                 q 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                             
                              
                             
                               I 
                               
                                 d 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                             
                           
                           - 
                         
                       
                     
                     
                       
                           
                       
                     
                   
                   
                     
                       
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                          
                         
                           I 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                          
                         
                           I 
                           
                             q 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                       
                     
                     
                       
                           
                       
                     
                   
                   
                     
                       
                           
                       
                     
                     
                       
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 
                                   γ 
                                   + 
                                   1 
                                 
                               
                               ) 
                             
                           
                           ′ 
                         
                         = 
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           ′ 
                         
                       
                     
                     
                       
                         
                           E 
                           
                             q 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 
                                   γ 
                                   + 
                                   1 
                                 
                               
                               ) 
                             
                           
                           ′ 
                         
                         = 
                         
                           E 
                           
                             q 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                           ′ 
                         
                       
                     
                   
                   
                     
                       
                           
                       
                     
                     
                       
                         
                           
                             δ 
                             . 
                           
                           
                             ( 
                             
                               i 
                               , 
                               γ 
                             
                             ) 
                           
                         
                         = 
                         
                           
                             ω 
                             b 
                           
                            
                           
                             [ 
                             
                               
                                 ω 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     γ 
                                   
                                   ) 
                                 
                                 p 
                               
                               - 
                               1 
                             
                             ] 
                           
                         
                       
                     
                     
                       
                           
                       
                     
                   
                 
                  
                 
                   
 
                 
                  
                 
                     
                 
                  
                 
                   
                     
                       ω 
                       . 
                     
                     
                       ( 
                       
                         i 
                         , 
                         γ 
                       
                       ) 
                     
                     p 
                   
                   = 
                   
                     
                       1 
                       
                         2 
                          
                         
                             
                         
                          
                         
                           H 
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                      
                     
                       [ 
                       
                         
                           P 
                           
                             m 
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 γ 
                               
                               ) 
                             
                           
                         
                         - 
                         
                           
                             P 
                             
                               e 
                                
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   γ 
                                 
                                 ) 
                               
                             
                           
                            
                           
                             GEN 
                             
                               MVA 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                         - 
                         
                           
                             D 
                             
                               ( 
                               i 
                               ) 
                             
                           
                            
                           
                             ( 
                             
                               
                                 ω 
                                 
                                   ( 
                                   
                                     i 
                                     , 
                                     γ 
                                   
                                   ) 
                                 
                                 p 
                               
                               - 
                               1 
                             
                             ) 
                           
                         
                       
                       ] 
                     
                   
                 
                  
                 
                   
 
                 
                  
                 
                     
                 
                  
                 
                   
                     S 
                     
                       e 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       [ 
                       
                         
                           E 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         + 
                         
                           j 
                            
                           
                               
                           
                            
                           
                             E 
                             
                               q 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                       ] 
                     
                      
                     
                       [ 
                       
                         
                           I 
                           
                             d 
                              
                             
                               ( 
                               i 
                               ) 
                             
                           
                         
                         - 
                         
                           j 
                            
                           
                               
                           
                            
                           
                             I 
                             
                               q 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               ) 
             
              
             
               = 
               Δ 
             
              
             
               
                 ( 
                 
                   
                     V 
                     _ 
                   
                    
                   
                       
                   
                    
                    
                 
                 ) 
               
                
               
                 
                   ( 
                   
                     
                       I 
                       _ 
                     
                      
                     
                         
                     
                      
                      
                   
                   ) 
                 
                 * 
               
             
           
         
       
       
         
           
             
               
                 
                   
                       
                   
                    
                   
                     
                       
                         V 
                         _ 
                       
                        
                       
                           
                       
                        
                        
                     
                     = 
                       
                      
                     
                       
                         E 
                         d 
                       
                       + 
                       
                         j 
                          
                         
                             
                         
                          
                         
                           E 
                           q 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     
                       ( 
                       
                         
                           E 
                           d 
                           ′ 
                         
                         + 
                         
                           
                             X 
                             d 
                             ′ 
                           
                            
                           
                             I 
                             qg 
                           
                         
                       
                       ) 
                     
                     + 
                     
                       j 
                        
                       
                         ( 
                         
                           
                             E 
                             q 
                             ′ 
                           
                           - 
                           
                             
                               X 
                               d 
                               ′ 
                             
                              
                             
                               I 
                               dg 
                             
                           
                         
                         ) 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     
                       ( 
                       
                         
                           E 
                           d 
                           ′ 
                         
                         + 
                         
                           j 
                            
                           
                               
                           
                            
                           
                             E 
                             q 
                             ′ 
                           
                         
                       
                       ) 
                     
                     - 
                     
                       j 
                        
                       
                           
                       
                        
                       
                         
                           X 
                           d 
                           ′ 
                         
                          
                         
                           ( 
                           
                             
                               I 
                               qg 
                             
                             + 
                             
                               j 
                                
                               
                                   
                               
                                
                               
                                 I 
                                 dg 
                               
                             
                           
                           ) 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     
                       
                         
                           E 
                           _ 
                         
                         ′ 
                       
                        
                       
                           
                       
                        
                        
                     
                     - 
                     
                       j 
                        
                       
                           
                       
                        
                       
                         X 
                         d 
                         ′ 
                       
                        
                       
                         
                           I 
                           _ 
                         
                         g 
                       
                        
                        
                     
                   
                 
               
             
           
         
       
     
         [0121]    B. A “Clean” but Equivalent Version of Equations 
         [0122]    For each generator at time step 1 (main): 
         [0000]    
       
         
           
             
               
                 
                     
                 
               
               
                 
                   
                     GEN 
                     
                       MVA 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   ← 
                   
                     
                       S 
                       MVA 
                     
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     D 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   ← 
                   
                     
                       D 
                       
                         ( 
                         i 
                         ) 
                       
                     
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     H 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   ← 
                   
                     
                       H 
                       
                         ( 
                         i 
                         ) 
                       
                     
                     
                       GEN 
                       
                         MVA 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     V 
                     _ 
                   
                   = 
                   
                     
                       E 
                       
                         T 
                          
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                      
                     
                        
                       
                         j 
                          
                         
                             
                         
                          
                         
                           θ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                   I 
                   = 
                   
                     
                       
                         
                           
                             P 
                             
                               e 
                                
                               
                                 ( 
                                 
                                   i 
                                   , 
                                   1 
                                 
                                 ) 
                               
                             
                             2 
                           
                           + 
                           
                             Q 
                             
                               e 
                                
                               
                                 ( 
                                 i 
                                 ) 
                               
                             
                             2 
                           
                         
                       
                       / 
                       
                         E 
                         
                           T 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                     
                     × 
                   
                 
               
               
                 
                   φ 
                   = 
                   
                     
                       tan 
                       
                         - 
                         1 
                       
                     
                     ( 
                     
                       
                         Q 
                         
                           e 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                       
                         P 
                         
                           e 
                            
                           
                             ( 
                             
                               i 
                               , 
                               1 
                             
                             ) 
                           
                         
                       
                     
                     ) 
                   
                 
               
               
                 
                   
                     I 
                     _ 
                   
                   = 
                   
                     I 
                      
                     
                         
                     
                      
                     
                        
                       
                         j 
                         ( 
                         
                           
                             θ 
                             
                               ( 
                               i 
                               ) 
                             
                           
                           - 
                           φ 
                         
                         ) 
                       
                     
                   
                 
               
             
             
               
                 
                   GEN 
                   
                     MVA 
                      
                     
                       ( 
                       i 
                       ) 
                     
                   
                 
               
               
                 
                     
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     E 
                     _ 
                   
                   = 
                   
                     
                       V 
                       _ 
                     
                     + 
                     
                       j 
                        
                       
                           
                       
                        
                       
                         X 
                         
                           d 
                            
                           
                             ( 
                             i 
                             ) 
                           
                         
                         ′ 
                       
                        
                       
                         I 
                         _ 
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                   
                     δ 
                     
                       ( 
                       
                         i 
                         , 
                         1 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       tan 
                       
                         - 
                         1 
                       
                     
                     ( 
                     
                       
                         imag 
                          
                         
                           ( 
                           
                             E 
                             _ 
                           
                           ) 
                         
                       
                       
                         real 
                          
                         
                           ( 
                           
                             E 
                             _ 
                           
                           ) 
                         
                       
                     
                     ) 
                   
                 
               
               
                 
                   
                     ω 
                     
                       ( 
                       
                         i 
                         , 
                         1 
                       
                       ) 
                     
                   
                   = 
                   0 
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     E 
                     
                       q 
                        
                       
                         ( 
                         i 
                         ) 
                       
                     
                   
                   = 
                   
                      
                     
                       E 
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                      
                   
                 
               
               
                 
                     
                 
               
             
             
               
                 
                     
                 
               
               
                 
                   
                     P 
                     
                       m 
                        
                       
                         ( 
                         
                           i 
                           , 
                           1 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       P 
                       
                         e 
                          
                         
                           ( 
                           
                             i 
                             , 
                             1 
                           
                           ) 
                         
                       
                     
                      
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
         [0123]    For each time step γ, for each generator i: 
         [0000]    
       
      
       P 
       m(i,γ+1) 
       =P 
       m(i,γ)  
      
     
         [0124]    mac_em1 (machine to system reference frame): 
         [0000]        E   re(i,γ) =cos δ (i,γ)   E′   q(i)  
 
         [0000]        E   im(i,γ) =sin δ (i,γ)   E′   q(i)  
 
         [0125]    After terminal voltage Ē( i,γ ) is obtained for all the buses, for each generator i: 
         [0126]    i_simu_innerloop2 (system reference frame): 
         [0000]    
       
         
           
             
               
                 I 
                 _ 
               
               
                 ( 
                 
                   i 
                   , 
                   γ 
                 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 k 
               
                
               
                   
               
                
               
                 
                   
                     Y 
                     _ 
                   
                   
                     ( 
                     ik 
                     ) 
                   
                 
                  
                 
                   
                     E 
                     _ 
                   
                   
                     ( 
                     
                       k 
                       , 
                       γ 
                     
                     ) 
                   
                 
               
             
           
         
       
       
         
           
             
               I 
               
                 re 
                  
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
             = 
             
               real 
                
               
                 [ 
                 
                   
                     I 
                     _ 
                   
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                 ] 
               
             
           
         
       
       
         
           
             
               I 
               
                 im 
                  
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
             = 
             
               imag 
                
               
                 [ 
                 
                   
                     I 
                     _ 
                   
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                 ] 
               
             
           
         
       
     
         [0127]    mac_em2 (system to machine reference frame): 
         [0000]    
       
         
           
             
               I 
               
                 q 
                  
                 
                   ( 
                   i 
                   ) 
                 
               
             
             = 
             
               
                 cos 
                  
                 
                     
                 
                  
                 
                   δ 
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                  
                 
                   I 
                   
                     re 
                      
                     
                       ( 
                       
                         i 
                         , 
                         γ 
                       
                       ) 
                     
                   
                 
               
               + 
               
                 sin 
                  
                 
                     
                 
                  
                 
                   δ 
                   
                     ( 
                     
                       i 
                       , 
                       γ 
                     
                     ) 
                   
                 
                  
                 
                   I 
                   
                     im 
                      
                     
                       ( 
                       
                         i 
                         , 
                         γ 
                       
                       ) 
                     
                   
                 
               
             
           
         
       
       
         
           
             
               P 
               
                 e 
                  
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
             = 
             
               
                 E 
                 
                   q 
                    
                   
                     ( 
                     i 
                     ) 
                   
                 
                 ′ 
               
                
               
                 I 
                 
                   q 
                    
                   
                     ( 
                     i 
                     ) 
                   
                 
               
             
           
         
       
       
         
           
             
               
                 δ 
                 . 
               
               
                 ( 
                 
                   i 
                   , 
                   γ 
                 
                 ) 
               
             
             = 
             
               
                 ω 
                 b 
               
                
               
                 ω 
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
             
           
         
       
       
         
           
             
               
                 ω 
                 . 
               
               
                 ( 
                 
                   i 
                   , 
                   γ 
                 
                 ) 
               
             
             = 
             
               
                 1 
                 
                   2 
                    
                   
                       
                   
                    
                   
                     H 
                     
                       ( 
                       i 
                       ) 
                     
                   
                 
               
                
               
                 [ 
                 
                   
                     P 
                     
                       m 
                        
                       
                         ( 
                         
                           i 
                           , 
                           γ 
                         
                         ) 
                       
                     
                   
                   - 
                   
                     
                       P 
                       
                         e 
                          
                         
                           ( 
                           
                             i 
                             , 
                             γ 
                           
                           ) 
                         
                       
                     
                      
                   
                   - 
                   
                     
                       D 
                       
                         ( 
                         i 
                         ) 
                       
                     
                      
                     
                       ω 
                       
                         ( 
                         
                           i 
                           , 
                           γ 
                         
                         ) 
                       
                     
                   
                 
                 ] 
               
             
           
         
       
       
         
           
             
               ω 
               
                 ( 
                 
                   i 
                   , 
                   γ 
                 
                 ) 
               
               p 
             
             = 
             
               
                 ω 
                 
                   ( 
                   
                     i 
                     , 
                     γ 
                   
                   ) 
                 
               
               + 
               1 
             
           
         
       
     
         [0128]    In compliance with the statute, embodiments of the invention have been described in language more or less specific as to structural and methodical features. It is to be understood, however, that the entire invention is not limited to the specific features and/or embodiments shown and/or described, since the disclosed embodiments comprise forms of putting the invention into effect.