From 9986c381be6cb986af351c9b39189008a3bf0607 Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Wed, 25 Jul 2018 17:15:06 +0200 Subject: [PATCH] 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". --- scripts/add_electricity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 122b7c8e..11fcf78f 100644 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -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"})