Hey Marissa,
that's a good question. Form the pure config side this is not
possible. You could make a work-around and modify
attach_conventional_generators in add_electricity.py such that for
carrier == 'OCGT' or 'CCGT' ensure
p_nom_min = ppl.p_nom,
p_nom_extendable = True,
capital_cost=costs.at[carrier, 'capital_cost'],
marginal_cost=costs.at[carrier, 'marginal_cost'],
--
You received this message because you are subscribed to the Google Groups "pypsa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pypsa+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pypsa/6b97a7be-be07-4faa-a0e6-aa1ba3a1d4bcn%40googlegroups.com.


You received this message because you are subscribed to a topic in the Google Groups "pypsa" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pypsa/NYZCqUToweE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pypsa+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pypsa/d66d1657-70fe-dd73-edbd-a3dd60ce4809%40gmail.com.
Hi Fabian,
I believe that I was able to fix the error in my previous post. In order to do so, I had to make a small change in the PyPSA code. This was needed to be able to add the p_nom_min of the existing installed capacities for the conventional generators that I would like to allow to extend above the capacities given in the powerplant database. In the networkclustering.py script, I had to add “‘p_nom_min’:np.sum” to the strategies, as shown in the following block of code:
def normed_or_uniform(x):
return x/x.sum() if x.sum(skipna=False) > 0 else pd.Series(1./len(x), x.index)
weighting = generators.weight.groupby(grouper, axis=0).transform(normed_or_uniform)
generators['capital_cost'] *= weighting
strategies = {'p_nom_max': np.min, 'p_nom_min': np.sum, 'weight': np.sum, 'p_nom': np.sum, 'capital_cost': np.sum}
strategies.update(custom_strategies)
if strategies['p_nom_max'] is np.min:
generators['p_nom_max'] /= weighting
In addition, I edited the add_electricity script to attach the extendable conventional generators. To do so, I added a new variable to the config file “conventional_extendable_carriers", added the code below to defined “attach_conventional_extendable_generators”, and of course add "attach_conventional_extendable_generators(n, costs, ppl)" to the bottom of the add_electricity.py script.
Coded added to add_electricity.py to included extendable conventional generators:
def attach_conventional_extendable_generators(n, costs, ppl):
carriers = snakemake.config['electricity']['conventional_extendable_carriers']
_add_missing_carriers_from_costs(n, costs, carriers)
ppl = (ppl.query('carrier in @carriers').join(costs, on='carrier')
.rename(index=lambda s: 'C' + str(s)))
ccgt = ppl.query('carrier == "CCGT"')
ocgt = ppl.query('carrier == "OCGT"')
nuclear = ppl.query('carrier == "nuclear"')
biomass = ppl.query('carrier == "biomass"')
logger.info('Adding {} generators as extendable generators with minimum capacities\n{}'
.format(len(ppl), ppl.groupby('carrier').p_nom.sum()))
if 'CCGT' in carriers:
n.madd("Generator", ccgt.index,
carrier=ccgt.carrier,
bus=ccgt.bus,
p_nom=ccgt.p_nom,
p_nom_min=ccgt.p_nom,
p_nom_extendable=True,
efficiency=ccgt.efficiency,
marginal_cost=costs.at['CCGT', 'marginal_cost'],
capital_cost=costs.at['CCGT', 'capital_cost'])
if 'OCGT' in carriers:
n.madd("Generator", ocgt.index,
carrier=ocgt.carrier,
bus=ocgt.bus,
p_nom=ocgt.p_nom,
p_nom_min=ocgt.p_nom,
p_nom_extendable=True,
efficiency=ocgt.efficiency,
marginal_cost=costs.at['OCGT', 'marginal_cost'],
capital_cost=costs.at['OCGT', 'capital_cost'])
if 'nuclear' in carriers:
n.madd("Generator", nuclear.index,
carrier=nuclear.carrier,
bus=nuclear.bus,
p_nom=nuclear.p_nom,
p_nom_min=nuclear.p_nom,
p_nom_extendable=True,
efficiency=nuclear.efficiency,
marginal_cost=costs.at['nuclear', 'marginal_cost'],
capital_cost=costs.at['nuclear', 'capital_cost'])
if 'biomass' in carriers:
n.madd("Generator", biomass.index,
carrier=biomass.carrier,
bus=biomass.bus,
p_nom=biomass.p_nom,
p_nom_min=biomass.p_nom,
p_nom_extendable=True,
efficiency=biomass.efficiency,
marginal_cost=costs.at['biomass', 'marginal_cost'],
capital_cost=costs.at['biomass', 'capital_cost'])attach_conventional_extendable_generators(n, costs, ppl)
I am not sure if this is a correct way to do it, but it seems to be working for me so far.
Best,
Marissa