#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Aircraft:
# 1903 Wright Flyer
#
# File name:
# wrightFlyer1903-nl-v1
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Author:
#
# Michael Selig
# http://www.aae.uiuc.edu/m-selig
# 2002/02/27   initial setup
# 2002/03/08   various refinements, focusing on the pitching moment behavior
# 2002/12/21   more updates
#              - additional wing hard points
#              - adding in engine curve (model)
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# References:
# 
#  - Culick, F.E.C. and Jex, H.R., "Aerodynamics, Stability and
#    Control of the 1903 Wright Flyer," Proceedings of The Wright
#    Flyer: An Engineering Perspective, National Air and Space Museum,
#    Smithsonian Institution, 1985.
#
#  - Jex, H.R. and Culick, F.E.C., "Flight Control Dynamics of the
#    1903 Wright Flyer," 12th AIAA Atmospheric Flight Mechanics
#    Conference, AIAA Paper 85-1804-CP, 1985.
#
#  - Jex, H, Grimm, R., Latz, J.P., and Hange, C., "Full-Scale 1903
#    Wright Flyer Wind Tunnel Test Results From the NASA Ames Research
#    Center", AIAA 38th Aerospace Sciences Meeting, AIAA Paper
#    2000-0512, 2000.
#
#  - Various other sources including 
#    http://www.wrightflyer.org/Papers/papers.html
#    http://www.aae.uiuc.edu/m-selig/uiuc_lsat.html (low Re data)
#
#  - Additional models and updates 
#    http://www.aae.uiuc.edu/m-selig/apasim.html
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Notes:
# '[]' these items below still to do
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# initializations
init use_V_rel_wind_2U
init use_dyn_on_speed_curve1
init dyn_on_speed  2
init dyn_on_speed_zero 1
init use_Alpha_dot_on_speed 2   # [ft/sec] speed below which Alpha_dot is set to zero    
init use_gamma_horiz_on_speed 10 # [ft/sec] speed above which Gamma_horiz_deg is used in chase view [1]

# geometry
geometry bw   40.3      # [ft]
geometry cbar  6.2      # [ft]
geometry Sw  518        # [ft^2]

# canard
controlSurface de  20   20 # [deg]
# wing warping (delta_w)
controlSurface da 8.5  8.5 # [deg]
# Per discussion w/ Fred Culick, 
# 11 inches up and 11 inch down movement is given on the Smithsonian plans.
# With a 74-inch chord, this gives 8.5 deg up and 8.5 deg down of wing warping.
# Rudder coupling of Flyer: coupling between wing warp and rudder is delta_r = 2.5 * delta_w
# But w/ auto-coordination flag set to true in FGFS code, the amount of rudder used
# is delta_r_used = delta_r_spec/2, so here the max limits must be 1:5.
controlSurface dr 42.5 42.5 # [deg]

# if enable-auto-coordination is not used w/ FGFS startup options, then use
# where 30 deg rudder can be used with 12 deg aileron (2.5:1)
#controlSurface dr 30 30 # [deg]

mass Weight    750      # [lb]
# mass moments estimates from Culick paper
mass I_xx     1318      # [slug-ft^2]
mass I_yy      271      # [slug-ft^2]
mass I_zz     1343      # [slug-ft^2]
mass I_xz        0      # [slug-ft^2]

#  Apparent mass terms
#  F_Z_aero += -(0.269 * Mass) * W_dot_body;
#  M_l_aero += -(0.59  * I_xx) * P_dot_body;
#  M_m_aero += -(0.14  * I_yy) * Q_dot_body;
mass Mass_appMass_ratio  .269
mass I_xx_appMass_ratio  .590
mass I_yy_appMass_ratio  .14


# [] max thrust estimate
#engine simpleSingleModel 171 -5  88    # [lb] [fps]  [lb/fps]
engine simpleSingleModel 165 -5  88    # [lb] [fps]  [lb/fps]
# where token3 - static thrust in [lb]
#       token4 - speed at which thrust goes to zero [ft/sec]
#       token5 - slope dT/dV at the speed at which thrust goes to zero [lb/fps]
#engine simpleSingle  171  # [lb]

# lift curve
CL CLfade CLfade.dat  0 1

# drag polar
CD CDfa   CDfa.dat    0 1

# moment contributions
Cm Cmfa   Cmfa2.dat   0 1
Cm Cmfade Cmfade6.dat 0 1 1
Cm Cm_q     -3.5         # [/rad], estimate

# da negative right aileron TEU
CY CY_beta   -.321       # [/rad], -.0056/deg
CY CY_da     -.636       # [/rad], -.0111/deg
CY CY_dr     0.241       # [/rad], 0.0042/deg
# [] mss - update rotary derivatives
CY CY_p      0.0         # [/rad], placeholder
CY CY_r      0.3         # [/rad], placeholder

Cl Cl_beta   0.0212      # [/rad], 0.00037033/deg
Cl Cl_da    -0.1317      # [/rad], -.0023/deg
Cl Cl_dr     0.007       # [/rad], 0.000125/deg
# [] mss - update rotary derivatives
Cl Cl_p     -0.5         # [/rad], placeholder
Cl Cl_r      0           # [/rad], placeholder

Cn Cn_beta   0.0335      # [/rad], 0.0005853/deg
Cn Cn_dr    -0.039       # [/rad], -.0069/deg
Cn Cn_da     0.024       # [/rad], 0.000421/deg
# [] mss - update rotary derivatives
Cn Cn_p     -0.06        # [/rad], placeholder
Cn Cn_r     -0.15        # [/rad], placeholder

# nose wheel (must be position 0 if present)
gear Dx_gear     0     6.5      # x-offset from CG [ft]
gear Dy_gear     0     0        # y-offset from CG [ft]
gear Dz_gear     0     4.5      # z-offset from CG [ft]
gear cgear       0   300        # damping [lbs/ft/sec]
gear kgear       0   600        # springiness [lbs/ft]
gear muGear      0     0        # rolling coefficient
gear strutLength 0    -0.5      # gear travel [ft] (not yet used)

# right gear (must be position 1 if present)
gear Dx_gear     1    -8.5      # [ft]
gear Dy_gear     1     3.25     # [ft]
gear Dz_gear     1     4        # [ft]
gear cgear       1   300        # [lbs/ft/sec]
gear kgear       1   600        # [lbs/ft]
gear muGear      1     0        # rolling coefficient
gear strutLength 1     2.5      # gear travel [ft] (not yet used)

# left gear (must be position 2 if present)
gear Dx_gear     2    -8.5      # [ft]
gear Dy_gear     2    -3.25     # [ft]
gear Dz_gear     2     4        # [ft]
gear cgear       2   300        # [lbs/ft/sec]
gear kgear       2   600        # [lbs/ft]
gear muGear      2     0        # rolling coefficient
gear strutLength 2     2.5      # gear travel [ft] (not yet used)

# right wing
gear Dx_gear     3    -4        # [ft]
gear Dy_gear     3    21        # [ft]
gear Dz_gear     3     3.0      # [ft]
gear cgear       3   400        # [lbs/ft/sec]
gear kgear       3   800        # [lbs/ft]
gear muGear      3     0.0      # rolling coefficient
gear strutLength 3     2.5      # gear travel [ft] (not yet used)

# left wing
gear Dx_gear     4    -4        # [ft]
gear Dy_gear     4   -21        # [ft]
gear Dz_gear     4     3.0      # [ft]
gear cgear       4   400        # [lbs/ft/sec]
gear kgear       4   800        # [lbs/ft]
gear muGear      4     0.0      # rolling coefficient
gear strutLength 4     2.5      # gear travel [ft] (not yet used)

# right wing
gear Dx_gear     5     3        # [ft]
gear Dy_gear     5    21        # [ft]
gear Dz_gear     5     3.0      # [ft]
gear cgear       5   400        # [lbs/ft/sec]
gear kgear       5   800        # [lbs/ft]
gear muGear      5     0.0      # rolling coefficient
gear strutLength 5     2.5      # gear travel [ft] (not yet used)

# left wing
gear Dx_gear     6     3        # [ft]
gear Dy_gear     6   -21        # [ft]
gear Dz_gear     6     3.0      # [ft]
gear cgear       6   400        # [lbs/ft/sec]
gear kgear       6   800        # [lbs/ft]
gear muGear      6     0.0      # rolling coefficient
gear strutLength 6     2.5      # gear travel [ft] (not yet used)

*
