Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions aviary/core/aviary_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ def add_design_variables(self, problem_type: ProblemType = None, verbosity=None)
and another for the gross mass of the aircraft computed during the mission. A constraint is
also added to ensure that the residual range is zero.

If solving an alternate problem, only a design variable for the gross mass of the aircraft
If solving an OFF_DESIGN_MIN_FUEL problem, only a design variable for the gross mass of the aircraft
computed during the mission is added. A constraint is also added to ensure that the residual
range is zero.

Expand Down Expand Up @@ -1364,7 +1364,7 @@ def add_design_variables(self, problem_type: ProblemType = None, verbosity=None)
if self.require_range_residual:
self.add_constraint(Mission.Constraints.RANGE_RESIDUAL, equals=0, ref=1000)

elif problem_type is ProblemType.ALTERNATE:
elif problem_type is ProblemType.OFF_DESIGN_MIN_FUEL:
# target range problem
# fixed vehicle (design GTOW) but variable actual GTOW for off-design
# get the design gross mass and set as the upper bound for the gross mass design variable
Expand All @@ -1379,10 +1379,12 @@ def add_design_variables(self, problem_type: ProblemType = None, verbosity=None)

self.add_constraint(Mission.Constraints.RANGE_RESIDUAL, equals=0, ref=1000)

elif problem_type is ProblemType.FALLOUT:
elif problem_type is ProblemType.OFF_DESIGN_MAX_RANGE:
# fixed vehicle gross mass aviary finds optimal trajectory and maximum range
if verbosity >= Verbosity.VERBOSE:
print('No additional aircraft design variables added for Fallout missions')
print(
'No additional aircraft design variables added for OFF_DESIGN_MAX_RANGE missions'
)

elif problem_type is ProblemType.MULTI_MISSION:
self.add_design_var(
Expand Down
42 changes: 21 additions & 21 deletions aviary/core/aviary_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def add_design_variables(self, verbosity=None):
and another for the gross mass of the aircraft computed during the mission. A constraint is
also added to ensure that the residual range is zero.

If solving an alternate problem, only a design variable for the gross mass of the aircraft
If solving an OFF_DESIGN_MIN_FUEL problem, only a design variable for the gross mass of the aircraft
computed during the mission is added. A constraint is also added to ensure that the residual
range is zero.

Expand Down Expand Up @@ -694,10 +694,10 @@ def add_objective(self, objective_type=None, ref=None, verbosity=None):
if self.problem_type is ProblemType.SIZING:
self.model.add_objective(Mission.Objectives.FUEL, ref=ref)

elif self.problem_type is ProblemType.ALTERNATE:
elif self.problem_type is ProblemType.OFF_DESIGN_MIN_FUEL:
self.model.add_objective(Mission.Objectives.FUEL, ref=ref)

elif self.problem_type is ProblemType.FALLOUT:
elif self.problem_type is ProblemType.OFF_DESIGN_MAX_RANGE:
# if ref > 0:
# # Maximize range.
# ref = -ref
Expand Down Expand Up @@ -786,8 +786,8 @@ def add_composite_objective(self, *args, ref: float = None):
If 2-tuple: (model, output) or (output, weight)
If 1-tuple: (output) or 'fuel', 'fuel_burned', 'mass', 'range', 'time'
If empty, information will be populated based on problem_type:
- If ProblemType = FALLOUT, objective = Mission.Objectives.RANGE
- If ProblemType = Sizing or Alternate, objective = Mission.Objectives.FUEL
- If ProblemType = OFF_DESIGN_MAX_RANGE, objective = Mission.Objectives.RANGE
- If ProblemType = Sizing or OFF_DESIGN_MIN_FUEL, objective = Mission.Objectives.FUEL

Example inputs can be any of the following:
('fuel')
Expand Down Expand Up @@ -858,17 +858,17 @@ def add_composite_objective(self, *args, ref: float = None):
# in some cases the users provides no input and we can derive the objectie from the problem type:
elif self.model.problem_type is ProblemType.SIZING:
model, output, weight = default_model, Mission.Objectives.FUEL, default_weight
elif self.model.problem_type is ProblemType.ALTERNATE:
elif self.model.problem_type is ProblemType.OFF_DESIGN_MIN_FUEL:
model, output, weight = default_model, Mission.Objectives.FUEL, default_weight
elif self.model.problem_type is ProblemType.FALLOUT:
elif self.model.problem_type is ProblemType.OFF_DESIGN_MAX_RANGE:
model, output, weight = default_model, Mission.Objectives.RANGE, default_weight
else:
raise ValueError(
f'Unrecognized objective format: {arg}. '
f'Each argument must be one of the following: '
f'(output), (output, weight), (model, output), or (model, output, weight).'
f'Outputs can be from the variable meta data, or can be: fuel_burned, fuel'
f'Or problem type must be set to SIZING, ALTERNATE, or FALLOUT'
f'Or problem type must be set to SIZING, OFF_DESIGN_MIN_FUEL, or OFF_DESIGN_MAX_RANGE'
)
objectives.append((model, output, weight))
# objectives = [
Expand Down Expand Up @@ -1321,10 +1321,10 @@ def run_off_design_mission(
for total cargo mass.
mission_gross_mass : float, optional
Gross mass of aircraft flying off-design mission, in pounds-mass. Defaults to design
gross mass. For missions where mass is solved for (such as ALTERNATE missions), this is
gross mass. For missions where mass is solved for (such as OFF_DESIGN_MIN_FUEL missions), this is
the initial guess.
mission_range : float, optional
[ALTERNATE missions only]
[OFF_DESIGN_MIN_FUEL missions only]
Sets fixed range of flown off-design mission, in nautical miles. Unused for other
mission types.
optimizer : string, optional
Expand Down Expand Up @@ -1434,12 +1434,12 @@ def run_off_design_mission(
# NOTE once load_inputs is run, phase info details are stored in prob.model.configurator,
# meaning any phase_info changes that happen after load inputs is ignored

if problem_type is ProblemType.ALTERNATE:
if problem_type is ProblemType.OFF_DESIGN_MIN_FUEL:
# Set mission range, aviary will calculate required fuel
if mission_range is None:
if verbosity >= Verbosity.VERBOSE:
warnings.warn(
'Alternate problem type requested with no specified range. Using design '
'OFF_DESIGN_MIN_FUEL problem type requested with no specified range. Using design '
'mission range for the off-design mission.'
)
mission_range = self.get_val(Mission.RANGE, units='NM')[0]
Expand All @@ -1453,9 +1453,9 @@ def run_off_design_mission(
off_design_prob.load_inputs(inputs, phase_info, verbosity=verbosity)

# Update inputs that are specific to problem type
# Some Alternate problem changes had to happen before load_inputs, all fallout problem
# Some OFF_DESIGN_MIN_FUEL problem changes had to happen before load_inputs, all OFF_DESIGN_MAX_RANGE problem
# changes must come after load_inputs
if problem_type is ProblemType.ALTERNATE:
if problem_type is ProblemType.OFF_DESIGN_MIN_FUEL:
off_design_prob.aviary_inputs.set_val(Mission.RANGE, mission_range, units='NM')
# set initial guess for Mission.GROSS_MASS to help optimizer with new design
# variable bounds.
Expand All @@ -1467,12 +1467,12 @@ def run_off_design_mission(
Mission.GROSS_MASS, mission_gross_mass * 0.9, units='lbm'
)

elif problem_type is ProblemType.FALLOUT:
elif problem_type is ProblemType.OFF_DESIGN_MAX_RANGE:
# Set mission fuel and calculate gross weight, aviary will calculate range
if mission_gross_mass is None:
if verbosity >= Verbosity.VERBOSE:
warnings.warn(
'Fallout problem type requested with no specified gross mass. Using design '
'OFF_DESIGN_MAX_RANGE problem type requested with no specified gross mass. Using design '
'takeoff gross mass for the off-design mission.'
)
mission_gross_mass = self.get_val(Aircraft.Design.GROSS_MASS, units='lbm')[0]
Expand Down Expand Up @@ -1684,7 +1684,7 @@ def run_payload_range(self, verbosity=None):
# we don't know if we actually filled the aircraft to exactly TOGW yet. Need to use
# "fill_cargo" flag in off-design call
economic_range_prob = self.economic_range_prob = self.run_off_design_mission(
problem_type=ProblemType.FALLOUT,
problem_type=ProblemType.OFF_DESIGN_MAX_RANGE,
phase_info=phase_info,
num_first_class=economic_mission_num_first,
num_business=economic_mission_num_bus,
Expand All @@ -1696,7 +1696,7 @@ def run_payload_range(self, verbosity=None):
verbosity=verbosity,
)

# Pull the payload and range values from the fallout mission
# Pull the payload and range values from the OFF_DESIGN_MAX_RANGE mission
payload_3 = float(
economic_range_prob.get_val(Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS)
)
Expand All @@ -1719,7 +1719,7 @@ def run_payload_range(self, verbosity=None):
ferry_cargo_mass = None
ferry_range_gross_mass = operating_mass + max_usable_fuel
ferry_range_prob = self.ferry_range_prob = self.run_off_design_mission(
problem_type=ProblemType.FALLOUT,
problem_type=ProblemType.OFF_DESIGN_MAX_RANGE,
phase_info=phase_info,
num_first_class=0,
num_business=0,
Expand All @@ -1743,7 +1743,7 @@ def run_payload_range(self, verbosity=None):
payload_3 = payload_4
range_3 = range_4

# Check if fallout missions ran successfully before writing to csv file
# Check if OFF_DESIGN_MAX_RANGE missions ran successfully before writing to csv file
# If both missions ran successfully, writes the payload/range data to a csv file
self.payload_range_data = payload_range_data = NamedValues()
if ferry_range_prob.result.success and economic_range_prob.result.success:
Expand All @@ -1770,7 +1770,7 @@ def run_payload_range(self, verbosity=None):
return (economic_range_prob, ferry_range_prob)
else:
warnings.warn(
'One or both of the fallout missions did not run successfully; payload/range '
'One or both of the OFF_DESIGN_MAX_RANGE missions did not run successfully; payload/range '
'diagram was not generated.'
)
else:
Expand Down
Loading
Loading