Skip to content

Commit

Permalink
Black reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Nov 17, 2021
1 parent f156743 commit 8f73a10
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions carculator_truck/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def __init__(
}

l_pwt = [
pt for pt in ("BEV", "FCEV", "HEV-d", "PHEV-e") if pt in self.array.powertrain.values
pt
for pt in ("BEV", "FCEV", "HEV-d", "PHEV-e")
if pt in self.array.powertrain.values
]

for pt in l_pwt:
Expand Down Expand Up @@ -720,7 +722,6 @@ def calculate_ttw_energy(self):
# as documented in
# https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/121450/1/2539-07.pdf


l_pwt = [
p
for p in self.array.powertrain.values
Expand Down Expand Up @@ -772,9 +773,15 @@ def calculate_ttw_energy(self):
]
if len(l_pwt) > 0:
self.energy.loc[
dict(parameter=["engine efficiency", "transmission efficiency"], powertrain=l_pwt)
dict(
parameter=["engine efficiency", "transmission efficiency"],
powertrain=l_pwt,
)
] = self.array.loc[
dict(parameter=["engine efficiency", "transmission efficiency"], powertrain=l_pwt)
dict(
parameter=["engine efficiency", "transmission efficiency"],
powertrain=l_pwt,
)
].values[
..., None
]
Expand Down Expand Up @@ -884,11 +891,15 @@ def calculate_ttw_energy(self):
axis=-1,
)

self.array.loc[dict(parameter="transmission efficiency", powertrain=pwt)] = np.nanmean(
self.array.loc[
dict(parameter="transmission efficiency", powertrain=pwt)
] = np.nanmean(
np.where(
self.energy.loc[dict(parameter="power load", powertrain=pwt)] == 0,
np.nan,
self.energy.loc[dict(parameter="transmission efficiency", powertrain=pwt)],
self.energy.loc[
dict(parameter="transmission efficiency", powertrain=pwt)
],
),
axis=-1,
)
Expand Down Expand Up @@ -982,7 +993,8 @@ def set_battery_fuel_cell_replacements(self):
]:
with self(pt) as cpm:
battery_tech_label = (
"battery cycle life, " + self.energy_storage["electric"][pt].split("-")[0]
"battery cycle life, "
+ self.energy_storage["electric"][pt].split("-")[0]
)
cpm["battery lifetime replacements"] = finite(
np.ceil(
Expand Down Expand Up @@ -1393,15 +1405,15 @@ def set_energy_stored_properties(self):
)

cpm["battery cell mass"] = (
cpm["electric energy stored"] / cpm[battery_tech_label]
cpm["electric energy stored"] / cpm[battery_tech_label]
)

cpm["energy battery mass"] = (
cpm["battery cell mass"] / cpm["battery cell mass share"]
cpm["battery cell mass"] / cpm["battery cell mass share"]
)

cpm["battery BoP mass"] = (
cpm["energy battery mass"] - cpm["battery cell mass"]
cpm["energy battery mass"] - cpm["battery cell mass"]
)

# kWh electricity/kg battery cell
Expand Down

0 comments on commit 8f73a10

Please sign in to comment.