-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into enh/improving_get_rocket_radius
- Loading branch information
Showing
23 changed files
with
3,158 additions
and
881 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,351 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "73649456", | ||
"metadata": {}, | ||
"source": [ | ||
"# RocketPy Simulation\n", | ||
"This notebook was generated using Rocket-Serializer, a RocketPy tool to convert simulation files to RocketPy simulations\n", | ||
"The notebook was generated using the following parameters file: `examples/NDRT--Rocket--2020/parameters.json`\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4160e107", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install rocketpy<=2.0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f9588fa3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from rocketpy import (\n", | ||
" Environment,\n", | ||
" SolidMotor,\n", | ||
" Rocket,\n", | ||
" Flight,\n", | ||
" TrapezoidalFins,\n", | ||
" RailButtons,\n", | ||
" NoseCone,\n", | ||
" Tail,\n", | ||
")\n", | ||
"import datetime" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c8b00a08", | ||
"metadata": {}, | ||
"source": [ | ||
"## Environment\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "84016cc8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"env = Environment()\n", | ||
"env.set_location(latitude=28.61, longitude=-80.6)\n", | ||
"env.set_elevation(0.0)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e9ba5e6c", | ||
"metadata": {}, | ||
"source": [ | ||
"Optionally, you can set the date and atmospheric model\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1f1c978f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"tomorrow = datetime.date.today() + datetime.timedelta(days=1)\n", | ||
"env.set_date((tomorrow.year, tomorrow.month, tomorrow.day, 12))\n", | ||
"env.set_atmospheric_model(type=\"Forecast\", file=\"GFS\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d2c7c4a8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"env.all_info()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e4712496", | ||
"metadata": {}, | ||
"source": [ | ||
"## Motor\n", | ||
"Currently, only Solid Motors are supported by Rocket-Serializer\n", | ||
"If you want to use a Liquid or Hybrid motor, please use rocketpy directly.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7303fe66", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"motor = SolidMotor(\n", | ||
" thrust_source=\"thrust_source.csv\",\n", | ||
" dry_mass=0,\n", | ||
" center_of_dry_mass_position=0,\n", | ||
" dry_inertia=[0, 0, 0],\n", | ||
" grains_center_of_mass_position=0,\n", | ||
" grain_number=1,\n", | ||
" grain_density=1202.7971321820446,\n", | ||
" grain_outer_radius=0.0375,\n", | ||
" grain_initial_inner_radius=0.01875,\n", | ||
" grain_initial_height=0.621,\n", | ||
" grain_separation=0,\n", | ||
" nozzle_radius=0.028124999999999997,\n", | ||
" nozzle_position=-0.3105,\n", | ||
" throat_radius=0.01875,\n", | ||
" reshape_thrust_curve=False, # Not implemented in Rocket-Serializer\n", | ||
" interpolation_method=\"linear\",\n", | ||
" coordinate_system_orientation=\"nozzle_to_combustion_chamber\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1d4de914", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"motor.all_info()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "88365a2f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Rocket\n", | ||
"Currently, only single stage rockets are supported by Rocket-Serializer\n", | ||
"We will start by defining the aerodynamic surfaces, and then build the rocket.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "16c74786", | ||
"metadata": {}, | ||
"source": [ | ||
"### Nosecones\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b027c306", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"nosecone = NoseCone(\n", | ||
" length=0.6095999999999999,\n", | ||
" kind=\"ogive\",\n", | ||
" base_radius=0.1016,\n", | ||
" rocket_radius=0.1016,\n", | ||
" name=\"0.6095999999999999\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6b49767b", | ||
"metadata": {}, | ||
"source": [ | ||
"### Fins\n", | ||
"As rocketpy allows for multiple fins sets, we will create a dictionary with all the fins sets and then add them to the rocket\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "bcdd3f39", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"trapezoidal_fins = {}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a7a104cc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"trapezoidal_fins[0] = TrapezoidalFins(\n", | ||
" n=4,\n", | ||
" root_chord=0.15239999999999995,\n", | ||
" tip_chord=0.07619999999999999,\n", | ||
" span=0.1651,\n", | ||
" cant_angle=0.0,\n", | ||
" sweep_length=0.038099999999999995,\n", | ||
" sweep_angle=None,\n", | ||
" rocket_radius=0.1016,\n", | ||
" name=\"Trapezoidal fin set\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e8bde053", | ||
"metadata": {}, | ||
"source": [ | ||
"### Transitions (Tails)\n", | ||
"As rocketpy allows for multiple tails, we will create a dictionary with all the tails and then add them to the rocket\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a88dd483", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"tails = {}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "31fcb9e1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"tails[0] = Tail(\n", | ||
" top_radius=0.1016,\n", | ||
" bottom_radius=0.0776224,\n", | ||
" length=0.127,\n", | ||
" rocket_radius=0.1016,\n", | ||
" name=\"Transition\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9c489fab", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"rocket = Rocket(\n", | ||
" radius=0.1016,\n", | ||
" mass=20.735,\n", | ||
" inertia=[0.15089, 0.15089, 18.411],\n", | ||
" power_off_drag=\"drag_curve.csv\",\n", | ||
" power_on_drag=\"drag_curve.csv\",\n", | ||
" center_of_mass_without_motor=1.7041,\n", | ||
" coordinate_system_orientation=\"nose_to_tail\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f6ef9ca6", | ||
"metadata": {}, | ||
"source": [ | ||
"### Adding surfaces to the rocket\n", | ||
"Now that we have all the surfaces, we can add them to the rocket\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0d487990", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"rocket.add_surfaces(\n", | ||
" surfaces=[nosecone, trapezoidal_fins[0], tails[0]],\n", | ||
" positions=[0.0, 3.3528000000000002, 1.1938],\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d57554cd", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"rocket.add_motor(motor, position=3.079819999999998)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e8e7472b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"### Rocket Info\n", | ||
"rocket.all_info()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "524a3720", | ||
"metadata": {}, | ||
"source": [ | ||
"## Flight\n", | ||
"We will now create the flight simulation. Let's go!\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b27cac03", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"flight = Flight(\n", | ||
" rocket=rocket,\n", | ||
" environment=env,\n", | ||
" rail_length=2.7432000000000003,\n", | ||
" inclination=85.0,\n", | ||
" heading=90.0,\n", | ||
" terminate_on_apogee=False,\n", | ||
" max_time=600,\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c8a92813", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"flight.all_info()" | ||
] | ||
} | ||
], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.