{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Plane Take-Off Example\n",
    "\n",
    "This example demonstrates how to use flight-mech to compute the take-off characteristics of a plane."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Python imports\n",
    "import os\n",
    "import sys\n",
    "sys.path.append(\"..\")\n",
    "\n",
    "# Additional imports\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Flight-Mech imports\n",
    "from flight_mech.plane import Plane"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plane definition\n",
    "\n",
    "Let us use in this case the Cessna Citation III defined in the database."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load the plane\n",
    "plane = Plane(\"cessna_citation_III\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Take-off characteristics\n",
    "\n",
    "We can now define a runway by its altitude and friction coefficient and compute the take-off distance and velocities."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ground effect coef 0.7681105648826639\n",
      "take off speed [m.s-1] 83.80895862098065\n",
      "take off distance [m] 1105.3768140913871\n"
     ]
    }
   ],
   "source": [
    "# Define the friction coefficient of the runway\n",
    "mu = 0.02\n",
    "\n",
    "# Define the take off altitude\n",
    "z = 0\n",
    "\n",
    "# Print the results\n",
    "print(\"ground effect coef\", plane.ground_effect_coefficient)\n",
    "print(\"take off speed [m.s-1]\", plane.compute_take_off_speed(z))\n",
    "print(\"take off distance [m]\",\n",
    "      plane.compute_take_off_distance_with_friction(z, mu))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "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.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}