Exemplo n.º 1
0
    def __init__(self, u, T1, T2, T3, T4, zero_out=False, name=None, tex_name=None, info=None):
        super(LeadLag2ndOrd, self).__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T1 = dummify(T1)
        self.T2 = dummify(T2)
        self.T3 = dummify(T3)
        self.T4 = dummify(T4)
        self.zero_out = zero_out
        self.enforce_tex_name((self.T1, self.T2, self.T3, self.T4))

        self.x1 = State(info='State #1 in 2nd order lead-lag', tex_name="x'", t_const=self.T2)
        self.x2 = State(info='State #2 in 2nd order lead-lag', tex_name="x''")
        self.y = Algeb(info='Output of 2nd order lead-lag', tex_name='y', diag_eps=1e-6)

        self.vars = {'x1': self.x1, 'x2': self.x2, 'y': self.y}

        if self.zero_out is True:
            self.LT1 = LessThan(T1, dummify(0), equal=True, enable=zero_out, tex_name='LT',
                                cache=True, z0=1, z1=0)
            self.LT2 = LessThan(T2, dummify(0), equal=True, enable=zero_out, tex_name='LT',
                                cache=True, z0=1, z1=0)
            self.LT3 = LessThan(T4, dummify(0), equal=True, enable=zero_out, tex_name='LT',
                                cache=True, z0=1, z1=0)
            self.LT4 = LessThan(T4, dummify(0), equal=True, enable=zero_out, tex_name='LT',
                                cache=True, z0=1, z1=0)
            self.x2.discrete = (self.LT1, self.LT2, self.LT3, self.LT4)
            self.vars['LT1'] = self.LT1
            self.vars['LT2'] = self.LT2
            self.vars['LT3'] = self.LT3
            self.vars['LT4'] = self.LT4
Exemplo n.º 2
0
    def __init__(self,
                 u,
                 T1,
                 T2,
                 T3,
                 T4,
                 name=None,
                 tex_name=None,
                 info='2nd-order lead-lag'):
        super(LeadLag2ndOrd, self).__init__(name=name,
                                            tex_name=tex_name,
                                            info=info)
        self.u = u
        self.T1 = dummify(T1)
        self.T2 = dummify(T2)
        self.T3 = dummify(T3)
        self.T4 = dummify(T4)
        self.enforce_tex_name((self.T1, self.T2, self.T3, self.T4))

        self.x1 = State(info='State #1 in 2nd order lead-lag',
                        tex_name="x'",
                        t_const=self.T2)
        self.x2 = State(info='State #2 in 2nd order lead-lag', tex_name="x''")
        self.y = Algeb(info='Output of 2nd order lead-lag',
                       tex_name='y',
                       diag_eps=1e-6)

        self.vars = {'x1': self.x1, 'x2': self.x2, 'y': self.y}
Exemplo n.º 3
0
    def __init__(self, system, config):
        DC2Term.__init__(self, system, config)
        self.flags.pflow = True
        self.group = 'DCLink'

        self.R = NumParam(
            unit='p.u.',
            tex_name='R',
            info='DC line resistance',
            non_zero=True,
            default=0.01,
            r=True,
        )
        self.L = NumParam(
            unit='p.u.',
            tex_name='L',
            info='DC line inductance',
            non_zero=True,
            default=0.001,
            r=True,
        )
        self.C = NumParam(
            unit='p.u.',
            tex_name='C',
            info='DC capacitance',
            non_zero=True,
            default=0.001,
            g=True,
        )
        self.IL = State(
            tex_name='I_L',
            info='Inductance current',
            unit='p.u.',
            v_str='0',
            e_str='u * vC',
            t_const=self.L,
        )
        self.vC = State(
            tex_name='v_C',
            info='Capacitor current',
            unit='p.u.',
            e_str='-u * (Idc - vC/R - IL)',
            v_str='v1 - v2',
            t_const=self.C,
        )
        self.Idc = Algeb(
            tex_name='I_{dc}',
            info='Current from node 2 to 1',
            unit='p.u.',
            e_str='u * (vC - (v1 - v2)) + '
            '(1 - u) * Idc',
            v_str='-(v1 - v2) / R',
            diag_eps=True,
        )
        self.v1.e_str = '-Idc'
        self.v2.e_str = '+Idc'
Exemplo n.º 4
0
    def __init__(self):
        self.psid = State(tex_name=r'\psi_d',
                          v_str='psid0',
                          e_str='u * 2 * pi * fn * (ra * Id + vd + omega * psiq)',
                          )
        self.psiq = State(tex_name=r'\psi_q',
                          v_str='psiq0',
                          e_str='u * 2 * pi * fn * (ra * Iq + vq - omega * psid)',
                          )

        self.Id.e_str += '+ psid'
        self.Iq.e_str += '+ psiq'
Exemplo n.º 5
0
    def __init__(self, system, config):
        DC2Term.__init__(self, system, config)
        self.flags['pflow'] = True
        self.group = 'DCLink'

        self.R = NumParam(
            unit='p.u.',
            info='DC line resistance',
            non_zero=True,
            default=0.01,
            r=True,
        )
        self.L = NumParam(
            unit='p.u.',
            info='DC line inductance',
            non_zero=True,
            default=0.001,
            r=True,
        )
        self.C = NumParam(
            unit='p.u.',
            info='DC capacitance',
            non_zero=True,
            default=0.001,
            g=True,
        )
        self.IL = State(
            tex_name='I_L',
            info='Inductance current',
            unit='p.u.',
            e_str='u * (v1 - v2 - R * IL - vC) / L',
            v_str='0',
        )
        self.vC = State(
            tex_name='v_C',
            info='Capacitor current',
            unit='p.u.',
            e_str='u * IL / C',
            v_str='v1 - v2',
        )
        self.Idc = Algeb(
            tex_name='I_{dc}',
            info='Current from node 2 to 1',
            unit='p.u.',
            e_str='-IL - Idc',
            v_str='0',
            diag_eps=1e-6,
        )
        self.v1.e_str = '-Idc'
        self.v2.e_str = '+Idc'
Exemplo n.º 6
0
    def __init__(self, u, K, T1, T2, name=None, tex_name=None, info=None):
        super(Lag2ndOrd, self).__init__(name=name, tex_name=tex_name, info=info)

        self.u = dummify(u)
        self.K = dummify(K)
        self.T1 = dummify(T1)
        self.T2 = dummify(T2)

        self.enforce_tex_name((self.K, self.T1, self.T2))

        self.x = State(info='State in 2nd order LPF', tex_name="x'", t_const=self.T2)
        self.y = State(info='Output of 2nd order LPF', tex_name='y')

        self.vars = {'x': self.x, 'y': self.y}
Exemplo n.º 7
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='tm0 * R - pref',
        )
        self.wd = Algeb(
            info='Generator under speed',
            unit='p.u.',
            tex_name=r'\omega_{dev}',
            v_str='0',
            e_str='u * (wref - omega) - wd',
        )
        self.pd = Algeb(info='Pref plus under speed times gain',
                        unit='p.u.',
                        tex_name="P_d",
                        v_str='tm0',
                        e_str='(wd + pref) * 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 = '(LL_y + Dt * wd) - pout'
Exemplo n.º 8
0
    def __init__(self,
                 u,
                 T,
                 K,
                 y0,
                 lower,
                 upper,
                 name=None,
                 tex_name=None,
                 info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T = dummify(T)
        self.K = dummify(K)
        self.y0 = dummify(y0)
        self.lower = dummify(lower)
        self.upper = dummify(upper)
        self.enforce_tex_name((self.K, self.T))

        self.y = State(info='AW Integrator output',
                       tex_name='y',
                       t_const=self.T)

        self.lim = AntiWindup(
            u=self.y,
            lower=self.lower,
            upper=self.upper,
            tex_name='lim',
            info='Limiter in integrator',
        )

        self.vars = {'y': self.y, 'lim': self.lim}
Exemplo n.º 9
0
    def __init__(self,
                 u,
                 T1,
                 T2,
                 lower,
                 upper,
                 name=None,
                 tex_name=None,
                 info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T1 = dummify(T1)
        self.T2 = dummify(T2)
        self.lower = lower
        self.upper = upper
        self.enforce_tex_name((self.T1, self.T2))

        self.x = State(info='State in lead-lag TF',
                       tex_name="x'",
                       t_const=self.T2)
        self.ynl = Algeb(info='Output of lead-lag TF before limiter',
                         tex_name=r'y_{nl}')
        self.y = Algeb(info='Output of lead-lag TF after limiter',
                       tex_name=r'y',
                       diag_eps=1e-6)
        self.lim = AntiWindup(u=self.ynl, lower=self.lower, upper=self.upper)

        self.vars = {
            'x': self.x,
            'ynl': self.ynl,
            'y': self.y,
            'lim': self.lim
        }
Exemplo n.º 10
0
    def __init__(self, system, config):
        DC2Term.__init__(self, system, config)
        self.flags.pflow = True
        self.group = 'DCLink'

        self.R = NumParam(unit='p.u.',
                          tex_name='R',
                          info='DC line resistance',
                          non_zero=True,
                          default=0.01,
                          r=True,
                          )
        self.L = NumParam(unit='p.u.',
                          tex_name='L',
                          info='DC line inductance',
                          non_zero=True,
                          default=0.001,
                          r=True,
                          )
        self.IL = State(tex_name='I_L',
                        info='Inductance current',
                        unit='p.u.',
                        e_str='u * (v1 - v2 - R * IL) / L',
                        v_str='(v1 - v2) / R',
                        )
        self.Idc = Algeb(tex_name='I_{dc}',
                         info='Current from node 2 to 1',
                         unit='p.u.',
                         e_str='-u * IL - Idc',
                         v_str='-u * (v1 - v2) / R',
                         )
        self.v1.e_str = '-Idc'
        self.v2.e_str = '+Idc'
Exemplo n.º 11
0
    def __init__(self,
                 u,
                 T,
                 K,
                 lower,
                 upper,
                 name=None,
                 tex_name=None,
                 info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T = dummify(T)
        self.K = dummify(K)

        self.lower = lower
        self.upper = upper

        self.enforce_tex_name((self.T, self.K))

        self.y = State(info='State in lag TF', tex_name="y", t_const=self.T)
        self.lim = AntiWindup(u=self.y,
                              lower=self.lower,
                              upper=self.upper,
                              tex_name='lim',
                              info='Limiter in Lag')

        self.vars = {'y': self.y, 'lim': self.lim}
Exemplo n.º 12
0
    def __init__(self, u, T, K,
                 lower, upper, rate_lower, rate_upper,
                 no_lower=False, no_upper=False, rate_no_lower=False, rate_no_upper=False,
                 rate_lower_cond=None, rate_upper_cond=None,
                 name=None, tex_name=None, info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T = dummify(T)
        self.K = dummify(K)

        self.lower = dummify(lower)
        self.upper = dummify(upper)

        self.enforce_tex_name((self.T, self.K))

        self.y = State(info='State in lag TF', tex_name="y",
                       t_const=self.T,
                       )
        self.lim = AntiWindupRate(u=self.y, lower=self.lower, upper=self.upper,
                                  rate_lower=rate_lower, rate_upper=rate_upper,
                                  no_lower=no_lower, no_upper=no_upper,
                                  rate_no_lower=rate_no_lower, rate_no_upper=rate_no_upper,
                                  rate_lower_cond=rate_lower_cond, rate_upper_cond=rate_upper_cond,
                                  tex_name='lim',
                                  info='Limiter in Lag',
                                  )

        self.vars = {'y': self.y, 'lim': self.lim}
Exemplo n.º 13
0
    def __init__(self, system, config):
        DC2Term.__init__(self, system, config)
        self.flags['pflow'] = True
        self.group = 'DCLink'

        self.C = NumParam(
            unit='p.u.',
            info='DC capacitance',
            non_zero=True,
            default=0.001,
            g=True,
        )
        self.vC = State(
            tex_name='v_C',
            info='Capacitor current',
            unit='p.u.',
            v_str='0',
            e_str='-u * Idc / C',
        )
        self.Idc = Algeb(
            tex_name='I_{dc}',
            info='Current from node 2 to 1',
            unit='p.u.',
            v_str='0',
            e_str='u * (vC - (v1 - v2)) + '
            '(1 - u) * Idc',
            diag_eps=1e-6,
        )
        self.v1.e_str = '-Idc'
        self.v2.e_str = '+Idc'
Exemplo n.º 14
0
    def __init__(self,
                 u,
                 T1,
                 T2,
                 lower,
                 upper,
                 name=None,
                 info='Lead-lag transfer function'):
        super().__init__(name=name, info=info)
        self.T1 = T1
        self.T2 = T2
        self.u = u
        self.lower = lower
        self.upper = upper

        self.x = State(info='State in lead-lag transfer function',
                       tex_name="x'")
        self.ynl = Algeb(
            info='Output of lead-lag transfer function before limiter',
            tex_name=r'y_{nl}')
        self.y = Algeb(
            info='Output of lead-lag transfer function after limiter',
            tex_name=r'y')
        self.lim = HardLimiter(u=self.ynl, lower=self.lower, upper=self.upper)

        self.vars = {
            'x': self.x,
            'ynl': self.ynl,
            'y': self.y,
            'lim': self.lim
        }
Exemplo n.º 15
0
    def __init__(self,
                 u,
                 T,
                 K,
                 lower,
                 upper,
                 name=None,
                 info='Lag transfer function with non-windup limiter'):
        super().__init__(name=name, info=info)
        if isinstance(K, (int, float)):
            self.K = DummyValues(K)
        else:
            self.K = K
        self.u = u
        self.T = T
        self.lower = lower
        self.upper = upper

        self.x = State(info='State in lag transfer function', tex_name="x'")
        self.lim = AntiWindupLimiter(u=self.x,
                                     lower=self.lower,
                                     upper=self.upper,
                                     tex_name='lim')

        self.vars = {'x': self.x, 'lim': self.lim}
Exemplo n.º 16
0
    def __init__(self,
                 u,
                 T,
                 K,
                 lower,
                 upper,
                 name=None,
                 info='Lag transfer function with non-windup limiter'):
        super().__init__(name=name, info=info)
        self.u = u
        self.T = dummify(T)
        self.K = dummify(K)

        self.lower = lower
        self.upper = upper

        self.enforce_tex_name((self.T, self.K))

        self.x = State(info='State in lag transfer function',
                       tex_name="x'",
                       t_const=self.T)
        self.lim = AntiWindupLimiter(u=self.x,
                                     lower=self.lower,
                                     upper=self.upper,
                                     tex_name='lim')

        self.vars = {'x': self.x, 'lim': self.lim}
Exemplo n.º 17
0
    def __init__(self, system, config):
        MotorBaseModel.__init__(self, system, config)

        self.x2 = ConstService(
            v_str='xs + xr1*xr2*xm / (xr1*xr2 + xr1*xm + xr2*xm)',
            tex_name="x''",
        )
        self.T20 = ConstService(
            v_str='(xr2 + xr1*xm / (xr1 + xm) ) / (wb * rr2)',
            tex_name="T''_0",
        )

        self.e2d = State(
            info='real part of 2nd cage voltage',
            e_str='u * '
            '(-wb*slip*(e1q - e2q) + '
            '(wb*slip*e1q - (e1d + (x0 - x1) * Iq)/T10) + '
            '(e1d - e2d - (x1 - x2) * Iq)/T20)',
            v_str='0.05 * u',
            tex_name="e''_d",
            diag_eps=True,
        )

        self.e2q = State(
            info='imag part of 2nd cage voltage',
            e_str='u * '
            '(wb*slip*(e1d - e2d) + '
            '(-wb*slip*e1d - (e1q - (x0 - x1) * Id)/T10) + '
            '(e1q - e2q + (x1 - x2) * Id) / T20)',
            v_str='0.9 * u',
            tex_name="e''_q",
            diag_eps=True,
        )

        self.Id.e_str = 'u * (vd - e2d - rs * Id + x2 * Iq)'

        self.Id.v_str = '0.9 * u'

        self.Iq.e_str = 'u * (vq - e2q - rs * Iq - x2 * Id)'

        self.Iq.v_str = '0.1 * u'

        self.te.v_str = 'u * (e2d * Id + e2q * Iq)'

        self.te.e_str = f'{self.te.v_str} - te'
Exemplo n.º 18
0
    def __init__(self, system, config):
        Model.__init__(self, system, config)
        self.group = 'Experimental'
        self.flags.update({'tds': True})
        self.uin = State(
            v_str=0,
            e_str=
            'Piecewise((0, dae_t<= 0), (1, dae_t <= 2), (-1, dae_t <6), (1, True))',
        )
        self.x = State(
            e_str='uin * Ki * HL_zi',
            v_str=0.05,
        )
        self.y = Algeb(e_str='uin * Kp + x - y', v_str=0.05)

        self.HL = HardLimiter(u=self.y, lower=self.Wmin, upper=self.Wmax)
        self.w = Algeb(e_str='HL_zi * y + HL_zl * Wmin + HL_zu * Wmax - w',
                       v_str=0.05)
Exemplo n.º 19
0
    def __init__(self, u, T, K, name=None, tex_name=None, info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T = dummify(T)
        self.K = dummify(K)
        self.enforce_tex_name((self.K, self.T))

        self.x = State(info='State in washout filter', tex_name="x'", t_const=self.T)
        self.y = Algeb(info='Output of washout filter', tex_name=r'y', diag_eps=1e-6)
        self.vars.update({'x': self.x, 'y': self.y})
Exemplo n.º 20
0
    def __init__(self, u, T, K, y0, name=None, tex_name=None, info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.K = dummify(K)
        self.T = dummify(T)
        self.y0 = dummify(y0)
        self.enforce_tex_name((self.K, self.T))

        self.y = State(info='Integrator output', tex_name='y', t_const=self.T)
        self.vars = {'y': self.y}
Exemplo n.º 21
0
    def __init__(self, u, T, K, name=None, tex_name=None, info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T = dummify(T)
        self.K = dummify(K)

        self.enforce_tex_name((self.K, self.T))
        self.y = State(info='State in lag transfer function', tex_name="y",
                       t_const=self.T)

        self.vars = {'y': self.y}
Exemplo n.º 22
0
    def __init__(self, u, T, K, name=None, info='Lag transfer function'):
        super().__init__(name=name, info=info)
        self.u = u
        self.T = dummify(T)
        self.K = dummify(K)

        self.enforce_tex_name((self.K, self.T))
        self.x = State(info='State in lag transfer function',
                       tex_name="x'",
                       t_const=self.T)

        self.vars = {'x': self.x}
Exemplo n.º 23
0
    def __init__(self, u, T1, T2, name=None, info='Lead-lag transfer function', safe_div=True):
        super().__init__(name=name, info=info)
        self.T1 = T1
        self.T2 = T2
        self.u = u
        self.safe_div = safe_div  # TODO: implement me

        self.enforce_tex_name((self.T1, self.T2))

        self.x = State(info='State in lead-lag transfer function', tex_name="x'")
        self.y = Algeb(info='Output of lead-lag transfer function', tex_name=r'y')
        self.vars = {'x': self.x, 'y': self.y}
Exemplo n.º 24
0
    def __init__(self, u, ref, kp, ki, name=None, info=None):
        super().__init__(name=name, info=info)

        self.u = u
        self.ref = ref
        self.kp = kp
        self.ki = ki

        self.xi = State(info="Integration value of PI controller")
        self.y = Algeb(info="Output value")

        self.vars = {'xi': self.xi, 'y': self.y}
Exemplo n.º 25
0
    def __init__(self, u, T, K, name=None, info='Lag transfer function'):
        super().__init__(name=name, info=info)
        self.u = u
        self.T = T
        if isinstance(K, (int, float)):
            self.K = DummyValues(K)
        else:
            self.K = K

        self.enforce_tex_name((self.K, self.T))
        self.x = State(info='State in lag transfer function', tex_name="x'")

        self.vars = {'x': self.x}
Exemplo n.º 26
0
    def __init__(self, u, kp, ki, ref=0.0, x0=0.0, name=None, tex_name=None, info=None):
        Block.__init__(self, name=name, tex_name=tex_name, info=info)

        self.u = u
        self.kp = dummify(kp)
        self.ki = dummify(ki)
        self.ref = dummify(ref)
        self.x0 = dummify(x0)

        self.xi = State(info="Integrator output", tex_name='xi')
        self.y = Algeb(info="PI output", tex_name='y')

        self.vars = {'xi': self.xi, 'y': self.y}
Exemplo n.º 27
0
    def __init__(self, system, config):
        PMUData.__init__(self)
        Model.__init__(self, system, config)

        self.flags.tds = True
        self.group = 'PhasorMeasurement'

        self.a = ExtAlgeb(
            model='Bus',
            src='a',
            indexer=self.bus,
            tex_name=r'\theta',
            info='Bus voltage phase angle',
        )
        self.v = ExtAlgeb(
            model='Bus',
            src='v',
            indexer=self.bus,
            tex_name=r'V',
            info='Bus voltage magnitude',
        )

        self.am = State(
            tex_name=r'\theta_m',
            info='phase angle measurement',
            unit='rad.',
            e_str='a - am',
            t_const=self.Ta,
            v_str='a',
        )

        self.vm = State(
            tex_name='V_m',
            info='voltage magnitude measurement',
            unit='p.u.(kV)',
            e_str='v - vm',
            t_const=self.Tv,
            v_str='v',
        )
Exemplo n.º 28
0
    def __init__(self, u, kp, ki, ref=0.0, name=None, tex_name=None, info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)

        self.u = u
        self.ref = dummify(ref)
        self.kp = dummify(kp)
        self.ki = dummify(ki)

        self.xi = State(info="Integrator value")
        self.y = Algeb(info="PI output")

        self.vars = {'xi': self.xi, 'y': self.y}
        self.flags.update({'f_num': True, 'g_num': True, 'j_num': True})
Exemplo n.º 29
0
    def __init__(self, system, config):
        super().__init__(system, config)

        self.flags.tds = True
        self.group = 'PLL'

        self.a = ExtAlgeb(model='Bus',
                          src='a',
                          indexer=self.bus,
                          tex_name=r'\theta',
                          info='Bus voltage angle')

        self.af = Lag(
            u=self.a,
            T=self.Tf,
            K=1,
            D=1,
            info='input angle signal filter',
        )

        self.PI = PIController(
            u='u * (af_y - am)',
            kp=self.Kp,
            ki=self.Ki,
            tex_name='PI',
            info='PI controller',
        )

        self.ae = State(info='PLL angle output before filter',
                        e_str='2 * pi *fn * PI_y',
                        v_str='a',
                        tex_name=r'\theta_{est}')

        self.am = State(info='PLL output angle after filtering',
                        e_str='ae - am',
                        t_const=self.Tp,
                        v_str='a',
                        tex_name=r'\theta_{PLL}')
Exemplo n.º 30
0
    def __init__(self,
                 u,
                 T1,
                 T2,
                 K=1,
                 zero_out=True,
                 name=None,
                 tex_name=None,
                 info=None):
        super().__init__(name=name, tex_name=tex_name, info=info)
        self.u = dummify(u)
        self.T1 = dummify(T1)
        self.T2 = dummify(T2)
        self.K = dummify(K)
        self.zero_out = zero_out

        self.enforce_tex_name((self.T1, self.T2))

        self.x = State(info='State in lead-lag',
                       tex_name="x'",
                       t_const=self.T2)
        self.y = Algeb(info='Output of lead-lag', tex_name=r'y', diag_eps=1e-6)
        self.vars = {'x': self.x, 'y': self.y}

        if self.zero_out is True:
            self.LT1 = LessThan(T1,
                                dummify(0),
                                equal=True,
                                enable=zero_out,
                                tex_name='LT',
                                cache=True,
                                z0=1,
                                z1=0)
            self.LT2 = LessThan(T2,
                                dummify(0),
                                equal=True,
                                enable=zero_out,
                                tex_name='LT',
                                cache=True,
                                z0=1,
                                z1=0)
            self.x.discrete = (self.LT1, self.LT2)
            self.vars['LT1'] = self.LT1
            self.vars['LT2'] = self.LT2