]> git.mxchange.org Git - flightgear.git/commitdiff
Robert Deters:
authorcurt <curt>
Thu, 9 May 2002 05:02:36 +0000 (05:02 +0000)
committercurt <curt>
Thu, 9 May 2002 05:02:36 +0000 (05:02 +0000)
> I have attached some new additions to the UIUC code.  Most of the
> changes allow for the addition of apparent mass.  This is very
> useful with light aircraft and gliders.

src/FDM/UIUCModel/uiuc_aircraft.h
src/FDM/UIUCModel/uiuc_coefficients.cpp
src/FDM/UIUCModel/uiuc_map_init.cpp
src/FDM/UIUCModel/uiuc_map_mass.cpp
src/FDM/UIUCModel/uiuc_menu.cpp
src/FDM/UIUCModel/uiuc_wrapper.cpp

index a0d4e1d888295db96131237e60e815e6ce5a3cd6..8e43f5bca866862a431bfdd862c6a754ea557c3f 100644 (file)
@@ -65,6 +65,9 @@
                            uiuc_3Dinterp_quick() function.  Takes
                            advantage of data in a "nice" form (data
                            that are in a rectangular matrix).
+              04/21/2002   (MSS) Added new variables for apparent mass effects
+                            and options for computing *_2U coefficient
+                            scale factors.
 
 ----------------------------------------------------------------------
 
@@ -155,7 +158,10 @@ enum {Dx_pilot_flag = 2000, Dy_pilot_flag, Dz_pilot_flag,
       P_body_flag, Q_body_flag, R_body_flag, 
       Phi_flag, Theta_flag, Psi_flag,
       Long_trim_flag, recordRate_flag, recordStartTime_flag, 
-      nondim_rate_V_rel_wind_flag, dyn_on_speed_flag, Alpha_flag, 
+      use_V_rel_wind_2U_flag, nondim_rate_V_rel_wind_flag, 
+      use_abs_U_body_2U_flag,
+      dyn_on_speed_flag, dyn_on_speed_zero_flag, 
+      use_dyn_on_speed_curve1_flag, Alpha_flag, 
       Beta_flag, U_body_flag, V_body_flag, W_body_flag};
 
 // geometry === Aircraft-specific geometric quantities
@@ -173,7 +179,12 @@ enum {de_flag = 4000, da_flag, dr_flag,
 enum {nomix_flag = 5000};
 
 //mass ======== Aircraft-specific mass properties
-enum {Weight_flag = 6000, Mass_flag, I_xx_flag, I_yy_flag, I_zz_flag, I_xz_flag};
+enum {Weight_flag = 6000, 
+      Mass_flag, I_xx_flag, I_yy_flag, I_zz_flag, I_xz_flag,
+      Mass_appMass_ratio_flag, I_xx_appMass_ratio_flag, 
+      I_yy_appMass_ratio_flag, I_zz_appMass_ratio_flag, 
+      Mass_appMass_flag,       I_xx_appMass_flag,      
+      I_yy_appMass_flag,       I_zz_appMass_flag};
 
 // engine ===== Propulsion data
 enum {simpleSingle_flag = 7000, c172_flag, cherokee_flag, 
@@ -239,7 +250,13 @@ enum {iceTime_flag = 15000, transientTime_flag, eta_ice_final_flag,
 // record ===== Record desired quantites to file
 enum {Simtime_record = 16000, dt_record, 
 
+      cbar_2U_record, b_2U_record, ch_2U_record,
+
       Weight_record, Mass_record, I_xx_record, I_yy_record, I_zz_record, I_xz_record, 
+      Mass_appMass_ratio_record, I_xx_appMass_ratio_record, 
+      I_yy_appMass_ratio_record, I_zz_appMass_ratio_record, 
+      Mass_appMass_record,       I_xx_appMass_record,      
+      I_yy_appMass_record,       I_zz_appMass_record,
 
       Dx_pilot_record, Dy_pilot_record, Dz_pilot_record, 
       Dx_cg_record, Dy_cg_record, Dz_cg_record,
@@ -438,16 +455,24 @@ struct AIRCRAFT
   /* init ========== Initial values for equations of motion =======*/
 
   map <string,int> init_map;
-#define      init_map            aircraft_->init_map          
+#define      init_map          aircraft_->init_map          
 
   int recordRate;
 #define recordRate             aircraft_->recordRate
   double recordStartTime;
 #define recordStartTime        aircraft_->recordStartTime
+  bool use_V_rel_wind_2U;
+#define use_V_rel_wind_2U      aircraft_->use_V_rel_wind_2U
   bool nondim_rate_V_rel_wind;
 #define nondim_rate_V_rel_wind aircraft_->nondim_rate_V_rel_wind
+  bool use_abs_U_body_2U;
+#define use_abs_U_body_2U      aircraft_->use_abs_U_body_2U
   double dyn_on_speed;
 #define dyn_on_speed           aircraft_->dyn_on_speed
+  double dyn_on_speed_zero;
+#define dyn_on_speed_zero      aircraft_->dyn_on_speed_zero
+  bool use_dyn_on_speed_curve1;
+#define use_dyn_on_speed_curve1 aircraft_->use_dyn_on_speed_curve1
   bool P_body_init_true;
   double P_body_init;
 #define P_body_init_true       aircraft_->P_body_init_true
@@ -638,6 +663,22 @@ struct AIRCRAFT
   double Weight;
 #define Weight  aircraft_->Weight
 
+  double Mass_appMass_ratio;
+#define Mass_appMass_ratio aircraft_->Mass_appMass_ratio
+  double I_xx_appMass_ratio;
+#define I_xx_appMass_ratio aircraft_->I_xx_appMass_ratio
+  double I_yy_appMass_ratio;
+#define I_yy_appMass_ratio aircraft_->I_yy_appMass_ratio
+  double I_zz_appMass_ratio;
+#define I_zz_appMass_ratio aircraft_->I_zz_appMass_ratio
+  double Mass_appMass;
+#define Mass_appMass aircraft_->Mass_appMass
+  double I_xx_appMass;
+#define I_xx_appMass aircraft_->I_xx_appMass
+  double I_yy_appMass;
+#define I_yy_appMass aircraft_->I_yy_appMass
+  double I_zz_appMass;
+#define I_zz_appMass aircraft_->I_zz_appMass
 
   /* Variables (token2) ===========================================*/
   /* engine ======== Propulsion data ==============================*/
index 7aa06ab3b2b1b03ffc6417e207dc59034a71d503..c47de419949846e1f835f773735ddce9bc1aae99 100644 (file)
 void uiuc_coefficients()
 {
   double l_trim, l_defl;
+  double V_rel_wind_dum, U_body_dum;
 
   if (Alpha_init_true && Simtime==0)
     Alpha = Alpha_init;
@@ -109,34 +110,71 @@ void uiuc_coefficients()
 
   // calculate rate derivative nondimensionalization factors
   // check if speed is sufficient to compute dynamic pressure terms
-  if (nondim_rate_V_rel_wind)         // c172_aero uses V_rel_wind
+  if (nondim_rate_V_rel_wind || use_V_rel_wind_2U)         // c172_aero uses V_rel_wind
     {
       if (V_rel_wind > dyn_on_speed)
        {
          cbar_2U = cbar / (2.0 * V_rel_wind);
-         b_2U = bw / (2.0 * V_rel_wind);
-         ch_2U = ch / (2.0 * V_rel_wind);
+         b_2U    = bw /   (2.0 * V_rel_wind);
+         ch_2U   = ch /   (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);
+       }
       else
        {
          cbar_2U = 0.0;
-         b_2U = 0.0;
-         ch_2U = 0.0;
+         b_2U    = 0.0;
+         ch_2U   = 0.0;
        }
     }
-  else      // use U_body which is probably more correct
+  else if(use_abs_U_body_2U)      // use absolute(U_body)
+    {
+      if (fabs(U_body) > dyn_on_speed)
+       {
+         cbar_2U = cbar / (2.0 * fabs(U_body));
+         b_2U    = bw /   (2.0 * fabs(U_body));
+         ch_2U   = ch /   (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);
+       }
+      else
+       {
+         cbar_2U = 0.0;
+         b_2U    = 0.0;
+         ch_2U   = 0.0;
+       }
+    }
+  else      // use U_body
     {
       if (U_body > dyn_on_speed)
        {
          cbar_2U = cbar / (2.0 * U_body);
-         b_2U = bw / (2.0 * U_body);
-         ch_2U = ch / (2.0 * U_body);
+         b_2U    = bw /   (2.0 * U_body);
+         ch_2U   = ch /   (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);
+         beta_flow_clean_tail = cbar_2U;
        }
       else
        {
          cbar_2U = 0.0;
-         b_2U = 0.0;
-         ch_2U = 0.0;
+         b_2U    = 0.0;
+         ch_2U   = 0.0;
        }
     }
 
index 8f2a8f9d0bbcbb858efe9a940c5dcd3f8e7aded2..f85ff7fb9cb921824e016a736b196b3463d05fd2 100644 (file)
@@ -90,8 +90,12 @@ void uiuc_map_init()
   init_map["Long_trim"]           =      Long_trim_flag             ;
   init_map["recordRate"]          =      recordRate_flag            ;
   init_map["recordStartTime"]     =      recordStartTime_flag       ;
+  init_map["use_V_rel_wind_2U"]   =      use_V_rel_wind_2U_flag     ;
   init_map["nondim_rate_V_rel_wind"]=    nondim_rate_V_rel_wind_flag;
+  init_map["use_abs_U_body_2U"]   =      use_abs_U_body_2U_flag     ;
   init_map["dyn_on_speed"]        =      dyn_on_speed_flag          ;
+  init_map["dyn_on_speed_zero"]   =      dyn_on_speed_zero_flag     ;
+  init_map["use_dyn_on_speed_curve1"] =  use_dyn_on_speed_curve1_flag;
   init_map["Alpha"]               =      Alpha_flag                 ;
   init_map["Beta"]                =      Beta_flag                  ;
   init_map["U_body"]              =      U_body_flag                ;
index 5aa25c578a985d707cbad7c3a09786ab8ba62400..0e9ba70256005eef2618102c623be4e8c937fc6d 100644 (file)
@@ -74,6 +74,14 @@ void uiuc_map_mass()
   mass_map["I_yy"]                =      I_yy_flag                  ;
   mass_map["I_zz"]                =      I_zz_flag                  ;
   mass_map["I_xz"]                =      I_xz_flag                  ;
+  mass_map["Mass_appMass_ratio"]  =      Mass_appMass_ratio_flag    ;
+  mass_map["I_xx_appMass_ratio"]  =      I_xx_appMass_ratio_flag    ;
+  mass_map["I_yy_appMass_ratio"]  =      I_yy_appMass_ratio_flag    ;
+  mass_map["I_zz_appMass_ratio"]  =      I_zz_appMass_ratio_flag    ;
+  mass_map["Mass_appMass"]        =      Mass_appMass_flag          ;
+  mass_map["I_xx_appMass"]        =      I_xx_appMass_flag          ;
+  mass_map["I_yy_appMass"]        =      I_yy_appMass_flag          ;
+  mass_map["I_zz_appMass"]        =      I_zz_appMass_flag          ;
 }
 
 // end uiuc_map_mass.cpp
index 932a7b15695aada6f19c3cbc517412c21f23308b..a9d32ab549b8515a51d92132b0f86611546eba55 100644 (file)
@@ -263,7 +263,8 @@ void uiuc_menu( string aircraft_name )
 
 /* set speed at which dynamic pressure terms will be accounted for,
    since if velocity is too small, coefficients will go to infinity */
-  dyn_on_speed = 33;    /* 20 kts, default */
+  dyn_on_speed      = 33;    /* 20 kts, default */
+  dyn_on_speed_zero = 0.5 * dyn_on_speed;    /* only used of use_dyn_on_speed_curve1 is used */
 
 
 
@@ -533,11 +534,21 @@ void uiuc_menu( string aircraft_name )
                   recordStartTime = token_value;
                   break;
                 }
+              case use_V_rel_wind_2U_flag:
+                {
+                  use_V_rel_wind_2U = true;
+                  break;
+                }
               case nondim_rate_V_rel_wind_flag:
                 {
                   nondim_rate_V_rel_wind = true;
                   break;
                 }
+              case use_abs_U_body_2U_flag:
+                {
+                  use_abs_U_body_2U = true;
+                  break;
+                }
               case dyn_on_speed_flag:
                 {
                   if (check_float(linetoken3))
@@ -548,6 +559,21 @@ void uiuc_menu( string aircraft_name )
                   dyn_on_speed = token_value;
                   break;
                 }
+              case dyn_on_speed_zero_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  dyn_on_speed_zero = token_value;
+                  break;
+                }
+              case use_dyn_on_speed_curve1_flag:
+                {
+                  use_dyn_on_speed_curve1 = true;
+                  break;
+                }
              case Alpha_flag:
                {
                  if (check_float(linetoken3))
@@ -1032,6 +1058,94 @@ void uiuc_menu( string aircraft_name )
                   massParts -> storeCommands (*command_line);
                   break;
                 }
+              case Mass_appMass_ratio_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  Mass_appMass_ratio = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_xx_appMass_ratio_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_xx_appMass_ratio = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_yy_appMass_ratio_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_yy_appMass_ratio = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_zz_appMass_ratio_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_zz_appMass_ratio = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case Mass_appMass_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  Mass_appMass = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_xx_appMass_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_xx_appMass = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_yy_appMass_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_yy_appMass = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
+              case I_zz_appMass_flag:
+                {
+                  if (check_float(linetoken3))
+                    token3 >> token_value;
+                  else
+                    uiuc_warnings_errors(1, *command_line);
+                  
+                  I_zz_appMass = token_value;
+                  massParts -> storeCommands (*command_line);
+                  break;
+                }
               default:
                 {
                   uiuc_warnings_errors(2, *command_line);
index 32c167942116f83132f4fe923c4feab891c00503..1526167239ba812bd6bdb2b631c3439c7469a126 100644 (file)
@@ -199,9 +199,9 @@ void uiuc_force_moment(double dt)
     }
   else
     {
-      F_X_wind = -CD * qS;
-      F_Y_wind = CY * qS;
-      F_Z_wind = -CL * qS;
+      F_X_wind = -CD * qS  * Cos_beta * Cos_beta;
+      F_Y_wind =  CY * qS  * Cos_beta * Cos_beta;
+      F_Z_wind = -CL * qS  * Cos_beta * Cos_beta;
 
       /* wind-axis to body-axis transformation */
       F_X_aero = F_X_wind * Cos_alpha * Cos_beta - F_Y_wind * Cos_alpha * Sin_beta - F_Z_wind * Sin_alpha;
@@ -209,14 +209,29 @@ void uiuc_force_moment(double dt)
       F_Z_aero = F_X_wind * Sin_alpha * Cos_beta - F_Y_wind * Sin_alpha * Sin_beta + F_Z_wind * Cos_alpha;
     }
   /* Moment calculations */
-  M_l_aero = Cl * qSb;
-  M_m_aero = Cm * qScbar;
-  M_n_aero = Cn * qSb;
-
-  /* Call flight data recorder */
-  //  if (Simtime >= recordStartTime)
-  //      uiuc_recorder(dt);
-  
+  M_l_aero = Cl * qSb    * Cos_beta * Cos_beta;
+  M_m_aero = Cm * qScbar * Cos_beta * Cos_beta;
+  M_n_aero = Cn * qSb    * Cos_beta * Cos_beta;
+
+  /* Adding in apparent mass effects */
+
+  if (Mass_appMass_ratio)
+    F_Z_aero += -(Mass_appMass_ratio * Mass) * W_dot_body;
+  if (I_xx_appMass_ratio)
+    M_l_aero += -(I_xx_appMass_ratio * I_xx) * P_dot_body;
+  if (I_yy_appMass_ratio)
+    M_m_aero += -(I_yy_appMass_ratio * I_yy) * Q_dot_body;
+  if (I_zz_appMass_ratio)
+    M_m_aero += -(I_zz_appMass_ratio * I_yy) * R_dot_body;
+
+  if (Mass_appMass)
+    F_Z_aero += -Mass_appMass * W_dot_body;
+  if (I_xx_appMass)
+    M_l_aero += -I_xx_appMass * P_dot_body;
+  if (I_yy_appMass)
+    M_m_aero += -I_yy_appMass * Q_dot_body;
+  if (I_zz_appMass)
+    M_m_aero += -I_zz_appMass * R_dot_body;
 
   // fog field update
    Fog = 0;