{prepare,solve}_network: Don't add a line volume limit for lv1.0
lv1.0 signifies lines being non-extendable!
This commit is contained in:
parent
de5916eb57
commit
8d70766e72
@ -45,21 +45,22 @@ def set_line_volume_limit(n, lv):
|
||||
n.lines['capital_cost'] = 0.
|
||||
n.links['capital_cost'] = 0.
|
||||
|
||||
lines_s_nom = n.lines.s_nom.where(
|
||||
n.lines.type == '',
|
||||
np.sqrt(3) * n.lines.num_parallel *
|
||||
n.lines.type.map(n.line_types.i_nom) *
|
||||
n.lines.bus0.map(n.buses.v_nom)
|
||||
)
|
||||
if lv > 1.0:
|
||||
lines_s_nom = n.lines.s_nom.where(
|
||||
n.lines.type == '',
|
||||
np.sqrt(3) * n.lines.num_parallel *
|
||||
n.lines.type.map(n.line_types.i_nom) *
|
||||
n.lines.bus0.map(n.buses.v_nom)
|
||||
)
|
||||
|
||||
n.lines['s_nom_min'] = lines_s_nom
|
||||
n.links['p_nom_min'] = n.links['p_nom']
|
||||
n.lines['s_nom_min'] = lines_s_nom
|
||||
n.links['p_nom_min'] = n.links['p_nom']
|
||||
|
||||
n.lines['s_nom_extendable'] = True
|
||||
n.links['p_nom_extendable'] = True
|
||||
n.lines['s_nom_extendable'] = True
|
||||
n.links['p_nom_extendable'] = True
|
||||
|
||||
n.line_volume_limit = lv * ((lines_s_nom * n.lines['length']).sum() +
|
||||
n.links.loc[n.links.carrier=='DC'].eval('p_nom * length').sum())
|
||||
n.line_volume_limit = lv * ((lines_s_nom * n.lines['length']).sum() +
|
||||
n.links.loc[n.links.carrier=='DC'].eval('p_nom * length').sum())
|
||||
|
||||
return n
|
||||
|
||||
|
@ -181,7 +181,7 @@ def add_opts_constraints(n, opts=None):
|
||||
n.model.safe_peakdemand = pypsa.opt.Constraint(expr=sum(n.model.generator_p_nom[gen] for gen in ext_gens_i) >= peakdemand - exist_conv_caps)
|
||||
|
||||
def add_lv_constraint(n):
|
||||
line_volume = getattr(n, 'line_volume_limit')
|
||||
line_volume = getattr(n, 'line_volume_limit', None)
|
||||
if line_volume is not None and not np.isinf(line_volume):
|
||||
n.model.line_volume_constraint = pypsa.opt.Constraint(
|
||||
expr=((sum(n.model.passive_branch_s_nom["Line",line]*n.lines.at[line,"length"]
|
||||
|
Loading…
Reference in New Issue
Block a user