Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ help(Environment)
A sample code is:

```python
Env = Environment(
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
)

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

This can be followed up by starting a Solid Motor object. To get help on it, just use:
Expand All @@ -204,18 +204,18 @@ A sample Motor object can be created by the following code:

```python
Pro75M1670 = SolidMotor(
thrustSource="../data/motors/Cesaroni_M1670.eng",
thrust_source="../data/motors/Cesaroni_M1670.eng",
burn_time=3.9,
grainNumber=5,
grainSeparation=5/1000,
grainDensity=1815,
grainOuterRadius=33/1000,
grainInitialInnerRadius=15/1000,
grainInitialHeight=120/1000,
grainsCenterOfMassPosition=-0.85704,
nozzleRadius=33/1000,
throatRadius=11/1000,
interpolationMethod='linear'
grain_number=5,
grain_separation=5/1000,
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'
)
```

Expand All @@ -228,64 +228,64 @@ help(Rocket)
A sample code to create a Rocket is:

```python
Calisto = Rocket(
calisto = Rocket(
radius=127 / 2000,
mass=19.197 - 2.956,
inertiaI=6.60,
inertiaZ=0.0351,
powerOffDrag="../../data/calisto/powerOffDragCurve.csv",
powerOnDrag="../../data/calisto/powerOnDragCurve.csv",
centerOfDryMassPosition=0,
coordinateSystemOrientation="tailToNose"
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"
)
Calisto.setRailButtons(0.2, -0.5)
Calisto.addMotor(Pro75M1670, position=-1.255)
Calisto.addNose(length=0.55829, kind="vonKarman", position=1.278)
Calisto.addTrapezoidalFins(
calisto.set_rail_buttons(0.2, -0.5)
calisto.add_motor(Pro75M1670, position=-1.255)
calisto.add_nose(length=0.55829, kind="vonKarman", position=1.278)
calisto.add_trapezoidal_fins(
n=4,
rootChord=0.120,
tipChord=0.040,
root_chord=0.120,
tip_chord=0.040,
span=0.100,
position=-1.04956,
cantAngle=0,
cant_angle=0,
radius=None,
airfoil=None
)
Calisto.addTail(
topRadius=0.0635, bottomRadius=0.0435, length=0.060, position=-1.194656
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 drogueTrigger(p, h, y):
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 mainTrigger(p, h, y):
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.addParachute('Main',
CdS=10.0,
trigger=mainTrigger,
samplingRate=105,
calisto.add_parachute('Main',
cd_s=10.0,
trigger=main_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5))

Calisto.addParachute('Drogue',
CdS=1.0,
trigger=drogueTrigger,
samplingRate=105,
calisto.add_parachute('Drogue',
cd_s=1.0,
trigger=drogue_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5))
```
Expand All @@ -299,19 +299,19 @@ help(Flight)
To actually create a Flight object, use:

```python
TestFlight = Flight(rocket=Calisto, environment=Env, railLength=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:

```python
TestFlight.info()
test_flight.info()
```

To see all available results, use:

```python
TestFlight.allInfo()
test_flight.all_info()
```

Here is just a quick taste of what RocketPy is able to calculate. There are hundreds of plots and data points computed by RocketPy to enhance your analyses.
Expand Down
90 changes: 45 additions & 45 deletions docs/development/rocketpy_as_developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ It contains information about the local pressure profile, temperature, speed of

.. code-block:: python

Env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)
env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)

RocketPy can use local files via the Ensemble method or meteorological forecasts through OpenDAP protocol.
To work with environment files, it will be very important ensuring tha that you have the netCDF4 library installed.
Expand All @@ -102,17 +102,17 @@ Assuming we are using forecast, first we set the simulated data with:

import datetime
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
Env.setDate((tomorrow.year, tomorrow.month, tomorrow.day, 12)) # Hour given in UTC time
env.set_date((tomorrow.year, tomorrow.month, tomorrow.day, 12)) # Hour given in UTC time

Then we set the atmospheric model, in this case, GFS forecast:

.. code-block:: python

Env.setAtmosphericModel(type="Forecast", file="GFS")
env.set_atmospheric_model(type="Forecast", file="GFS")

Weather forecast data can be visualized through two info methods.

``Env.info()`` or ``Env.allInfo()``
``env.info()`` or ``env.all_info()``

Creating the motor that boosts the rocket
-----------------------------------------
Expand All @@ -124,22 +124,22 @@ The motor class contains information about the thrust curve and uses some geomet
.. code-block:: python

Pro75M1670 = SolidMotor(
thrustSource="../data/motors/Cesaroni_M1670.eng", #copy here the path to the thrust source file
thrust_source="../data/motors/Cesaroni_M1670.eng", #copy here the path to the thrust source file
burn_time=3.9,
grainNumber=5,
grainSeparation=5 / 1000,
grainDensity=1815,
grainOuterRadius=33 / 1000,
grainInitialInnerRadius=15 / 1000,
grainInitialHeight=120 / 1000,
nozzleRadius=33 / 1000,
throatRadius=11 / 1000,
interpolationMethod="linear",
grain_number=5,
grain_separation=5 / 1000,
grain_density=1815,
grain_outer_radius=33 / 1000,
grain_initial_inner_radius=15 / 1000,
grain_initial_height=120 / 1000,
nozzle_radius=33 / 1000,
throat_radius=11 / 1000,
interpolation_method="linear",
)

Motor data can be visualized through the following methods:

``Pro75M1670.info()`` or ``Pro75M1670.allInfo()``
``Pro75M1670.info()`` or ``Pro75M1670.all_info()``


Creating the rocket
Expand All @@ -150,46 +150,46 @@ The first step is to initialize the class with the vital data:

.. code-block:: python

Calisto = Rocket(
calisto = Rocket(
radius=127 / 2000,
mass=19.197 - 2.956,
inertiaI=6.60,
inertiaZ=0.0351,
powerOffDrag="../../data/calisto/powerOffDragCurve.csv",
powerOnDrag="../../data/calisto/powerOnDragCurve.csv",
centerOfDryMassPosition=0,
coordinateSystemOrientation="tailToNose",
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",
)

Calisto.addMotor(Pro75M1670, position=-1.255)
calisto.add_motor(Pro75M1670, position=-1.255)

Then the rail buttons must be set:

.. code-block:: python

Calisto.setRailButtons(0.2, -0.5)
calisto.set_rail_buttons(0.2, -0.5)

In sequence, the aerodynamic surfaces must be set.
If a lift curve for the fin set is not specified, it is assumed that they behave according to a linearized model with a coefficient calculated with Barrowman's theory.
In the example, a nosecone, one fin set and one tail were added, but each case can be designed differently.

.. code-block:: python

NoseCone = Calisto.addNose(length=0.55829, kind="vonKarman", position=0.71971 + 0.55829)
nosecone = calisto.add_nose(length=0.55829, kind="vonKarman", position=0.71971 + 0.55829)

FinSet = Calisto.addTrapezoidalFins(
fin_set = calisto.add_trapezoidal_fins(
n=4,
rootChord=0.120,
tipChord=0.040,
root_chord=0.120,
tip_chord=0.040,
span=0.100,
position=-1.04956,
cantAngle=0,
cant_angle=0,
radius=None,
airfoil=None,
)

Tail = Calisto.addTail(
topRadius=0.0635, bottomRadius=0.0435, length=0.060, position=-1.194656
tail = calisto.add_tail(
top_radius=0.0635, bottom_radius=0.0435, length=0.060, position=-1.194656
)

If you are considering the parachutes in the simulation, they also have to be added to the rocket object.
Expand All @@ -200,7 +200,7 @@ For example:

.. code-block:: python

def drogueTrigger(p, h, y):
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]
Expand All @@ -209,7 +209,7 @@ For example:
return True if y[5] < 0 else False


def mainTrigger(p, h, y):
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]
Expand All @@ -221,20 +221,20 @@ After having the trigger functions defined, the parachute must be added to the r

.. code-block:: python

Main = Calisto.addParachute(
Main = calisto.add_parachute(
"Main",
CdS=10.0,
trigger=mainTrigger,
samplingRate=105,
cd_s=10.0,
trigger=main_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5),
)

Drogue = Calisto.addParachute(
Drogue = calisto.add_parachute(
"Drogue",
CdS=1.0,
trigger=drogueTrigger,
samplingRate=105,
cd_s=1.0,
trigger=drogue_trigger,
sampling_rate=105,
lag=1.5,
noise=(0, 8.3, 0.5),
)
Expand All @@ -247,14 +247,14 @@ The rocket and environment classes are supplied as inputs, as well as the rail l

.. code-block:: python

TestFlight = Flight(rocket=Calisto, environment=Env, railLength=5.2, inclination=85, heading=0)
test_flight = Flight(rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0)

Flight data can be retrieved through:

``TestFlight.info()`` or ``TestFlight.allInfo()``
``test_flight.info()`` or ``test_flight.all_info()``

This function plots a comprehensive amount of flight data and graphs but, if you want to access one specific variable, for example Z position, this may be achieved by `TestFlight.z`.
If you insert `TestFlight.z()` the graph of the function will be plotted.
This function plots a comprehensive amount of flight data and graphs but, if you want to access one specific variable, for example Z position, this may be achieved by `test_flight.z`.
If you insert `test_flight.z()` the graph of the function will be plotted.
This and other features can be found in the documentation of the `Function` class, which allows data to be treated in an easier way.
The documentation of each variable used in the class can be found on `Flight.py` file.

Expand Down
Loading