add_electricity: Fix bugs when parsing costs

pandas has to be provoked to give NaNs for missing values in the sum,
so force min_count=1. Then these NaNs are filled with defaults.

OCGT and CCGT have fuel "gas".
This commit is contained in:
Tom Brown 2018-07-25 17:15:06 +02:00 committed by Jonas Hörsch
parent 23ebcaeaa0
commit 9986c381be

View File

@ -41,7 +41,7 @@ def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None):
costs.loc[costs.unit.str.contains("/kW"),"value"] *= 1e3
costs.loc[costs.unit.str.contains("USD"),"value"] *= config['USD2013_to_EUR2013']
costs = costs.loc[idx[:,config['year'],:], "value"].unstack(level=2).groupby("technology").sum()
costs = costs.loc[idx[:,config['year'],:], "value"].unstack(level=2).groupby("technology").sum(min_count=1)
costs = costs.fillna({"CO2 intensity" : 0,
"FOM" : 0,
@ -54,6 +54,10 @@ def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None):
costs["capital_cost"] = ((annuity(costs["lifetime"], costs["discount rate"]) + costs["FOM"]/100.) *
costs["investment"] * Nyears)
costs.at['OCGT', 'fuel'] = costs.at['gas', 'fuel']
costs.at['CCGT', 'fuel'] = costs.at['gas', 'fuel']
costs['marginal_cost'] = costs['VOM'] + costs['fuel'] / costs['efficiency']
costs = costs.rename(columns={"CO2 intensity": "co2_emissions"})