Skip to content

Commit

Permalink
Fix ttw
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi authored and romainsacchi committed Aug 30, 2024
1 parent b6a3712 commit a973b72
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 18 deletions.
2 changes: 1 addition & 1 deletion carculator_truck/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def fill_in_A_matrix(self):
np.ix_(
np.arange(self.iterations),
self.find_input_indices(
"charger, for electric vehicles, level 3, plugin, 200 kW",
("EV charger, level 3, plugin, 200 kW",),
),
[j for i, j in self.inputs.items() if i[0].startswith("truck, ")],
)
Expand Down
Binary file modified dev/Input data_truck.xlsx
Binary file not shown.
97 changes: 80 additions & 17 deletions dev/test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "d95db687-4668-4f25-a9b5-5d269b95828f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/Users/romain/Github/carculator_truck/carculator_truck/__init__.py'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from carculator_truck import __file__\n",
"__file__"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "02be2be5-cfbf-4749-b924-11e85567e4a5",
"metadata": {},
"outputs": [
Expand All @@ -21,17 +43,40 @@
"output_type": "stream",
"text": [
"Finding solutions for trucks...\n",
"Urban delivery driving cycle is selected. \n",
"Vehicles will be designed to achieve a minimal range of 150 km.\n",
"Regional delivery driving cycle is selected. \n",
"Vehicles will be designed to achieve a minimal range of 400 km.\n",
"\n",
"\n",
"'-' vehicle with driving mass superior to the permissible gross weight.\n",
"'/' vehicle not available for the specified year.\n",
"+-------------------+-----+\n",
"| Payload (in tons) | 26t |\n",
"+-------------------+-----+\n",
"| BEV, 2020 | 6.3 |\n",
"+-------------------+-----+\n"
"+-------------------+-----+-----+------+------+------+------+------+\n",
"| Payload (in tons) | 18t | 26t | 3.5t | 32t | 40t | 60t | 7.5t |\n",
"+-------------------+-----+-----+------+------+------+------+------+\n",
"| BEV, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| BEV, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| BEV, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| BEV, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| FCEV, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| FCEV, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| FCEV, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| FCEV, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| HEV-d, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| HEV-d, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| HEV-d, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| HEV-d, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-d, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-d, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-d, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-d, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-g, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-g, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-g, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| ICEV-g, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| PHEV-d, 2020 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| PHEV-d, 2030 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| PHEV-d, 2040 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"| PHEV-d, 2050 | 3.2 | 6.3 | 0.8 | 10.3 | 10.3 | 19.3 | 1.8 |\n",
"+-------------------+-----+-----+------+------+------+------+------+\n"
]
}
],
Expand All @@ -41,30 +86,48 @@
"tip.static()\n",
"dcts, array = fill_xarray_from_input_parameters(\n",
" tip,\n",
" scope={\"year\":[2020, ], \"size\":[\"26t\",], \"powertrain\":[\"BEV\",]},\n",
" sensitivity=True\n",
" scope={\"year\": [2020, 2030, 2040, 2050]}\n",
")\n",
"tm = TruckModel(array, cycle='Urban delivery',)\n",
"tm = TruckModel(array, cycle='Regional delivery',)\n",
"tm.set_all()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "5958afeb-a8ad-406c-b48a-7825405edfb7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No input found for ('treatment of used bus',) and exclude () in the A matrix.\n",
"****************** IMPORTANT BACKGROUND PARAMETERS ******************\n",
" * The functional unit is: vkm.\n",
" * The background prospective scenario is: SSP2-NPi.\n",
" * The country of use is: CH.\n",
" * Power and energy batteries produced in CN using ['NMC-622'] chemistry/ies\n",
" * Power and energy batteries produced in CN using ['NMC-622', 'NMC-955'] chemistry/ies\n",
"\t * between 2020 and 2029, % of non-hydro renew.: 12, hydro: 61, nuclear: 20.\n",
"*********************************************************************\n"
"\t * between 2030 and 2039, % of non-hydro renew.: 25, hydro: 58, nuclear: 7.\n",
"\t * between 2040 and 2049, % of non-hydro renew.: 30, hydro: 56, nuclear: 2.\n",
"\t * between 2050 and 2059, % of non-hydro renew.: 33, hydro: 54, nuclear: 1.\n",
"hydrogen - smr - natural gas is completed by hydrogen - electrolysis - PEM.\n",
" \t * in 2020 _________________________________________ 1.0%\n",
" \t * in 2030 _________________________________________ 1.0%\n",
" \t * in 2040 _________________________________________ 1.0%\n",
" \t * in 2050 _________________________________________ 1.0%\n",
" * methane is completed by methane - biomethane - sewage sludge.\n",
" \t * in 2020 _________________________________________ 22.0%\n",
" \t * in 2030 _________________________________________ 22.0%\n",
" \t * in 2040 _________________________________________ 22.0%\n",
" \t * in 2050 _________________________________________ 22.0%\n",
" * diesel is completed by diesel - biodiesel - cooking oil.\n",
" \t * in 2020 _________________________________________ 5.0%\n",
" \t * in 2030 _________________________________________ 5.0%\n",
" \t * in 2040 _________________________________________ 5.0%\n",
" \t * in 2050 _________________________________________ 5.0%\n",
" * *********************************************************************\n"
]
}
],
Expand All @@ -74,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "d91260d3-cb98-4589-8dd2-abcf5fa379f0",
"metadata": {},
"outputs": [
Expand All @@ -84,12 +147,12 @@
"text": [
"Calculating impacts\n",
"0% [##############################] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:00\n"
"Total time elapsed: 00:00:02\n"
]
}
],
"source": [
"res = ic.calculate_impacts(sensitivity=True)"
"res = ic.calculate_impacts()"
]
},
{
Expand Down Expand Up @@ -413,7 +476,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down

0 comments on commit a973b72

Please sign in to comment.