1
|
|
|
""" |
2
|
|
|
Heavy Duty Transport / Heavy Goods Vehicle (HGV) |
3
|
|
|
|
4
|
|
|
Main module for preparation of model data (static and timeseries) for |
5
|
|
|
heavy duty transport. |
6
|
|
|
|
7
|
|
|
**Contents of this module** |
8
|
|
|
* Creation of DB tables |
9
|
|
|
* Download and preprocessing of vehicle registration data from BAST |
10
|
|
|
* Calculation of hydrogen demand based on a Voronoi distribution of counted |
11
|
|
|
truck traffic among NUTS 3 regions. |
12
|
|
|
* Write results to DB |
13
|
|
|
* Map demand to H2 buses and write to DB |
14
|
|
|
|
15
|
|
|
**Configuration** |
16
|
|
|
|
17
|
|
|
The config of this dataset can be found in *datasets.yml* in section |
18
|
|
|
*mobility_hgv*. |
19
|
|
|
|
20
|
|
|
**Scenarios and variations** |
21
|
|
|
|
22
|
|
|
Assumptions can be changed within the *datasets.yml*. |
23
|
|
|
|
24
|
|
|
In the context of the eGon project, it is assumed that e-trucks will be |
25
|
|
|
completely hydrogen-powered and in both scenarios the hydrogen consumption is |
26
|
|
|
assumed to be 6.68 kgH2 per 100 km with an additional |
27
|
|
|
[supply chain leakage rate of 0.5 %]( |
28
|
|
|
https://www.energy.gov/eere/fuelcells/doe-technical-targets-hydrogen-delivery). |
29
|
|
|
|
30
|
|
|
### Scenario NEP C 2035 |
31
|
|
|
|
32
|
|
|
The ramp-up figures are taken from |
33
|
|
|
[Scenario C 2035 Grid Development Plan 2021-2035]( |
34
|
|
|
https://www.netzentwicklungsplan.de/sites/default/files/paragraphs-files/ |
35
|
|
|
NEP_2035_V2021_2_Entwurf_Teil1.pdf). According to this, 100,000 e-trucks are |
36
|
|
|
expected in Germany in 2035, each covering an average of 100,000 km per year. |
37
|
|
|
In total this means 10 Billion km. |
38
|
|
|
|
39
|
|
|
### Scenario eGon100RE |
40
|
|
|
|
41
|
|
|
In the case of the eGon100RE scenario it is assumed that the HGV traffic is |
42
|
|
|
completely hydrogen-powered. The total freight traffic with 40 Billion km is |
43
|
|
|
taken from the |
44
|
|
|
[BMWk Langfristszenarien GHG-emission free scenarios (SNF > 12 t zGG)]( |
45
|
|
|
https://www.langfristszenarien.de/enertile-explorer-wAssets/docs/ |
46
|
|
|
LFS3_Langbericht_Verkehr_final.pdf#page=17). |
47
|
|
|
|
48
|
|
|
## Methodology |
49
|
|
|
|
50
|
|
|
Using a Voronoi interpolation, the censuses of the BASt data is distributed |
51
|
|
|
according to the area fractions of the Voronoi fields within each mv grid or |
52
|
|
|
any other geometries like NUTS-3. |
53
|
|
|
""" |
54
|
|
|
from pathlib import Path |
55
|
|
|
import csv |
56
|
|
|
|
57
|
|
|
from loguru import logger |
58
|
|
|
import requests |
59
|
|
|
|
60
|
|
|
from egon.data import config, db |
61
|
|
|
from egon.data.datasets import Dataset |
62
|
|
|
from egon.data.datasets.emobility.heavy_duty_transport.create_h2_buses import ( |
63
|
|
|
insert_hgv_h2_demand, |
64
|
|
|
) |
65
|
|
|
from egon.data.datasets.emobility.heavy_duty_transport.db_classes import ( |
66
|
|
|
EgonHeavyDutyTransportVoronoi, |
67
|
|
|
) |
68
|
|
|
from egon.data.datasets.emobility.heavy_duty_transport.h2_demand_distribution import ( # noqa: E501 |
69
|
|
|
run_egon_truck, |
70
|
|
|
) |
71
|
|
|
|
72
|
|
|
WORKING_DIR = Path(".", "heavy_duty_transport").resolve() |
73
|
|
|
DATASET_CFG = config.datasets()["mobility_hgv"] |
74
|
|
|
TESTMODE_OFF = ( |
75
|
|
|
config.settings()["egon-data"]["--dataset-boundary"] == "Everything" |
76
|
|
|
) |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
def create_tables(): |
80
|
|
|
engine = db.engine() |
81
|
|
|
EgonHeavyDutyTransportVoronoi.__table__.drop(bind=engine, checkfirst=True) |
82
|
|
|
EgonHeavyDutyTransportVoronoi.__table__.create( |
83
|
|
|
bind=engine, checkfirst=True |
84
|
|
|
) |
85
|
|
|
|
86
|
|
|
logger.debug("Created tables.") |
87
|
|
|
|
88
|
|
|
|
89
|
|
|
def download_hgv_data(): |
90
|
|
|
sources = DATASET_CFG["original_data"]["sources"] |
91
|
|
|
|
92
|
|
|
# Create the folder, if it does not exist |
93
|
|
|
WORKING_DIR.mkdir(parents=True, exist_ok=True) |
94
|
|
|
|
95
|
|
|
url = sources["BAST"]["url"] |
96
|
|
|
file = WORKING_DIR / sources["BAST"]["file"] |
97
|
|
|
|
98
|
|
|
response = requests.get(url) |
99
|
|
|
|
100
|
|
|
with open(file, "w") as f: |
101
|
|
|
writer = csv.writer(f) |
102
|
|
|
for line in response.iter_lines(): |
103
|
|
|
writer.writerow(line.decode("ISO-8859-1").split(";")) |
104
|
|
|
|
105
|
|
|
logger.debug("Downloaded BAST data.") |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
class HeavyDutyTransport(Dataset): |
109
|
|
|
def __init__(self, dependencies): |
110
|
|
|
super().__init__( |
111
|
|
|
name="HeavyDutyTransport", |
112
|
|
|
version="0.0.2", |
113
|
|
|
dependencies=dependencies, |
114
|
|
|
tasks=( |
115
|
|
|
{ |
116
|
|
|
create_tables, |
117
|
|
|
download_hgv_data, |
118
|
|
|
}, |
119
|
|
|
run_egon_truck, |
120
|
|
|
insert_hgv_h2_demand, |
121
|
|
|
), |
122
|
|
|
) |
123
|
|
|
|