Template Class Generator4Governor
Defined in File Generator4Governor.hpp
Inheritance Relationships
Base Type
public GridKit::ModelEvaluatorImpl< ScalarT, IdxT >(Template Class ModelEvaluatorImpl)
Class Documentation
-
template<class ScalarT, typename IdxT>
class Generator4Governor : public GridKit::ModelEvaluatorImpl<ScalarT, IdxT> Implementation of a fourth order generator model with a simple governor.
Public Functions
-
Generator4Governor(bus_type *bus, ScalarT P0, ScalarT Q0)
Constructor for a model of generator with governor.
Arguments passed to ModelEvaluatorImpl:
Number of equations = 6 differential + 3 algebraic = 9
Number of quadratures = 1
Number of optimization parameters = 2
-
virtual int allocate()
allocate method computes sparsity pattern of the Jacobian.
-
virtual int initialize()
Initialization of the generator model.
Initialization equations are derived from example 9.2 in Power System Modeling and Scripting, Federico Milano, Chapter 9, p. 225:
\[\begin{split}\begin{eqnarray*} \omega_0 &=& 0, \\ \delta_0 &=& \tan^{-1} \left(\frac{X_q P_0 - R_s Q_0}{V_0^2 + R_s P_0 + X_q Q_0} \right) + \theta_0, \\ \phi_0 &=& \delta_0 - \theta_0 + \tan^{-1} \left( \frac{Q_0}{P_0} \right), \\ I_{d0} &=& \frac{\sqrt{P_0^2 + Q_0^2}}{V_0} \sin(\phi_0), \\ I_{q0} &=& \frac{\sqrt{P_0^2 + Q_0^2}}{V_0} \cos(\phi_0), \\ E_{d0}' &=& V_0 \sin(\delta_0 - \theta_0) + R_s I_{d0} - X_q' I_{q0}, \\ E_{q0}' &=& V_0 \cos(\delta_0 - \theta_0) + R_s I_{q0} + X_d' I_{d0} \end{eqnarray*}\end{split}\]The input from exciter and governor is set to the steady state value:
\[\begin{split}\begin{eqnarray*} E_{f0} &=& E_{q0}' + (X_d - X_d') I_{d0}, \\ P_{m0} &=& E_{d0}' I_{d0} + E_{q0}' I_{q0} + ( X_q' - X_d') I_{d0} I_{q0} \end{eqnarray*}\end{split}\]
-
virtual int tagDifferentiable()
Identify differential variables.
-
virtual int evaluateResidual()
Computes residual vector for the generator model.
Residual equations are given as:
\[\begin{split}\begin{eqnarray*} f_0: &~& \dot{\delta} -\omega_b (\omega - \omega_s), \\ f_1: &~& 2H/\omega_s \dot{\omega} - L_m(P_m) + E_q' I_q + E_d' I_d + (X_q' - X_d')I_d I_q + D (\omega - \omega_s), \\ f_2: &~& T_{q0}' \dot{E}_d' + E_d' - (X_q - X_q')I_q, \\ f_3: &~& T_{d0}' \dot{E}_q' + E_q' + (X_d - X_d')I_d - E_f, \\ f_4: &~& R_s I_d - X_q' I_q + V \sin(\delta - \theta) - E_d', \\ f_5: &~& R_s I_q + X_d' I_d + V \cos(\delta - \theta) - E_q', \\ f_6: &~& \dot{P}_m - L_n(P_n), \\ f_7: &~& T_1 \dot{X} + X - (1 - T_2 / T_1) (\omega - \omega_s), \\ f_8: &~& T_3 P_n - P_{m0} + L_m(P_m) + K X + K T_2 / T_1 (\omega - \omega_s) \end{eqnarray*}\end{split}\]where \( \Omega_b \) is the synchronous frequency in [rad/s], and overdot denotes time derivative. \( \omega \) is machine frequency in [p.u.]. \( L_m() \) and \( L_n() \) are limiter functions, their derivatives will be denoted as \( dL_m() \) and \( dL_n() \)Generator injection active and reactive power are
\[\begin{split}\begin{eqnarray*} P_g &=& E_d' I_d + E_q' I_q + (X_q' - X_d') I_d I_q - R_s (I_d^2 + I_q^2), \\ Q_g &=& E_q' I_d - E_d' I_q - X_q' I_q^2 - X_d' I_d^2, \\ \end{eqnarray*}\end{split}\]respectively.State variables for the generator are: \( y_0 = \omega \), \( y_1 = \delta \), \( y_2 = E_d' \), \( y_3 = E_q' \), \( y_4 = I_d \), \( y_5 = I_q \), \( y_6 = P_m \), \( y_7 = X \), \( y_{8} = P_n \) Bus voltage \( V \) and bus phase \( \theta \) are bus state variable.
-
virtual int evaluateAdjointResidual()
Computes adjoint residual vector for the generator model.
Adjoint residual equations are given as:
\[\begin{split}\begin{eqnarray*} f_{B0}: &~& \dot{y}_{B0} - y_{B4} V \cos(\delta - \theta) + y_{B5} V \sin(\delta - \theta), \\ f_{B1}: &~& 2H/\omega_s \dot{y}_{B1} + y_{B0} \omega_b - y_{B1} D + y_{B7} (1 - T_2/T_1) - y_{B8} K T_2/T_1 + g_{\omega}(\omega), \\ f_{B2}: &~& T_{q0}' \dot{y}_{B2} - y_{B1} I_d - y_{B2} + y_{B4} + \lambda_P I_d - \lambda_Q I_q, \\ f_{B3}: &~& T_{d0}' \dot{y}_{B3} - y_{B1} I_q - y_{B3} + y_{B5} + \lambda_P I_q + \lambda_Q I_d, \\ f_{B4}: &~& -y_{B1} (E_d' + (-X_d'+X_q') I_q) - y_{B3} (X_d - X_d') - y_{B4} R_s - y_{B5} X_d' + \lambda_P (E_d' + (X_q' - X_d') I_q - 2 R_s I_d) + \lambda_Q (E_q' - 2 X_d' I_d), \\ f_{B5}: &~& -y_{B1} (E_q' + (-X_d'+X_q') I_d) + y_{B2} (X_q - X_q') + y_{B4} X_q' - y_{B5} R_s + \lambda_P (E_q' + (X_q' - X_d') I_d - 2 R_s I_q) - \lambda_Q (E_d' + 2 X_q' I_q), \\ f_{B6}: &~& \dot{y}_{B6} + y_{B1} dL_m(P_m) - y_{B10} dL_m(P_m), \\ f_{B7}: &~& T_1 \dot{y}_{B7} - y_{B7} - y_{B8} K, \\ f_{B8}: &~& y_{B6} dL_n(P_n) - y_{B8} T_3 \end{eqnarray*}\end{split}\]Generator adjoint injections are
\[\begin{split}\begin{eqnarray*} P_g &=& -\lambda_P \sin(\delta - \theta) - \lambda_Q \cos(\delta - \theta), \\ Q_g &=& \lambda_P V \cos(\delta - \theta) - \lambda_Q V \sin(\delta - \theta), \\ \end{eqnarray*}\end{split}\]respectively.
-
Generator4Governor(bus_type *bus, ScalarT P0, ScalarT Q0)