From 777df7b62178b6707b09f114dd4573d774130678 Mon Sep 17 00:00:00 2001 From: cmbenne3 Date: Tue, 10 Dec 2024 11:53:25 -0500 Subject: [PATCH] updates to load_off_design function to handle num_pax and cargo. WIP -> need to update other off design function for running alternate and fallout missions --- aviary/interface/methods_for_level2.py | 11 +++++++---- .../models/test_aircraft/aircraft_for_bench_GwGm.csv | 2 +- aviary/utils/preprocessors.py | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/aviary/interface/methods_for_level2.py b/aviary/interface/methods_for_level2.py index ab5ec0146..de11b481b 100644 --- a/aviary/interface/methods_for_level2.py +++ b/aviary/interface/methods_for_level2.py @@ -2943,7 +2943,7 @@ def _read_sizing_json(aviary_problem, json_filename): def _load_off_design(json_filename, ProblemType, phase_info, - payload, mission_range, mission_gross_mass): + num_pax, cargo_mass, mission_range, mission_gross_mass): """ This function loads a sized aircraft, and sets up an aviary problem for a specified off design mission. @@ -2956,8 +2956,10 @@ def _load_off_design(json_filename, ProblemType, phase_info, Alternate or Fallout. Alternate requires mission_range input and Fallout requires mission_fuel input phase_info: phase_info dictionary for off design mission - payload: float - Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS + num_pax: integer + Aircraft.CrewPayload.NUM_PASSENGERS + cargo_mass: float + Aircraft.CrewPayload.CARGO_MASS mission_range float Mission.Summary.RANGE 'NM' mission_gross_mass float @@ -2980,7 +2982,8 @@ def _load_off_design(json_filename, ProblemType, phase_info, # Set Payload prob.aviary_inputs.set_val( - Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS, payload, units='lbm') + Aircraft.CrewPayload.NUM_PASSENGERS, num_pax, units='unitless') + prob.aviary_inputs.set_val(Aircraft.CrewPayload.CARGO_MASS, cargo_mass, 'lbm') if ProblemType == ProblemType.ALTERNATE: # Set mission range, aviary will calculate required fuel diff --git a/aviary/models/test_aircraft/aircraft_for_bench_GwGm.csv b/aviary/models/test_aircraft/aircraft_for_bench_GwGm.csv index c05f0de09..343d60630 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_GwGm.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_GwGm.csv @@ -6,7 +6,7 @@ aircraft:controls:cockpit_control_mass_scaler,1,unitless aircraft:controls:control_mass_increment,0,lbm aircraft:controls:stability_augmentation_system_mass,0,lbm aircraft:controls:stability_augmentation_system_mass_scaler,1,unitless -aircraft:crew_and_payload:cargo_mass,0,lbm +aircraft:crew_and_payload:cargo_mass,10040,lbm #aircraft:crew_and_payload:design:cargo_mass,0,lbm #aircraft:crew_and_payload:max_cargo_mass,0,lbm aircraft:crew_and_payload:catering_items_mass_per_passenger,7.6,lbm diff --git a/aviary/utils/preprocessors.py b/aviary/utils/preprocessors.py index 175ff1f24..811d352dc 100644 --- a/aviary/utils/preprocessors.py +++ b/aviary/utils/preprocessors.py @@ -239,8 +239,8 @@ def preprocess_crewpayload(aviary_options: AviaryValues): as_flown_payload = as_flown_passenger_payload_mass + cargo if as_flown_payload > des_payload: print('WARNING! as flown payload > design payload! Please re-design the aircraft!') - raise om.AnalysisError( - f"ERROR: In preprocesssors.py: as_flown payload {as_flown_payload} = passenger_payload_mass {as_flown_passenger_payload_mass} + cargo_mass {cargo} is larger than the design payload {des_payload} = design_passenger_payload {design_passenger_payload_mass} + Design.cargo_mass {des_cargo} : Aricraft must be re-designed") + #raise om.AnalysisError( + # f"ERROR: In preprocesssors.py: as_flown payload {as_flown_payload} = passenger_payload_mass {as_flown_passenger_payload_mass} + cargo_mass {cargo} is larger than the design payload {des_payload} = design_passenger_payload {design_passenger_payload_mass} + Design.cargo_mass {des_cargo} : Aricraft must be re-designed") # set assumed cargo mass variables: aviary_options.set_val(Aircraft.CrewPayload.CARGO_MASS, cargo, 'lbm')