{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Utilities module usage" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from rocketpy.utilities import (\n", " calculate_equilibrium_altitude,\n", " compute_cd_s_from_drop_test,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib widget" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Estimations for your cd_s" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "compute_cd_s_from_drop_test(\n", " terminal_velocity=10, # The desired terminal velocity (m/s)\n", " rocket_mass=20, # kg\n", " air_density=1.225,\n", " g=9.80665,\n", ")" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Altitude of Terminal Velocity being reached " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "a, b, c = calculate_equilibrium_altitude(\n", " rocket_mass=20,\n", " cd_s=5,\n", " z0=1000,\n", " v0=-20,\n", " env=None,\n", " eps=1e-3,\n", " max_step=0.1,\n", " see_graphs=True,\n", " g=9.80665,\n", " estimated_final_time=10,\n", ")\n", "\n", "altitude_function, velocity_function, final_sol = a, b, c" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "final_sol" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\n", " f\"The terminal velocity of {final_sol['velocity']:.3} m/s is reached after {final_sol['time']:.3} seconds at altitude of {final_sol['altitude']:.6} meters.\"\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": ".venv12", "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.12.4" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }