Creating a Turboprop Powered Aircraft Example#
Here we will create an aircraft using a more advanced EngineModel
, the TurbopropModel
. This is a more complicated type of engine that combines several different models into a single unit. The TurbopropModel
has three individual pieces needed to create it - a “shaft power model” that describes how the turboprop turns energy into shaft power, such as a turboshaft or motor, a “gearbox model” for adjusting the shaft RPM, and a “propeller model” to convert shaft power into thrust. Let’s walk through two examples: first building a turboprop-powered aircraft with a minimum amount of information, and then a second example where we electrify the aircraft by replacing the default models in the TurbopropModel
with custom ones.
Basic Turboprop Aircraft Example#
import aviary.api as av
from aviary.models.large_turboprop_freighter.phase_info import two_dof_phase_info
Aircraft = av.Aircraft
Mission = av.Mission
Dynamic = av.Dynamic
# define the minimum option set for a turboprop
options = av.AviaryValues()
# top-level turboprop settings
options.set_val(av.Settings.VERBOSITY, 0) # quiet unneeded printouts
options.set_val(Aircraft.Engine.FIXED_RPM, 13820, units='rpm')
# EngineDeck minimum option set
options.set_val(Aircraft.Engine.DATA_FILE, av.get_path('models/engines/turboshaft_4465hp.deck'))
# Gearbox model minimum option set
options.set_val(Aircraft.Engine.Gearbox.GEAR_RATIO, 13.55, 'unitless')
options.set_val(Aircraft.Engine.Gearbox.SHAFT_POWER_DESIGN, 4465, 'hp')
# Hamilton Standard propeller minimum option set
options.set_val(Aircraft.Engine.Propeller.TIP_MACH_MAX, 1.0)
options.set_val(Aircraft.Engine.Propeller.NUM_BLADES, val=4, units='unitless')
options.set_val(Aircraft.Engine.Propeller.COMPUTE_INSTALLATION_LOSS, True)
# Initialize turboprop model. Model uses an EngineDeck built from `options`, basic
# gearbox model with default efficiency of 1, and the Hamilton Standard propeller model
# "turboprop" is ready to be included in an AviaryProblem
turboprop = av.TurbopropModel(name='turboprop_example', options=options)
# Build and run AviaryProblem using the Level2 interface
prob = av.AviaryProblem()
prob.load_inputs(
'models/large_turboprop_freighter/large_turboprop_freighter_GASP.csv',
two_dof_phase_info,
engine_builders=[turboprop],
)
prob.check_and_preprocess_inputs()
prob.add_pre_mission_systems()
prob.add_phases()
prob.add_post_mission_systems()
prob.link_phases()
prob.add_driver('IPOPT', max_iter=0, verbosity=0)
prob.add_design_variables()
prob.add_objective()
prob.setup()
prob.set_initial_guesses()
prob.run_aviary_problem(suppress_solver_print=True, make_plots=False)
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/pyoptsparse/pyOpt_MPI.py:68: UserWarning: mpi4py could not be imported. mpi4py is required to use the parallel gradient analysis and parallel objective analysis for non-gradient based optimizers. Continuing using a dummy MPI module from pyOptSparse.
warnings.warn(warn)
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <aircraft:engine:scale_performance> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value True will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <aircraft:engine:ignore_negative_thrust> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value False will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <aircraft:engine:geopotential_alt> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value False will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <aircraft:engine:generate_flight_idle> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value False will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <aircraft:engine:interpolation_method> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value slinear will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/subsystems/propulsion/engine_deck.py:234: UserWarning: <mission:summary:fuel_flow_scaler> is a required option for EngineDecks, but has not been specified for EngineDeck <engine_deck>. The default value 1.0 will be used.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/utils/preprocessors.py:345: UserWarning: As-flown cargo mass was specified but design cargo mass and max cargo mass were not. To mantain backwards-compatibility with converted GASP files, setting max cargo mass to 0 and maximum and design cargo masses to zero.
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/utils/preprocessors.py:429: UserWarning: As-flown payload (11400.0) is greater than design payload (0.0). The aircraft will be undersized for this payload!
warnings.warn(
/home/runner/work/Aviary/Aviary/aviary/utils/preprocessors.py:659: UserWarning: Mount location for engines of type <turboprop_example> not specified. Wing-mounted engines are assumed.
warnings.warn(
No design variables for Fallout missions
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'groundroll': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'rotation': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'ascent': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'accel': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'climb1': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'climb2': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'cruise': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'desc1': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/dymos/phase/phase.py:2386: RuntimeWarning: Invalid options for non-optimal parameter 'aircraft:engine:gearbox:shaft_power_design' in phase 'desc2': lower
warnings.warn(f"Invalid options for non-optimal parameter '{name}' in "
'rhs_checking' is disabled for 'DirectSolver in 'traj.phases.ascent' <class Phase>' but that solver has redundant adjoint solves. If it is expensive to compute derivatives for this solver, turning on 'rhs_checking' may improve performance.
'rhs_checking' is disabled for 'DirectSolver in 'traj.phases.climb1' <class Phase>' but that solver has redundant adjoint solves. If it is expensive to compute derivatives for this solver, turning on 'rhs_checking' may improve performance.
'rhs_checking' is disabled for 'DirectSolver in 'traj.phases.desc1' <class Phase>' but that solver has redundant adjoint solves. If it is expensive to compute derivatives for this solver, turning on 'rhs_checking' may improve performance.
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/openmdao/core/total_jac.py:1757: DerivativesWarning:Design variables [('aircraft:engine:gearbox:shaft_power_design', inds=[0]), ('aircraft:engine:propeller:integrated_lift_coefficient', inds=[0])] have no impact on the constraints or objective.
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank
/home/runner/work/Aviary/Aviary/aviary/interface/methods_for_level2.py:1934: UserWarning:
Aviary run failed. See the dashboard for more details.
warnings.warn('\nAviary run failed. See the dashboard for more details.\n')
/usr/share/miniconda/envs/test/lib/python3.12/site-packages/openmdao/core/driver.py:144: OMDeprecationWarning:boolean evaluation of DriverResult is temporarily implemented to mimick the previous `failed` return behavior of run_driver.
Use the `success` attribute of the returned DriverResult object to test for successful driver completion.
Electrified Propeller Aircraft Example#
This model is a WIP and will be coming soon