Flight Class#

class rocketpy.Flight[source]#

Keeps all flight information and has a method to simulate flight.

Variables:
  • Flight.env (Environment) – Environment object describing rail length, elevation, gravity and weather condition. See Environment class for more details.

  • Flight.rocket (Rocket) – Rocket class describing rocket. See Rocket class for more details.

  • Flight.parachutes (Parachute) – Direct link to parachutes of the Rocket. See Rocket class for more details.

  • Flight.frontal_surface_wind (float) – Surface wind speed in m/s aligned with the launch rail.

  • Flight.lateral_surface_wind (float) – Surface wind speed in m/s perpendicular to launch rail.

  • Flight.FlightPhases (class) – Helper class to organize and manage different flight phases.

  • Flight.TimeNodes (class) – Helper class to manage time discretization during simulation.

  • Flight.time_iterator (function) – Helper iterator function to generate time discretization points.

  • Flight.rail_length (float, int) – Launch rail length in meters.

  • Flight.effective_1rl (float) – Original rail length minus the distance measured from nozzle exit to the upper rail button. It assumes the nozzle to be aligned with the beginning of the rail.

  • Flight.effective_2rl (float) – Original rail length minus the distance measured from nozzle exit to the lower rail button. It assumes the nozzle to be aligned with the beginning of the rail.

  • Flight.name (str) – Name of the flight.

  • Flight._controllers (list) – List of controllers to be used during simulation.

  • Flight.max_time (int, float) – Maximum simulation time allowed. Refers to physical time being simulated, not time taken to run simulation.

  • Flight.max_time_step (int, float) – Maximum time step to use during numerical integration in seconds.

  • Flight.min_time_step (int, float) – Minimum time step to use during numerical integration in seconds.

  • Flight.rtol (int, float) – Maximum relative error tolerance to be tolerated in the numerical integration scheme.

  • Flight.atol (int, float) – Maximum absolute error tolerance to be tolerated in the integration scheme.

  • Flight.time_overshoot (bool, optional) – If True, decouples ODE time step from parachute and controller trigger functions sampling rate. The time steps can overshoot the necessary trigger function evaluation points and then interpolation is used to calculate them and feed the triggers. Can greatly improve run time in some cases.

  • Flight.terminate_on_apogee (bool) – Whether to terminate simulation when rocket reaches apogee.

  • Flight.solver (scipy.integrate.LSODA) – Scipy LSODA integration scheme.

  • Flight.x (Function) – Rocket’s X coordinate (positive east) as a function of time.

  • Flight.y (list) – Rocket’s Y coordinate (positive north) as a function of time.

  • Flight.z (Function) – Rocket’s z coordinate (positive up) as a function of time.

  • Flight.vx (Function) – Velocity of the rocket’s center of dry mass in the X (East) direction of the inertial frame as a function of time.

  • Flight.vy (Function) – Velocity of the rocket’s center of dry mass in the Y (North) direction of the inertial frame as a function of time.

  • Flight.vz (Function) – Velocity of the rocket’s center of dry mass in the Z (Up) direction of the inertial frame as a function of time.

  • Flight.e0 (Function) – Rocket’s Euler parameter 0 as a function of time.

  • Flight.e1 (Function) – Rocket’s Euler parameter 1 as a function of time.

  • Flight.e2 (Function) – Rocket’s Euler parameter 2 as a function of time.

  • Flight.e3 (Function) – Rocket’s Euler parameter 3 as a function of time.

  • Flight.w1 (Function) – Angular velocity of the rocket in the x direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as pitch rate (q).

  • Flight.w2 (Function) – Angular velocity of the rocket in the y direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as yaw rate (r).

  • Flight.w3 (Function) – Angular velocity of the rocket in the z direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as roll rate (p).

  • Flight.latitude (Function) – Rocket’s latitude coordinates (positive North) as a function of time. The Equator has a latitude equal to 0, by convention.

  • Flight.longitude (Function) – Rocket’s longitude coordinates (positive East) as a function of time. Greenwich meridian has a longitude equal to 0, by convention.

  • Flight.inclination (int, float) – Launch rail inclination angle relative to ground, given in degrees.

  • Flight.heading (int, float) – Launch heading angle relative to north given in degrees.

  • Flight.initial_solution (list) – List defines initial condition - [t_initial, x_init, y_init, z_init, vx_init, vy_init, vz_init, e0_init, e1_init, e2_init, e3_init, w1_init, w2_init, w3_init]

  • Flight.t_initial (int, float) – Initial simulation time in seconds. Usually 0.

  • Flight.solution (list) – Solution array which keeps results from each numerical integration.

  • Flight.t (float) – Current integration time.

  • Flight.y – Current integration state vector u.

  • Flight.out_of_rail_time (int, float) – Time, in seconds, in which the rocket completely leaves the rail.

  • Flight.out_of_rail_state (list) – State vector u corresponding to state when the rocket completely leaves the rail.

  • Flight.out_of_rail_velocity (int, float) – Velocity, in m/s, with which the rocket completely leaves the rail.

  • Flight.apogee_state (array) – State vector u corresponding to state when the rocket’s vertical velocity is zero in the apogee.

  • Flight.apogee_time (int, float) – Time, in seconds, in which the rocket’s vertical velocity reaches zero in the apogee.

  • Flight.apogee_x (int, float) – X coordinate (positive east) of the center of mass of the rocket when it reaches apogee.

  • Flight.apogee_y (int, float) – Y coordinate (positive north) of the center of mass of the rocket when it reaches apogee.

  • Flight.apogee (int, float) – Z coordinate, or altitude, of the center of mass of the rocket when it reaches apogee.

  • Flight.x_impact (int, float) – X coordinate (positive east) of the center of mass of the rocket when it impacts ground.

  • Flight.y_impact (int, float) – Y coordinate (positive east) of the center of mass of the rocket when it impacts ground.

  • Flight.impact_velocity (int, float) – Velocity magnitude of the center of mass of the rocket when it impacts ground.

  • Flight.impact_state (array) – State vector u corresponding to state when the rocket impacts the ground.

  • Flight.parachute_events (array) – List that stores parachute events triggered during flight.

  • Flight.function_evaluations (array) – List that stores number of derivative function evaluations during numerical integration in cumulative manner.

  • Flight.function_evaluations_per_time_step (list) – List that stores number of derivative function evaluations per time step during numerical integration.

  • Flight.time_steps (array) – List of time steps taking during numerical integration in seconds.

  • Flight.flight_phases (Flight.FlightPhases) – Stores and manages flight phases.

  • Flight.wind_velocity_x (Function) – Wind velocity X (East) experienced by the rocket as a function of time.

  • Flight.wind_velocity_y (Function) – Wind velocity Y (North) experienced by the rocket as a function of time.

  • Flight.density (Function) – Air density experienced by the rocket as a function of time.

  • Flight.pressure (Function) – Air pressure experienced by the rocket as a function of time.

  • Flight.dynamic_viscosity (Function) – Air dynamic viscosity experienced by the rocket as a function of time.

  • Flight.speed_of_sound (Function) – Speed of Sound in air experienced by the rocket as a function of time.

  • Flight.ax (Function) – Acceleration of the rocket’s center of dry mass along the X (East) axis in the inertial frame as a function of time.

  • Flight.ay (Function) – Acceleration of the rocket’s center of dry mass along the Y (North) axis in the inertial frame as a function of time.

  • Flight.az (Function) – Acceleration of the rocket’s center of dry mass along the Z (Up) axis in the inertial frame as a function of time.

  • Flight.alpha1 (Function) – Angular acceleration of the rocket in the x direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as yaw acceleration.

  • Flight.alpha2 (Function) – Angular acceleration of the rocket in the y direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as yaw acceleration.

  • Flight.alpha3 (Function) – Angular acceleration of the rocket in the z direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as roll acceleration.

  • Flight.speed (Function) – Rocket velocity magnitude in m/s relative to ground as a function of time.

  • Flight.max_speed (float) – Maximum velocity magnitude in m/s reached by the rocket relative to ground during flight.

  • Flight.max_speed_time (float) – Time in seconds at which rocket reaches maximum velocity magnitude relative to ground.

  • Flight.horizontal_speed (Function) – Rocket’s velocity magnitude in the horizontal (North-East) plane in m/s as a function of time.

  • Flight.acceleration (Function) – Rocket acceleration magnitude in m/s² relative to ground as a function of time.

  • Flight.max_acceleration (float) – Maximum acceleration magnitude in m/s² reached by the rocket relative to ground during flight.

  • Flight.max_acceleration_time (float) – Time in seconds at which rocket reaches maximum acceleration magnitude relative to ground.

  • Flight.path_angle (Function) – Rocket’s flight path angle, or the angle that the rocket’s velocity makes with the horizontal (North-East) plane. Measured in degrees and expressed as a function of time.

  • Flight.attitude_vector_x (Function) – Rocket’s attitude vector, or the vector that points in the rocket’s axis of symmetry, component in the X direction (East) as a function of time.

  • Flight.attitude_vector_y (Function) – Rocket’s attitude vector, or the vector that points in the rocket’s axis of symmetry, component in the Y direction (East) as a function of time.

  • Flight.attitude_vector_z (Function) – Rocket’s attitude vector, or the vector that points in the rocket’s axis of symmetry, component in the Z direction (East) as a function of time.

  • Flight.attitude_angle (Function) – Rocket’s attitude angle, or the angle that the rocket’s axis of symmetry makes with the horizontal (North-East) plane. Measured in degrees and expressed as a function of time.

  • Flight.lateral_attitude_angle (Function) – Rocket’s lateral attitude angle, or the angle that the rocket’s axis of symmetry makes with plane defined by the launch rail direction and the Z (up) axis. Measured in degrees and expressed as a function of time.

  • Flight.phi (Function) – Rocket’s Spin Euler Angle, φ, according to the 3-2-3 rotation system nomenclature (NASA Standard Aerospace). Measured in degrees and expressed as a function of time.

  • Flight.theta (Function) – Rocket’s Nutation Euler Angle, θ, according to the 3-2-3 rotation system nomenclature (NASA Standard Aerospace). Measured in degrees and expressed as a function of time.

  • Flight.psi (Function) – Rocket’s Precession Euler Angle, ψ, according to the 3-2-3 rotation system nomenclature (NASA Standard Aerospace). Measured in degrees and expressed as a function of time.

  • Flight.R1 (Function) – Aerodynamic force acting along the x-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.R2 (Function) – Aerodynamic force acting along the y-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.R3 (Function) – Aerodynamic force acting along the z-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.M1 (Function) – Aerodynamic moment acting along the x-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.M2 (Function) – Aerodynamic moment acting along the y-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.M3 (Function) – Aerodynamic moment acting along the z-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

  • Flight.net_thrust (Function) – Rocket’s engine net thrust as a function of time in Newton. This is the actual thrust force experienced by the rocket. It may be corrected with the atmospheric pressure if a reference pressure is defined.

  • Flight.aerodynamic_lift (Function) – Resultant force perpendicular to rockets axis due to aerodynamic effects as a function of time. Units in N. Expressed as a function of time. Can be called or accessed as array.

  • Flight.aerodynamic_drag (Function) – Resultant force aligned with the rockets axis due to aerodynamic effects as a function of time. Units in N. Expressed as a function of time. Can be called or accessed as array.

  • Flight.aerodynamic_bending_moment (Function) – Resultant moment perpendicular to rocket’s axis due to aerodynamic effects as a function of time. Units in N m. Expressed as a function of time. Can be called or accessed as array.

  • Flight.aerodynamic_spin_moment (Function) – Resultant moment aligned with the rockets axis due to aerodynamic effects as a function of time. Units in N m. Expressed as a function of time. Can be called or accessed as array.

  • Flight.rail_button1_normal_force (Function) – Upper rail button normal force in N as a function of time.

  • Flight.max_rail_button1_normal_force (float) – Maximum upper rail button normal force experienced during rail flight phase in N.

  • Flight.rail_button1_shear_force (Function) – Upper rail button shear force in N as a function of time.

  • Flight.max_rail_button1_shear_force (float) – Maximum upper rail button shear force experienced during rail flight phase in N.

  • Flight.rail_button2_normal_force (Function) – Lower rail button normal force in N as a function of time.

  • Flight.max_rail_button2_normal_force (float) – Maximum lower rail button normal force experienced during rail flight phase in N.

  • Flight.rail_button2_shear_force (Function) – Lower rail button shear force in N as a function of time.

  • Flight.max_rail_button2_shear_force (float) – Maximum lower rail button shear force experienced during rail flight phase in N.

  • Flight.rotational_energy (Function) – Rocket’s rotational kinetic energy as a function of time. Units in J.

  • Flight.translational_energy (Function) – Rocket’s translational kinetic energy as a function of time. Units in J.

  • Flight.kinetic_energy (Function) – Rocket’s total kinetic energy as a function of time. Units in J.

  • Flight.potential_energy (Function) – Rocket’s gravitational potential energy as a function of time. Units in J.

  • Flight.total_energy (Function) – Rocket’s total mechanical energy as a function of time. Units in J.

  • Flight.thrust_power (Function) – Rocket’s engine thrust power output as a function of time in Watts.

  • Flight.drag_power (Function) – Aerodynamic drag power output as a function of time in Watts.

  • Flight.attitude_frequency_response (Function) – Fourier Frequency Analysis of the rocket’s attitude angle. Expressed as the absolute value of the magnitude as a function of frequency in Hz.

  • Flight.omega1_frequency_response (Function) – Fourier Frequency Analysis of the rocket’s angular velocity omega 1. Expressed as the absolute value of the magnitude as a function of frequency in Hz.

  • Flight.omega2_frequency_response (Function) – Fourier Frequency Analysis of the rocket’s angular velocity omega 2. Expressed as the absolute value of the magnitude as a function of frequency in Hz.

  • Flight.omega3_frequency_response (Function) – Fourier Frequency Analysis of the rocket’s angular velocity omega 3. Expressed as the absolute value of the magnitude as a function of frequency in Hz.

  • Flight.static_margin (Function) – Rocket’s static margin during flight in calibers.

  • Flight.stability_margin (Function) – Rocket’s stability margin during flight, in calibers.

  • Flight.initial_stability_margin (float) – Rocket’s initial stability margin in calibers.

  • Flight.out_of_rail_stability_margin (float) – Rocket’s stability margin in calibers when it leaves the rail.

  • Flight.stream_velocity_x (Function) – Freestream velocity x (East) component, in m/s, as a function of time.

  • Flight.stream_velocity_y (Function) – Freestream velocity y (North) component, in m/s, as a function of time.

  • Flight.stream_velocity_z (Function) – Freestream velocity z (up) component, in m/s, as a function of time.

  • Flight.free_stream_speed (Function) – Freestream velocity magnitude, in m/s, as a function of time.

  • Flight.apogee_freestream_speed (float) – Freestream speed of the rocket at apogee in m/s.

  • Flight.mach_number (Function) – Rocket’s Mach number defined as its freestream speed divided by the speed of sound at its altitude. Expressed as a function of time.

  • Flight.max_mach_number (float) – Rocket’s maximum Mach number experienced during flight.

  • Flight.max_mach_number_time (float) – Time at which the rocket experiences the maximum Mach number.

  • Flight.reynolds_number (Function) – Rocket’s Reynolds number, using its diameter as reference length and free_stream_speed as reference velocity. Expressed as a function of time.

  • Flight.max_reynolds_number (float) – Rocket’s maximum Reynolds number experienced during flight.

  • Flight.max_reynolds_number_time (float) – Time at which the rocket experiences the maximum Reynolds number.

  • Flight.dynamic_pressure (Function) – Dynamic pressure experienced by the rocket in Pa as a function of time, defined by 0.5*rho*V^2, where rho is air density and V is the freestream speed.

  • Flight.max_dynamic_pressure (float) – Maximum dynamic pressure, in Pa, experienced by the rocket.

  • Flight.max_dynamic_pressure_time (float) – Time at which the rocket experiences maximum dynamic pressure.

  • Flight.total_pressure (Function) – Total pressure experienced by the rocket in Pa as a function of time.

  • Flight.max_total_pressure (float) – Maximum total pressure, in Pa, experienced by the rocket.

  • Flight.max_total_pressure_time (float) – Time at which the rocket experiences maximum total pressure.

  • Flight.angle_of_attack (Function) – Rocket’s angle of attack in degrees as a function of time. Defined as the minimum angle between the attitude vector and the freestream velocity vector. Can be called or accessed as array.

  • Flight.simulation_mode (str) – Simulation mode for the flight. Can be “6 DOF” or “3 DOF”.

  • Flight.rail_button1_bending_moment (Function) – Internal bending moment at upper rail button attachment point in N·m as a function of time. Calculated using beam theory during rail phase.

  • Flight.max_rail_button1_bending_moment (float) – Maximum internal bending moment experienced at upper rail button attachment point during rail flight phase in N·m.

  • Flight.rail_button2_bending_moment (Function) – Internal bending moment at lower rail button attachment point in N·m as a function of time. Calculated using beam theory during rail phase.

  • Flight.max_rail_button2_bending_moment (float) – Maximum internal bending moment experienced at lower rail button attachment point during rail flight phase in N·m.

__init__(rocket, environment, rail_length, inclination=80.0, heading=90.0, initial_solution=None, terminate_on_apogee=False, max_time=600, max_time_step=inf, min_time_step=0, rtol=1e-06, atol=None, time_overshoot=True, verbose=False, name='Flight', equations_of_motion='standard', ode_solver='LSODA', simulation_mode='6 DOF')[source]#

Run a trajectory simulation.

Parameters:
  • rocket (Rocket) – Rocket to simulate.

  • environment (Environment) – Environment to run simulation on.

  • rail_length (int, float) – Length in which the rocket will be attached to the rail, only moving along a fixed direction, that is, the line parallel to the rail. Currently, if the an initial_solution is passed, the rail length is not used.

  • inclination (int, float, optional) – Rail inclination angle relative to ground, given in degrees. Default is 80.

  • heading (int, float, optional) – Heading angle relative to north given in degrees. Default is 90, which points in the x (east) direction.

  • initial_solution (array, Flight, optional) –

    Initial solution array to be used. Format is:

    initial_solution = [
        self.t_initial,
        x_init, y_init, z_init,
        vx_init, vy_init, vz_init,
        e0_init, e1_init, e2_init, e3_init,
        w1_init, w2_init, w3_init
    ]
    

    If a Flight object is used, the last state vector will be used as initial solution. If None, the initial solution will start with all null values, except for the euler parameters which will be calculated based on given values of inclination and heading. Default is None.

  • terminate_on_apogee (boolean, optional) – Whether to terminate simulation when rocket reaches apogee. Default is False.

  • max_time (int, float, optional) – Maximum time in which to simulate trajectory in seconds. Using this without setting a max_time_step may cause unexpected errors. Default is 600.

  • max_time_step (int, float, optional) – Maximum time step to use during integration in seconds. Default is 0.01.

  • min_time_step (int, float, optional) – Minimum time step to use during integration in seconds. Default is 0.01.

  • rtol (float, array, optional) – Maximum relative error tolerance to be tolerated in the integration scheme. Can be given as array for each state space variable. Default is 1e-6.

  • atol (float, optional) – Maximum absolute error tolerance to be tolerated in the integration scheme. Can be given as array for each state space variable. Default is 6*[1e-3] + 4*[1e-6] + 3*[1e-3].

  • time_overshoot (bool, optional) – If True, decouples ODE time step from parachute and controller trigger functions sampling rate. The time steps can overshoot the necessary trigger function evaluation points and then interpolation is used to calculate them and feed the triggers. Can greatly improve run time in some cases. Default is True.

  • verbose (bool, optional) – If true, verbose mode is activated. Default is False.

  • name (str, optional) – Name of the flight. Default is “Flight”.

  • equations_of_motion (str, optional) – Type of equations of motion to use. Can be “standard” or “solid_propulsion”. Default is “standard”. Solid propulsion is a more restricted set of equations of motion that only works for solid propulsion rockets. Such equations were used in RocketPy v0 and are kept here for backwards compatibility.

  • ode_solver (str, scipy.integrate.OdeSolver, optional) – Integration method to use to solve the equations of motion ODE. Available options are: ‘RK23’, ‘RK45’, ‘DOP853’, ‘Radau’, ‘BDF’, ‘LSODA’ from scipy.integrate.solve_ivp. Default is ‘LSODA’, which is recommended for most flights. A custom scipy.integrate.OdeSolver can be passed as well. For more information on the integration methods, see the scipy documentation [1].

Return type:

None

property effective_1rl#

Original rail length minus the distance measured from nozzle exit to the upper rail button. It assumes the nozzle to be aligned with the beginning of the rail.

property effective_2rl#

Original rail length minus the distance measured from nozzle exit to the lower rail button. It assumes the nozzle to be aligned with the beginning of the rail.

property frontal_surface_wind#

Frontal wind velocity at the surface level. The frontal wind is defined as the wind blowing in the direction of the rocket’s heading.

Returns:

Wind velocity in the frontal direction at the surface level.

Return type:

float

property lateral_surface_wind#

Lateral wind velocity at the surface level. The lateral wind is defined as the wind blowing perpendicular to the rocket’s heading.

Returns:

Wind velocity in the lateral direction at the surface level.

Return type:

float

udot_rail1(t, u, post_processing=False)[source]#

Calculates derivative of u state vector with respect to time when rocket is flying in 1 DOF motion in the rail.

Parameters:
  • t (float) – Time in seconds

  • u (list) – State vector defined by u = [x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data information directly to self variables such as self.angle_of_attack. Default is False.

Returns:

u_dot – State vector defined by u_dot = [vx, vy, vz, ax, ay, az, e0dot, e1dot, e2dot, e3dot, alpha1, alpha2, alpha3].

Return type:

list

udot_rail2(t, u, post_processing=False)[source]#

[Still not implemented] Calculates derivative of u state vector with respect to time when rocket is flying in 3 DOF motion in the rail.

Parameters:
  • t (float) – Time in seconds

  • u (list) – State vector defined by u = [x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data information directly to self variables such as self.angle_of_attack, by default False

Returns:

u_dot – State vector defined by u_dot = [vx, vy, vz, ax, ay, az, e0dot, e1dot, e2dot, e3dot, alpha1, alpha2, alpha3].

Return type:

list

u_dot(t, u, post_processing=False)[source]#

Calculates derivative of u state vector with respect to time when rocket is flying in 6 DOF motion during ascent out of rail and descent without parachute.

Parameters:
  • t (float) – Time in seconds

  • u (list) – State vector defined by u = [x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data information directly to self variables such as self.angle_of_attack, by default False

Returns:

u_dot – State vector defined by u_dot = [vx, vy, vz, ax, ay, az, e0dot, e1dot, e2dot, e3dot, alpha1, alpha2, alpha3].

Return type:

list

u_dot_generalized_3dof(t, u, post_processing=False)[source]#

Calculates derivative of u state vector with respect to time when the rocket is flying in 3 DOF motion in space and significant mass variation effects exist. Includes a weathercocking model that evolves the body axis direction toward the relative wind direction.

Parameters:
  • t (float) – Time in seconds.

  • u (list) – State vector: [x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data to self variables like self.angle_of_attack.

Returns:

Derivative state vector: [vx, vy, vz, ax, ay, az, e0_dot, e1_dot, e2_dot, e3_dot, alpha1, alpha2, alpha3].

Return type:

list

u_dot_generalized(t, u, post_processing=False)[source]#

Calculates derivative of u state vector with respect to time when the rocket is flying in 6 DOF motion in space and significant mass variation effects exist. Typical flight phases include powered ascent after launch rail.

Parameters:
  • t (float) – Time in seconds

  • u (list) – State vector defined by u = [x, y, z, vx, vy, vz, q0, q1, q2, q3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data information directly to self variables such as self.angle_of_attack, by default False.

Returns:

u_dot – State vector defined by u_dot = [vx, vy, vz, ax, ay, az, e0_dot, e1_dot, e2_dot, e3_dot, alpha1, alpha2, alpha3].

Return type:

list

u_dot_parachute(t, u, post_processing=False)[source]#

Calculates derivative of u state vector with respect to time when rocket is flying under parachute. A 3 DOF approximation is used.

Parameters:
  • t (float) – Time in seconds

  • u (list) – State vector defined by u = [x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

  • post_processing (bool, optional) – If True, adds flight data information directly to self variables such as self.angle_of_attack. Default is False.

Returns:

u_dot – State vector defined by u_dot = [vx, vy, vz, ax, ay, az, e0dot, e1dot, e2dot, e3dot, alpha1, alpha2, alpha3].

Return type:

list

property solution_array#

Returns solution array of the rocket flight.

property function_evaluations_per_time_step#

Get the number of function evaluations per time step. This method calculates the difference between consecutive function evaluations during numerical integration and returns it as a list.

Returns:

The list of differences in function evaluations per time step.

Return type:

list

property time#

Returns time array from solution.

property time_steps#

Returns time step array.

get_solution_at_time(t, atol=0.001)[source]#

Returns the solution state vector at a given time. If the time is not found in the solution, the closest time is used and a warning is raised.

Parameters:
  • t (float) – Time in seconds.

  • atol (float, optional) – Absolute tolerance for time comparison. Default is 1e-3. If the difference between the time and the closest time in the solution is greater than this value, a warning is raised.

Returns:

solution – Solution state at time t. The array follows the format of the solution array, with the first column being time like this: [t, x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3].

Return type:

np.array

x#

Rocket x position relative to the launch pad as a Function of time.

y#

Rocket y position relative to the launch pad as a Function of time.

z#

Rocket z position relative to the launch pad as a Function of time.

altitude#

Rocket altitude above ground level as a Function of time. Ground level is defined by the environment elevation.

vx#

Velocity of the rocket’s center of dry mass in the X (East) direction of the inertial frame as a function of time.

vy#

Velocity of the rocket’s center of dry mass in the Y (North) direction of the inertial frame as a function of time.

vz#

Velocity of the rocket’s center of dry mass in the Z (Up) direction of the inertial frame as a function of time.

e0#

Rocket quaternion e0 as a Function of time.

e1#

Rocket quaternion e1 as a Function of time.

e2#

Rocket quaternion e2 as a Function of time.

e3#

Rocket quaternion e3 as a Function of time.

w1#

Angular velocity of the rocket in the x direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as pitch rate (q).

w2#

Angular velocity of the rocket in the y direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as yaw rate (r).

w3#

Angular velocity of the rocket in the z direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as roll rate (p).

ax#

Acceleration of the rocket’s center of dry mass along the X (East) axis in the inertial frame as a function of time.

ay#

Acceleration of the rocket’s center of dry mass along the Y (North) axis in the inertial frame as a function of time.

az#

Acceleration of the rocket’s center of dry mass along the Z (Up) axis in the inertial frame as a function of time.

alpha1#

Angular acceleration of the rocket in the x direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as pitch acceleration.

alpha2#

Angular acceleration of the rocket in the y direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as yaw acceleration.

alpha3#

Angular acceleration of the rocket in the z direction of the rocket’s body frame as a function of time, in rad/s. Sometimes referred to as roll acceleration.

R1#

Aerodynamic force acting along the x-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

R2#

Aerodynamic force acting along the y-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

R3#

Aerodynamic force acting along the z-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

M1#

Aerodynamic moment acting along the x-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

M2#

Aerodynamic moment acting along the y-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

M3#

Aerodynamic moment acting along the z-axis of the rocket’s body frame as a function of time. Expressed in Newtons (N).

net_thrust#

Net thrust of the rocket as a Function of time. This is the actual thrust force experienced by the rocket. It may be corrected with the atmospheric pressure if a reference pressure is defined.

pressure#

Air pressure felt by the rocket as a Function of time.

density#

Air density felt by the rocket as a Function of time.

dynamic_viscosity#

Air dynamic viscosity felt by the rocket as a Function of time.

speed_of_sound#

Speed of sound in the air felt by the rocket as a Function of time.

wind_velocity_x#

Wind velocity in the X direction (east) as a Function of time.

wind_velocity_y#

Wind velocity in the Y direction (north) as a Function of time.

vx_body_frame#

Velocity of the rocket’s center of dry mass along the x axis of the body frame as a function of time.

vy_body_frame#

Velocity of the rocket’s center of dry mass along the y axis of the body frame as a function of time.

vz_body_frame#

Velocity of the rocket’s center of dry mass along the z axis of the body frame as a function of time.

ax_body_frame#

Acceleration of the rocket’s center of dry mass along the x axis of the body frame as a function of time.

ay_body_frame#

Acceleration of the rocket’s center of dry mass along the y axis of the body frame as a function of time.

az_body_frame#

Acceleration of the rocket’s center of dry mass along the z axis of the body frame as a function of time.

speed#

Rocket speed, or velocity magnitude, as a Function of time.

property out_of_rail_velocity#

Velocity at which the rocket leaves the launch rail.

property max_speed_time#

Time at which the rocket reaches its maximum speed.

property max_speed#

Maximum speed reached by the rocket.

acceleration#

Rocket acceleration magnitude as a Function of time.

axial_acceleration#

Axial acceleration magnitude as a Function of time.

property max_acceleration_power_on_time#

Time at which the rocket reaches its maximum acceleration during motor burn.

property max_acceleration_power_on#

Maximum acceleration reached by the rocket during motor burn.

property max_acceleration_power_off_time#

Time at which the rocket reaches its maximum acceleration after motor burn.

property max_acceleration_power_off#

Maximum acceleration reached by the rocket after motor burn.

property max_acceleration_time#

Time at which the rocket reaches its maximum acceleration.

property max_acceleration#

Maximum acceleration reached by the rocket.

horizontal_speed#

Rocket horizontal speed as a Function of time.

path_angle#

Rocket path angle as a Function of time.

attitude_vector_x#

Rocket attitude vector X component as a Function of time. Same as row 1, column 3 of the rotation matrix that defines the conversion from the body frame to the inertial frame at each time step.

attitude_vector_y#

Rocket attitude vector Y component as a Function of time. Same as row 2, column 3 of the rotation matrix that defines the conversion from the body frame to the inertial frame at each time step.

attitude_vector_z#

Rocket attitude vector Z component as a Function of time. Same as row 3, column 3 of the rotation matrix that defines the conversion from the body frame to the inertial frame at each time step.

attitude_angle#

Rocket attitude angle as a Function of time.

lateral_attitude_angle#

Rocket lateral attitude angle as a Function of time.

psi#

Precession angle as a Function of time.

phi#

Spin angle as a Function of time.

theta#

Nutation angle as a Function of time.

stream_velocity_x#

Freestream velocity X component as a Function of time.

stream_velocity_y#

Freestream velocity Y component as a Function of time.

stream_velocity_z#

Freestream velocity Z component as a Function of time.

free_stream_speed#

Freestream speed as a Function of time.

property apogee_freestream_speed#

Freestream speed at apogee in m/s.

mach_number#

Mach number as a Function of time.

property max_mach_number_time#

Time of maximum Mach number.

property max_mach_number#

Maximum Mach number.

property max_stability_margin_time#

Time of maximum stability margin.

property max_stability_margin#

Maximum stability margin.

property min_stability_margin_time#

Time of minimum stability margin.

property min_stability_margin#

Minimum stability margin.

property initial_stability_margin#

Stability margin at time 0.

Return type:

float

property out_of_rail_stability_margin#

Stability margin at the time the rocket leaves the rail.

Return type:

float

reynolds_number#

Reynolds number as a Function of time.

property max_reynolds_number_time#

Time of maximum Reynolds number.

property max_reynolds_number#

Maximum Reynolds number.

dynamic_pressure#

Dynamic pressure as a Function of time.

property max_dynamic_pressure_time#

Time of maximum dynamic pressure.

property max_dynamic_pressure#

Maximum dynamic pressure.

total_pressure#

Total pressure as a Function of time.

property max_total_pressure_time#

Time of maximum total pressure.

property max_total_pressure#

Maximum total pressure.

aerodynamic_lift#

Aerodynamic lift force as a Function of time.

aerodynamic_drag#

Aerodynamic drag force as a Function of time.

aerodynamic_bending_moment#

Aerodynamic bending moment as a Function of time.

aerodynamic_spin_moment#

Aerodynamic spin moment as a Function of time.

rotational_energy#

Rotational kinetic energy as a Function of time.

translational_energy#

Translational kinetic energy as a Function of time.

kinetic_energy#

Total kinetic energy as a Function of time.

potential_energy#

Potential energy as a Function of time in relation to sea level.

total_energy#

Total mechanical energy as a Function of time.

thrust_power#

Thrust power as a Function of time.

drag_power#

Drag power as a Function of time.

property direction_cosine_matrixes#

Direction cosine matrix representing the attitude of the body frame, relative to the inertial frame, at each time step.

property stream_velocity_body_frame#

Stream velocity array at the center of dry mass in the body frame at each time step.

angle_of_attack#

Angle of attack of the rocket with respect to the freestream velocity vector. Sometimes called total angle of attack. Defined as the angle between the freestream velocity vector and the rocket’s z-axis. All in the Body Axes Coordinate System.

partial_angle_of_attack#

Partial angle of attack of the rocket with respect to the stream velocity vector. By partial angle of attack, it is meant the angle between the stream velocity vector in the y-z plane and the rocket’s z-axis. All in the Body Axes Coordinate System.

angle_of_sideslip#

Angle of sideslip of the rocket with respect to the stream velocity vector. Defined as the angle between the stream velocity vector in the x-z plane and the rocket’s z-axis. All in the Body Axes Coordinate System.

omega1_frequency_response#

Angular velocity 1 frequency response as a Function of frequency, as the rocket leaves the launch rail for 5 seconds of flight.

omega2_frequency_response#

Angular velocity 2 frequency response as a Function of frequency, as the rocket leaves the launch rail for 5 seconds of flight.

omega3_frequency_response#

Angular velocity 3 frequency response as a Function of frequency, as the rocket leaves the launch rail for 5 seconds of flight.

attitude_frequency_response#

Attitude frequency response as a Function of frequency, as the rocket leaves the launch rail for 5 seconds of flight.

property static_margin#

Static margin of the rocket.

stability_margin#

Stability margin of the rocket along the flight, it considers the variation of the center of pressure position according to the mach number, as well as the variation of the center of gravity position according to the propellant mass evolution.

Parameters:

None

Returns:

stability – Stability margin as a rocketpy.Function of time. The stability margin is defined as the distance between the center of pressure and the center of gravity, divided by the rocket diameter.

Return type:

rocketpy.Function

rail_button1_normal_force#

Upper rail button normal force as a Function of time. If there’s no rail button defined, the function returns a null Function.

rail_button1_shear_force#

Upper rail button shear force as a Function of time. If there’s no rail button defined, the function returns a null Function.

rail_button2_normal_force#

Lower rail button normal force as a Function of time. If there’s no rail button defined, the function returns a null Function.

rail_button2_shear_force#

Lower rail button shear force as a Function of time. If there’s no rail button defined, the function returns a null Function.

property max_rail_button1_normal_force#

Maximum upper rail button normal force, in Newtons.

property max_rail_button1_shear_force#

Maximum upper rail button shear force, in Newtons.

property max_rail_button2_normal_force#

Maximum lower rail button normal force, in Newtons.

property max_rail_button2_shear_force#

Maximum lower rail button shear force, in Newtons.

property calculate_rail_button_bending_moments#

Calculate internal bending moments at rail button attachment points.

Uses beam theory to determine the internal structural moments for stress analysis of the rail button attachments (fasteners and airframe).

The bending moment at each button attachment consists of:

  1. Normal force moment: $M = N times d$, where $N$ is the normal reaction force and $d$ is the distance from button to center of dry mass.

  2. Shear force cantilever moment: $M = S times h$, where $S$ is the shear (tangential) force and $h$ is the button standoff height.

Returns:

rail_button1_bending_momentFunction

Bending moment at upper rail button as a function of time (N·m).

max_rail_button1_bending_momentfloat

Maximum upper rail button bending moment (N·m).

rail_button2_bending_momentFunction

Bending moment at lower rail button as a function of time (N·m).

max_rail_button2_bending_momentfloat

Maximum lower rail button bending moment (N·m).

Return type:

tuple

Notes

  • Calculated only during the rail phase of flight

  • Maximum values use absolute values for worst-case stress analysis

  • The bending moments represent internal stresses in the rocket airframe at the rail button attachment points

Assumptions:

  • Rail buttons act as simple supports: provide reaction forces (normal and shear) but no moment reaction at the rail contact point

  • The rocket acts as a beam supported at two points (rail buttons)

  • Bending moments arise from the lever arm effect of reaction forces and the cantilever moment from button standoff height

property rail_button1_bending_moment#

Upper rail button bending moment as a Function of time.

property max_rail_button1_bending_moment#

Maximum upper rail button bending moment, in N·m.

property rail_button2_bending_moment#

Lower rail button bending moment as a Function of time.

property max_rail_button2_bending_moment#

Maximum lower rail button bending moment, in N·m.

drift#

Rocket horizontal distance to the launch point, in meters, as a Function of time.

bearing#

Rocket bearing compass, in degrees, as a Function of time.

latitude#

Rocket latitude coordinate, in degrees, as a Function of time.

longitude#

Rocket longitude coordinate, in degrees, as a Function of time.

get_controller_observed_variables()[source]#

Retrieve the observed variables related to air brakes from the controllers. If there is only one set of observed variables, it is returned as a list. If there are multiple sets, the list containing all sets is returned.

calculate_stall_wind_velocity(stall_angle)[source]#

Function to calculate the maximum wind velocity before the angle of attack exceeds a desired angle, at the instant of departing rail launch. Can be helpful if you know the exact stall angle of all aerodynamics surfaces.

Parameters:

stall_angle (float) – Angle, in degrees, for which you would like to know the maximum wind speed before the angle of attack exceeds it

Return type:

None

export_pressures(file_name, time_step)[source]#

Deprecated since version 1.11: Use rocketpy.simulation.flight_data_exporter.FlightDataExporter and call .export_pressures(...).

export_data(file_name, *variables, time_step=None)[source]#

Deprecated since version 1.11: Use rocketpy.simulation.flight_data_exporter.FlightDataExporter and call .export_data(...).

export_sensor_data(file_name, sensor=None)[source]#

Deprecated since version 1.11: Use rocketpy.simulation.flight_data_exporter.FlightDataExporter and call .export_sensor_data(...).

export_kml(file_name='trajectory.kml', time_step=None, extrude=True, color='641400F0', altitude_mode='absolute')[source]#

Deprecated since version 1.11: Use rocketpy.simulation.flight_data_exporter.FlightDataExporter and call .export_kml(...).

info()[source]#

Prints out a summary of the data available about the Flight.

all_info()[source]#

Prints out all data and graphs available about the Flight.

class FlightPhases[source]#

Class to handle flight phases. It is used to store the derivatives and callbacks for each flight phase. It is also used to handle the insertion of flight phases in the correct order, according to their initial time.

Variables:

list (list) – A list of FlightPhase objects. See FlightPhase subclass.

__init__(init_list=None)[source]#
display_warning(*messages)[source]#

A simple function to print a warning message.

add(flight_phase, index=None)[source]#

Add a flight phase to the list. It will be inserted in the correct position, according to its initial time. If no index is provided, it will be appended to the end of the list. If by any reason the flight phase cannot be inserted in the correct position, a warning will be displayed and the flight phase will be inserted in the closest position possible.

Parameters:
  • flight_phase (FlightPhase) – The flight phase object to be added. See FlightPhase class.

  • index (int, optional) – The index of the flight phase to be added. If no index is provided, the flight phase will be appended to the end of the list. Default is None.

Return type:

None

add_phase(t, derivatives=None, callback=None, clear=True, index=None)[source]#

Add a new flight phase to the list, with the specified characteristics. This method creates a new FlightPhase instance and adds it to the flight phases list, either at the specified index position or appended to the end. See FlightPhases.add() for more information.

Parameters:
  • t (float) – The initial time of the new flight phase.

  • derivatives (function, optional) – A function representing the derivatives of the flight phase. Default is None.

  • callback (list of functions, optional) – A list of callback functions to be executed during the flight phase. Default is None. You can also pass an empty list.

  • clear (bool, optional) – A flag indicating whether to clear the solution after the phase. Default is True.

  • index (int, optional) – The index at which the new flight phase should be inserted. If not provided, the flight phase will be appended to the end of the list. Default is None.

Return type:

None

flush_after(index)[source]#

This function deletes all flight phases after a given index.

Parameters:

index (int) – The index of the last flight phase to be kept.

Return type:

None

class FlightPhase[source]#

Class to store a flight phase. It stores the initial time, the derivative function, the callback functions and a flag to clear the solution after the phase.

Variables:
  • t (float) – The initial time of the flight phase.

  • derivative (function) – A function representing the derivatives of the flight phase.

  • callbacks (list of functions) – A list of callback functions to be executed during the flight phase.

  • clear (bool) – A flag indicating whether to clear the solution after the phase.

__init__(t, derivative=None, callbacks=None, clear=True)[source]#
class TimeNodes[source]#

TimeNodes is a class that stores all the time nodes of a simulation. It is meant to work like a python list, but it has some additional methods that are useful for the simulation. Them items stored in are TimeNodes object are instances of the TimeNode class.

__init__(init_list=None)[source]#
merge()[source]#

Merge all the time nodes that have the same time. This is made to avoid multiple evaluations of the same time node. This method does not guarantee the order of the nodes in the list, so it is recommended to sort the list before or after using this method.

class TimeNode[source]#

TimeNode is a class that represents a time node in the time nodes list. It stores the time, the parachutes and the controllers that are active at that time. This class is supposed to work exclusively within the TimeNodes class.

__init__(t, parachutes, controllers, sensors)[source]#

Create a TimeNode object.

Parameters:
  • t (float) – Initial time of the time node.

  • parachutes (list[Parachute]) – List containing all the parachutes that should be evaluated at this time node.

  • controllers (list[_Controller]) – List containing all the controllers that should be evaluated at this time node.

  • sensors (list[ComponentSensor]) – List containing all the sensors that should be evaluated at this time node.

__lt__(other)[source]#

Allows the comparison of two TimeNode objects based on their initial time. This is particularly useful for sorting a list of TimeNode objects.

Parameters:

other (TimeNode) – Another TimeNode object to compare with.

Returns:

True if the initial time of the current TimeNode is less than the initial time of the other TimeNode, False otherwise.

Return type:

bool