Skip to content
Snippets Groups Projects
Commit 35b42154 authored by sroscher's avatar sroscher
Browse files

_14_calculatecorrectedseatkilometercosts.py:

- Implemented calculation

methodplot.py:
- Added plot for SKC vs. SKC corrected
parent 12d52ee4
No related tags found
No related merge requests found
# Import standard libraries.
from numpy import array, nonzero
from numpy import inf, where
from matplotlib import pyplot as plt
def calculate_corrected_seat_kilometer_costs(dict_ac_data, dict_operating_costs, runtime_output):
......@@ -11,7 +12,7 @@ def calculate_corrected_seat_kilometer_costs(dict_ac_data, dict_operating_costs,
following parameters:
- array corrected_seat_kilometer_costs: Corrected seat kilometer costs (range dependent) in EUR/SKO
:param dict dict_ac_data: Dict containing parameters and values from aircraft exchange and module configuration file
:param dict dict_ac_data: Dict containing parameters and values from aircraft exchange and module config file
:param dict dict_operating_costs: Dict containing parameters from cost estimation calculation
:param logging.Logger runtime_output: Logging object used for capturing log messages in the module
:return dict dict_operating_costs: Dict containing parameters from cost estimation calculation
......@@ -34,8 +35,8 @@ def calculate_corrected_seat_kilometer_costs(dict_ac_data, dict_operating_costs,
# idx_prd_point_a = 0
# idx_prd_point_b = n_points[0]
# points = len(n_points)
# max_number_of_pax = max(n_pax_for_prd)
# max_weight_pax = ACCELERATION_OF_GRAVITY * m_passenger_incl_luggage * max_number_of_pax
max_number_of_pax = max(n_pax_for_prd)
max_weight_pax = ACCELERATION_OF_GRAVITY * m_passenger_incl_luggage * max_number_of_pax
# # First n entries can be obtained using the payloads for PRD directly.
# weight_payload = [ACCELERATION_OF_GRAVITY * payloads_for_prd[i] for i in range(points)]
# delta_weight_payload = ACCELERATION_OF_GRAVITY * (payloads_for_prd[idx_prd_point_a]
......@@ -55,13 +56,27 @@ def calculate_corrected_seat_kilometer_costs(dict_ac_data, dict_operating_costs,
# # Replace zeros to eliminate 'invalid value encountered in divide' warning.
# zero_n_pax = nonzero(n_pax_for_prd == 0)[0]
# n_pax_for_prd[zero_n_pax] = 1e-8
# G_P_max = dict_ac_data['m_payload_max']*ACCELERATION_OF_GRAVITY
G_P_max = payloads_for_prd
G_pax = n_pax_for_prd*m_passenger_incl_luggage
I_cargo = revenue_per_freight_km*(G_P_max - G_pax)
I_pax = revenue_per_seat_and_flight
n_pax_cargo = I_cargo/I_pax
# Calculate corrected seat kilometer costs.
corrected_seat_kilometer_costs = 0
corrected_seat_kilometer_costs = (dict_operating_costs['seat_kilometer_costs']['seat_kilometer_costs']
* (n_pax_for_prd/(n_pax_for_prd + n_pax_cargo)))
# corrected_seat_kilometer_costs[corrected_seat_kilometer_costs == 0] = inf
# Prepare output data.
dict_operating_costs['corrected_seat_kilometer_costs'] = {}
dict_operating_costs['corrected_seat_kilometer_costs']['corrected_seat_kilometer_costs'] = \
corrected_seat_kilometer_costs
# Plot test.
plt.plot(corrected_seat_kilometer_costs)
plt.show()
plt.plot(G_P_max - G_pax)
plt.show()
return dict_operating_costs
......@@ -24,6 +24,8 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output
prd_range_array = data_dict['design']['payload_range_diagram_data']['ranges_for_prd']/1000
prd_payload_array = data_dict['design']['payload_range_diagram_data']['payloads_for_prd']
seat_kilometer_costs_design = data_dict['design']['seat_kilometer_costs']['seat_kilometer_costs']
seat_kilometer_costs_corrected_design = (
data_dict['design']['corrected_seat_kilometer_costs']['corrected_seat_kilometer_costs'])
ton_kilometers_offered_design = data_dict['design']['ton_kilometer_costs']['ton_kilometer_offered']
ton_kilometer_costs_design = data_dict['design']['ton_kilometer_costs']['ton_kilometer_costs']
......@@ -34,6 +36,12 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output
prd_range_array, "SKC and TKO for design mission",
"design_mission", paths_and_names)
create_two_axes_plot(seat_kilometer_costs_design, 300, "SKC in €/number of PAX * km for design mission",
seat_kilometer_costs_corrected_design, 300,
"SKC corrected in €/number of PAX * km for mission study",
prd_range_array, "Seat kilometer costs (SKC) vs. corrected SKC",
"design_mission", paths_and_names)
create_two_axes_plot(ton_kilometer_costs_design, 3, "DOC per ton kilometers offered in €/payload weight * km",
ton_kilometers_offered_design, max(ton_kilometers_offered_design) * 1.1,
"Ton kilometers offered in payload weight * km",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment