def __init__(self, name='', code='', idtag=None, id_technology_category=None): """ :param name: :param idtag: :param code: :param id_technology_category: """ EditableDevice.__init__( self, name=name, code=code, idtag=idtag, active=True, device_type=DeviceType.Technology, editable_headers={ 'name': GCProp('', str, 'Name of the bus'), 'idtag': GCProp('', str, 'Unique ID'), 'code': GCProp('deg', str, 'Code.'), 'id_technology_category': GCProp('deg', TechnologyCategory, 'Technology category where this technology belongs') }, non_editable_attributes=['idtag'], properties_with_profile={}) self.id_technology_category = id_technology_category
def __init__(self, name='', code='', idtag=None): """ :param name: :param idtag: :param code: """ EditableDevice.__init__(self, name=name, code=code, idtag=idtag, active=True, device_type=DeviceType.Technology, editable_headers={ 'name': GCProp('', str, 'Name of the bus'), 'idtag': GCProp('', str, 'Unique ID'), 'longitude': GCProp('deg', float, 'longitude of the bus.'), 'latitude': GCProp('deg', float, 'latitude of the bus.') }, non_editable_attributes=['idtag'], properties_with_profile={})
def __init__(self, name='StaticGen', idtag=None, code='', 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, idtag=idtag, code=code, active=active, device_type=DeviceType.StaticGeneratorDevice, editable_headers={ 'name': GCProp('', str, ''), 'idtag': GCProp('', str, 'Unique ID', False), 'code': GCProp('', str, 'Secondary ID'), '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=['bus', 'idtag'], 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
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, idtag=None): """ :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, idtag=idtag, active=True, device_type=DeviceType.TransformerTypeDevice, editable_headers={'name': GCProp('', str, "Name of the transformer type"), 'idtag': GCProp('', str, 'Unique ID'), '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
def __init__(self, name='External grid', idtag=None, active=True, Vm=1.0, Va=0.0, Vm_prof=None, Va_prof=None, mttf=0.0, mttr=0.0): EditableDevice.__init__(self, name=name, idtag=idtag, active=active, device_type=DeviceType.ExternalGridDevice, editable_headers={ 'name': GCProp('', str, 'Load name'), 'idtag': GCProp('', str, 'Unique ID'), 'bus': GCProp('', DeviceType.BusDevice, 'Connection bus name'), 'active': GCProp('', bool, 'Is the load active?'), 'Vm': GCProp('p.u.', float, 'Active power'), 'Va': GCProp('radians', float, 'Reactive power'), 'mttf': GCProp('h', float, 'Mean time to failure'), 'mttr': GCProp('h', float, 'Mean time to recovery'), }, non_editable_attributes=['bus', 'idtag'], properties_with_profile={ 'active': 'active_prof', 'Vm': 'Vm_prof', 'Va': 'Va_prof' }) self.bus = None self.active_prof = None self.mttf = mttf self.mttr = mttr # Impedance in equivalent MVA self.Vm = Vm self.Va = Va self.Vm_prof = Vm_prof self.Va_prof = Va_prof
def __init__(self, name='', code='', idtag=None, device_type=DeviceType.GenericArea, latitude=0.0, longitude=0.0): """ :param name: :param idtag: :param device_type: :param latitude: :param longitude: """ EditableDevice.__init__(self, name=name, idtag=idtag, active=True, device_type=device_type, editable_headers={ 'name': GCProp('', str, 'Name of the bus'), 'idtag': GCProp('', str, 'Unique ID'), 'longitude': GCProp('deg', float, 'longitude of the bus.'), 'latitude': GCProp('deg', float, 'latitude of the bus.') }, non_editable_attributes=['idtag'], properties_with_profile={}) self.code = code self.latitude = latitude self.longitude = longitude
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='Switch', idtag=None, code='', r=1e-20, x=1e-20, rate=1.0, active=True, active_prof=None): EditableDevice.__init__(self, name=name, idtag=idtag, active=active, device_type=DeviceType.SwitchDevice, code=code, editable_headers={'name': GCProp('', str, 'Name of the line.'), 'idtag': GCProp('', str, 'Unique ID'), 'code': GCProp('', str, 'Secondary ID'), 'bus_from': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "from" side of the line.'), 'bus_to': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "to" side of the line.'), 'active': GCProp('', bool, 'Is the line active?'), 'rate': GCProp('MVA', float, 'Thermal rating power of the line.'), 'R': GCProp('p.u.', float, 'Total resistance.'), 'X': GCProp('p.u.', float, 'Total reactance.') }, non_editable_attributes=['bus_from', 'bus_to', 'idtag'], properties_with_profile={'active': 'active_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.R = r self.X = x self.active_prof = active_prof # line rating in MVA self.rate = rate # line type: Line, Transformer, etc... self.branch_type = BranchType.Switch
def __init__(self, name='', idtag=None, 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, idtag=idtag, active=True, device_type=DeviceType.WireDevice, editable_headers={ 'name': GCProp('', str, "Name of the conductor"), 'idtag': GCProp('', str, 'Unique ID'), '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
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='UPFC', code='', idtag=None, active=True, rs=0.0, xs=0.00001, rl=0.0, xl=0.0, bl=0.0, rp=0.0, xp=0.0, vp=1.0, Pset=0.0, Qset=0.0, rate=9999, mttf=0, mttr=0, cost=100, cost_prof=None, rate_prof=None, active_prof=None, contingency_factor=1.0, contingency_enabled=True, monitor_loading=True): """ Unified Power Flow Converter (UPFC) :param bus_from: :param bus_to: :param name: :param idtag: :param active: :param rs: series resistance (p.u.) :param xs: series reactance (p.u.) :param rl: line resistance (p.u.) :param xl: line reactance (p.u.) :param bl: line shunt susceptance (p.u.) :param rp: shunt resistance (p.u.) :param xp: shunt reactance (p.u.) :param vp: shunt voltage set point (p.u.) :param rate: Power rating (MVA) :param Pset: Power set point (MW) :param mttf: :param mttr: :param cost: :param cost_prof: :param rate_prof: :param active_prof: """ EditableDevice.__init__( self, name=name, idtag=idtag, active=active, code=code, device_type=DeviceType.UpfcDevice, editable_headers={ 'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), 'code': GCProp('', str, 'Secondary ID'), '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.'), 'contingency_factor': GCProp('p.u.', float, 'Rating multiplier for contingencies.'), 'contingency_enabled': GCProp('', bool, 'Consider this UPFC for contingencies.'), 'monitor_loading': GCProp( '', bool, 'Monitor this device loading for optimization, NTC or contingency studies.' ), 'mttf': GCProp('h', float, 'Mean time to failure, ' 'used in reliability studies.'), 'mttr': GCProp( 'h', float, 'Mean time to recovery, ' 'used in reliability studies.'), 'Rl': GCProp('p.u.', float, 'Line resistance.'), 'Xl': GCProp('p.u.', float, 'Line reactance.'), 'Bl': GCProp('p.u.', float, 'Line susceptance.'), 'Rs': GCProp('p.u.', float, 'Series resistance.'), 'Xs': GCProp('p.u.', float, 'Series reactance.'), 'Rsh': GCProp('p.u.', float, 'Shunt resistance.'), 'Xsh': GCProp('p.u.', float, 'Shunt resistance.'), 'Vsh': GCProp('p.u.', float, 'Shunt voltage set point.'), 'Pfset': GCProp('MW', float, 'Active power set point.'), 'Qfset': GCProp('MVAr', float, 'Active power set point.'), 'Cost': GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'), }, non_editable_attributes=['bus_from', 'bus_to', 'idtag'], properties_with_profile={ 'active': 'active_prof', 'rate': 'rate_prof', 'Cost': 'Cost_prof' }) self.bus_from = bus_from self.bus_to = bus_to # List of measurements self.measurements = list() # total impedance and admittance in p.u. self.Rl = rl self.Xl = xl self.Bl = bl self.Rs = rs self.Xs = xs self.Rsh = rp self.Xsh = xp self.Vsh = vp self.Pfset = Pset self.Qfset = Qset self.Cost = cost self.Cost_prof = cost_prof self.mttf = mttf self.mttr = mttr self.active = active self.active_prof = active_prof # branch rating in MVA self.rate = rate self.contingency_factor = contingency_factor self.contingency_enabled: bool = contingency_enabled self.monitor_loading: bool = monitor_loading self.rate_prof = rate_prof # branch type: Line, Transformer, etc... self.branch_type = BranchType.UPFC
def __init__(self, name='gen', idtag=None, 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, q_points=None, use_reactive_power_curve=False): EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.GeneratorDevice, editable_headers={ 'name': GCProp('', str, 'Name of the generator'), 'idtag': GCProp('', str, 'Unique ID'), '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.'), 'use_reactive_power_curve': GCProp('', bool, 'Use the reactive power capability curve?'), '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=['bus', 'idtag'], 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 self.use_reactive_power_curve = use_reactive_power_curve # minimum reactive power in MVAr self.qmin_set = Qmin # Maximum reactive power in MVAr self.qmax_set = Qmax if q_points is not None: self.q_points = np.array(q_points) self.custom_q_points = True else: self.q_points = make_default_q_curve(self.Snom, self.qmin_set, self.qmax_set) self.custom_q_points = False # 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
def __init__(self, name='batt', idtag=None, active_power=0.0, power_factor=0.8, voltage_module=1.0, is_controlled=True, Qmin=-9999, Qmax=9999, Snom=9999, Enom=9999, p_min=-9999, p_max=9999, op_cost=1.0, power_prof=None, power_factor_prof=None, vset_prof=None, active=True, Sbase=100, enabled_dispatch=True, mttf=0.0, mttr=0.0, charge_efficiency=0.9, discharge_efficiency=0.9, max_soc=0.99, min_soc=0.3, soc=0.8, charge_per_cycle=0.1, discharge_per_cycle=0.1): Generator.__init__(self, name=name, idtag=idtag, active_power=active_power, power_factor=power_factor, voltage_module=voltage_module, is_controlled=is_controlled, Qmin=Qmin, Qmax=Qmax, Snom=Snom, power_prof=power_prof, power_factor_prof=power_factor_prof, vset_prof=vset_prof, active=active, p_min=p_min, p_max=p_max, op_cost=op_cost, Sbase=Sbase, enabled_dispatch=enabled_dispatch, mttf=mttf, mttr=mttr) # type of this device self.device_type = DeviceType.BatteryDevice # manually modify the editable headers self.editable_headers = { 'name': GCProp('', str, 'Name of the battery'), 'idtag': GCProp('', str, 'Unique ID'), 'bus': GCProp('', DeviceType.BusDevice, 'Connection bus name'), 'active': GCProp('', bool, 'Is the battery active?'), 'is_controlled': GCProp('', bool, 'Is this battery voltage-controlled?'), 'P': GCProp('MW', float, 'Active power'), 'Pf': GCProp( '', float, 'Power factor (cos(fi)). This is used for non-controlled batteries.' ), 'Vset': GCProp('p.u.', float, 'Set voltage. This is used for controlled batteries.'), 'Snom': GCProp('MVA', float, 'Nomnial power.'), 'Enom': GCProp('MWh', float, 'Nominal energy capacity.'), 'max_soc': GCProp('p.u.', float, 'Minimum state of charge.'), 'min_soc': GCProp('p.u.', float, 'Maximum state of charge.'), 'soc_0': GCProp('p.u.', float, 'Initial state of charge.'), 'charge_efficiency': GCProp('p.u.', float, 'Charging efficiency.'), 'discharge_efficiency': GCProp('p.u.', float, 'Discharge efficiency.'), 'discharge_per_cycle': GCProp('p.u.', float, ''), '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') } self.charge_efficiency = charge_efficiency self.discharge_efficiency = discharge_efficiency self.max_soc = max_soc self.min_soc = min_soc self.min_soc_charge = (self.max_soc + self.min_soc ) / 2 # SoC state to force the battery charge self.charge_per_cycle = charge_per_cycle # charge 10% per cycle self.discharge_per_cycle = discharge_per_cycle self.min_energy = Enom * self.min_soc self.Enom = Enom self.soc_0 = soc self.soc = soc self.energy = self.Enom * self.soc self.energy_array = None self.power_array = None
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, HV=None, LV=None, name='Branch', idtag=None, r=1e-20, x=1e-20, g=1e-20, b=1e-20, rate=1.0, tap=1.0, shift_angle=0.0, active=True, tolerance=0, cost=0.0, mttf=0, mttr=0, vset=1.0, bus_to_regulated=False, temp_base=20, temp_oper=20, alpha=0.00330, control_mode: TransformerControlType = TransformerControlType.fixed, template: TransformerType = None, rate_prof=None, Cost_prof=None, active_prof=None, temp_oper_prof=None): EditableDevice.__init__(self, name=name, idtag=idtag, active=active, device_type=DeviceType.Transformer2WDevice, editable_headers={'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), '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?'), 'HV': GCProp('kV', float, 'High voltage rating'), 'LV': GCProp('kV', float, 'Low voltage rating'), '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.'), 'tap_module': GCProp('', float, 'Tap changer module, ' 'it a value close to 1.0'), 'angle': GCProp('rad', float, 'Angle shift of the tap changer.'), 'control_mode': GCProp('', TransformerControlType, 'Control type of the transformer'), '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.'), 'template': GCProp('', DeviceType.TransformerTypeDevice, '')}, 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 if bus_from is not None: vh = max(bus_from.Vnom, bus_to.Vnom) vl = min(bus_from.Vnom, bus_to.Vnom) else: vh = 1.0 vl = 1.0 if HV is None: self.HV = vh else: self.HV = HV if LV is None: self.LV = vl else: self.LV = LV # List of measurements self.measurements = list() # branch impedance tolerance self.tolerance = tolerance # 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 = Cost_prof self.active_prof = active_prof # Conductor base and operating temperatures in ºC self.temp_base = temp_base self.temp_oper = temp_oper self.temp_oper_prof = temp_oper_prof # 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 self.rate_prof = rate_prof # branch type: Line, Transformer, etc... self.branch_type = BranchType.Transformer # type template self.template = template self.bus_to_regulated = bus_to_regulated self.vset = vset self.control_mode = control_mode # 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()}
def __init__(self, name="Bus", idtag=None, code='', 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, is_dc=False, area=None, zone=None, substation=None, country=None, longitude=0.0, latitude=0.0): EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.BusDevice, editable_headers={ 'name': GCProp('', str, 'Name of the bus'), 'idtag': GCProp('', str, 'Unique ID'), 'code': GCProp('', str, 'Some code to further identify 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.'), 'is_dc': GCProp('', bool, 'Is this bus of DC 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.'), 'country': GCProp('', DeviceType.CountryDevice, 'Country of the bus'), 'area': GCProp('', DeviceType.AreaDevice, 'Area of the bus'), 'zone': GCProp('', DeviceType.ZoneDevice, 'Zone of the bus'), 'substation': GCProp('', DeviceType.SubstationDevice, 'Substation of the bus.'), 'longitude': GCProp('deg', float, 'longitude of the bus.'), 'latitude': GCProp('deg', float, 'latitude of the bus.') }, non_editable_attributes=['idtag'], 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.country = country self.area = area self.zone = zone self.substation = substation self.code = code # 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 External grid devices self.external_grids = list() # List of measurements self.measurements = list() # Bus type self.type = BusMode.PQ # Flag to determine if the bus is a slack bus or not self.is_slack = is_slack # determined if this bus is an AC or DC bus self.is_dc = is_dc # 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
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='VSC', idtag=None, active=True, r1=0.0001, x1=0.05, m=1.0, m_max=1.1, m_min=0.8, theta=0.1, theta_max=6.28, theta_min=-6.28, Beq=0.001, Beq_min=-0.1, Beq_max=0.1, G0=1e-5, rate=1e-9, kdp=-0.05, kdp_va=103.0, k=1.0, control_mode: ConverterControlType = ConverterControlType. type_0_free, Pfset=0.0, Qfset=0.0, Vac_set=1.0, Vdc_set=1.0, alpha1=0.0001, alpha2=0.015, alpha3=0.2, mttf=0, mttr=0, cost=1200, cost_prof=None, rate_prof=None, active_prof=None): """ Voltage source converter (VSC) :param bus_from: :param bus_to: :param name: :param idtag: :param active: :param r1: :param x1: :param m: :param m_max: :param m_min: :param theta: :param theta_max: :param theta_min: :param Beq: :param Beq_min: :param Beq_max: :param G0: :param rate: :param kdp: :param kdp_va: :param k: :param control_mode: :param Pfset: :param Qfset: :param Vac_set: :param Vdc_set: :param alpha1: :param alpha2: :param alpha3: :param mttf: :param mttr: :param cost: :param cost_prof: :param rate_prof: :param active_prof: """ EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.VscDevice, editable_headers={ 'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), '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.'), 'G0': GCProp('p.u.', float, 'Inverter losses.'), 'Beq': GCProp('p.u.', float, 'Total shunt susceptance.'), 'Beq_max': GCProp('p.u.', float, 'Max total shunt susceptance.'), 'Beq_min': GCProp('p.u.', float, 'Min total shunt susceptance.'), 'm': GCProp('', float, 'Tap changer module, it a value close to 1.0'), 'm_max': GCProp('', float, 'Max tap changer module'), 'm_min': GCProp('', float, 'Min tap changer module'), 'theta': GCProp('rad', float, 'Converter firing angle.'), 'theta_max': GCProp('rad', float, 'Max converter firing angle.'), 'theta_min': GCProp('rad', float, 'Min converter firing angle.'), 'alpha1': GCProp( '', float, 'Converter losses curve parameter (IEC 62751-2 loss Correction).' ), 'alpha2': GCProp( '', float, 'Converter losses curve parameter (IEC 62751-2 loss Correction).' ), 'alpha3': GCProp( '', float, 'Converter losses curve parameter (IEC 62751-2 loss Correction).' ), 'k': GCProp('p.u./p.u.', float, 'Converter factor, typically 0.866.'), 'control_mode': GCProp('', ConverterControlType, 'Converter control mode'), 'kdp': GCProp('p.u./p.u.', float, 'Droop Power/Voltage module slope.'), 'kdp_va': GCProp('p.u./p.u.', float, 'Droop Power/Voltage angle slope.'), 'Pfset': GCProp('MW', float, 'Active power set point.'), 'Qfset': GCProp('MVAr', float, 'Reactive power set point.'), 'Vac_set': GCProp('p.u.', float, 'AC voltage set point.'), 'Vdc_set': GCProp('p.u.', float, 'DC voltage set point.'), 'Cost': GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'), }, non_editable_attributes=['bus_from', 'bus_to', 'idtag'], properties_with_profile={ 'active': 'active_prof', 'rate': 'rate_prof', 'Cost': 'Cost_prof' }) # the VSC must only connect from an DC to a AC bus # this connectivity sense is done to keep track with the articles that set it # from -> DC # to -> AC # assert(bus_from.is_dc != bus_to.is_dc) if bus_to is not None and bus_from is not None: # connectivity: # for the later primitives to make sense, the "bus from" must be AC and the "bus to" must be DC if bus_from.is_dc and not bus_to.is_dc: # correct sense self.bus_from = bus_from self.bus_to = bus_to elif not bus_from.is_dc and bus_to.is_dc: # opposite sense, revert self.bus_from = bus_to self.bus_to = bus_from print('Corrected the connection direction of the VSC device:', self.name) else: raise Exception( 'Impossible connecting a VSC device here. ' 'VSC devices must be connected between AC and DC buses') else: self.bus_from = None self.bus_to = None # 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.k = k self.m_max = m_max self.m_min = m_min self.theta_max = theta_max self.theta_min = theta_min self.Beq_min = Beq_min self.Beq_max = Beq_max self.Pfset = Pfset self.Qfset = Qfset self.Vac_set = Vac_set self.Vdc_set = Vdc_set self.control_mode = control_mode self.kdp = kdp self.kdp_va = kdp_va self.alpha1 = alpha1 self.alpha2 = alpha2 self.alpha3 = alpha3 self.Cost = cost self.Cost_prof = cost_prof self.mttf = mttf self.mttr = mttr self.active = active self.active_prof = active_prof # branch rating in MVA self.rate = rate self.rate_prof = rate_prof # branch type: Line, Transformer, etc... self.branch_type = BranchType.VSC
def __init__(self, name='Load', idtag=None, 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, idtag=idtag, active=active, device_type=DeviceType.LoadDevice, editable_headers={ 'name': GCProp('', str, 'Load name'), 'idtag': GCProp('', str, 'Unique ID', False), 'bus': GCProp('', DeviceType.BusDevice, '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=['bus', 'idtag'], properties_with_profile={ 'active': 'active_prof', '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.active_prof = 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
def __init__(self, name='shunt', idtag=None, G=0.0, B=0.0, G_prof=None, B_prof=None, active=True, controlled=False, Bmin=0.0, Bmax=0.0, mttf=0.0, mttr=0.0): EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.ShuntDevice, editable_headers={ 'name': GCProp('', str, 'Load name'), 'idtag': GCProp('', str, 'Unique ID'), 'bus': GCProp('', DeviceType.BusDevice, 'Connection bus name'), 'active': GCProp('', bool, 'Is the shunt active?'), 'controlled': GCProp('', bool, 'Is the shunt controllable?'), '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.'), 'Bmin': GCProp('MVAr', float, 'Reactive power min control value at V=1.0 p.u.'), 'Bmax': GCProp('MVAr', float, 'Reactive power max control value 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=['bus', 'idtag'], 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.controlled = controlled self.mttf = mttf self.mttr = mttr # Impedance (MVA) self.G = G self.B = B self.Bmin = Bmin self.Bmax = Bmax # admittance profile self.G_prof = G_prof self.B_prof = B_prof
def __init__(self, name='Tower', tpe=BranchType.Branch, idtag=None): """ Overhead line editor :param name: name :param tpe: type """ EditableDevice.__init__( self, name=name, idtag=idtag, active=True, device_type=DeviceType.TowerDevice, editable_headers={ 'name': GCProp('', str, "Tower name"), 'idtag': GCProp('', str, 'Unique ID'), '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_in_tower = 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'] self.index_prop = {0: 'name', 1: 'xpos', 2: 'ypos', 3: 'phase'} self.converter = {0: str, 1: float, 2: float, 3: int} self.editable_wire = [False, True, True, True]
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='Line', idtag=None, code='', r=1e-20, x=1e-20, b=1e-20, rate=1.0, active=True, tolerance=0, cost=0.0, mttf=0, mttr=0, r_fault=0.0, x_fault=0.0, fault_pos=0.5, length=1, temp_base=20, temp_oper=20, alpha=0.00330, template=LineTemplate(), rate_prof=None, Cost_prof=None, active_prof=None, temp_oper_prof=None): EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.LineDevice, code=code, editable_headers={ 'name': GCProp('', str, 'Name of the line.'), 'idtag': GCProp('', str, 'Unique ID'), 'code': GCProp('', str, 'Secondary ID'), 'bus_from': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "from" side of the line.'), 'bus_to': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "to" side of the line.'), 'active': GCProp('', bool, 'Is the line active?'), 'rate': GCProp('MVA', float, 'Thermal rating power of the line.'), '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.'), '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 line ' '(not used for calculation)'), '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.'), 'template': GCProp('', DeviceType.SequenceLineDevice, '') }, non_editable_attributes=[ 'bus_from', 'bus_to', 'template', 'idtag' ], 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 # line 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.B = b self.mttf = mttf self.mttr = mttr self.Cost = cost self.Cost_prof = Cost_prof self.active_prof = active_prof # Conductor base and operating temperatures in ºC self.temp_base = temp_base self.temp_oper = temp_oper self.temp_oper_prof = temp_oper_prof # Conductor thermal constant (1/ºC) self.alpha = alpha # line rating in MVA self.rate = rate self.rate_prof = rate_prof # line type: Line, Transformer, etc... self.branch_type = BranchType.Line # type template self.template = template
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='HVDC Line', idtag=None, active=True, rate=1.0, Pset=0.0, r=1e-20, loss_factor=0.0, Vset_f=1.0, Vset_t=1.0, length=1.0, mttf=0.0, mttr=0.0, overload_cost=1000.0, min_firing_angle_f=-1.0, max_firing_angle_f=1.0, min_firing_angle_t=-1.0, max_firing_angle_t=1.0, active_prof=np.ones(0, dtype=bool), rate_prof=np.zeros(0), Pset_prof=np.zeros(0), Vset_f_prof=np.ones(0), Vset_t_prof=np.ones(0), overload_cost_prof=np.zeros(0), contingency_factor=1.0, control_mode: HvdcControlType = HvdcControlType.type_1_Pset): """ HVDC Line model :param bus_from: Bus from :param bus_to: Bus to :param idtag: id tag of the line :param name: name of the line :param active: Is the line active? :param rate: Line rate in MVA :param Pset: Active power set point :param loss_factor: Losses factor (p.u.) :param Vset_f: Voltage set point at the "from" side :param Vset_t: Voltage set point at the "to" side :param min_firing_angle_f: minimum firing angle at the "from" side :param max_firing_angle_f: maximum firing angle at the "from" side :param min_firing_angle_t: minimum firing angle at the "to" side :param max_firing_angle_t: maximum firing angle at the "to" side :param overload_cost: cost of a line overload in EUR/MW :param mttf: Mean time to failure in hours :param mttr: Mean time to recovery in hours :param length: line length in km :param active_prof: profile of active states (bool) :param rate_prof: Profile of ratings in MVA :param Pset_prof: Active power set points profile :param Vset_f_prof: Voltage set points at the "from" side profile :param Vset_t_prof: Voltage set points at the "to" side profile :param overload_cost_prof: Profile of overload costs in EUR/MW """ EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.HVDCLineDevice, editable_headers={ 'name': GCProp('', str, 'Name of the line.'), 'idtag': GCProp('', str, 'Unique ID'), 'bus_from': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "from" side of the line.'), 'bus_to': GCProp('', DeviceType.BusDevice, 'Name of the bus at the "to" side of the line.'), 'active': GCProp('', bool, 'Is the line active?'), 'rate': GCProp('MVA', float, 'Thermal rating power of the line.'), 'contingency_factor': GCProp('p.u.', float, 'Rating multiplier for contingencies.'), 'control_mode': GCProp('-', HvdcControlType, 'Control type.'), 'Pset': GCProp('MW', float, 'Set power flow.'), 'r': GCProp('Ohm', float, 'line resistance.'), 'loss_factor': GCProp( 'p.u.', float, 'Losses factor.\n' 'The losses are computed as losses=Pfset x Ploss'), 'Vset_f': GCProp('p.u.', float, 'Set voltage at the from side'), 'Vset_t': GCProp('p.u.', float, 'Set voltage at the to side'), 'min_firing_angle_f': GCProp('rad', float, 'minimum firing angle at the ' '"from" side.'), 'max_firing_angle_f': GCProp('rad', float, 'maximum firing angle at the ' '"from" side.'), 'min_firing_angle_t': GCProp('rad', float, 'minimum firing angle at the ' '"to" side.'), 'max_firing_angle_t': GCProp('rad', float, 'maximum firing angle at the ' '"to" side.'), 'mttf': GCProp('h', float, 'Mean time to failure, ' 'used in reliability studies.'), 'mttr': GCProp( 'h', float, 'Mean time to recovery, ' 'used in reliability studies.'), 'length': GCProp('km', float, 'Length of the branch ' '(not used for calculation)'), 'overload_cost': GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'), }, non_editable_attributes=['bus_from', 'bus_to', 'idtag'], properties_with_profile={ 'active': 'active_prof', 'rate': 'rate_prof', 'Pset': 'Pset_prof', 'Vset_f': 'Vset_f_prof', 'Vset_t': 'Vset_t_prof', 'overload_cost': 'overload_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 self.Pset = Pset self.r = r self.loss_factor = loss_factor self.mttf = mttf self.mttr = mttr self.overload_cost = overload_cost self.Vset_f = Vset_f self.Vset_t = Vset_t # converter / inverter firing angles self.min_firing_angle_f = min_firing_angle_f self.max_firing_angle_f = max_firing_angle_f self.min_firing_angle_t = min_firing_angle_t self.max_firing_angle_t = max_firing_angle_t self.Qmin_f, self.Qmax_f = firing_angles_to_reactive_limits( self.Pset, self.min_firing_angle_f, self.max_firing_angle_f) self.Qmin_t, self.Qmax_t = firing_angles_to_reactive_limits( self.Pset, self.min_firing_angle_t, self.max_firing_angle_t) self.overload_cost_prof = overload_cost_prof self.control_mode = control_mode self.Pset_prof = Pset_prof self.active_prof = active_prof self.Vset_f_prof = Vset_f_prof self.Vset_t_prof = Vset_t_prof # branch rating in MVA self.rate = rate self.contingency_factor = contingency_factor self.rate_prof = rate_prof
def __init__(self, bus_from: Bus = None, bus_to: Bus = None, name='VSC', idtag=None, active=True, r1=0.0001, x1=0.05, m=1.0, theta=0.1, Gsw=1e-5, Beq=0.001, rate=1e-9, mttf=0, mttr=0, cost=1200, cost_prof=None, rate_prof=None, active_prof=None): """ Voltage source converter (VSC) :param bus_from: :param bus_to: :param name: :param active: :param r1: :param x1: :param m: :param theta: :param Gsw: :param Beq: :param rate: """ EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.VscDevice, editable_headers={ 'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), '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.'), 'Cost': GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'), }, non_editable_attributes=['bus_from', 'bus_to'], properties_with_profile={ 'active': 'active_prof', 'rate': 'rate_prof', 'Cost': 'Cost_prof' }) # the VSC must only connect from an AC to a DC bus # assert(bus_from.is_dc != bus_to.is_dc) if bus_to is not None and bus_from is not None: # 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) else: self.bus_from = None self.bus_to = None # List of measurements self.measurements = list() # total impedance and admittance in p.u. self.R1 = r1 self.X1 = x1 self.Gsw = Gsw self.Beq = Beq self.m = m self.theta = theta self.Cost = cost self.Cost_prof = cost_prof self.mttf = mttf self.mttr = mttr self.active = active self.active_prof = active_prof # branch rating in MVA self.rate = rate self.rate_prof = rate_prof # branch type: Line, Transformer, etc... self.branch_type = BranchType.VSC
def __init__( self, bus_from: Bus = None, bus_to: Bus = None, name='VSC', idtag=None, active=True, r1=0.0001, x1=0.05, m=1.0, theta=0.1, G0=1e-5, Beq=0.001, Inom=100, rate=1e-9, control_mode: ConverterControlType = ConverterControlType.pf_vac, Pset=0.0, Vac_set=1.0, Vdc_set=1.0, Qset=0.0, mttf=0, mttr=0, cost=1200, cost_prof=None, rate_prof=None, active_prof=None): """ Voltage source converter (VSC) :param bus_from: :param bus_to: :param name: :param idtag: :param active: :param r1: :param x1: :param m: :param theta: :param G0: :param Beq: :param Inom: :param rate: :param control_mode: :param Pset: :param Vac_set: :param Vdc_set: :param Qset: :param mttf: :param mttr: :param cost: :param cost_prof: :param rate_prof: :param active_prof: """ EditableDevice.__init__( self, name=name, idtag=idtag, active=active, device_type=DeviceType.VscDevice, editable_headers={ 'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), '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.'), 'control_mode': GCProp('', ConverterControlType, 'Converter control mode'), '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.'), 'G0': 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.'), 'Inom': GCProp('kA', float, 'Nominal current.'), 'Pset': GCProp('MW', float, 'Set power (Only valid for type I control modes).'), 'Cost': GCProp('e/MWh', float, 'Cost of overloads. Used in OPF.'), }, non_editable_attributes=['bus_from', 'bus_to'], properties_with_profile={ 'active': 'active_prof', 'rate': 'rate_prof', 'Cost': 'Cost_prof' }) # the VSC must only connect from an DC to a AC bus # this connectivity sense is done to keep track with the articles that set it # from -> DC # to -> AC # assert(bus_from.is_dc != bus_to.is_dc) if bus_to is not None and bus_from is not None: # connectivity: # for the later primitives to make sense, the "bus from" must be AC and the "bus to" must be DC if bus_from.is_dc and not bus_to.is_dc: # correct sense self.bus_from = bus_from self.bus_to = bus_to elif not bus_from.is_dc and bus_to.is_dc: # opposite sense, revert self.bus_from = bus_to self.bus_to = bus_from print('Corrected the connection direction of the VSC device:', self.name) else: raise Exception( 'Impossible connecting a VSC device here. ' 'VSC devices must be connected between AC and DC buses') else: self.bus_from = None self.bus_to = None # 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.Inom = Inom self.Pset = Pset self.Qset = Qset self.Vac_set = Vac_set self.Vdc_set = Vdc_set self.control_mode = control_mode self.Cost = cost self.Cost_prof = cost_prof self.mttf = mttf self.mttr = mttr self.active = active self.active_prof = active_prof # branch rating in MVA self.rate = rate self.rate_prof = rate_prof # branch type: Line, Transformer, etc... self.branch_type = BranchType.VSC
def __init__(self, name='SequenceLine', idtag=None, rating=1, R=0, X=0, G=0, B=0, R0=0, X0=0, G0=0, B0=0, tpe=BranchType.Line): """ Constructor :param name: name of the model :param rating: Line 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 """ EditableDevice.__init__( self, name=name, idtag=idtag, active=True, device_type=DeviceType.SequenceLineDevice, editable_headers={ 'name': GCProp('', str, "Name of the line template"), 'idtag': GCProp('', str, 'Unique ID'), 'rating': GCProp('kA', float, "Current rating of the line"), '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 = tpe self.rating = rating # impudence and admittance 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
def __init__( self, idtag=None, 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, idtag=idtag, name=name, active=active, device_type=DeviceType.BranchDevice, editable_headers={ 'name': GCProp('', str, 'Name of the branch.'), 'idtag': GCProp('', str, 'Unique ID'), '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', '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.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 self.rate_prof = None # 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 # 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()}