|
|
(5 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| This is instruction on how to include a more realistic custom mandatory blackout/redout system based of a description of how that worked in a 1979 Langley F-16 simulator. The system is time based, so the longer time you spend at a high G the darker the screen gets.
| | {{Delete |reason=Superseded by [[Howto:Add blackout and redout settings]]}} |
| | |
| Per default to clear the darkness you must get below 5G for blackout and above -2G for redout. It also features G priming, so that if you for example pull some high Gs for a while and then go negative the redout will take longer to come into effect, and vice versa, as the blood flows to or from the pilots brain.
| |
| | |
| ==Install in an aircraft==
| |
| | |
| Copy this code into your aircraft's Nasal folder as <code>blackout.nas</code> file:
| |
| | |
| <syntaxhighlight lang="nasal">
| |
| ###################################################################################
| |
| ## ##
| |
| ## Improved redout/blackout system for Flightgear ##
| |
| ## ##
| |
| ## Author: Nikolai V. Chr. ##
| |
| ## ##
| |
| ## Version 1.03 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 - 2);
| |
| 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 F-16:
| |
| #
| |
| # 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 = -2.0;
| |
| var redout_fast = -4;
| |
| | |
| var blackout_onset_time = 300;
| |
| var blackout_fast_time = 10;
| |
| var redout_onset_time = 45;
| |
| var redout_fast_time = 7.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("accelerations/pilot/z-accel-fps_sec")/32.174;
| |
| } 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);
| |
| }
| |
| }
| |
| | |
| | |
| var blackout_init = func {
| |
| fdm = getprop("/sim/flight-model");
| |
| var timer = maketimer(0, func blackout_loop() );
| |
| timer.start();
| |
| }
| |
| | |
| | |
| | |
| 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();
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| | |
| Then in your [[aircraft-set.xml]] file under nasal tags add
| |
| | |
| <syntaxhighlight lang="xml">
| |
| <crash>
| |
| <file>Aircraft/[aircraft name here]/Nasal/blackout.nas</file>
| |
| </crash>
| |
| </syntaxhighlight>
| |
| | |
| And that is it. It will work even since blackout/redout is disabled in the flightsim cockpit dialog.
| |
| If you enable blackout/redout in the dialog, it will revert back to being unselected, the reason is to disable the default blackout system.
| |
| | |
| == Adjusting the numbers ==
| |
| | |
| The default numbers are for G-suits anno 1979. We have done a lot of research into this and for more modern fighters 1995+ you could set it to something like this:
| |
| | |
| <syntaxhighlight lang="nasal">
| |
| var blackout_onset = 5;
| |
| var blackout_fast = 8;
| |
| var redout_onset = -2;
| |
| var redout_fast = -4;
| |
| | |
| var blackout_onset_time = 300;
| |
| var blackout_fast_time = 30;
| |
| var redout_onset_time = 45;
| |
| var redout_fast_time = 7.5;
| |
| </syntaxhighlight>
| |
| | |
| == Aircraft that use this system ==
| |
| [[Saab JA-37 Viggen]]
| |
| | |
| [[F-16|General Dynamics YF-16]]
| |
| | |
| == Related content ==
| |
| === Wiki articles ===
| |
| * [[Howto:Add blackout and redout settings]] – The current system (as of Nov 2016)
| |
| | |
| === Forum topics ===
| |
| * [https://forum.flightgear.org/viewtopic.php?f=4&t=30985 More realistic Blackout/Redout] – Development topic
| |
| | |
| == External links ==
| |
| * {{cite web
| |
| | url = http://www.dtic.mil/dtic/tr/fulltext/u2/a109127.pdf
| |
| | title = AFHRL-TP-80-41 - Study and Design of High G Augmentation Devices for Flight Simulators
| |
| | author = Kron, Gerald J.; Cardullo, Frank M.; Young, Laurence R.
| |
| | date = December 1981
| |
| | publisher = US Air Force Human Resources Laboratory
| |
| | format = pdf
| |
| }}
| |
| | |
| [[Category:Aircraft enhancement]]
| |
| [[Category:Nasal howto]]
| |