add_electricity: Refactor extendable generators to provide a OCGT-ext technology
Partially adresses #7.
This commit is contained in:
parent
50abd6c0c9
commit
6bb9cd1025
@ -30,8 +30,13 @@ def normed(s): return s/s.sum()
|
|||||||
|
|
||||||
def _add_missing_carriers_from_costs(n, costs, carriers):
|
def _add_missing_carriers_from_costs(n, costs, carriers):
|
||||||
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
|
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
|
||||||
|
if missing_carriers.empty: return
|
||||||
|
|
||||||
emissions_cols = costs.columns.to_series().loc[lambda s: s.str.endswith('_emissions')].values
|
emissions_cols = costs.columns.to_series().loc[lambda s: s.str.endswith('_emissions')].values
|
||||||
n.import_components_from_dataframe(costs.loc[missing_carriers, emissions_cols].fillna(0.), 'Carrier')
|
suptechs = missing_carriers.str.split('-').str[0]
|
||||||
|
emissions = costs.loc[suptechs, emissions_cols].fillna(0.)
|
||||||
|
emissions.index = missing_carriers
|
||||||
|
n.import_components_from_dataframe(emissions, 'Carrier')
|
||||||
|
|
||||||
def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None):
|
def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None):
|
||||||
if tech_costs is None:
|
if tech_costs is None:
|
||||||
@ -324,21 +329,26 @@ def attach_hydro(n, costs, ppl):
|
|||||||
|
|
||||||
def attach_extendable_generators(n, costs, ppl):
|
def attach_extendable_generators(n, costs, ppl):
|
||||||
elec_opts = snakemake.config['electricity']
|
elec_opts = snakemake.config['electricity']
|
||||||
carriers = list(elec_opts['extendable_carriers']['Generator'])
|
carriers = pd.Index(elec_opts['extendable_carriers']['Generator'])
|
||||||
assert set(carriers).issubset(['OCGT']), "Only OCGT plants as extendable generators allowed for now"
|
|
||||||
|
|
||||||
_add_missing_carriers_from_costs(n, costs, carriers)
|
_add_missing_carriers_from_costs(n, costs, carriers)
|
||||||
|
|
||||||
if 'OCGT' in carriers:
|
for tech in carriers:
|
||||||
|
suptech = tech.split('-')[0]
|
||||||
|
|
||||||
|
if suptech == 'OCGT':
|
||||||
ocgt = ppl.loc[ppl.Fueltype.isin(('OCGT', 'CCGT'))].groupby('bus', as_index=False).first()
|
ocgt = ppl.loc[ppl.Fueltype.isin(('OCGT', 'CCGT'))].groupby('bus', as_index=False).first()
|
||||||
n.madd('Generator', ocgt.index,
|
n.madd('Generator', ocgt.index,
|
||||||
bus=ocgt['bus'],
|
bus=ocgt['bus'],
|
||||||
carrier='OCGT',
|
carrier=tech,
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
p_nom=0.,
|
p_nom=0.,
|
||||||
capital_cost=costs.at['OCGT', 'capital_cost'],
|
capital_cost=costs.at['OCGT', 'capital_cost'],
|
||||||
marginal_cost=costs.at['OCGT', 'marginal_cost'],
|
marginal_cost=costs.at['OCGT', 'marginal_cost'],
|
||||||
efficiency=costs.at['OCGT', 'efficiency'])
|
efficiency=costs.at['OCGT', 'efficiency'])
|
||||||
|
else:
|
||||||
|
raise NotImplementedError(f"Adding extendable generators for carrier '{tech}' is not implemented, yet."
|
||||||
|
"Only OCGT are allowed at the moment.")
|
||||||
|
|
||||||
|
|
||||||
def attach_storage(n, costs):
|
def attach_storage(n, costs):
|
||||||
|
Loading…
Reference in New Issue
Block a user