{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Tutorial 10 - Analyses\n", "Welcome to this tutorial outlining the analyses assignment process in RCAIDE. This guide will walk you through the code, explain its components, and highlight where modifications can be made to customize the simulation for different vehicle designs. It breaks down tutorial 01 into smaller sections, although the reader is encouraged to subsequently refer to tutorial 01 for the full context. \n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Header and Imports\n", "\n", "\n", "The **Imports** section is divided into two parts: general-purpose Python libraries and simulation-specific libraries. Here, only the numpy Library, general RCAIDE, and the Units module are imported. \n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Matplotlib created a temporary cache directory at /var/folders/r4/4h9x29hj6f95kyhjsltxc6_00000gn/T/matplotlib-_gb2tlaa because the default path (/Users/aidanmolloy/.matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.\n", "Fontconfig warning: ignoring UTF-8: not a valid region tag\n", "Matplotlib is building the font cache; this may take a moment.\n" ] } ], "source": [ "import RCAIDE\n", "from RCAIDE.Framework.Core import Units\n", "\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Setup Analyses\n", "\n", "The **`setup`** function assigns a set of analyses to each vehicle configuration. Analyses are used to evaluate the aircraft’s performance, aerodynamics, energy systems, and other characteristics for a given configuration.\n", "\n", "### Overview of Analyses Assignment\n", "\n", "In this tutorial, **all configurations** share the same set of analyses, the base analysis. However, this function provides the flexibility to assign a unique set of analyses to any specific configuration.\n", "\n", "### Purpose of Analyses Assignment\n", "\n", "The analyses ensure that the defined vehicle configurations (e.g., **cruise**, **takeoff**, **landing**) are evaluated correctly during the simulation. Each configuration can have:\n", "\n", "- **Common Analyses**: Shared across multiple configurations for simplicity.\n", "- **Custom Analyses**: Tailored to a specific phase of flight or performance evaluation. Often a base analysis is used as a starting point and then additional analyses are added to or subtracted from the base analysis. The base analysis is defined below. \n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def setup(configs):\n", " \n", " analyses = RCAIDE.Framework.Analyses.Analysis.Container()\n", "\n", " # build a base analysis for each config\n", " for tag,config in configs.items():\n", " analysis = base(config) \n", " analyses[tag] = analysis \n", "\n", " return analyses" ] }, { "cell_type": "markdown", "metadata": { "vscode": { "languageId": "plaintext" } }, "source": [ "## 3. Base Analyses Setup\n", "\n", "Often, a base analysis is used as a starting point and then additional analyses are added to or subtracted from the base analysis. The **`base`** function includes some of the most commonly used analyses such as:\n", "\n", "- **Weights Analysis**: Computes weight distribution across components.\n", "- **Aerodynamics Analysis**: Estimates lift, drag, and aerodynamic coefficients.\n", "- **Stability Analysis**: Evaluates stability derivatives for flight control assessments.\n", "- **Energy Analysis**: Runs the energy network (e.g., turbofan engine) for thrust and fuel performance.\n", "- **Atmosphere Analysis**: Sets atmospheric conditions using standard atmospheric models.\n", "\n", "Note how in this example only the weights, aerodynamics, energy, planet, and atmosphere analyses are included. By assigning these analyses, the vehicle's behavior under different configurations (e.g., **cruise**, **takeoff**, **landing**) can be comprehensively evaluated.\n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "\n", "def base(vehicle):\n", "\n", " # ------------------------------------------------------------------\n", " # Initialize the Analyses\n", " # ------------------------------------------------------------------ \n", " analyses = RCAIDE.Framework.Analyses.Vehicle()\n", " analyses.vehicle = vehicle \n", "\n", " # ------------------------------------------------------------------\n", " # Weights\n", " weights = RCAIDE.Framework.Analyses.Weights.Transport()\n", " analyses.append(weights)\n", "\n", " # ------------------------------------------------------------------\n", " # Aerodynamics Analysis\n", " aerodynamics = RCAIDE.Framework.Analyses.Aerodynamics.Vortex_Lattice_Method()\n", " analyses.append(aerodynamics)\n", "\n", " # ------------------------------------------------------------------\n", " # Energy\n", " energy = RCAIDE.Framework.Analyses.Energy.Energy()\n", " analyses.append(energy)\n", "\n", " # ------------------------------------------------------------------\n", " # Planet Analysis\n", " planet = RCAIDE.Framework.Analyses.Planets.Earth()\n", " analyses.append(planet)\n", "\n", " # ------------------------------------------------------------------\n", " # Atmosphere Analysis\n", " atmosphere = RCAIDE.Framework.Analyses.Atmospheric.US_Standard_1976()\n", " analyses.append(atmosphere) \n", "\n", " return analyses " ] } ], "metadata": { "kernelspec": { "display_name": ".rcaideenv", "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.6" } }, "nbformat": 4, "nbformat_minor": 2 }