diff --git a/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/call_functions/_14_calculatecorrectedseatkilometercosts.py b/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/call_functions/_14_calculatecorrectedseatkilometercosts.py index 6099d4bfe0ee7eba34247e62533953de68b639e8..2c29959a9911b990ba2cd1c98b884cf438c70c22 100644 --- a/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/call_functions/_14_calculatecorrectedseatkilometercosts.py +++ b/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/call_functions/_14_calculatecorrectedseatkilometercosts.py @@ -1,5 +1,6 @@ # 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 diff --git a/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/methodplot.py b/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/methodplot.py index e35ab6e97c3984094320d6f878bc5e6f13017b07..2e91c6b6c1d11446ae6c58be34b15398b693b169 100644 --- a/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/methodplot.py +++ b/cost_estimation/src/tube_and_wing/empirical/operating_cost_estimation_tu_berlin/general/methodplot.py @@ -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",