Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi authored and romainsacchi committed Jul 17, 2024
2 parents 8f8ba94 + 6ae846c commit 7cbdd02
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions premise/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ def adjust_battery_mass(self) -> None:

energy_density = load_cell_energy_density()

filters = [ws.contains("name", x) for x in energy_density if "battery capacity" not in x]
filters = [
ws.contains("name", x)
for x in energy_density
if "battery capacity" not in x
]

for ds in ws.get_many(
self.database,
Expand All @@ -111,7 +115,7 @@ def adjust_battery_mass(self) -> None:
"battery production",
"battery cell production",
"cell module production",
"battery capacity"
"battery capacity",
]
]
)
Expand Down Expand Up @@ -159,15 +163,27 @@ def adjust_battery_mass(self) -> None:
if "log parameters" not in ds:
ds["log parameters"] = {}

ds["log parameters"]["battery input"] = [e["name"] for e in ws.technosphere(ds, ws.contains("name", "market for battery"))][0]
ds["log parameters"]["old battery mass"] = sum(e["amount"] for e in ws.technosphere(ds, ws.contains("name", "market for battery")))

rescale_exchanges(
ds,
scaling_factor
ds["log parameters"]["battery input"] = [
e["name"]
for e in ws.technosphere(
ds, ws.contains("name", "market for battery")
)
][0]
ds["log parameters"]["old battery mass"] = sum(
e["amount"]
for e in ws.technosphere(
ds, ws.contains("name", "market for battery")
)
)

ds["log parameters"]["new battery mass"] = sum(e["amount"] for e in ws.technosphere(ds, ws.contains("name", "market for battery")))
rescale_exchanges(ds, scaling_factor)

ds["log parameters"]["new battery mass"] = sum(
e["amount"]
for e in ws.technosphere(
ds, ws.contains("name", "market for battery")
)
)

self.write_log(ds, status="modified")

Expand Down

0 comments on commit 7cbdd02

Please sign in to comment.