rocketPy package¶
Submodules¶
rocketPy.cli module¶
Console script for rocketPy.
rocketPy.components module¶
Creates the components of a rocket. Base classes and the specific useful components are created.
All components inherit from Component
From here, it splits into
InternalComponent or ExternalComponent
where the difference is used to help the drag model, and plotting.
-
class
rocketPy.components.BodyTube(name='Body Tube', mass=None, inertia=None, diameter=None, length=None, wall_thickness=<Quantity(2, 'millimeter')>, material=None)[source]¶ Bases:
rocketPy.components.ExternalComponent-
estimate_inertia()[source]¶ Generic method to estimate the mass of the component - assume inertia is 0. This method should be overridden for each component specified
-
-
class
rocketPy.components.Component(name='Component', mass=None, inertia=None)[source]¶ Bases:
objectBase class for all components
- Parameters
name (str) – Name of component. Defaults to ‘Component’.
mass (function or None or Quantity) – Mass of component. Defaults to None. If
None: calls theself.estimate_mass()method to assign mass. Iffunction: calls the function and assigns mass IfPint.Quantity: assigns mass directly.inertia (function or None or Quantity) – Assigns inertia of the rocket, in (I_xx, I_yy, I_zz). Rest of the components are assumed to be 0. Defaults to None. If
None: calls theself.estimate_inertia()method to assign inertia. Iffunction: calls the function to assign the inertia. The function must return a tuple of (I_xx, I_yy, I_zz) Iftuple of Pint.Quantity: assigns the inertia direction. The tuple must be (I_xx, I_yy, I_zz) with each being a Pint.Quantity of the right units.
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>>
-
I_xx¶ Description of parameter I_xx.
- Type
type
-
I_yy¶ Description of parameter I_yy.
- Type
type
-
I_zz¶ Description of parameter I_zz.
- Type
type
-
x_ref¶ Description of parameter x_ref.
- Type
type
-
y_ref¶ Description of parameter y_ref.
- Type
type
-
z_ref¶ Description of parameter z_ref.
- Type
type
-
A_ref¶ Description of parameter A_ref.
- Type
type
-
name¶
-
mass¶
-
estimate_inertia()[source] Generic method to estimate the mass of the component - assume inertia is 0. This method should be overridden for each component specified
-
estimate_mass()[source] Generic method to estimate the mass of the component - assume mass is 0. This method should be overridden for each component specified
-
plot(ax=None, rotation=<Quantity(0, 'degree')>, unit=<Unit('meter')>)[source]¶ Plots the component.
- Parameters
ax (type) – Description of parameter ax. Defaults to None.
rotation (type) – Description of parameter rotation. Defaults to 0*ureg.degree.
unit (type) – Description of parameter unit. Defaults to ureg.m.
- Returns
Description of returned object.
- Return type
type
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>>
-
set_position(start_of=None, end_of=None, middle_of=None, after=None, offset=<Quantity(0, 'meter')>)[source]¶ Defines the x_ref of this component relative to other components.
- Parameters
start_of (Component) – If not None, aligns self with other. Defaults to None.
end_of (Component) – If not None, aligns end of self with other. Defaults to None.
middle_of (Component) – If not None, aligns midpoints of self and other. Defaults to None.
after (Component) – If not None, aligns start of self to end of other. Defaults to None.
offset (Pint.Quantity) – Follows rules as above, but adds
offsetto self.x_ref. Defaults to 0*ureg.m.
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>>
-
class
rocketPy.components.Cylinder(name='Internal Cylinder', mass=None, inertia=None, diameter=<Quantity(6, 'inch')>, length=<Quantity(6, 'inch')>, density=None)[source]¶
-
class
rocketPy.components.ExternalComponent(name='External Component', mass=None, inertia=None, A_ref=<Quantity(28.274333882308138, 'inch ** 2')>)[source]¶
-
class
rocketPy.components.FinSet(name='Fins', mass=None, inertia=None, n=None, span=None, root_chord=None, tip_chord=None, mid_sweep=None, tube_dia=None, thickness=None, material=None)[source]¶ Bases:
rocketPy.components.ExternalComponent-
estimate_inertia()[source]¶ Generic method to estimate the mass of the component - assume inertia is 0. This method should be overridden for each component specified
-
-
class
rocketPy.components.InternalComponent(name='Internal Component', mass=None, inertia=None)[source]¶
-
class
rocketPy.components.NoseCone(name='Nose Cone', mass=None, inertia=None, shape='Conical', diameter=None, length=None, fineness=None, wall_thickness=<Quantity(2, 'millimeter')>, material=None)[source]¶
-
class
rocketPy.components.Transition(name='Transition', mass=None, inertia=None, fore_dia=None, aft_dia=None, length=None, wall_thickness=<Quantity(2, 'millimeter')>, material=None)[source]¶ Bases:
rocketPy.components.ExternalComponent-
estimate_inertia()[source]¶ Generic method to estimate the mass of the component - assume inertia is 0. This method should be overridden for each component specified
-
rocketPy.materials module¶
Defines all the materials and their material properties. Base class Material allows for users to define a material, while some specific commonly used materials are predefined to help speed up the design process. Users should check that the right material properties are assumed for their parts.
-
class
rocketPy.materials.Acrylic(name='Acrylic')[source]¶ Bases:
rocketPy.materials.Material
-
class
rocketPy.materials.Aluminium(name='Al-6061-T6')[source]¶ Bases:
rocketPy.materials.MaterialDefines a basic aluminium.
- Parameters
name (str) – Description of parameter name. Defaults to ‘Al-6061-T6’.
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>>
-
density¶ Description of parameter density.
- Type
Pint.Quantity
-
tensile_modulus¶ Description of parameter tensile_modulus.
- Type
Pint.Quantity
-
tensile_strength¶ Description of parameter tensile_strength.
- Type
Pint.Quantity
-
max_temp¶ Description of parameter max_temp.
- Type
Pint.Quantity
-
class
rocketPy.materials.Material(name)[source]¶ Bases:
objectBase class for defining material properties
- Parameters
name (str) – Name of material.
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>>
-
density¶ Material Density.
- Type
Pint.Quantity
-
name¶ name
- Type
str
-
class
rocketPy.materials.PLA(name='PLA')[source]¶ Bases:
rocketPy.materials.Material
-
class
rocketPy.materials.Phenolic(name='Phenolic')[source]¶ Bases:
rocketPy.materials.Material
-
class
rocketPy.materials.Plywood(name='Plywood')[source]¶ Bases:
rocketPy.materials.Material
-
class
rocketPy.materials.Polycarbonate(name='Polycarbonate')[source]¶ Bases:
rocketPy.materials.Material
rocketPy.rocket module¶
Module to describe the rocket
-
class
rocketPy.rocket.Rocket(name='Rocket')[source]¶ Bases:
object-
CA(alpha=<Quantity(0, 'radian')>, Re=1000000.0, Mach=0.3)[source]¶ Compute the axial drag force from the normal force and the axial force
-
CD(alpha=<Quantity(0, 'radian')>, Re=1000000.0, Mach=0.3)[source]¶ Calculate the drag force at some angle of attack, including compressibility
-
CD0(Re=1000000.0)[source]¶ Calcualte the zero angle-of-attack incompressible drag of the rocket. Generally uses DATCOM method (as specified by Box [1]) Reynolds number refers to the reynolds number by the length of the rocket.
-
CD0_f(Re=1000000.0)[source]¶ Calcualte the zero-angle of attack drag due to the fins, including the effect of the interference
-
plot(ax=None, unit=<Unit('meter')>, rotation=<Quantity(0, 'degree')>, plot_component_cp=True, plot_component_cg=True, alpha=<Quantity(0, 'degree')>, Re=1000000.0, Mach=0.3)[source]¶
-
rocketPy.rocketPy module¶
Main module.
rocketPy.util module¶
Utility functions for rocketPy
-
rocketPy.util.mach_correction(Ma=0.0, method='default')[source]¶ Performs the Prandtl-Glauert compressibility correction, extended for supersonic region.
- Parameters
Ma (dimensionless float) – Mach Number. Defaults to 0.0.
method (str) – Choose the correction method (‘default’ or ‘Cambridge’). Defaults to ‘default’.
- Returns
Mach correction multiplier (float)
- Return type
dimensionless float
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>> mach_correction(0.5) 1.1547005383792517 >> mach_correction(1.5) 0.8944271909999159
-
rocketPy.util.si(v)[source]¶ Utility function to convert a Pint Quantity into a float in SI units.
- Parameters
v (Pint.Quantity or list/numpy.Array of Pint.Quantity) – quantity or list of quantities to convert.
- Returns
magnitudes in SI units.
- Return type
float or list of floats
- Examples
Examples should be written in doctest format, and should illustrate how to use the function/class. >>> si(5.0*ureg.meter) 5.0 >> si(6.0*ureg.inch) 0.1524
Module contents¶
Top-level package for rocketPy.