diff --git a/Nasal/MCDU1.nas b/Nasal/MCDU1.nas index 6ea1fbbb..22a8d18a 100644 --- a/Nasal/MCDU1.nas +++ b/Nasal/MCDU1.nas @@ -360,6 +360,8 @@ var PerfTOInput = func(key) { if (scratchpad >= 0 and scratchpad <= 70) { setprop("/FMGC/internal/flex", scratchpad); setprop("/FMGC/internal/flex-set", 1); + var flex_calc = getprop("/FMGC/internal/flex") - getprop("/environment/temperature-degc"); + setprop("/FMGC/internal/flex-cmd", flex_calc); setprop("/MCDU[0]/scratchpad", ""); } else { setprop("/MCDU[0]/scratchpad-msg", "1"); diff --git a/Nasal/MCDU2.nas b/Nasal/MCDU2.nas index 05215ba6..6d89c08a 100644 --- a/Nasal/MCDU2.nas +++ b/Nasal/MCDU2.nas @@ -360,6 +360,8 @@ var PerfTOInput = func(key) { if (scratchpad >= 0 and scratchpad <= 70) { setprop("/FMGC/internal/flex", scratchpad); setprop("/FMGC/internal/flex-set", 1); + var flex_calc = getprop("/FMGC/internal/flex") - getprop("/environment/temperature-degc"); + setprop("/FMGC/internal/flex-cmd", flex_calc); setprop("/MCDU[1]/scratchpad", ""); } else { setprop("/MCDU[1]/scratchpad-msg", "1"); diff --git a/Nasal/thrust.nas b/Nasal/thrust.nas index 836ee519..e8e56019 100644 --- a/Nasal/thrust.nas +++ b/Nasal/thrust.nas @@ -6,7 +6,10 @@ setprop("/systems/thrust/toga-lk", 0); setprop("/systems/thrust/epr/toga-lim", 0.0); setprop("/systems/thrust/epr/mct-lim", 0.0); +setprop("/systems/thrust/epr/flx-lim", 0.0); setprop("/systems/thrust/epr/clb-lim", 0.0); +setprop("/systems/thrust/n1/flx-lim", 0.0); +setprop("/engines/flx-thr", 0.0); setlistener("/sim/signals/fdm-initialized", func { setprop("/controls/engines/thrust-limit", "TOGA"); @@ -41,7 +44,12 @@ setlistener("/controls/engines/engine[0]/throttle-pos", func { unflex(); } else if (thrr >= 0.78 and thrr < 0.83) { setprop("/it-autoflight/input/athr", 1); - setprop("/controls/engines/engine[0]/throttle-fdm", 0.90); + if (getprop("/controls/engines/thrust-limit") == "FLX") { + var derate = getprop("/engines/flex-derate"); + setprop("/controls/engines/engine[0]/throttle-fdm", 0.95 - derate); + } else { + setprop("/controls/engines/engine[0]/throttle-fdm", 0.90); + } setprop("/systems/thrust/state1", "MCT"); } else if (thrr >= 0.83 and thrr < 0.95) { setprop("/it-autoflight/input/athr", 1); @@ -91,7 +99,12 @@ setlistener("/controls/engines/engine[1]/throttle-pos", func { unflex(); } else if (thrr >= 0.78 and thrr < 0.83) { setprop("/it-autoflight/input/athr", 1); - setprop("/controls/engines/engine[1]/throttle-fdm", 0.90); + if (getprop("/controls/engines/thrust-limit") == "FLX") { + var derate = getprop("/engines/flex-derate"); + setprop("/controls/engines/engine[1]/throttle-fdm", 0.95 - derate); + } else { + setprop("/controls/engines/engine[1]/throttle-fdm", 0.90); + } setprop("/systems/thrust/state2", "MCT"); } else if (thrr >= 0.83 and thrr < 0.95) { setprop("/it-autoflight/input/athr", 1); @@ -154,9 +167,11 @@ var thrust_lim = func { var state2 = getprop("/systems/thrust/state2"); var thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); var thr2 = getprop("/controls/engines/engine[0]/throttle-pos"); - var eprtoga = getprop("/systems/thrust/epr/toga-lim") + 0.001; - var eprmct = getprop("/systems/thrust/epr/mct-lim") + 0.001; - var eprclb = getprop("/systems/thrust/epr/clb-lim") + 0.001; + var eprtoga = getprop("/systems/thrust/epr/toga-lim"); + var eprmct = getprop("/systems/thrust/epr/mct-lim"); + var eprflx = getprop("/systems/thrust/epr/flx-lim"); + var eprclb = getprop("/systems/thrust/epr/clb-lim"); + var n1flx = getprop("/systems/thrust/n1/flx-lim"); if (getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0) { if ((state1 == "TOGA" or state2 == "TOGA" or (state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) or getprop("/systems/thrust/alpha-floor") == 1 or getprop("/systems/thrust/toga-lk") == 1) { setprop("/controls/engines/thrust-limit", "TOGA"); @@ -178,8 +193,8 @@ var thrust_lim = func { } else if (getprop("/FMGC/internal/flex-set") == 1) { setprop("/systems/thrust/lim-flex", 1); setprop("/controls/engines/thrust-limit", "FLX"); - setprop("/controls/engines/epr-limit", eprmct); - setprop("/controls/engines/n1-limit", 97.7); + setprop("/controls/engines/epr-limit", eprflx); + setprop("/controls/engines/n1-limit", n1flx); } else { setprop("/controls/engines/thrust-limit", "TOGA"); setprop("/controls/engines/epr-limit", eprtoga); @@ -196,6 +211,8 @@ var unflex = func { } var thrust_loop = func { + var derate = getprop("/engines/flex-derate"); + setprop("/engines/flx-thr", 0.95 - derate); var state1 = getprop("/systems/thrust/state1"); var state2 = getprop("/systems/thrust/state2"); if ((state1 == "CL") and (state2 == "CL")) { diff --git a/Systems/engine-timing.xml b/Systems/engine-timing.xml index 6d2dece3..638adc5c 100644 --- a/Systems/engine-timing.xml +++ b/Systems/engine-timing.xml @@ -2,6 +2,23 @@ + + Flex Derate + gain + 1 + 0.05 + + + + /FMGC/internal/flex-cmd + 00.0 + 700.12 +
+
+ + /engines/flex-derate +
+ EGT L gain diff --git a/Systems/fadec-cfm.xml b/Systems/fadec-cfm.xml index dd680b9f..b966bdcc 100644 --- a/Systems/fadec-cfm.xml +++ b/Systems/fadec-cfm.xml @@ -419,5 +419,22 @@ 1 + + + N1 Limit FLX + gain + 1 + 0.05 + + + + /engines/flx-thr + 0.00 23.4 + 1.00105.8 +
+
+ + /systems/thrust/n1/flx-lim +
diff --git a/Systems/fadec-iae.xml b/Systems/fadec-iae.xml index e75af255..a4a83905 100644 --- a/Systems/fadec-iae.xml +++ b/Systems/fadec-iae.xml @@ -633,6 +633,41 @@ /systems/thrust/epr/mct-lim + + EPR Limit FLX + gain + 1 + 0.05 + + + + /engines/flx-thr + 0.0000.03 + 0.1410.20 + 1.0001.00 +
+
+ /engines/epr-scale + + /systems/thrust/epr/flx-lim-cmd +
+ + + EPR CMD FLX + gain + 1 + 0.05 + + + + /systems/thrust/epr/flx-lim-cmd + /engines/epr-scale-b + + + + /systems/thrust/epr/flx-lim + + EPR Limit CLB gain