Skip to content

Commit

Permalink
Fix CCS issue
Browse files Browse the repository at this point in the history
Align with TIAM branch
  • Loading branch information
romainsacchi committed Dec 14, 2023
1 parent b43bb3a commit a1cab9e
Show file tree
Hide file tree
Showing 29 changed files with 527 additions and 388 deletions.
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ requirements:
- bottleneck
- bw2data
- bw2io >=0.8.10
- constructive_geometries>=0.9.4
- constructive_geometries>=0.9.5
- cryptography
- datapackage
- numpy
Expand Down
175 changes: 48 additions & 127 deletions dev/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"0.9.4 /opt/homebrew/Caskroom/miniforge/base/envs/premise_env/lib/python3.10/site-packages/constructive_geometries/__init__.py\n"
"(0, 8, 2) /opt/homebrew/Caskroom/miniforge/base/envs/carculator/lib/python3.10/site-packages/constructive_geometries/__init__.py\n"
]
}
],
Expand All @@ -33,8 +33,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"/opt/homebrew/Caskroom/miniforge/base/envs/premise_env/lib/python3.10/site-packages/wurst/__init__.py\n",
"(0, 4)\n"
"/opt/homebrew/Caskroom/miniforge/base/envs/carculator/lib/python3.10/site-packages/wurst/__init__.py\n",
"(0, 3, 4)\n"
]
}
],
Expand All @@ -53,10 +53,14 @@
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/romain/GitHub/premise/premise/__init__.py\n"
"ename": "ModuleNotFoundError",
"evalue": "No module named 'premise'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpremise\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;18m__file__\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;18m__file__\u001b[39m)\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'premise'"
]
}
],
Expand All @@ -67,65 +71,12 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f8e0a4cb-a226-4ab7-a093-015ea48749d0",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"premise v.(1, 8, 2, 'dev2')\n",
"+------------------------------------------------------------------+\n",
"| Warning |\n",
"+------------------------------------------------------------------+\n",
"| Because some of the scenarios can yield LCI databases |\n",
"| containing net negative emission technologies (NET), |\n",
"| it is advised to account for biogenic CO2 flows when calculating |\n",
"| Global Warming potential indicators. |\n",
"| `premise_gwp` provides characterization factors for such flows. |\n",
"| It also provides factors for hydrogen emissions to air. |\n",
"| |\n",
"| Within your bw2 project: |\n",
"| from premise_gwp import add_premise_gwp |\n",
"| add_premise_gwp() |\n",
"+------------------------------------------------------------------+\n",
"+--------------------------------+----------------------------------+\n",
"| Utils functions | Description |\n",
"+--------------------------------+----------------------------------+\n",
"| clear_cache() | Clears the cache folder. Useful |\n",
"| | when updating `premise`or |\n",
"| | encountering issues with |\n",
"| | inventories. |\n",
"+--------------------------------+----------------------------------+\n",
"| get_regions_definition(model) | Retrieves the list of countries |\n",
"| | for each region of the model. |\n",
"+--------------------------------+----------------------------------+\n",
"| ndb.NewDatabase(...) | Generates a summary of the most |\n",
"| ndb.generate_scenario_report() | important scenarios' variables. |\n",
"+--------------------------------+----------------------------------+\n",
"Keep uncertainty data?\n",
"NewDatabase(..., keep_uncertainty_data=True)\n",
"\n",
"Disable multiprocessing?\n",
"NewDatabase(..., use_multiprocessing=False)\n",
"\n",
"Hide these messages?\n",
"NewDatabase(..., quiet=True)\n",
"\n",
"//////////////////// EXTRACTING SOURCE DATABASE ////////////////////\n",
"Done!\n",
"\n",
"////////////////// IMPORTING DEFAULT INVENTORIES ///////////////////\n",
"Done!\n",
"\n",
"/////////////////////// EXTRACTING IAM DATA ////////////////////////\n",
"Done!\n"
]
}
],
"outputs": [],
"source": [
"from premise import *\n",
"import bw2data\n",
Expand All @@ -137,11 +88,11 @@
"scenarios = [\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-Base\", \"year\": 2030},\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-Base\", \"year\": 2040},\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-Base\", \"year\": 2100},\n",
" {\"model\": \"remind\", \"pathway\": \"SSP2-Base\", \"year\": 2050},\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-PkBudg1150\", \"year\": 2030},\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-PkBudg1150\", \"year\": 2040},\n",
" {\"model\": \"remind\", \"pathway\": \"SSP2-PkBudg500\", \"year\": 2020},\n",
" #{\"model\": \"image\", \"pathway\": \"SSP2-RCP19\", \"year\": 2100},\n",
" #{\"model\": \"remind\", \"pathway\": \"SSP2-PkBudg500\", \"year\": 2020},\n",
" {\"model\": \"image\", \"pathway\": \"SSP2-RCP19\", \"year\": 2050},\n",
"]\n",
"\n",
"ndb = NewDatabase(\n",
Expand Down Expand Up @@ -169,8 +120,30 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"////////////////////////////// FUELS ///////////////////////////////\n",
"`update_all()` will skip the following steps:\n",
"update_two_wheelers(), update_cars(), and update_buses()\n",
"If you want to update these steps, please run them separately afterwards.\n",
"Extracted 1 worksheets in 4.50 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Anomalies found: check the change report.\n",
"Done!\n",
"Done!\n",
"Extracted 1 worksheets in 5.16 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Anomalies found: check the change report.\n",
"Done!\n",
"Done!\n",
"Done!\n",
"\n"
Expand All @@ -180,12 +153,12 @@
"source": [
"#ndb.update_external_scenario()\n",
"#ndb.update_dac()\n",
"#ndb.update_all()\n",
"ndb.update_all()\n",
"#ndb.update_biomass()\n",
"#ndb.update_electricity()\n",
"#ndb.update_cement()\n",
"#ndb.update_steel()\n",
"ndb.update_fuels()\n",
"#ndb.update_fuels()\n",
"#ndb.update_heat()\n",
"#ndb.update_heat()\n",
"#ndb.update_buses()\n",
Expand All @@ -196,40 +169,6 @@
"#ndb.update_metals()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f24675ba-05d9-46ee-a2db-b7d6e18e3fe9",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Write Simapro import file(s).\n",
"Running all checks...\n",
"Simapro CSV files saved in /Users/romain/GitHub/premise/dev/export/simapro.\n",
"Generate scenario report.\n",
"Report saved under /Users/romain/GitHub/premise/dev/export/scenario_report.\n",
"Generate change report.\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_dac.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_biomass.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_electricity.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_fuel.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_heat.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_steel.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_cement.log\n",
"/Users/romain/GitHub/premise/dev/export/logs/premise_validation.log\n",
"Report saved under /Users/romain/GitHub/premise/dev.\n"
]
}
],
"source": [
"ndb.write_db_to_simapro()"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -265,33 +204,15 @@
"output_type": "stream",
"text": [
"Write new database(s) to Brightway.\n",
"Running all checks...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Writing activities to SQLite3 database:\n",
"0% [##############################] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:25\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Title: Writing activities to SQLite3 database:\n",
" Started: 12/10/2023 18:53:59\n",
" Finished: 12/10/2023 18:54:24\n",
" Total time elapsed: 00:00:25\n",
" CPU %: 94.60\n",
" Memory %: 15.01\n"
"Running all checks...\n",
"Running all checks...\n",
"Database ecoinvent_cutoff_3.9_remind_SSP2-Base_2050 already exists: it will be overwritten.\n",
"Vacuuming database \n"
]
}
],
"source": [
"ndb.write_db_to_brightway(\"test_biomethane\")"
"ndb.write_db_to_brightway()"
]
},
{
Expand Down Expand Up @@ -2872,7 +2793,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
Binary file modified premise/data/additional_inventories/lci-biofuels.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 2 additions & 3 deletions premise/data/fuels/fuel_groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hydrogen:
- hydrogen, from biogas
- hydrogen, from biogas, with CCS

kerosen:
kerosene:
- kerosene, from petroleum
- kerosene, synthetic, from electrolysis, energy allocation
- kerosene, synthetic, from coal, energy allocation
Expand All @@ -61,8 +61,7 @@ kerosen:

liquefied petroleum gas:
- liquefied petroleum gas
- liquefied petroleum gas, synthetic, from natural gas
- liquefied petroleum gas, synthetic, from natural gas, with CCS
- liquefied petroleum gas, synthetic, from electrolysis, energy allocation
- liquefied petroleum gas, synthetic, from biomass
- liquefied petroleum gas, synthetic, from biomass, with CCS
- liquefied petroleum gas, synthetic, from coal
Expand Down
16 changes: 16 additions & 0 deletions premise/data/fuels/liquid_fuel_activities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,31 @@ methanol, from coal, with CCS:

fischer-tropsch:
- diesel production, synthetic, Fischer Tropsch process, hydrogen from electrolysis, energy allocation
- kerosene production, synthetic, Fischer Tropsch process, hydrogen from electrolysis, energy allocation
- diesel production, synthetic, from Fischer Tropsch process, hydrogen from electrolysis, energy allocation, at fuelling station
- syngas, RWGS, Production, for Fischer Tropsch process, hydrogen from electrolysis
- carbon monoxide, from RWGS, for Fischer Tropsch process, hydrogen from electrolysis

fischer-tropsch, from natural gas:
- diesel production, synthetic, Fischer Tropsch process, from natural gas, energy allocation
- liquefied petroleum gas production, synthetic, Fischer Tropsch process, from natural gas, energy allocation
- kerosene production, synthetic, Fischer Tropsch process, from natural gas, energy allocation
- syngas production, from natural gas
- diesel production, synthetic, Fischer Tropsch process, from natural gas, energy allocation, with carbon capture and storage
- liquefied petroleum gas production, synthetic, Fischer Tropsch process, from natural gas, energy allocation, with carbon capture and storage
- kerosene production, synthetic, Fischer Tropsch process, from natural gas, energy allocation, with carbon capture and storage
- syngas production, from natural gas, with carbon capture and storage


fischer-tropsch, from woody biomass:
- diesel production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, energy allocation
- diesel production, synthetic, from Fischer Tropsch process, hydrogen from wood gasification, energy allocation, at fuelling station
- diesel production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, with CCS, energy allocation
- diesel production, synthetic, from Fischer Tropsch process, hydrogen from wood gasification, with CCS, energy allocation, at fuelling station
- liquefied petroleum gas production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, energy allocation
- liquefied petroleum gas production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, energy allocation, with carbon capture and storage
- kerosene production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, energy allocation
- kerosene production, synthetic, Fischer Tropsch process, hydrogen from wood gasification, with CCS, energy allocation
- syngas, RWGS, Production, for Fischer Tropsch process, hydrogen from wood gasification
- syngas, RWGS, Production, for Fischer Tropsch process, hydrogen from wood gasification, with CCS
- carbon monoxide, from RWGS, for Fischer Tropsch process, hydrogen from wood gasification
Expand Down
20 changes: 6 additions & 14 deletions premise/data/utils/logging/reporting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,12 @@ premise_dac:
region:
name: region
description: Region name
scaling factor operation:
name: Thermal and electrical scaling factor
description: Scaling factor the initial energy input related to operation is multiplied by
scaling factor infrastructure:
name: Infrastructure input scaling factor
description: Scaling factor the initial infrastructure and sorbent/solvent inputs are multiplied by
initial energy input per kg CO2:
name: Initial energy input per kg CO2 captured
description: Energy input per kg CO2 captured before adjustment
unit: MJ/kg
new energy input per kg CO2:
name: New energy input per kg CO2 captured
description: Energy input per kg CO2 captured after adjustment
unit: MJ/kg
electricity scaling factor:
name: Electrical scaling factor
description: Scaling factor the initial electricity input
heat scaling factor:
name: Heat scaling factor
description: Scaling factor the initial heat input
tab: Direct Air Capture

premise_biomass:
Expand Down
24 changes: 24 additions & 0 deletions premise/data/utils/report/report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ Fuel (hydrogen) - efficiency:
label: Efficiency gains (2020 = 1)
expl_text: Energy efficiency gains per technology relative to 2020. Used to calibrate the efficiency of the (bio)fuel-producing datasets.
offset: 5
Fuel (kerosene) - generation:
label: Exajoules (EJ)
expl_text: Generated volumes of kerosene fuel, per technology. Used to calculate fuel supply mixes.
offset: 5
Fuel (kerosene) - efficiency:
label: Efficiency gains (2020 = 1)
expl_text: Energy efficiency gains per technology relative to 2020. Used to calibrate the efficiency of the (bio)fuel-producing datasets.
offset: 5
Fuel (LPG) - generation:
label: Exajoules (EJ)
expl_text: Generated volumes of kerosene fuel, per technology. Used to calculate fuel supply mixes.
offset: 5
Fuel (LPG) - efficiency:
label: Efficiency gains (2020 = 1)
expl_text: Energy efficiency gains per technology relative to 2020. Used to calibrate the efficiency of the (bio)fuel-producing datasets.
offset: 5
Cement - generation:
label: Millions of tons (MT)
expl_text: Generated volumes of cement.
Expand Down Expand Up @@ -86,6 +102,14 @@ Direct Air Capture - generation:
label: Millions of tons of CO2 (Mt CO2, cumul.)
expl_text: Cumulated mass of CO2 removed by direct air capture. Used to calculate the learning rate of DAC systems. Assumes that sorbent- and solvent-based DAC systems are equally used.
offset: 10
Direct Air Capture - heat eff.:
label: Efficiency gains (2020 = 1)
expl_text: Heat efficiency gains relative to 2020. Used to calibrate the efficiency of the DAC datasets.
offset: 10
Direct Air Capture - elec eff.:
label: Efficiency gains (2020 = 1)
expl_text: Electricity efficiency gains relative to 2020. Used to calibrate the efficiency of the DAC datasets.
offset: 10
Transport (cars):
label: Vehicle-kilometers (million)
expl_text: Number of vehicle-kilometers driven by passenger cars. Used to calculate fleet-average vehicles.
Expand Down
Loading

0 comments on commit a1cab9e

Please sign in to comment.