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
180 changes: 89 additions & 91 deletions docs/notebooks/getting_started.ipynb

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions docs/notebooks/getting_started_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@
" mass=19.197 - 2.956,\n",
" inertiaI=6.60,\n",
" inertiaZ=0.0351,\n",
" distanceRocketNozzle=-1.255,\n",
" positionNozzle=-1.255,\n",
" positionCenterOfDryMass=0,\n",
" powerOffDrag=\"../../data/calisto/powerOffDragCurve.csv\",\n",
" powerOnDrag=\"../../data/calisto/powerOnDragCurve.csv\",\n",
")\n",
Expand Down Expand Up @@ -358,14 +359,14 @@
},
"outputs": [],
"source": [
"NoseCone = Calisto.addNose(length=0.55829, kind=\"vonKarman\", distanceToCM=0.71971)\n",
"NoseCone = Calisto.addNose(length=0.55829, kind=\"vonKarman\", positionNose=1.278)\n",
"\n",
"FinSet = Calisto.addFins(\n",
" 4, span=0.100, rootChord=0.120, tipChord=0.040, distanceToCM=-1.04956\n",
" 4, span=0.100, rootChord=0.120, tipChord=0.040, positionFins=-1.04956\n",
")\n",
"\n",
"Tail = Calisto.addTail(\n",
" topRadius=0.0635, bottomRadius=0.0435, length=0.060, distanceToCM=-1.194656\n",
" topRadius=0.0635, bottomRadius=0.0435, length=0.060, positionTail=-1.194656\n",
")"
]
},
Expand Down
16 changes: 8 additions & 8 deletions rocketpy/Flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def __init__(
# Modifying Rail Length for a better out of rail condition
upperRButton = max(self.rocket.railButtons[0])
lowerRButton = min(self.rocket.railButtons[0])
nozzle = self.rocket.distanceRocketNozzle
nozzle = -self.rocket.positionCenterOfDryMassToNozzle
self.effective1RL = self.env.rL - abs(nozzle - upperRButton)
self.effective2RL = self.env.rL - abs(nozzle - lowerRButton)

Expand Down Expand Up @@ -1347,8 +1347,8 @@ def uDot(self, t, u, postProcessing=False):
M = Mt + Mr
mu = (Mt * Mr) / (Mt + Mr)
# Geometry
b = -self.rocket.distanceRocketMotorReference
c = -self.rocket.distanceRocketNozzle
b = -self.rocket.positionMotorReferencePositionToCenterOfDryMass
c = -(-self.rocket.positionCenterOfDryMassToNozzle)
a = b * Mt / M
rN = self.rocket.motor.nozzleRadius
# Prepare transformation matrix
Expand Down Expand Up @@ -1835,7 +1835,7 @@ def postProcess(self, interpolation="spline", extrapolation="natural"):
* 2
* np.arcsin(-((self.e1[:, 1] ** 2 + self.e2[:, 1] ** 2) ** 0.5))
) # Nutation angle
theta = np.column_stack([self.e1[:, 0], theta]) # Nutation angle
theta = np.column_stack([self.e2[:, 0], theta]) # Nutation angle
self.theta = Function(theta, "Time (s)", "Nutation Angle - θ (°)")

# Dynamics functions and variables
Expand Down Expand Up @@ -1905,7 +1905,7 @@ def postProcess(self, interpolation="spline", extrapolation="natural"):
self.aerodynamicSpinMoment = self.M3
self.aerodynamicSpinMoment.setOutputs("Aerodynamic Spin Moment (N m)")
# Energy
b = -self.rocket.distanceRocketMotorReference
b = -self.rocket.positionMotorReferencePositionToCenterOfDryMass
totalMass = self.rocket.totalMass
mu = self.rocket.reducedMass
Rz = self.rocket.inertiaZ
Expand Down Expand Up @@ -2142,7 +2142,7 @@ def postProcess(self, interpolation="spline", extrapolation="natural"):
+ math.atan(abs(self.y[i][1]) / abs(self.x[i][1]))
)

# Store values of distance and bearing using approriate units
# Store values of distance and bearing using appropriate units
# self.distance = distance # Must be in meters
# self.bearing = bearing # Must be in radians

Expand Down Expand Up @@ -3228,8 +3228,8 @@ def calculateFinFlutterAnalysis(self, finThickness, shearModulus):
minDifHeight = self.z(minDifTime) - self.env.elevation
minDifVelocity = minDif * self.env.speedOfSound(minDifHeight)

# Calculate the minimun Fin Flutter Safety factor
# Calculate the time and height of minimun Fin Flutter Safety factor
# Calculate the minimum Fin Flutter Safety factor
# Calculate the time and height of minimum Fin Flutter Safety factor
minSFTimeIndex = np.argmin(self.safetyFactor[:, 1])
minSF = self.safetyFactor[minSFTimeIndex, 1]
minSFTime = self.safetyFactor[minSFTimeIndex, 0]
Expand Down
28 changes: 9 additions & 19 deletions rocketpy/Motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
__license__ = "MIT"

import re
import math
import bisect
import warnings
import time
from abc import ABC, abstractmethod, abstractproperty
from datetime import datetime, timedelta
from inspect import signature, getsourcelines
from collections import namedtuple

import numpy as np
from scipy import integrate
from scipy import linalg
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm

from .Function import Function

Expand Down Expand Up @@ -141,7 +130,7 @@ def __init__(
distanceNozzleMotorReference : int, float
Distance from nozzle outlet to the motor reference point, which
for Solids and Hybrids is the center of mass of the solid propellant,
in meters. Generally positive, meaning a positive position in the
in meters. Always positive, meaning a positive position in the
z axis which has an origin in the rocket's center of mass (without
propellant) and points towards the nose cone.
nozzleRadius : int, float, optional
Expand Down Expand Up @@ -174,7 +163,8 @@ def __init__(
self.burnOutTime = burnOut

# Geometric parameters
self.distanceNozzleMotorReference = distanceNozzleMotorReference
# Position of motor reference point relative to the nozzle exit
self.distanceMotorReferenceToNozzle = distanceNozzleMotorReference

# Check if thrustSource is csv, eng, function or other
if isinstance(thrustSource, str):
Expand Down Expand Up @@ -556,7 +546,7 @@ def info(self):
)
print(
"Distance Nozzle - Motor reference point: "
+ str(self.distanceNozzleMotorReference)
+ str(self.distanceMotorReferenceToNozzle)
+ " m"
)
print(
Expand Down Expand Up @@ -597,7 +587,7 @@ def allInfo(self):
print("Nozzle Throat Radius: " + str(self.throatRadius) + " m")
print(
"Distance Nozzle - Motor reference point: "
+ str(self.distanceNozzleMotorReference)
+ str(self.distanceMotorReferenceToNozzle)
+ " m"
)

Expand Down Expand Up @@ -815,7 +805,7 @@ def __init__(
self.burnOutTime = burnOut

# Geometric parameters
self.distanceNozzleMotorReference = distanceNozzleMotorReference
self.distanceMotorReferenceToNozzle = distanceNozzleMotorReference

# Check if thrustSource is csv, eng, function or other
if isinstance(thrustSource, str):
Expand Down Expand Up @@ -1234,7 +1224,7 @@ def info(self):
)
print(
"Distance Nozzle - Motor reference point: "
+ str(self.distanceNozzleMotorReference)
+ str(self.distanceMotorReferenceToNozzle)
+ " m"
)
print(
Expand Down Expand Up @@ -1275,7 +1265,7 @@ def allInfo(self):
print("Nozzle Throat Radius: " + str(self.throatRadius) + " m")
print(
"Distance Nozzle - Motor reference point: "
+ str(self.distanceNozzleMotorReference)
+ str(self.distanceMotorReferenceToNozzle)
+ " m"
)

Expand Down Expand Up @@ -1517,7 +1507,7 @@ def __init__(
self.burnOutTime = burnOut

# Geometric parameters
self.distanceNozzleMotorReference = distanceNozzleMotorReference
self.distanceMotorReferenceToNozzle = distanceNozzleMotorReference

# Check if thrustSource is csv, eng, function or other
if isinstance(thrustSource, str):
Expand Down
Loading