adjust p_nom_max if existing larger
This commit is contained in:
parent
bbeb7af1a8
commit
332936bcec
@ -338,7 +338,12 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
|
|||||||
efficiency2=costs.at[key, 'efficiency-heat'],
|
efficiency2=costs.at[key, 'efficiency-heat'],
|
||||||
lifetime=lifetime_assets.loc[new_capacity.index]
|
lifetime=lifetime_assets.loc[new_capacity.index]
|
||||||
)
|
)
|
||||||
|
# check if existing capacities are larger than technical potential
|
||||||
|
existing_large = n.generators[n.generators["p_nom_min"] > n.generators["p_nom_max"]].index
|
||||||
|
if len(existing_large):
|
||||||
|
logger.warning(f"Existing capacities larger than technical potential for {existing_large},\
|
||||||
|
adjust technical potential to existing capacities")
|
||||||
|
n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[existing_large, "p_nom_min"]
|
||||||
|
|
||||||
def add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years, ashp_cop, gshp_cop, time_dep_hp_cop, costs, default_lifetime):
|
def add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years, ashp_cop, gshp_cop, time_dep_hp_cop, costs, default_lifetime):
|
||||||
"""
|
"""
|
||||||
@ -520,11 +525,11 @@ if __name__ == "__main__":
|
|||||||
snakemake = mock_snakemake(
|
snakemake = mock_snakemake(
|
||||||
'add_existing_baseyear',
|
'add_existing_baseyear',
|
||||||
simpl='',
|
simpl='',
|
||||||
clusters="37",
|
clusters="45",
|
||||||
lv=1.0,
|
lv=1.0,
|
||||||
opts='',
|
opts='',
|
||||||
sector_opts='800sn-T-H-B-I-A-solar+p3-dist1-co2min-1p7',
|
sector_opts='8760H-T-H-B-I-A-solar+p3-dist1',
|
||||||
planning_horizons=2030,
|
planning_horizons=2020,
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.basicConfig(level=snakemake.config['logging_level'])
|
logging.basicConfig(level=snakemake.config['logging_level'])
|
||||||
|
@ -23,10 +23,19 @@ def _add_land_use_constraint(n):
|
|||||||
#warning: this will miss existing offwind which is not classed AC-DC and has carrier 'offwind'
|
#warning: this will miss existing offwind which is not classed AC-DC and has carrier 'offwind'
|
||||||
|
|
||||||
for carrier in ['solar', 'onwind', 'offwind-ac', 'offwind-dc']:
|
for carrier in ['solar', 'onwind', 'offwind-ac', 'offwind-dc']:
|
||||||
existing = n.generators.loc[n.generators.carrier==carrier,"p_nom"].groupby(n.generators.bus.map(n.buses.location)).sum()
|
ext_i = (n.generators.carrier==carrier) & ~n.generators.p_nom_extendable
|
||||||
|
existing = n.generators.loc[ext_i,"p_nom"].groupby(n.generators.bus.map(n.buses.location)).sum()
|
||||||
existing.index += " " + carrier + "-" + snakemake.wildcards.planning_horizons
|
existing.index += " " + carrier + "-" + snakemake.wildcards.planning_horizons
|
||||||
n.generators.loc[existing.index,"p_nom_max"] -= existing
|
n.generators.loc[existing.index,"p_nom_max"] -= existing
|
||||||
|
|
||||||
|
# check if existing capacities are larger than technical potential
|
||||||
|
existing_large = n.generators[n.generators["p_nom_min"] > n.generators["p_nom_max"]].index
|
||||||
|
if len(existing_large):
|
||||||
|
logger.warning(f"Existing capacities larger than technical potential for {existing_large},\
|
||||||
|
adjust technical potential to existing capacities")
|
||||||
|
n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[existing_large, "p_nom_min"]
|
||||||
|
|
||||||
|
|
||||||
n.generators.p_nom_max.clip(lower=0, inplace=True)
|
n.generators.p_nom_max.clip(lower=0, inplace=True)
|
||||||
|
|
||||||
|
|
||||||
@ -241,18 +250,18 @@ def solve_network(n, config, opts="", **kwargs):
|
|||||||
return n
|
return n
|
||||||
|
|
||||||
|
|
||||||
|
#%%
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if 'snakemake' not in globals():
|
if 'snakemake' not in globals():
|
||||||
from helper import mock_snakemake
|
from helper import mock_snakemake
|
||||||
snakemake = mock_snakemake(
|
snakemake = mock_snakemake(
|
||||||
'solve_network',
|
'solve_network_myopic',
|
||||||
simpl='',
|
simpl='',
|
||||||
opts="",
|
opts="",
|
||||||
clusters="5",
|
clusters="45",
|
||||||
lv=1.0,
|
lv=1.0,
|
||||||
sector_opts='Co2L0-3H-T-H-B-I-A-solar+p3-dist1',
|
sector_opts='8760H-T-H-B-I-A-solar+p3-dist1',
|
||||||
planning_horizons="2050",
|
planning_horizons="2020",
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.basicConfig(filename=snakemake.log.python,
|
logging.basicConfig(filename=snakemake.log.python,
|
||||||
|
Loading…
Reference in New Issue
Block a user