Skip to content
This repository was archived by the owner on Oct 30, 2022. It is now read-only.

Issue #7: team-05 - New tail shapes #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
45 changes: 39 additions & 6 deletions rocketpy/Rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def evaluateStaticMargin(self):
# Return self
return self

def addTail(self, topRadius, bottomRadius, length, distanceToCM):
def addTail(self, topRadius, bottomRadius, length, distanceToCM,format,n=0):
"""Create a new tail or rocket diameter change, storing its
parameters as part of the aerodynamicSurfaces list. Its
parameters are the axial position along the rocket and its
Expand All @@ -356,6 +356,12 @@ def addTail(self, topRadius, bottomRadius, length, distanceToCM):
cone. Consider the point belonging to the tail which is
closest to the unloaded center of mass to calculate
distance.
format: string
Tail geometric format, varying between conical,circular-arc, eliptical and parabolic PS (power series).
n: int, float, optional
Tail caracterisc only for parabolical formats, varying from 0 to 1 for Power Series. For other formats, leave n=0.
Daefault is zero

Returns
-------
cl : Function
Expand All @@ -374,13 +380,40 @@ def addTail(self, topRadius, bottomRadius, length, distanceToCM):
# Retrieve reference radius
rref = self.radius

# Calculate cp position relative to cm
if distanceToCM < 0:
cpz = distanceToCM - (length / 3) * (1 + (1 - r) / (1 - r**2))
else:
cpz = distanceToCM + (length / 3) * (1 + (1 - r) / (1 - r**2))
#Separate cp position formula by format
if format == "conical" :

# Calculate cp position relative to cm
if distanceToCM < 0:
cpz = distanceToCM - (length / 3) * (1 + (1 - r) / (1 - r**2))
else:
cpz = distanceToCM + (length / 3) * (1 + (1 - r) / (1 - r**2))
elif format == "circular arc":
if distanceToCM < 0:
cpz= distanceToCM - ((length-(topRadius/6)-(bottomRadius^3/topRadius^2))/(1-(bottomRadius/topRadius)^2))
else:
cpz= distanceToCM + ((length-(topRadius/6)-(bottomRadius^3/topRadius^2))/(1-(bottomRadius/topRadius)^2))
elif format == "eliptical":
#calculate the volume
L= length *(topRadius**2/(bottomRadius**2-topRadius**2)**(1/2))
v= 2/3 *((topRadius**2 *length)-(bottomRadius**2*(L-length)))

#Calculate cp position relative to cm
if distanceToCM < 0:
cpz= distanceToCM - ((length-(v/np.pi*bottomRadius**2))/(1-(bottomRadius/topRadius)**2))
else:
cpz= distanceToCM + ((length-(v/np.pi*bottomRadius**2))/(1-(bottomRadius/topRadius)**2))
elif format == "parabolic PS":
# calculate the volume
L= (topRadius/bottomRadius *length**n)**(1/n)
v = (np.pi/3 )* (topRadius**2 *L)
if distanceToCM < 0:
cpz= distanceToCM - ((length-(v/np.pi*bottomRadius**2))/(1-(bottomRadius/topRadius)**2))
else:
cpz= distanceToCM + ((length-(v/np.pi*bottomRadius**2))/(1-(bottomRadius/topRadius)**2))

# Calculate clalpha
# clalpha não altera com o formato da cauda para voo subsônico, então assim como das ogivas, a sua fórmula se mantém a mesa
clalpha = -2 * (1 - r ** (-2)) * (topRadius / rref) ** 2
cl = Function(
lambda alpha, mach: clalpha * alpha,
Expand Down