Advertisement
Guest User

DCS EFM/PFM Ground Effect Bug

a guest
Mar 2nd, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.73 KB | None | 0 0
  1. //Ground Effect Bug described in code
  2. //Fix shown below and is working perfectly well in three EFM aircraft I've developed
  3.  
  4. void ed_fm_set_surface(double       h,//surface height under the center of aircraft
  5.     double      h_obj,//surface height with objects
  6.     unsigned    surface_type,
  7.     double      normal_x,//components of normal vector to surface
  8.     double      normal_y,//components of normal vector to surface
  9.     double      normal_z//components of normal vector to surface
  10.     )
  11. {
  12.     double altitudeAboveTerrain = alt - h;  //alt is from ed_fm_set_atmosphere
  13.     double altitudeClearance = alt - h_obj; //this clearance becomes negative when underneath another aircraft, bridge, aircraft shelter, etc.
  14.  
  15.     double groundEffectAltitude = altitudeClearance;
  16.  
  17.     //why negative altitude matters:
  18.     //equation for ground effect influence on lift:
  19.     //CLge_mult - ground effect lift coefficient multiplier
  20.     //b - aircraft wingspan (m)
  21.     double CLge_mult = CLge_mult_table->getValue(groundEffectAltitude / b); //table lookup to get multiplier
  22.    
  23.     //Here is a lift coefficient multiplier table that is typical
  24.     // h/b is the independent variable and is always supposed to be positive, as you should never fly underground
  25.     //          h/b         CL mult
  26.     //  *CLge_multTable
  27.     //       0.054000  1.250000
  28.     //       0.100000  1.160000
  29.     //       0.200000  1.096100
  30.     //       0.300000  1.060000
  31.     //       0.400000  1.040000
  32.     //       0.500000  1.030000
  33.     //       0.600000  1.024200
  34.     //       0.700000  1.021300
  35.     //       0.800000  1.016100
  36.     //       0.900000  1.010000
  37.     //       1.000000  1.000000;
  38.  
  39.     //This means 25% increase in lift when a negative groundEffectAltitude is used.
  40.  
  41.     //How to fix:
  42.     if (altitudeClearance < 0)
  43.         groundEffectAltitude = altitudeAboveTerrain; //use this altitude whenever the other method gives a negative.
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement