API Reference

Python Flight Mechanics Engine (PyFME). Copyright (c) AeroPython Development Team. Distributed under the terms of the MIT License.

Simulation class

Select the simulation configuration based on a system (and its dynamic model), environment and aircraft.

class pyfme.simulator.Simulation(aircraft, system, environment, controls, dt=0.01, save_vars=None)

Simulation class stores the simulation configuration, aircraft, system and environment. It provides methods for simulation running and results storing.

system

System – System object with mathematical model of the dynamic system and integrator (ie. EulerFlatEarth)

aircraft

Aircraft – Aircraft model, where aerodynamics and forces are calculated

environment

Environment – Environment containing the atmosphere, gravity and wind models.

controls

dict of callable – Dictionary containing the control names as keys and functions of time as values.

results

dict of lists – Dictionary containing the variables that have been set to be saved during the simulation.

propagate(time)

Run the simulation by integrating the system until time t.

Parameters:time (float) – Final time of the simulation

Notes

The propagation relies on the dense output of the integration method, so that the number and length of the time steps is automatically chosen.

pyfme.environment package

Python Flight Mechanics Engine (PyFME). Copyright (c) AeroPython Development Team. Distributed under the terms of the MIT License.

Environment

class pyfme.environment.environment.Environment(atmosphere, gravity, wind)

Stores all the environment info: atmosphere, gravity and wind.

Python Flight Mechanics Engine (PyFME). Copyright (c) AeroPython Development Team. Distributed under the terms of the MIT License.

Wind Models

pyfme.models package

pyfme.utils package

Python Flight Mechanics Engine (PyFME). Copyright (c) AeroPython Development Team. Distributed under the terms of the MIT License.

Frames of Reference orientation functions

pyfme.utils.coordinates.body2hor(body_coords, theta, phi, psi)

Transforms the vector coordinates in body frame of reference to local horizon frame of reference.

Parameters:
  • body_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in body axes.
  • theta (float) – Pitch (or elevation) angle (rad).
  • phi (float) – Bank angle (rad).
  • psi (float) – Yaw (or azimuth) angle (rad)
Returns:

hor_coords – 3 dimensional vector with (x,y,z) coordinates in local horizon axes.

Return type:

array_like

Raises:

ValueError – If the values of the euler angles are outside the proper ranges.

See also

hor2body function.

Notes

See [1] or [2] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to:

  • -pi/2 <= theta <= pi/2
  • -pi <= phi <= pi
  • 0 <= psi <= 2*pi

References

[1]B. Etkin, “Dynamics of Atmospheric Flight,” Courier Corporation, pp. 104-120, 2012.
[2]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012
pyfme.utils.coordinates.body2wind(body_coords, alpha, beta)

Transforms the vector coordinates in body frame of reference to wind frame of reference.

Parameters:
  • body_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in body axes.
  • alpha (float) – Angle of attack (rad).
  • beta (float) – Sideslip angle (rad).
Returns:

wind_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes.

Return type:

array_like

Raises:

ValueError – If the values of the wind-body angles are outside the proper ranges.

See also

wind2body function.

Notes

See [1] or [2] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to: * -pi/2 <= alpha <= pi/2 * -pi <= beta <= pi

References

[1]B. Etkin, “Dynamics of Atmospheric Flight,” Courier Corporation, pp. 104-120, 2012.
[2]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012
pyfme.utils.coordinates.check_alpha_beta_range(alpha, beta)

Check alpha, beta values are inside the defined range. This comprobation can also detect if the value of the angle is in degrees in some cases.

pyfme.utils.coordinates.check_gamma_mu_chi_range(gamma, mu, chi)

Check gamma, mu, chi values are inside the defined range. This comprobation can also detect if the value of the angle is in degrees in some cases.

pyfme.utils.coordinates.check_theta_phi_psi_range(theta, phi, psi)

Check theta, phi, psi values are inside the defined range. This comprobation can also detect if the value of the angle is in degrees in some cases.

pyfme.utils.coordinates.hor2body(hor_coords, theta, phi, psi)

Transforms the vector coordinates in local horizon frame of reference to body frame of reference.

Parameters:
  • hor_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in local horizon axes.
  • theta (float) – Pitch (or elevation) angle (rad).
  • phi (float) – Bank angle (rad).
  • psi (float) – Yaw (or azimuth) angle (rad)
Returns:

body_coords – 3 dimensional vector with (x,y,z) coordinates in body axes.

Return type:

array_like

Raises:

ValueError – If the values of the euler angles are outside the proper ranges.

See also

body2hor function.

Notes

See [1] or [2] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to:

  • -pi/2 <= theta <= pi/2
  • -pi <= phi <= pi
  • 0 <= psi <= 2*pi

References

[1]B. Etkin, “Dynamics of Atmospheric Flight,” Courier Corporation, pp. 104-120, 2012.
[2]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012
pyfme.utils.coordinates.hor2wind(hor_coords, gamma, mu, chi)

Transforms the vector coordinates in local horizon frame of reference to wind frame of reference.

Parameters:
  • hor_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in local horizon axes.
  • gamma (float) – Velocity pitch (or elevation) angle (rad).
  • mu (float) – Velocity bank angle (rad).
  • chi (float) – Velocity yaw (or azimuth) angle (rad)
Returns:

wind_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes.

Return type:

array_like

Raises:

ValueError – If the values of the wind-horizon angles are outside the proper ranges.

See also

wind2hor function.

Notes

See [1] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to: * -pi/2 <= gamma <= pi/2 * -pi <= mu <= pi * 0 <= chi <= 2*pi

References

[1]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012
pyfme.utils.coordinates.wind2body(wind_coords, alpha, beta)

Transforms the vector coordinates in wind frame of reference to body frame of reference.

Parameters:
  • wind_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in body axes.
  • alpha (float) – Angle of attack (rad).
  • beta (float) – Sideslip angle (rad).
Returns:

body_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes.

Return type:

array_like

Raises:

ValueError – If the values of the wind-body angles are outside the proper ranges.

See also

body2wind function.

Notes

See [1] or [2] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to: * -pi/2 <= alpha <= pi/2 * -pi <= beta <= pi

References

[1]B. Etkin, “Dynamics of Atmospheric Flight,” Courier Corporation, pp. 104-120, 2012.
[2]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012
pyfme.utils.coordinates.wind2hor(wind_coords, gamma, mu, chi)

Transforms the vector coordinates in wind frame of reference to local horizon frame of reference.

Parameters:
  • wind_coords (array_like) – 3 dimensional vector with (x,y,z) coordinates in wind axes.
  • gamma (float) – Velocity pitch (or elevation) angle (rad).
  • mu (float) – Velocity bank angle (rad).
  • chi (float) – Velocity yaw (or azimuth) angle (rad)
Returns:

hor_coords – 3 dimensional vector with (x,y,z) coordinates in local horizon axes.

Return type:

array_like

Raises:

ValueError – If the values of the wind-horizon angles are outside the proper ranges.

See also

hor2wind function.

Notes

See [1] for frame of reference definition. Note that in order to avoid ambiguities ranges in angles are limited to:

  • -pi/2 <= gamma <= pi/2
  • -pi <= mu <= pi
  • 0 <= chi <= 2*pi

References

[1]Gómez Tierno, M.A. et al, “Mecánica del Vuelo,” Garceta, pp. 1-12, 2012

Python Flight Mechanics Engine (PyFME). Copyright (c) AeroPython Development Team. Distributed under the terms of the MIT License.

Inputs generator

Provides some typical inputs signals such as: step, doublet, ramp, harmonic.