Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#should be removed and set by program based on generators at bus
control = String(default="PQ",restricted=["PQ","PV","Slack"])
#2-d location data (e.g. longitude and latitude; Spatial Reference System Identifier (SRID) set in network.srid)
x = Float(default=0.)
y = Float(default=0.)
p = Series(output=True)
q = Series(output=True)
v_mag_pu = Series(default=1., output=True)
v_ang = Series(output=True)
v_mag_pu_set = Series(default=1.)
v_mag_pu_min = Float(default=0.)
v_mag_pu_max = Float(default=inf)
#optimisation output for power balance constraint at bus
marginal_price = Series(output=True)
#energy carrier could be "AC", "DC", "heat", "gas"
carrier = String(default="AC")
sub_network = String(default="")
class SubStation(Common):
"""Placeholder for a group of buses."""
class Region(Common):
"""A group of buses such as a country or county."""
#so if power flows from bus0 to bus1, p0 is positive, p1 is negative
p0 = Series(output=True)
p1 = Series(output=True)
q0 = Series(output=True)
q1 = Series(output=True)
class Line(Branch):
"""Lines include distribution and transmission lines, overhead lines and cables."""
list_name = "lines"
#series impedance z = r + jx in Ohm
r = Float(0.)
x = Float(0.)
#shunt reactance y = g + jb in 1/Ohm
g = Float(0.)
b = Float(0.)
x_pu = Float(0.)
r_pu = Float(0.)
g_pu = Float(0.)
b_pu = Float(0.)
#voltage angle difference across branches
v_ang_min = Float(-inf)
v_ang_max = Float(inf)
length = Float(default=1.0)
terrain_factor = Float(default=1.0)
sign = Float(default=1.)
p = Series(output=True)
q = Series(output=True)
class Generator(OnePort):
list_name = "generators"
control = String(default="PQ",restricted=["PQ","PV","Slack"])
#i.e. coal, CCGT, onshore wind, PV, CSP,....
carrier = String(default="")
#rated power
p_nom = Float(default=0.0)
#switch to allow capacity to be extended
p_nom_extendable = Boolean(False)
#technical potential
p_nom_max = Float(inf)
p_nom_min = Float(0.0)
#optimised capacity
p_nom_opt = Float(0.0)
capital_cost = Float(0.0)
marginal_cost = Float(0.0)
#power limits for variable generators, which can change e.g. due
class Store(Common):
"""Generic store, whose capacity may be optimised."""
list_name = "stores"
bus = String(default="")
sign = Float(default=1.)
p = Series(output=True)
q = Series(output=True)
e = Series(output=True)
p_set = Series()
q_set = Series()
#rated energy capacity
e_nom = Float(default=0.0)
#switch to allow energy capacity to be extended
e_nom_extendable = Boolean(False)
#technical potential
e_nom_max = Float(inf)
e_nom_min = Float(0.0)
#optimised capacity
e_nom_opt = Float(0.0)
e_max_pu = Series(default=1.)
e_min_pu = Series(default=0.)
e_cyclic = Boolean(False)
#optimised capacity
e_nom_opt = Float(0.0)
e_max_pu = Series(default=1.)
e_min_pu = Series(default=0.)
e_cyclic = Boolean(False)
e_initial = Float(0.)
#cost of increasing e_nom
capital_cost = Float(0.0)
#cost of dispatching from the store
marginal_cost = Float(0.0)
#per hour per unit loss in state of charge
standing_loss = Float(0.)
class Load(OnePort):
"""PQ load."""
list_name = "loads"
#set sign convention for powers opposite to generator
sign = Float(-1.)
p_set = Series()
q_set = Series()
sign = Float(default=1.)
p = Series(output=True)
q = Series(output=True)
e = Series(output=True)
p_set = Series()
q_set = Series()
#rated energy capacity
e_nom = Float(default=0.0)
#switch to allow energy capacity to be extended
e_nom_extendable = Boolean(False)
#technical potential
e_nom_max = Float(inf)
e_nom_min = Float(0.0)
#optimised capacity
e_nom_opt = Float(0.0)
e_max_pu = Series(default=1.)
e_min_pu = Series(default=0.)
e_cyclic = Boolean(False)
e_initial = Float(0.)
#cost of increasing e_nom
capital_cost = Float(0.0)
#maximum state of charge capacity in terms of hours at full output capacity p_nom
max_hours = Float(1)
#the minimum power dispatch is negative
p_min_pu = Series(default=-1)
#in MW
inflow = Series()
spill = Series(output=True)
efficiency_store = Float(1)
efficiency_dispatch = Float(1)
#per hour per unit loss in state of charge
standing_loss = Float(0.)
class Store(Common):
"""Generic store, whose capacity may be optimised."""
list_name = "stores"
bus = String(default="")
sign = Float(default=1.)
p = Series(output=True)
q = Series(output=True)
e = Series(output=True)
p_set = Series()
q_set = Series()
#pi is positive if power is flowing from bus i into the branch
#so if power flows from bus0 to bus1, p0 is positive, p1 is negative
p0 = Series(output=True)
p1 = Series(output=True)
#limits per unit of p_nom
p_min_pu = Series(default=0.)
p_max_pu = Series(default=1.)
efficiency = Series(default=1.)
#The set point for p0.
p_set = Series()
length = Float(default=1.0)
terrain_factor = Float(default=1.0)
class ThreePort(Common):
"""Placeholder for 3-winding transformers."""
class ThreeTransformer(ThreePort):
pass
class LineType(Common):
"""Placeholder for future functionality to automatically generate line
parameters from standard parameters (e.g. r/km)."""
Type = namedtuple("Type", ['typ', 'name', 'df', 'pnl', 'ind'])
class Network(Basic):
"""
Network container for all buses, one-ports and branches.
#i.e. coal, CCGT, onshore wind, PV, CSP,....
carrier = String(default="")
#rated power
p_nom = Float(default=0.0)
#switch to allow capacity to be extended
p_nom_extendable = Boolean(False)
#technical potential
p_nom_max = Float(inf)
p_nom_min = Float(0.0)
#optimised capacity
p_nom_opt = Float(0.0)
capital_cost = Float(0.0)
marginal_cost = Float(0.0)
#power limits for variable generators, which can change e.g. due
#to weather conditions; per unit to ease multiplication with
#p_nom, which may be optimised
p_max_pu = Series(default=1.)
p_min_pu = Series(default=0.)
#operator's intended dispatch
p_set = Series()
q_set = Series()
list_name = "generators"
control = String(default="PQ",restricted=["PQ","PV","Slack"])
#i.e. coal, CCGT, onshore wind, PV, CSP,....
carrier = String(default="")
#rated power
p_nom = Float(default=0.0)
#switch to allow capacity to be extended
p_nom_extendable = Boolean(False)
#technical potential
p_nom_max = Float(inf)
p_nom_min = Float(0.0)
#optimised capacity
p_nom_opt = Float(0.0)
capital_cost = Float(0.0)
marginal_cost = Float(0.0)
#power limits for variable generators, which can change e.g. due
#to weather conditions; per unit to ease multiplication with
#p_nom, which may be optimised
p_max_pu = Series(default=1.)
p_min_pu = Series(default=0.)
#operator's intended dispatch
p_set = Series()