Skip to content

Commit

Permalink
PR feedback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjasa committed Mar 20, 2024
1 parent 71c6a9b commit 4e30f05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 1 addition & 3 deletions aviary/interface/test/test_height_energy_mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,4 @@ def test_custom_phase_builder_error(self):


if __name__ == '__main__':
z = AircraftMissionTestSuite()
z.setUp()
z.test_mission_solve_for_distance()
unittest.main()
13 changes: 7 additions & 6 deletions aviary/mission/flight_phase_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from aviary.mission.flops_based.phases.phase_utils import add_subsystem_variables_to_phase, get_initial
from aviary.variable_info.variables import Dynamic
from aviary.mission.flops_based.ode.mission_ODE import MissionODE
from aviary.variable_info.enums import EquationsOfMotion


# TODO: support/handle the following in the base class
Expand Down Expand Up @@ -50,7 +51,7 @@ def __init__(

self.meta_data = meta_data

def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_energy'):
def build_phase(self, aviary_options: AviaryValues = None, phase_type=EquationsOfMotion.HEIGHT_ENERGY):
'''
Return a new energy phase for analysis using these constraints.
Expand Down Expand Up @@ -108,7 +109,7 @@ def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_en
phase.add_constraint('rhs_all.initial_mass_residual', equals=0.0, ref=1e4)
input_initial_mass = False

if phase_type == 'height_energy':
if phase_type is EquationsOfMotion.HEIGHT_ENERGY:
rate_source = Dynamic.Mission.FUEL_FLOW_RATE_NEGATIVE_TOTAL
else:
rate_source = "dmass_dr"
Expand All @@ -121,7 +122,7 @@ def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_en
input_initial=input_initial_mass,
)

if phase_type == 'height_energy':
if phase_type is EquationsOfMotion.HEIGHT_ENERGY:
input_initial_distance = get_initial(input_initial, Dynamic.Mission.DISTANCE)
fix_initial_distance = get_initial(
fix_initial, Dynamic.Mission.DISTANCE, True)
Expand All @@ -139,7 +140,7 @@ def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_en
################
# Add Controls #
################
if phase_type == 'height_energy':
if phase_type is EquationsOfMotion.HEIGHT_ENERGY:
rate_targets = [Dynamic.Mission.MACH_RATE]
else:
rate_targets = ['dmach_dr']
Expand All @@ -162,7 +163,7 @@ def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_en
)

# Add altitude rate as a control
if phase_type == 'height_energy':
if phase_type is EquationsOfMotion.HEIGHT_ENERGY:
rate_targets = [Dynamic.Mission.ALTITUDE_RATE]
rate2_targets = []
else:
Expand Down Expand Up @@ -236,7 +237,7 @@ def build_phase(self, aviary_options: AviaryValues = None, phase_type='height_en

phase.add_timeseries_output(Dynamic.Mission.ALTITUDE)

if phase_type == 'two_dof':
if phase_type is EquationsOfMotion.SOLVED_2DOF:
phase.add_timeseries_output(Dynamic.Mission.FLIGHT_PATH_ANGLE)
phase.add_timeseries_output("alpha")
phase.add_timeseries_output(
Expand Down
8 changes: 6 additions & 2 deletions aviary/mission/twodof_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from aviary.variable_info.variable_meta_data import _MetaData
from aviary.variable_info.variables import Dynamic
from aviary.mission.gasp_based.ode.unsteady_solved.unsteady_solved_ode import UnsteadySolvedODE
from aviary.variable_info.enums import SpeedType
from aviary.variable_info.enums import SpeedType, EquationsOfMotion

# TODO: support/handle the following in the base class
# - phase.set_time_options()
Expand Down Expand Up @@ -41,7 +41,8 @@ def build_phase(self, aviary_options: AviaryValues = None):
dymos.Phase
'''
self.ode_class = UnsteadySolvedODE
phase: dm.Phase = super().build_phase(aviary_options, phase_type='two_dof')
phase: dm.Phase = super().build_phase(
aviary_options, phase_type=EquationsOfMotion.SOLVED_2DOF)

user_options: AviaryValues = self.user_options

Expand Down Expand Up @@ -76,6 +77,9 @@ def build_phase(self, aviary_options: AviaryValues = None):
val=0.,
opt=True)

phase.add_timeseries_output("EAS", units="kn")
phase.add_timeseries_output("TAS", units="kn")

return phase

def make_default_transcription(self):
Expand Down

0 comments on commit 4e30f05

Please sign in to comment.