style improvement
This commit is contained in:
parent
71a8bc6c96
commit
03fca360ff
@ -78,8 +78,14 @@ def add_brownfield(n, n_p, year):
|
|||||||
|
|
||||||
# deal with gas network
|
# deal with gas network
|
||||||
pipe_carrier = ['gas pipeline']
|
pipe_carrier = ['gas pipeline']
|
||||||
to_drop = n.links.carrier.isin(pipe_carrier) & (n.links.build_year!=year)
|
if snakemake.config["sector"]['H2_retrofit']:
|
||||||
n.mremove("Link", n.links.loc[to_drop].index)
|
to_drop = n.links.carrier.isin(pipe_carrier) & (n.links.build_year!=year)
|
||||||
|
n.mremove("Link", n.links.loc[to_drop].index)
|
||||||
|
else:
|
||||||
|
new_pipes = n.links.carrier.isin(pipe_carrier) & (n.links.build_year==year)
|
||||||
|
n.links.loc[new_pipes, "p_nom"] = 0.
|
||||||
|
n.links.loc[new_pipes, "p_nom_min"] = 0.
|
||||||
|
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -409,12 +409,11 @@ def add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years
|
|||||||
lifetime=costs.at[costs_name, 'lifetime']
|
lifetime=costs.at[costs_name, 'lifetime']
|
||||||
)
|
)
|
||||||
|
|
||||||
bus0 = vars(spatial)["gas"].nodes
|
|
||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name],
|
nodes[name],
|
||||||
suffix= f" {name} gas boiler-{grouping_year}",
|
suffix= f" {name} gas boiler-{grouping_year}",
|
||||||
bus0=bus0,
|
bus0=spatial.gas.nodes,
|
||||||
bus1=nodes[name] + " " + name + " heat",
|
bus1=nodes[name] + " " + name + " heat",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier=name + " gas boiler",
|
carrier=name + " gas boiler",
|
||||||
@ -429,7 +428,7 @@ def add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name],
|
nodes[name],
|
||||||
suffix=f" {name} oil boiler-{grouping_year}",
|
suffix=f" {name} oil boiler-{grouping_year}",
|
||||||
bus0="EU oil",
|
bus0=spatial.oil.nodes,
|
||||||
bus1=nodes[name] + " " + name + " heat",
|
bus1=nodes[name] + " " + name + " heat",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier=name + " oil boiler",
|
carrier=name + " oil boiler",
|
||||||
@ -458,7 +457,7 @@ if __name__ == "__main__":
|
|||||||
clusters="37",
|
clusters="37",
|
||||||
lv=1.0,
|
lv=1.0,
|
||||||
opts='',
|
opts='',
|
||||||
sector_opts='Co2L0-168H-T-H-B-I-solar+p3-dist1',
|
sector_opts='168H-T-H-B-I-solar+p3-dist1',
|
||||||
planning_horizons=2020,
|
planning_horizons=2020,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ def plot_h2_map(network):
|
|||||||
|
|
||||||
# make a fake MultiIndex so that area is correct for legend
|
# make a fake MultiIndex so that area is correct for legend
|
||||||
bus_sizes.rename(index=lambda x: x.replace(" H2", ""), level=0, inplace=True)
|
bus_sizes.rename(index=lambda x: x.replace(" H2", ""), level=0, inplace=True)
|
||||||
# frop all links which are not H2 pipelines
|
# drop all links which are not H2 pipelines
|
||||||
n.links.drop(n.links.index[~n.links.carrier.str.contains("H2 pipeline")], inplace=True)
|
n.links.drop(n.links.index[~n.links.carrier.str.contains("H2 pipeline")], inplace=True)
|
||||||
|
|
||||||
h2_new = n.links.loc[n.links.carrier=="H2 pipeline"]
|
h2_new = n.links.loc[n.links.carrier=="H2 pipeline"]
|
||||||
|
@ -1438,8 +1438,8 @@ def add_land_transport(n, costs):
|
|||||||
|
|
||||||
if "oil" not in n.buses.carrier.unique():
|
if "oil" not in n.buses.carrier.unique():
|
||||||
n.madd("Bus",
|
n.madd("Bus",
|
||||||
vars(spatial)["oil"].nodes,
|
spatial.oil.nodes,
|
||||||
location=vars(spatial)["oil"].locations,
|
location=spatial.oil.locations,
|
||||||
carrier="oil"
|
carrier="oil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1448,7 +1448,7 @@ def add_land_transport(n, costs):
|
|||||||
n.madd("Load",
|
n.madd("Load",
|
||||||
nodes,
|
nodes,
|
||||||
suffix=" land transport oil",
|
suffix=" land transport oil",
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
carrier="land transport oil",
|
carrier="land transport oil",
|
||||||
p_set=ice_share / ice_efficiency * transport[nodes]
|
p_set=ice_share / ice_efficiency * transport[nodes]
|
||||||
)
|
)
|
||||||
@ -2115,7 +2115,7 @@ def add_industry(n, costs):
|
|||||||
n.madd("Load",
|
n.madd("Load",
|
||||||
nodes,
|
nodes,
|
||||||
suffix=" shipping oil",
|
suffix=" shipping oil",
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
carrier="shipping oil",
|
carrier="shipping oil",
|
||||||
p_set=p_set
|
p_set=p_set
|
||||||
)
|
)
|
||||||
@ -2131,8 +2131,8 @@ def add_industry(n, costs):
|
|||||||
|
|
||||||
if "oil" not in n.buses.carrier.unique():
|
if "oil" not in n.buses.carrier.unique():
|
||||||
n.madd("Bus",
|
n.madd("Bus",
|
||||||
vars(spatial)["oil"].nodes,
|
spatial.oil.nodes,
|
||||||
location=vars(spatial)["oil"].locations,
|
location=spatial.oil.locations,
|
||||||
carrier="oil"
|
carrier="oil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2140,8 +2140,8 @@ def add_industry(n, costs):
|
|||||||
|
|
||||||
#could correct to e.g. 0.001 EUR/kWh * annuity and O&M
|
#could correct to e.g. 0.001 EUR/kWh * annuity and O&M
|
||||||
n.madd("Store",
|
n.madd("Store",
|
||||||
[oil_bus + " Store" for oil_bus in vars(spatial)["oil"].nodes],
|
[oil_bus + " Store" for oil_bus in spatial.oil.nodes],
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
e_nom_extendable=True,
|
e_nom_extendable=True,
|
||||||
e_cyclic=True,
|
e_cyclic=True,
|
||||||
carrier="oil",
|
carrier="oil",
|
||||||
@ -2150,8 +2150,8 @@ def add_industry(n, costs):
|
|||||||
if "oil" not in n.generators.carrier.unique():
|
if "oil" not in n.generators.carrier.unique():
|
||||||
|
|
||||||
n.madd("Generator",
|
n.madd("Generator",
|
||||||
vars(spatial)["oil"].nodes,
|
spatial.oil.nodes,
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
carrier="oil",
|
carrier="oil",
|
||||||
marginal_cost=costs.at["oil", 'fuel']
|
marginal_cost=costs.at["oil", 'fuel']
|
||||||
@ -2166,7 +2166,7 @@ def add_industry(n, costs):
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes_heat[name] + f" {name} oil boiler",
|
nodes_heat[name] + f" {name} oil boiler",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
bus0=vars(spatial)["oil"].nodes,
|
bus0=spatial.oil.nodes,
|
||||||
bus1=nodes_heat[name] + f" {name} heat",
|
bus1=nodes_heat[name] + f" {name} heat",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier=f"{name} oil boiler",
|
carrier=f"{name} oil boiler",
|
||||||
@ -2179,7 +2179,7 @@ def add_industry(n, costs):
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes + " Fischer-Tropsch",
|
nodes + " Fischer-Tropsch",
|
||||||
bus0=nodes + " H2",
|
bus0=nodes + " H2",
|
||||||
bus1=vars(spatial)["oil"].nodes,
|
bus1=spatial.oil.nodes,
|
||||||
bus2=spatial.co2.nodes,
|
bus2=spatial.co2.nodes,
|
||||||
carrier="Fischer-Tropsch",
|
carrier="Fischer-Tropsch",
|
||||||
efficiency=costs.at["Fischer-Tropsch", 'efficiency'],
|
efficiency=costs.at["Fischer-Tropsch", 'efficiency'],
|
||||||
@ -2191,7 +2191,7 @@ def add_industry(n, costs):
|
|||||||
|
|
||||||
n.madd("Load",
|
n.madd("Load",
|
||||||
["naphtha for industry"],
|
["naphtha for industry"],
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
carrier="naphtha for industry",
|
carrier="naphtha for industry",
|
||||||
p_set=industrial_demand.loc[nodes, "naphtha"].sum() / 8760
|
p_set=industrial_demand.loc[nodes, "naphtha"].sum() / 8760
|
||||||
)
|
)
|
||||||
@ -2201,7 +2201,7 @@ def add_industry(n, costs):
|
|||||||
|
|
||||||
n.madd("Load",
|
n.madd("Load",
|
||||||
["kerosene for aviation"],
|
["kerosene for aviation"],
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
carrier="kerosene for aviation",
|
carrier="kerosene for aviation",
|
||||||
p_set=p_set
|
p_set=p_set
|
||||||
)
|
)
|
||||||
@ -2354,7 +2354,7 @@ def add_agriculture(n, costs):
|
|||||||
|
|
||||||
n.add("Load",
|
n.add("Load",
|
||||||
"agriculture machinery oil",
|
"agriculture machinery oil",
|
||||||
bus=vars(spatial)["oil"].nodes,
|
bus=spatial.oil.nodes,
|
||||||
carrier="agriculture machinery oil",
|
carrier="agriculture machinery oil",
|
||||||
p_set=ice_share * machinery_nodal_energy.sum() * 1e6 / 8760
|
p_set=ice_share * machinery_nodal_energy.sum() * 1e6 / 8760
|
||||||
)
|
)
|
||||||
|
@ -282,7 +282,7 @@ if __name__ == "__main__":
|
|||||||
if 'snakemake' not in globals():
|
if 'snakemake' not in globals():
|
||||||
from helper import mock_snakemake
|
from helper import mock_snakemake
|
||||||
snakemake = mock_snakemake(
|
snakemake = mock_snakemake(
|
||||||
'solve_network_myopic',
|
'solve_network',
|
||||||
simpl='',
|
simpl='',
|
||||||
opts="",
|
opts="",
|
||||||
clusters="37",
|
clusters="37",
|
||||||
|
Loading…
Reference in New Issue
Block a user