Skip to content

Commit

Permalink
updates to load_off_design function to handle num_pax and cargo. WIP …
Browse files Browse the repository at this point in the history
…-> need to update other off design function for running alternate and fallout missions
  • Loading branch information
cmbenne3 committed Dec 10, 2024
1 parent 44d7c92 commit 777df7b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions aviary/interface/methods_for_level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aviary/models/test_aircraft/aircraft_for_bench_GwGm.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions aviary/utils/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 777df7b

Please sign in to comment.