Modal Analysis¶
You can also perform eigenvalue analysis of the aircraft to characterize its dynamic stability.
Instead of calling execute_run
, call execute_eigen_mode_calc
.
To run this type of analysis the aircraft should be in trim, so here we determine the CL necessary for lift = weight.
You must also set a velocity before the analysis with ovl.set_parameter("velocity", <velocity>)
You can retrieve the eigenvalues and vectors after the analysis with get_eigenvalues
and get_eigenvectors
.
from optvl import OVLSolver
import numpy as np
import matplotlib.pyplot as plt
ovl = OVLSolver(geo_file="aircraft.avl", mass_file="aircraft.mass", debug=False)
vel = 10
ovl.set_parameter("velocity", vel)
dens = ovl.get_parameter("density")
g = ovl.get_parameter("grav.acc.")
mass = ovl.get_parameter("mass")
weight = mass * g
cl = weight / (0.5 * dens * vel**2)
ovl.set_trim_condition("CL", cl)
ovl.set_constraint("Elevator", 0.00, con_var="Cm pitch moment")
ovl.execute_eigen_mode_calc()
vals_ovl = ovl.get_eigenvalues()
# plot the eigenvalues
plt.plot(np.real(vals_ovl),np.imag(vals_ovl), 'o')
plt.xlabel('real')
plt.ylabel('imag')
plt.title('Eigenvalues')
plt.grid('on')
plt.show()
# ----------------------------------------------------
The eigenvalues should look like this