lossy_bidirectional_links: use original length for loss calculation
This commit is contained in:
parent
014a4cd62e
commit
0d03d384cc
@ -3309,15 +3309,16 @@ def lossy_bidirectional_links(n, carrier, efficiencies={}):
|
||||
n.links.loc[carrier_i, "length"] / 1e3
|
||||
)
|
||||
rev_links = (
|
||||
n.links.loc[carrier_i].copy().rename({"bus0": "bus1", "bus1": "bus0"}, axis=1)
|
||||
n.links.loc[carrier_i].copy().rename({"bus0": "bus1", "bus1": "bus0", "length": "length_original"}, axis=1)
|
||||
)
|
||||
rev_links.capital_cost = 0
|
||||
rev_links.length = 0
|
||||
rev_links["capital_cost"] = 0
|
||||
rev_links["length"] = 0
|
||||
rev_links["reversed"] = True
|
||||
rev_links.index = rev_links.index.map(lambda x: x + "-reversed")
|
||||
|
||||
n.links = pd.concat([n.links, rev_links], sort=False)
|
||||
n.links["reversed"] = n.links["reversed"].fillna(False)
|
||||
n.links["length_original"] = n.links["length_original"].fillna(n.links.length)
|
||||
|
||||
# do compression losses after concatenation to take electricity consumption at bus0 in either direction
|
||||
carrier_i = n.links.query("carrier == @carrier").index
|
||||
@ -3326,7 +3327,7 @@ def lossy_bidirectional_links(n, carrier, efficiencies={}):
|
||||
n.buses.location
|
||||
) # electricity
|
||||
n.links.loc[carrier_i, "efficiency2"] = (
|
||||
-compression_per_1000km * n.links.loc[carrier_i, "length"] / 1e3
|
||||
-compression_per_1000km * n.links.loc[carrier_i, "length_original"] / 1e3
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user