1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-09-25 16:40:46 +01:00
commit e0fbf923af
14 changed files with 668 additions and 637 deletions

View file

@ -209,11 +209,6 @@
<autopilot n="13">
<path>Aircraft/A320-family/Systems/ecam-proprules.xml</path>
</autopilot>
<wingflexer include="Systems/wingflexer-params.xml"/>
<property-rule n="100">
<name>Generic Wing Flexer</name>
<path>Aircraft/Generic/wingflexer.xml</path>
</property-rule>
<path>Aircraft/A320-family/Systems/pitot-static.xml</path>
</systems>
@ -731,6 +726,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>
@ -1150,6 +1148,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>
@ -1250,6 +1254,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>
@ -1260,6 +1265,7 @@
<fac2 type="bool">0</fac2>
<yawdamper-active type="bool">0</yawdamper-active>
</fctl>
<fire n="0">
<apu>
<temperature type="double">0</temperature>
@ -1307,6 +1313,7 @@
<fuel-used-2 type="double">0</fuel-used-2>
<mode-fault type="bool">0</mode-fault>
</fuel>
<hydraulic n="0">
<sources>
<ptu>
@ -1416,6 +1423,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,32 +144,7 @@ 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);
var fadecPowerUp = props.globals.getNode("/systems/fadec/powerup", 1);
var fuel_flow1 = props.globals.getNode("/engines/engine[0]/fuel-flow_actual", 1);
var fuel_flow2 = props.globals.getNode("/engines/engine[1]/fuel-flow_actual", 1);
var fuel_left_outer_temp = props.globals.getNode("/consumables/fuel/tank[0]/temperature_degC", 1);
@ -226,7 +195,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 +221,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 +711,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 +759,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 +805,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 +819,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 +1899,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 +1907,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 +1915,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 +2092,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 +2106,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 +2120,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 +2134,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 +2148,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 +2162,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 +2176,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 +2190,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 +2204,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 +2218,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 +2233,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 +2340,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 +2348,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 {
@ -2403,7 +2372,7 @@ var canvas_lowerECAM_fuel = {
me["FFlow-weight-unit"].setText("LBS/MIN");
}
if (fadec1.getValue() and fadec2.getValue() or fadecPowerUp.getValue()) {
if (fadec.FADEC.Power.powered1.getValue() and fadec.FADEC.Power.powered2.getValue() or fadec.FADEC.Power.powerup.getValue()) {
me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941);
if (_weight_kgs == 1) {
me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round(((fuel_flow1.getValue() + fuel_flow2.getValue()) * LBS2KGS) / 60, 10)));
@ -3238,7 +3207,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 +3221,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 +3235,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 +3249,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 +3263,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 +3277,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 +3291,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 +3305,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 +3319,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 +3333,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 +3474,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

@ -55,6 +55,11 @@
<command>property-toggle</command>
<property>controls/fadec/n1mode1</property>
</binding>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/eng1-n1</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
@ -70,28 +75,23 @@
<animation>
<type>pick</type>
<object-name>Eng1N1Btn</object-name>
<object-name>Eng1N1Btn2O</object-name>
<object-name>Eng1N1Prot</object-name>
<action>
<button>1</button>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<command>property-toggle</command>
<property>controls/OH/protectors/eng1-n1</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/eng1-n1</property>
<value>0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/oh-cover", 1);</script>
</binding>
</mod-up>
<binding>
<condition>
<not>
<property>controls/OH/protectors/eng1-n1</property>
</not>
</condition>
<command>nasal</command>
<script>setprop("sim/sounde/oh-cover", 1);</script>
</binding>
</action>
</animation>
@ -156,6 +156,11 @@
<command>property-toggle</command>
<property>controls/fadec/n1mode2</property>
</binding>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/eng2-n1</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
@ -171,28 +176,23 @@
<animation>
<type>pick</type>
<object-name>Eng2N1Btn</object-name>
<object-name>Eng2N1Btn2O</object-name>
<object-name>Eng2N1Prot</object-name>
<action>
<button>1</button>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<command>property-toggle</command>
<property>controls/OH/protectors/eng2-n1</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/eng2-n1</property>
<value>0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("sim/sounde/oh-cover", 1);</script>
</binding>
</mod-up>
<binding>
<condition>
<not>
<property>controls/OH/protectors/eng2-n1</property>
</not>
</condition>
<command>nasal</command>
<script>setprop("sim/sounde/oh-cover", 1);</script>
</binding>
</action>
</animation>

View file

@ -44,12 +44,6 @@ var eng_option = props.globals.getNode("/options/eng", 1);
var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1);
var rev_1 = props.globals.getNode("/engines/engine[0]/reverser-pos-norm", 1);
var rev_2 = props.globals.getNode("/engines/engine[1]/reverser-pos-norm", 1);
var eng1_n1mode = props.globals.getNode("/systems/fadec/eng1/n1", 1);
var eng1_eprmode = props.globals.getNode("/systems/fadec/eng1/epr", 1);
var eng2_n1mode = props.globals.getNode("/systems/fadec/eng2/n1", 1);
var eng2_eprmode = props.globals.getNode("/systems/fadec/eng2/epr", 1);
var eng1_n2mode = props.globals.getNode("/systems/fadec/eng1/n2", 1);
var eng2_n2mode = props.globals.getNode("/systems/fadec/eng2/n2", 1);
var fuel = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1);
var modeautobrake = props.globals.getNode("/controls/autobrake/mode", 1);
var speedbrakearm = props.globals.getNode("/controls/flight/speedbrake-arm", 1);
@ -67,18 +61,12 @@ var eng1_epr = props.globals.getNode("/engines/engine[0]/epr-actual", 1);
var eng2_epr = props.globals.getNode("/engines/engine[1]/epr-actual", 1);
var eng1_egt = props.globals.getNode("/engines/engine[0]/egt-actual", 1);
var eng2_egt = props.globals.getNode("/engines/engine[1]/egt-actual", 1);
var eng1_egtmode = props.globals.getNode("/systems/fadec/eng1/egt", 1);
var eng2_egtmode = props.globals.getNode("/systems/fadec/eng2/egt", 1);
var eng1_ffmode = props.globals.getNode("/systems/fadec/eng1/ff", 1);
var eng2_ffmode = props.globals.getNode("/systems/fadec/eng2/ff", 1);
var fadecpower_1 = props.globals.getNode("/systems/fadec/powered1", 1);
var fadecpower_2 = props.globals.getNode("/systems/fadec/powered2", 1);
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);
@ -198,10 +186,10 @@ var canvas_upperECAM_base = {
rev_1_cur = rev_1.getValue();
rev_2_cur = rev_2.getValue();
cur_eng_option = eng_option.getValue();
if (rev_1_cur >= 0.01 and eng1_n1mode.getValue() == 1 and cur_eng_option == "CFM") {
if (rev_1_cur >= 0.01 and fadec.FADEC.Eng1.n1 == 1 and cur_eng_option == "CFM") {
me["REV1"].show();
me["REV1-box"].show();
} else if (rev_1_cur >= 0.01 and eng1_eprmode.getValue() == 1 and cur_eng_option == "IAE") {
} else if (rev_1_cur >= 0.01 and fadec.FADEC.Eng1.epr == 1 and cur_eng_option == "IAE") {
me["REV1"].show();
me["REV1-box"].show();
} else {
@ -215,10 +203,10 @@ var canvas_upperECAM_base = {
me["REV1"].setColor(0.7333,0.3803,0);
}
if (rev_2_cur >= 0.01 and eng2_n1mode.getValue() == 1 and cur_eng_option == "CFM") {
if (rev_2_cur >= 0.01 and fadec.FADEC.Eng2.n1 == 1 and cur_eng_option == "CFM") {
me["REV2"].show();
me["REV2-box"].show();
} else if (rev_2_cur >= 0.01 and eng2_eprmode.getValue() == 1 and cur_eng_option == "IAE") {
} else if (rev_2_cur >= 0.01 and fadec.FADEC.Eng2.epr == 1 and cur_eng_option == "IAE") {
me["REV2"].show();
me["REV2-box"].show();
} else {
@ -656,12 +644,8 @@ var canvas_upperECAM_cfm_eis2 = {
N1_lim_cur = N1_lim.getValue();
N1_thr_1_act = N1_thr_1.getValue();
N1_thr_2_act = N1_thr_2.getValue();
n1mode_1 = eng1_n1mode.getValue();
n1mode_2 = eng2_n1mode.getValue();
rev_1_act = rev_1.getValue();
rev_2_act = rev_2.getValue();
ff_1 = eng1_ffmode.getValue();
ff_2 = eng2_ffmode.getValue();
EGT_1_cur = EGT_1.getValue();
EGT_2_cur = EGT_2.getValue();
n2cur_1 = eng1_n2.getValue();
@ -681,7 +665,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N12-thr"].setRotation((N1_thr_2_act + 90) * D2R);
me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R);
if (n1mode_1 == 1) {
if (fadec.FADEC.Eng1.n1 == 1) {
me["N11-scale"].setColor(0.8078,0.8039,0.8078);
me["N11-scale2"].setColor(1,0,0);
me["N11"].show();
@ -711,13 +695,13 @@ var canvas_upperECAM_cfm_eis2 = {
me["N11-XX-box"].show();
}
if (rev_1_act < 0.01 and n1mode_1 == 1) {
if (rev_1_act < 0.01 and fadec.FADEC.Eng1.n1 == 1) {
me["N11-thr"].show();
} else {
me["N11-thr"].hide();
}
if (n1mode_2 == 1) {
if (fadec.FADEC.Eng2.n1 == 1) {
me["N12-scale"].setColor(0.8078,0.8039,0.8078);
me["N12-scale2"].setColor(1,0,0);
me["N12"].show();
@ -747,7 +731,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N12-XX-box"].show();
}
if (rev_2_act < 0.01 and n1mode_2 == 1) {
if (rev_2_act < 0.01 and fadec.FADEC.Eng2.n1 == 1) {
me["N12-thr"].show();
} else {
me["N12-thr"].hide();
@ -760,7 +744,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R);
me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R);
if (eng1_egtmode.getValue() == 1) {
if (fadec.FADEC.Eng1.egt == 1) {
me["EGT1-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT1-scale2"].setColor(1,0,0);
me["EGT1"].show();
@ -778,7 +762,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["EGT1-XX"].show();
}
if (eng2_egtmode.getValue() == 1) {
if (fadec.FADEC.Eng2.egt == 1) {
me["EGT2-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT2-scale2"].setColor(1,0,0);
me["EGT2"].show();
@ -803,7 +787,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N22"].setText(sprintf("%s", math.floor(n2cur_2 + 0.05)));
me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(n2cur_2 + 0.05, 1))));
if (eng1_n2mode.getValue() == 1) {
if (fadec.FADEC.Eng1.n2 == 1) {
me["N21"].show();
me["N21-decimal"].show();
me["N21-decpnt"].show();
@ -815,7 +799,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N21-XX"].show();
}
if (eng2_n2mode.getValue() == 1) {
if (fadec.FADEC.Eng2.n2 == 1) {
me["N22"].show();
me["N22-decimal"].show();
me["N22-decpnt"].show();
@ -838,7 +822,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["FFlow-weight-unit"].setText("LBS/H");
}
if (ff_1 == 1) {
if (fadec.FADEC.Eng1.ff == 1) {
me["FF1"].show();
me["FF1-XX"].hide();
} else {
@ -846,7 +830,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["FF1-XX"].show();
}
if (ff_2 == 1) {
if (fadec.FADEC.Eng2.ff == 1) {
me["FF2"].show();
me["FF2-XX"].hide();
} else {
@ -913,12 +897,8 @@ var canvas_upperECAM_iae_eis2 = {
EPR_lim_cur = EPR_lim.getValue();
EPR_thr_1_act = EPR_thr_1.getValue();
EPR_thr_2_act = EPR_thr_2.getValue();
eprmode1 = eng1_eprmode.getValue();
eprmode2 = eng2_eprmode.getValue();
rev_1_act = rev_1.getValue();
rev_2_act = rev_2.getValue();
ff_1 = eng1_ffmode.getValue();
ff_2 = eng2_ffmode.getValue();
EGT_1_cur = EGT_1.getValue();
EGT_2_cur = EGT_2.getValue();
n2cur_1 = eng1_n2.getValue();
@ -937,7 +917,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R);
me["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R);
if (eprmode1 == 1) {
if (fadec.FADEC.Eng1.epr == 1) {
me["EPR1-scale"].setColor(0.8078,0.8039,0.8078);
me["EPR1"].show();
me["EPR1-decpnt"].show();
@ -963,13 +943,13 @@ var canvas_upperECAM_iae_eis2 = {
me["EPR1-XX2"].show();
}
if (rev_1_act < 0.01 and eprmode1 == 1) {
if (rev_1_act < 0.01 and fadec.FADEC.Eng1.epr == 1) {
me["EPR1-thr"].show();
} else {
me["EPR1-thr"].hide();
}
if (eprmode2 == 1) {
if (fadec.FADEC.Eng2.epr == 1) {
me["EPR2-scale"].setColor(0.8078,0.8039,0.8078);
me["EPR2"].show();
me["EPR2-decpnt"].show();
@ -995,7 +975,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EPR2-XX2"].show();
}
if (rev_2_act < 0.01 and eprmode2 == 1) {
if (rev_2_act < 0.01 and fadec.FADEC.Eng2.epr == 1) {
me["EPR2-thr"].show();
} else {
me["EPR2-thr"].hide();
@ -1008,7 +988,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R);
me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R);
if (eng1_egtmode.getValue() == 1) {
if (fadec.FADEC.Eng1.egt == 1) {
me["EGT1-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT1-scale2"].setColor(1,0,0);
me["EGT1"].show();
@ -1026,7 +1006,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EGT1-XX"].show();
}
if (eng2_egtmode.getValue() == 1) {
if (fadec.FADEC.Eng2.egt == 1) {
me["EGT2-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT2-scale2"].setColor(1,0,0);
me["EGT2"].show();
@ -1059,7 +1039,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R);
me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R);
if (eng1_n1mode.getValue() == 1) {
if (fadec.FADEC.Eng1.n1 == 1) {
me["N11-scale"].setColor(0.8078,0.8039,0.8078);
me["N11-scale2"].setColor(1,0,0);
me["N11"].show();
@ -1081,7 +1061,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N11-XX"].show();
}
if (eng2_n1mode.getValue() == 1) {
if (fadec.FADEC.Eng2.n1 == 1) {
me["N12-scale"].setColor(0.8078,0.8039,0.8078);
me["N12-scale2"].setColor(1,0,0);
me["N12"].show();
@ -1103,7 +1083,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N12-XX"].show();
}
if (eng1_n1mode.getValue() == 1 and n1mode1.getValue() == 1) {
if (fadec.FADEC.Eng1.n1 == 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 +1091,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N11-ylim"].hide();
}
if (eng2_n1mode.getValue() == 1 and n1mode2.getValue() == 1) {
if (fadec.FADEC.Eng2.n1 == 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 {
@ -1125,7 +1105,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N22"].setText(sprintf("%s", math.floor(eng2_n2.getValue() + 0.05)));
me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(eng2_n2.getValue() + 0.05, 1))));
if (eng1_n2mode.getValue() == 1) {
if (fadec.FADEC.Eng1.n2 == 1) {
me["N21"].show();
me["N21-decimal"].show();
me["N21-decpnt"].show();
@ -1137,7 +1117,7 @@ var canvas_upperECAM_iae_eis2 = {
me["N21-XX"].show();
}
if (eng2_n2mode.getValue() == 1) {
if (fadec.FADEC.Eng2.n2 == 1) {
me["N22"].show();
me["N22-decimal"].show();
me["N22-decpnt"].show();
@ -1162,7 +1142,7 @@ var canvas_upperECAM_iae_eis2 = {
me["FFlow2-weight-unit"].setText("LBS/H");
}
if (ff_1 == 1) {
if (fadec.FADEC.Eng1.ff == 1) {
me["FF1"].show();
me["FF1-XX"].hide();
} else {
@ -1170,7 +1150,7 @@ var canvas_upperECAM_iae_eis2 = {
me["FF1-XX"].show();
}
if (ff_2 == 1) {
if (fadec.FADEC.Eng2.ff == 1) {
me["FF2"].show();
me["FF2-XX"].hide();
} 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

@ -259,6 +259,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,10 @@ var Environment = {
var Fdm = {
JSBsim: {
Aero: {
alpha: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg"),
alphaNorm: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg-norm"),
},
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 +191,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

@ -2,139 +2,172 @@
# Copyright (c) 2020 Josh Davidson (Octal450)
setprop("/systems/fadec/n1mode1", 0); # Doesn't do anything, just here for other logic #
setprop("/systems/fadec/n1mode2", 0); # Doesn't do anything, just here for other logic #
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/n1", 1);
setprop("/systems/fadec/eng1/n2", 1);
setprop("/systems/fadec/eng1/ff", 1);
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/n1", 1);
setprop("/systems/fadec/eng2/n2", 1);
setprop("/systems/fadec/eng2/ff", 1);
setprop("/systems/fadec/power-avail", 0);
setprop("/systems/fadec/powered1", 0);
setprop("/systems/fadec/powered2", 0);
setprop("/systems/fadec/powered-time", -300);
setprop("/systems/fadec/powerup", 0);
setprop("/systems/fadec/eng1-master-count", 0);
setprop("/systems/fadec/eng1-master-time", -300);
setprop("/systems/fadec/eng1-off-power", 0);
setprop("/systems/fadec/eng2-master-count", 0);
setprop("/systems/fadec/eng2-master-time", -300);
setprop("/systems/fadec/eng2-off-power", 0);
var powerAvailTemp = nil;
var master1 = nil;
var master2 = nil;
var state1 = nil;
var state2 = nil;
var modeSel = nil;
var powered1 = nil;
var powered2 = nil;
var powerup = nil;
var N11 = nil;
var N12 = nil;
var N21 = nil;
var N22 = nil;
var FADEC = {
Power: {
powered1: props.globals.initNode("/systems/fadec/powered1", 0, "BOOL"),
powered2: props.globals.initNode("/systems/fadec/powered2", 0, "BOOL"),
powerup: props.globals.initNode("/systems/fadec/powerup", 0, "BOOL"),
powerAvail: props.globals.initNode("/systems/fadec/power-avail", 0, "BOOL"),
poweredTime: props.globals.initNode("/systems/fadec/powered-time", 0, "DOUBLE"),
},
Eng1: {
eng1Time: props.globals.initNode("/systems/fadec/eng1-master-time", -300, "DOUBLE"),
eng1Off: props.globals.initNode("/systems/fadec/eng1-off-power", 0, "BOOL"),
eng1Counting: 0,
epr: 0,
egt: 0,
n1: 0,
n2: 0,
ff: 0,
},
Eng2: {
eng2Time: props.globals.initNode("/systems/fadec/eng2-master-time", -300, "DOUBLE"),
eng2Off: props.globals.initNode("/systems/fadec/eng2-off-power", 0, "BOOL"),
eng2Counting: 0,
epr: 0,
egt: 0,
n1: 0,
n2: 0,
ff: 0,
},
Switches: {
n1ModeSwitch1: props.globals.initNode("/controls/fadec/n1mode1", 0, "BOOL"),
n1ModeSwitch2: props.globals.initNode("/controls/fadec/n1mode2", 0, "BOOL"),
},
Modes: {
n1Mode1: props.globals.initNode("/systems/fadec/n1mode1", 0, "BOOL"), # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
n1Mode2: props.globals.initNode("/systems/fadec/n1mode2", 0, "BOOL"),
},
init: func() {
setprop("/systems/fadec/powered-time", 0);
setprop("/systems/fadec/eng1-master-time", -300);
setprop("/systems/fadec/eng2-master-time", -300);
me.Power.poweredTime.setValue(-300);
me.Eng1.eng1Time.setValue(-300);
me.Eng2.eng2Time.setValue(-300);
},
loop: func() {
var ac1 = systems.ELEC.Bus.ac1.getValue();
var ac2 = systems.ELEC.Bus.ac2.getValue();
var acess = systems.ELEC.Bus.acEss.getValue();
var state1 = pts.Engines.Engine.state[0].getValue();
var state2 = pts.Engines.Engine.state[1].getValue();
var master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
var master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
var modeSel = pts.Controls.Engines.startSw.getValue();
var elapsedSec = pts.Sim.Time.elapsedSec.getValue();
powerAvailTemp = me.Power.powerAvail.getValue();
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
if (getprop("/systems/fadec/power-avail") != 1) {
setprop("/systems/fadec/powered-time", elapsedSec);
setprop("/systems/fadec/power-avail", 1);
if (systems.ELEC.Bus.ac1.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110 or systems.ELEC.Bus.acEss.getValue() >= 110) {
if (powerAvailTemp != 1) {
me.Power.poweredTime.setValue(elapsedSec);
me.Power.powerAvail.setValue(1);
}
} else {
if (getprop("/systems/fadec/power-avail") != 0) {
setprop("/systems/fadec/power-avail", 0);
if (powerAvailTemp != 0) {
me.Power.powerAvail.setValue(0);
}
}
var powerAvail = getprop("/systems/fadec/power-avail");
powerAvailTemp = me.Power.powerAvail.getValue();
if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/powerup", 1);
if (me.Power.poweredTime.getValue() + 300 >= elapsedSec) {
if (!me.Power.powerup.getValue()) {
me.Power.powerup.setValue(1);
}
} else {
setprop("/systems/fadec/powerup", 0);
if (me.Power.powerup.getValue()) {
me.Power.powerup.setValue(0);
}
}
master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
if (master1 == 1) {
if (getprop("/systems/fadec/eng1-master-count") != 1) {
setprop("/systems/fadec/eng1-master-time", elapsedSec);
setprop("/systems/fadec/eng1-master-count", 1);
if (me.Eng1.eng1Counting != 1) {
me.Eng1.eng1Time.setValue(elapsedSec);
me.Eng1.eng1Counting = 1;
}
} else {
if (getprop("/systems/fadec/eng1-master-count") != 0) {
setprop("/systems/fadec/eng1-master-count", 0);
if (me.Eng1.eng1Counting != 0) {
me.Eng1.eng1Counting = 0;
}
}
if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/eng1-off-power", 1);
if (me.Eng1.eng1Time.getValue() + 300 >= elapsedSec) {
me.Eng1.eng1Off.setValue(1);
} else {
setprop("/systems/fadec/eng1-off-power", 0);
me.Eng1.eng1Off.setValue(0);
}
master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
if (master2 == 1) {
if (getprop("/systems/fadec/eng2-master-count") != 1) {
setprop("/systems/fadec/eng2-master-time", elapsedSec);
setprop("/systems/fadec/eng2-master-count", 1);
if (me.Eng2.eng2Counting != 1) {
me.Eng2.eng2Time.setValue(elapsedSec);
me.Eng2.eng2Counting = 1;
}
} else {
if (getprop("/systems/fadec/eng2-master-count") != 0) {
setprop("/systems/fadec/eng2-master-count", 0);
if (me.Eng2.eng2Counting != 0) {
me.Eng2.eng2Counting = 0;
}
}
if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/eng2-off-power", 1);
if (me.Eng2.eng2Time.getValue() + 300 >= elapsedSec) {
me.Eng2.eng2Off.setValue(1);
} else {
setprop("/systems/fadec/eng2-off-power", 0);
me.Eng2.eng2Off.setValue(0);
}
state1 = pts.Engines.Engine.state[0].getValue();
state2 = pts.Engines.Engine.state[1].getValue();
modeSel = pts.Controls.Engines.startSw.getValue();
if (state1 == 3) {
setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) {
setprop("/systems/fadec/powered1", 1);
me.Power.powered1.setValue(1);
} else if (powerAvailTemp and modeSel == 2) {
me.Power.powered1.setValue(1);
} else {
setprop("/systems/fadec/powered1", 0);
me.Power.powered1.setValue(0);
}
if (state2 == 3) {
setprop("/systems/fadec/powered2", 1);
} else if (powerAvail and modeSel == 2) {
setprop("/systems/fadec/powered2", 1);
me.Power.powered2.setValue(1);
} else if (powerAvailTemp and modeSel == 2) {
me.Power.powered2.setValue(1);
} else {
setprop("/systems/fadec/powered2", 0);
me.Power.powered2.setValue(0);
}
var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("/systems/fadec/powered2");
powered1 = me.Power.powered1.getValue();
powered2 = me.Power.powered2.getValue();
powerup = me.Power.powerup.getValue();
if (powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) {
setprop("/systems/fadec/eng1/n1", 1);
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/n2", 1);
setprop("/systems/fadec/eng1/ff", 1);
if (powered1 or powerup or me.Eng1.eng1Off.getValue()) {
me.Eng1.n1 = 1;
me.Eng1.n2 = 1;
me.Eng1.egt = 1;
me.Eng1.ff = 1;
} else {
setprop("/systems/fadec/eng1/n1", 0);
setprop("/systems/fadec/eng1/egt", 0);
setprop("/systems/fadec/eng1/n2", 0);
setprop("/systems/fadec/eng1/ff", 0);
me.Eng1.n1 = 0;
me.Eng1.n2 = 0;
me.Eng1.egt = 0;
me.Eng1.ff = 0;
}
if (powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) {
setprop("/systems/fadec/eng2/n1", 1);
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/n2", 1);
setprop("/systems/fadec/eng2/ff", 1);
if (powered2 or powerup or me.Eng2.eng2Off.getValue()) {
me.Eng2.n1 = 1;
me.Eng2.n2 = 1;
me.Eng2.egt = 1;
me.Eng2.ff = 1;
} else {
setprop("/systems/fadec/eng2/n1", 0);
setprop("/systems/fadec/eng2/egt", 0);
setprop("/systems/fadec/eng2/n2", 0);
setprop("/systems/fadec/eng2/ff", 0);
me.Eng2.n1 = 0;
me.Eng2.n2 = 0;
me.Eng2.egt = 0;
me.Eng2.ff = 0;
}
},
};

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-norm");
flaps = getprop("controls/flight/flaps-pos");
alpha = pts.Fdm.JSBsim.Aero.alphaNorm.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);

View file

@ -1,192 +1,222 @@
# A3XX IAE FADEC by Joshua Davidson (Octal450)
# Copyright (c) 2020 Josh Davidson (Octal450)
setprop("/controls/fadec/n1mode1", 0);
setprop("/controls/fadec/n1mode2", 0);
setprop("/systems/fadec/n1mode1", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
setprop("/systems/fadec/n1mode2", 0); # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
setprop("/systems/fadec/eng1/epr", 1);
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/n1", 1);
setprop("/systems/fadec/eng1/n2", 1);
setprop("/systems/fadec/eng1/ff", 1);
setprop("/systems/fadec/eng2/epr", 1);
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/n1", 1);
setprop("/systems/fadec/eng2/n2", 1);
setprop("/systems/fadec/eng2/ff", 1);
setprop("/systems/fadec/power-avail", 0);
setprop("/systems/fadec/powered1", 0);
setprop("/systems/fadec/powered2", 0);
setprop("/systems/fadec/powered-time", -300);
setprop("/systems/fadec/powerup", 0);
setprop("/systems/fadec/eng1-master-count", 0);
setprop("/systems/fadec/eng1-master-time", -300);
setprop("/systems/fadec/eng1-off-power", 0);
setprop("/systems/fadec/eng2-master-count", 0);
setprop("/systems/fadec/eng2-master-time", -300);
setprop("/systems/fadec/eng2-off-power", 0);
var powerAvailTemp = nil;
var master1 = nil;
var master2 = nil;
var state1 = nil;
var state2 = nil;
var modeSel = nil;
var powered1 = nil;
var powered2 = nil;
var powerup = nil;
var N11 = nil;
var N12 = nil;
var N21 = nil;
var N22 = nil;
var FADEC = {
Power: {
powered1: props.globals.initNode("/systems/fadec/powered1", 0, "BOOL"),
powered2: props.globals.initNode("/systems/fadec/powered2", 0, "BOOL"),
powerup: props.globals.initNode("/systems/fadec/powerup", 0, "BOOL"),
powerAvail: props.globals.initNode("/systems/fadec/power-avail", 0, "BOOL"),
poweredTime: props.globals.initNode("/systems/fadec/powered-time", 0, "DOUBLE"),
},
Eng1: {
eng1Time: props.globals.initNode("/systems/fadec/eng1-master-time", -300, "DOUBLE"),
eng1Off: props.globals.initNode("/systems/fadec/eng1-off-power", 0, "BOOL"),
eng1Counting: 0,
epr: 0,
egt: 0,
n1: 0,
n2: 0,
ff: 0,
},
Eng2: {
eng2Time: props.globals.initNode("/systems/fadec/eng2-master-time", -300, "DOUBLE"),
eng2Off: props.globals.initNode("/systems/fadec/eng2-off-power", 0, "BOOL"),
eng2Counting: 0,
epr: 0,
egt: 0,
n1: 0,
n2: 0,
ff: 0,
},
Switches: {
n1ModeSwitch1: props.globals.initNode("/controls/fadec/n1mode1", 0, "BOOL"),
n1ModeSwitch2: props.globals.initNode("/controls/fadec/n1mode2", 0, "BOOL"),
},
Modes: {
n1Mode1: props.globals.initNode("/systems/fadec/n1mode1", 0, "BOOL"), # 0 == EPR, 1 == N1 Rated, 2 == N1 Unrated #
n1Mode2: props.globals.initNode("/systems/fadec/n1mode2", 0, "BOOL"),
},
# Copyright (c) 2020 Josh Davidson (Octal450)
init: func() {
setprop("/systems/fadec/powered-time", 0);
setprop("/systems/fadec/eng1-master-time", -300);
setprop("/systems/fadec/eng2-master-time", -300);
me.Power.poweredTime.setValue(-300);
me.Eng1.eng1Time.setValue(-300);
me.Eng2.eng2Time.setValue(-300);
},
loop: func() {
var ac1 = systems.ELEC.Bus.ac1.getValue();
var ac2 = systems.ELEC.Bus.ac2.getValue();
var acess = systems.ELEC.Bus.acEss.getValue();
var state1 = pts.Engines.Engine.state[0].getValue();
var state2 = pts.Engines.Engine.state[1].getValue();
var master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
var master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
var modeSel = pts.Controls.Engines.startSw.getValue();
var elapsedSec = pts.Sim.Time.elapsedSec.getValue();
var N1Mode1_sw = getprop("/controls/fadec/n1mode1");
var N1Mode2_sw = getprop("/controls/fadec/n1mode2");
powerAvailTemp = me.Power.powerAvail.getValue();
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
if (getprop("/systems/fadec/power-avail") != 1) {
setprop("/systems/fadec/powered-time", elapsedSec);
setprop("/systems/fadec/power-avail", 1);
if (systems.ELEC.Bus.ac1.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110 or systems.ELEC.Bus.acEss.getValue() >= 110) {
if (powerAvailTemp != 1) {
me.Power.poweredTime.setValue(elapsedSec);
me.Power.powerAvail.setValue(1);
}
} else {
if (getprop("/systems/fadec/power-avail") != 0) {
setprop("/systems/fadec/power-avail", 0);
if (powerAvailTemp != 0) {
me.Power.powerAvail.setValue(0);
}
}
var powerAvail = getprop("/systems/fadec/power-avail");
powerAvailTemp = me.Power.powerAvail.getValue();
if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/powerup", 1);
if (me.Power.poweredTime.getValue() + 300 >= elapsedSec) {
if (!me.Power.powerup.getValue()) {
me.Power.powerup.setValue(1);
}
} else {
setprop("/systems/fadec/powerup", 0);
if (me.Power.powerup.getValue()) {
me.Power.powerup.setValue(0);
}
}
master1 = pts.Controls.Engines.Engine.cutoffSw[0].getValue();
if (master1 == 1) {
if (getprop("/systems/fadec/eng1-master-count") != 1) {
setprop("/systems/fadec/eng1-master-time", elapsedSec);
setprop("/systems/fadec/eng1-master-count", 1);
if (me.Eng1.eng1Counting != 1) {
me.Eng1.eng1Time.setValue(elapsedSec);
me.Eng1.eng1Counting = 1;
}
} else {
if (getprop("/systems/fadec/eng1-master-count") != 0) {
setprop("/systems/fadec/eng1-master-count", 0);
if (me.Eng1.eng1Counting != 0) {
me.Eng1.eng1Counting = 0;
}
}
if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/eng1-off-power", 1);
if (me.Eng1.eng1Time.getValue() + 300 >= elapsedSec) {
me.Eng1.eng1Off.setValue(1);
} else {
setprop("/systems/fadec/eng1-off-power", 0);
me.Eng1.eng1Off.setValue(0);
}
master2 = pts.Controls.Engines.Engine.cutoffSw[1].getValue();
if (master2 == 1) {
if (getprop("/systems/fadec/eng2-master-count") != 1) {
setprop("/systems/fadec/eng2-master-time", elapsedSec);
setprop("/systems/fadec/eng2-master-count", 1);
if (me.Eng2.eng2Counting != 1) {
me.Eng2.eng2Time.setValue(elapsedSec);
me.Eng2.eng2Counting = 1;
}
} else {
if (getprop("/systems/fadec/eng2-master-count") != 0) {
setprop("/systems/fadec/eng2-master-count", 0);
if (me.Eng2.eng2Counting != 0) {
me.Eng2.eng2Counting = 0;
}
}
if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) {
setprop("/systems/fadec/eng2-off-power", 1);
if (me.Eng2.eng2Time.getValue() + 300 >= elapsedSec) {
me.Eng2.eng2Off.setValue(1);
} else {
setprop("/systems/fadec/eng2-off-power", 0);
me.Eng2.eng2Off.setValue(0);
}
state1 = pts.Engines.Engine.state[0].getValue();
state2 = pts.Engines.Engine.state[1].getValue();
modeSel = pts.Controls.Engines.startSw.getValue();
if (state1 == 3) {
setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) {
setprop("/systems/fadec/powered1", 1);
me.Power.powered1.setValue(1);
} else if (powerAvailTemp and modeSel == 2) {
me.Power.powered1.setValue(1);
} else {
setprop("/systems/fadec/powered1", 0);
me.Power.powered1.setValue(0);
}
if (state2 == 3) {
setprop("/systems/fadec/powered2", 1);
} else if (powerAvail and modeSel == 2) {
setprop("/systems/fadec/powered2", 1);
me.Power.powered2.setValue(1);
} else if (powerAvailTemp and modeSel == 2) {
me.Power.powered2.setValue(1);
} else {
setprop("/systems/fadec/powered2", 0);
me.Power.powered2.setValue(0);
}
if (N1Mode1_sw == 1) {
setprop("/systems/fadec/n1mode1", 1);
powered1 = me.Power.powered1.getValue();
powered2 = me.Power.powered2.getValue();
powerup = me.Power.powerup.getValue();
if (powered1 or powerup or me.Eng1.eng1Off.getValue()) {
if (me.Modes.n1Mode1.getValue() == 0) {
me.Eng1.epr = 1;
} else {
me.Eng1.epr = 0;
}
me.Eng1.egt = 1;
me.Eng1.ff = 1;
} else {
setprop("/systems/fadec/n1mode1", 0);
me.Eng1.epr = 0;
me.Eng1.egt = 0;
me.Eng1.ff = 0;
}
if (N1Mode2_sw == 1) {
setprop("/systems/fadec/n1mode2", 1);
if (powered2 or powerup or me.Eng2.eng2Off.getValue()) {
if (me.Modes.n1Mode2.getValue() == 0) {
me.Eng2.epr = 1;
} else {
me.Eng2.epr = 0;
}
me.Eng2.egt = 1;
me.Eng2.ff = 1;
} else {
setprop("/systems/fadec/n1mode2", 0);
me.Eng2.epr = 0;
me.Eng2.egt = 0;
me.Eng2.ff = 0;
}
var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("/systems/fadec/powered2");
var N1Mode1 = getprop("/systems/fadec/n1mode1");
var N1Mode2 = getprop("/systems/fadec/n1mode2");
var N11 = getprop("engines/engine[0]/n1-actual");
var N12 = getprop("engines/engine[1]/n1-actual");
var N21 = getprop("engines/engine[0]/n2-actual");
var N22 = getprop("engines/engine[1]/n2-actual");
if ((powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) and N1Mode1 == 0) {
setprop("/systems/fadec/eng1/epr", 1);
} else {
setprop("/systems/fadec/eng1/epr", 0);
}
if ((powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) and N1Mode2 == 0) {
setprop("/systems/fadec/eng2/epr", 1);
} else {
setprop("/systems/fadec/eng2/epr", 0);
}
if (powered1 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng1-off-power")) {
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/ff", 1);
} else {
setprop("/systems/fadec/eng1/egt", 0);
setprop("/systems/fadec/eng1/ff", 0);
}
if (powered2 or getprop("/systems/fadec/powerup") or getprop("/systems/fadec/eng2-off-power")) {
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/ff", 1);
} else {
setprop("/systems/fadec/eng2/egt", 0);
setprop("/systems/fadec/eng2/ff", 0);
}
N11 = pts.Engines.Engine.n1Actual[0].getValue();
N12 = pts.Engines.Engine.n1Actual[1].getValue();
N21 = pts.Engines.Engine.n2Actual[0].getValue();
N22 = pts.Engines.Engine.n2Actual[1].getValue();
if (powered1 and N11 >= 3.5) {
setprop("/systems/fadec/eng1/n1", 1);
me.Eng1.n1 = 1;
} else {
setprop("/systems/fadec/eng1/n1", 0);
me.Eng1.n1 = 0;
}
if (powered2 and N12 >= 3.5) {
setprop("/systems/fadec/eng2/n1", 1);
me.Eng2.n1 = 1;
} else {
setprop("/systems/fadec/eng2/n1", 0);
me.Eng2.n1 = 0;
}
if (powered1 and N21 >= 3.5) {
setprop("/systems/fadec/eng1/n2", 1);
me.Eng1.n2 = 1;
} else {
setprop("/systems/fadec/eng1/n2", 0);
me.Eng1.n2 = 0;
}
if (powered2 and N22 >= 3.5) {
setprop("/systems/fadec/eng2/n2", 1);
me.Eng2.n2 = 1;
} else {
setprop("/systems/fadec/eng2/n2", 0);
me.Eng2.n2 = 0;
}
},
};
setlistener("/controls/fadec/n1mode1", func() {
if (FADEC.Switches.n1ModeSwitch1.getValue()) {
FADEC.Modes.n1Mode1.setValue(1);
} else {
FADEC.Modes.n1Mode1.setValue(0);
}
}, 0, 0);
setlistener("/controls/fadec/n1mode2", func() {
if (FADEC.Switches.n1ModeSwitch2.getValue()) {
FADEC.Modes.n1Mode2.setValue(1);
} else {
FADEC.Modes.n1Mode2.setValue(0);
}
}, 0, 0);

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<params>
<m-wing-dry-kg type="double">12000</m-wing-dry-kg>
<K type="double">259</K>
<D type="double">12</D>
<fuel-frac type="double">0.375</fuel-frac>
<lift-node-lbs alias="/fdm/jsbsim/forces/fbz-aero-lbs"/>
<fuel-node-1-kg alias="/consumables/fuel/tank/level-kg"/>
<fuel-node-2-kg alias="/consumables/fuel/tank[1]/level-kg"/>
<fuel-node-3-kg type="double">0</fuel-node-3-kg>
<fuel-node-4-kg type="double">0</fuel-node-4-kg>
</params>
</PropertyList>