Skip to content

Commit

Permalink
Merge pull request #88 from johnjasa/move_gasp_phases_to_builder
Browse files Browse the repository at this point in the history
Make GASP-based phases use phase builders
  • Loading branch information
johnjasa authored Jan 25, 2024
2 parents 14ae396 + 597d29b commit 4f8f2b2
Show file tree
Hide file tree
Showing 54 changed files with 1,803 additions and 7,047 deletions.
16 changes: 8 additions & 8 deletions aviary/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@


# Phase builders
from aviary.mission.flops_based.phases.phase_builder_base import PhaseBuilderBase
from aviary.mission.phase_builder_base import PhaseBuilderBase
# note that this is only for simplified right now
from aviary.mission.flops_based.phases.energy_phase import EnergyPhase as HeightEnergyPhaseBuilder
from aviary.mission.flops_based.phases.build_landing import Landing as HeightEnergyLandingPhaseBuilder
Expand All @@ -107,13 +107,13 @@
from aviary.mission.flops_based.phases.detailed_takeoff_phases import TakeoffMicP1ToClimb as DetailedTakeoffMicP1ToClimbPhaseBuilder
from aviary.mission.flops_based.phases.detailed_takeoff_phases import TakeoffBrakeToAbort as DetailedTakeoffBrakeToAbortPhaseBuilder

# Phase getters # TODO these should be going away in favor of phase builders
from aviary.mission.gasp_based.phases.accel_phase import get_accel as get_2DOF_acceleration_phase
from aviary.mission.gasp_based.phases.ascent_phase import get_ascent as get_2DOF_ascent_phase
from aviary.mission.gasp_based.phases.climb_phase import get_climb as get_2DOF_climb_phase
from aviary.mission.gasp_based.phases.desc_phase import get_descent as get_2DOF_descent_phase
from aviary.mission.gasp_based.phases.groundroll_phase import get_groundroll as get_2DOF_groundroll_phase
from aviary.mission.gasp_based.phases.rotation_phase import get_rotation as get_2DOF_rotation_phase
# Phase builders
from aviary.mission.gasp_based.phases.accel_phase import AccelPhase as TwoDOFAccelerationPhase
from aviary.mission.gasp_based.phases.ascent_phase import AscentPhase as TwoDOFAscentPhase
from aviary.mission.gasp_based.phases.climb_phase import ClimbPhase as TwoDOFClimbPhase
from aviary.mission.gasp_based.phases.descent_phase import DescentPhase as TwoDOFDescentPhase
from aviary.mission.gasp_based.phases.groundroll_phase import GroundrollPhase as TwoDOFGroundrollPhase
from aviary.mission.gasp_based.phases.rotation_phase import RotationPhase as TwoDOFRotationPhase


# Trajectory builders
Expand Down
9 changes: 6 additions & 3 deletions aviary/docs/getting_started/onboarding_level2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"source": [
"from aviary.api import Aircraft, Mission\n",
"import aviary.api as av\n",
"from copy import deepcopy\n",
"\n",
"\n",
"# inputs that run_aviary() requires\n",
Expand All @@ -86,13 +87,14 @@
"record_filename = 'aviary_history.db'\n",
"restart_filename = None\n",
"max_iter = 0\n",
"phase_info = deepcopy(av.default_2DOF_phase_info)\n",
"\n",
"# Build problem\n",
"prob = av.AviaryProblem(analysis_scheme)\n",
"\n",
"# Load aircraft and options data from user\n",
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename, av.default_2DOF_phase_info)\n",
"prob.load_inputs(aircraft_filename, phase_info)\n",
"\n",
"# Preprocess inputs\n",
"prob.check_and_preprocess_inputs()\n",
Expand Down Expand Up @@ -196,7 +198,8 @@
"metadata": {},
"outputs": [],
"source": [
"prob.load_inputs(aircraft_filename, av.default_2DOF_phase_info)"
"phase_info = deepcopy(av.default_2DOF_phase_info)\n",
"prob.load_inputs(aircraft_filename, phase_info)"
]
},
{
Expand Down Expand Up @@ -900,7 +903,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.8.17"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion aviary/docs/user_guide/aerodynamics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.8.17"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion aviary/examples/test/test_all_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def run_script(self, script_path):
if 'ImportError' in str(stderr):
self.skipTest(f"Skipped {script_path.name} due to ImportError")
else:
raise
raise Exception(
f"Error running {script_path.name}:\n{stderr.decode('utf-8')}")

def test_run_scripts(self):
"""
Expand Down
Loading

0 comments on commit 4f8f2b2

Please sign in to comment.