Example #1
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        self.bus = IdxParam(
            model='Bus',
            info="linked bus idx",
            mandatory=True,
        )
        self.tf = TimerParam(
            info='Fault start time for the bus',
            mandatory=True,
            callback=self.apply_fault,
        )
        self.tc = TimerParam(
            info='Fault end time for the bus',
            callback=self.clear_fault,
        )
        self.xf = NumParam(
            info='Fault to ground impedance',
            default=1e-4,
            tex_name='x_f',
        )
        self.rf = NumParam(
            info='Fault to ground resistance',
            default=0,
            tex_name='x_f',
        )

        Model.__init__(self, system, config)
        self.flags.update({'tds': True})
        self.group = 'TimedEvent'
        self.gf = ConstService(
            tex_name='g_{f}',
            v_str='re(1/(rf + 1j * xf))',
        )
        self.bf = ConstService(
            tex_name='b_{f}',
            v_str='im(1/(rf + 1j * xf))',
        )
        self.uf = ConstService(
            tex_name='u_f',
            v_str='0',
        )

        self.a = ExtAlgeb(
            model='Bus',
            src='a',
            indexer=self.bus,
            tex_name=r'\theta',
            e_str='u * uf * (v ** 2 * gf)',
        )
        self.v = ExtAlgeb(
            model='Bus',
            src='v',
            indexer=self.bus,
            tex_name=r'V',
            e_str='u * uf * (v ** 2 * bf)',
        )
        self._vstore = np.array([])
Example #2
0
    def __init__(self):
        ModelData.__init__(self)
        self.t = TimerParam(info='switch time for connection status',
                            mandatory=True)

        self.model = DataParam(info='model or group name of the device',
                               mandatory=True)
        self.dev = IdxParam(info='idx of the device to alter', mandatory=True)
        self.src = IdxParam(info='model source field (param or service)',
                            mandatory=True)
        self.attr = IdxParam(info='attribute (e.g., v) of the source field',
                             default='v')

        self.method = NumParam(
            info='alteration method in `+`, `-`, `*`, `/`, `=`',
            mandatory=True,
            vtype=object)
        self.amount = NumParam(
            info='the amount to apply',
            mandatory=True,
        )

        self.rand = NumParam(info='use uniform ramdom sampling', default=0)
        self.lb = NumParam(info='lower bound of random sampling', default=0)
        self.ub = NumParam(info='upper bound of random sampling', default=0)
Example #3
0
 def __init__(self):
     super(TogglerData, self).__init__()
     self.model = DataParam(info='Model or Group of the device to control',
                            mandatory=True)
     self.dev = IdxParam(info='idx of the device to control',
                         mandatory=True)
     self.t = TimerParam(info='switch time for connection status',
                         mandatory=True)
Example #4
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        self.bus = IdxParam(
            model='Bus',
            info="linked bus idx",
            mandatory=True,
        )
        self.tf = TimerParam(
            info='Bus fault start time',
            unit='second',
            mandatory=True,
            callback=self.apply_fault,
        )
        self.tc = TimerParam(
            info='Bus fault end time',
            unit='second',
            callback=self.clear_fault,
        )
        self.xf = NumParam(
            info='Fault to ground impedance (positive)',
            unit='p.u.(sys)',
            default=1e-4,
            tex_name='x_f',
        )
        self.rf = NumParam(
            info='Fault to ground resistance (positive)',
            unit='p.u.(sys)',
            default=0,
            tex_name='x_f',
        )

        Model.__init__(self, system, config)
        self.flags.update({'tds': True})
        self.group = 'TimedEvent'
        self.gf = ConstService(
            tex_name='g_{f}',
            v_str='re(1/(rf + 1j * xf))',
        )
        self.bf = ConstService(
            tex_name='b_{f}',
            v_str='im(1/(rf + 1j * xf))',
        )

        # uf: an internal flag of whether the fault is in action (1) or not (0)
        self.uf = ConstService(tex_name='u_f', v_str='0')

        self.a = ExtAlgeb(
            model='Bus',
            src='a',
            indexer=self.bus,
            tex_name=r'\theta',
            info='Bus voltage angle',
            unit='p.u.(kV)',
            e_str='u * uf * (v ** 2 * gf)',
        )
        self.v = ExtAlgeb(
            model='Bus',
            src='v',
            indexer=self.bus,
            tex_name=r'V',
            unit='p.u.(kV)',
            info='Bus voltage magnitude',
            e_str='-u * uf * (v ** 2 * bf)',
        )
        self._vstore = np.array([])
Example #5
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        self.bus = IdxParam(
            model='Bus',
            info="linked bus idx",
            mandatory=True,
        )
        self.tf = TimerParam(
            info='Bus fault start time',
            unit='second',
            mandatory=True,
            callback=self.apply_fault,
        )
        self.tc = TimerParam(
            info='Bus fault end time',
            unit='second',
            callback=self.clear_fault,
        )
        self.xf = NumParam(
            info='Fault to ground reactance (positive)',
            unit='p.u.(sys)',
            default=1e-4,
            tex_name='x_f',
        )
        self.rf = NumParam(
            info='Fault to ground resistance (positive)',
            unit='p.u.(sys)',
            default=0,
            tex_name='x_f',
        )

        Model.__init__(self, system, config)
        self.flags.update({'tds': True})
        self.group = 'TimedEvent'

        self.config.add(
            OrderedDict((
                ('restore', 1),
                ('mode', 1),
                ('scale', 1.0),
            )))
        self.config.add_extra(
            '_alt',
            restore=(0, 1),
            mode=(1, 2, 3),
        )
        self.config.add_extra(
            '_help',
            restore='restore algebraic variables to pre-fault values',
            mode='1. restore all algeb variables, 2. fault bus only',
            scale='scaling factor of restored algebraic values',
        )

        self.gf = ConstService(
            tex_name='g_{f}',
            v_str='re(1/(rf + 1j * xf))',
        )
        self.bf = ConstService(
            tex_name='b_{f}',
            v_str='im(1/(rf + 1j * xf))',
        )

        # uf: an internal flag of whether the fault is in action (1) or not (0)
        self.uf = ConstService(tex_name='u_f', v_str='0')

        self.a = ExtAlgeb(
            model='Bus',
            src='a',
            indexer=self.bus,
            tex_name=r'\theta',
            info='Bus voltage angle',
            unit='p.u.(kV)',
            e_str='u * uf * (v ** 2 * gf)',
            ename='P',
            tex_ename='P',
        )
        self.v = ExtAlgeb(
            model='Bus',
            src='v',
            indexer=self.bus,
            tex_name=r'V',
            unit='p.u.(kV)',
            info='Bus voltage magnitude',
            e_str='-u * uf * (v ** 2 * bf)',
            ename='Q',
            tex_ename='Q',
        )
        self._vstore = np.array([])