Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bioenergy stores with generators #1372

Open
wants to merge 51 commits into
base: ariadne2
Choose a base branch
from
Open
Changes from 4 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7798e12
feat: add temperature reduction to workflow
amos-schledorn Sep 12, 2024
c252d17
chore: fix name change issues
amos-schledorn Sep 12, 2024
a83909c
feat: update input/output of dependent rules
amos-schledorn Sep 12, 2024
31e6e3a
feat: add {planning _horizons} wildcard to COP input in myopic rules
amos-schledorn Sep 12, 2024
85656c0
fix: exponential temperature reduction
amos-schledorn Sep 12, 2024
881cf01
feat: add {planning_horizons} wildcard to solve_perfect
amos-schledorn Sep 12, 2024
cdfcf23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2024
69cad8e
style: "_today" -> "_baseyear"
amos-schledorn Sep 12, 2024
39ae475
doc: update configtables
amos-schledorn Sep 12, 2024
d5c6135
style: "_today" -> "_baseyear" (config)
amos-schledorn Sep 12, 2024
6c112e3
Merge remote-tracking branch 'origin/annual-temperature-reduction' in…
amos-schledorn Sep 12, 2024
a109899
feat: update heat pump efficiency in add_brownfield
amos-schledorn Sep 13, 2024
d218a08
Merge remote-tracking branch 'origin/master' into annual-temperature-…
amos-schledorn Sep 17, 2024
a5be8b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 17, 2024
7bf57ad
fix: pass planning_horizons to add_brownfield
amos-schledorn Sep 17, 2024
94d628f
Merge branch 'master' into annual-temperature-reduction
amos-schledorn Sep 17, 2024
8871a2d
feat: update COPs for perfect foresight
amos-schledorn Sep 17, 2024
4107e31
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 17, 2024
30f7dce
update release notes
amos-schledorn Sep 17, 2024
bf87e8c
Merge remote-tracking branch 'origin/annual-temperature-reduction' in…
amos-schledorn Sep 17, 2024
635d3d6
Update doc/release_notes.rst
amos-schledorn Sep 30, 2024
f1f0d20
Update scripts/build_central_heating_temperature_profiles/run.py
amos-schledorn Sep 30, 2024
ecbb228
Update scripts/build_central_heating_temperature_profiles/run.py
amos-schledorn Sep 30, 2024
bdf1d7d
Merge branch 'master' into annual-temperature-reduction
amos-schledorn Sep 30, 2024
85a878b
Update build_central_heating_temperature_profiles.run
amos-schledorn Sep 30, 2024
b27227f
style: simplify update_heat_pump_efficiency functions
amos-schledorn Sep 30, 2024
a9853b0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 30, 2024
9950384
Merge branch 'master' into annual-temperature-reduction
amos-schledorn Oct 1, 2024
5095a74
Update README.md
fneum Oct 8, 2024
267e540
[pre-commit.ci] pre-commit autoupdate (#1352)
pre-commit-ci[bot] Oct 10, 2024
2e6132c
Merge branch 'master' into annual-temperature-reduction
fneum Oct 10, 2024
b9416ae
transmission_projects: update AC line types to high-temperature lines…
p-glaum Oct 10, 2024
6dd41b8
Bugfix of solar constraint in post discretization (#1343)
toniseibold Oct 10, 2024
5402088
Merge pull request #1290 from PyPSA/annual-temperature-reduction
amos-schledorn Oct 10, 2024
5fa8007
Update NEP DC20 to underground
nworbmot Oct 13, 2024
4435f02
fix: remove broken pre-commit rule (docformatter) (#1362)
lkstrp Oct 15, 2024
0e0191a
prepare for pypsa `0.31.0` (#1340)
lkstrp Oct 15, 2024
be83b59
[github-actions.ci] Update fixed environment (#1363)
github-actions[bot] Oct 15, 2024
0026b0f
fix: more robust `progress_retrieve` (#1361)
lkstrp Oct 16, 2024
236a1fb
replace bioenergy stores with generators
cpschau Sep 27, 2024
006eb3c
fix values to ensure feasibility
cpschau Oct 18, 2024
029ff85
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2024
9edf5b1
replace bioenergy stores with generators
cpschau Sep 27, 2024
9bb42c8
fix values to ensure feasibility
cpschau Oct 18, 2024
f7dad98
represent other bioenergy and msw sources as generators
cpschau Oct 18, 2024
eded450
fix spatial variable for biogas
cpschau Oct 18, 2024
51f651c
fix virtual msw transport bug
cpschau Oct 18, 2024
adcf3d3
make operational limit for msw work
cpschau Oct 18, 2024
42c262e
Merge branch 'ariadne2' into e_sum_generators
lindnemi Oct 22, 2024
39b154f
fix bioliquids potential resolution
cpschau Oct 25, 2024
5237167
Merge remote-tracking branch 'origin/replace_stores_gens' into e_sum_…
lindnemi Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 26 additions & 37 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2888,38 +2888,29 @@ def add_biomass(n, costs):
)

if biomass_potentials.filter(like="unsustainable").sum().sum() > 0:
# Create timeseries to force usage of unsustainable potentials
e_max_pu = pd.DataFrame(1, index=n.snapshots, columns=spatial.biogas.nodes)
e_max_pu.iloc[-1] = 0

n.add(
"Store",
"Generator",
spatial.biogas.nodes,
suffix=" unsustainable",
bus=spatial.biogas.nodes,
carrier="unsustainable biogas",
e_nom=unsustainable_biogas_potentials_spatial,
p_nom=unsustainable_biogas_potentials_spatial,
p_nom_extendable=False,
marginal_cost=costs.at["biogas", "fuel"],
e_initial=unsustainable_biogas_potentials_spatial,
e_nom_extendable=False,
e_max_pu=e_max_pu,
e_sum_min=unsustainable_biogas_potentials_spatial,
e_sum_max=unsustainable_biogas_potentials_spatial,
)

e_max_pu = pd.DataFrame(
1, index=n.snapshots, columns=spatial.biomass.nodes_unsustainable
)
e_max_pu.iloc[-1] = 0

n.add(
"Store",
"Generator",
spatial.biomass.nodes_unsustainable,
bus=spatial.biomass.nodes,
carrier="unsustainable solid biomass",
e_nom=unsustainable_solid_biomass_potentials_spatial,
p_nom=unsustainable_solid_biomass_potentials_spatial,
p_nom_extendable=False,
marginal_cost=costs.at["fuelwood", "fuel"],
e_initial=unsustainable_solid_biomass_potentials_spatial,
e_nom_extendable=False,
e_max_pu=e_max_pu,
e_sum_min=unsustainable_solid_biomass_potentials_spatial,
e_sum_max=unsustainable_solid_biomass_potentials_spatial,
)

n.add(
Expand All @@ -2930,21 +2921,16 @@ def add_biomass(n, costs):
unit="MWh_LHV",
)

e_max_pu = pd.DataFrame(
1, index=n.snapshots, columns=spatial.biomass.bioliquids
)
e_max_pu.iloc[-1] = 0

n.add(
"Store",
"Generator",
spatial.biomass.bioliquids,
bus=spatial.biomass.bioliquids,
carrier="unsustainable bioliquids",
e_nom=unsustainable_liquid_biofuel_potentials_spatial,
p_nom=unsustainable_liquid_biofuel_potentials_spatial,
p_nom_extendable=False,
marginal_cost=costs.at["biodiesel crops", "fuel"],
e_initial=unsustainable_liquid_biofuel_potentials_spatial,
e_nom_extendable=False,
e_max_pu=e_max_pu,
e_sum_min=unsustainable_liquid_biofuel_potentials_spatial,
e_sum_max=unsustainable_liquid_biofuel_potentials_spatial,
)

add_carrier_buses(n, "oil")
Expand Down Expand Up @@ -3071,6 +3057,7 @@ def add_biomass(n, costs):
n.add(
"Generator",
spatial.biomass.nodes,
suffix=" transported",
bus=spatial.biomass.nodes,
carrier="solid biomass",
p_nom=10000,
Expand All @@ -3089,6 +3076,7 @@ def add_biomass(n, costs):
n.add(
"Generator",
spatial.biomass.nodes_unsustainable,
suffix=" transported",
bus=spatial.biomass.nodes,
carrier="unsustainable solid biomass",
p_nom=10000,
Expand All @@ -3100,14 +3088,15 @@ def add_biomass(n, costs):
)
* average_distance,
)
# Set last snapshot of e_max_pu for unsustainable solid biomass to 1 to make operational limit work
unsus_stores_idx = n.stores.query(
"carrier == 'unsustainable solid biomass'"
).index
unsus_stores_idx = unsus_stores_idx.intersection(
n.stores_t.e_max_pu.columns
)
n.stores_t.e_max_pu.loc[n.snapshots[-1], unsus_stores_idx] = 1
# Set e_sum_min to 0 to allow for the faux biomass transport
n.generators.loc[
n.generators.carrier == "unsustainable solid biomass", "e_sum_min"
] = 0
# Set e_sum_max to the potential to limit the faux biomass transport
n.generators.loc[
n.generators.carrier == "unsustainable solid biomass", "e_sum_max"
] = unsustainable_solid_biomass_potentials_spatial.sum()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the right constraint. There is one generator for every bus, and if every bus has access to the sum of the total potential wouldn't we get n_buses * total_potential of import capacity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see, the GlobalConstraint is just below and remains there. Then the questions if, if this e_sum_max constraint is still needed or only a duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right that it is not only redundant, but actually false. The e_sum_max set at the original generator intialization in

e_sum_max=unsustainable_solid_biomass_potentials_spatial,
should remain. All the generation needed beyond that local limit must be provided by the other "artifical" generator, that also takes into account the transport costs.


n.add(
"GlobalConstraint",
"unsustainable biomass limit",
Expand Down