-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add battery transformation + documentation
- Loading branch information
1 parent
f032783
commit 1ea1e79
Showing
13 changed files
with
825 additions
and
786 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
""" | ||
module to adjust the battery inputs to reflect progress in | ||
terms of cell energy density. | ||
""" | ||
|
||
import yaml | ||
|
||
from .filesystem_constants import DATA_DIR | ||
from .logger import create_logger | ||
from .transformation import BaseTransformation, IAMDataCollection, List, np, ws | ||
|
||
logger = create_logger("battery") | ||
|
||
|
||
def load_cell_energy_density(): | ||
""" | ||
Load cell energy density data. | ||
""" | ||
with open(DATA_DIR / "battery/energy_density.yaml", "r") as file: | ||
data = yaml.load(file, Loader=yaml.FullLoader) | ||
|
||
result = {} | ||
for key, value in data.items(): | ||
names = value['ecoinvent_aliases']['name'] | ||
if isinstance(names, list): | ||
for name in names: | ||
result[name] = value['target'] | ||
else: | ||
result[names] = value['target'] | ||
|
||
return result | ||
|
||
|
||
def _update_battery(scenario, version, system_model): | ||
battery = Battery( | ||
database=scenario["database"], | ||
iam_data=scenario["iam data"], | ||
model=scenario["model"], | ||
pathway=scenario["pathway"], | ||
year=scenario["year"], | ||
version=version, | ||
system_model=system_model, | ||
cache=scenario.get("cache"), | ||
index=scenario.get("index"), | ||
) | ||
|
||
battery.adjust_battery_mass() | ||
|
||
scenario["database"] = battery.database | ||
scenario["index"] = battery.index | ||
scenario["cache"] = battery.cache | ||
|
||
return scenario | ||
|
||
|
||
class Battery(BaseTransformation): | ||
""" | ||
Class that modifies the battery market to reflect progress | ||
in terms of cell energy density. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
database: List[dict], | ||
iam_data: IAMDataCollection, | ||
model: str, | ||
pathway: str, | ||
year: int, | ||
version: str, | ||
system_model: str, | ||
cache: dict = None, | ||
index: dict = None, | ||
) -> None: | ||
super().__init__( | ||
database, | ||
iam_data, | ||
model, | ||
pathway, | ||
year, | ||
version, | ||
system_model, | ||
cache, | ||
index, | ||
) | ||
self.system_model = system_model | ||
|
||
def adjust_battery_mass(self) -> None: | ||
""" | ||
Adjust vehicle components (e.g., battery). | ||
Adjust the battery mass to reflect progress in battery technology. | ||
Specifically, we adjust the battery mass to reflect progress in | ||
terms of cell energy density. | ||
We leave the density unchanged after 2050. | ||
""" | ||
|
||
energy_density = load_cell_energy_density() | ||
|
||
filters = [ws.contains("name", x) for x in energy_density] | ||
|
||
for ds in ws.get_many( | ||
self.database, | ||
ws.exclude( | ||
ws.either( | ||
*[ | ||
ws.contains("name", x) | ||
for x in [ | ||
"market for battery", | ||
"battery production", | ||
"battery cell production", | ||
"cell module production", | ||
] | ||
] | ||
) | ||
), | ||
): | ||
|
||
for exc in ws.technosphere(ds, ws.either(*filters)): | ||
name = [x for x in energy_density if x in exc["name"]][0] | ||
|
||
scaling_factor = energy_density[name][2020] / np.clip( | ||
np.interp( | ||
self.year, | ||
list(energy_density[name].keys()), | ||
list(energy_density[name].values()), | ||
), | ||
0.1, | ||
0.5, | ||
) | ||
|
||
if "log parameters" not in ds: | ||
ds["log parameters"] = {} | ||
|
||
ds["log parameters"]["battery input"] = exc["name"] | ||
ds["log parameters"]["old battery mass"] = exc["amount"] | ||
exc["amount"] *= scaling_factor | ||
ds["log parameters"]["new battery mass"] = exc["amount"] | ||
|
||
self.write_log(ds, status="modified") | ||
|
||
def write_log(self, dataset, status="created"): | ||
""" | ||
Write log file. | ||
""" | ||
|
||
logger.info( | ||
f"{status}|{self.model}|{self.scenario}|{self.year}|" | ||
f"{dataset['name']}|{dataset['location']}|" | ||
f"{dataset.get('log parameters', {}).get('battery input', '')}|" | ||
f"{dataset.get('log parameters', {}).get('old battery mass', '')}|" | ||
f"{dataset.get('log parameters', {}).get('new battery mass', '')}" | ||
) |
Binary file modified
BIN
+612 Bytes
(100%)
premise/data/additional_inventories/lci-batteries-LiO2.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Battery cell energy densities, in kWh/kg cell | ||
--- | ||
|
||
NMC111: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, NMC111 | ||
- market for battery, Li-ion, NMC111, rechargeable, prismatic | ||
target: | ||
2020: 0.150 | ||
2050: 0.200 | ||
|
||
NMC622: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, NMC622 | ||
- market for battery, Li-ion, NMC622, rechargeable, prismatic | ||
target: | ||
2020: 0.200 | ||
2050: 0.350 | ||
|
||
NMC811: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, NMC811 | ||
- market for battery, Li-ion, NMC811, rechargeable, prismatic | ||
target: | ||
2020: 0.220 | ||
2050: 0.500 | ||
|
||
NCA: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, NCA | ||
- market for battery, Li-ion, NCA, rechargeable, prismatic | ||
target: | ||
2020: 0.280 | ||
2050: 0.350 | ||
|
||
LFP: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, LFP | ||
- market for battery, Li-ion, LFP, rechargeable, prismatic | ||
target: | ||
2020: 0.140 | ||
2050: 0.250 | ||
|
||
LTO: | ||
ecoinvent_aliases: | ||
name: market for battery cell, Li-ion, LTO | ||
target: | ||
2020: 0.080 | ||
2050: 0.150 | ||
|
||
LMO: | ||
ecoinvent_aliases: | ||
name: | ||
- market for battery cell, Li-ion, LiMn2O4 | ||
- market for battery, Li-ion, LiMn2O4, rechargeable, prismatic | ||
|
||
target: | ||
2020: 0.130 | ||
2050: 0.200 | ||
|
||
Li-O2: | ||
ecoinvent_aliases: | ||
name: market for battery, Li-oxygen, Li-O2 | ||
target: | ||
2020: 0.24 | ||
2050: 0.50 | ||
|
||
BoP: | ||
ecoinvent_aliases: | ||
name: market for battery management system | ||
target: | ||
2020: 0.2 | ||
2050: 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.