Skip to content

Commit

Permalink
add_electricity: fix cost ref
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Jun 15, 2023
1 parent 27eea27 commit a17647a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/add_electricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ def _add_missing_carriers_from_costs(n, costs, carriers):
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
costs = pd.read_csv(tech_costs, index_col=[0, 1]).sort_index()

# correct units to MW
costs.loc[costs.unit.str.contains("/kW"), "value"] *= 1e3
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["capital_cost"] = (
Expand All @@ -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["solar", "capital_cost"] = (
costs["rooftop_share"] * costs.at["solar-rooftop", "capital_cost"]
+ (1 - costs["rooftop_share"]) * costs.at["solar-utility", "capital_cost"]
config["rooftop_share"] * costs.at["solar-rooftop", "capital_cost"]
+ (1 - config["rooftop_share"]) * costs.at["solar-utility", "capital_cost"]
)

def costs_for_storage(store, link1, link2=None, max_hours=1.0):
Expand All @@ -193,7 +193,7 @@ def costs_for_storage(store, link1, link2=None, max_hours=1.0):
)

for attr in ("marginal_cost", "capital_cost"):
overwrites = costs.get(attr)
overwrites = config.get(attr)
if overwrites is not None:
overwrites = pd.Series(overwrites)
costs.loc[overwrites.index, attr] = overwrites
Expand Down

0 comments on commit a17647a

Please sign in to comment.