add_electricity: fix cost ref

This commit is contained in:
Fabian 2023-06-15 19:35:41 +02:00
parent 27eea273bd
commit a17647a07e

View File

@ -137,7 +137,7 @@ def _add_missing_carriers_from_costs(n, costs, carriers):
n.import_components_from_dataframe(emissions, "Carrier") n.import_components_from_dataframe(emissions, "Carrier")
def load_costs(tech_costs, costs, max_hours, Nyears=1.0): def load_costs(tech_costs, config, max_hours, Nyears=1.0):
# set all asset costs and other parameters # set all asset costs and other parameters
costs = pd.read_csv(tech_costs, index_col=[0, 1]).sort_index() costs = pd.read_csv(tech_costs, index_col=[0, 1]).sort_index()
@ -145,7 +145,7 @@ def load_costs(tech_costs, costs, max_hours, Nyears=1.0):
costs.loc[costs.unit.str.contains("/kW"), "value"] *= 1e3 costs.loc[costs.unit.str.contains("/kW"), "value"] *= 1e3
costs.unit = costs.unit.str.replace("/kW", "/MW") costs.unit = costs.unit.str.replace("/kW", "/MW")
fill_values = costs["fill_values"] fill_values = config["fill_values"]
costs = costs.value.unstack().fillna(fill_values) costs = costs.value.unstack().fillna(fill_values)
costs["capital_cost"] = ( costs["capital_cost"] = (
@ -168,8 +168,8 @@ def load_costs(tech_costs, costs, max_hours, Nyears=1.0):
costs.at["CCGT", "co2_emissions"] = costs.at["gas", "co2_emissions"] costs.at["CCGT", "co2_emissions"] = costs.at["gas", "co2_emissions"]
costs.at["solar", "capital_cost"] = ( costs.at["solar", "capital_cost"] = (
costs["rooftop_share"] * costs.at["solar-rooftop", "capital_cost"] config["rooftop_share"] * costs.at["solar-rooftop", "capital_cost"]
+ (1 - costs["rooftop_share"]) * costs.at["solar-utility", "capital_cost"] + (1 - config["rooftop_share"]) * costs.at["solar-utility", "capital_cost"]
) )
def costs_for_storage(store, link1, link2=None, max_hours=1.0): def costs_for_storage(store, link1, link2=None, max_hours=1.0):
@ -193,7 +193,7 @@ def load_costs(tech_costs, costs, max_hours, Nyears=1.0):
) )
for attr in ("marginal_cost", "capital_cost"): for attr in ("marginal_cost", "capital_cost"):
overwrites = costs.get(attr) overwrites = config.get(attr)
if overwrites is not None: if overwrites is not None:
overwrites = pd.Series(overwrites) overwrites = pd.Series(overwrites)
costs.loc[overwrites.index, attr] = overwrites costs.loc[overwrites.index, attr] = overwrites