]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/UIUCModel/uiuc_coefficients.cpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / FDM / UIUCModel / uiuc_coefficients.cpp
index 704e54c3116056b40f350b424f03d4c9391d057d..d56c2f40934f5d8bd544699932120132a62cd67a 100644 (file)
@@ -33,7 +33,7 @@
                            Added pilot_elev_no, pilot_ail_no, and
                            pilot_rud_no.
               07/05/2001   (RD) Added pilot_(elev,ail,rud)_no=false
-              01/11/2002   (AP) Added call to uiuc_bootTime()
+              01/11/2002   (AP) Added call to uiuc_iceboot()
                12/02/2002   (RD) Moved icing demo interpolations to its
                             own function
               
@@ -92,8 +92,7 @@
 
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA or view http://www.gnu.org/copyleft/gpl.html.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 **********************************************************************/
 
@@ -104,10 +103,6 @@ void uiuc_coefficients(double dt)
   static string uiuc_coefficients_error = " (from uiuc_coefficients.cpp) ";
   double l_trim, l_defl;
   double V_rel_wind_dum, U_body_dum;
-  static bool ap_pah_on_prev = false;
-  int ap_pah_init = 1;
-  static bool ap_alh_on_prev = false;
-  int ap_alh_init = 1;
 
   if (Alpha_init_true && Simtime==0)
     Std_Alpha = Alpha_init;
@@ -127,15 +122,15 @@ void uiuc_coefficients(double dt)
        {
          cbar_2U = cbar / (2.0 * V_rel_wind);
          b_2U    = bw /   (2.0 * V_rel_wind);
-         // ch is the horizontal tail chord
-         ch_2U   = ch /   (2.0 * V_rel_wind);
+         // chord_h is the horizontal tail chord
+         ch_2U   = chord_h /   (2.0 * V_rel_wind);
        }
       else if (use_dyn_on_speed_curve1)
        {
          V_rel_wind_dum = dyn_on_speed_zero + V_rel_wind * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
          cbar_2U        = cbar / (2.0 * V_rel_wind_dum);
          b_2U           = bw /   (2.0 * V_rel_wind_dum);
-         ch_2U          = ch /   (2.0 * V_rel_wind_dum);
+         ch_2U          = chord_h /   (2.0 * V_rel_wind_dum);
          Std_Alpha_dot      = 0.0;
        }
       else
@@ -152,14 +147,14 @@ void uiuc_coefficients(double dt)
        {
          cbar_2U = cbar / (2.0 * fabs(U_body));
          b_2U    = bw /   (2.0 * fabs(U_body));
-         ch_2U   = ch /   (2.0 * fabs(U_body));
+         ch_2U   = chord_h /   (2.0 * fabs(U_body));
        }
       else if (use_dyn_on_speed_curve1)
        {
          U_body_dum = dyn_on_speed_zero + fabs(U_body) * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
          cbar_2U    = cbar / (2.0 * U_body_dum);
          b_2U       = bw /   (2.0 * U_body_dum);
-         ch_2U      = ch /   (2.0 * U_body_dum);
+         ch_2U      = chord_h /   (2.0 * U_body_dum);
          Std_Alpha_dot  = 0.0;
        }
       else
@@ -176,14 +171,14 @@ void uiuc_coefficients(double dt)
        {
          cbar_2U = cbar / (2.0 * U_body);
          b_2U    = bw /   (2.0 * U_body);
-         ch_2U   = ch /   (2.0 * U_body);
+         ch_2U   = chord_h /   (2.0 * U_body);
        }
       else if (use_dyn_on_speed_curve1)
        {
          U_body_dum = dyn_on_speed_zero + U_body * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
          cbar_2U    = cbar / (2.0 * U_body_dum);
          b_2U       = bw /   (2.0 * U_body_dum);
-         ch_2U      = ch /   (2.0 * U_body_dum);
+         ch_2U      = chord_h /   (2.0 * U_body_dum);
          Std_Alpha_dot  = 0.0;
          beta_flow_clean_tail = cbar_2U;
        }
@@ -223,38 +218,15 @@ void uiuc_coefficients(double dt)
       uiuc_controlInput();
     }
 
-  if (ap_pah_on && icing_demo==false)
-    {
-      double V_rel_wind_ms;
-      V_rel_wind_ms = V_rel_wind * 0.3048;
-      ap_Theta_ref_rad = ap_Theta_ref_deg * DEG_TO_RAD;
-      if (ap_pah_on_prev == false)
-       ap_pah_init = 0;
-      elevator = pah_ap(Theta, Theta_dot, ap_Theta_ref_rad, V_rel_wind_ms, dt, 
-                       ap_pah_init);
-      if (elevator*RAD_TO_DEG <= -1*demax)
-       elevator = -1*demax * DEG_TO_RAD;
-      if (elevator*RAD_TO_DEG >= demin)
-       elevator = demin * DEG_TO_RAD;
-      pilot_elev_no=true;
-    }
+  //if (Simtime >=10.0)
+  //  {
+  //    ap_hh_on = 1;
+  //    ap_Psi_ref_rad = 0*DEG_TO_RAD;
+  //  }
 
-  if (ap_alh_on && icing_demo==false)
+  if (ap_pah_on || ap_alh_on || ap_rah_on || ap_hh_on)
     {
-      double V_rel_wind_ms;
-      double Altitude_m;
-      V_rel_wind_ms = V_rel_wind * 0.3048;
-      ap_alt_ref_m = ap_alt_ref_ft * 0.3048;
-      Altitude_m = Altitude * 0.3048;
-      if (ap_alh_on_prev == false)
-       ap_alh_init = 0;
-      elevator = alh_ap(Theta, Theta_dot, ap_alt_ref_m, Altitude_m, 
-                       V_rel_wind_ms, dt, ap_alh_init);
-      if (elevator*RAD_TO_DEG <= -1*demax)
-       elevator = -1*demax * DEG_TO_RAD;
-      if (elevator*RAD_TO_DEG >= demin)
-       elevator = demin * DEG_TO_RAD;
-      pilot_elev_no=true;
+      uiuc_auto_pilot(dt);
     }
 
   CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;