forked from NikolaiVChr/f16
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new variant of the YF-16 FDM by Nicolai Verner Christensen
git-svn-id: svn://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft/f16@2270 9eb9bc84-db9d-4e05-893b-26dd41ac94a6
- Loading branch information
ehofman
committed
Nov 4, 2016
1 parent
f1f8e48
commit 8d744fb
Showing
5 changed files
with
5,942 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0"?> | ||
|
||
<turbine_engine name="gen"> | ||
<milthrust> 14670.0 </milthrust> | ||
<maxthrust> 23830.0 </maxthrust> | ||
<bypassratio> 0.71 </bypassratio> | ||
<tsfc> 0.72 </tsfc> | ||
<atsfc> 2.1 </atsfc> | ||
<idlen1> 30.0 </idlen1> | ||
<idlen2> 60.0 </idlen2> | ||
<maxn1> 100.0 </maxn1> | ||
<maxn2> 100.0 </maxn2> | ||
<augmented> 1 </augmented> | ||
<augmethod> 2 </augmethod> | ||
<injected> 0 </injected> | ||
|
||
<function name="IdleThrust"> | ||
<product> | ||
<v>0.00006816632583503749</v> | ||
<table> | ||
<independentVar lookup="row">velocities/mach</independentVar> | ||
<independentVar lookup="column">atmosphere/density-altitude</independentVar> | ||
<tableData> | ||
0 10000 20000 30000 40000 50000 60000 | ||
0.2 635 425 690 1010 1330 1700 0 | ||
0.4 60 25 345 755 1130 1525 0 | ||
0.6 -1020 -710 -300 350 910 1360 0 | ||
0.8 -2700 -1900 -1300 -247 600 1100 0 | ||
1.0 -3600 -1400 -595 -342 -200 700 0 | ||
</tableData> | ||
</table> | ||
</product> | ||
</function> | ||
|
||
<function name="MilThrust"> | ||
<product> | ||
<v>0.00006816632583503749</v> | ||
<table> | ||
<independentVar lookup="row">velocities/mach</independentVar> | ||
<independentVar lookup="column">atmosphere/density-altitude</independentVar> | ||
<tableData> | ||
0 10000 20000 30000 40000 50000 60000 | ||
0.0 14670 10856 7834 5457 3535 2186 0 <!-- this line from AeromatiC++ --> | ||
0.2 12680 9150 6313 4040 2470 1400 0 | ||
0.4 12610 9312 6610 4290 2600 1560 0 | ||
0.6 12640 9839 7090 4660 2840 1660 0 | ||
0.8 12390 10176 7750 5320 3250 1930 0 | ||
1.0 11680 9848 8050 6100 3800 2310 0 | ||
1.2 16353 12962 9891 7245 4840 2991 0 <!-- this line from AeromatiC++ --> | ||
1.4 17509 14190 11041 8205 5539 3435 0 <!-- this line from AeromatiC++ --> | ||
</tableData> | ||
</table> | ||
</product> | ||
</function> | ||
|
||
<function name="AugThrust"> | ||
<product> | ||
<v>0.0000419639110365086</v> | ||
<table> | ||
<independentVar lookup="row">velocities/mach</independentVar> | ||
<independentVar lookup="column">atmosphere/density-altitude</independentVar> | ||
<tableData> | ||
0 10000 20000 30000 40000 50000 60000 | ||
0.0 23830 19502 15792 12582 8950 5545 0 <!-- this line from AeromatiC++ --> | ||
0.2 21420 15700 11225 7323 4435 2600 0 | ||
0.4 22700 16860 12250 8154 5000 2835 0 | ||
0.6 24240 18910 13760 9285 5700 3215 0 | ||
0.8 26070 21075 15975 11115 6860 3950 0 | ||
1.0 28886 23319 18300 13484 8642 5057 0 | ||
1.4 28951 23670 19114 15155 10744 6658 0 <!-- this line from AeromatiC++ --> | ||
2.0 37413 31184 24959 19578 13788 8543 0 <!-- this line from AeromatiC++ --> | ||
</tableData> | ||
</table> | ||
</product> | ||
</function> | ||
|
||
</turbine_engine> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
################################################################################### | ||
## ## | ||
## Improved redout/blackout system for Flightgear ## | ||
## ## | ||
## Author: Nikolai V. Chr. ## | ||
## ## | ||
## Version 1.0 License: GPL 2.0 ## | ||
## ## | ||
################################################################################### | ||
|
||
|
||
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v } | ||
|
||
var invert = func (acc) { | ||
var g_inv = -1 * (acc - 5); | ||
return g_inv; | ||
} | ||
|
||
|
||
# | ||
# Customize the values according to the quality of the G-suit the pilot is wearing. The times are in seconds. | ||
# | ||
# According to NASA (1979), this should be the blackout values for generic: | ||
# | ||
# blackout_onset = 5; | ||
# blackout_fast = 9; | ||
# blackout_onset_time = 300; | ||
# blackout_fast_time = 10; | ||
# | ||
# That means at 9G it will take 10 seconds to blackout completely. | ||
# At 5G it will take 300 seconds. | ||
# | ||
|
||
var blackout_onset = 5; | ||
var blackout_fast = 9; | ||
var redout_onset = -1.5; | ||
var redout_fast = -4; | ||
|
||
var blackout_onset_time = 300; | ||
var blackout_fast_time = 10; | ||
var redout_onset_time = 45; | ||
var redout_fast_time = 3.5; | ||
|
||
var fast_time_recover = 7; | ||
var slow_time_recover = 15; | ||
|
||
|
||
|
||
|
||
|
||
|
||
## Do not modify anything below this line ## | ||
|
||
var fdm = "jsb"; | ||
var g1_log = math.log10(1); | ||
var blackout_onset_log = math.log10(blackout_onset); | ||
var blackout_fast_log = math.log10(blackout_fast); | ||
var redout_onset_log = math.log10(invert(redout_onset)); | ||
var redout_fast_log = math.log10(invert(redout_fast)); | ||
|
||
var blackout = 0; | ||
var redout = 0; | ||
|
||
|
||
|
||
var blackout_loop = func { | ||
setprop("/sim/rendering/redout/enabled", 0);# disable the Fg default redout/blackout system. | ||
var dt = getprop("sim/time/delta-sec"); | ||
var g = 0; | ||
if (fdm == "jsb") { | ||
# JSBSim | ||
g = getprop("fdm/jsbsim/accelerations/Nz"); | ||
} else { | ||
# Yasim | ||
g = getprop("/accelerations/pilot-g[0]"); | ||
} | ||
if (g == nil) { | ||
g = 1; | ||
} | ||
|
||
var g_log = g <= 1?0:math.log10(g); | ||
if (g < blackout_onset) { | ||
# reduce blackout | ||
|
||
var curr_time = fast_time_recover + ((g_log - g1_log) / (blackout_onset_log - g1_log)) * (slow_time_recover - fast_time_recover); | ||
|
||
curr_time = clamp(curr_time, 0, 1000); | ||
|
||
blackout -= (1/curr_time)*dt; | ||
|
||
blackout = clamp(blackout, 0, 1); | ||
|
||
} elsif (g >= blackout_onset) { | ||
# increase blackout | ||
|
||
var curr_time = math.log10(blackout_onset_time) + ((g_log - blackout_onset_log) / (blackout_fast_log - blackout_onset_log)) * (math.log10(blackout_fast_time) - math.log10(blackout_onset_time)); | ||
|
||
curr_time = math.pow(10, curr_time); | ||
|
||
curr_time = clamp(curr_time, 0, 1000); | ||
|
||
blackout += (1/curr_time)*dt; | ||
|
||
blackout = clamp(blackout, 0, 1); | ||
|
||
} | ||
|
||
var g_inv = invert (g); | ||
var g_inv_log = g_inv <= 1?0:math.log10(g_inv); | ||
if (g > redout_onset) { | ||
# reduce redout | ||
|
||
var curr_time = fast_time_recover + ((g_inv_log - g1_log) / (redout_onset_log - g1_log)) * (slow_time_recover - fast_time_recover); | ||
|
||
curr_time = clamp(curr_time, 0, 1000); | ||
|
||
redout -= (1/curr_time)*dt; | ||
|
||
redout = clamp(redout, 0, 1); | ||
|
||
} elsif (g <= redout_onset) { | ||
# increase redout | ||
|
||
var curr_time = math.log10(redout_onset_time) + ((g_inv_log - redout_onset_log) / (redout_fast_log - redout_onset_log)) * (math.log10(redout_fast_time) - math.log10(redout_onset_time)); | ||
|
||
curr_time = math.pow(10, curr_time); | ||
|
||
curr_time = clamp(curr_time, 0, 1000); | ||
|
||
redout += (1/curr_time)*dt; | ||
|
||
redout = clamp(redout, 0, 1); | ||
|
||
} | ||
|
||
var sum = blackout - redout; | ||
|
||
if (getprop("/sim/current-view/internal") == 0) { | ||
# not inside aircraft | ||
setprop("/sim/rendering/redout/red", 0); | ||
setprop("/sim/rendering/redout/alpha", 0); | ||
} elsif (sum < 0) { | ||
setprop("/sim/rendering/redout/red", 1); | ||
setprop("/sim/rendering/redout/alpha", -1 * sum); | ||
} else { | ||
setprop("/sim/rendering/redout/red", 0); | ||
setprop("/sim/rendering/redout/alpha", sum); | ||
} | ||
|
||
settimer(blackout_loop, 0); | ||
} | ||
|
||
|
||
var blackout_init = func { | ||
fdm = getprop("/sim/flight-model"); | ||
|
||
blackout_loop(); | ||
} | ||
|
||
|
||
|
||
var blackout_init_listener = setlistener("sim/signals/fdm-initialized", func { | ||
blackout_init(); | ||
removelistener(blackout_init_listener); | ||
}, 0, 0); | ||
|
||
|
||
var test = func (blackout_onset, blackout_fast, blackout_onset_time, blackout_fast_time) { | ||
var blackout_onset_log = math.log10(blackout_onset); | ||
var blackout_fast_log = math.log10(blackout_fast); | ||
|
||
var g = 5; | ||
print(); | ||
while(g <= 20) { | ||
|
||
var g_log = g <= 1?0:math.log10(g); | ||
|
||
var curr_time = math.log10(blackout_onset_time) + ((g_log - blackout_onset_log) / (blackout_fast_log - blackout_onset_log)) * (math.log10(blackout_fast_time) - math.log10(blackout_onset_time)); | ||
|
||
curr_time = math.pow(10, curr_time); | ||
|
||
curr_time = clamp(curr_time, 0, 1000); | ||
|
||
printf("%0.1f, %0.2f", g, curr_time); | ||
|
||
g += .5; | ||
} | ||
print(); | ||
} |
Oops, something went wrong.