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

Compatibility with PyPSA-Ariadne derivative #827

Merged
merged 23 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b9090c
add option for additional national carbon budget constraints
chrstphtrs Oct 18, 2023
a35f547
add links instead of equal-and-opposite fuel/emissions load pairs for…
chrstphtrs Oct 24, 2023
94afba7
add coal tech_color to config
chrstphtrs Oct 24, 2023
7cb677d
clean up function add_co2limit_country
chrstphtrs Oct 24, 2023
e2b2eaf
add geographical resolution to oil and methanol for options['co2_budg…
chrstphtrs Oct 24, 2023
2ad9ca8
add regionalised oil load for process emissions from naphtha as feeds…
chrstphtrs Oct 26, 2023
82ac430
fix spatial resolution for solid biomass links and naphtha oil loads …
chrstphtrs Nov 8, 2023
d9ec127
Add process emissions to country emissions constraint, fix snapshot w…
chrstphtrs Nov 21, 2023
e8324b9
fix bug when oil copper plated
lisazeyen Nov 24, 2023
3ff925e
add load shedding for all energy carriers
lisazeyen Nov 24, 2023
cea62de
solve_network: quick fix so duals can be read from CO2 constrain
nworbmot Dec 4, 2023
66178a5
solve_network: fix sign for country CO2 when bus0=atmosphere
nworbmot Dec 4, 2023
bbf9ca2
bug fix: naming of p_set when co2_national is True
nworbmot Dec 8, 2023
2d323d1
bug fix: ICE efficiency for land transport was applied twice
nworbmot Dec 8, 2023
00e86e6
bug fix: route process emissions from steam cracker to correct bus
nworbmot Dec 8, 2023
326ed63
add_brownfield: disable grid expansion if LV already hit
nworbmot Dec 8, 2023
830019a
add rule that allows cost data to be modified
nworbmot Dec 15, 2023
c5a123b
allow additional functionality for solving to be added by file
nworbmot Dec 15, 2023
1a7f093
solve: pass wildcards and config to additional_functionality
nworbmot Dec 15, 2023
b3753d7
undo addition of script to allow cost modifications
nworbmot Dec 20, 2023
8a55a55
copperplate oil/methanol supply; allow demand to be regional
nworbmot Dec 21, 2023
1b569dd
move code for national CO2 budgets out of extra_functionality
nworbmot Jan 2, 2024
f494dd8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 2, 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
3 changes: 3 additions & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ sector:
hydrogen_turbine: false
SMR: true
SMR_cc: true
regional_methanol_demand: false #set to true if regional CO2 constraints needed
regional_oil_demand: false #set to true if regional CO2 constraints needed
regional_co2_sequestration_potential:
enable: false
attribute: 'conservative estimate Mt'
Expand Down Expand Up @@ -799,6 +801,7 @@ plotting:
Coal: '#545454'
coal: '#545454'
Coal marginal: '#545454'
coal for industry: '#343434'
solid: '#545454'
Lignite: '#826837'
lignite: '#826837'
Expand Down
2 changes: 2 additions & 0 deletions rules/solve_myopic.smk
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ rule solve_sector_network_myopic:
co2_sequestration_potential=config["sector"].get(
"co2_sequestration_potential", 200
),
countries=config["countries"],
input:
network=RESULTS
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
costs="data/costs_{planning_horizons}.csv",
config=RESULTS + "config.yaml",
co2_totals_name=RESOURCES + "co2_totals.csv",
output:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
Expand Down
35 changes: 35 additions & 0 deletions scripts/add_brownfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,39 @@ def add_brownfield(n, n_p, year):
n.links.loc[new_pipes, "p_nom_min"] = 0.0


def disable_grid_expansion_if_LV_limit_hit(n):
if not "lv_limit" in n.global_constraints.index:
return

# calculate minimum LV
attr = "nom_min"
dc = n.links.index[n.links.carrier == "DC"]
tot = (n.lines["s_" + attr] * n.lines["length"]).sum() + (
n.links.loc[dc, "p_" + attr] * n.links.loc[dc, "length"]
).sum()

diff = n.global_constraints.at["lv_limit", "constant"] - tot

# allow small numerical differences
limit = 1

if diff < limit:
logger.info(
f"LV is already reached (gap {diff}), disabling expansion and LV limit"
)
expandable_acs = n.lines.index[n.lines.s_nom_extendable]
n.lines.loc[expandable_acs, "s_nom_extendable"] = False
n.lines.loc[expandable_acs, "s_nom"] = n.lines.loc[expandable_acs, "s_nom_min"]

expandable_dcs = n.links.index[
n.links.p_nom_extendable & (n.links.carrier == "DC")
]
n.links.loc[expandable_dcs, "p_nom_extendable"] = False
n.links.loc[expandable_dcs, "p_nom"] = n.links.loc[expandable_dcs, "p_nom_min"]

n.global_constraints.drop("lv_limit", inplace=True)


if __name__ == "__main__":
if "snakemake" not in globals():
from _helpers import mock_snakemake
Expand Down Expand Up @@ -150,5 +183,7 @@ def add_brownfield(n, n_p, year):

add_brownfield(n, n_p, year)

disable_grid_expansion_if_LV_limit_hit(n)

n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))
n.export_to_netcdf(snakemake.output[0])
2 changes: 1 addition & 1 deletion scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
else:
bus0 = vars(spatial)[carrier[generator]].nodes
if "EU" not in vars(spatial)[carrier[generator]].locations:
bus0 = bus0.intersection(capacity.index + " gas")
bus0 = bus0.intersection(capacity.index + " " + carrier[generator])

# check for missing bus
missing_bus = pd.Index(bus0).difference(n.buses.index)
Expand Down
Loading