Skip to content

Commit

Permalink
Merge pull request OpenMDAO#515 from kaushikponnapalli/od_docs
Browse files Browse the repository at this point in the history
Off-Design documention
  • Loading branch information
jkirk5 authored Sep 10, 2024
2 parents f904f26 + 74d709b commit e47bf87
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 5 deletions.
2 changes: 2 additions & 0 deletions aviary/docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parts:
- file: user_guide/features/overriding
- file: user_guide/FLOPS_based_detailed_takeoff_and_landing
- file: user_guide/reserve_missions
- file: user_guide/off_design_missions
- file: user_guide/SGM_capabilities
- file: user_guide/troubleshooting

Expand All @@ -56,6 +57,7 @@ parts:
- file: examples/coupled_aircraft_mission_optimization
- file: examples/additional_flight_phases
- file: examples/reserve_missions
- file: examples/off_design_example
- file: examples/OAS_subsystem
- file: examples/level_2_detailed_takeoff_and_landing

Expand Down
83 changes: 83 additions & 0 deletions aviary/docs/examples/off_design_example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Off-Design Mission Example\n",
"\n",
"The off-design mission example here demonstrates the capability in the height energy formulation, using the level 2 interface.\n",
"By default Aviary uses a height-energy formulation unless you have specified otherwise.\n",
"Running a sizing mission followed by running fallout and alternate missions on the sized aircraft will be presented.\n",
"An overview of off-design missions is presented in [Off-Design Mission User Guide](../user_guide/off_design_missions).\n",
"\n",
"The example is available in `aviary/examples/off_design_example.py`\n",
"The examples start with `run_aviary_example.py` and add off-design missions.\n",
"\n",
"The results of the sizing problem are saved using `prob.save_sizing_to_json()`.\n",
"By default, this method saves the results to `sizing_problem.json` but the name of the file may be changed using the `json_filename` argument.\n",
"The saved problem may then be used to run off-design missions using `prob.fallout_mission()` and `prob.alternate_mission()`.\n",
"\n",
"This example can be modified to use the 2DOF formulation by using `aircraft_for_bench_GwGm` instead of `aircraft_for_bench_FwFm` and import the default 2DOF phase_info (aviary/interface/default_phase_info/two_dof.py) instead of the `phase_info` declared in the problem.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The methods used to run the off-design missions accept the mission parameters `payload_mass`, `mission_range`, `mission_mass`, and `phase_info` as inputs depending on the type of mission being run.\n",
"If these values are not specified, the same values as the design mission are used by default.\n",
"For this example, we simply run a fallout and alternate mission with those default values.\n",
"The expected result is that the range for the fallout mission and the mission mass for the alternate will be the same as the values computed by the sizing mission.\n",
"\n",
"The results of this study are output after interrogating the problem objects."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"## Sizing Results\n",
"Design Range = 3375.\n",
"Design Gross mass = 175871.01115631\n",
"Summary Gross mass = 175871.01115631\n",
"\n",
"## Fallout Results\n",
"Summary Range = 3375.00699084\n",
"Design Gross mass = 175871.01115631\n",
"Summary Gross mass = 175871.01115631\n",
"\n",
"## Alternate Results\n",
"Summary Range = 3375.\n",
"Design Gross mass = 175871.01115631\n",
"Summary Gross mass = 175869.64047452\n",
"\n",
"\n",
"In these results, `design` values represent the values used to size the aircraft, while the `summary` values represent the values used in the specific mission that is run.\n",
"We can see that the results are almost identical as expected."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
92 changes: 92 additions & 0 deletions aviary/docs/user_guide/off_design_missions.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Off-Design Missions\n",
"\n",
"## Overview\n",
"\n",
"Off-design missions are enabled for the following mission types:\n",
"\n",
"* height_energy (collocation) (completed)\n",
"* 2DOF (collocation) (complete)\n",
"* 2DOF (shooting) (future work)\n",
"* height_energy (shooting) (future work)\n",
"\n",
"An off-design mission can be created either by directly entering the parameters of the sized aircraft or by using the built-in functionality to run an off-design in the same script as the sizing mission.\n",
"There are currently two types of off-design missions supported in Aviary; alternate and fallout.\n",
"For an alternate mission, the target range of the mission and the payload mass are specified and the fuel mass required is solved for.\n",
"Fallout missions meanwhile take the payload and fuel masses as inputs and determine the range of the aircraft.\n",
"To create a simple off-design mission, take your input deck and add the line `settings:problem_type, fallout` or `settings:problem_type, alternate`.\n",
"\n",
"```{note}\n",
"You may need to revise some of the values in your input deck for the off-design mission.\n",
"Since the aircraft is not re-designed, it is assumed that provided inputs constitute a valid aircraft.\n",
"```\n",
"\n",
"From there, the mission may be run as before."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You may also run multiple off-design missions in the same script used to solve the design mission.\n",
"An examples of this is shown in `off_design_example.py`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# Testing Cell\n",
"from aviary.docs.tests.utils import check_contains\n",
"import aviary.api as av\n",
"import os\n",
"\n",
"off_design_examples = av.get_path(os.path.join('examples'))\n",
"check_contains(\n",
" ('off_design_example.py'),\n",
" os.listdir(off_design_examples),\n",
" error_string=\"{var} not in \"+str(off_design_examples),\n",
" error_type=FileNotFoundError)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
6 changes: 3 additions & 3 deletions aviary/docs/user_guide/reserve_missions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Reserve missions are enabled for the following mission types:\n",
"\n",
"* height_energy (completed)\n",
"* 2ODF (collocation) (complete)\n",
"* 2DOF (collocation) (complete)\n",
"* 2DOF (shooting) (in-progress)\n",
"* height_energy (shooting) (future work)\n",
"\n",
Expand Down Expand Up @@ -297,7 +297,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "latest_env",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -311,7 +311,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions aviary/examples/off_design_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
This performs a coupled design-mission optimization and outputs the results from Aviary into the `reports` folder.
"""
import aviary.api as av
from example_phase_info import phase_info

from aviary.interface.default_phase_info.height_energy import phase_info_parameterization
from aviary.variable_info.enums import ProblemType, Verbosity
from aviary.variable_info.enums import ProblemType
from aviary.variable_info.variables import Mission

phase_info = {
Expand Down

0 comments on commit e47bf87

Please sign in to comment.