{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "authorship_tag": "ABX9TyOj1yqYrLX9mLbUuHL9DP3T",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/tbamud/tbamud/blob/master/power_curve.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 569
        },
        "id": "X9G-1-Tm9yk1",
        "outputId": "31c04ccd-06e7-4319-aa70-2141971ea984"
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 800x600 with 1 Axes>"
            ],
            "image/png": "[encoded data, 85236 characters]\n"
          },
          "metadata": {}
        }
      ],
      "source": [
        "import matplotlib.pyplot as plt\n",
        "import numpy as np\n",
        "\n",
        "# Simulated power curve data\n",
        "airspeed = np.linspace(20, 200, 100)  # Airspeed in knots\n",
        "power_required = 10000 / airspeed + 0.01 * airspeed**2  # Simplified model: induced + parasitic drag\n",
        "\n",
        "# Create the plot\n",
        "plt.figure(figsize=(8, 6))\n",
        "plt.plot(airspeed, power_required, label=\"Power Required\", color=\"blue\")\n",
        "plt.axvline(x=80, color=\"green\", linestyle=\"--\", label=\"Minimum Power Point\")\n",
        "plt.axvspan(20, 80, alpha=0.2, color=\"red\", label=\"Back Side (High Drag)\")\n",
        "plt.axvspan(80, 200, alpha=0.2, color=\"green\", label=\"Ahead of Power Curve\")\n",
        "\n",
        "# Annotations\n",
        "plt.text(50, 400, \"High Induced Drag\\n(Risk of Stall)\", fontsize=10, color=\"red\")\n",
        "plt.text(120, 200, \"Efficient Operation\\n(Excess Power)\", fontsize=10, color=\"green\")\n",
        "\n",
        "# Plot settings\n",
        "plt.title(\"Power Curve: Staying Ahead\", fontsize=14)\n",
        "plt.xlabel(\"Airspeed (knots)\", fontsize=12)\n",
        "plt.ylabel(\"Power Required (arbitrary units)\", fontsize=12)\n",
        "plt.grid(True)\n",
        "plt.legend()\n",
        "plt.show()"
      ]
    }
  ]
}