Motor Abstract Class#

class rocketpy.Motor[source]#

Abstract class to specify characteristics and useful operations for motors. Cannot be instantiated.

Variables:
  • Motor.coordinate_system_orientation (str) – Orientation of the motor’s coordinate system. The coordinate system is defined by the motor’s axis of symmetry. The origin of the coordinate system may be placed anywhere along such axis, such as at the nozzle exit area, and must be kept the same for all other positions specified. Options are “nozzle_to_combustion_chamber” and “combustion_chamber_to_nozzle”.

  • Motor.nozzle_radius (float) – Radius of motor nozzle outlet in meters.

  • Motor.nozzle_position (float) – Motor’s nozzle outlet position in meters, specified in the motor’s coordinate system. See Positions and Coordinate Systems for more information.

  • Motor.dry_mass (float) – The mass of the motor when devoid of any propellants, measured in kilograms (kg). It encompasses the structural weight of the motor, including the combustion chamber, nozzles, tanks, and fasteners. Excluded from this measure are the propellants and any other elements that are dynamically accounted for in the mass parameter of the rocket class. Ensure that mass contributions from components shared with the rocket structure are not recounted here. This parameter does not vary with time.

  • Motor.propellant_initial_mass (float) – Total propellant initial mass in kg, including solid, liquid and gas phases.

  • Motor.total_mass (Function) – Total motor mass in kg as a function of time, defined as the sum of propellant mass and the motor’s dry mass (i.e. structure mass).

  • Motor.propellant_mass (Function) – Total propellant mass in kg as a function of time, including solid, liquid and gas phases.

  • Motor.total_mass_flow_rate (Function) – Time derivative of propellant total mass in kg/s as a function of time as obtained by the thrust source.

  • Motor.center_of_mass (Function) – Position of the motor center of mass in meters as a function of time. See Positions and Coordinate Systems for more information regarding the motor’s coordinate system.

  • Motor.center_of_propellant_mass (Function) – Position of the motor propellant center of mass in meters as a function of time. See Positions and Coordinate Systems for more information regarding the motor’s coordinate system.

  • Motor.I_11 (Function) – Component of the motor’s inertia tensor relative to the e_1 axis in kg*m^2, as a function of time. The e_1 axis is the direction perpendicular to the motor body axis of symmetry, centered at the instantaneous motor center of mass.

  • Motor.I_22 (Function) – Component of the motor’s inertia tensor relative to the e_2 axis in kg*m^2, as a function of time. The e_2 axis is the direction perpendicular to the motor body axis of symmetry, centered at the instantaneous motor center of mass. Numerically equivalent to I_11 due to symmetry.

  • Motor.I_33 (Function) – Component of the motor’s inertia tensor relative to the e_3 axis in kg*m^2, as a function of time. The e_3 axis is the direction of the motor body axis of symmetry, centered at the instantaneous motor center of mass.

  • Motor.I_12 (Function) – Component of the motor’s inertia tensor relative to the e_1 and e_2 axes in kg*m^2, as a function of time. See Motor.I_11 and Motor.I_22 for more information.

  • Motor.I_13 (Function) – Component of the motor’s inertia tensor relative to the e_1 and e_3 axes in kg*m^2, as a function of time. See Motor.I_11 and Motor.I_33 for more information.

  • Motor.I_23 (Function) – Component of the motor’s inertia tensor relative to the e_2 and e_3 axes in kg*m^2, as a function of time. See Motor.I_22 and Motor.I_33 for more information.

  • Motor.propellant_I_11 (Function) – Component of the propellant inertia tensor relative to the e_1 axis in kg*m^2, as a function of time. The e_1 axis is the direction perpendicular to the motor body axis of symmetry, centered at the instantaneous propellant center of mass.

  • Motor.propellant_I_22 (Function) – Component of the propellant inertia tensor relative to the e_2 axis in kg*m^2, as a function of time. The e_2 axis is the direction perpendicular to the motor body axis of symmetry, centered at the instantaneous propellant center of mass. Numerically equivalent to propellant_I_11 due to symmetry.

  • Motor.propellant_I_33 (Function) – Component of the propellant inertia tensor relative to the e_3 axis in kg*m^2, as a function of time. The e_3 axis is the direction of the motor body axis of symmetry, centered at the instantaneous propellant center of mass.

  • Motor.propellant_I_12 (Function) – Component of the propellant inertia tensor relative to the e_1 and e_2 axes in kg*m^2, as a function of time. See Motor.propellant_I_11 and Motor.propellant_I_22 for more information.

  • Motor.propellant_I_13 (Function) – Component of the propellant inertia tensor relative to the e_1 and e_3 axes in kg*m^2, as a function of time. See Motor.propellant_I_11 and Motor.propellant_I_33 for more information.

  • Motor.propellant_I_23 (Function) – Component of the propellant inertia tensor relative to the e_2 and e_3 axes in kg*m^2, as a function of time. See Motor.propellant_I_22 and Motor.propellant_I_33 for more information.

  • Motor.thrust (Function) – Motor thrust force, in Newtons, as a function of time.

  • Motor.total_impulse (float) – Total impulse of the thrust curve in N*s.

  • Motor.max_thrust (float) – Maximum thrust value of the given thrust curve, in N.

  • Motor.max_thrust_time (float) – Time, in seconds, in which the maximum thrust value is achieved.

  • Motor.average_thrust (float) – Average thrust of the motor, given in N.

  • Motor.burn_time (tuple of float) – Tuple containing the initial and final time of the motor’s burn time in seconds.

  • Motor.burn_start_time (float) – Motor burn start time, in seconds.

  • Motor.burn_out_time (float) – Motor burn out time, in seconds.

  • Motor.burn_duration (float) – Total motor burn duration, in seconds. It is the difference between the burn_out_time and the burn_start_time.

  • Motor.exhaust_velocity (Function) – Propulsion gases exhaust velocity in m/s.

  • Motor.interpolate (string) – 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”.

__init__(thrust_source, dry_mass, dry_inertia, nozzle_radius, center_of_dry_mass_position, nozzle_position=0, burn_time=None, reshape_thrust_curve=False, interpolation_method='linear', coordinate_system_orientation='nozzle_to_combustion_chamber')[source]#

Initialize Motor class, process thrust curve and geometrical parameters and store results.

Parameters:
  • thrust_source (int, float, callable, string, array, Function) –

    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 can contain a single line header 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. Thrust units are Newtons.

  • dry_mass (int, float) – Same as in Motor class. See the Motor docs

  • center_of_dry_mass_position (int, float) – The position, in meters, of the motor’s center of mass with respect to the motor’s coordinate system when it is devoid of propellant. See Positions and Coordinate Systems

  • dry_inertia (tuple, list) – Tuple or list containing the motor’s dry mass inertia tensor components, in kg*m^2. This inertia is defined with respect to the the center_of_dry_mass_position position. Assuming e_3 is the rocket’s axis of symmetry, e_1 and e_2 are orthogonal and form a plane perpendicular to e_3, the dry mass inertia tensor components must be given in the following order: (I_11, I_22, I_33, I_12, I_13, I_23), where I_ij is the component of the inertia tensor in the direction of e_i x e_j. Alternatively, the inertia tensor can be given as (I_11, I_22, I_33), where I_12 = I_13 = I_23 = 0.

  • nozzle_radius (int, float, optional) – Motor’s nozzle outlet radius in meters.

  • burn_time (float, tuple of float, optional) – Motor’s burn time. If a float is given, the burn time is assumed to be between 0 and the given float, in seconds. If a tuple of float is given, the burn time is assumed to be between the first and second elements of the tuple, in seconds. If not specified, automatically sourced as the range between the first and last-time step of the motor’s thrust curve. This can only be used if the motor’s thrust is defined by a list of points, such as a .csv file, a .eng file or a Function instance whose source is a list.

  • nozzle_position (int, float, optional) – Motor’s nozzle outlet position in meters, in the motor’s coordinate system. See Positions and Coordinate Systems for details. Default is 0, in which case the origin of the coordinate system is placed at the motor’s nozzle outlet.

  • reshape_thrust_curve (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. Note that the Motor burn_time parameter must include the new reshaped burn time.

  • interpolation_method (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”.

  • coordinate_system_orientation (string, optional) – Orientation of the motor’s coordinate system. The coordinate system is defined by the motor’s axis of symmetry. The origin of the coordinate system may be placed anywhere along such axis, such as at the nozzle area, and must be kept the same for all other positions specified. Options are “nozzle_to_combustion_chamber” and “combustion_chamber_to_nozzle”. Default is “nozzle_to_combustion_chamber”.

Return type:

None

property burn_time#

Burn time range in seconds.

Returns:

Burn time range in seconds.

Return type:

tuple

property total_impulse#

Calculates and returns total impulse by numerical integration of the thrust curve in SI units.

Returns:

self.total_impulse – Motor total impulse in Ns.

Return type:

float

abstract property exhaust_velocity#

Exhaust velocity of the motor gases.

Returns:

self.exhaust_velocity – Gas exhaust velocity of the motor.

Return type:

Function

Notes

This method is implemented in the following manner by the child Motor classes:

  • The SolidMotor assumes a constant exhaust velocity and computes it as the ratio of the total impulse and the propellant mass;

  • The HybridMotor assumes a constant exhaust velocity and computes it as the ratio of the total impulse and the propellant mass;

  • The LiquidMotor class favors the more accurate data from the Tanks’s mass flow rates. Therefore the exhaust velocity is generally variable, being the ratio of the motor thrust by the mass flow rate.

total_mass#

Total mass of the motor as a function of time. It is defined as the propellant mass plus the dry mass.

Returns:

Motor total mass as a function of time.

Return type:

Function

propellant_mass#

Total propellant mass as a Function of time.

Returns:

Total propellant mass as a function of time.

Return type:

Function

total_mass_flow_rate#

Time derivative of the propellant mass as a function of time. The formula used is the opposite of thrust divided by exhaust velocity.

Returns:

Time derivative of total propellant mass a function of time.

Return type:

Function

See also

SolidMotor.mass_flow_rate

Numerically equivalent to total_mass_flow_rate.

HybridMotor.mass_flow_rate

Numerically equivalent to total_mass_flow_rate.

LiquidMotor.mass_flow_rate

Independent of total_mass_flow_rate favoring more accurate sum of Tanks’ mass flow rates.

Notes

This function computes the total mass flow rate of the motor by dividing the thrust data by the exhaust velocity. This is an approximation, and it is used by the child Motor classes as follows:

  • The SolidMotor class uses this approximation to compute the grain’s mass flow rate;

  • The HybridMotor class uses this approximation as a reference to the sum of the oxidizer and fuel (grains) mass flow rates;

  • The LiquidMotor class favors the more accurate data from the Tanks’s mass flow rates. Therefore this value is numerically independent of the LiquidMotor.mass_flow_rate.

  • The GenericMotor class considers the total_mass_flow_rate as the

same as the mass_flow_rate.

It should be noted that, for hybrid motors, the oxidizer mass flow rate should not be greater than total_mass_flow_rate, otherwise the grains mass flow rate will be negative, losing physical meaning.

abstract property propellant_initial_mass#

Propellant initial mass in kg, including solid, liquid and gas phases

Returns:

Propellant initial mass in kg.

Return type:

float

center_of_mass#

Position of the center of mass as a function of time. The position is specified as a scalar, relative to the motor’s coordinate system.

Returns:

Position of the center of mass as a function of time.

Return type:

Function

abstract property center_of_propellant_mass#

Position of the propellant center of mass as a function of time. The position is specified as a scalar, relative to the origin of the motor’s coordinate system.

Returns:

Position of the propellant center of mass as a function of time.

Return type:

Function

I_11#

Inertia tensor 11 component, which corresponds to the inertia relative to the e_1 axis, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 11 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis. Also, due to symmetry, I_11 = I_22.

I_22#

Inertia tensor 22 component, which corresponds to the inertia relative to the e_2 axis, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 22 component at time t.

Return type:

Function

Notes

The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1. Also, due to symmetry, I_22 = I_11.

I_33#

Inertia tensor 33 component, which corresponds to the inertia relative to the e_3 axis, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 33 component at time t.

Return type:

Function

Notes

The e_3 direction is assumed to be the axial direction of the rocket motor.

I_12#

Inertia tensor 12 component, which corresponds to the product of inertia relative to axes e_1 and e_2, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 12 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis. The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

I_13#

Inertia tensor 13 component, which corresponds to the product of inertia relative to the axes e_1 and e_3, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 13 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis. The e_3 direction is assumed to be the axial direction of the rocket motor. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

I_23#

Inertia tensor 23 component, which corresponds to the product of inertia relative the axes e_2 and e_3, centered at the instantaneous center of mass.

Returns:

Propellant inertia tensor 23 component at time t.

Return type:

Function

Notes

The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1. The e_3 direction is assumed to be the axial direction of the rocket motor. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

abstract property propellant_I_11#

Inertia tensor 11 component of the propellant, the inertia is relative to the e_1 axis, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 11 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis.

abstract property propellant_I_22#

Inertia tensor 22 component of the propellant, the inertia is relative to the e_2 axis, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 22 component at time t.

Return type:

Function

Notes

The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1.

abstract property propellant_I_33#

Inertia tensor 33 component of the propellant, the inertia is relative to the e_3 axis, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 33 component at time t.

Return type:

Function

Notes

The e_3 direction is assumed to be the axial direction of the rocket motor.

abstract property propellant_I_12#

Inertia tensor 12 component of the propellant, the product of inertia is relative to axes e_1 and e_2, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 12 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis. The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

abstract property propellant_I_13#

Inertia tensor 13 component of the propellant, the product of inertia is relative to axes e_1 and e_3, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 13 component at time t.

Return type:

Function

Notes

The e_1 direction is assumed to be the direction perpendicular to the motor body axis. The e_3 direction is assumed to be the axial direction of the rocket motor. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

abstract property propellant_I_23#

Inertia tensor 23 component of the propellant, the product of inertia is relative to axes e_2 and e_3, centered at the instantaneous propellant center of mass.

Returns:

Propellant inertia tensor 23 component at time t.

Return type:

Function

Notes

The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1. The e_3 direction is assumed to be the axial direction of the rocket motor. RocketPy follows the definition of the inertia tensor as in [1], which includes the minus sign for all products of inertia.

static reshape_thrust_curve(thrust, new_burn_time, total_impulse)[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.

Parameters:
  • thrust (Function) – Thrust curve to be reshaped.

  • new_burn_time (float, tuple of float) – New desired burn time in seconds.

  • total_impulse (float) – New desired total impulse.

Returns:

Reshaped thrust curve.

Return type:

Function

static clip_thrust(thrust, new_burn_time)[source]#

Clips the thrust curve data points according to the new_burn_time parameter. If the burn_time range does not coincides with the thrust dataset, their values are interpolated.

Parameters:
  • thrust (Function) – Thrust curve to be clipped.

  • new_burn_time (float, tuple of float) – New desired burn time in seconds for the thrust curve. Must be within the thrust curve time range, otherwise the thrust time range is used instead.

Returns:

Clipped thrust curve.

Return type:

Function

static import_eng(file_name)[source]#

Read content from .eng file and process it, in order to return the comments, description and data points.

Parameters:

file_name (string) – Name of the .eng file. E.g. ‘test.eng’. Note that the .eng file must not contain the 0 0 point.

Returns:

  • comments (list) – 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 5-10-15 .0377 .0695 RV” is return as [‘F32’, ‘24’, ‘124’, ‘5-10-15’, ‘.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.

export_eng(file_name, motor_name)[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:
  • file_name (string) – Name of the .eng file to be exported. E.g. ‘test.eng’

  • motor_name (string) – Name given to motor. Will appear in the description of the .eng file. E.g. ‘Mandioca’

Return type:

None

info()[source]#

Prints out a summary of the data and graphs available about the Motor.

abstract all_info()[source]#

Prints out all data and graphs available about the Motor.