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

Biomass transport #73

Merged
merged 31 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2b9ac51
update mocksnakemake for testing
lisazeyen Oct 20, 2020
b4f1c57
move input data path for emobility/transport data to snakemake input
lisazeyen Oct 20, 2020
cdaa458
Snakefile: add transport input data to rule prepare_sector_network
lisazeyen Oct 20, 2020
50b4e82
config: add missing color for industry electricity
lisazeyen Oct 20, 2020
2dd97c3
Snakefile: add path to biomass transport cost in rule prepare_sector_…
lisazeyen Oct 20, 2020
651a7ff
add biomass transport, split potential for solid biomass to nodes, ad…
lisazeyen Oct 20, 2020
3944e19
config.yaml: add color for biomass transport
lisazeyen Oct 20, 2020
ae9c0d9
prepare_sector_network: split industry demand for biomass to single n…
lisazeyen Oct 20, 2020
13cae7d
drop nan values to avoid runtime error when removing todays electric…
lisazeyen Oct 20, 2020
b4fbb47
fix bug when adding biomass industry demand, add option to remove bio…
lisazeyen Oct 21, 2020
4f2135a
add option for solid biomass transport
lisazeyen Oct 21, 2020
846f57f
add script for biomass transport costs. Converts JRC-EU-Times transpo…
lisazeyen Jun 11, 2021
fa8f788
Update scripts/prepare_sector_network.py
fneum Jul 2, 2021
4ebbd29
apply suggestions from code review
fneum Jul 2, 2021
e97c4dd
merge master
fneum Jul 2, 2021
fd1121a
add rule for build_biomass_transport_costs
fneum Jul 2, 2021
d1298fa
use spatial namespace to manage biomass transport resolution
fneum Jul 12, 2021
3f43656
call define_spatial
fneum Jul 12, 2021
dd0ab87
Merge pull request #152 from PyPSA/biomass-transport-rev
lisazeyen Jul 13, 2021
ba9be74
make build_biomass_transport_costs fully optional
fneum Aug 4, 2021
0da8f8f
Merge branch 'master' into biomass-transport
fneum Aug 6, 2021
d428c1b
fix syntax and auto-retrieve biomass transport cost
fneum Aug 9, 2021
6711d72
biomass_transport: fix cost calculation and get from remote
fneum Aug 9, 2021
3eb404f
biomass_transport: correct and simplify spatial management
fneum Aug 9, 2021
7ca4f04
biomass_transport: reduce output files
fneum Aug 9, 2021
edf3a5f
biomass_transport: clarify meaning in config
fneum Aug 9, 2021
928d1f2
biomass_transport: improve spatial biomass potential handling
fneum Aug 9, 2021
12f385e
biomass_transport: simplify read-in
fneum Aug 9, 2021
2e2a66e
biomass_transport: add release notes and documentation
fneum Aug 9, 2021
b391aa6
Update build_biomass_transport_costs.py
lisazeyen Sep 24, 2021
385779f
Merge branch 'master' into biomass-transport
fneum Sep 28, 2021
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
17 changes: 15 additions & 2 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ rule build_biomass_potentials:
script: 'scripts/build_biomass_potentials.py'


rule build_biomass_transport_costs:
input: "data/biomass/biomass potentials in europe_web rev.pdf"
output:
supply_chain1="resources/biomass_transport_costs_supply_chain1.csv",
supply_chain2="resources/biomass_transport_costs_supply_chain2.csv",
transport_costs="resources/biomass_transport_costs.csv",
threads: 1
resources: mem_mb=1000
benchmark: "benchmarks/build_biomass_transport_costs"
script: 'scripts/build_biomass_transport_costs.py'


rule build_ammonia_production:
input:
usgs="data/myb1-2017-nitro.xls"
Expand Down Expand Up @@ -321,9 +333,10 @@ rule prepare_sector_network:
energy_totals_name='resources/energy_totals.csv',
co2_totals_name='resources/co2_totals.csv',
transport_name='resources/transport_data.csv',
traffic_data_KFZ = "data/emobility/KFZ__count",
traffic_data_Pkw = "data/emobility/Pkw__count",
traffic_data_KFZ="data/emobility/KFZ__count",
traffic_data_Pkw="data/emobility/Pkw__count",
biomass_potentials='resources/biomass_potentials.csv',
biomass_transport="resources/biomass_transport_costs.csv",
heat_profile="data/heat_load_profile_BDEW.csv",
costs=CDIR + "costs_{planning_horizons}.csv",
profile_offwind_ac=pypsaeur("resources/profile_offwind-ac.nc"),
Expand Down
3 changes: 2 additions & 1 deletion config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ sector:
electricity_grid_connection: true # only applies to onshore wind and utility PV
gas_distribution_grid: true
gas_distribution_grid_cost_factor: 1.0 #multiplies cost in data/costs.csv
biomass_transport: false # biomass potential per country + transport between countries
conventional_generation: # generator : carrier
OCGT: gas

Expand All @@ -241,7 +242,6 @@ industry:
hotmaps_locate_missing: false
reference_year: 2015


costs:
lifetime: 25 #default lifetime
# From a Lion Hirth paper, also reflects average of Noothout et al 2016
Expand Down Expand Up @@ -471,3 +471,4 @@ plotting:
today: '#D2691E'
shipping: '#6495ED'
electricity distribution grid: '#333333'
solid biomass transport: green
70 changes: 70 additions & 0 deletions scripts/build_biomass_transport_costs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""
Reads biomass transport costs for different countries of the JRC report

"The JRC-EU-TIMES model.
Bioenergy potentials
for EU and neighbouring countries."
(2015)

converts them from units 'EUR per km/ton' -> 'EUR/ (km MWh)'

assuming as an approximation energy content of wood pellets

@author: bw0928
"""

import pandas as pd
import tabula as tbl

ENERGY_CONTENT = 4.8 # unit MWh/tonne (assuming wood pellets)


def build_biomass_transport_costs():

df_list = tbl.read_pdf(
snakemake.input[0],
pages="145-147",
multiple_tables=True,
)

countries = df_list[0][0].iloc[6:].rename(index=lambda x: x + 1)

# supply chain 1
df = df_list[1].copy().rename(index=countries.to_dict())
df.rename(
columns=df.iloc[:6].apply(lambda col: col.str.cat(sep=" "), axis=0).to_dict(),
inplace=True,
)
df = df.iloc[6:]
df.loc[6] = df.loc[6].str.replace("€", "EUR")

# supply chain 2
df2 = df_list[2].copy().rename(index=countries.to_dict())
df2.rename(
columns=df2.iloc[:6].apply(lambda col: col.str.cat(sep=" "), axis=0).to_dict(),
inplace=True,
)
df2 = df2.iloc[6:]
df2.loc[6] = df2.loc[6].str.replace("€", "EUR")

df.to_csv(snakemake.output.supply_chain1)
df2.to_csv(snakemake.output.supply_chain1)

transport_costs = pd.concat([df["per km/ton"], df2["per km/ton"]], axis=1).drop(6)
transport_costs = transport_costs.astype(float, errors="ignore").mean(axis=1)

# convert unit to EUR/MWh
transport_costs /= ENERGY_CONTENT
transport_costs = pd.DataFrame(transport_costs, columns=["cost [EUR/(km MWh)]"])

# rename
transport_costs.rename({"UK": "GB", "XK": "KO", "EL": "GR"}, inplace=True)

# add missing Norway
transport_costs.loc["NO"] = transport_costs.loc["SE"]
transport_costs.to_csv(snakemake.output.transport_costs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I got an error here, I would suggest to change it to:
transport_costs.to_csv(snakemake.output[0])



if __name__ == "__main__":

prepare_biomass_transport_costs()
Loading