From 600f52375f4d18087cdf2a965c08eee196025022 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 20 Sep 2020 20:52:54 +0100 Subject: [PATCH 1/4] Thrust: redo Nasal. Much more efficient now. --- A320-main.xml | 29 ++ Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 114 ++--- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 6 +- Nasal/ECAM/ECAM-phases.nas | 4 +- Nasal/FMGC/FMGC.nas | 1 + Nasal/Libraries/property-tree-setup.nas | 8 + Nasal/MCDU/MCDU.nas | 14 +- Nasal/MCDU/PERFGA.nas | 4 +- Nasal/MCDU/PERFTO.nas | 4 +- Nasal/Systems/FADEC/fadec-common.nas | 474 ++++++++++--------- 10 files changed, 334 insertions(+), 324 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 16a4be3f..6b76afea 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -711,6 +711,9 @@ 1 + 0.0 + 0.0 + TOGA true true @@ -1124,6 +1127,12 @@ + + + 0 + 0 + + 0 0 @@ -1224,6 +1233,7 @@ 0 0 + 0 0 @@ -1234,6 +1244,7 @@ 0 0 + 0 @@ -1281,6 +1292,7 @@ 0 0 + @@ -1390,6 +1402,23 @@ 1 + + 0 + 1500 + 0 + 0 + 0 + IDLE + IDLE + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 0 diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index f0786a8b..5cc9934a 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -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(); diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 25869d0a..07eb6121 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -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 { diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index e94ba100..eb653a00 100644 --- a/Nasal/ECAM/ECAM-phases.nas +++ b/Nasal/ECAM/ECAM-phases.nas @@ -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); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 2bde3628..9ad82b9f 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -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"), diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 83109c2f..9899445c 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -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")], }, }; diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index c9158e19..1a5f73f2 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -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; diff --git a/Nasal/MCDU/PERFGA.nas b/Nasal/MCDU/PERFGA.nas index 09032900..3b799120 100644 --- a/Nasal/MCDU/PERFGA.nas +++ b/Nasal/MCDU/PERFGA.nas @@ -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 { diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index 4f647b14..7d8cb645 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -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 { diff --git a/Nasal/Systems/FADEC/fadec-common.nas b/Nasal/Systems/FADEC/fadec-common.nas index 6efdbc83..60a49de4 100644 --- a/Nasal/Systems/FADEC/fadec-common.nas +++ b/Nasal/Systems/FADEC/fadec-common.nas @@ -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); From 558a8ab2fbb3051595b8475ce0552a37d40884ec Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 23 Sep 2020 15:38:03 +0100 Subject: [PATCH 2/4] Remove wingflexer. --- A320-main.xml | 5 ----- Systems/wingflexer-params.xml | 17 ----------------- 2 files changed, 22 deletions(-) delete mode 100644 Systems/wingflexer-params.xml diff --git a/A320-main.xml b/A320-main.xml index 6b76afea..6089dd99 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -195,11 +195,6 @@ Aircraft/A320-family/Systems/ecam-proprules.xml - - - Generic Wing Flexer - Aircraft/Generic/wingflexer.xml - Aircraft/A320-family/Systems/pitot-static.xml diff --git a/Systems/wingflexer-params.xml b/Systems/wingflexer-params.xml deleted file mode 100644 index d684e0c7..00000000 --- a/Systems/wingflexer-params.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - 12000 - 259 - 12 - 0.375 - - - - 0 - 0 - - - \ No newline at end of file From ce6f08bb3012e8bd45dcc32de2f1beea88f86154 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 24 Sep 2020 20:18:09 +0100 Subject: [PATCH 3/4] Fix overhead bindings for EPR N1 Mode --- Models/Instruments/OHpanel/OHpanelEPR.xml | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanelEPR.xml b/Models/Instruments/OHpanel/OHpanelEPR.xml index ffb0bd0b..8fb64484 100644 --- a/Models/Instruments/OHpanel/OHpanelEPR.xml +++ b/Models/Instruments/OHpanel/OHpanelEPR.xml @@ -55,6 +55,11 @@ property-toggle controls/fadec/n1mode1 + + property-assign + controls/OH/protectors/eng1-n1 + 0 + @@ -70,28 +75,23 @@ pick - Eng1N1Btn - Eng1N1Btn2O Eng1N1Prot - + false - property-assign + property-toggle controls/OH/protectors/eng1-n1 - 1 - - - property-assign - controls/OH/protectors/eng1-n1 - 0 - - - nasal - - - + + + + controls/OH/protectors/eng1-n1 + + + nasal + + @@ -156,6 +156,11 @@ property-toggle controls/fadec/n1mode2 + + property-assign + controls/OH/protectors/eng2-n1 + 0 + @@ -171,28 +176,23 @@ pick - Eng2N1Btn - Eng2N1Btn2O Eng2N1Prot - + false - property-assign + property-toggle controls/OH/protectors/eng2-n1 - 1 - - - property-assign - controls/OH/protectors/eng2-n1 - 0 - - - nasal - - - + + + + controls/OH/protectors/eng2-n1 + + + nasal + + From 844d604ea1d9a7c0ecb637fa3e974608b59be4a2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 24 Sep 2020 20:32:02 +0100 Subject: [PATCH 4/4] FADEC: efficientize the nasal loop --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 5 +- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 74 ++--- Nasal/Systems/FADEC/fadec-cfm.nas | 205 ++++++++------ Nasal/Systems/FADEC/fadec-iae.nas | 280 ++++++++++--------- 4 files changed, 303 insertions(+), 261 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 5cc9934a..f033b0c4 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -145,9 +145,6 @@ var spoiler_R3 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r3/final- 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 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); @@ -2375,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))); diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 07eb6121..0a94ee83 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -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,10 +61,6 @@ 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); @@ -196,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 { @@ -213,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 { @@ -654,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(); @@ -679,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(); @@ -709,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(); @@ -745,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(); @@ -758,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(); @@ -776,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(); @@ -801,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(); @@ -813,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(); @@ -836,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 { @@ -844,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 { @@ -911,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(); @@ -935,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(); @@ -961,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(); @@ -993,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(); @@ -1006,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(); @@ -1024,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(); @@ -1057,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(); @@ -1079,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(); @@ -1101,7 +1083,7 @@ var canvas_upperECAM_iae_eis2 = { me["N12-XX"].show(); } - if (eng1_n1mode.getValue() == 1 and fadec.Fadec.n1Mode[0].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 { @@ -1109,7 +1091,7 @@ var canvas_upperECAM_iae_eis2 = { me["N11-ylim"].hide(); } - if (eng2_n1mode.getValue() == 1 and fadec.Fadec.n1Mode[1].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 { @@ -1123,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(); @@ -1135,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(); @@ -1160,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 { @@ -1168,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 { diff --git a/Nasal/Systems/FADEC/fadec-cfm.nas b/Nasal/Systems/FADEC/fadec-cfm.nas index b78055bb..54bcea9b 100644 --- a/Nasal/Systems/FADEC/fadec-cfm.nas +++ b/Nasal/Systems/FADEC/fadec-cfm.nas @@ -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; } }, }; diff --git a/Nasal/Systems/FADEC/fadec-iae.nas b/Nasal/Systems/FADEC/fadec-iae.nas index 4ff62d3d..eeb04da8 100644 --- a/Nasal/Systems/FADEC/fadec-iae.nas +++ b/Nasal/Systems/FADEC/fadec-iae.nas @@ -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); \ No newline at end of file