Skip to content

Commit

Permalink
Merge pull request #389 from RocketPy-Team/beta/v1.0.0
Browse files Browse the repository at this point in the history
REL: v1.0.0a1
  • Loading branch information
Gui-FernandesBR authored Jul 3, 2023
2 parents 564ff3d + 6f48b07 commit 1930532
Show file tree
Hide file tree
Showing 48 changed files with 2,141 additions and 2,856 deletions.
138 changes: 80 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ RocketPy is the next-generation trajectory simulation solution for High-Power Ro
</details>

<details>
<summary>Solid motors models</summary>
<summary>Solid, Hybrid and Liquid motors models</summary>
<ul>
<li>Burn rate and mass variation properties from thrust curve</li>
<li>Define custom rocket tanks based on their flux data</li>
<li>CSV and ENG file support</li>
</ul>
</details>
Expand Down Expand Up @@ -156,12 +157,12 @@ To learn more about RocketPy's requirements, visit our [Requirements Docs](https

## Running Your First Simulation

In order to run your first rocket trajectory simulation using RocketPy, you can start a Jupyter Notebook and navigate to the _nbks_ folder. Open _Getting Started - Examples.ipynb_ and you are ready to go.
In order to run your first rocket trajectory simulation using RocketPy, you can start a Jupyter Notebook and navigate to the _docs/notebooks_ folder. Open _getting_started.ipynb_ and you are ready to go.

Otherwise, you may want to create your own script or your own notebook using RocketPy. To do this, let's see how to use RocketPy's four main classes:

- Environment - Keeps data related to weather.
- SolidMotor - Keeps data related to solid motors. Hybrid motor support is coming in the next weeks.
- Motor - Subdivided into SolidMotor, HybridMotor and LiquidMotor. Keeps data related to rocket motors.
- Rocket - Keeps data related to a rocket.
- Flight - Runs the simulation and keeps the results.

Expand All @@ -175,6 +176,12 @@ A typical workflow starts with importing these classes from RocketPy:
from rocketpy import Environment, Rocket, SolidMotor, Flight
```

An optional step is to import datetime, which is used to define the date of the simulation:

```python
import datetime
```

Then create an Environment object. To learn more about it, you can use:

```python
Expand All @@ -188,9 +195,14 @@ env = Environment(
latitude=32.990254,
longitude=-106.974998,
elevation=1400,
date=(2020, 3, 4, 12) # Tomorrow's date in year, month, day, hour UTC format
)

tomorrow = datetime.date.today() + datetime.timedelta(days=1)

env.set_date(
(tomorrow.year, tomorrow.month, tomorrow.day, 12), timezone="America/Denver"
) # Tomorrow's date in year, month, day, hour UTC format

env.set_atmospheric_model(type='Forecast', file='GFS')
```

Expand All @@ -204,18 +216,23 @@ A sample Motor object can be created by the following code:

```python
Pro75M1670 = SolidMotor(
thrust_source="../data/motors/Cesaroni_M1670.eng",
thrust_source="data/motors/Cesaroni_M1670.eng",
dry_mass=1.815,
dry_inertia=(0.125, 0.125, 0.002),
center_of_dry_mass=0.317,
grains_center_of_mass_position=0.397,
burn_time=3.9,
grain_number=5,
grain_separation=5/1000,
grain_separation=0.005,
grain_density=1815,
grain_outer_radius=33/1000,
grain_initial_inner_radius=15/1000,
grain_initial_height=120/1000,
grains_center_of_mass_position=-0.85704,
nozzle_radius=33/1000,
throat_radius=11/1000,
interpolation_method='linear'
grain_outer_radius=0.033,
grain_initial_inner_radius=0.015,
grain_initial_height=0.12,
nozzle_radius=0.033,
throat_radius=0.011,
interpolation_method="linear",
nozzle_position=0,
coordinate_system_orientation="nozzle_to_combustion_chamber",
)
```

Expand All @@ -229,65 +246,62 @@ A sample code to create a Rocket is:

```python
calisto = Rocket(
radius=127 / 2000,
mass=19.197 - 2.956,
inertia_i=6.60,
inertia_z=0.0351,
power_off_drag="../../data/calisto/powerOffDragCurve.csv",
power_on_drag="../../data/calisto/powerOnDragCurve.csv",
center_of_dry_mass_position=0,
coordinate_system_orientation="tail_to_nose"
radius=0.0635,
mass=14.426, # without motor
inertia=(6.321, 6.321, 0.034),
power_off_drag="data/calisto/powerOffDragCurve.csv",
power_on_drag="data/calisto/powerOnDragCurve.csv",
center_of_mass_without_motor=0,
coordinate_system_orientation="tail_to_nose",
)
calisto.set_rail_buttons(0.2, -0.5)

buttons = calisto.set_rail_buttons(
upper_button_position=0.0818,
lower_button_position=-0.6182,
angular_position=45,
)

calisto.add_motor(Pro75M1670, position=-1.255)
calisto.add_nose(length=0.55829, kind="vonKarman", position=1.278)
calisto.add_trapezoidal_fins(

nose = calisto.add_nose(
length=0.55829, kind="vonKarman", position=1.278
)

fins = calisto.add_trapezoidal_fins(
n=4,
root_chord=0.120,
tip_chord=0.040,
span=0.100,
position=-1.04956,
sweep_length=None,
cant_angle=0,
radius=None,
airfoil=None
position=-1.04956,
)
calisto.add_tail(

tail = calisto.add_tail(
top_radius=0.0635, bottom_radius=0.0435, length=0.060, position=-1.194656
)
```

You may want to add parachutes to your rocket as well:

```python
def drogue_trigger(p, h, y):
# p = pressure considering parachute noise signal
# h = height above ground level considering parachute noise signal
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]

# activate drogue when vz < 0 m/s.
return True if y[5] < 0 else False

def main_trigger(p, h, y):
# p = pressure considering parachute noise signal
# h = height above ground level considering parachute noise signal
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]

# activate main when vz < 0 m/s and z < 800 m
return True if y[5] < 0 and h < 800 else False

calisto.add_parachute('Main',
cd_s=10.0,
trigger=main_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5))

calisto.add_parachute('Drogue',
cd_s=1.0,
trigger=drogue_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5))
main = calisto.add_parachute(
name="main",
cd_s=10.0,
trigger=800, # ejection altitude in meters
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5),
)

drogue = calisto.add_parachute(
name="drogue",
cd_s=1.0,
trigger="apogee", # ejection at apogee
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5),
)
```

Finally, you can create a Flight object to simulate your trajectory. To get help on the Flight class, use:
Expand All @@ -299,7 +313,9 @@ help(Flight)
To actually create a Flight object, use:

```python
test_flight = Flight(rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0)
test_flight = Flight(
rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0
)
```

Once the Flight object is created, your simulation is done! Use the following code to get a summary of the results:
Expand All @@ -318,6 +334,12 @@ Here is just a quick taste of what RocketPy is able to calculate. There are hund

![6-DOF Trajectory Plot](https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/static/rocketpy_example_trajectory.svg)

If you want to see the trajectory on Google Earth, RocketPy acn easily export a KML file for you:

```python
test_flight.export_kml(file_name="test_flight.kml")
```

<br>

# Authors and Contributors
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"logo_link": "index",
"github_url": "https://github.com/RocketPy-Team/RocketPy",
"collapse_navigation": True,
"show_toc_level": 3,
"show_toc_level": 4,
"show_nav_level": 4,
}

html_sidebars = {
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Flights simulated with RocketPy
===============================

Apart from the classical Calisto rocket, which is many times used as a
reference in the getting started tutorial, RocketPy also includes some very
interesting examples of real rockets.

If you want to see your rocket here, please contact the maintainers!

.. toctree::
:maxdepth: 2
:caption: Contents:

../notebooks/SEBLM.ipynb

3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
contain the root `toctree` directive.
.. toctree::
:maxdepth: 2
:maxdepth: 4
:hidden:

User Guide <user/index>
Code Reference <reference/index>
Development <development/index>
Technical <technical/index>
Flight Examples <examples/index>

.. _`RocketPy`: https://www.linkedin.com/company/75016723

Expand Down
6 changes: 3 additions & 3 deletions docs/notebooks/deployable_payload_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Deployable Payload Flight Simulation Example"
"# Deployable Payload"
]
},
{
Expand Down Expand Up @@ -37,8 +37,8 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install rocketpy netCDF4\n",
"!git clone https://github.com/RocketPy-Team/RocketPy.git"
"%pip install rocketpy netCDF4\n",
"%git clone https://github.com/RocketPy-Team/RocketPy.git"
]
},
{
Expand Down
Loading

0 comments on commit 1930532

Please sign in to comment.