Skip to content

Commit

Permalink
networkclustering: Recalculate capital_cost of aggregated lines
Browse files Browse the repository at this point in the history
  • Loading branch information
coroa committed Aug 16, 2018
1 parent 3fdeb43 commit b310303
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pypsa/networkclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def aggregatelines(network, buses, interlines, line_length_factor=1.0):
}

def aggregatelinegroup(l):
def normed(s):
tot = s.sum()
if tot == 0:
return 1.
else:
return s/tot

# l.name is a tuple of the groupby index (bus0_s, bus1_s)
length_s = _haversine(buses.loc[list(l.name),['x', 'y']])*line_length_factor
Expand All @@ -179,7 +185,7 @@ def aggregatelinegroup(l):
s_nom_max=l['s_nom_max'].sum(),
s_nom_extendable=l['s_nom_extendable'].any(),
num_parallel=l['num_parallel'].sum(),
capital_cost=l['capital_cost'].sum(),
capital_cost=(length_factor * normed(l['s_nom']) * l['capital_cost']).mean(),
length=length_s,
sub_network=consense['sub_network'](l['sub_network']),
v_ang_min=l['v_ang_min'].max(),
Expand Down

0 comments on commit b310303

Please sign in to comment.