Skip to content

Commit

Permalink
Merge pull request #791 from PyPSA/heat-vent
Browse files Browse the repository at this point in the history
add heat vent
  • Loading branch information
lisazeyen authored Dec 4, 2023
2 parents bbc31f4 + b8e7268 commit 35f2f29
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 2 additions & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ sector:
coal_cc: false
dac: true
co2_vent: false
central_heat_vent: false
allam_cycle: false
hydrogen_fuel_cell: true
hydrogen_turbine: false
Expand Down Expand Up @@ -878,6 +879,7 @@ plotting:
services rural heat: '#ff9c9c'
central heat: '#cc1f1f'
urban central heat: '#d15959'
urban central heat vent: '#a74747'
decentral heat: '#750606'
residential urban decentral heat: '#a33c3c'
services urban decentral heat: '#cc1f1f'
Expand Down
3 changes: 3 additions & 0 deletions config/test/config.myopic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ snapshots:
start: "2013-03-01"
end: "2013-03-08"

sector:
central_heat_vent: true

electricity:
co2limit: 100.e+6

Expand Down
1 change: 1 addition & 0 deletions config/test/config.perfect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ electricity:
sector:
min_part_load_fischer_tropsch: 0
min_part_load_methanolisation: 0

atlite:
default_cutout: be-03-2013-era5
cutouts:
Expand Down
21 changes: 16 additions & 5 deletions scripts/make_summary_perfect.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
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):
investments = n.investment_periods
cols = pd.MultiIndex.from_product(
Expand All @@ -39,7 +49,8 @@ def calculate_costs(n, label, costs):
],
names=costs.columns.names[:3] + ["year"],
)
costs = costs.reindex(cols, axis=1)

costs = reindex_columns(costs, cols)

for c in n.iterate_components(
n.branch_components | n.controllable_one_port_components ^ {"Load"}
Expand Down Expand Up @@ -176,7 +187,7 @@ def calculate_capacities(n, label, capacities):
],
names=capacities.columns.names[:3] + ["year"],
)
capacities = capacities.reindex(cols, axis=1)
capacities = reindex_columns(capacities, cols)

for c in n.iterate_components(
n.branch_components | n.controllable_one_port_components ^ {"Load"}
Expand Down Expand Up @@ -229,7 +240,7 @@ def calculate_energy(n, label, energy):
],
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):
if c.name in n.one_port_components:
Expand Down Expand Up @@ -336,7 +347,7 @@ def calculate_supply_energy(n, label, supply_energy):
],
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()

Expand Down Expand Up @@ -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["standard_deviation", label] = (
n.buses_t.marginal_price[buses].droplevel(0).unstack().std()
n.buses_t.marginal_price[buses].std().std()
)

return price_statistics
Expand Down
12 changes: 12 additions & 0 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,18 @@ def add_heat(n, costs):
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

for sector in sectors:
Expand Down

0 comments on commit 35f2f29

Please sign in to comment.