Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def __init__(self):
        ModelData.__init__(self)

        self.bus = IdxParam(info="bus idx", mandatory=True)

        self.Kp = NumParam(
            info='proportional gain',
            default=1,
            tex_name='K_p',
        )

        self.Ki = NumParam(
            info='integral gain',
            default=0.2,
            tex_name='K_i',
        )

        self.Tf = NumParam(
            default=0.05,
            info="input digital filter time const",
            unit="sec",
            tex_name='T_f',
        )
        self.Tp = NumParam(default=0.05,
                           info='output filter time const.',
                           unit='sec',
                           tex_name='T_p')

        self.fn = NumParam(
            default=60.0,
            info="nominal frequency",
            unit='Hz',
            tex_name='f_n',
        )
Ejemplo n.º 3
0
    def __init__(self):
        ModelData.__init__(self)

        self.mode = NumParam(default='1',
                             info='Mode for applying timeseries. '
                                  '1: exact time, '
                                  '2: interpolated',
                             vrange=(1, 2),
                             )

        self.path = DataParam(mandatory=True, info='Path to timeseries xlsx file')
        self.sheet = DataParam(mandatory=True, info='Sheet name to use')
        self.fields = NumParam(mandatory=True,
                               info='comma-separated field names in timeseries data',
                               iconvert=str_list_iconv,
                               oconvert=str_list_oconv,
                               vtype=np.object,
                               )

        self.tkey = DataParam(default='t', info='Key for timestamps')

        self.model = DataParam(info='Model to link to', mandatory=True)
        self.dev = IdxParam(info='Idx of device to link to', mandatory=True)
        self.dests = NumParam(mandatory=True,
                              info='comma-separated device fields as destinations',
                              iconvert=str_list_iconv,
                              oconvert=str_list_oconv,
                              vtype=np.object,
                              )
Ejemplo n.º 4
0
 def __init__(self, system, config):
     ModelData.__init__(self)
     self.node = IdxParam(
         default=None,
         tex_name='node',
         info='Node index',
         mandatory=True,
         model='Node',
     )
     self.voltage = NumParam(
         default=0.0,
         tex_name='V_0',
         info='Ground voltage (typically 0)',
         unit='p.u.',
     )
     Model.__init__(self, system, config)
     self.flags.update({'pflow': True})
     self.group = 'DCLink'
     self.v = ExtAlgeb(
         model='Node',
         src='v',
         indexer=self.node,
         e_str='-Idc',
     )
     self.Idc = Algeb(
         tex_name='I_{dc}',
         info='Ficticious current injection from ground',
         e_str='u * (v - voltage)',
         v_str='0',
         diag_eps=1e-6,
     )
     self.v.e_str = '-Idc'
Ejemplo n.º 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='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([])
Ejemplo n.º 6
0
    def __init__(self):
        ModelData.__init__(self)
        self.bus = IdxParam(info="bus idx", mandatory=True)

        self.Ta = NumParam(default=0.1,
                           tex_name='T_a',
                           info='angle filter time constant')
        self.Tv = NumParam(default=0.1,
                           tex_name='T_v',
                           info='voltage filter time constant')
Ejemplo n.º 7
0
    def __init__(self, system, config):
        ModelData.__init__(self, three_params=False)

        self.field = DataParam(info='field name')
        self.comment = DataParam(info='information, comment, or anything')
        self.comment2 = DataParam(info='comment field 2')
        self.comment3 = DataParam(info='comment field 3')
        self.comment4 = DataParam(info='comment field 4')

        Model.__init__(self, system, config)
        self.group = 'Information'
Ejemplo n.º 8
0
    def __init__(self):
        ModelData.__init__(self)

        self.bus = IdxParam(
            model='Bus',
            info="interface bus id",
            mandatory=True,
        )
        self.gen = IdxParam(
            info="static generator index",
            mandatory=True,
        )
Ejemplo n.º 9
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        self.node1 = IdxParam(
            default=None,
            tex_name='node_1',
            info='Node 1 index',
            mandatory=True,
            model='Node',
        )
        self.node2 = IdxParam(
            default=None,
            tex_name='node_2',
            info='Node 2 index',
            mandatory=True,
            model='Node',
        )
        self.Vdcn1 = NumParam(
            default=100,
            info='DC voltage rating on node 1',
            unit='kV',
            non_zero=True,
            tex_name='V_{dcn1}',
        )
        self.Vdcn2 = NumParam(
            default=100,
            info='DC voltage rating on node 2',
            unit='kV',
            non_zero=True,
            tex_name='V_{dcn2}',
        )
        self.Idcn = NumParam(
            default=1,
            info='DC current rating',
            unit='kA',
            non_zero=True,
            tex_name='I_{dcn}',
        )

        Model.__init__(self, system, config)
        self.v1 = ExtAlgeb(
            model='Node',
            src='v',
            indexer=self.node1,
            info='DC voltage on node 1',
        )
        self.v2 = ExtAlgeb(
            model='Node',
            src='v',
            indexer=self.node2,
            info='DC voltage on node 2',
        )
Ejemplo n.º 10
0
    def __init__(self):
        ModelData.__init__(self)
        self.bus = IdxParam(model='Bus',
                            info="bus idx for freq. measurement",
                            mandatory=True)
        self.bias = NumParam(default=1.0,
                             info='bias parameter',
                             tex_name=r'\beta',
                             unit='MW/0.1Hz',
                             power=True)

        self.busf = IdxParam(info='Optional BusFreq device idx',
                             model='BusFreq',
                             default=None)
Ejemplo n.º 11
0
    def __init__(self):
        ModelData.__init__(self)
        self.avr = IdxParam(info='Exciter idx',
                            mandatory=True,
                            model='Exciter')

        self.rc = NumParam(default=0.0,
                           info="Active compensation degree.",
                           z=True,
                           tex_name='r_c')
        self.xc = NumParam(default=0.0,
                           info="Reactive compensation degree.",
                           z=True,
                           tex_name='x_c')
Ejemplo n.º 12
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        Model.__init__(self, system, config)
        self.flags.tds = True
        self.group = 'FreqMeasurement'

        # Parameters
        self.bus = IdxParam(info="bus idx", mandatory=True)
        self.Tf = NumParam(default=0.02, info="input digital filter time const", unit="sec",
                           tex_name='T_f')
        self.Tw = NumParam(default=0.02, info="washout time const", unit="sec",
                           tex_name='T_w')
        self.fn = NumParam(default=60.0, info="nominal frequency", unit='Hz',
                           tex_name='f_n')

        # Variables
        self.iwn = ConstService(v_str='u / (2 * pi * fn)', tex_name=r'1/\omega_n')
        self.a0 = ExtService(src='a',
                             model='Bus',
                             indexer=self.bus,
                             tex_name=r'\theta_0',
                             info='initial phase angle',
                             )
        self.a = ExtAlgeb(model='Bus',
                          src='a',
                          indexer=self.bus,
                          tex_name=r'\theta',
                          )
        self.v = ExtAlgeb(model='Bus',
                          src='v',
                          indexer=self.bus,
                          tex_name=r'V',
                          )
        self.L = Lag(u='(a-a0)',
                     T=self.Tf,
                     K=1,
                     info='digital filter',
                     )
        self.WO = Washout(u=self.L_y,
                          K=self.iwn,
                          T=self.Tw,
                          info='angle washout',
                          )
        self.f = Algeb(info='frequency output',
                       unit='p.u. (Hz)',
                       tex_name='f',
                       v_str='1',
                       e_str='1 + WO_y - f',
                       )
Ejemplo n.º 13
0
    def __init__(self):
        ModelData.__init__(self)

        self.pq = IdxParam(
            model='PQ',
            mandatory=True,
            info='idx of the PQ to replace',
        )
        self.busf = IdxParam(
            model='BusFreq',
            info='optional idx of the BusFreq device to use',
        )

        self.kp = NumParam(
            info='active power percentage',
            default=100.0,
            unit='%',
        )
        self.kq = NumParam(
            info='active power percentage',
            default=100.0,
            unit='%',
        )

        self.Tf = NumParam(
            info='filter time constant',
            unit='s',
            default=0.02,
            non_negative=True,
        )
        self.ap = NumParam(
            info='active power voltage exponent',
            default=1.0,
        )
        self.aq = NumParam(
            info='reactive power voltage exponent',
            default=0.0,
        )
        self.bp = NumParam(
            info='active power frequency exponent',
            default=0.0,
        )
        self.bq = NumParam(
            info='reactive power frequency exponent',
            default=0.0,
        )
Ejemplo n.º 14
0
    def __init__(self):
        ModelData.__init__(self)
        self.bus = IdxParam(model='Bus',
                            info="bus idx for freq. measurement",
                            mandatory=True)
        self.bias = NumParam(default=1.0,
                             info='bias parameter',
                             tex_name=r'\beta',
                             unit='MW/0.1Hz',
                             power=True)
        self.tcycle = NumParam(default=4.0,
                               info='Update cycle',
                               tex_name='t_{cycle}')
        # TODO: do not skip time in the update cycle.

        self.busf = IdxParam(info='Optional BusFreq idx',
                             model='BusFreq',
                             default=None)
Ejemplo n.º 15
0
    def __init__(self):
        ModelData.__init__(self)

        self.pq = IdxParam(
            model='PQ',
            mandatory=True,
            info='idx of the PQ to replace',
        )

        self.kpp = NumParam(
            info='Percentage of active power',
            mandatory=True,
            tex_name='K_{pp}',
        )
        self.kpi = NumParam(
            info='Percentage of active current',
            mandatory=True,
            tex_name='K_{pi}',
        )
        self.kpz = NumParam(
            info='Percentage of conductance',
            mandatory=True,
            tex_name='K_{pz}',
        )

        self.kqp = NumParam(
            info='Percentage of reactive power',
            mandatory=True,
            tex_name='K_{qp}',
        )
        self.kqi = NumParam(
            info='Percentage of reactive current',
            mandatory=True,
            tex_name='K_{qi}',
        )
        self.kqz = NumParam(
            info='Percentage of susceptance',
            mandatory=True,
            tex_name='K_{qz}',
        )
Ejemplo n.º 16
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        Model.__init__(self, system, config)
        self.group = 'Experimental'

        self.flags.tds = True
Ejemplo n.º 17
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([])
Ejemplo n.º 18
0
    def __init__(self, system, config):
        ModelData.__init__(self)
        self.bus = IdxParam(
            model='Bus',
            info="idx of connected bus",
            mandatory=True,
        )
        self.node1 = IdxParam(
            default=None,
            tex_name='node_1',
            info='Node 1 index',
            mandatory=True,
            model='Node',
        )
        self.node2 = IdxParam(
            default=None,
            tex_name='node_2',
            info='Node 2 index',
            mandatory=True,
            model='Node',
        )
        self.Vn = NumParam(
            default=110.0,
            info="AC voltage rating",
            non_zero=True,
            tex_name=r'V_n',
        )
        self.Vdcn1 = NumParam(
            default=100,
            info='DC voltage rating on node 1',
            unit='kV',
            non_zero=True,
            tex_name='V_{dcn1}',
        )
        self.Vdcn2 = NumParam(
            default=100,
            info='DC voltage rating on node 2',
            unit='kV',
            non_zero=True,
            tex_name='V_{dcn2}',
        )
        self.Idcn = NumParam(
            default=1,
            info='DC current rating',
            unit='kA',
            non_zero=True,
            tex_name='I_{dcn}',
        )

        Model.__init__(self, system, config)
        self.a = ExtAlgeb(
            model='Bus',
            src='a',
            indexer=self.bus,
            info='AC bus voltage phase',
        )
        self.v = ExtAlgeb(
            model='Bus',
            src='v',
            indexer=self.bus,
            info='AC bus voltage magnitude',
        )
        self.v1 = ExtAlgeb(
            model='Node',
            src='v',
            indexer=self.node1,
            info='DC node 1 voltage',
        )
        self.v2 = ExtAlgeb(
            model='Node',
            src='v',
            indexer=self.node2,
            info='DC node 2 voltage',
        )
Ejemplo n.º 19
0
    def __init__(self):
        ModelData.__init__(self, three_params=False)

        self.model = DataParam(info='Name of the model', mandatory=True)
        self.varname = DataParam(info='Variable name', )
        self.dev = DataParam(info='Device name', )
Ejemplo n.º 20
0
    def __init__(self):
        ModelData.__init__(self)

        self.bus1 = IdxParam(model='Bus', info="idx of from bus")
        self.bus2 = IdxParam(model='Bus', info="idx of to bus")
Ejemplo n.º 21
0
 def __init__(self):
     ModelData.__init__(self)
Ejemplo n.º 22
0
 def __init__(self):
     ModelData.__init__(self)
     self.Kp = NumParam()
     self.Ki = NumParam()
     self.Wmax = NumParam()
     self.Wmin = NumParam()
Ejemplo n.º 23
0
    def __init__(self):
        ModelData.__init__(self)
        self.bus = IdxParam(
            model='Bus',
            info="interface bus id",
            mandatory=True,
        )

        self.Sn = NumParam(
            default=100.0,
            info="Power rating",
            tex_name='S_n',
        )

        self.Vn = NumParam(
            default=110.0,
            info="AC voltage rating",
            tex_name='V_n',
        )
        self.fn = NumParam(
            default=60.0,
            info="rated frequency",
            tex_name='f',
        )

        self.rs = NumParam(
            default=0.01,
            info="rotor resistance",
            z=True,
            tex_name='r_s',
            non_zero=True,
        )

        self.xs = NumParam(
            default=0.15,
            info="rotor reactance",
            z=True,
            tex_name='x_s',
            non_zero=True,
        )
        self.rr1 = NumParam(
            default=0.05,
            info="1st cage rotor resistance",
            z=True,
            non_zero=True,
            tex_name='r_{R1}',
        )
        self.xr1 = NumParam(
            default=0.15,
            info="1st cage rotor reactance",
            z=True,
            tex_name='x_{R1}',
            non_zero=True,
        )
        self.rr2 = NumParam(
            default=0.001,
            info="2st cage rotor resistance",
            z=True,
            non_zero=True,
            tex_name='r_{R2}',
        )
        self.xr2 = NumParam(
            default=0.04,
            info="2st cage rotor reactance",
            z=True,
            tex_name='x_{R2}',
            non_zero=True,
        )

        self.xm = NumParam(
            default=5.0,
            info="magnetization reactance",
            z=True,
            tex_name='x_m',
            non_zero=True,
        )

        self.Hm = NumParam(
            default=3.0,
            info='Inertia constant',
            power=True,
            tex_name='H_m',
            unit='kWs/KVA',
        )

        self.c1 = NumParam(
            default=0.1,
            info='1st coeff. of Tm(w)',
            tex_name='c_1',
        )

        self.c2 = NumParam(
            default=0.02,
            info='2nd coeff. of Tm(w)',
            tex_name='c_2',
        )

        self.c3 = NumParam(
            default=0.02,
            info='3rd coeff. of Tm(w)',
            tex_name='c_3',
        )

        self.zb = NumParam(
            default=1.0,
            info='Allow working as brake',
            tex_name='z_b',
            vrange=(0, 1),
        )
Ejemplo n.º 24
0
    def __init__(self):
        ModelData.__init__(self)

        self.bus = IdxParam(model='Bus',
                            info="interface bus id",
                            mandatory=True,
                            )

        self.gen = IdxParam(info="static generator index",
                            mandatory=True,
                            )

        self.Sn = NumParam(default=100.0, tex_name='S_n',
                           info='device MVA rating',
                           unit='MVA',
                           )

        self.fn = NumParam(default=60.0, tex_name='f_n',
                           info='nominal frequency',
                           unit='Hz',
                           )

        self.busf = IdxParam(info='Optional BusFreq measurement device idx',
                             model='BusFreq',
                             default=None,
                             )

        self.xc = NumParam(default=0.0, tex_name='x_c',
                           info='coupling reactance',
                           unit='p.u.',
                           z=True,
                           )

        self.pqflag = NumParam(info='P/Q priority for I limit; 0-Q priority, 1-P priority',
                               mandatory=True,
                               unit='bool',
                               )

        # --- parameters found from ESIG.energy ---
        self.igreg = IdxParam(model='Bus',
                              info='Remote bus idx for droop response, None for local',
                              )

        self.qmx = NumParam(default=0.33, tex_name='q_{mx}',
                            info='Max. reactive power command',
                            power=True,
                            unit='pu',
                            )

        self.qmn = NumParam(default=-0.33, tex_name='q_{mn}',
                            info='Min. reactive power command',
                            power=True,
                            unit='pu',
                            )
        self.pmx = NumParam(default=999.0, info='maximum power limit',
                            tex_name='p_{mx}',
                            power=True,
                            unit='pu',
                            )

        self.v0 = NumParam(default=0.8, tex_name='v_0',
                           info='Lower limit of deadband for Vdroop response',
                           unit='pu', non_zero=True,
                           )
        self.v1 = NumParam(default=1.1, tex_name='v_1',
                           info='Upper limit of deadband for Vdroop response',
                           unit='pu', non_zero=True,
                           )

        self.dqdv = NumParam(default=-1.0, tex_name='dq/dv',
                             info='Q-V droop characteristics (negative)',
                             power=True, non_zero=True
                             )

        self.fdbd = NumParam(default=-0.017, tex_name='f_{dbd}',
                             info='frequency deviation deadband',
                             unit='Hz',
                             non_positive=True,
                             )

        # added on 11/14/2020: convert to system base pu
        self.ddn = NumParam(default=0.0, tex_name='D_{dn}',
                            info='Gain after f deadband',
                            unit='pu (MW)/Hz',
                            power=True,
                            non_negative=True,
                            )

        self.ialim = NumParam(default=1.3, tex_name='I_{alim}',
                              info='Apparent power limit',
                              current=True,
                              non_negative=True,
                              non_zero=True,
                              )

        self.vt0 = NumParam(default=0.88, tex_name='V_{t0}',
                            info='Voltage tripping response curve point 0',
                            unit='p.u.',
                            non_negative=True,
                            non_zero=True,
                            )

        self.vt1 = NumParam(default=0.90, tex_name='V_{t1}',
                            info='Voltage tripping response curve point 1',
                            unit='p.u.',
                            non_negative=True,
                            non_zero=True,
                            )

        self.vt2 = NumParam(default=1.1, tex_name='V_{t2}',
                            info='Voltage tripping response curve point 2',
                            unit='p.u.',
                            non_negative=True,
                            non_zero=True,
                            )

        self.vt3 = NumParam(default=1.2, tex_name='V_{t3}',
                            info='Voltage tripping response curve point 3',
                            unit='p.u.',
                            non_negative=True,
                            non_zero=True,
                            )

        self.vrflag = NumParam(default=0.0, tex_name='z_{VR}',
                               info='V-trip is latching (0) or self-resetting (0-1)',
                               )

        self.ft0 = NumParam(default=59.5, tex_name='f_{t0}',
                            info='Frequency tripping response curve point 0',
                            unit='Hz',
                            non_negative=True,
                            non_zero=True,
                            )

        self.ft1 = NumParam(default=59.7, tex_name='f_{t1}',
                            info='Frequency tripping response curve point 1',
                            unit='Hz',
                            non_negative=True,
                            non_zero=True,
                            )

        self.ft2 = NumParam(default=60.3, tex_name='f_{t2}',
                            info='Frequency tripping response curve point 2',
                            unit='Hz',
                            non_negative=True,
                            non_zero=True,
                            )

        self.ft3 = NumParam(default=60.5, tex_name='f_{t3}',
                            info='Frequency tripping response curve point 3',
                            unit='Hz',
                            non_negative=True,
                            non_zero=True,
                            )

        self.frflag = NumParam(default=0.0, tex_name='z_{FR}',
                               info='f-trip is latching (0) or self-resetting (0-1)',
                               )

        self.tip = NumParam(default=0.02, tex_name='T_{ip}',
                            info='Inverter active current lag time constant',
                            unit='s',
                            non_negative=True,
                            )

        self.tiq = NumParam(default=0.02, tex_name='T_{iq}',
                            info='Inverter reactive current lag time constant',
                            unit='s',
                            non_negative=True,
                            )

        self.gammap = NumParam(default=1.0, tex_name=r'\gamma_p',
                               info='Ratio of PVD1.pref0 w.r.t to that of static PV',
                               vrange='(0, 1]',
                               )

        self.gammaq = NumParam(default=1.0, tex_name=r'\gamma_q',
                               info='Ratio of PVD1.qref0 w.r.t to that of static PV',
                               vrange='(0, 1]',
                               )

        self.recflag = NumParam(default=1, tex_name=r'z_{rec}',
                                info='Enable flag for voltage and frequency recovery limiters',
                                vrange='(0, 1)',
                                )
Ejemplo n.º 25
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([])