From d5bc0a0765399dceb51a8ac69d0e678fe6640138 Mon Sep 17 00:00:00 2001 From: Pedro Bressan Date: Sat, 1 Jul 2023 11:23:50 -0300 Subject: [PATCH 1/3] DOC: update README.md with new features of v1.0.0a1. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e4b838466..a54e765e7 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,10 @@ RocketPy is the next-generation trajectory simulation solution for High-Power Ro
-Solid motors models +Solid, Hybrid and Liquid motors models
@@ -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. From 8facdce868a06aae136c7770d8026fcfc6d74dae Mon Sep 17 00:00:00 2001 From: Guilherme Date: Sat, 1 Jul 2023 18:46:10 +0200 Subject: [PATCH 2/3] DOC: improve README and ensure simulation works --- README.md | 131 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index a54e765e7..113f5d289 100644 --- a/README.md +++ b/README.md @@ -176,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 @@ -189,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') ``` @@ -205,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", ) ``` @@ -230,29 +246,38 @@ 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 ) ``` @@ -260,35 +285,23 @@ calisto.add_tail( 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: @@ -300,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: @@ -319,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") +``` +
# Authors and Contributors From 962c4b25450b7271f2bb4bbfc9392c4230523d5f Mon Sep 17 00:00:00 2001 From: Guilherme Date: Sat, 1 Jul 2023 18:46:50 +0200 Subject: [PATCH 3/3] FIX: a few missing variables in camelCase --- rocketpy/Environment.py | 2 +- rocketpy/prints/environment_prints.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rocketpy/Environment.py b/rocketpy/Environment.py index e169218ae..d5756cb7f 100644 --- a/rocketpy/Environment.py +++ b/rocketpy/Environment.py @@ -786,7 +786,7 @@ def set_atmospheric_model( so information from virtual soundings such as GFS and NAM can also be imported. - - 'WindyAtmosphere': sets pressure, temperature, wind-u and wind-v + - 'windy_atmosphere': sets pressure, temperature, wind-u and wind-v profiles and surface elevation obtained from the Windy API. See file argument to specify the model as either ECMWF, GFS or ICON. diff --git a/rocketpy/prints/environment_prints.py b/rocketpy/prints/environment_prints.py index db4e06efc..e621b4ae4 100644 --- a/rocketpy/prints/environment_prints.py +++ b/rocketpy/prints/environment_prints.py @@ -72,7 +72,7 @@ def launch_site_details(self): "Launch Date:", self.environment.datetime_date.strftime(time_format), "UTC |", - self.environment.localDate.strftime(time_format), + self.environment.local_date.strftime(time_format), self.environment.timezone, ) elif self.environment.datetime_date != None: