GenericMotor Class#
- class rocketpy.GenericMotor[source]#
Class that represents a simple motor defined mainly by its thrust curve. There is no distinction between the propellant types (e.g. Solid, Liquid). This class is meant for rough estimations of the motor performance, therefore for more accurate results, use the
SolidMotor
,HybridMotor
orLiquidMotor
classes.- __init__(thrust_source, burn_time, chamber_radius, chamber_height, chamber_position, propellant_initial_mass, nozzle_radius, dry_mass=0, center_of_dry_mass_position=None, dry_inertia=(0, 0, 0), nozzle_position=0, reshape_thrust_curve=False, interpolation_method='linear', coordinate_system_orientation='nozzle_to_combustion_chamber')[source]#
Initialize GenericMotor 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.
See also
chamber_radius (
int
,float
) – The radius of a overall cylindrical chamber of propellant in meters. This is a rough estimate for the motor’s propellant chamber or tanks.chamber_height (
int
,float
) – The height of a overall cylindrical chamber of propellant in meters. This is a rough estimate for the motor’s propellant chamber or tanks.chamber_position (
int
,float
) – The position, in meters, of the centroid (half height) of the motor’s overall cylindrical chamber of propellant with respect to the motor’s coordinate system. See Positions and Coordinate Systemsdry_mass (
int
,float
) – Same as in Motor class. See theMotor
docspropellant_initial_mass (
int
,float
) – The initial mass of the propellant in the motor.center_of_dry_mass_position (
int
,float
, optional) – 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. If not specified, automatically sourced as the chamber position. See Positions and Coordinate Systemsdry_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
offloat
, 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”.
- property propellant_initial_mass#
Calculates the initial mass of the propellant.
- Returns:
Initial mass of the propellant.
- Return type:
float
- exhaust_velocity#
Exhaust velocity by assuming it as a constant. The formula used is total impulse/propellant initial mass.
- Returns:
self.exhaust_velocity – Gas exhaust velocity of the motor.
- Return type:
- mass_flow_rate#
Time derivative of propellant mass. Assumes constant exhaust velocity. The formula used is the opposite of thrust divided by exhaust velocity.
- center_of_propellant_mass#
Estimates the propellant center of mass as fixed in the chamber position. For a more accurate evaluation, use the classes SolidMotor, LiquidMotor or HybridMotor.
- Returns:
Function representing the center of mass of the motor.
- Return type:
- 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:
Notes
The e_1 direction is assumed to be the direction perpendicular to the motor body axis.
- 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:
Notes
The e_2 direction is assumed to be the direction perpendicular to the motor body axis, and perpendicular to e_1.
- 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:
Notes
The e_3 direction is assumed to be the axial direction of the rocket motor.
- propellant_I_12#
- propellant_I_13#
- propellant_I_23#
- static load_from_eng_file(file_name, nozzle_radius=None, chamber_radius=None, chamber_height=None, chamber_position=0, propellant_initial_mass=None, dry_mass=None, burn_time=None, center_of_dry_mass_position=None, dry_inertia=(0, 0, 0), nozzle_position=0, reshape_thrust_curve=False, interpolation_method='linear', coordinate_system_orientation='nozzle_to_combustion_chamber')[source]#
Loads motor data from a .eng file and processes it.
- Parameters:
file_name (
string
) – Name of the .eng file. E.g. ‘test.eng’.nozzle_radius (
int
,float
) – Motor’s nozzle outlet radius in meters.chamber_radius (
int
,float
, optional) – The radius of a overall cylindrical chamber of propellant in meters.chamber_height (
int
,float
, optional) – The height of a overall cylindrical chamber of propellant in meters.chamber_position (
int
,float
, optional) – The position, in meters, of the centroid (half height) of the motor’s overall cylindrical chamber of propellant with respect to the motor’s coordinate system.propellant_initial_mass (
int
,float
, optional) – The initial mass of the propellant in the motor.dry_mass (
int
,float
, optional) – Same as in Motor class. See theMotor
docsburn_time (
float
,tuple
offloat
, 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.center_of_dry_mass_position (
int
,float
, optional) – 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. If not specified, automatically sourced as the chamber position.dry_inertia (
tuple
,list
) – Tuple or list containing the motor’s dry mass inertia tensornozzle_position (
int
,float
, optional) – Motor’s nozzle outlet position in meters, in the motor’s coordinate system. 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 givencoordinate_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:
Generic Motor object