Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EngineDecks now take scale factor as an input #565

Merged
merged 19 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions aviary/docs/getting_started/onboarding_level3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@
"\n",
"traj.link_phases([\"climb\", \"cruise\", \"descent\"], [\"time\", av.Dynamic.Vehicle.MASS, av.Dynamic.Mission.DISTANCE], connected=strong_couple)\n",
"\n",
"param_vars = [av.Aircraft.Nacelle.CHARACTERISTIC_LENGTH,\n",
"param_vars = [av.Aircraft.Engine.SCALE_FACTOR,\n",
" av.Aircraft.Nacelle.CHARACTERISTIC_LENGTH,\n",
" av.Aircraft.Nacelle.FINENESS,\n",
" av.Aircraft.Nacelle.LAMINAR_FLOW_LOWER,\n",
" av.Aircraft.Nacelle.LAMINAR_FLOW_UPPER,\n",
Expand Down Expand Up @@ -451,6 +452,7 @@
"\n",
"# Set initial default values for all LEAPS aircraft variables.\n",
"varnames = [\n",
" av.Aircraft.Engine.SCALE_FACTOR,\n",
" av.Aircraft.Wing.MAX_CAMBER_AT_70_SEMISPAN,\n",
" av.Aircraft.Wing.SWEEP,\n",
" av.Aircraft.Wing.TAPER_RATIO,\n",
Expand Down Expand Up @@ -698,7 +700,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "aviary",
"language": "python",
"name": "python3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@
"# Set initial default values for any variables that have\n",
"# different defaults in premission and mission.\n",
"varnames = [\n",
" av.Aircraft.Engine.SCALE_FACTOR,\n",
" av.Aircraft.Wing.AREA,\n",
" av.Aircraft.Wing.MAX_CAMBER_AT_70_SEMISPAN,\n",
" av.Aircraft.Wing.SWEEP,\n",
Expand Down
2 changes: 0 additions & 2 deletions aviary/mission/flops_based/ode/landing_eom.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None):

alpha0 = aviary_options.get_val(Mission.Takeoff.ANGLE_OF_ATTACK_RUNWAY, 'rad')
t_inc = aviary_options.get_val(Mission.Takeoff.THRUST_INCIDENCE, 'rad')
total_num_engines = aviary_options.get_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES)

mass = inputs[Dynamic.Vehicle.MASS]
lift = inputs[Dynamic.Vehicle.LIFT]
Expand Down Expand Up @@ -234,7 +233,6 @@ def compute_partials(self, inputs, J, discrete_inputs=None):

alpha0 = aviary_options.get_val(Mission.Takeoff.ANGLE_OF_ATTACK_RUNWAY, 'rad')
t_inc = aviary_options.get_val(Mission.Takeoff.THRUST_INCIDENCE, 'rad')
total_num_engines = aviary_options.get_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES)

mass = inputs[Dynamic.Vehicle.MASS]
lift = inputs[Dynamic.Vehicle.LIFT]
Expand Down
2 changes: 1 addition & 1 deletion aviary/mission/gasp_based/ode/test/test_landing_eom.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_case1(self):
prob.setup(check=False, force_alloc_complex=True)

partial_data = prob.check_partials(out_stream=None, method="cs")
assert_check_partials(partial_data, atol=2e-11, rtol=1e-12)
assert_check_partials(partial_data, atol=1e-10, rtol=1e-12)


class GroundRollTestCase(unittest.TestCase):
Expand Down
56 changes: 16 additions & 40 deletions aviary/models/N3CC/N3CC_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,34 +186,20 @@
filename = get_path('models/engines/turbofan_22k.deck')

inputs.set_val(Aircraft.Engine.DATA_FILE, filename)
engine_mass = 6293.8
engine_mass_units = 'lbm'
inputs.set_val(Aircraft.Engine.MASS, engine_mass, engine_mass_units)
inputs.set_val(
Aircraft.Engine.REFERENCE_MASS,
engine_mass,
engine_mass_units)
scaled_sls_thrust = 22200.5
scaled_sls_thrust_units = 'lbf'
inputs.set_val(
Aircraft.Engine.SCALED_SLS_THRUST, scaled_sls_thrust, scaled_sls_thrust_units)
inputs.set_val(
Aircraft.Engine.REFERENCE_SLS_THRUST, scaled_sls_thrust, scaled_sls_thrust_units)
inputs.set_val(Aircraft.Engine.MASS, 6293.8, 'lbm')
inputs.set_val(Aircraft.Engine.REFERENCE_MASS, 6293.8, 'lbm')
inputs.set_val(Aircraft.Engine.SCALE_FACTOR, 0.99997747798473)
inputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS_SCALER, 0.0)
num_engines = 2
inputs.set_val(Aircraft.Engine.NUM_ENGINES, num_engines)
num_fuselage_engines = 0
inputs.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, num_fuselage_engines)
num_wing_engines = num_engines
inputs.set_val(Aircraft.Engine.NUM_WING_ENGINES, num_wing_engines)
inputs.set_val(Aircraft.Engine.NUM_ENGINES, 2)
inputs.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 0)
inputs.set_val(Aircraft.Engine.NUM_WING_ENGINES, 2)
inputs.set_val(Aircraft.Engine.WING_LOCATIONS, 0.289682918)
inputs.set_val(Aircraft.Engine.SCALE_MASS, True)
inputs.set_val(Aircraft.Engine.MASS_SCALER, 1.15)
inputs.set_val(Aircraft.Engine.SCALE_PERFORMANCE, True)
inputs.set_val(Aircraft.Engine.SUBSONIC_FUEL_FLOW_SCALER, 1.0)
inputs.set_val(Aircraft.Engine.SUPERSONIC_FUEL_FLOW_SCALER, 1.0)
inputs.set_val(
Aircraft.Engine.FUEL_FLOW_SCALER_CONSTANT_TERM, 0.0)
inputs.set_val(Aircraft.Engine.FUEL_FLOW_SCALER_CONSTANT_TERM, 0.0)
inputs.set_val(Aircraft.Engine.FUEL_FLOW_SCALER_LINEAR_TERM, 1.0)
inputs.set_val(Aircraft.Engine.CONSTANT_FUEL_CONSUMPTION, 0.0, units='lb/h')
inputs.set_val(Aircraft.Engine.ADDITIONAL_MASS_FRACTION, 0.0)
Expand Down Expand Up @@ -396,36 +382,26 @@

outputs.set_val(Aircraft.Paint.MASS, 0.0, 'lbm')

outputs.set_val(
Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST,
scaled_sls_thrust * num_engines, scaled_sls_thrust_units)
inputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST, 22200.5, 'lbf')
inputs.set_val(Aircraft.Engine.REFERENCE_SLS_THRUST, 22200.5, 'lbf')
outputs.set_val(Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST, 22200.5 * 2, 'lbf')

outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS, 110.0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES, num_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES, 2)

outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES, num_wing_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES, 2)

outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_FUSELAGE_ENGINES, num_fuselage_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_FUSELAGE_ENGINES, 0)

outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS, 0.0, 'lbm')

outputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
# Not printed in FLOPS, but total mass matches
outputs.set_val(Aircraft.Engine.POD_MASS, 6619.27529209, 'lbm')
outputs.set_val(Aircraft.Engine.MASS, 12587./2.0, 'lbm')
outputs.set_val(Aircraft.Engine.ADDITIONAL_MASS, 0.0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_MISC_MASS, 0.0, 'lbm')
thrust_reversers_mass = 0.
thrust_reversers_mass_units = 'lbm'
outputs.set_val(
Aircraft.Engine.THRUST_REVERSERS_MASS,
thrust_reversers_mass, thrust_reversers_mass_units)
outputs.set_val(
Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS,
thrust_reversers_mass, thrust_reversers_mass_units)
outputs.set_val(
Aircraft.Propulsion.TOTAL_ENGINE_MASS,
engine_mass * num_engines, engine_mass_units)
outputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS, 0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS, 0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_MASS, 6293.8 * 2, 'lbm')

outputs.set_val(Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, 11.25, 'ft')
outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
inputs.set_val(Aircraft.Engine.NUM_WING_ENGINES, 2)
inputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS_SCALER, 0.0)
inputs.set_val(Aircraft.Engine.WING_LOCATIONS, 15.8300 / (117.83 / 2))
inputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
inputs.set_val(Aircraft.Engine.SCALE_MASS, True)
inputs.set_val(Aircraft.Engine.MASS_SCALER, 1.15)
inputs.set_val(Aircraft.Engine.SCALE_PERFORMANCE, True)
Expand Down Expand Up @@ -357,11 +358,10 @@
outputs.set_val(Aircraft.Engine.POD_MASS, 9000, 'lbm')
outputs.set_val(Aircraft.Engine.ADDITIONAL_MASS, 0.0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_MISC_MASS, 648.83, 'lbm')
outputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
outputs.set_val(Aircraft.Propulsion.TOTAL_STARTER_MASS, 560.39, 'lbm')

outputs.set_val(Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS, 0, 'lbm')
outputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS, 0, 'lbm')
outputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST, 28928.1, 'lbf')

outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_MASS, 7400 * 2, 'lbm')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,34 +159,23 @@
'models/engines/turbofan_24k_1.deck')

inputs.set_val(Aircraft.Engine.DATA_FILE, filename)
engine_mass = 8071.35
engine_mass_units = 'lbm'
inputs.set_val(Aircraft.Engine.MASS, engine_mass, engine_mass_units)
inputs.set_val(
Aircraft.Engine.REFERENCE_MASS,
engine_mass,
engine_mass_units)
scaled_sls_thrust = 27301.0
scaled_sls_thrust_units = 'lbf'
inputs.set_val(Aircraft.Engine.MASS, 8071.35, 'lbm')
inputs.set_val(Aircraft.Engine.REFERENCE_MASS, 8071.35, 'lbm')
inputs.set_val(Aircraft.Engine.REFERENCE_SLS_THRUST, 27301.0, 'lbf')
inputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
inputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST,
scaled_sls_thrust, scaled_sls_thrust_units)
inputs.set_val(
Aircraft.Engine.REFERENCE_SLS_THRUST, scaled_sls_thrust, scaled_sls_thrust_units)
num_engines = 2
inputs.set_val(Aircraft.Engine.NUM_ENGINES, num_engines)
num_fuselage_engines = 0
inputs.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, num_fuselage_engines)
num_wing_engines = 2
inputs.set_val(Aircraft.Engine.NUM_WING_ENGINES, num_wing_engines)
27301.0, 'lbf')
inputs.set_val(Aircraft.Engine.NUM_ENGINES, 2)
inputs.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 0)
inputs.set_val(Aircraft.Engine.NUM_WING_ENGINES, 2)
inputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS_SCALER, 1.0)
inputs.set_val(Aircraft.Engine.SCALE_MASS, True)
inputs.set_val(Aircraft.Engine.MASS_SCALER, 1.15)
inputs.set_val(Aircraft.Engine.SCALE_PERFORMANCE, True)
inputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
inputs.set_val(Aircraft.Engine.SUBSONIC_FUEL_FLOW_SCALER, 1.0)
inputs.set_val(Aircraft.Engine.SUPERSONIC_FUEL_FLOW_SCALER, 1.0)
inputs.set_val(
Aircraft.Engine.FUEL_FLOW_SCALER_CONSTANT_TERM, 0.0)
inputs.set_val(Aircraft.Engine.FUEL_FLOW_SCALER_CONSTANT_TERM, 0.0)
inputs.set_val(Aircraft.Engine.FUEL_FLOW_SCALER_LINEAR_TERM, 0.0)
inputs.set_val(Aircraft.Engine.CONSTANT_FUEL_CONSUMPTION, 0.0, units='lbm/h')
inputs.set_val(Aircraft.Engine.ADDITIONAL_MASS_FRACTION, 0.0)
Expand Down Expand Up @@ -314,13 +303,11 @@

outputs.set_val(Aircraft.Furnishings.MASS, 14690., 'lbm')

avg_diameter = (13.0208 + 12.33) / 2
avg_diameter_units = 'ft'
outputs.set_val(Aircraft.Fuselage.AVG_DIAMETER, avg_diameter, avg_diameter_units)
outputs.set_val(Aircraft.Fuselage.AVG_DIAMETER, (13.0208 + 12.33) / 2, 'ft')
outputs.set_val(Aircraft.Fuselage.CHARACTERISTIC_LENGTH, 124.75, 'ft')
outputs.set_val(
Aircraft.Fuselage.CROSS_SECTION,
pi * (avg_diameter / 2.0)**2.0, 'ft**2')
pi * (12.6754 / 2.0)**2.0, 'ft**2')
outputs.set_val(Aircraft.Fuselage.DIAMETER_TO_WING_SPAN, 0.112598)
outputs.set_val(Aircraft.Fuselage.FINENESS, 9.8419)
outputs.set_val(Aircraft.Fuselage.LENGTH_TO_DIAMETER, 9.841898)
Expand Down Expand Up @@ -348,13 +335,11 @@
outputs.set_val(Aircraft.Nacelle.WETTED_AREA, np.array([228.34]), 'ft**2')

outputs.set_val(Aircraft.Paint.MASS, 582.3, 'lbm')

outputs.set_val(
Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST,
scaled_sls_thrust * num_engines, scaled_sls_thrust_units)
27301.0 * 2, 'lbf')

total_num_engines = num_engines
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES, total_num_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES, 2)

ctrls_mass = 0.26 * 2 * 27301.0**0.5 # 85.92
ctrls_mass_units = 'lbm'
Expand All @@ -368,30 +353,21 @@

outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS, 125.42, 'lbm')

outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES, num_wing_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES, 2)

outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_FUSELAGE_ENGINES, num_fuselage_engines)
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_FUSELAGE_ENGINES, 2)

outputs.set_val(
Aircraft.Propulsion.TOTAL_ENGINE_MASS,
engine_mass * num_engines, engine_mass_units)
outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_MASS, 16143., 'lbm')

outputs.set_val(Aircraft.Engine.MASS, 16143./2.0, 'lbm')
outputs.set_val(Aircraft.Engine.POD_MASS, 10350, 'lbm')
outputs.set_val(Aircraft.Engine.ADDITIONAL_MASS, 0.0, 'lbm')
outputs.set_val(Aircraft.Propulsion.TOTAL_MISC_MASS, 550.4, 'lbm')
outputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
outputs.set_val(
Aircraft.Propulsion.TOTAL_STARTER_MASS, 11.0 * 2 * 0.82**0.32 * 7.0**1.6, 'lbm')

thrust_reversers_mass = 1856.4
thrust_reversers_mass_units = 'lbm'
outputs.set_val(
Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS,
thrust_reversers_mass, thrust_reversers_mass_units)
outputs.set_val(
Aircraft.Engine.THRUST_REVERSERS_MASS,
thrust_reversers_mass, thrust_reversers_mass_units)
outputs.set_val(Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS, 1856.4, 'lbm')
outputs.set_val(Aircraft.Engine.THRUST_REVERSERS_MASS, 1856.4, 'lbm')

outputs.set_val(Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, 11.30, 'ft')
outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1375)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
inputs.set_val(Aircraft.Engine.DATA_FILE, filename)
inputs.set_val(Aircraft.Engine.MASS, 8071.35, 'lbm')
inputs.set_val(Aircraft.Engine.REFERENCE_MASS, 8071.35, 'lbm')
inputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST, 27301.0, 'lbf')
inputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST, 28928.1, 'lbf')
inputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
inputs.set_val(Aircraft.Engine.REFERENCE_SLS_THRUST, 27301.0, 'lbf')
inputs.set_val(Aircraft.Engine.NUM_ENGINES, 2)
inputs.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 0)
Expand Down Expand Up @@ -346,6 +347,7 @@
outputs.set_val(Aircraft.Paint.MASS, 582.3, 'lbm')

outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_ENGINES, 2)
inputs.set_val(Aircraft.Engine.SCALED_SLS_THRUST, 27301.0, 'lbf')
outputs.set_val(
Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST,
27301.0 * 2, 'lbf')
Expand All @@ -368,7 +370,6 @@
outputs.set_val(Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES, 2)
outputs.set_val(Aircraft.Engine.MASS, 16143./2.0, 'lbm')
outputs.set_val(Aircraft.Engine.ADDITIONAL_MASS, 0.0, 'lbm')
outputs.set_val(Aircraft.Engine.SCALE_FACTOR, 1.0)
outputs.set_val(Aircraft.Propulsion.TOTAL_ENGINE_MASS, 8071.35 * 2, 'lbm')

outputs.set_val(Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, 11.30, 'ft')
Expand Down
Loading
Loading