Merge branch 'master' of github.com:PyPSA/pypsa-eur

This commit is contained in:
Fabian Neumann 2023-12-04 14:39:33 +01:00
commit 3b20b5c642
5 changed files with 34 additions and 5 deletions

View File

@ -451,6 +451,7 @@ sector:
coal_cc: false coal_cc: false
dac: true dac: true
co2_vent: false co2_vent: false
central_heat_vent: false
allam_cycle: false allam_cycle: false
hydrogen_fuel_cell: true hydrogen_fuel_cell: true
hydrogen_turbine: false hydrogen_turbine: false
@ -878,6 +879,7 @@ plotting:
services rural heat: '#ff9c9c' services rural heat: '#ff9c9c'
central heat: '#cc1f1f' central heat: '#cc1f1f'
urban central heat: '#d15959' urban central heat: '#d15959'
urban central heat vent: '#a74747'
decentral heat: '#750606' decentral heat: '#750606'
residential urban decentral heat: '#a33c3c' residential urban decentral heat: '#a33c3c'
services urban decentral heat: '#cc1f1f' services urban decentral heat: '#cc1f1f'

View File

@ -30,6 +30,9 @@ snapshots:
start: "2013-03-01" start: "2013-03-01"
end: "2013-03-08" end: "2013-03-08"
sector:
central_heat_vent: true
electricity: electricity:
co2limit: 100.e+6 co2limit: 100.e+6

View File

@ -44,6 +44,7 @@ electricity:
sector: sector:
min_part_load_fischer_tropsch: 0 min_part_load_fischer_tropsch: 0
min_part_load_methanolisation: 0 min_part_load_methanolisation: 0
atlite: atlite:
default_cutout: be-03-2013-era5 default_cutout: be-03-2013-era5
cutouts: cutouts:

View File

@ -28,6 +28,16 @@ idx = pd.IndexSlice
opt_name = {"Store": "e", "Line": "s", "Transformer": "s"} opt_name = {"Store": "e", "Line": "s", "Transformer": "s"}
def reindex_columns(df, cols):
investments = cols.levels[3]
if len(cols.names) != len(df.columns.levels):
df = pd.concat([df] * len(investments), axis=1)
df.columns = cols
df = df.reindex(cols, axis=1)
return df
def calculate_costs(n, label, costs): def calculate_costs(n, label, costs):
investments = n.investment_periods investments = n.investment_periods
cols = pd.MultiIndex.from_product( cols = pd.MultiIndex.from_product(
@ -39,7 +49,8 @@ def calculate_costs(n, label, costs):
], ],
names=costs.columns.names[:3] + ["year"], names=costs.columns.names[:3] + ["year"],
) )
costs = costs.reindex(cols, axis=1)
costs = reindex_columns(costs, cols)
for c in n.iterate_components( for c in n.iterate_components(
n.branch_components | n.controllable_one_port_components ^ {"Load"} n.branch_components | n.controllable_one_port_components ^ {"Load"}
@ -176,7 +187,7 @@ def calculate_capacities(n, label, capacities):
], ],
names=capacities.columns.names[:3] + ["year"], names=capacities.columns.names[:3] + ["year"],
) )
capacities = capacities.reindex(cols, axis=1) capacities = reindex_columns(capacities, cols)
for c in n.iterate_components( for c in n.iterate_components(
n.branch_components | n.controllable_one_port_components ^ {"Load"} n.branch_components | n.controllable_one_port_components ^ {"Load"}
@ -229,7 +240,7 @@ def calculate_energy(n, label, energy):
], ],
names=energy.columns.names[:3] + ["year"], names=energy.columns.names[:3] + ["year"],
) )
energy = energy.reindex(cols, axis=1) energy = reindex_columns(energy, cols)
for c in n.iterate_components(n.one_port_components | n.branch_components): for c in n.iterate_components(n.one_port_components | n.branch_components):
if c.name in n.one_port_components: if c.name in n.one_port_components:
@ -336,7 +347,7 @@ def calculate_supply_energy(n, label, supply_energy):
], ],
names=supply_energy.columns.names[:3] + ["year"], names=supply_energy.columns.names[:3] + ["year"],
) )
supply_energy = supply_energy.reindex(cols, axis=1) supply_energy = reindex_columns(supply_energy, cols)
bus_carriers = n.buses.carrier.unique() bus_carriers = n.buses.carrier.unique()
@ -604,7 +615,7 @@ def calculate_price_statistics(n, label, price_statistics):
price_statistics.at["mean", label] = n.buses_t.marginal_price[buses].mean().mean() price_statistics.at["mean", label] = n.buses_t.marginal_price[buses].mean().mean()
price_statistics.at["standard_deviation", label] = ( price_statistics.at["standard_deviation", label] = (
n.buses_t.marginal_price[buses].droplevel(0).unstack().std() n.buses_t.marginal_price[buses].std().std()
) )
return price_statistics return price_statistics

View File

@ -1693,6 +1693,18 @@ def add_heat(n, costs):
unit="MWh_th", unit="MWh_th",
) )
if name == "urban central" and options.get("central_heat_vent"):
n.madd(
"Generator",
nodes[name] + f" {name} heat vent",
location=nodes[name],
carrier=name + " heat vent",
p_nom_extendable=True,
p_max_pu=0,
p_min_pu=-1,
unit="MWh_th",
)
## Add heat load ## Add heat load
for sector in sectors: for sector in sectors: