Exemplo n.º 1
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config)

        self.gain = ConstService(
            v_str='ue/R',
            tex_name='G',
        )

        self.pref = Algeb(
            info='Reference power input',
            tex_name='P_{ref}',
            v_str='tm0 * R',
            e_str='pref0 * R - pref',
        )

        self.wd = Algeb(
            info='Generator under speed',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='ue * (omega - wref) - wd',
        )
        self.pd = Algeb(info='Pref plus under speed times gain',
                        unit='p.u.',
                        tex_name="P_d",
                        v_str='ue * tm0',
                        e_str='ue*(- wd + pref + paux) * gain - pd')

        self.v9 = Algeb(
            tex_name=r'V_{9}',
            info='V_9 for LVGate input',
            v_str='ue * (AT + KT * (AT - tm0))',
            e_str='ue * (AT + KT * (AT - LG3_y)) - v9',
        )

        self.LVG = LVGate(
            u1=self.pd,
            u2=self.v9,
            info='LVGate',
        )

        self.LAG = LagAntiWindup(
            u=self.LVG_y,
            K=1,
            T=self.T1,
            lower=self.VMIN,
            upper=self.VMAX,
        )

        self.LG2 = Lag(u=self.LAG_y, T=self.T2, K=1, info='Lag T2')

        self.LG3 = Lag(u=self.LG2_y, T=self.T3, K=1, info='Lag T3')

        self.pout.e_str = 'ue * (LG2_y - Dt * wd) - pout'
Exemplo n.º 2
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config)

        self.pref = Algeb(
            info='Reference power input',
            tex_name='P_{ref}',
            v_str='tm0 * R',
            e_str='pref0 * R - pref',
        )
        self.wd = Algeb(
            info='Generator speed deviation',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='ue * (omega - wref) - wd',
        )
        self.pd = Algeb(info='Pref plus speed deviation times gain',
                        unit='p.u.',
                        tex_name="P_d",
                        v_str='tm0',
                        e_str='(- wd + pref + paux) * gain - pd')

        self.LAG_y = State(
            info='State in lag transfer function',
            tex_name=r"x'_{LAG}",
            e_str='LAG_lim_zi * (1 * pd - LAG_y)',
            t_const=self.T1,
            v_str='pd',
        )
        self.LAG_lim = AntiWindup(
            u=self.LAG_y,
            lower=self.VMIN,
            upper=self.VMAX,
            tex_name='lim_{lag}',
        )
        self.LL_x = State(info='State in lead-lag transfer function',
                          tex_name="x'_{LL}",
                          v_str='LAG_y',
                          e_str='(LAG_y - LL_x)',
                          t_const=self.T3)
        self.LL_y = Algeb(
            info='Lead-lag Output',
            tex_name='y_{LL}',
            v_str='LAG_y',
            e_str='T2 / T3 * (LAG_y - LL_x) + LL_x - LL_y',
        )

        self.pout.e_str = 'ue * (LL_y - Dt * wd) - pout'
Exemplo n.º 3
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config)

        self.F1 = Lag(
            u='ue * (omega - wref)',
            T=self.T1,
            K=self.K1,
        )

        self.F2 = LeadLag(
            u=self.F1_y,
            T1=self.T2,
            T2=self.T3,
            K=1.0,
        )

        self.HL = GainLimiter(
            u='ue * (paux + pref0 - F2_y)',
            K=1.0,
            R=1.0,
            lower=self.PMIN,
            upper=self.PMAX,
        )
        self.F3 = Lag(
            u=self.HL_y,
            T=self.T4,
            K=1.0,
        )

        self.F4 = Lag(
            u=self.F3_y,
            T=self.T5,
            K=self.K2,
        )

        self.F5 = Lag(
            u=self.F4_y,
            T=self.T6,
            K=self.K3,
        )

        self.pout.e_str = 'ue * ((1-K2)*F3_y + (1-K3)*F4_y + F5_y) - pout'
Exemplo n.º 4
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config)

        self.gain = ConstService(
            v_str='ue/R',
            tex_name='G',
        )

        self.pref = Algeb(
            info='Reference power input',
            tex_name='P_{ref}',
            v_str='tm0 * R',
            e_str='pref0 * R - pref',
        )

        self.wd = Algeb(
            info='Generator speed deviation',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='ue * (omega - wref) - wd',
        )
        self.pd = Algeb(info='Pref plus speed deviation times gain',
                        unit='p.u.',
                        tex_name="P_d",
                        v_str='ue * tm0',
                        e_str='ue*(- wd + pref + paux) * gain - pd')

        self.LAG = LagAntiWindup(
            u=self.pd,
            K=1,
            T=self.T1,
            lower=self.VMIN,
            upper=self.VMAX,
        )
        self.LL = LeadLag(
            u=self.LAG_y,
            T1=self.T2,
            T2=self.T3,
        )
        self.pout.e_str = 'ue * (LL_y - Dt * wd) - pout'
Exemplo n.º 5
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config, add_sn=False)

        # check if K1-K8 sums up to 1
        self._sumK18 = ConstService(v_str='K1+K2+K3+K4+K5+K6+K7+K8',
                                    info='summation of K1-K8',
                                    tex_name=r"\sum_{i=1}^8 K_i")
        self._K18c1 = InitChecker(
            u=self._sumK18,
            info='summation of K1-K8 and 1.0',
            equal=1,
        )

        # check if  `tm0 * (K2 + k4 + K6 + K8) = tm02 *(K1 + K3 + K5 + K7)
        self._tm0K2 = PostInitService(
            info='mul of tm0 and (K2+K4+K6+K8)',
            v_str='zsyn2*tm0*(K2+K4+K6+K8)',
        )
        self._tm02K1 = PostInitService(
            info='mul of tm02 and (K1+K3+K5+K6)',
            v_str='tm02*(K1+K3+K5+K7)',
        )
        self._Pc = InitChecker(
            u=self._tm0K2,
            info='proportionality of tm0 and tm02',
            equal=self._tm02K1,
        )

        self.Sg2 = ExtParam(
            src='Sn',
            model='SynGen',
            indexer=self.syn2,
            allow_none=True,
            default=0.0,
            tex_name='S_{n2}',
            info='Rated power of Syn2',
            unit='MVA',
            export=False,
        )
        self.Sg12 = ParamCalc(
            self.Sg,
            self.Sg2,
            func=np.add,
            tex_name="S_{g12}",
            info='Sum of generator power ratings',
        )
        self.Sn = NumSelect(
            self.Tn,
            fallback=self.Sg12,
            tex_name='S_n',
            info='Turbine or Gen rating',
        )

        self.zsyn2 = FlagValue(
            self.syn2,
            value=None,
            tex_name='z_{syn2}',
            info='Exist flags for syn2',
        )

        self.tm02 = ExtService(
            src='tm',
            model='SynGen',
            indexer=self.syn2,
            tex_name=r'\tau_{m02}',
            info='Initial mechanical input of syn2',
            allow_none=True,
            default=0.0,
        )
        self.tm012 = ConstService(
            info='total turbine power',
            v_str='tm0 + tm02',
        )

        self.tm2 = ExtAlgeb(
            src='tm',
            model='SynGen',
            indexer=self.syn2,
            allow_none=True,
            tex_name=r'\tau_{m2}',
            e_str='zsyn2 * u * (PLP - tm02)',
            info='Mechanical power to syn2',
        )

        self.wd = Algeb(
            info='Generator under speed',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='(wref - omega) - wd',
        )

        self.LL = LeadLag(
            u=self.wd,
            T1=self.T2,
            T2=self.T1,
            K=self.K,
            info='Signal conditioning for wd',
        )

        # `P0` == `tm0`
        self.vs = Algeb(
            info='Valve speed',
            tex_name='V_s',
            v_str='0',
            e_str='(LL_y + tm012 + paux - IAW_y) / T3 - vs',
        )

        self.HL = HardLimiter(
            u=self.vs,
            lower=self.UC,
            upper=self.UO,
            info='Limiter on valve acceleration',
        )

        self.vsl = Algeb(
            info='Valve move speed after limiter',
            tex_name='V_{sl}',
            v_str='vs * HL_zi + UC * HL_zl + UO * HL_zu',
            e_str='vs * HL_zi + UC * HL_zl + UO * HL_zu - vsl',
        )

        self.IAW = IntegratorAntiWindup(
            u=self.vsl,
            T=1,
            K=1,
            y0=self.tm012,
            lower=self.PMIN,
            upper=self.PMAX,
            info='Valve position integrator',
        )

        self.L4 = Lag(
            u=self.IAW_y,
            T=self.T4,
            K=1,
            info='first process',
        )

        self.L5 = Lag(
            u=self.L4_y,
            T=self.T5,
            K=1,
            info='second (reheat) process',
        )

        self.L6 = Lag(
            u=self.L5_y,
            T=self.T6,
            K=1,
            info='third process',
        )

        self.L7 = Lag(
            u=self.L6_y,
            T=self.T7,
            K=1,
            info='fourth (second reheat) process',
        )

        self.PHP = Algeb(
            info='HP output',
            tex_name='P_{HP}',
            v_str='K1*L4_y + K3*L5_y + K5*L6_y + K7*L7_y',
            e_str='K1*L4_y + K3*L5_y + K5*L6_y + K7*L7_y - PHP',
        )

        self.PLP = Algeb(
            info='LP output',
            tex_name='P_{LP}',
            v_str='K2*L4_y + K4*L5_y + K6*L6_y + K8*L7_y',
            e_str='K2*L4_y + K4*L5_y + K6*L6_y + K8*L7_y - PLP',
        )

        self.pout.e_str = 'PHP - pout'
Exemplo n.º 6
0
    def __init__(self, system, config):
        TG2Data.__init__(self)
        TGBase.__init__(self, system, config)
        self.config.add({'deadband': 0, 'hardlimit': 1})
        self.config.add_extra("_help",
                              deadband="enable input dead band",
                              hardlimit="enable output hard limit")
        self.config.add_extra(
            "_alt",
            deadband=(0, 1),
            hardlimit=(0, 1),
        )
        self.config.add_extra(
            "_tex",
            deadband="z_{deadband}",
            hardlimit="z_{hardlimit}",
        )

        self.gain = ConstService(
            v_str='u / R',
            tex_name='G',
        )

        self.w_d = Algeb(
            info=
            'Generator speed deviation before dead band (positive for under speed)',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='u*(wref-omega) - w_d',
        )
        self.w_db = DeadBandRT(
            u=self.w_d,
            center=self.dbc,
            lower=self.dbl,
            upper=self.dbu,
            enable=self.config.deadband,
        )
        self.w_dm = Algeb(info='Measured speed deviation after dead band',
                          tex_name=r'\omega_{dm}',
                          v_str='0',
                          e_str='(1 - w_db_zi) * w_d + '
                          'w_db_zlr * dbl + '
                          'w_db_zur * dbu - '
                          'w_dm')

        self.w_dmg = Algeb(
            info='Speed deviation after dead band after gain',
            tex_name=r'\omega_{dmG}',
            v_str='0',
            e_str='gain * w_dm - w_dmg',
        )
        self.ll = LeadLag(
            u=self.w_dmg,
            T1=self.T1,
            T2=self.T2,
        )

        self.pnl = Algeb(
            info='Power output before hard limiter',
            tex_name='P_{nl}',
            v_str='tm0',
            e_str='pref0 + ll_y - pnl',
        )
        self.plim = HardLimiter(
            u=self.pnl,
            lower=self.pmin,
            upper=self.pmax,
            enable=self.config.hardlimit,
        )

        self.pout.e_str = 'pnl * plim_zi + pmax * plim_zu + pmin * plim_zl - pout'
Exemplo n.º 7
0
    def __init__(self, system, config):
        TGBase.__init__(self, system, config)

        self.VELMn = ConstService(
            v_str='-VELM',
            tex_name='-VELM',
        )
        self.tr = ConstService(
            v_str='r * Tr',
            tex_name='r*Tr',
        )
        self.gr = ConstService(
            v_str='1/r',
            tex_name='1/r',
        )
        self.ratel = ConstService(
            v_str='- VELM - gr',
            tex_name='rate_l',
        )
        self.rateu = ConstService(
            v_str='VELM - gr',
            tex_name='rate_u',
        )
        self.q0 = ConstService(
            v_str='tm0 / At + qNL',
            tex_name='q_0',
        )
        self.pref = Algeb(
            info='Reference power input',
            tex_name='P_{ref}',
            v_str='R * q0',
            e_str='R * q0 - pref',
        )

        self.wd = Algeb(
            info='Generator speed deviation',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='ue * (omega - wref) - wd',
        )
        self.pd = Algeb(
            info='Pref plus speed deviation times gain',
            unit='p.u.',
            tex_name="P_d",
            v_str='0',
            e_str='ue * (- wd + pref + paux - R * dg) - pd',
        )

        self.LG = Lag(
            u=self.pd,
            K=1,
            T=self.Tf,
            info='filter after speed deviation (e)',
        )

        self.gtpos = State(info='State in gate position (c)',
                           unit='rad',
                           v_str='q0',
                           tex_name=r'\delta',
                           e_str='LG_y')

        self.dgl = VarService(
            tex_name='dg_{lower}',
            info='dg lower limit',
            v_str='- VELM - gr * LG_y',
        )
        self.dgu = VarService(
            tex_name='dg_{upper}',
            info='dg upper limit',
            v_str='VELM - gr * LG_y',
        )
        self.dg_lim = AntiWindupRate(
            u=self.gtpos,
            lower=self.GMIN,
            upper=self.GMAX,
            rate_lower=self.dgl,
            rate_upper=self.dgu,
            tex_name='lim_{dg}',
            info='gate velocity and position limiter',
        )

        self.dg = Algeb(
            info='desired gate (c)',
            unit='p.u.',
            tex_name="dg",
            v_str='q0',
            e_str='gtpos + gr * LG_y - dg',
        )

        self.LAG = Lag(
            u=self.dg,
            K=1,
            T=self.Tg,
            info='gate opening (g)',
        )
        self.h = Algeb(
            info='turbine head',
            unit='p.u.',
            tex_name="h",
            e_str='q_y**2 / LAG_y**2 - h',
            v_str='1',
        )
        self.q = Integrator(u="1 - q_y**2 / LAG_y**2",
                            T=self.Tw,
                            K=1,
                            y0='q0',
                            check_init=False,
                            info="turbine flow (q)")

        self.pout.e_str = 'ue * (At * h * (q_y - qNL) - Dt * wd * LAG_y) - pout'