Based on GovernorInit.m from MatDyn by Stijn Cole, developed at
        Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/
        electa/teaching/matdyn/} for more information.

        @rtype: tuple
        @return: Initial governor conditions.

def governorInit(self, Xgov, Vgov):
        """ Based on GovernorInit.m from MatDyn by Stijn Cole, developed at
        Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/
        electa/teaching/matdyn/} for more information.

        @rtype: tuple
        @return: Initial governor conditions.
        """
        governors = self.governors

        Xgov0 = zeros(Xgov.shape)
        Pgov0 = zeros(len(governors))

        typ1 = [g.generator._i for g in governors if g.model == CONST_POWER]
        typ2 = [g.generator._i for g in governors if g.model == GENERAL_IEEE]

        # Governor type 1: constant power
        Pm0 = Xgov[typ1, 0]
        Xgov0[typ1, 0] = Pm0

        # Governor type 2: IEEE general speed-governing system
        Pm0 = Xgov[typ2, 0]

        K = array([g.k for g in governors])
        T1 = array([g.t1 for g in governors])
        T2 = array([g.t2 for g in governors])
        T3 = array([g.t3 for g in governors])
        Pup = array([g.p_up for g in governors])
        Pdown = array([g.p_down for g in governors])
        Pmax = array([g.p_max for g in governors])
        Pmin = array([g.p_min for g in governors])

        omega0 = Vgov[typ2, 0]

        zz0 = Pm0
        PP0 = Pm0

        P0 = K * (2 * pi * self.freq - omega0)
        xx0 = T1 * (1 - T2 / T1) * (2 * pi * self.freq - omega0)

        Xgov0[typ2, :] = c_[Pm0, P0, xx0, zz0]
        Pgov0[typ2, :] = c_[K, T1, T2, T3, Pup, Pdown, Pmax, Pmin, PP0]

        # Governor type 3:

        # Governor type 4:

        return Xgov0, Pgov0