From 3ff09ef031482caf5cb9afa22552ffb5df755d85 Mon Sep 17 00:00:00 2001 From: Kaushik Ponnapalli Date: Wed, 4 Sep 2024 15:09:15 -0500 Subject: [PATCH 1/6] Added documentation for off design missions --- aviary/docs/examples/off_design_example.ipynb | 83 +++++++++++++++++ .../docs/user_guide/off_design_missions.ipynb | 92 +++++++++++++++++++ aviary/docs/user_guide/reserve_missions.ipynb | 6 +- aviary/examples/off_design_example.py | 3 +- 4 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 aviary/docs/examples/off_design_example.ipynb create mode 100644 aviary/docs/user_guide/off_design_missions.ipynb diff --git a/aviary/docs/examples/off_design_example.ipynb b/aviary/docs/examples/off_design_example.ipynb new file mode 100644 index 000000000..0657b8780 --- /dev/null +++ b/aviary/docs/examples/off_design_example.ipynb @@ -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.\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 two_dof phase_info 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 +} diff --git a/aviary/docs/user_guide/off_design_missions.ipynb b/aviary/docs/user_guide/off_design_missions.ipynb new file mode 100644 index 000000000..f2ec4f60d --- /dev/null +++ b/aviary/docs/user_guide/off_design_missions.ipynb @@ -0,0 +1,92 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Off-Design Missions\n", + "\n", + "## Overview\n", + "\n", + "Reserve missions are enabled for the following mission types:\n", + "\n", + "* height_energy (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 +} diff --git a/aviary/docs/user_guide/reserve_missions.ipynb b/aviary/docs/user_guide/reserve_missions.ipynb index 66a4a6ae5..65ef7bf45 100644 --- a/aviary/docs/user_guide/reserve_missions.ipynb +++ b/aviary/docs/user_guide/reserve_missions.ipynb @@ -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", @@ -297,7 +297,7 @@ ], "metadata": { "kernelspec": { - "display_name": "latest_env", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -311,7 +311,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.11.0" } }, "nbformat": 4, diff --git a/aviary/examples/off_design_example.py b/aviary/examples/off_design_example.py index 5a1f22434..2b8f23a49 100644 --- a/aviary/examples/off_design_example.py +++ b/aviary/examples/off_design_example.py @@ -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 = { From 4c4aa1f75aa02a2638fc664de8c2afaed511af4e Mon Sep 17 00:00:00 2001 From: Kaushik Ponnapalli Date: Thu, 5 Sep 2024 10:38:15 -0500 Subject: [PATCH 2/6] added new docs to toctree --- aviary/docs/_toc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aviary/docs/_toc.yml b/aviary/docs/_toc.yml index ac2e8ce91..4c53a7e9c 100644 --- a/aviary/docs/_toc.yml +++ b/aviary/docs/_toc.yml @@ -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 @@ -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 From 3526a38a8f964f86d9b3d893f66511cbebbc337f Mon Sep 17 00:00:00 2001 From: kaushikponnapalli Date: Tue, 10 Sep 2024 13:57:16 -0500 Subject: [PATCH 3/6] Update aviary/docs/examples/off_design_example.ipynb Co-authored-by: Jason Kirk <110835404+jkirk5@users.noreply.github.com> --- aviary/docs/examples/off_design_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/docs/examples/off_design_example.ipynb b/aviary/docs/examples/off_design_example.ipynb index 0657b8780..08c4aafcd 100644 --- a/aviary/docs/examples/off_design_example.ipynb +++ b/aviary/docs/examples/off_design_example.ipynb @@ -18,7 +18,7 @@ "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 two_dof phase_info instead of the `phase_info` declared in the problem.\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" ] }, { From 9b202e6f08d06586f7905f983e34bced6595d93c Mon Sep 17 00:00:00 2001 From: kaushikponnapalli Date: Tue, 10 Sep 2024 13:57:24 -0500 Subject: [PATCH 4/6] Update aviary/docs/examples/off_design_example.ipynb Co-authored-by: Jason Kirk <110835404+jkirk5@users.noreply.github.com> --- aviary/docs/examples/off_design_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/docs/examples/off_design_example.ipynb b/aviary/docs/examples/off_design_example.ipynb index 08c4aafcd..14cb8530f 100644 --- a/aviary/docs/examples/off_design_example.ipynb +++ b/aviary/docs/examples/off_design_example.ipynb @@ -6,7 +6,7 @@ "source": [ "# Off-Design Mission Example\n", "\n", - "The off-design mission example here demonstrates the capability in the height energy formulation.\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", From 1ccafb2b1d88c066bc933cc29933d0e30a90a074 Mon Sep 17 00:00:00 2001 From: kaushikponnapalli Date: Tue, 10 Sep 2024 13:57:32 -0500 Subject: [PATCH 5/6] Update aviary/docs/user_guide/off_design_missions.ipynb Co-authored-by: Jason Kirk <110835404+jkirk5@users.noreply.github.com> --- aviary/docs/user_guide/off_design_missions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/docs/user_guide/off_design_missions.ipynb b/aviary/docs/user_guide/off_design_missions.ipynb index f2ec4f60d..f96d16066 100644 --- a/aviary/docs/user_guide/off_design_missions.ipynb +++ b/aviary/docs/user_guide/off_design_missions.ipynb @@ -8,7 +8,7 @@ "\n", "## Overview\n", "\n", - "Reserve missions are enabled for the following mission types:\n", + "Off-design missions are enabled for the following mission types:\n", "\n", "* height_energy (completed)\n", "* 2DOF (collocation) (complete)\n", From 011e36777b8337a81019e2514a2f33cb16e94587 Mon Sep 17 00:00:00 2001 From: kaushikponnapalli Date: Tue, 10 Sep 2024 13:57:44 -0500 Subject: [PATCH 6/6] Update aviary/docs/user_guide/off_design_missions.ipynb Co-authored-by: crecine <51181861+crecine@users.noreply.github.com> --- aviary/docs/user_guide/off_design_missions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/docs/user_guide/off_design_missions.ipynb b/aviary/docs/user_guide/off_design_missions.ipynb index f96d16066..13ebd0fc4 100644 --- a/aviary/docs/user_guide/off_design_missions.ipynb +++ b/aviary/docs/user_guide/off_design_missions.ipynb @@ -10,7 +10,7 @@ "\n", "Off-design missions are enabled for the following mission types:\n", "\n", - "* height_energy (completed)\n", + "* height_energy (collocation) (completed)\n", "* 2DOF (collocation) (complete)\n", "* 2DOF (shooting) (future work)\n", "* height_energy (shooting) (future work)\n",