Commits

James Goppert  committed b9b47b7

Working on nonlin model.

  • Participants
  • Parent commits fe168f8

Comments (0)

Files changed (13)

File data/figures/V_T.pdf

Binary file modified.

File data/figures/alpha_beta.pdf

Binary file modified.

File data/figures/elevons.pdf

Binary file modified.

File data/figures/euler_angles.pdf

Binary file modified.

File data/figures/fast_updates.pdf

Binary file modified.

File data/figures/position.pdf

Binary file modified.

File data/figures/propulsion.pdf

Binary file modified.

File data/figures/rotation_rate.pdf

Binary file modified.

File data/figures/slow_updates.pdf

Binary file modified.

File nonlinear_model/aircraft.py

         self.params = params
         self.f_dynamics = f_dynamics
 
-    def trim_steady_level(self, V_T, xd_guess=[0, 0, 0, 0]):
+    def trim_steady_level(self, V_T, xd_guess=[0, 0, 0, 0.5]):
 
         # initial guess
         u0 = np.zeros(Data.n_u)
                (-elvn_max, elvn_max),
                (0, 1))
         res = scipy.optimize.minimize(
-            cost, xd_guess, method='SLSQP',
+            cost, xd_guess, method='Nelder-Mead',
             bounds=bnds)
         print res
         xs = res.x

File nonlinear_model/camflyer.f90

           ! force equations
           F_b = matmul(C_bw, FA_w) + FT_b
           dv_b = F_b/m  + matmul(C_bn, g_n) - cross(omega_bn_b, v_b)
-          ! dx(1:3) = dv_b
-          dx(1) = R*V - Q*W - g_D*sin(theta)  + F_b(1)/m
-          dx(2) = -R*U + P*W + g_D*sin(phi)*cos(theta) + F_b(2)/m
-          dx(3) = Q*U - P*V + g_D*cos(phi)*cos(theta) + F_b(3)/m
+          dx(1:3) = dv_b
+          ! component version
+          ! dx(1) = R*V - Q*W - g_D*sin(theta)  + F_b(1)/m
+          ! dx(2) = -R*U + P*W + g_D*sin(phi)*cos(theta) + F_b(2)/m
+          ! dx(3) = Q*U - P*V + g_D*cos(phi)*cos(theta) + F_b(3)/m
 
           ! rotational kinematics equations
           call quaternion_derivative(q_bn, omega_bn_b, dq_bn)
 
           ! moment equations
           M_b = matmul(C_bw, MA_w) + MT_b
-          !dx(8:10) = matmul(inv_J_b, &
-          !      M_b - cross(omega_bn_b, matmul(J_b, omega_bn_b)))
-          dx(8) = (J_xz*(J_x - J_y + J_z)*P*Q &
-                       - (J_z*(J_z - J_y) + J_xz*J_xz)*Q*R &
-                       +  J_z*M_b(1) + J_xz*M_b(3))/gam
-          dx(9) = ((J_z - J_x)*P*R - J_xz*(P*P - R*R) + M_b(2))/gam
-          dx(10) = (((J_x - J_y)*J_x + J_x*J_x)*P*Q &
-                   - J_xz*(J_x - J_y + J_z)*Q*R + J_xz*M_b(1) &
-                   + J_x*M_b(3))/gam
+          dx(8:10) = matmul(inv_J_b, &
+                M_b - cross(omega_bn_b, matmul(J_b, omega_bn_b)))
+          ! component version
+          ! dx(8) = (J_xz*(J_x - J_y + J_z)*P*Q &
+          !              - (J_z*(J_z - J_y) + J_xz*J_xz)*Q*R &
+          !              +  J_z*M_b(1) + J_xz*M_b(3))/gam
+          ! dx(9) = ((J_z - J_x)*P*R - J_xz*(P*P - R*R) + M_b(2))/gam
+          ! dx(10) = (((J_x - J_y)*J_x + J_x*J_x)*P*Q &
+          !          - J_xz*(J_x - J_y + J_z)*Q*R + J_xz*M_b(1) &
+          !          + J_x*M_b(3))/gam
 
           ! navigation equations: dv_N, dv_E, dv_D
           v_n = matmul(C_nb, v_b)

File nonlinear_model/camflyer_fortran.so

Binary file modified.
 import nonlinear_model
 ac = nonlinear_model.Aircraft()
-x0, u0, dx = ac.trim_steady_level(12)
+x0, u0, dx = ac.trim_steady_level(10)
 
 print x0
 print u0