aerosandbox.dynamics#

Subpackages#

Package Contents#

Classes#

DynamicsPointMass1DHorizontal

Dynamics instance:

DynamicsPointMass1DVertical

Dynamics instance:

DynamicsPointMass2DCartesian

Dynamics instance:

DynamicsPointMass2DSpeedGamma

Dynamics instance:

DynamicsPointMass3DCartesian

Dynamics instance:

DynamicsPointMass3DSpeedGammaTrack

Dynamics instance:

DynamicsRigidBody2DBody

Dynamics instance:

DynamicsRigidBody3DBodyEuler

Dynamics instance:

class aerosandbox.dynamics.DynamicsPointMass1DHorizontal(mass_props=None, x_e=0, u_e=0)[source]#

Bases: aerosandbox.dynamics.point_mass.point_3D.cartesian.DynamicsPointMass3DCartesian

Dynamics instance: * simulating a point mass * in 1D, oriented horizontally (i.e., the .add_gravity() method will have no effect)

State variables:

x_e: x-position, in Earth axes. [meters] u_e: x-velocity, in Earth axes. [m/s]

Control variables:

Fx_e: Force along the Earth-x axis. [N]

Parameters:
property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

class aerosandbox.dynamics.DynamicsPointMass1DVertical(mass_props=None, z_e=0, w_e=0)[source]#

Bases: aerosandbox.dynamics.point_mass.point_3D.cartesian.DynamicsPointMass3DCartesian

Dynamics instance: * simulating a point mass * in 1D, oriented vertically (i.e., the .add_gravity() method will have an effect)

State variables:

z_e: z-position, in Earth axes. [meters] w_e: z-velocity, in Earth axes. [m/s]

Control variables:

Fz_e: Force along the Earth-x axis. [N]

Parameters:
property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

class aerosandbox.dynamics.DynamicsPointMass2DCartesian(mass_props=None, x_e=0, z_e=0, u_e=0, w_e=0, alpha=0)[source]#

Bases: aerosandbox.dynamics.point_mass.point_3D.cartesian.DynamicsPointMass3DCartesian

Dynamics instance: * simulating a point mass * in 2D * with velocity parameterized in Cartesian coordinates

State variables:

x_e: x-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] u_e: x-velocity, in Earth axes. [m/s] w_e: z-velocity, in Earth axes. [m/s]

Indirect control variables:

alpha: Angle of attack. [degrees]

Control variables:

Fx_e: Force along the Earth-x axis. [N] Fz_e: Force along the Earth-z axis. [N]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • u_e (Union[float, aerosandbox.numpy.ndarray]) –

  • w_e (Union[float, aerosandbox.numpy.ndarray]) –

  • alpha (Union[float, aerosandbox.numpy.ndarray]) –

property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

class aerosandbox.dynamics.DynamicsPointMass2DSpeedGamma(mass_props=None, x_e=0, z_e=0, speed=0, gamma=0, alpha=0)[source]#

Bases: aerosandbox.dynamics.point_mass.point_3D.speed_gamma_track.DynamicsPointMass3DSpeedGammaTrack

Dynamics instance: * simulating a point mass * in 2D * with velocity parameterized in speed-gamma space.

State variables:

x_e: x-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] speed: Speed; equivalent to u_w, the x-velocity in wind axes. [m/s] gamma: Flight path angle. [rad]

Indirect control variables:

alpha: Angle of attack. [degrees]

Control variables:

Fx_w: Force along the wind-x axis. [N] Fz_w: Force along the wind-z axis. [N]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • speed (Union[float, aerosandbox.numpy.ndarray]) –

  • gamma (Union[float, aerosandbox.numpy.ndarray]) –

  • alpha (Union[float, aerosandbox.numpy.ndarray]) –

property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

class aerosandbox.dynamics.DynamicsPointMass3DCartesian(mass_props=None, x_e=0, y_e=0, z_e=0, u_e=0, v_e=0, w_e=0, alpha=0, beta=0, bank=0)[source]#

Bases: aerosandbox.dynamics.point_mass.common_point_mass._DynamicsPointMassBaseClass

Dynamics instance: * simulating a point mass * in 3D * with velocity parameterized in Cartesian coordinates

State variables:

x_e: x-position, in Earth axes. [meters] y_e: y-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] u_e: x-velocity, in Earth axes. [m/s] v_e: v-velocity, in Earth axes. [m/s] w_e: z-velocity, in Earth axes. [m/s]

Indirect control variables:

alpha: Angle of attack. [degrees] beta: Sideslip angle. [degrees] bank: Bank angle. [radians]

Control variables:

Fx_e: Force along the Earth-x axis. [N] Fy_e: Force along the Earth-y axis. [N] Fz_e: Force along the Earth-z axis. [N]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • y_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • u_e (Union[float, aerosandbox.numpy.ndarray]) –

  • v_e (Union[float, aerosandbox.numpy.ndarray]) –

  • w_e (Union[float, aerosandbox.numpy.ndarray]) –

  • alpha (Union[float, aerosandbox.numpy.ndarray]) –

  • beta (Union[float, aerosandbox.numpy.ndarray]) –

  • bank (Union[float, aerosandbox.numpy.ndarray]) –

property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property speed: float#
Return type:

float

property gamma#

Returns the flight path angle, in radians.

Positive flight path angle indicates positive vertical speed.

property track#

Returns the track angle, in radians.

  • Track of 0 == North == aligned with x_e axis

  • Track of np.pi / 2 == East == aligned with y_e axis

state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

convert_axes(x_from, y_from, z_from, from_axes, to_axes)[source]#

Converts a vector [x_from, y_from, z_from], as given in the from_axes frame, to an equivalent vector [x_to, y_to, z_to], as given in the to_axes frame.

Identical to OperatingPoint.convert_axes(), but adds in “earth” as a valid axis frame. For more documentation, see the docstring of OperatingPoint.convert_axes().

Both from_axes and to_axes should be a string, one of:
  • “geometry”

  • “body”

  • “wind”

  • “stability”

  • “earth”

Parameters:
  • x_from (float) – x-component of the vector, in from_axes frame.

  • y_from (float) – y-component of the vector, in from_axes frame.

  • z_from (float) – z-component of the vector, in from_axes frame.

  • from_axes (str) – The axes to convert from. See above for options.

  • to_axes (str) – The axes to convert to. See above for options.

Return type:

Tuple[float, float, float]

Returns: The x-, y-, and z-components of the vector, in to_axes frame. Given as a tuple.

add_force(Fx=0, Fy=0, Fz=0, axes='earth')[source]#

Adds a force (in whichever axis system you choose) to this Dynamics instance.

Parameters:
  • Fx (Union[float, aerosandbox.numpy.ndarray]) – Force in the x-direction in the axis system chosen. [N]

  • Fy (Union[float, aerosandbox.numpy.ndarray]) – Force in the y-direction in the axis system chosen. [N]

  • Fz (Union[float, aerosandbox.numpy.ndarray]) – Force in the z-direction in the axis system chosen. [N]

  • axes – The axis system that the specified force is in. One of: * “geometry” * “body” * “wind” * “stability” * “earth”

Return type:

None

Returns: None (in-place)

class aerosandbox.dynamics.DynamicsPointMass3DSpeedGammaTrack(mass_props=None, x_e=0, y_e=0, z_e=0, speed=0, gamma=0, track=0, alpha=0, beta=0, bank=0)[source]#

Bases: aerosandbox.dynamics.point_mass.common_point_mass._DynamicsPointMassBaseClass

Dynamics instance: * simulating a point mass * in 3D * with velocity parameterized in speed-gamma-track space

State variables:

x_e: x-position, in Earth axes. [meters] y_e: y-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] speed: Speed; equivalent to u_w, the x-velocity in wind axes. [m/s] gamma: Flight path angle. [radians] track: Track angle. [radians]

  • Track of 0 == North == aligned with x_e axis

  • Track of np.pi / 2 == East == aligned with y_e axis

Indirect control variables:

alpha: Angle of attack. [degrees] beta: Sideslip angle. [degrees] bank: Bank angle. [radians]

Control variables:

Fx_w: Force along the wind-x axis. [N] Fy_w: Force along the wind-y axis. [N] Fz_w: Force along the wind-z axis. [N]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • y_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • speed (Union[float, aerosandbox.numpy.ndarray]) –

  • gamma (Union[float, aerosandbox.numpy.ndarray]) –

  • track (Union[float, aerosandbox.numpy.ndarray]) –

  • alpha (Union[float, aerosandbox.numpy.ndarray]) –

  • beta (Union[float, aerosandbox.numpy.ndarray]) –

  • bank (Union[float, aerosandbox.numpy.ndarray]) –

property state: Dict[str, float | aerosandbox.numpy.ndarray]#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property control_variables: Dict[str, float | aerosandbox.numpy.ndarray]#
Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

property u_e#
property v_e#
property w_e#
state_derivatives()[source]#

A function that returns the derivatives with respect to time of the state specified in the state property.

Should return a Dict with the same keys as the state property.

Return type:

Dict[str, Union[float, aerosandbox.numpy.ndarray]]

convert_axes(x_from, y_from, z_from, from_axes, to_axes)[source]#

Converts a vector [x_from, y_from, z_from], as given in the from_axes frame, to an equivalent vector [x_to, y_to, z_to], as given in the to_axes frame.

Identical to OperatingPoint.convert_axes(), but adds in “earth” as a valid axis frame. For more documentation, see the docstring of OperatingPoint.convert_axes().

Both from_axes and to_axes should be a string, one of:
  • “geometry”

  • “body”

  • “wind”

  • “stability”

  • “earth”

Parameters:
  • x_from (float) – x-component of the vector, in from_axes frame.

  • y_from (float) – y-component of the vector, in from_axes frame.

  • z_from (float) – z-component of the vector, in from_axes frame.

  • from_axes (str) – The axes to convert from. See above for options.

  • to_axes (str) – The axes to convert to. See above for options.

Return type:

Tuple[float, float, float]

Returns: The x-, y-, and z-components of the vector, in to_axes frame. Given as a tuple.

add_force(Fx=0, Fy=0, Fz=0, axes='wind')[source]#

Adds a force (in whichever axis system you choose) to this Dynamics instance.

Parameters:
  • Fx (Union[float, aerosandbox.numpy.ndarray]) – Force in the x-direction in the axis system chosen. [N]

  • Fy (Union[float, aerosandbox.numpy.ndarray]) – Force in the y-direction in the axis system chosen. [N]

  • Fz (Union[float, aerosandbox.numpy.ndarray]) – Force in the z-direction in the axis system chosen. [N]

  • axes – The axis system that the specified force is in. One of: * “geometry” * “body” * “wind” * “stability” * “earth”

Return type:

None

Returns: None (in-place)

class aerosandbox.dynamics.DynamicsRigidBody2DBody(mass_props=None, x_e=0, z_e=0, u_b=0, w_b=0, theta=0, q=0)[source]#

Bases: aerosandbox.dynamics.rigid_body.rigid_3D.body_euler.DynamicsRigidBody3DBodyEuler

Dynamics instance: * simulating a rigid body * in 2D * with velocity parameterized in body axes

State variables:

x_e: x-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] u_b: x-velocity, in body axes. [m/s] w_b: z-velocity, in body axes. [m/s] theta: pitch angle. [rad] q: y-angular-velocity, in body axes. [rad/sec]

Control variables:

Fx_b: Force along the body-x axis. [N] Fz_b: Force along the body-z axis. [N] My_b: Moment about the body-y axis. [Nm]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • u_b (Union[float, aerosandbox.numpy.ndarray]) –

  • w_b (Union[float, aerosandbox.numpy.ndarray]) –

  • theta (Union[float, aerosandbox.numpy.ndarray]) –

  • q (Union[float, aerosandbox.numpy.ndarray]) –

property state#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
property control_variables#
state_derivatives()[source]#

Computes the state derivatives (i.e. equations of motion) for a body in 3D space.

Based on Section 9.8.2 of Flight Vehicle Aerodynamics by Mark Drela.

Returns:

{

“xe” : d_xe, “ye” : d_ye, “ze” : d_ze, “u” : d_u, “v” : d_v, “w” : d_w, “phi” : d_phi, “theta”: d_theta, “psi” : d_psi, “p” : d_p, “q” : d_q, “r” : d_r,

}

Return type:

Time derivatives of each of the 12 state variables, given in a dictionary

class aerosandbox.dynamics.DynamicsRigidBody3DBodyEuler(mass_props=None, x_e=0, y_e=0, z_e=0, u_b=0, v_b=0, w_b=0, phi=0, theta=0, psi=0, p=0, q=0, r=0)[source]#

Bases: aerosandbox.dynamics.rigid_body.common_rigid_body._DynamicsRigidBodyBaseClass

Dynamics instance: * simulating a rigid body * in 3D * with velocity parameterized in body axes * and angle parameterized in Euler angles

State variables:

x_e: x-position, in Earth axes. [meters] y_e: y-position, in Earth axes. [meters] z_e: z-position, in Earth axes. [meters] u_b: x-velocity, in body axes. [m/s] v_b: y-velocity, in body axes. [m/s] w_b: z-velocity, in body axes. [m/s] phi: roll angle. Uses yaw-pitch-roll Euler angle convention. [rad] theta: pitch angle. Uses yaw-pitch-roll Euler angle convention. [rad] psi: yaw angle. Uses yaw-pitch-roll Euler angle convention. [rad] p: x-angular-velocity, in body axes. [rad/sec] q: y-angular-velocity, in body axes. [rad/sec] r: z-angular-velocity, in body axes. [rad/sec]

Control variables:

Fx_b: Force along the body-x axis. [N] Fy_b: Force along the body-y axis. [N] Fz_b: Force along the body-z axis. [N] Mx_b: Moment about the body-x axis. [Nm] My_b: Moment about the body-y axis. [Nm] Mz_b: Moment about the body-z axis. [Nm] hx_b: Angular momentum (e.g., propellers) about the body-x axis. [kg*m^2/sec] hy_b: Angular momentum (e.g., propellers) about the body-y axis. [kg*m^2/sec] hz_b: Angular momentum (e.g., propellers) about the body-z axis. [kg*m^2/sec]

Parameters:
  • mass_props (aerosandbox.weights.mass_properties.MassProperties) –

  • x_e (Union[float, aerosandbox.numpy.ndarray]) –

  • y_e (Union[float, aerosandbox.numpy.ndarray]) –

  • z_e (Union[float, aerosandbox.numpy.ndarray]) –

  • u_b (Union[float, aerosandbox.numpy.ndarray]) –

  • v_b (Union[float, aerosandbox.numpy.ndarray]) –

  • w_b (Union[float, aerosandbox.numpy.ndarray]) –

  • phi (Union[float, aerosandbox.numpy.ndarray]) –

  • theta (Union[float, aerosandbox.numpy.ndarray]) –

  • psi (Union[float, aerosandbox.numpy.ndarray]) –

  • p (Union[float, aerosandbox.numpy.ndarray]) –

  • q (Union[float, aerosandbox.numpy.ndarray]) –

  • r (Union[float, aerosandbox.numpy.ndarray]) –

property state#

Returns the state variables of this Dynamics instance as a Dict.

Keys are strings that give the name of the variables. Values are the variables themselves.

This method should look something like:
>>> {
>>>     "x_e": self.x_e,
>>>     "u_e": self.u_e,
>>>     ...
>>> }
property control_variables#
property speed#

The speed of the object, expressed as a scalar.

property alpha#

The angle of attack, in degrees.

property beta#

The sideslip angle, in degrees.

state_derivatives()[source]#

Computes the state derivatives (i.e. equations of motion) for a body in 3D space.

Based on Section 9.8.2 of Flight Vehicle Aerodynamics by Mark Drela.

Returns:

{

“xe” : d_xe, “ye” : d_ye, “ze” : d_ze, “u” : d_u, “v” : d_v, “w” : d_w, “phi” : d_phi, “theta”: d_theta, “psi” : d_psi, “p” : d_p, “q” : d_q, “r” : d_r,

}

Return type:

Time derivatives of each of the 12 state variables, given in a dictionary

convert_axes(x_from, y_from, z_from, from_axes, to_axes)[source]#

Converts a vector [x_from, y_from, z_from], as given in the from_axes frame, to an equivalent vector [x_to, y_to, z_to], as given in the to_axes frame.

Identical to OperatingPoint.convert_axes(), but adds in “earth” as a valid axis frame. For more documentation, see the docstring of OperatingPoint.convert_axes().

Both from_axes and to_axes should be a string, one of:
  • “geometry”

  • “body”

  • “wind”

  • “stability”

  • “earth”

Parameters:
  • x_from – x-component of the vector, in from_axes frame.

  • y_from – y-component of the vector, in from_axes frame.

  • z_from – z-component of the vector, in from_axes frame.

  • from_axes (str) – The axes to convert from.

  • to_axes (str) – The axes to convert to.

Returns: The x-, y-, and z-components of the vector, in to_axes frame. Given as a tuple.

add_force(Fx=0, Fy=0, Fz=0, axes='body')[source]#

Adds a force (in whichever axis system you choose) to this Dynamics instance.

Parameters:
  • Fx (Union[float, aerosandbox.numpy.ndarray]) – Force in the x-direction in the axis system chosen. [N]

  • Fy (Union[float, aerosandbox.numpy.ndarray]) – Force in the y-direction in the axis system chosen. [N]

  • Fz (Union[float, aerosandbox.numpy.ndarray]) – Force in the z-direction in the axis system chosen. [N]

  • axes – The axis system that the specified force is in. One of: * “geometry” * “body” * “wind” * “stability” * “earth”

Returns: None (in-place)

add_moment(Mx=0, My=0, Mz=0, axes='body')[source]#

Adds a moment (in whichever axis system you choose) to this Dynamics instance.

Parameters:
  • Mx (Union[float, aerosandbox.numpy.ndarray]) – Moment about the x-axis in the axis system chosen. Assumed these moments are applied about the center of mass. [Nm]

  • My (Union[float, aerosandbox.numpy.ndarray]) – Moment about the y-axis in the axis system chosen. Assumed these moments are applied about the center of mass. [Nm]

  • Mz (Union[float, aerosandbox.numpy.ndarray]) – Moment about the z-axis in the axis system chosen. Assumed these moments are applied about the center of mass. [Nm]

  • axes – The axis system that the specified moment is in. One of: * “geometry” * “body” * “wind” * “stability” * “earth”

Returns: None (in-place)