Basic example for using AeroMAPS with Jupyter Notebook¶
This document represents both an example and a tutorial for using the basic functions of AeroMAPS to simulate and evaluate a transition scenario for the aviation sector. It is written in the form of a Jupyter Notebook to facilitate its use. The user will be able to adapt this notebook and couple it with other notebooks proposed in the documentation.
Load and process¶
First, the user has to load the framework and generate a process.
%matplotlib widget
from aeromaps import create_process
process = create_process(configuration_file="data/config.yaml")
Set up variables¶
The user can then set the different parameters of the model to generate its scenario. The list of the float inputs can be displayed using this command.
# process.list_float_inputs()
In the following, some main parameters are for instance set up, corresponding to standard models (e.g. do not include fuels, which are managed in a dedicated configuration files, see Tutorials 02 and 04).
# Air traffic evolution
## Growth rate by category [%]
process.parameters.cagr_passenger_short_range_reference_periods = [2020, 2030, 2040, 2050]
process.parameters.cagr_passenger_short_range_reference_periods_values = [3.0, 2.0, 1.0]
process.parameters.cagr_passenger_medium_range_reference_periods = []
process.parameters.cagr_passenger_medium_range_reference_periods_values = [3.0]
process.parameters.cagr_passenger_long_range_reference_periods = []
process.parameters.cagr_passenger_long_range_reference_periods_values = [3.0]
process.parameters.cagr_freight_reference_periods = []
process.parameters.cagr_freight_reference_periods_values = [3.0]
# Aircraft fleet and operation evolution - Aircraft load factor
## Aircraft load factor in 2050 [%]
process.parameters.load_factor_end_year = 85.0 # 2019 value: 82.399312
# Aircraft fleet and operation evolution - Aircraft efficiency using the top-down approach
## Drop-in aircraft
### Mean annual efficiency gains by category [%]
process.parameters.energy_per_ask_short_range_dropin_fuel_gain_reference_years = []
process.parameters.energy_per_ask_short_range_dropin_fuel_gain_reference_years_values = [1.5]
process.parameters.energy_per_ask_medium_range_dropin_fuel_gain_reference_years = []
process.parameters.energy_per_ask_medium_range_dropin_fuel_gain_reference_years_values = [1.5]
process.parameters.energy_per_ask_long_range_dropin_fuel_gain_reference_years = []
process.parameters.energy_per_ask_long_range_dropin_fuel_gain_reference_years_values = [1.5]
## Hydrogen aircraft
### Values for setting logistic functions by category
process.parameters.hydrogen_final_market_share_short_range = 50.0 # [%]
process.parameters.hydrogen_introduction_year_short_range = 2035
process.parameters.fleet_renewal_duration = 20.0
### Relative energy consumption for hydrogen aircraft with respect to drop-in aircraft [%]
process.parameters.relative_energy_per_ask_hydrogen_wrt_dropin_short_range_reference_years = []
process.parameters.relative_energy_per_ask_hydrogen_wrt_dropin_short_range_reference_years_values = [
1.0
]
# Aircraft fleet and operation evolution - Operations
## Values for setting the logistic function
process.parameters.operations_final_gain = 8.0 # [%]
process.parameters.operations_start_year = 2025
process.parameters.operations_duration = 25.0
# Carbon offset
process.parameters.carbon_offset_baseline_level_vs_2019_reference_periods = [2020, 2024, 2050]
process.parameters.carbon_offset_baseline_level_vs_2019_reference_periods_values = [100.0, 85.0]
process.parameters.residual_carbon_offset_share_reference_years = [2020, 2030, 2040, 2050]
process.parameters.residual_carbon_offset_share_reference_years_values = [0.0, 0.0, 20.0, 50.0]
# Environmental limits
## Carbon budgets and Carbon Dioxide Removal [GtCO2]
process.parameters.net_carbon_budget = 850.0
process.parameters.carbon_dioxyde_removal_2100 = 280.0
# Allocation settings
## Aviation share of the global (equivalent) carbon budget [%]
process.parameters.aviation_carbon_budget_allocated_share = 2.6
process.parameters.aviation_equivalentcarbonbudget_allocated_share = 5.1
Compute¶
Once all the parameters have been set up, the user can compute.
import time
t1 = time.time()
process.compute()
print(time.time() - t1)
process.write_json()
Results¶
The user can then display the results. The user has access to float outputs but also to annual data outputs, with the possibility of choosing the output.
process.data["float_outputs"]
process.data["vector_outputs"]
process.data["climate_outputs"][["co2_emissions"]]
The user can write the results to an Excel file with the following command.
process.write_excel(file_name="aeromaps_data.xlsx")
Plots¶
Lastly, the user can also plot different parameters based on a database of plots. The list of the available plots can be displayed using the following command.
process.list_available_plots()
The user can thus display a figure of this list, for instance the CO2 emissions of the simulated scenario.
process.plot("air_transport_co2_emissions", save=False)
# Verify the outputs between .outputs.json and data/reference/outputs.json
from aeromaps.utils.functions import compare_json_files
files_are_different = compare_json_files(
"./data/reference/outputs.json",
"./data/outputs.json",
rtol=0.0001,
atol=0,
)
if files_are_different:
raise ValueError("The outputs.json files are different.")
from aeromaps.utils.functions import clean_notebooks_on_tests
clean_notebooks_on_tests(globals())