Skip to content

Commit 1930532

Browse files
Merge pull request #389 from RocketPy-Team/beta/v1.0.0
REL: v1.0.0a1
2 parents 564ff3d + 6f48b07 commit 1930532

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2141
-2856
lines changed

README.md

Lines changed: 80 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ RocketPy is the next-generation trajectory simulation solution for High-Power Ro
5959
</details>
6060

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

157158
## Running Your First Simulation
158159

159-
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.
160+
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.
160161

161162
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:
162163

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

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

179+
An optional step is to import datetime, which is used to define the date of the simulation:
180+
181+
```python
182+
import datetime
183+
```
184+
178185
Then create an Environment object. To learn more about it, you can use:
179186

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

200+
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
201+
202+
env.set_date(
203+
(tomorrow.year, tomorrow.month, tomorrow.day, 12), timezone="America/Denver"
204+
) # Tomorrow's date in year, month, day, hour UTC format
205+
194206
env.set_atmospheric_model(type='Forecast', file='GFS')
195207
```
196208

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

205217
```python
206218
Pro75M1670 = SolidMotor(
207-
thrust_source="../data/motors/Cesaroni_M1670.eng",
219+
thrust_source="data/motors/Cesaroni_M1670.eng",
220+
dry_mass=1.815,
221+
dry_inertia=(0.125, 0.125, 0.002),
222+
center_of_dry_mass=0.317,
223+
grains_center_of_mass_position=0.397,
208224
burn_time=3.9,
209225
grain_number=5,
210-
grain_separation=5/1000,
226+
grain_separation=0.005,
211227
grain_density=1815,
212-
grain_outer_radius=33/1000,
213-
grain_initial_inner_radius=15/1000,
214-
grain_initial_height=120/1000,
215-
grains_center_of_mass_position=-0.85704,
216-
nozzle_radius=33/1000,
217-
throat_radius=11/1000,
218-
interpolation_method='linear'
228+
grain_outer_radius=0.033,
229+
grain_initial_inner_radius=0.015,
230+
grain_initial_height=0.12,
231+
nozzle_radius=0.033,
232+
throat_radius=0.011,
233+
interpolation_method="linear",
234+
nozzle_position=0,
235+
coordinate_system_orientation="nozzle_to_combustion_chamber",
219236
)
220237
```
221238

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

230247
```python
231248
calisto = Rocket(
232-
radius=127 / 2000,
233-
mass=19.197 - 2.956,
234-
inertia_i=6.60,
235-
inertia_z=0.0351,
236-
power_off_drag="../../data/calisto/powerOffDragCurve.csv",
237-
power_on_drag="../../data/calisto/powerOnDragCurve.csv",
238-
center_of_dry_mass_position=0,
239-
coordinate_system_orientation="tail_to_nose"
249+
radius=0.0635,
250+
mass=14.426, # without motor
251+
inertia=(6.321, 6.321, 0.034),
252+
power_off_drag="data/calisto/powerOffDragCurve.csv",
253+
power_on_drag="data/calisto/powerOnDragCurve.csv",
254+
center_of_mass_without_motor=0,
255+
coordinate_system_orientation="tail_to_nose",
240256
)
241-
calisto.set_rail_buttons(0.2, -0.5)
257+
258+
buttons = calisto.set_rail_buttons(
259+
upper_button_position=0.0818,
260+
lower_button_position=-0.6182,
261+
angular_position=45,
262+
)
263+
242264
calisto.add_motor(Pro75M1670, position=-1.255)
243-
calisto.add_nose(length=0.55829, kind="vonKarman", position=1.278)
244-
calisto.add_trapezoidal_fins(
265+
266+
nose = calisto.add_nose(
267+
length=0.55829, kind="vonKarman", position=1.278
268+
)
269+
270+
fins = calisto.add_trapezoidal_fins(
245271
n=4,
246272
root_chord=0.120,
247273
tip_chord=0.040,
248274
span=0.100,
249-
position=-1.04956,
275+
sweep_length=None,
250276
cant_angle=0,
251-
radius=None,
252-
airfoil=None
277+
position=-1.04956,
253278
)
254-
calisto.add_tail(
279+
280+
tail = calisto.add_tail(
255281
top_radius=0.0635, bottom_radius=0.0435, length=0.060, position=-1.194656
256282
)
257283
```
258284

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

261287
```python
262-
def drogue_trigger(p, h, y):
263-
# p = pressure considering parachute noise signal
264-
# h = height above ground level considering parachute noise signal
265-
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
266-
267-
# activate drogue when vz < 0 m/s.
268-
return True if y[5] < 0 else False
269-
270-
def main_trigger(p, h, y):
271-
# p = pressure considering parachute noise signal
272-
# h = height above ground level considering parachute noise signal
273-
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
274-
275-
# activate main when vz < 0 m/s and z < 800 m
276-
return True if y[5] < 0 and h < 800 else False
277-
278-
calisto.add_parachute('Main',
279-
cd_s=10.0,
280-
trigger=main_trigger,
281-
sampling_rate=105,
282-
lag=1.5,
283-
noise=(0, 8.3, 0.5))
284-
285-
calisto.add_parachute('Drogue',
286-
cd_s=1.0,
287-
trigger=drogue_trigger,
288-
sampling_rate=105,
289-
lag=1.5,
290-
noise=(0, 8.3, 0.5))
288+
main = calisto.add_parachute(
289+
name="main",
290+
cd_s=10.0,
291+
trigger=800, # ejection altitude in meters
292+
sampling_rate=105,
293+
lag=1.5,
294+
noise=(0, 8.3, 0.5),
295+
)
296+
297+
drogue = calisto.add_parachute(
298+
name="drogue",
299+
cd_s=1.0,
300+
trigger="apogee", # ejection at apogee
301+
sampling_rate=105,
302+
lag=1.5,
303+
noise=(0, 8.3, 0.5),
304+
)
291305
```
292306

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

301315
```python
302-
test_flight = Flight(rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0)
316+
test_flight = Flight(
317+
rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0
318+
)
303319
```
304320

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

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

337+
If you want to see the trajectory on Google Earth, RocketPy acn easily export a KML file for you:
338+
339+
```python
340+
test_flight.export_kml(file_name="test_flight.kml")
341+
```
342+
321343
<br>
322344

323345
# Authors and Contributors

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"logo_link": "index",
7979
"github_url": "https://github.com/RocketPy-Team/RocketPy",
8080
"collapse_navigation": True,
81-
"show_toc_level": 3,
81+
"show_toc_level": 4,
82+
"show_nav_level": 4,
8283
}
8384

8485
html_sidebars = {

docs/examples/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Flights simulated with RocketPy
2+
===============================
3+
4+
Apart from the classical Calisto rocket, which is many times used as a
5+
reference in the getting started tutorial, RocketPy also includes some very
6+
interesting examples of real rockets.
7+
8+
If you want to see your rocket here, please contact the maintainers!
9+
10+
.. toctree::
11+
:maxdepth: 2
12+
:caption: Contents:
13+
14+
../notebooks/SEBLM.ipynb
15+

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
contain the root `toctree` directive.
55
66
.. toctree::
7-
:maxdepth: 2
7+
:maxdepth: 4
88
:hidden:
99

1010
User Guide <user/index>
1111
Code Reference <reference/index>
1212
Development <development/index>
1313
Technical <technical/index>
14+
Flight Examples <examples/index>
1415

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

docs/notebooks/deployable_payload_example.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"cell_type": "markdown",
66
"metadata": {},
77
"source": [
8-
"# Deployable Payload Flight Simulation Example"
8+
"# Deployable Payload"
99
]
1010
},
1111
{
@@ -37,8 +37,8 @@
3737
"metadata": {},
3838
"outputs": [],
3939
"source": [
40-
"!pip install rocketpy netCDF4\n",
41-
"!git clone https://github.com/RocketPy-Team/RocketPy.git"
40+
"%pip install rocketpy netCDF4\n",
41+
"%git clone https://github.com/RocketPy-Team/RocketPy.git"
4242
]
4343
},
4444
{

0 commit comments

Comments
 (0)