SolidMotor Class¶

class
rocketpy.SolidMotor.
SolidMotor
(thrustSource, burnOut, grainNumber, grainDensity, grainOuterRadius, grainInitialInnerRadius, grainInitialHeight, grainSeparation=0, nozzleRadius=0.0335, throatRadius=0.0114, reshapeThrustCurve=False, interpolationMethod='linear')[source]¶ Class to specify characteristics and useful operations for solid motors.

Geometrical attributes

Motor.
nozzleRadius
¶ Radius of motor nozzle outlet in meters.
 Type
float

Motor.
throatRadius
¶ Radius of motor nozzle throat in meters.
 Type
float

Motor.
grainNumber
¶ Number of solid grains.
 Type
int

Motor.
grainSeparation
¶ Distance between two grains in meters.
 Type
float

Motor.
grainDensity
¶ Density of each grain in kg/meters cubed.
 Type
float

Motor.
grainOuterRadius
¶ Outer radius of each grain in meters.
 Type
float

Motor.
grainInitialInnerRadius
¶ Initial inner radius of each grain in meters.
 Type
float

Motor.
grainInitialHeight
¶ Initial height of each grain in meters.
 Type
float

Motor.
grainInitialVolume
¶ Initial volume of each grain in meters cubed.
 Type
float

Mass and moment of inertia attributes

Motor.
grainInitialMass
¶ Initial mass of each grain in kg.
 Type
float

Motor.
propellantInitialMass
¶ Total propellant initial mass in kg.
 Type
float

Motor.
massDot
¶ Time derivative of propellant total mass in kg/s as a function of time.
 Type

Motor.
inertiaI
¶ Propellant moment of inertia in kg*meter^2 with respect to axis perpendicular to axis of cylindrical symmetry of each grain, given as a function of time.
 Type

Motor.
inertiaIDot
¶ Time derivative of inertiaI given in kg*meter^2/s as a function of time.
 Type

Motor.
inertiaZ
¶ Propellant moment of inertia in kg*meter^2 with respect to axis of cylindrical symmetry of each grain, given as a function of time.
 Type

Motor.
inertiaDot
¶ Time derivative of inertiaZ given in kg*meter^2/s as a function of time.
 Type

Thrust and burn attributes

Motor.
totalImpulse
¶ Total impulse of the thrust curve in N*s.
 Type
float

Motor.
maxThrust
¶ Maximum thrust value of the given thrust curve, in N.
 Type
float

Motor.
maxThrustTime
¶ Time, in seconds, in which the maximum thrust value is achieved.
 Type
float

Motor.
averageThrust
¶ Average thrust of the motor, given in N.
 Type
float

Motor.
burnOutTime
¶ Total motor burn out time, in seconds. Must include delay time when the motor takes time to ignite. Also seen as time to end thrust curve.
 Type
float

Motor.
exhaustVelocity
¶ Propulsion gases exhaust velocity, assumed constant, in m/s.
 Type
float

Motor.
burnArea
¶ Total burn area considering all grains, made out of inner cylindrical burn area and grain top and bottom faces. Expressed in meters squared as a function of time.
 Type

Motor.
Kn
¶ Motor Kn as a function of time. Defined as burnArea divided by nozzle throat cross sectional area. Has no units.
 Type

Motor.
interpolate
¶ Method of interpolation used in case thrust curve is given by data set in .csv or .eng, or as an array. Options are ‘spline’ ‘akima’ and ‘linear’. Default is “linear”.
 Type
string
Initialize Motor class, process thrust curve and geometrical parameters and store results.
 Parameters
thrustSource (int, float, callable, string, array) – Motor’s thrust curve. Can be given as an int or float, in which case the thrust will be considered constant in time. It can also be given as a callable function, whose argument is time in seconds and returns the thrust supplied by the motor in the instant. If a string is given, it must point to a .csv or .eng file. The .csv file shall contain no headers and the first column must specify time in seconds, while the second column specifies thrust. Arrays may also be specified, following rules set by the class Function. See help(Function). Thrust units are Newtons.
burnOut (int, float) – Motor burn out time in seconds.
grainNumber (int) – Number of solid grains
grainDensity (int, float) – Solid grain density in kg/m3.
grainOuterRadius (int, float) – Solid grain outer radius in meters.
grainInitialInnerRadius (int, float) – Solid grain initial inner radius in meters.
grainInitialHeight (int, float) – Solid grain initial height in meters.
grainSeparation (int, float, optional) – Distance between grains, in meters. Default is 0.
nozzleRadius (int, float, optional) – Motor’s nozzle outlet radius in meters. Used to calculate Kn curve. Optional if the Kn curve is not interesting. Its value does not impact trajectory simulation.
throatRadius (int, float, optional) – Motor’s nozzle throat radius in meters. Its value has very low impact in trajectory simulation, only useful to analyze dynamic instabilities, therefore it is optional.
reshapeThrustCurve (boolean, tuple, optional) – If False, the original thrust curve supplied is not altered. If a tuple is given, whose first parameter is a new burn out time and whose second parameter is a new total impulse in Ns, the thrust curve is reshaped to match the new specifications. May be useful for motors whose thrust curve shape is expected to remain similar in case the impulse and burn time varies slightly. Default is False.
interpolationMethod (string, optional) – Method of interpolation to be used in case thrust curve is given by data set in .csv or .eng, or as an array. Options are ‘spline’ ‘akima’ and ‘linear’. Default is “linear”.
 Returns
 Return type
None

reshapeThrustCurve
(burnTime, totalImpulse, oldTotalImpulse=None, startAtZero=True)[source]¶ Transforms the thrust curve supplied by changing its total burn time and/or its total impulse, without altering the general shape of the curve. May translate the curve so that thrust starts at time equals 0, without any delays.
 Parameters
burnTime (float) – New desired burn out time in seconds.
totalImpulse (float) – New desired total impulse.
oldTotalImpulse (float, optional) – Specify the total impulse of the given thrust curve, overriding the value calculated by numerical integration. If left as None, the value calculated by numerical integration will be used in order to reshape the curve.
startAtZero (bool, optional) – If True, trims the initial thrust curve points which are 0 Newtons, translating the thrust curve so that thrust starts at time equals 0. If False, no translation is applied.
 Returns
 Return type
None

evaluateTotalImpulse
()[source]¶ Calculates and returns total impulse by numerical integration of the thrust curve in SI units. The value is also stored in self.totalImpulse.
 Parameters
None –
 Returns
self.totalImpulse – Motor total impulse in Ns.
 Return type
float

exhaustVelocity
¶ Calculates and returns exhaust velocity by assuming it as a constant. The formula used is total impulse/propellant initial mass. The value is also stored in self.exhaustVelocity.
 Parameters
None –
 Returns
self.exhaustVelocity – Constant gas exhaust velocity of the motor.
 Return type
float

evaluateMassDot
()[source]¶ Calculates and returns the time derivative of propellant mass by assuming constant exhaust velocity. The formula used is the opposite of thrust divided by exhaust velocity. The result is a function of time, object of the Function class, which is stored in self.massDot.
 Parameters
None –
 Returns
self.massDot – Time derivative of total propellant mas as a function of time.
 Return type

evaluateMass
()[source]¶ Calculates and returns the total propellant mass curve by numerically integrating the MassDot curve, calculated in evaluateMassDot. Numerical integration is done with the Trapezoidal Rule, given the same result as scipy.integrate. odeint but 100x faster. The result is a function of time, object of the class Function, which is stored in self.mass.
 Parameters
None –
 Returns
self.mass – Total propellant mass as a function of time.
 Return type

evaluateGeometry
()[source]¶ Calculates grain inner radius and grain height as a function of time by assuming that every propellant mass burnt is exhausted. In order to do that, a system of differential equations is solved using scipy.integrate. odeint. Furthermore, the function calculates burn area, burn rate and Kn as a function of time using the previous results. All functions are stored as objects of the class Function in self.grainInnerRadius, self.grainHeight, self. burnArea, self.burnRate and self.Kn.
 Parameters
None –
 Returns
geometry – First element is the Function representing the inner radius of a grain as a function of time. Second argument is the Function representing the height of a grain as a function of time.
 Return type
list of Functions

evaluateBurnArea
()[source]¶ Calculates the BurnArea of the grain for each time. Assuming that the grains are cylindrical BATES grains.
 Parameters
None –
 Returns
burnArea (Function)
Function representing the burn area progression with the time.

evaluateBurnRate
()[source]¶ Calculates the BurnRate with respect to time. This evaluation assumes that it was already calculated the massDot, burnArea timeseries.
 Parameters
None –
 Returns
burnRate (Function)
Rate of progression of the inner radius during the combustion.

evaluateInertia
()[source]¶ Calculates propellant inertia I, relative to directions perpendicular to the rocket body axis and its time derivative as a function of time. Also calculates propellant inertia Z, relative to the axial direction, and its time derivative as a function of time. Products of inertia are assumed null due to symmetry. The four functions are stored as an object of the Function class.
 Parameters
None –
 Returns
The first argument is the Function representing inertia I, while the second argument is the Function representing inertia Z.
 Return type
list of Functions

importEng
(fileName)[source]¶  Read content from .eng file and process it, in order to
return the comments, description and data points.
 fileNamestring
Name of the .eng file. E.g. ‘test.eng’. Note that the .eng file must not contain the 0 0 point.
 commentslist
All comments in the .eng file, separated by line in a list. Each line is an entry of the list.
 description: list
Description of the motor. All attributes are returned separated in a list. E.g. “F32 24 124 51015 .0377 .0695 RV
 ” is return as
[‘F32’, ‘24’, ‘124’, ‘51015’, ‘.0377’, ‘.0695’, ‘RV
 ‘]
 dataPoints: list
List of all data points in file. Each data point is an entry in the returned list and written as a list of two entries.

exportEng
(fileName, motorName)[source]¶ Exports thrust curve data points and motor description to .eng file format. A description of the format can be found here: http://www.thrustcurve.org/raspformat.shtml
 Parameters
fileName (string) – Name of the .eng file to be exported. E.g. ‘test.eng’
motorName (string) – Name given to motor. Will appear in the description of the .eng file. E.g. ‘Mandioca’
 Returns
 Return type
None
