1
0
Fork 0

Thrust: redo Nasal. Much more efficient now.

This commit is contained in:
legoboyvdlp R 2020-09-20 20:52:54 +01:00
parent 74cd14db02
commit 600f52375f
10 changed files with 334 additions and 324 deletions

View file

@ -711,6 +711,9 @@
</electrical>
<engines>
<engine-start-switch type="int">1</engine-start-switch>
<epr-limit type="double">0.0</epr-limit>
<n1-limit type="double">0.0</n1-limit>
<thrust-limit type="string">TOGA</thrust-limit>
<engine n="0">
<cutoff type="bool">true</cutoff>
<cutoff-switch type="bool">true</cutoff-switch>
@ -1124,6 +1127,12 @@
</bat-2>
</sources>
</electrical>
<fadec>
<n1mode1 type="bool">0</n1mode1>
<n1mode2 type="bool">0</n1mode2>
</fadec>
<failures n="0">
<aileron-left type="bool">0</aileron-left>
<aileron-right type="bool">0</aileron-right>
@ -1224,6 +1233,7 @@
<cargo-fwd-fire type="bool">0</cargo-fwd-fire>
<cargo-aft-fire type="bool">0</cargo-aft-fire>
</failures>
<fctl n="0">
<elac1 type="bool">0</elac1>
<elac2 type="bool">0</elac2>
@ -1234,6 +1244,7 @@
<fac2 type="bool">0</fac2>
<yawdamper-active type="bool">0</yawdamper-active>
</fctl>
<fire n="0">
<apu>
<temperature type="double">0</temperature>
@ -1281,6 +1292,7 @@
<fuel-used-2 type="double">0</fuel-used-2>
<mode-fault type="bool">0</mode-fault>
</fuel>
<hydraulic n="0">
<sources>
<ptu>
@ -1390,6 +1402,23 @@
<serviceable type="bool">1</serviceable>
</static>
<thrust>
<alpha-floor type="bool">0</alpha-floor>
<clbreduc-ft type="double">1500</clbreduc-ft>
<eng-out type="bool">0</eng-out>
<lim-flex type="bool">0</lim-flex>
<lvrclb type="bool">0</lvrclb>
<state1 type="string">IDLE</state1>
<state2 type="string">IDLE</state2>
<toga-lk type="bool">0</toga-lk>
<thr-locked type="bool">0</thr-locked>
<thr-locked-alert type="bool">0</thr-locked-alert>
<thr-lock-cmd n="0" type="double">0</thr-lock-cmd>
<thr-lock-cmd n="1" type="double">0</thr-lock-cmd>
<thr-locked-flash type="bool">0</thr-locked-flash>
<thr-locked-time type="double">0</thr-locked-time>
</thrust>
<navigation>
<aligned-1 type="bool">0</aligned-1>
<aligned-2 type="bool">0</aligned-2>

View file

@ -42,7 +42,6 @@ LBS2KGS = 0.4535924;
# Fetch Nodes
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1);
var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1);
var rate = props.globals.getNode("/systems/acconfig/options/lecam-rate", 1);
var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1);
@ -63,8 +62,6 @@ var oil_qt2 = props.globals.getNode("/ECAM/Lower/Oil-QT[1]", 1);
var oil_psi1 = props.globals.getNode("/ECAM/Lower/Oil-PSI[0]", 1);
var oil_psi2 = props.globals.getNode("/ECAM/Lower/Oil-PSI[1]", 1);
var bleedapu = props.globals.getNode("/systems/pneumatics/source/apu-psi", 1);
var oil_psi_actual1 = props.globals.getNode("/engines/engine[0]/oil-psi-actual", 1);
var oil_psi_actual2 = props.globals.getNode("/engines/engine[1]/oil-psi-actual", 1);
var aileron_ind_left = props.globals.getNode("/ECAM/Lower/aileron-ind-left", 1);
var aileron_ind_right = props.globals.getNode("/ECAM/Lower/aileron-ind-right", 1);
var elevator_ind_left = props.globals.getNode("/ECAM/Lower/elevator-ind-left", 1);
@ -75,7 +72,6 @@ var temperature_degc = props.globals.getNode("/environment/temperature-degc", 1)
var gw = props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs", 1);
var tank3_content_lbs = props.globals.getNode("/fdm/jsbsim/propulsion/tank[2]/contents-lbs", 1);
var ir2_knob = props.globals.getNode("/controls/adirs/ir[1]/knob", 1);
var switch_bleedapu = props.globals.getNode("/controls/pneumatics/switches/apu", 1);
var apuBleedNotOn = props.globals.getNode("/systems/pneumatics/warnings/apu-bleed-not-on", 1);
var apu_valve = props.globals.getNode("/systems/pneumatics/valves/apu-bleed-valve-cmd", 1);
var apu_valve_state = props.globals.getNode("/systems/pneumatics/valves/apu-bleed-valve", 1);
@ -86,8 +82,6 @@ var hp_valve1_state = props.globals.getNode("/systems/pneumatics/valves/engine-1
var hp_valve2_state = props.globals.getNode("/systems/pneumatics/valves/engine-2-hp-valve", 1);
var hp_valve1 = props.globals.getNode("/systems/pneumatics/valves/engine-1-hp-valve-cmd", 1);
var hp_valve2 = props.globals.getNode("/systems/pneumatics/valves/engine-2-hp-valve-cmd", 1);
var eng_valve1_cmd = props.globals.getNode("/controls/pneumatics/switches/bleed-1", 1);
var eng_valve2_cmd = props.globals.getNode("/controls/pneumatics/switches/bleed-2", 1);
var eng_valve1 = props.globals.getNode("/systems/pneumatics/valves/engine-1-prv-valve", 1);
var eng_valve2 = props.globals.getNode("/systems/pneumatics/valves/engine-2-prv-valve", 1);
var precooler1_psi = props.globals.getNode("/systems/pneumatics/psi/engine-1-psi", 1);
@ -150,28 +144,6 @@ var spoiler_R2 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r2/final-
var spoiler_R3 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r3/final-deg", 1);
var spoiler_R4 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r4/final-deg", 1);
var spoiler_R5 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r5/final-deg", 1);
var spoiler_L1_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l1", 1);
var spoiler_L2_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l2", 1);
var spoiler_L3_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l3", 1);
var spoiler_L4_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l4", 1);
var spoiler_L5_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l5", 1);
var spoiler_R1_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r1", 1);
var spoiler_R2_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r2", 1);
var spoiler_R3_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r3", 1);
var spoiler_R4_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r4", 1);
var spoiler_R5_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r5", 1);
var elac1 = props.globals.getNode("/systems/fctl/elac1", 1);
var elac2 = props.globals.getNode("/systems/fctl/elac2", 1);
var sec1 = props.globals.getNode("/systems/fctl/sec1", 1);
var sec2 = props.globals.getNode("/systems/fctl/sec2", 1);
var sec3 = props.globals.getNode("/systems/fctl/sec3", 1);
var elac1_fail = props.globals.getNode("/systems/failures/fctl/elac1", 1);
var elac2_fail = props.globals.getNode("/systems/failures/fctl/elac2", 1);
var sec1_fail = props.globals.getNode("/systems/failures/fctl/sec1", 1);
var sec2_fail = props.globals.getNode("/systems/failures/fctl/sec2", 1);
var sec3_fail = props.globals.getNode("/systems/failures/fctl/sec3", 1);
var eng1_n1 = props.globals.getNode("/engines/engine[0]/n1-actual", 1);
var eng2_n1 = props.globals.getNode("/engines/engine[1]/n1-actual", 1);
var total_fuel_lbs = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1);
var fadec1 = props.globals.getNode("/systems/fadec/powered1", 1);
var fadec2 = props.globals.getNode("/systems/fadec/powered2", 1);
@ -226,7 +198,7 @@ var canvas_lowerECAM_base = {
return [];
},
updateDu4: func() {
var elapsedtime = elapsed_sec.getValue();
var elapsedtime = pts.Sim.Time.elapsedSec.getValue();
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
if (du4_offtime.getValue() + 3 < elapsedtime) {
@ -252,7 +224,7 @@ var canvas_lowerECAM_base = {
}
},
update: func() {
var elapsedtime = elapsed_sec.getValue();
var elapsedtime = pts.Sim.Time.elapsedSec.getValue();
if (systems.ELEC.Bus.ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) {
if (du4_test_time.getValue() + du4_test_amount.getValue() >= elapsedtime) {
@ -742,7 +714,7 @@ var canvas_lowerECAM_bleed = {
}
# ENG BLEED valve 1
var eng_valve_state = eng_valve1_cmd.getValue();
var eng_valve_state = systems.PNEU.Switch.bleed1.getValue();
if (eng_valve1.getValue() == 0) {
me["BLEED-ENG-1"].setRotation(0);
@ -790,7 +762,7 @@ var canvas_lowerECAM_bleed = {
}
# ENG BLEED valve 2
eng_valve_state = eng_valve2_cmd.getValue();
eng_valve_state = systems.PNEU.Switch.bleed2.getValue();
if (eng_valve2.getValue() == 0) {
me["BLEED-ENG-2"].setRotation(0);
@ -836,7 +808,7 @@ var canvas_lowerECAM_bleed = {
if (bmc1working.getValue()) {
var precooler_temp = precooler1_temp.getValue();
me["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve1_cmd.getValue() and (precooler_temp < 150 or precooler1_ovht.getValue())) {
if (systems.PNEU.Switch.bleed1.getValue() and (precooler_temp < 150 or precooler1_ovht.getValue())) {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -850,7 +822,7 @@ var canvas_lowerECAM_bleed = {
if (bmc2working.getValue()) {
var precooler_temp = precooler2_temp.getValue();
me["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve2_cmd.getValue() and (precooler_temp < 150 or precooler2_ovht.getValue())) {
if (systems.PNEU.Switch.bleed2.getValue() and (precooler_temp < 150 or precooler2_ovht.getValue())) {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -1930,7 +1902,7 @@ var canvas_lowerECAM_eng = {
me["OilQT2-needle"].setRotation((oil_qt2.getValue() + 90) * D2R);
# Oil Pressure
if (oil_psi_actual1.getValue() >= 20) {
if (pts.Engines.Engine.oilPsi[0].getValue() >= 20) {
me["OilPSI1"].setColor(0.0509,0.7529,0.2941);
me["OilPSI1-needle"].setColor(0.0509,0.7529,0.2941);
} else {
@ -1938,7 +1910,7 @@ var canvas_lowerECAM_eng = {
me["OilPSI1-needle"].setColor(1,0,0);
}
if (oil_psi_actual2.getValue() >= 20) {
if (pts.Engines.Engine.oilPsi[1].getValue() >= 20) {
me["OilPSI2"].setColor(0.0509,0.7529,0.2941);
me["OilPSI2-needle"].setColor(0.0509,0.7529,0.2941);
} else {
@ -1946,8 +1918,8 @@ var canvas_lowerECAM_eng = {
me["OilPSI2-needle"].setColor(1,0,0);
}
me["OilPSI1"].setText(sprintf("%s", math.round(oil_psi_actual1.getValue())));
me["OilPSI2"].setText(sprintf("%s", math.round(oil_psi_actual2.getValue())));
me["OilPSI1"].setText(sprintf("%s", math.round(pts.Engines.Engine.oilPsi[0].getValue())));
me["OilPSI2"].setText(sprintf("%s", math.round(pts.Engines.Engine.oilPsi[1].getValue())));
me["OilPSI1-needle"].setRotation((oil_psi1.getValue() + 90) * D2R);
me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R);
@ -2123,7 +2095,7 @@ var canvas_lowerECAM_fctl = {
}
# Spoiler Fail
if (spoiler_L1_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerl1.getValue() or green_psi < 1500) {
me["spoiler1Lex"].setColor(0.7333,0.3803,0);
me["spoiler1Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L1.getValue() < 1.5) {
@ -2137,7 +2109,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler1Lf"].hide();
}
if (spoiler_L2_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerl2.getValue() or yellow_psi < 1500) {
me["spoiler2Lex"].setColor(0.7333,0.3803,0);
me["spoiler2Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L2.getValue() < 1.5) {
@ -2151,7 +2123,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler2Lf"].hide();
}
if (spoiler_L3_fail.getValue() or blue_psi < 1500) {
if (fbw.FBW.Failures.spoilerl3.getValue() or blue_psi < 1500) {
me["spoiler3Lex"].setColor(0.7333,0.3803,0);
me["spoiler3Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L3.getValue() < 1.5) {
@ -2165,7 +2137,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler3Lf"].hide();
}
if (spoiler_L4_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerl4.getValue() or yellow_psi < 1500) {
me["spoiler4Lex"].setColor(0.7333,0.3803,0);
me["spoiler4Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L4.getValue() < 1.5) {
@ -2179,7 +2151,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler4Lf"].hide();
}
if (spoiler_L5_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerl5.getValue() or green_psi < 1500) {
me["spoiler5Lex"].setColor(0.7333,0.3803,0);
me["spoiler5Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L5.getValue() < 1.5) {
@ -2193,7 +2165,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler5Lf"].hide();
}
if (spoiler_R1_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerr1.getValue() or green_psi < 1500) {
me["spoiler1Rex"].setColor(0.7333,0.3803,0);
me["spoiler1Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R1.getValue() < 1.5) {
@ -2207,7 +2179,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler1Rf"].hide();
}
if (spoiler_R2_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerr2.getValue() or yellow_psi < 1500) {
me["spoiler2Rex"].setColor(0.7333,0.3803,0);
me["spoiler2Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R2.getValue() < 1.5) {
@ -2221,7 +2193,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler2Rf"].hide();
}
if (spoiler_R3_fail.getValue() or blue_psi < 1500) {
if (fbw.FBW.Failures.spoilerr3.getValue() or blue_psi < 1500) {
me["spoiler3Rex"].setColor(0.7333,0.3803,0);
me["spoiler3Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R3.getValue() < 1.5) {
@ -2235,7 +2207,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler3Rf"].hide();
}
if (spoiler_R4_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerr4.getValue() or yellow_psi < 1500) {
me["spoiler4Rex"].setColor(0.7333,0.3803,0);
me["spoiler4Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R4.getValue() < 1.5) {
@ -2249,7 +2221,7 @@ var canvas_lowerECAM_fctl = {
me["spoiler4Rf"].hide();
}
if (spoiler_R5_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerr5.getValue() or green_psi < 1500) {
me["spoiler5Rex"].setColor(0.7333,0.3803,0);
me["spoiler5Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R5.getValue() < 1.5) {
@ -2264,42 +2236,42 @@ var canvas_lowerECAM_fctl = {
}
# Flight Computers
if (elac1.getValue()) {
if (fbw.FBW.Computers.elac1.getValue()) {
me["elac1"].setColor(0.0509,0.7529,0.2941);
me["path4249"].setColor(0.0509,0.7529,0.2941);
} else if ((elac1.getValue() == 0) or (elac1_fail.getValue())) {
} else if (!fbw.FBW.Computers.elac1.getValue() or fbw.FBW.Failures.elac1.getValue()) {
me["elac1"].setColor(0.7333,0.3803,0);
me["path4249"].setColor(0.7333,0.3803,0);
}
if (elac2.getValue()) {
if (fbw.FBW.Computers.elac2.getValue()) {
me["elac2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3"].setColor(0.0509,0.7529,0.2941);
} else if ((elac2.getValue() == 0) or (elac2_fail.getValue())) {
} else if (!fbw.FBW.Computers.elac2.getValue() or fbw.FBW.Failures.elac2.getValue()) {
me["elac2"].setColor(0.7333,0.3803,0);
me["path4249-3"].setColor(0.7333,0.3803,0);
}
if (sec1.getValue()) {
if (fbw.FBW.Computers.sec1.getValue()) {
me["sec1"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941);
} else if ((sec1.getValue() == 0) or (sec1_fail.getValue())) {
} else if (!fbw.FBW.Computers.sec1.getValue() or fbw.FBW.Failures.sec1.getValue()) {
me["sec1"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7"].setColor(0.7333,0.3803,0);
}
if (sec2.getValue()) {
if (fbw.FBW.Computers.sec2.getValue()) {
me["sec2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941);
} else if ((sec2.getValue() == 0) or (sec2_fail.getValue())) {
} else if (!fbw.FBW.Computers.sec2.getValue() or fbw.FBW.Failures.sec2.getValue()) {
me["sec2"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0);
}
if (sec3.getValue()) {
if (fbw.FBW.Computers.sec3.getValue()) {
me["sec3"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6"].setColor(0.0509,0.7529,0.2941);
} else if ((sec3.getValue() == 0) or (sec3_fail.getValue())) {
} else if (!fbw.FBW.Computers.sec3.getValue() or fbw.FBW.Failures.sec3.getValue()) {
me["sec3"].setColor(0.7333,0.3803,0);
me["path4249-3-6"].setColor(0.7333,0.3803,0);
}
@ -2371,7 +2343,7 @@ var canvas_lowerECAM_fuel = {
update: func() {
_weight_kgs = acconfig_weight_kgs.getValue();
if (eng1_n1.getValue() <= 18.8) {
if (pts.Engines.Engine.n1Actual[0].getValue() <= 18.8) {
me["ENG1idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0);
} else {
@ -2379,7 +2351,7 @@ var canvas_lowerECAM_fuel = {
me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078);
}
if (eng2_n1.getValue() <= 18.5) {
if (pts.Engines.Engine.n1Actual[1].getValue() <= 18.5) {
me["ENG2idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0);
} else {
@ -3238,7 +3210,7 @@ var canvas_lowerECAM_wheel = {
}
# Spoiler Fail
if (spoiler_L1_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerl1.getValue() or green_psi < 1500) {
me["spoiler1Lex"].setColor(0.7333,0.3803,0);
me["spoiler1Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L1.getValue() < 1.5) {
@ -3252,7 +3224,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler1Lf"].hide();
}
if (spoiler_L2_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerl2.getValue() or yellow_psi < 1500) {
me["spoiler2Lex"].setColor(0.7333,0.3803,0);
me["spoiler2Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L2.getValue() < 1.5) {
@ -3266,7 +3238,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler2Lf"].hide();
}
if (spoiler_L3_fail.getValue() or blue_psi < 1500) {
if (fbw.FBW.Failures.spoilerl3.getValue() or blue_psi < 1500) {
me["spoiler3Lex"].setColor(0.7333,0.3803,0);
me["spoiler3Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L3.getValue() < 1.5) {
@ -3280,7 +3252,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler3Lf"].hide();
}
if (spoiler_L4_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerl4.getValue() or yellow_psi < 1500) {
me["spoiler4Lex"].setColor(0.7333,0.3803,0);
me["spoiler4Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L4.getValue() < 1.5) {
@ -3294,7 +3266,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler4Lf"].hide();
}
if (spoiler_L5_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerl5.getValue() or green_psi < 1500) {
me["spoiler5Lex"].setColor(0.7333,0.3803,0);
me["spoiler5Lrt"].setColor(0.7333,0.3803,0);
if (spoiler_L5.getValue() < 1.5) {
@ -3308,7 +3280,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler5Lf"].hide();
}
if (spoiler_R1_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerr1.getValue() or green_psi < 1500) {
me["spoiler1Rex"].setColor(0.7333,0.3803,0);
me["spoiler1Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R1.getValue() < 1.5) {
@ -3322,7 +3294,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler1Rf"].hide();
}
if (spoiler_R2_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerr2.getValue() or yellow_psi < 1500) {
me["spoiler2Rex"].setColor(0.7333,0.3803,0);
me["spoiler2Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R2.getValue() < 1.5) {
@ -3336,7 +3308,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler2Rf"].hide();
}
if (spoiler_R3_fail.getValue() or blue_psi < 1500) {
if (fbw.FBW.Failures.spoilerr3.getValue() or blue_psi < 1500) {
me["spoiler3Rex"].setColor(0.7333,0.3803,0);
me["spoiler3Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R3.getValue() < 1.5) {
@ -3350,7 +3322,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler3Rf"].hide();
}
if (spoiler_R4_fail.getValue() or yellow_psi < 1500) {
if (fbw.FBW.Failures.spoilerr4.getValue() or yellow_psi < 1500) {
me["spoiler4Rex"].setColor(0.7333,0.3803,0);
me["spoiler4Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R4.getValue() < 1.5) {
@ -3364,7 +3336,7 @@ var canvas_lowerECAM_wheel = {
me["spoiler4Rf"].hide();
}
if (spoiler_R5_fail.getValue() or green_psi < 1500) {
if (fbw.FBW.Failures.spoilerr5.getValue() or green_psi < 1500) {
me["spoiler5Rex"].setColor(0.7333,0.3803,0);
me["spoiler5Rrt"].setColor(0.7333,0.3803,0);
if (spoiler_R5.getValue() < 1.5) {
@ -3505,7 +3477,7 @@ var canvas_lowerECAM_test = {
return ["Test_white","Test_text"];
},
update: func() {
var elapsedtime = elapsed_sec.getValue();
var elapsedtime = pts.Sim.Time.elapsedSec.getValue();
if (du4_test_time.getValue() + 1 >= elapsedtime) {
me["Test_white"].show();
me["Test_text"].hide();

View file

@ -77,8 +77,6 @@ var fadecpowerup = props.globals.getNode("/systems/fadec/powerup", 1);
var thr_limit = props.globals.getNode("/controls/engines/thrust-limit", 1);
var n1_limit = props.globals.getNode("/controls/engines/n1-limit", 1);
var epr_limit = props.globals.getNode("/controls/engines/epr-limit", 1);
var n1mode1 = props.globals.getNode("/systems/fadec/n1mode1", 1);
var n1mode2 = props.globals.getNode("/systems/fadec/n1mode2", 1);
var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1);
var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1);
var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1);
@ -1103,7 +1101,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N12-XX"].show();
}
if (eng1_n1mode.getValue() == 1 and n1mode1.getValue() == 1) {
if (eng1_n1mode.getValue() == 1 and fadec.Fadec.n1Mode[0].getValue() == 1) {
me["N11-thr"].show();
me["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet
} else {
@ -1111,7 +1109,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N11-ylim"].hide();
}
if (eng2_n1mode.getValue() == 1 and n1mode2.getValue() == 1) {
if (eng2_n1mode.getValue() == 1 and fadec.Fadec.n1Mode[1].getValue() == 1) {
me["N12-thr"].show();
me["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet
} else {

View file

@ -116,14 +116,14 @@ var phaseLoop = func() {
if (eng == "IAE") {
eprlim = getprop("controls/engines/epr-limit");
if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
FWC.toPower.setBoolValue(1);
} else {
FWC.toPower.setBoolValue(0);
}
} else {
n1lim = getprop("controls/engines/n1-limit");
if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Output.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) {
FWC.toPower.setBoolValue(1);
} else {
FWC.toPower.setBoolValue(0);

View file

@ -261,6 +261,7 @@ var postInit = func() {
var FMGCNodes = {
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"),
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),

View file

@ -25,6 +25,9 @@ var Controls = {
cutoffSw: [props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), props.globals.getNode("/controls/engines/engine[1]/cutoff-switch")],
firePb: [props.globals.getNode("/controls/engines/engine[0]/fire-btn"), props.globals.getNode("/controls/engines/engine[1]/fire-btn")],
throttle: [props.globals.getNode("/controls/engines/engine[0]/throttle"), props.globals.getNode("/controls/engines/engine[1]/throttle")],
throttleFdm: [props.globals.getNode("/controls/engines/engine[0]/throttle-fdm"), props.globals.getNode("/controls/engines/engine[1]/throttle-fdm")],
throttleOutput: [props.globals.getNode("/controls/engines/engine[0]/throttle-output"), props.globals.getNode("/controls/engines/engine[1]/throttle-output")],
throttlePos: [props.globals.getNode("/controls/engines/engine[0]/throttle-pos"), props.globals.getNode("/controls/engines/engine[1]/throttle-pos")],
throttleRev: [props.globals.getNode("/controls/engines/engine[0]/throttle-rev"), props.globals.getNode("/controls/engines/engine[1]/throttle-rev")],
reverser: [props.globals.getNode("/controls/engines/engine[0]/reverser"), props.globals.getNode("/controls/engines/engine[1]/reverser")],
},
@ -58,6 +61,7 @@ var Engines = {
eprActual: [props.globals.getNode("/engines/engine[0]/epr-actual"), props.globals.getNode("/engines/engine[1]/epr-actual")],
n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")],
n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")],
oilPsi: [props.globals.getNode("/engines/engine[0]/oil-psi-actual"), props.globals.getNode("/engines/engine[1]/oil-psi-actual")],
thrust: [props.globals.getNode("/engines/engine[0]/thrust-lb"), props.globals.getNode("/engines/engine[1]/thrust-lb")],
state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")],
},
@ -70,6 +74,9 @@ var Environment = {
var Fdm = {
JSBsim: {
Aero: {
alpha: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg"),
},
Fcs: {
brake: [props.globals.getNode("/fdm/jsbsim/fcs/left-brake-cmd-norm"),props.globals.getNode("/fdm/jsbsim/fcs/right-brake-cmd-norm")],
flapDeg: props.globals.getNode("/fdm/jsbsim/fcs/flap-pos-deg"),
@ -183,6 +190,7 @@ var Sim = {
var Systems = {
Thrust: {
engOut: props.globals.getNode("/systems/thrust/eng-out"),
state: [props.globals.getNode("/systems/thrust/state1"), props.globals.getNode("/systems/thrust/state2")],
},
};

View file

@ -149,14 +149,14 @@ var MCDU_reset = func(i) {
fmgc.FMGCInternal.v2 = 0;
fmgc.FMGCInternal.v2set = 0;
setprop("FMGC/internal/accel-agl-ft", "1500"); #eventually set to 1500 above runway
setprop("/FMGC/internal/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("/MCDUC/thracc-set", 0);
setprop("FMGC/internal/to-flap", 0);
setprop("FMGC/internal/to-ths", "0.0");
setprop("FMGC/internal/flap-ths-set", 0);
setprop("FMGC/internal/flex", 0);
setprop("FMGC/internal/flex-set", 0);
setprop("FMGC/internal/eng-out-reduc", "1500");
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0);
setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/flex-set", 0);
setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("/MCDUC/reducacc-set", 0);
fmgc.FMGCInternal.transAlt = 18000;

View file

@ -6,8 +6,8 @@ var perfGAInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("systems/thrust/clbreduc-ft", 1500);
setprop("/FMGC/internal/accel-agl-ft", 1500);
setprop("MCDUC/thracc-set", 0);
mcdu_scratchpad.scratchpads[i].empty();
} else {

View file

@ -100,8 +100,8 @@ var perfTOInput = func(key, i) {
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("systems/thrust/clbreduc-ft", 1500);
setprop("/FMGC/internal/accel-agl-ft", 1500);
setprop("MCDUC/thracc-set", 0);
mcdu_scratchpad.scratchpads[i].empty();
} else {

View file

@ -8,10 +8,6 @@ if (getprop("options/eng") == "IAE") {
io.include("fadec-cfm.nas");
}
var Output = {
limFlex: props.globals.getNode("/systems/thrust/lim-flex"),
};
var thr1 = 0;
var thr2 = 0;
var state1 = 0;
@ -31,179 +27,184 @@ var flaps = 0;
var alphaProt = 0;
var togaLock = 0;
var gs = 0;
setprop("systems/thrust/alpha-floor", 0);
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/toga-lim", 0.0);
setprop("systems/thrust/n1/mct-lim", 0.0);
setprop("systems/thrust/n1/flx-lim", 0.0);
setprop("systems/thrust/n1/clb-lim", 0.0);
setprop("engines/flx-thr", 0.0);
setprop("controls/engines/thrust-limit", "TOGA");
setprop("controls/engines/epr-limit", 0.0);
setprop("controls/engines/n1-limit", 0.0);
setprop("systems/thrust/state1", "IDLE");
setprop("systems/thrust/state2", "IDLE");
setprop("systems/thrust/lvrclb", 0);
setprop("systems/thrust/clbreduc-ft", "1500");
setprop("systems/thrust/toga-lim", 0.0);
setprop("systems/thrust/mct-lim", 0.0);
setprop("systems/thrust/clb-lim", 0.0);
setprop("systems/thrust/lim-flex", 0);
setprop("engines/flex-derate", 0);
setprop("systems/thrust/eng-out", 0);
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-locked-flash", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-lock-cmd[0]", 0);
setprop("systems/thrust/thr-lock-cmd[1]", 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/toga-lim", 0.0);
setprop("/systems/thrust/n1/mct-lim", 0.0);
setprop("/systems/thrust/n1/flx-lim", 0.0);
setprop("/systems/thrust/n1/clb-lim", 0.0);
setprop("/systems/thrust/toga-lim", 0.0);
setprop("/systems/thrust/mct-lim", 0.0);
setprop("/systems/thrust/clb-lim", 0.0);
setprop("/engines/flex-derate", 0);
setprop("/engines/flx-thr", 0.0);
setlistener("/sim/signals/fdm-initialized", func {
thrust_loop.start();
thrust_flash.start();
});
var Fadec = {
n1Mode: [props.globals.getNode("/systems/fadec/n1mode1"), props.globals.getNode("/systems/fadec/n1mode2")],
};
var Thrust = {
alphaFloor: props.globals.getNode("/systems/thrust/alpha-floor"),
clbReduc: props.globals.getNode("/systems/thrust/clbreduc-ft"),
eprLimit: props.globals.getNode("/controls/engines/epr-limit"),
n1Limit: props.globals.getNode("/controls/engines/n1-limit"),
limFlex: props.globals.getNode("/systems/thrust/lim-flex"),
lvrClb: props.globals.getNode("/systems/thrust/lvrclb"),
togaLk: props.globals.getNode("/systems/thrust/toga-lk"),
thrustLimit: props.globals.getNode("/controls/engines/thrust-limit"),
Lock: {
thrLockAlert: props.globals.getNode("/systems/thrust/thr-locked-alert"),
thrLockCmd: props.globals.getNode("/systems/thrust/thr-locked"),
thrLockCmdN1: [props.globals.getNode("/systems/thrust/thr-lock-cmd[0]"), props.globals.getNode("/systems/thrust/thr-lock-cmd[1]")],
thrLockFlash: props.globals.getNode("/systems/thrust/thr-locked-flash"),
thrLockTime: props.globals.getNode("/systems/thrust/thr-locked-time"),
},
};
setlistener("/controls/engines/engine[0]/throttle-pos", func {
engstate1 = getprop("engines/engine[0]/state");
engstate2 = getprop("engines/engine[1]/state");
thr1 = getprop("controls/engines/engine[0]/throttle-pos");
if (getprop("systems/thrust/alpha-floor") == 0 and getprop("systems/thrust/toga-lk") == 0) {
engstate1 = pts.Engines.Engine.state[0].getValue();
engstate2 = pts.Engines.Engine.state[1].getValue();
thr1 = pts.Controls.Engines.Engine.throttlePos[0].getValue();
if (!Thrust.alphaFloor.getValue() and !Thrust.togaLk.getValue()) {
if (thr1 < 0.01) {
setprop("systems/thrust/state1", "IDLE");
pts.Systems.Thrust.state[0].setValue("IDLE");
unflex();
atoff_request();
} else if (thr1 >= 0.01 and thr1 < 0.60) {
setprop("systems/thrust/state1", "MAN");
pts.Systems.Thrust.state[0].setValue("MAN");
unflex();
} else if (thr1 >= 0.60 and thr1 < 0.65) {
setprop("systems/thrust/state1", "CL");
pts.Systems.Thrust.state[0].setValue("CL");
unflex();
} else if (thr1 >= 0.65 and thr1 < 0.78) {
setprop("systems/thrust/state1", "MAN THR");
pts.Systems.Thrust.state[0].setValue("MAN THR");
unflex();
} else if (thr1 >= 0.78 and thr1 < 0.83) {
if (getprop("systems/thrust/eng-out") != 1) {
if (getprop("controls/engines/thrust-limit") == "FLX") {
if (getprop("gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) {
setprop("it-autoflight/input/athr", 1);
if (pts.Systems.Thrust.engOut.getValue() != 1) {
if (Thrust.thrustLimit.getValue() == "FLX") {
if (pts.Gear.wow[0].getValue() and (engstate1 == 3 or engstate2 == 3)) {
fmgc.Input.athr.setValue(1);
}
setprop("controls/engines/engine[0]/throttle-fdm", 0.99);
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.99);
} else {
setprop("controls/engines/engine[0]/throttle-fdm", 0.95);
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.95);
}
}
setprop("systems/thrust/state1", "MCT");
pts.Systems.Thrust.state[0].setValue("MCT");
} else if (thr1 >= 0.83 and thr1 < 0.95) {
setprop("systems/thrust/state1", "MAN THR");
pts.Systems.Thrust.state[0].setValue("MAN THR");
unflex();
} else if (thr1 >= 0.95) {
if (getprop("gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) {
setprop("it-autoflight/input/athr", 1);
if (pts.Gear.wow[0].getValue() and (engstate1 == 3 or engstate2 == 3)) {
fmgc.Input.athr.setValue(1);
}
setprop("controls/engines/engine[0]/throttle-fdm", 0.99);
setprop("systems/thrust/state1", "TOGA");
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.99);
pts.Systems.Thrust.state[0].setValue("TOGA");
unflex();
}
} else {
if (thr1 < 0.01) {
setprop("systems/thrust/state1", "IDLE");
pts.Systems.Thrust.state[0].setValue("IDLE");
} else if (thr1 >= 0.01 and thr1 < 0.60) {
setprop("systems/thrust/state1", "MAN");
pts.Systems.Thrust.state[0].setValue("MAN");
} else if (thr1 >= 0.60 and thr1 < 0.65) {
setprop("systems/thrust/state1", "CL");
pts.Systems.Thrust.state[0].setValue("CL");
} else if (thr1 >= 0.65 and thr1 < 0.78) {
setprop("systems/thrust/state1", "MAN THR");
pts.Systems.Thrust.state[0].setValue("MAN THR");
} else if (thr1 >= 0.78 and thr1 < 0.83) {
setprop("systems/thrust/state1", "MCT");
pts.Systems.Thrust.state[0].setValue("MCT");
} else if (thr1 >= 0.83 and thr1 < 0.95) {
setprop("systems/thrust/state1", "MAN THR");
pts.Systems.Thrust.state[0].setValue("MAN THR");
} else if (thr1 >= 0.95) {
setprop("systems/thrust/state1", "TOGA");
pts.Systems.Thrust.state[0].setValue("TOGA");
}
setprop("controls/engines/engine[0]/throttle-fdm", 0.99);
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.99);
}
}, 0, 0);
setlistener("/controls/engines/engine[1]/throttle-pos", func {
engstate1 = getprop("engines/engine[0]/state");
engstate2 = getprop("engines/engine[1]/state");
thr2 = getprop("controls/engines/engine[1]/throttle-pos");
if (getprop("systems/thrust/alpha-floor") == 0 and getprop("systems/thrust/toga-lk") == 0) {
engstate1 = pts.Engines.Engine.state[0].getValue();
engstate2 = pts.Engines.Engine.state[1].getValue();
thr2 = pts.Controls.Engines.Engine.throttlePos[1].getValue();
if (!Thrust.alphaFloor.getValue() and !Thrust.togaLk.getValue()) {
if (thr2 < 0.01) {
setprop("systems/thrust/state2", "IDLE");
pts.Systems.Thrust.state[1].setValue("IDLE");
unflex();
atoff_request();
} else if (thr2 >= 0.01 and thr2 < 0.60) {
setprop("systems/thrust/state2", "MAN");
pts.Systems.Thrust.state[1].setValue("MAN");
unflex();
} else if (thr2 >= 0.60 and thr2 < 0.65) {
setprop("systems/thrust/state2", "CL");
pts.Systems.Thrust.state[1].setValue("CL");
unflex();
} else if (thr2 >= 0.65 and thr2 < 0.78) {
setprop("systems/thrust/state2", "MAN THR");
pts.Systems.Thrust.state[1].setValue("MAN THR");
unflex();
} else if (thr2 >= 0.78 and thr2 < 0.83) {
if (getprop("systems/thrust/eng-out") != 1) {
if (getprop("controls/engines/thrust-limit") == "FLX") {
if (getprop("gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) {
setprop("it-autoflight/input/athr", 1);
if (pts.Systems.Thrust.engOut.getValue() != 1) {
if (Thrust.thrustLimit.getValue() == "FLX") {
if (pts.Gear.wow[0].getValue() and (engstate1 == 3 or engstate2 == 3)) {
fmgc.Input.athr.setValue(1);
}
setprop("controls/engines/engine[1]/throttle-fdm", 0.99);
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.99);
} else {
setprop("controls/engines/engine[1]/throttle-fdm", 0.95);
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.95);
}
}
setprop("systems/thrust/state2", "MCT");
pts.Systems.Thrust.state[1].setValue("MCT");
} else if (thr2 >= 0.83 and thr2 < 0.95) {
setprop("systems/thrust/state2", "MAN THR");
pts.Systems.Thrust.state[1].setValue("MAN THR");
unflex();
} else if (thr2 >= 0.95) {
if (getprop("gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) {
setprop("it-autoflight/input/athr", 1);
if (pts.Gear.wow[0].getValue() and (engstate1 == 3 or engstate2 == 3)) {
fmgc.Input.athr.setValue(1);
}
setprop("controls/engines/engine[1]/throttle-fdm", 0.99);
setprop("systems/thrust/state2", "TOGA");
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.99);
pts.Systems.Thrust.state[1].setValue("TOGA");
unflex();
}
} else {
if (thr2 < 0.01) {
setprop("systems/thrust/state2", "IDLE");
pts.Systems.Thrust.state[1].setValue("IDLE");
} else if (thr2 >= 0.01 and thr2 < 0.60) {
setprop("systems/thrust/state2", "MAN");
pts.Systems.Thrust.state[1].setValue("MAN");
} else if (thr2 >= 0.60 and thr2 < 0.65) {
setprop("systems/thrust/state2", "CL");
pts.Systems.Thrust.state[1].setValue("CL");
} else if (thr2 >= 0.65 and thr2 < 0.78) {
setprop("systems/thrust/state2", "MAN THR");
pts.Systems.Thrust.state[1].setValue("MAN THR");
} else if (thr2 >= 0.78 and thr2 < 0.83) {
setprop("systems/thrust/state2", "MCT");
pts.Systems.Thrust.state[1].setValue("MCT");
} else if (thr2 >= 0.83 and thr2 < 0.95) {
setprop("systems/thrust/state2", "MAN THR");
pts.Systems.Thrust.state[1].setValue("MAN THR");
} else if (thr2 >= 0.95) {
setprop("systems/thrust/state2", "TOGA");
pts.Systems.Thrust.state[1].setValue("TOGA");
}
setprop("controls/engines/engine[1]/throttle-fdm", 0.99);
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.99);
}
}, 0, 0);
# Alpha Floor and Toga Lock
setlistener("/it-autoflight/input/athr", func {
if (getprop("systems/thrust/alpha-floor") == 1) {
setprop("it-autoflight/input/athr", 1);
if (Thrust.alphaFloor.getValue()) {
fmgc.Input.athr.setValue(1);
} else {
setprop("systems/thrust/toga-lk", 0);
Thrust.togaLk.setValue(0);
}
});
# Checks if all throttles are in the IDLE position, before tuning off the A/THR.
var atoff_request = func {
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("systems/thrust/alpha-floor") == 0) and (getprop("systems/thrust/toga-lk") == 0)) {
if (getprop("it-autoflight/input/athr") == 1 and pts.Position.gearAglFt.getValue() > 50) {
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if (state1 == "IDLE" and state2 == "IDLE" and !Thrust.alphaFloor.getValue() and !Thrust.togaLk.getValue()) {
if (fmgc.Input.athr.getValue() and pts.Position.gearAglFt.getValue() > 50) {
fcu.athrOff("soft");
} elsif (pts.Position.gearAglFt.getValue() < 50) {
fcu.athrOff("none");
@ -212,66 +213,66 @@ var atoff_request = func {
}
var thrust_loop = maketimer(0.04, func {
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
engstate1 = getprop("engines/engine[0]/state");
engstate2 = getprop("engines/engine[1]/state");
thr1 = getprop("controls/engines/engine[0]/throttle-pos");
thr2 = getprop("controls/engines/engine[1]/throttle-pos");
eprtoga = getprop("systems/thrust/epr/toga-lim");
eprmct = getprop("systems/thrust/epr/mct-lim");
eprflx = getprop("systems/thrust/epr/flx-lim");
eprclb = getprop("systems/thrust/epr/clb-lim");
n1toga = getprop("systems/thrust/n1/toga-lim");
n1mct = getprop("systems/thrust/n1/mct-lim");
n1flx = getprop("systems/thrust/n1/flx-lim");
n1clb = getprop("systems/thrust/n1/clb-lim");
gs = getprop("velocities/groundspeed-kt");
if (getprop("FMGC/internal/flex-set") == 1 and getprop("systems/fadec/n1mode1") == 0 and getprop("systems/fadec/n1mode2") == 0 and getprop("gear/gear[1]/wow") == 1 and getprop("gear/gear[2]/wow") == 1 and gs < 40) {
setprop("systems/thrust/lim-flex", 1);
} else if (getprop("FMGC/internal/flex-set") == 0 or engstate1 != 3 or engstate2 != 3) {
setprop("systems/thrust/lim-flex", 0);
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
engstate1 = pts.Engines.Engine.state[0].getValue();
engstate2 = pts.Engines.Engine.state[1].getValue();
thr1 = pts.Controls.Engines.Engine.throttlePos[0].getValue();
thr2 = pts.Controls.Engines.Engine.throttlePos[1].getValue();
eprtoga = getprop("/systems/thrust/epr/toga-lim");
eprmct = getprop("/systems/thrust/epr/mct-lim");
eprflx = getprop("/systems/thrust/epr/flx-lim");
eprclb = getprop("/systems/thrust/epr/clb-lim");
n1toga = getprop("/systems/thrust/n1/toga-lim");
n1mct = getprop("/systems/thrust/n1/mct-lim");
n1flx = getprop("/systems/thrust/n1/flx-lim");
n1clb = getprop("/systems/thrust/n1/clb-lim");
gs = pts.Velocities.groundspeed.getValue();
if (fmgc.FMGCNodes.flexSet.getValue() and !Fadec.n1Mode[0].getValue() and !Fadec.n1Mode[1].getValue() and pts.Gear.wow[1].getValue() and pts.Gear.wow[2].getValue() and gs < 40) {
Thrust.limFlex.setValue(1);
} else if (!fmgc.FMGCNodes.flexSet.getValue() or engstate1 != 3 or engstate2 != 3) {
Thrust.limFlex.setValue(0);
}
if (getprop("controls/engines/engine[0]/reverser") == "1" or getprop("controls/engines/engine[1]/reverser") == "1") {
setprop("controls/engines/thrust-limit", "MREV");
setprop("controls/engines/epr-limit", 1.000);
setprop("controls/engines/n1-limit", 0.0);
} else if (getprop("gear/gear[1]/wow") == 0 or getprop("gear/gear[2]/wow") == 0 or (engstate1 != 3 and engstate2 != 3)) {
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");
setprop("controls/engines/epr-limit", eprtoga);
setprop("controls/engines/n1-limit", n1toga);
} else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("systems/thrust/lim-flex") == 0) {
setprop("controls/engines/thrust-limit", "MCT");
setprop("controls/engines/epr-limit", eprmct);
setprop("controls/engines/n1-limit", n1mct);
} else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("systems/thrust/lim-flex") == 1) {
setprop("controls/engines/thrust-limit", "FLX");
setprop("controls/engines/epr-limit", eprflx);
setprop("controls/engines/n1-limit", n1flx);
if (pts.Controls.Engines.Engine.reverser[0].getValue() or pts.Controls.Engines.Engine.reverser[1].getValue()) {
Thrust.thrustLimit.setValue("MREV");
Thrust.eprLimit.setValue(1.0);
Thrust.n1Limit.setValue(0.0);
} else if (!pts.Gear.wow[1].getValue() or !pts.Gear.wow[2].getValue() or (engstate1 != 3 and engstate2 != 3)) {
if ((state1 == "TOGA" or state2 == "TOGA" or (state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) or Thrust.alphaFloor.getValue() or Thrust.togaLk.getValue()) {
Thrust.thrustLimit.setValue("TOGA");
Thrust.eprLimit.setValue(eprtoga);
Thrust.n1Limit.setValue(n1toga);
} else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and !Thrust.limFlex.getValue()) {
Thrust.thrustLimit.setValue("MCT");
Thrust.eprLimit.setValue(eprmct);
Thrust.n1Limit.setValue(n1mct);
} else if ((state1 == "MCT" or state2 == "MCT" or (state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and Thrust.limFlex.getValue()) {
Thrust.thrustLimit.setValue("FLX");
Thrust.eprLimit.setValue(eprflx);
Thrust.n1Limit.setValue(n1flx);
} else if (state1 == "CL" or state2 == "CL" or state1 == "MAN" or state2 == "MAN" or state1 == "IDLE" or state2 == "IDLE") {
setprop("controls/engines/thrust-limit", "CLB");
setprop("controls/engines/epr-limit", eprclb);
setprop("controls/engines/n1-limit", n1clb);
Thrust.thrustLimit.setValue("CLB");
Thrust.eprLimit.setValue(eprclb);
Thrust.n1Limit.setValue(n1clb);
}
} else if (getprop("FMGC/internal/flex-set") == 1 and getprop("systems/fadec/n1mode1") == 0 and getprop("systems/fadec/n1mode2") == 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");
setprop("controls/engines/epr-limit", eprtoga);
setprop("controls/engines/n1-limit", n1toga);
} else if (fmgc.FMGCNodes.flexSet.getValue() and !Fadec.n1Mode[0].getValue() and !Fadec.n1Mode[1].getValue()) {
if ((state1 == "TOGA" or state2 == "TOGA" or (state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) or Thrust.alphaFloor.getValue() or Thrust.togaLk.getValue()) {
Thrust.thrustLimit.setValue("TOGA");
Thrust.eprLimit.setValue(eprtoga);
Thrust.n1Limit.setValue(n1toga);
} else {
setprop("controls/engines/thrust-limit", "FLX");
setprop("controls/engines/epr-limit", eprflx);
setprop("controls/engines/n1-limit", n1flx);
Thrust.thrustLimit.setValue("FLX");
Thrust.eprLimit.setValue(eprflx);
Thrust.n1Limit.setValue(n1flx);
}
} else {
setprop("controls/engines/thrust-limit", "TOGA");
setprop("controls/engines/epr-limit", eprtoga);
setprop("controls/engines/n1-limit", n1toga);
Thrust.thrustLimit.setValue("TOGA");
Thrust.eprLimit.setValue(eprtoga);
Thrust.n1Limit.setValue(n1toga);
}
alpha = getprop("fdm/jsbsim/aero/alpha-deg");
flaps = getprop("controls/flight/flaps-pos");
alpha = pts.Fdm.JSBsim.Aero.alpha.getValue();
flaps = pts.Controls.Flight.flapsPos.getValue();
if (flaps == 0) {
alphaProt = 9.5;
} else if (flaps == 1 or flaps == 2 or flaps == 3) {
@ -281,116 +282,117 @@ var thrust_loop = maketimer(0.04, func {
} else if (flaps == 5) {
alphaProt = 13.0;
}
togaLock = alphaProt - 1;
if (getprop("gear/gear[1]/wow") == 0 and getprop("gear/gear[2]/wow") == 0 and getprop("it-fbw/law") == 0 and (getprop("systems/thrust/eng-out") == 0 or (getprop("systems/thrust/eng-out") == 1 and flaps == 0)) and getprop("systems/fadec/n1mode1") == 0
and getprop("systems/fadec/n1mode2") == 0) {
if (!pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue() and fbw.FBW.activeLaw.getValue() == 0 and (!pts.Systems.Thrust.engOut.getValue() or (pts.Systems.Thrust.engOut.getValue() and flaps == 0)) and !Fadec.n1Mode[0].getValue()
and !Fadec.n1Mode[1].getValue()) {
if (alpha > alphaProt and pts.Position.gearAglFt.getValue() >= 100) {
setprop("systems/thrust/alpha-floor", 1);
setprop("systems/thrust/toga-lk", 0);
setprop("it-autoflight/input/athr", 1);
setprop("controls/engines/engine[0]/throttle-fdm", 0.99);
setprop("controls/engines/engine[1]/throttle-fdm", 0.99);
} else if (getprop("systems/thrust/alpha-floor") == 1 and alpha < togaLock) {
setprop("systems/thrust/alpha-floor", 0);
setprop("it-autoflight/input/athr", 1);
setprop("systems/thrust/toga-lk", 1);
setprop("controls/engines/engine[0]/throttle-fdm", 0.99);
setprop("controls/engines/engine[1]/throttle-fdm", 0.99);
Thrust.alphaFloor.setValue(1);
Thrust.togaLk.setValue(0);
fmgc.Input.athr.setValue(1);
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.99);
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.99);
} else if (Thrust.alphaFloor.getValue() and alpha < togaLock) {
fmgc.Input.athr.setValue(1);
Thrust.alphaFloor.setValue(0);
Thrust.togaLk.setValue(1);
pts.Controls.Engines.Engine.throttleFdm[0].setValue(0.99);
pts.Controls.Engines.Engine.throttleFdm[1].setValue(0.99);
}
} else {
setprop("systems/thrust/alpha-floor", 0);
setprop("systems/thrust/toga-lk", 0);
Thrust.alphaFloor.setValue(0);
Thrust.togaLk.setValue(0);
}
});
var unflex = func {
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
if (state1 != "MCT" and state2 != "MCT" and getprop("gear/gear[1]/wow") == 0 and getprop("gear/gear[2]/wow") == 0) {
setprop("systems/thrust/lim-flex", 0);
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if (state1 != "MCT" and state2 != "MCT" and !pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue()) {
Thrust.limFlex.setValue(0);
}
}
var thrust_flash = maketimer(0.5, func {
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if (getprop("gear/gear[1]/wow") == 0 and getprop("gear/gear[2]/wow") == 0 and (getprop("engines/engine[0]/state") != 3 or getprop("engines/engine[1]/state") != 3)) {
setprop("systems/thrust/eng-out", 1);
if (!pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue() and (pts.Engines.Engine.state[0].getValue() != 3 or pts.Engines.Engine.state[1].getValue() != 3)) {
pts.Systems.Thrust.engOut.setValue(1)
} else {
setprop("systems/thrust/eng-out", 0);
pts.Systems.Thrust.engOut.setValue(0)
}
if (state1 == "CL" and state2 == "CL" and getprop("systems/thrust/eng-out") != 1) {
setprop("systems/thrust/lvrclb", 0);
} else if (state1 == "MCT" and state2 == "MCT" and getprop("systems/thrust/lim-flex") != 1 and getprop("systems/thrust/eng-out") == 1) {
setprop("systems/thrust/lvrclb", 0);
if (state1 == "CL" and state2 == "CL" and pts.Systems.Thrust.engOut.getValue() != 1) {
Thrust.lvrClb.setValue(0);
} else if (state1 == "MCT" and state2 == "MCT" and !Thrust.limFlex.getValue() and pts.Systems.Thrust.engOut.getValue()) {
Thrust.lvrClb.setValue(0);
} else {
var status = getprop("systems/thrust/lvrclb");
var status = Thrust.lvrClb.getValue();
if (status == 0) {
if (getprop("gear/gear[0]/wow") == 0) {
if (getprop("systems/thrust/state1") == "MAN" or getprop("systems/thrust/state2") == "MAN") {
setprop("systems/thrust/lvrclb", 1);
if (!pts.Gear.wow[0].getValue()) {
if (pts.Systems.Thrust.state[0].getValue() == "MAN" or pts.Systems.Thrust.state[1].getValue() == "MAN") {
Thrust.lvrClb.setValue(1);
} else {
if (getprop("instrumentation/altimeter/indicated-altitude-ft") >= getprop("systems/thrust/clbreduc-ft") and getprop("gear/gear[1]/wow") == 0 and getprop("gear/gear[2]/wow") == 0) {
setprop("systems/thrust/lvrclb", 1);
} else if ((state1 == "CL" and state2 != "CL") or (state1 != "CL" and state2 == "CL") and getprop("systems/thrust/eng-out") != 1) {
setprop("systems/thrust/lvrclb", 1);
if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= Thrust.clbReduc.getValue() and !pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue()) {
Thrust.lvrClb.setValue(1);
} else if ((state1 == "CL" and state2 != "CL") or (state1 != "CL" and state2 == "CL") and pts.Systems.Thrust.engOut.getValue() != 1) {
Thrust.lvrClb.setValue(1);
} else {
setprop("systems/thrust/lvrclb", 0);
Thrust.lvrClb.setValue(0);
}
}
}
} else if (status == 1) {
setprop("systems/thrust/lvrclb", 0);
Thrust.lvrClb.setValue(0);
}
}
});
var lockThr = func() {
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
if ((state1 == "CL" and state2 == "CL" and getprop("systems/thrust/eng-out") == 0) or (state1 == "MCT" and state2 == "MCT" and getprop("systems/thrust/eng-out") == 1)) {
setprop("systems/thrust/thr-lock-time", getprop("sim/time/elapsed-sec"));
setprop("systems/thrust/thr-locked", 1);
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if ((state1 == "CL" and state2 == "CL" and !pts.Systems.Thrust.engOut.getValue()) or (state1 == "MCT" and state2 == "MCT" and pts.Systems.Thrust.engOut.getValue())) {
Thrust.Lock.thrLockTime.setValue(pts.Sim.Time.elapsedSec.getValue());
Thrust.Lock.thrLockCmd.setValue(1);
lockTimer.start();
}
}
var checkLockThr = func() {
if (getprop("systems/thrust/thr-lock-time") + 5 > getprop("sim/time/elapsed-sec")) { return; }
if (Thrust.Lock.thrLockTime.getValue() + 5 > pts.Sim.Time.elapsedSec.getValue()) { return; }
if (fmgc.Output.athr.getBoolValue()) {
lockTimer.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
return;
}
if (getprop("systems/thrust/thr-locked") == 0) {
if (!Thrust.Lock.thrLockCmd.getValue()) {
lockTimer.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
return;
}
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if ((state1 != "CL" and state2 != "CL" and getprop("systems/thrust/eng-out") == 0) or (state1 != "MCT" and state2 != "MCT" and getprop("systems/thrust/eng-out") == 1)) {
if ((state1 != "CL" and state2 != "CL" and !pts.Systems.Thrust.engOut.getValue()) or (state1 != "MCT" and state2 != "MCT" and pts.Systems.Thrust.engOut.getValue())) {
lockTimer.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
} elsif ((state1 == "CL" and state2 == "CL" and getprop("systems/thrust/eng-out") == 0) or (state1 == "MCT" and state2 == "MCT" and getprop("systems/thrust/eng-out") == 1)) {
setprop("systems/thrust/thr-locked-alert", 1);
setprop("systems/thrust/thr-lock-time", getprop("sim/time/elapsed-sec"));
setprop("systems/thrust/thr-locked-flash", 1);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
} elsif ((state1 == "CL" and state2 == "CL" and !pts.Systems.Thrust.engOut.getValue()) or (state1 == "MCT" and state2 == "MCT" and pts.Systems.Thrust.engOut.getValue())) {
Thrust.Lock.thrLockAlert.setValue(1);
Thrust.Lock.thrLockTime.setValue(pts.Sim.Time.elapsedSec.getValue());
Thrust.Lock.thrLockFlash.setValue(1);
lockTimer.stop();
lockTimer2.start();
}
@ -399,49 +401,49 @@ var checkLockThr = func() {
var checkLockThr2 = func() {
if (fmgc.Output.athr.getBoolValue()) {
lockTimer2.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
return;
}
if (getprop("systems/thrust/thr-locked") == 0) {
if (!Thrust.Lock.thrLockCmd.getValue()) {
lockTimer2.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
return;
}
if (getprop("systems/thrust/thr-lock-time") + 5 < getprop("sim/time/elapsed-sec")) {
setprop("systems/thrust/thr-locked-flash", 0);
if (Thrust.Lock.thrLockTime.getValue() + 5 < pts.Sim.Time.elapsedSec.getValue()) {
Thrust.Lock.thrLockFlash.setValue(0);
settimer(func() {
setprop("systems/thrust/thr-locked-flash", 1);
setprop("systems/thrust/thr-lock-time", getprop("sim/time/elapsed-sec"));
Thrust.Lock.thrLockFlash.setValue(1);
Thrust.Lock.thrLockTime.setValue(pts.Sim.Time.elapsedSec.getValue());
ecam.athr_lock.noRepeat = 0;
ecam.athr_lock.noRepeat2 = 0;
}, 0.2);
}
state1 = getprop("systems/thrust/state1");
state2 = getprop("systems/thrust/state2");
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
if ((state1 != "CL" and state2 != "CL" and getprop("systems/thrust/eng-out") == 0) or (state1 != "MCT" and state2 != "MCT" and getprop("systems/thrust/eng-out") == 1)) {
if ((state1 != "CL" and state2 != "CL" and !pts.Systems.Thrust.engOut.getValue()) or (state1 != "MCT" and state2 != "MCT" and pts.Systems.Thrust.engOut.getValue())) {
lockTimer2.stop();
setprop("systems/thrust/thr-locked", 0);
setprop("systems/thrust/thr-locked-alert", 0);
setprop("systems/thrust/thr-lock-time", 0);
setprop("systems/thrust/thr-locked-flash", 0);
Thrust.Lock.thrLockCmd.setValue(0);
Thrust.Lock.thrLockAlert.setValue(0);
Thrust.Lock.thrLockFlash.setValue(0);
Thrust.Lock.thrLockTime.setValue(0);
}
}
setlistener("/systems/thrust/thr-locked", func {
if (getprop("systems/thrust/thr-locked") == 1) {
setprop("systems/thrust/thr-lock-cmd[0]", getprop("controls/engines/engine[0]/throttle-output"));
setprop("systems/thrust/thr-lock-cmd[1]", getprop("controls/engines/engine[1]/throttle-output"));
if (Thrust.Lock.thrLockCmd.getValue()) {
Thrust.Lock.thrLockCmdN1[0].setValue(pts.Controls.Engines.Engine.throttleOutput[0].getValue());
Thrust.Lock.thrLockCmdN1[1].setValue(pts.Controls.Engines.Engine.throttleOutput[1].getValue());
}
}, 0, 0);