Skip to content

Commit

Permalink
transport demand: clarify units in code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed May 25, 2024
1 parent 422c378 commit fd9e93b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions scripts/build_energy_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ def build_idees(countries):
names=["country", "year"],
)

# efficiency kgoe/100km -> ktoe/100km
totals.loc[:, "passenger car efficiency"] *= 1e3
# efficiency kgoe/100km -> ktoe/100km so that after conversion TWh/100km
totals.loc[:, "passenger car efficiency"] /= 1e6
# convert ktoe to TWh
exclude = totals.columns.str.fullmatch("passenger cars")
totals.loc[:, ~exclude] *= 11.63 / 1e3
Expand Down Expand Up @@ -766,9 +766,8 @@ def build_transport_data(countries, population, idees):

transport_data = transport_data.combine_first(fill_values)

# collect average fuel efficiency in kWh/km

transport_data["average fuel efficiency"] = idees["passenger car efficiency"]
# collect average fuel efficiency in MWh/100km, taking passengar car efficiency in TWh/100km
transport_data["average fuel efficiency"] = idees["passenger car efficiency"] * 1e6

missing = transport_data.index[transport_data["average fuel efficiency"].isna()]
if not missing.empty:
Expand Down
7 changes: 4 additions & 3 deletions scripts/build_transport_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ def build_transport_demand(traffic_fn, airtemp_fn, nodes, nodal_transport_data):
# divide out the heating/cooling demand from ICE totals
ice_correction = (transport_shape * (1 + dd_ICE)).sum() / transport_shape.sum()

# unit TWh
energy_totals_transport = (
pop_weighted_energy_totals["total road"]
+ pop_weighted_energy_totals["total rail"]
- pop_weighted_energy_totals["electricity rail"]
)

# convert average fuel efficiency from kW/100 km -> MW/100km
eff = nodal_transport_data["average fuel efficiency"] / 1e3
# average fuel efficiency in MWh/100 km
eff = nodal_transport_data["average fuel efficiency"]

return (transport_shape.multiply(energy_totals_transport) * 1e6 * nyears).divide(
eff * ice_correction
Expand Down Expand Up @@ -169,7 +170,7 @@ def bev_dsm_profile(snapshots, nodes, options):
snakemake = mock_snakemake(
"build_transport_demand",
simpl="",
clusters=37,
clusters=128,
)
configure_logging(snakemake)
set_scenario_config(snakemake)
Expand Down

0 comments on commit fd9e93b

Please sign in to comment.