API Reference¶

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¶

Environment¶

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

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

pyfme.utils package¶

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) hor_coords – 3 dimensional vector with (x,y,z) coordinates in local horizon axes. array_like ValueError – If the values of the euler angles are outside the proper ranges.

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). wind_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes. array_like ValueError – If the values of the wind-body angles are outside the proper ranges.

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) body_coords – 3 dimensional vector with (x,y,z) coordinates in body axes. array_like ValueError – If the values of the euler angles are outside the proper ranges.

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) wind_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes. array_like ValueError – If the values of the wind-horizon angles are outside the proper ranges.

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). body_coords – 3 dimensional vector with (x,y,z) coordinates in wind axes. array_like ValueError – If the values of the wind-body angles are outside the proper ranges.

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) hor_coords – 3 dimensional vector with (x,y,z) coordinates in local horizon axes. array_like ValueError – If the values of the wind-horizon angles are outside the proper ranges.

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