Example #1
0
    def __init__(self, name='', gmr=0.01, r=0.01, x=0.0, max_current=1):
        """
        Wire definition
        :param name: Name of the wire type
        :param gmr: Geometric Mean Radius (m)
        :param r: Resistance per unit length (Ohm / km)
        :param x: Reactance per unit length (Ohm / km)
        :param max_current: Maximum current of the conductor in (kA)

        """

        EditableDevice.__init__(self,
                                name=name,
                                active=True,
                                device_type=DeviceType.WireDevice,
                                editable_headers={'name': GCProp('', str, "Name of the conductor"),
                                                  'r': GCProp('Ohm/km', float, "resistance of the conductor"),
                                                  'x': GCProp('Ohm/km', float, "reactance of the conductor"),
                                                  'gmr': GCProp('m', float, "Geometric Mean Radius of the conductor"),
                                                  'max_current': GCProp('kA', float, "Maximum current of the conductor")
                                                  },
                                non_editable_attributes=list(),
                                properties_with_profile={})

        # self.wire_name = name
        self.r = r
        self.x = x
        self.gmr = gmr
        self.max_current = max_current
Example #2
0
    def __init__(self,
                 name='shunt',
                 G=0.0,
                 B=0.0,
                 G_prof=None,
                 B_prof=None,
                 active=True,
                 mttf=0.0,
                 mttr=0.0):

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.ShuntDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Load name'),
                'bus':
                GCProp('', DeviceType.BusDevice, 'Connection bus name'),
                'active':
                GCProp('', bool, 'Is the load active?'),
                'G':
                GCProp(
                    'MW', float,
                    'Active power of the impedance component at V=1.0 p.u.'),
                'B':
                GCProp(
                    'MVAr', float,
                    'Reactive power of the impedance component at V=1.0 p.u.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure'),
                'mttr':
                GCProp('h', float, 'Mean time to recovery')
            },
            non_editable_attributes=list(),
            properties_with_profile={
                'active': 'active_prof',
                'G': 'G_prof',
                'B': 'B_prof'
            })

        # The bus this element is attached to: Not necessary for calculations
        self.bus = None

        self.active_prof = None

        self.mttf = mttf

        self.mttr = mttr

        # Impedance (MVA)
        self.G = G
        self.B = B

        # admittance profile
        self.G_prof = G_prof
        self.B_prof = B_prof
Example #3
0
    def __init__(self, name='Load', G=0.0, B=0.0, Ir=0.0, Ii=0.0, P=0.0, Q=0.0, cost=0.0,
                  G_prof=None, B_prof=None, Ir_prof=None, Ii_prof=None, P_prof=None, Q_prof=None,
                  active=True, mttf=0.0, mttr=0.0):

        EditableDevice.__init__(self,
                                name=name,
                                active=active,
                                device_type=DeviceType.LoadDevice,
                                editable_headers={'name': GCProp('', str, 'Load name'),
                                                   'bus': GCProp('', None, 'Connection bus name'),
                                                   'active': GCProp('', bool, 'Is the load active?'),
                                                   'P': GCProp('MW', float, 'Active power'),
                                                   'Q': GCProp('MVAr', float, 'Reactive power'),
                                                   'Ir': GCProp('MW', float,
                                                                'Active power of the current component at V=1.0 p.u.'),
                                                   'Ii': GCProp('MVAr', float,
                                                                'Reactive power of the current component at V=1.0 p.u.'),
                                                   'G': GCProp('MW', float,
                                                               'Active power of the impedance component at V=1.0 p.u.'),
                                                   'B': GCProp('MVAr', float,
                                                               'Reactive power of the impedance component at V=1.0 p.u.'),
                                                   'mttf': GCProp('h', float, 'Mean time to failure'),
                                                   'mttr': GCProp('h', float, 'Mean time to recovery'),
                                                   'Cost': GCProp('e/MWh', float,
                                                                  'Cost of not served energy. Used in OPF.')},
                                non_editable_attributes=list(),
                                properties_with_profile={'P': 'P_prof',
                                                         'Q': 'Q_prof',
                                                         'Ir': 'Ir_prof',
                                                         'Ii': 'Ii_prof',
                                                         'G': 'G_prof',
                                                         'B': 'B_prof',
                                                         'Cost': 'Cost_prof'})

        self.bus = None

        self.mttf = mttf

        self.mttr = mttr

        self.Cost = cost

        self.Cost_prof = None

        # Impedance in equivalent MVA
        self.G = G
        self.B = B
        self.Ir = Ir
        self.Ii = Ii
        self.P = P
        self.Q = Q
        self.G_prof = G_prof
        self.B_prof = B_prof
        self.Ir_prof = Ir_prof
        self.Ii_prof = Ii_prof
        self.P_prof = P_prof
        self.Q_prof = Q_prof
Example #4
0
    def __init__(self,
                 name='',
                 xpos=0,
                 ypos=0,
                 gmr=0.01,
                 r=0.01,
                 x=0.0,
                 max_current=1,
                 phase=0):
        """
        Wire definition
        :param name: Name of the wire type
        :param xpos: x position (m)
        :param ypos: y position (m)
        :param gmr: Geometric Mean Radius (m)
        :param r: Resistance per unit length (Ohm / km)
        :param x: Reactance per unit length (Ohm / km)
        :param max_current: Maximum current of the conductor in (kA)
        :param phase: 0->Neutral, 1->A, 2->B, 3->C
        """

        EditableDevice.__init__(
            self,
            name=name,
            active=True,
            device_type=DeviceType.WireDevice,
            editable_headers={
                'wire_name':
                GCProp('', str, "Name of the conductor"),
                'r':
                GCProp('Ohm/km', float, "resistance of the conductor"),
                'x':
                GCProp('Ohm/km', float, "reactance of the conductor"),
                'gmr':
                GCProp('m', float, "Geometric Mean Radius of the conductor"),
                'max_current':
                GCProp('kA', float, "Maximum current of the conductor"),
                'xpos':
                GCProp('m', float, "Conductor x position within the tower"),
                'ypos':
                GCProp('m', float, "Conductor y position within the tower"),
                'phase':
                GCProp('', int, "Phase of the conductor (0, 1, 2)")
            },
            non_editable_attributes=list(),
            properties_with_profile={})

        self.wire_name = name
        self.xpos = xpos
        self.ypos = ypos
        self.r = r
        self.x = x
        self.gmr = gmr
        self.max_current = max_current
        self.phase = phase
Example #5
0
    def __init__(self, name='UndergroundLine', rating=1, R=0, X=0, G=0, B=0, R0=0, X0=0, G0=0, B0=0):
        """
        Constructor
        :param name: name of the device
        :param rating: rating in kA
        :param R: Resistance of positive sequence in Ohm/km
        :param X: Reactance of positive sequence in Ohm/km
        :param G: Conductance of positive sequence in Ohm/km
        :param B: Susceptance of positive sequence in Ohm/km
        :param R0: Resistance of zero sequence in Ohm/km
        :param X0: Reactance of zero sequence in Ohm/km
        :param G0: Conductance of zero sequence in Ohm/km
        :param B0: Susceptance of zero sequence in Ohm/km
        :param tpe:
        """
        EditableDevice.__init__(self,
                                name=name,
                                active=True,
                                device_type=DeviceType.UnderGroundLineDevice,
                                editable_headers={'name': GCProp('', str, "Name of the line template"),
                                                  'rating': GCProp('kA', float, "Current rating of the cable"),
                                                  'R': GCProp('Ohm/km', float, "Positive-sequence "
                                                                               "resistance per km"),
                                                  'X': GCProp('Ohm/km', float, "Positive-sequence "
                                                                               "reactance per km"),
                                                  'G': GCProp('S/km', float, "Positive-sequence "
                                                                             "shunt conductance per km"),
                                                  'B': GCProp('S/km', float, "Positive-sequence "
                                                                             "shunt susceptance per km"),
                                                  'R0': GCProp('Ohm/km', float, "Zero-sequence "
                                                                                "resistance per km"),
                                                  'X0': GCProp('Ohm/km', float, "Zero-sequence "
                                                                                "reactance per km"),
                                                  'G0': GCProp('S/km', float, "Zero-sequence "
                                                                              "shunt conductance per km"),
                                                  'B0': GCProp('S/km', float, "Zero-sequence "
                                                                              "shunt susceptance per km")},
                                non_editable_attributes=list(),
                                properties_with_profile={})

        self.tpe = BranchType.Line

        self.rating = rating

        # impedances and admittances per unit of length
        self.R = R
        self.X = X
        self.G = G
        self.B = B

        self.R0 = R0
        self.X0 = X0
        self.G0 = G0
        self.B0 = B0
Example #6
0
    def __init__(self,
                 name='StaticGen',
                 P=0.0,
                 Q=0.0,
                 P_prof=None,
                 Q_prof=None,
                 active=True,
                 mttf=0.0,
                 mttr=0.0):

        EditableDevice.__init__(self,
                                name=name,
                                active=active,
                                device_type=DeviceType.StaticGeneratorDevice,
                                editable_headers={
                                    'name':
                                    GCProp('', str, ''),
                                    'bus':
                                    GCProp('', DeviceType.BusDevice, ''),
                                    'active':
                                    GCProp('', bool, ''),
                                    'P':
                                    GCProp('MW', float, 'Active power'),
                                    'Q':
                                    GCProp('MVAr', float, 'Reactive power'),
                                    'mttf':
                                    GCProp('h', float, 'Mean time to failure'),
                                    'mttr':
                                    GCProp('h', float, 'Mean time to recovery')
                                },
                                non_editable_attributes=list(),
                                properties_with_profile={
                                    'active': 'active_prof',
                                    'P': 'P_prof',
                                    'Q': 'Q_prof'
                                })

        self.bus = None

        self.active_prof = None

        self.mttf = mttf

        self.mttr = mttr

        # Power (MW + jMVAr)
        self.P = P
        self.Q = Q

        # power profile for this load
        self.P_prof = P_prof
        self.Q_prof = Q_prof
Example #7
0
    def __init__(self,
                 name="Bus",
                 vnom=10,
                 vmin=0.9,
                 vmax=1.1,
                 r_fault=0.0,
                 x_fault=0.0,
                 xpos=0,
                 ypos=0,
                 height=0,
                 width=0,
                 active=True,
                 is_slack=False,
                 area='Default',
                 zone='Default',
                 substation='Default',
                 longitude=0.0,
                 latitude=0.0):

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.BusDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the bus'),
                'active':
                GCProp('', bool,
                       'Is the bus active? used to disable the bus.'),
                'is_slack':
                GCProp('', bool, 'Force the bus to be of slack type.'),
                'Vnom':
                GCProp('kV', float, 'Nominal line voltage of the bus.'),
                'Vmin':
                GCProp('p.u.', float, 'Lower range of allowed voltage.'),
                'Vmax':
                GCProp('p.u.', float, 'Higher range of allowed range.'),
                'r_fault':
                GCProp(
                    'p.u.', float, 'Resistance of the fault.\n'
                    'This is used for short circuit studies.'),
                'x_fault':
                GCProp(
                    'p.u.', float, 'Reactance of the fault.\n'
                    'This is used for short circuit studies.'),
                'x':
                GCProp('px', float, 'x position in pixels.'),
                'y':
                GCProp('px', float, 'y position in pixels.'),
                'h':
                GCProp('px', float, 'height of the bus in pixels.'),
                'w':
                GCProp('px', float, 'Width of the bus in pixels.'),
                'area':
                GCProp('', str, 'Area of the bus'),
                'zone':
                GCProp('', str, 'Zone of the bus'),
                'substation':
                GCProp('', str, 'Substation of the bus.'),
                'longitude':
                GCProp('deg', float, 'longitude of the bus.'),
                'latitude':
                GCProp('deg', float, 'latitude of the bus.')
            },
            non_editable_attributes=list(),
            properties_with_profile={'active': 'active_prof'})

        # Nominal voltage (kV)
        self.Vnom = vnom

        # minimum voltage limit
        self.Vmin = vmin

        # maximum voltage limit
        self.Vmax = vmax

        # summation of lower reactive power limits connected
        self.Qmin_sum = 0

        # summation of upper reactive power limits connected
        self.Qmax_sum = 0

        # short circuit impedance
        self.r_fault = r_fault
        self.x_fault = x_fault

        # is the bus active?
        self.active = active

        self.active_prof = None

        self.area = area

        self.zone = zone

        self.substation = substation

        # List of load s attached to this bus
        self.loads = list()

        # List of Controlled generators attached to this bus
        self.controlled_generators = list()

        # List of shunt s attached to this bus
        self.shunts = list()

        # List of batteries attached to this bus
        self.batteries = list()

        # List of static generators attached tot this bus
        self.static_generators = list()

        # List of measurements
        self.measurements = list()

        # Bus type
        self.type = BusMode.NONE

        # Flag to determine if the bus is a slack bus or not
        self.is_slack = is_slack

        # if true, the presence of storage devices turn the bus into a Reference bus in practice
        # So that P +jQ are computed
        self.dispatch_storage = False

        # position and dimensions
        self.x = xpos
        self.y = ypos
        self.h = height
        self.w = width
        self.longitude = longitude
        self.latitude = latitude
Example #8
0
    def __init__(self,
                 name='gen',
                 active_power=0.0,
                 power_factor=0.8,
                 voltage_module=1.0,
                 is_controlled=True,
                 Qmin=-9999,
                 Qmax=9999,
                 Snom=9999,
                 power_prof=None,
                 power_factor_prof=None,
                 vset_prof=None,
                 Cost_prof=None,
                 active=True,
                 p_min=0.0,
                 p_max=9999.0,
                 op_cost=1.0,
                 Sbase=100,
                 enabled_dispatch=True,
                 mttf=0.0,
                 mttr=0.0,
                 technology: GeneratorTechnologyType = GeneratorTechnologyType.
                 CombinedCycle):

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.GeneratorDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the generator'),
                'bus':
                GCProp('', DeviceType.BusDevice, 'Connection bus name'),
                'active':
                GCProp('', bool, 'Is the generator active?'),
                'is_controlled':
                GCProp('', bool, 'Is this generator voltage-controlled?'),
                'P':
                GCProp('MW', float, 'Active power'),
                'Pf':
                GCProp(
                    '', float, 'Power factor (cos(fi)). '
                    'This is used for non-controlled generators.'),
                'Vset':
                GCProp(
                    'p.u.', float, 'Set voltage. '
                    'This is used for controlled generators.'),
                'Snom':
                GCProp('MVA', float, 'Nomnial power.'),
                'Qmin':
                GCProp('MVAr', float, 'Minimum reactive power.'),
                'Qmax':
                GCProp('MVAr', float, 'Maximum reactive power.'),
                'Pmin':
                GCProp('MW', float, 'Minimum active power. Used in OPF.'),
                'Pmax':
                GCProp('MW', float, 'Maximum active power. Used in OPF.'),
                'Cost':
                GCProp('e/MWh', float,
                       'Generation unitary cost. Used in OPF.'),
                'enabled_dispatch':
                GCProp('', bool, 'Enabled for dispatch? Used in OPF.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure'),
                'mttr':
                GCProp('h', float, 'Mean time to recovery'),
                'technology':
                GCProp('', GeneratorTechnologyType, 'Generator technology')
            },
            non_editable_attributes=list(),
            properties_with_profile={
                'active': 'active_prof',
                'P': 'P_prof',
                'Pf': 'Pf_prof',
                'Vset': 'Vset_prof',
                'Cost': 'Cost_prof'
            })

        self.bus = None

        self.active_prof = None

        self.mttf = mttf

        self.mttr = mttr

        self.technology = technology

        # is the device active active power dispatch?
        self.enabled_dispatch = enabled_dispatch

        # Power (MVA)
        self.P = active_power

        # Power factor
        self.Pf = power_factor

        # voltage set profile for this load in p.u.
        self.Pf_prof = power_factor_prof

        # If this generator is voltage controlled it produces a PV node, otherwise the node remains as PQ
        self.is_controlled = is_controlled

        # Nominal power in MVA (also the machine base)
        self.Snom = Snom

        # Minimum dispatched power in MW
        self.Pmin = p_min

        # Maximum dispatched power in MW
        self.Pmax = p_max

        # power profile for this load in MW
        self.P_prof = power_prof

        # Voltage module set point (p.u.)
        self.Vset = voltage_module

        # voltage set profile for this load in p.u.
        self.Vset_prof = vset_prof

        # minimum reactive power in MVAr
        self.Qmin = Qmin

        # Maximum reactive power in MVAr
        self.Qmax = Qmax

        # Cost of operation €/MW
        self.Cost = op_cost

        self.Cost_prof = Cost_prof

        # Dynamic vars
        # self.Ra = Ra
        # self.Xa = Xa
        # self.Xd = Xd
        # self.Xq = Xq
        # self.Xdp = Xdp
        # self.Xqp = Xqp
        # self.Xdpp = Xdpp
        # self.Xqpp = Xqpp
        # self.Td0p = Td0p
        # self.Tq0p = Tq0p
        # self.Td0pp = Td0pp
        # self.Tq0pp = Tq0pp
        # self.H = H
        # self.speed_volt = speed_volt
        # self.base_mva = base_mva  # machine base MVA

        # system base power MVA
        self.Sbase = Sbase
Example #9
0
    def __init__(self,
                 parent=None,
                 edit_callback=None,
                 name='Tower',
                 tpe=BranchType.Branch):
        """

        :param parent:
        :param edit_callback:
        :param name:
        :param tpe:
        """
        EditableDevice.__init__(
            self,
            name=name,
            active=True,
            device_type=DeviceType.TowerDevice,
            editable_headers={
                'tower_name':
                GCProp('', str, "Tower name"),
                'earth_resistivity':
                GCProp('Ohm/m3', float, "Earth resistivity"),
                'frequency':
                GCProp('Hz', float, "Frequency"),
                'R1':
                GCProp('Ohm/km', float, "Positive sequence resistance"),
                'X1':
                GCProp('Ohm/km', float, "Positive sequence reactance"),
                'Gsh1':
                GCProp('S/km', float, "Positive sequence shunt conductance"),
                'Bsh1':
                GCProp('S/km', float, "Positive sequence shunt susceptance"),
                'R0':
                GCProp('Ohm/km', float, "Zero-sequence resistance"),
                'X0':
                GCProp('Ohm/km', float, "Zero sequence reactance"),
                'Gsh0':
                GCProp('S/km', float, "Zero sequence shunt conductance"),
                'Bsh0':
                GCProp('S/km', float, "Zero sequence shunt susceptance"),
                'rating':
                GCProp('kA', float, "Current rating of the tower")
            },
            non_editable_attributes=['tower_name'],
            properties_with_profile={})

        self.tpe = tpe

        # list of wires in the tower
        self.wires = list()

        # properties
        self.tower_name = name
        self.earth_resistivity = 100
        self.frequency = 50

        # total series impedance (positive sequence)
        self.R1 = 0.0
        self.X1 = 0.0

        # total shunt admittance (positive sequence)
        self.Gsh1 = 0.0
        self.Bsh1 = 0.0

        # total series impedance (positive sequence)
        self.R0 = 0.0
        self.X0 = 0.0

        # total shunt admittance (positive sequence)
        self.Gsh0 = 0.0
        self.Bsh0 = 0.0

        # current rating of the tower in kA
        self.rating = 0.0

        # impedances
        self.z_abcn = None
        self.z_phases_abcn = None
        self.z_abc = None
        self.z_phases_abc = None
        self.z_seq = None

        self.y_abcn = None
        self.y_phases_abcn = None
        self.y_abc = None
        self.y_phases_abc = None
        self.y_seq = None

        # wire properties for edition (do not confuse with the properties of this very object...)
        self.header = [
            'Wire', 'X (m)', 'Y (m)', 'Phase', 'Ri (Ohm/km)', 'Xi (Ohm/km)',
            'GMR (m)'
        ]
        self.index_prop = {
            0: 'wire_name',
            1: 'xpos',
            2: 'ypos',
            3: 'phase',
            4: 'r',
            5: 'x',
            6: 'gmr'
        }
        self.converter = {
            0: str,
            1: float,
            2: float,
            3: int,
            4: float,
            5: float,
            6: float
        }
        self.editable_wire = [False, True, True, True, True, True, True]
Example #10
0
    def __init__(self,
                 hv_nominal_voltage=0,
                 lv_nominal_voltage=0,
                 nominal_power=0.001,
                 copper_losses=0,
                 iron_losses=0,
                 no_load_current=0,
                 short_circuit_voltage=0,
                 gr_hv1=0.5,
                 gx_hv1=0.5,
                 name='TransformerType',
                 tpe=BranchType.Transformer):
        """

        :param hv_nominal_voltage:
        :param lv_nominal_voltage:
        :param nominal_power:
        :param copper_losses:
        :param iron_losses:
        :param no_load_current:
        :param short_circuit_voltage:
        :param gr_hv1:
        :param gx_hv1:
        :param name:
        :param tpe:
        """
        EditableDevice.__init__(
            self,
            name=name,
            active=True,
            device_type=DeviceType.TransformerTypeDevice,
            editable_headers={
                'name':
                GCProp('', str, "Name of the transformer type"),
                'HV':
                GCProp('kV', float,
                       "Nominal voltage al the high voltage side"),
                'LV':
                GCProp('kV', float, "Nominal voltage al the low voltage side"),
                'rating':
                GCProp('MVA', float, "Nominal power"),
                'Pcu':
                GCProp('kW', float, "Copper losses"),
                'Pfe':
                GCProp('kW', float, "Iron losses"),
                'I0':
                GCProp('%', float, "No-load current"),
                'Vsc':
                GCProp('%', float, "Short-circuit voltage")
            },
            non_editable_attributes=list(),
            properties_with_profile={})

        self.tpe = tpe

        self.HV = hv_nominal_voltage

        self.LV = lv_nominal_voltage

        self.rating = nominal_power

        self.Pcu = copper_losses

        self.Pfe = iron_losses

        self.I0 = no_load_current

        self.Vsc = short_circuit_voltage

        self.GR_hv1 = gr_hv1

        self.GX_hv1 = gx_hv1
Example #11
0
    def __init__(self,
                 bus_from: Bus = None,
                 bus_to: Bus = None,
                 name='DC Line',
                 r=1e-20,
                 rate=1.0,
                 active=True,
                 tolerance=0,
                 cost=0.0,
                 mttf=0,
                 mttr=0,
                 r_fault=0.0,
                 fault_pos=0.5,
                 branch_type: BranchType = BranchType.DCLine,
                 length=1,
                 vset=1.0,
                 temp_base=20,
                 temp_oper=20,
                 alpha=0.00330):

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.BranchDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the branch.'),
                'bus_from':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "from" side of the branch.'),
                'bus_to':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "to" side of the branch.'),
                'active':
                GCProp('', bool, 'Is the branch active?'),
                'rate':
                GCProp('MVA', float, 'Thermal rating power of the branch.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure, '
                       'used in reliability studies.'),
                'mttr':
                GCProp(
                    'h', float, 'Mean time to recovery, '
                    'used in reliability studies.'),
                'R':
                GCProp('p.u.', float, 'Total resistance.'),
                'tolerance':
                GCProp(
                    '%', float, 'Tolerance expected for the impedance values\n'
                    '7% is expected for transformers\n'
                    '0% for lines.'),
                'length':
                GCProp('km', float, 'Length of the branch '
                       '(not used for calculation)'),
                'vset':
                GCProp(
                    'p.u.', float, 'Objective voltage at the "to" side of '
                    'the bus when regulating the tap.'),
                'temp_base':
                GCProp('ºC', float, 'Base temperature at which R was '
                       'measured.'),
                'temp_oper':
                GCProp('ºC', float, 'Operation temperature to modify R.'),
                'alpha':
                GCProp(
                    '1/ºC', float, 'Thermal coefficient to modify R,\n'
                    'around a reference temperature\n'
                    'using a linear approximation.\n'
                    'For example:\n'
                    'Copper @ 20ºC: 0.004041,\n'
                    'Copper @ 75ºC: 0.00323,\n'
                    'Annealed copper @ 20ºC: 0.00393,\n'
                    'Aluminum @ 20ºC: 0.004308,\n'
                    'Aluminum @ 75ºC: 0.00330'),
                'Cost':
                GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'),
                'branch_type':
                GCProp('', BranchType, '')
            },
            non_editable_attributes=['bus_from', 'bus_to', 'template'],
            properties_with_profile={
                'active': 'active_prof',
                'rate': 'rate_prof',
                'temp_oper': 'temp_oper_prof',
                'Cost': 'Cost_prof'
            })

        # connectivity
        self.bus_from = bus_from
        self.bus_to = bus_to

        # List of measurements
        self.measurements = list()

        # line length in km
        self.length = length

        # branch impedance tolerance
        self.tolerance = tolerance

        # short circuit impedance
        self.r_fault = r_fault
        self.fault_pos = fault_pos

        # total impedance and admittance in p.u.
        self.R = r

        self.mttf = mttf

        self.mttr = mttr

        self.Cost = cost

        self.Cost_prof = None

        self.active_prof = None

        # Conductor base and operating temperatures in ºC
        self.temp_base = temp_base
        self.temp_oper = temp_oper

        self.temp_oper_prof = None

        # Conductor thermal constant (1/ºC)
        self.alpha = alpha

        # branch rating in MVA
        self.rate = rate

        self.rate_prof = None

        # branch type: Line, Transformer, etc...
        self.branch_type = branch_type

        # type template
        self.vset = vset

        # converter for enumerations
        self.conv = {
            'branch': BranchType.Branch,
            'line': BranchType.Line,
            'transformer': BranchType.Transformer,
            'switch': BranchType.Switch,
            'reactance': BranchType.Reactance
        }

        self.inv_conv = {val: key for key, val in self.conv.items()}
Example #12
0
    def __init__(
            self,
            bus_from: Bus = None,
            bus_to: Bus = None,
            name='Branch',
            r=1e-20,
            x=1e-20,
            g=1e-20,
            b=1e-20,
            rate=1.0,
            tap=1.0,
            shift_angle=0,
            active=True,
            tolerance=0,
            cost=0.0,
            mttf=0,
            mttr=0,
            r_fault=0.0,
            x_fault=0.0,
            fault_pos=0.5,
            branch_type: BranchType = BranchType.Line,
            length=1,
            vset=1.0,
            temp_base=20,
            temp_oper=20,
            alpha=0.00330,
            bus_to_regulated=False,
            template=BranchTemplate(),
    ):

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.BranchDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the branch.'),
                'bus_from':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "from" side of the branch.'),
                'bus_to':
                GCProp('', DeviceType.BusDevice, 'Name of the bus at the "to" '
                       'side of the branch.'),
                'active':
                GCProp('', bool, 'Is the branch active?'),
                'rate':
                GCProp('MVA', float, 'Thermal rating power of the branch.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure, '
                       'used in reliability studies.'),
                'mttr':
                GCProp(
                    'h', float, 'Mean time to recovery, '
                    'used in reliability studies.'),
                'R':
                GCProp('p.u.', float, 'Total resistance.'),
                'X':
                GCProp('p.u.', float, 'Total reactance.'),
                'G':
                GCProp('p.u.', float, 'Total shunt conductance.'),
                'B':
                GCProp('p.u.', float, 'Total shunt susceptance.'),
                'tolerance':
                GCProp(
                    '%', float, 'Tolerance expected for the impedance values\n'
                    '7% is expected for transformers\n'
                    '0% for lines.'),
                'length':
                GCProp('km', float, 'Length of the branch '
                       '(not used for calculation)'),
                'tap_module':
                GCProp('', float, 'Tap changer module, '
                       'it a value close to 1.0'),
                'angle':
                GCProp('rad', float, 'Angle shift of the tap changer.'),
                'bus_to_regulated':
                GCProp('', bool, 'Is the bus tap regulated?'),
                'vset':
                GCProp(
                    'p.u.', float, 'Objective voltage at the "to" side of '
                    'the bus when regulating the tap.'),
                'temp_base':
                GCProp('ºC', float, 'Base temperature at which R was '
                       'measured.'),
                'temp_oper':
                GCProp('ºC', float, 'Operation temperature to modify R.'),
                'alpha':
                GCProp(
                    '1/ºC', float, 'Thermal coefficient to modify R,\n'
                    'around a reference temperature\n'
                    'using a linear approximation.\n'
                    'For example:\n'
                    'Copper @ 20ºC: 0.004041,\n'
                    'Copper @ 75ºC: 0.00323,\n'
                    'Annealed copper @ 20ºC: 0.00393,\n'
                    'Aluminum @ 20ºC: 0.004308,\n'
                    'Aluminum @ 75ºC: 0.00330'),
                'Cost':
                GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'),
                'r_fault':
                GCProp(
                    'p.u.', float, 'Resistance of the mid-line fault.\n'
                    'Used in short circuit studies.'),
                'x_fault':
                GCProp(
                    'p.u.', float, 'Reactance of the mid-line fault.\n'
                    'Used in short circuit studies.'),
                'fault_pos':
                GCProp(
                    'p.u.', float, 'Per-unit positioning of the fault:\n'
                    '0 would be at the "from" side,\n'
                    '1 would be at the "to" side,\n'
                    'therefore 0.5 is at the middle.'),
                'branch_type':
                GCProp('', BranchType, ''),
                'template':
                GCProp('', BranchTemplate, '')
            },
            non_editable_attributes=['bus_from', 'bus_to', 'template'],
            properties_with_profile={
                'active': 'active_prof',
                'temp_oper': 'temp_oper_prof',
                'Cost': 'Cost_prof'
            })

        # connectivity
        self.bus_from = bus_from
        self.bus_to = bus_to

        # List of measurements
        self.measurements = list()

        # line length in km
        self.length = length

        # branch impedance tolerance
        self.tolerance = tolerance

        # short circuit impedance
        self.r_fault = r_fault
        self.x_fault = x_fault
        self.fault_pos = fault_pos

        # total impedance and admittance in p.u.
        self.R = r
        self.X = x
        self.G = g
        self.B = b

        self.mttf = mttf

        self.mttr = mttr

        self.Cost = cost

        self.Cost_prof = None

        self.active_prof = None

        # Conductor base and operating temperatures in ºC
        self.temp_base = temp_base
        self.temp_oper = temp_oper

        self.temp_oper_prof = None

        # Conductor thermal constant (1/ºC)
        self.alpha = alpha

        # tap changer object
        self.tap_changer = TapChanger()

        # Tap module
        if tap != 0:
            self.tap_module = tap
            self.tap_changer.set_tap(self.tap_module)
        else:
            self.tap_module = self.tap_changer.get_tap()

        # Tap angle
        self.angle = shift_angle

        # branch rating in MVA
        self.rate = rate

        # branch type: Line, Transformer, etc...
        self.branch_type = branch_type

        # type template
        self.template = template
        self.bus_to_regulated = bus_to_regulated
        self.vset = vset

        # self.non_editable_indices = [1, 2, 19]

        # converter for enumerations
        self.conv = {
            'branch': BranchType.Branch,
            'line': BranchType.Line,
            'transformer': BranchType.Transformer,
            'switch': BranchType.Switch,
            'reactance': BranchType.Reactance
        }

        self.inv_conv = {val: key for key, val in self.conv.items()}
Example #13
0
    def __init__(self,
                 bus_from: Bus = None,
                 bus_to: Bus = None,
                 name='DC Line',
                 active=True,
                 r1=0.0001,
                 rate=1e-9,
                 mttf=0,
                 mttr=0):
        """
        Voltage source converter (VSC)
        :param bus_from:
        :param bus_to:
        :param name:
        :param active:
        :param r1:
        :param rate:
        """

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.DCBranchDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the branch.'),
                'bus_from':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "from" side of the branch.'),
                'bus_to':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "to" side of the branch.'),
                'active':
                GCProp('', bool, 'Is the branch active?'),
                'rate':
                GCProp('MVA', float, 'Thermal rating power of the branch.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure, '
                       'used in reliability studies.'),
                'mttr':
                GCProp(
                    'h', float, 'Mean time to recovery, '
                    'used in reliability studies.'),
                'Rrd':
                GCProp('p.u.', float, 'DC Resistance.'),
            },
            non_editable_attributes=['bus_from', 'bus_to'],
            properties_with_profile={
                'active': 'active_prof',
                'rate': 'rate_prof'
            })

        # connectivity
        self.bus_from = bus_from
        self.bus_to = bus_to

        # List of measurements
        self.measurements = list()

        # total impedance and admittance in p.u.
        self.Rdc = r1

        self.mttf = mttf
        self.mttr = mttr

        self.active = active
        self.active_prof = None

        # branch rating in MVA
        self.rate = rate
        self.rate_prof = None

        # branch type: Line, Transformer, etc...
        self.branch_type = BranchType.DCLine
Example #14
0
    def __init__(self,
                 bus_from: Bus = None,
                 bus_to: Bus = None,
                 name='VSC',
                 active=True,
                 r1=0.0001,
                 x1=0.05,
                 m=0.8,
                 theta=0.1,
                 G0=1e-5,
                 Beq=0.001,
                 rate=1e-9,
                 mttf=0,
                 mttr=0):
        """
        Voltage source converter (VSC)
        :param bus_from:
        :param bus_to:
        :param name:
        :param active:
        :param r1:
        :param x1:
        :param m:
        :param theta:
        :param G0:
        :param Beq:
        :param rate:
        """

        EditableDevice.__init__(
            self,
            name=name,
            active=active,
            device_type=DeviceType.VscDevice,
            editable_headers={
                'name':
                GCProp('', str, 'Name of the branch.'),
                'bus_from':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "from" side of the branch.'),
                'bus_to':
                GCProp('', DeviceType.BusDevice,
                       'Name of the bus at the "to" side of the branch.'),
                'active':
                GCProp('', bool, 'Is the branch active?'),
                'rate':
                GCProp('MVA', float, 'Thermal rating power of the branch.'),
                'mttf':
                GCProp('h', float, 'Mean time to failure, '
                       'used in reliability studies.'),
                'mttr':
                GCProp(
                    'h', float, 'Mean time to recovery, '
                    'used in reliability studies.'),
                'R1':
                GCProp('p.u.', float, 'Resistive losses.'),
                'X1':
                GCProp('p.u.', float, 'Magnetic losses.'),
                'Gsw':
                GCProp('p.u.', float, 'Inverter losses.'),
                'Beq':
                GCProp('p.u.', float, 'Total shunt susceptance.'),
                'm':
                GCProp('', float,
                       'Tap changer module, it a value close to 1.0'),
                'theta':
                GCProp('rad', float, 'Converter firing angle.'),
            },
            non_editable_attributes=['bus_from', 'bus_to'],
            properties_with_profile={
                'active': 'active_prof',
                'rate': 'rate_prof'
            })

        # the VSC must only connect from an AC to a DC bus
        assert (bus_from.is_dc != bus_to.is_dc)

        # connectivity:
        # for the later primitives to make sense, the "bus from" must be AC and the "bus to" must be DC
        if bus_to.is_dc:
            self.bus_from = bus_from
            self.bus_to = bus_to
        else:
            self.bus_from = bus_to
            self.bus_to = bus_from
            print('Corrected the connection direction of the VSC device:',
                  self.name)

        # List of measurements
        self.measurements = list()

        # total impedance and admittance in p.u.
        self.R1 = r1
        self.X1 = x1
        self.G0 = G0
        self.Beq = Beq
        self.m = m
        self.theta = theta

        self.mttf = mttf
        self.mttr = mttr

        self.active = active
        self.active_prof = None

        # branch rating in MVA
        self.rate = rate
        self.rate_prof = None

        # branch type: Line, Transformer, etc...
        self.branch_type = BranchType.VSC