diff --git a/A320-main.xml b/A320-main.xml index bb96d7ed..b0f7f245 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -644,6 +644,7 @@ 0 + 0 0 0 0 diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 46082679..c2205bab 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -229,9 +229,6 @@ var colddark_b = func { # Continues the Cold and Dark script, after engines fully shutdown. setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/bleed/OHP/bleedapu", 0); - setprop("/controls/electrical/switches/battery1", 0); - setprop("/controls/electrical/switches/battery2", 0); setprop("/controls/gear/brake-left", 0); setprop("/controls/gear/brake-right", 0); setprop("/systems/acconfig/autoconfig-running", 0); @@ -265,9 +262,6 @@ var beforestart = func { failReset(); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/bleed/OHP/bleedapu", 0); - setprop("/controls/electrical/switches/battery1", 0); - setprop("/controls/electrical/switches/battery2", 0); # Now the Startup! setprop("/controls/electrical/switches/battery1", 1); @@ -343,8 +337,6 @@ var taxi = func { failReset(); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); - setprop("/controls/electrical/switches/battery1", 0); - setprop("/controls/electrical/switches/battery2", 0); # Now the Startup! setprop("/controls/electrical/switches/battery1", 1); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 57f27f2d..e677bcd7 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -1287,10 +1287,12 @@ var canvas_lowerECAM_elec = { if (switch_emer_gen.getValue() == 0) { me["EMERGEN-group"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide(); + me["ELEC-Line-Emergen-ESSTR-off"].show(); me["EMERGEN-Label-off"].show(); } else { me["EMERGEN-group"].show(); me["ELEC-Line-Emergen-ESSTR"].show(); + me["ELEC-Line-Emergen-ESSTR-off"].hide(); me["EMERGEN-Label-off"].hide(); } diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 7bb54580..3efd934f 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -643,7 +643,7 @@ var canvas_MCDU_base = { if (getprop("/FMGC/internal/adf1freq-set") == 1) { me["Simple_L5"].setFont(default); me["Simple_L5"].setFontSize(normal); - me["Simple_L5"].setText(sprintf("%3.0f", adf1)); + me["Simple_L5"].setText(sprintf("%s", adf1)); } else { me["Simple_L5"].setFont(symbol); me["Simple_L5"].setFontSize(small); @@ -663,7 +663,7 @@ var canvas_MCDU_base = { if (getprop("/FMGC/internal/adf2freq-set") == 1) { me["Simple_R5"].setFont(default); me["Simple_R5"].setFontSize(normal); - me["Simple_R5"].setText(sprintf("%3.0f", adf2)); + me["Simple_R5"].setText(sprintf("%s", adf2)); } else { me["Simple_R5"].setFont(symbol); me["Simple_R5"].setFontSize(small); diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 51c88147..d7722b72 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -3312,7 +3312,88 @@ - + + + ELEC RAT MAN pick + pick + EmerElecManOnBtn + + + false + + + + + controls/OH/protectors/elecratman + 1 + + + + systems/electrical/bus/dcbat + 25 + + + systems/electrical/bus/dc-ess + 25 + + + + + property-toggle + controls/electrical/switches/rat-man + + + + + controls/OH/protectors/elecratman + 1 + + + nasal + + + + + + + pick + EmerManOnGuard + + + + property-assign + controls/OH/protectors/elecratman + 1 + + + + property-assign + controls/OH/protectors/elecratman + 0 + + + nasal + + + + + + + + rotate + EmerManOnGuard + controls/OH/protectors/elecratman + -145 + + -0.00273 + -0.20848 + -0.02796 + -0.00420 + -0.19657 + -0.02796 + + + AC pack flow pick diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index 8de3b2a7..14a3f777 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -110,7 +110,7 @@ setlistener("/it-autoflight/input/ap1", func { fmabox(); updateTimers(); } else if (apmas == 1 and ac_ess >= 110 and law == 0) { - if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { + if (getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0 and getprop("/position/gear-agl-ft") >= 100) { if (getprop("/it-autoflight/output/lat") == 9) { setprop("/it-autoflight/input/lat", 3); } @@ -146,7 +146,7 @@ setlistener("/it-autoflight/input/ap2", func { fmabox(); updateTimers(); } else if (apmas == 1 and ac_ess >= 110 and law == 0) { - if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { + if (getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0 and getprop("/position/gear-agl-ft") >= 100) { if (getprop("/it-autoflight/output/lat") == 9) { setprop("/it-autoflight/input/lat", 3); } diff --git a/Nasal/FMGC.nas b/Nasal/FMGC.nas index d0865b66..a1a4c8a7 100644 --- a/Nasal/FMGC.nas +++ b/Nasal/FMGC.nas @@ -25,6 +25,8 @@ setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX"); +setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); +setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); setprop("/gear/gear[0]/wow-fmgc", 1); setlistener("/sim/signals/fdm-initialized", func { diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index 73600e7a..8fa710da 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -34,6 +34,7 @@ setlistener("/sim/signals/fdm-initialized", func { var ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed"); var battery1_sw = getprop("/controls/electrical/switches/battery1"); var battery2_sw = getprop("/controls/electrical/switches/battery2"); + var manrat = getprop("/controls/electrical/switches/rat-man"); var battery1_volts = getprop("/systems/electrical/battery1-volts"); var battery2_volts = getprop("/systems/electrical/battery2-volts"); var battery1_amps = getprop("/systems/electrical/battery1-amps"); @@ -62,8 +63,7 @@ setlistener("/sim/signals/fdm-initialized", func { var galley_shed = getprop("/systems/electrical/extra/galleyshed"); var emergen = getprop("/controls/electrical/switches/emer-gen"); var ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt"); - var rat = getprop("/controls/hydraulic/rat"); - var manrat = getprop("/controls/hydraulic/rat-man"); + var rat = getprop("/controls/electrical/rat"); var ac_ess_fail = getprop("/systems/failures/elec-ac-ess"); var batt1_fail = getprop("/systems/failures/elec-batt1"); var batt2_fail = getprop("/systems/failures/elec-batt2"); @@ -158,6 +158,7 @@ var ELEC = { setprop("/controls/electrical/switches/ac-ess-feed", 0); setprop("/controls/electrical/switches/battery1", 0); setprop("/controls/electrical/switches/battery2", 0); + setprop("/controls/electrical/switches/rat-man", 0); setprop("/systems/electrical/battery1-volts", 26.5); setprop("/systems/electrical/battery2-volts", 26.5); setprop("/systems/electrical/battery1-amps", 0); @@ -206,6 +207,7 @@ var ELEC = { setprop("/systems/electrical/idg2-fault", 0); setprop("/controls/electrical/xtie/xtieL", 0); setprop("/controls/electrical/xtie/xtieR", 0); + setprop("/controls/electrical/rat", 0); setprop("/systems/electrical/battery-available", 0); setprop("/systems/electrical/dc2-available", 0); # Below are standard FG Electrical stuff to keep things working when the plane is powered @@ -280,6 +282,7 @@ var ELEC = { ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed"); battery1_sw = getprop("/controls/electrical/switches/battery1"); battery2_sw = getprop("/controls/electrical/switches/battery2"); + manrat = getprop("/controls/electrical/switches/rat-man"); battery1_volts = getprop("/systems/electrical/battery1-volts"); battery2_volts = getprop("/systems/electrical/battery2-volts"); battery1_percent = getprop("/systems/electrical/battery1-percent"); @@ -302,8 +305,7 @@ var ELEC = { galley_shed = getprop("/systems/electrical/extra/galleyshed"); emergen = getprop("/controls/electrical/switches/emer-gen"); ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt"); - rat = getprop("/controls/hydraulic/rat"); - manrat = getprop("/controls/hydraulic/rat-man"); + rat = getprop("/controls/electrical/rat"); ac_ess_fail = getprop("/systems/failures/elec-ac-ess"); batt1_fail = getprop("/systems/failures/elec-batt1"); batt2_fail = getprop("/systems/failures/elec-batt2"); @@ -594,13 +596,17 @@ var ELEC = { setprop("/systems/electrical/extra/galleyshed", 0); } - if (((ac1 == 0 and ac2 == 0 and ias >= 100) or manrat) and replay == 0) { + if (ac1 < 110 and ac2 < 110 and ias >= 100 and replay == 0) { setprop("/controls/hydraulic/rat-deployed", 1); - setprop("/controls/hydraulic/rat", 1); + setprop("/controls/electrical/rat", 1); + setprop("/controls/electrical/switches/emer-gen", 1); + } else if (manrat) { + setprop("/controls/hydraulic/rat-deployed", 1); + setprop("/controls/electrical/rat", 1); setprop("/controls/electrical/switches/emer-gen", 1); } - if (ias < 100 or (ac1 == 1) or (ac2 == 1)) { + if (ias < 100 or ac1 >= 110 or ac2 >= 110) { setprop("/controls/electrical/switches/emer-gen", 0); } diff --git a/Nasal/engines-cfm.nas b/Nasal/engines-cfm.nas index 271ee991..a7082f0a 100644 --- a/Nasal/engines-cfm.nas +++ b/Nasal/engines-cfm.nas @@ -31,6 +31,7 @@ setprop("/controls/engines/engine[1]/last-igniter", "B"); var eng_init = func { setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0); + eng_common_init(); } # Trigger Startups and Stops diff --git a/Nasal/engines-common.nas b/Nasal/engines-common.nas index 0d9ff2c9..685e3fc3 100644 --- a/Nasal/engines-common.nas +++ b/Nasal/engines-common.nas @@ -17,10 +17,19 @@ var apu_egt_min = 352; var apu_egt_max = 704; setprop("/systems/apu/rpm", 0); setprop("/systems/apu/egt", 42); +setprop("/systems/apu/bleed-used", 0); +setprop("/systems/apu/bleed-counting", 0); +setprop("/systems/apu/bleed-time", 0); + +var eng_common_init = func { + setprop("/systems/apu/bleed-used", 0); +} # Start APU setlistener("/controls/APU/start", func { - if ((getprop("/controls/APU/master") == 1) and (getprop("/controls/APU/start") == 1)) { + if (getprop("/controls/APU/master") == 1 and getprop("/controls/APU/start") == 1) { + apuBleedChk.stop(); + setprop("/systems/apu/bleed-counting", 0); if (getprop("/systems/acconfig/autoconfig-running") == 0) { interpolate("/systems/apu/rpm", apu_max, spinup_time); apu_egt_check.start(); @@ -56,14 +65,38 @@ setlistener("/controls/APU/master", func { apu_egt_check.stop(); apu_egt2_check.stop(); apu_stop(); + } else if (getprop("/controls/APU/master") == 1) { + apuBleedChk.stop(); + setprop("/systems/apu/bleed-counting", 0); } }); var apu_stop = func { - interpolate("/systems/apu/rpm", 0, 30); - interpolate("/systems/apu/egt", 42, 40); + if (getprop("/systems/apu/bleed-used") == 1 and getprop("/systems/apu/bleed-counting") != 1) { + setprop("/systems/apu/bleed-counting", 1); + setprop("/systems/apu/bleed-time", getprop("/sim/time/elapsed-sec")); + } + if (getprop("/systems/apu/bleed-used") == 1 and getprop("/systems/apu/bleed-counting") == 1) { + apuBleedChk.start(); + } else { + apuBleedChk.stop(); + interpolate("/systems/apu/rpm", 0, 30); + interpolate("/systems/apu/egt", 42, 40); + setprop("/systems/apu/bleed-counting", 0); + } } +var apuBleedChk = maketimer(0.1, func { + if (getprop("/systems/apu/bleed-used") == 1 and getprop("/systems/apu/bleed-counting") == 1) { + if (getprop("/systems/apu/bleed-time") + 60 <= getprop("/sim/time/elapsed-sec")) { + apuBleedChk.stop(); + interpolate("/systems/apu/rpm", 0, 30); + interpolate("/systems/apu/egt", 42, 40); + setprop("/systems/apu/bleed-counting", 0); + } + } +}); + # Various Other Stuff var doIdleThrust = func { setprop("/controls/engines/engine[0]/throttle", 0.0); diff --git a/Nasal/engines-iae.nas b/Nasal/engines-iae.nas index b8ba6853..ec26ddb7 100644 --- a/Nasal/engines-iae.nas +++ b/Nasal/engines-iae.nas @@ -31,6 +31,7 @@ setprop("/controls/engines/engine[1]/last-igniter", "B"); var eng_init = func { setprop("/controls/engines/engine[0]/man-start", 0); setprop("/controls/engines/engine[1]/man-start", 0); + eng_common_init(); } # Trigger Startups and Stops diff --git a/Nasal/fadec-cfm.nas b/Nasal/fadec-cfm.nas index ba85a4a9..45262272 100644 --- a/Nasal/fadec-cfm.nas +++ b/Nasal/fadec-cfm.nas @@ -17,78 +17,126 @@ 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", 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 fadecLoop = func { - var ac1 = getprop("/systems/electrical/bus/ac1"); - var ac2 = getprop("/systems/electrical/bus/ac2"); - var acess = getprop("/systems/electrical/bus/ac-ess"); - var state1 = getprop("/engines/engine[0]/state"); - var state2 = getprop("/engines/engine[1]/state"); - var master1 = getprop("/controls/engines/engine[0]/cutoff-switch"); - var master2 = getprop("/controls/engines/engine[1]/cutoff-switch"); - var modeSel = getprop("/controls/engines/engine-start-switch"); - - if (ac1 >= 110 or ac2 >= 110 or acess >= 110) { - if (getprop("/systems/fadec/power-avail") != 1) { - setprop("/systems/fadec/powered-time", getprop("/sim/time/elapsed-sec")); - setprop("/systems/fadec/power-avail", 1); +var FADEC = { + init: func() { + setprop("/systems/fadec/powered-time", 0); + setprop("/systems/fadec/eng1-master-time", -300); + setprop("/systems/fadec/eng2-master-time", -300); + }, + loop: func() { + var ac1 = getprop("/systems/electrical/bus/ac1"); + var ac2 = getprop("/systems/electrical/bus/ac2"); + var acess = getprop("/systems/electrical/bus/ac-ess"); + var state1 = getprop("/engines/engine[0]/state"); + var state2 = getprop("/engines/engine[1]/state"); + var master1 = getprop("/controls/engines/engine[0]/cutoff-switch"); + var master2 = getprop("/controls/engines/engine[1]/cutoff-switch"); + var modeSel = getprop("/controls/engines/engine-start-switch"); + var elapsedSec = getprop("/sim/time/elapsed-sec"); + + 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); + } + } else { + if (getprop("/systems/fadec/power-avail") != 0) { + setprop("/systems/fadec/power-avail", 0); + } } - } else { - if (getprop("/systems/fadec/power-avail") != 0) { - setprop("/systems/fadec/power-avail", 0); + + var powerAvail = getprop("/systems/fadec/power-avail"); + + if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/powerup", 1); + } else { + setprop("/systems/fadec/powerup", 0); } - } - - var powerAvail = getprop("/systems/fadec/power-avail"); - - if (getprop("/systems/fadec/powered-time") + 300 >= getprop("/sim/time/elapsed-sec")) { - setprop("/systems/fadec/powerup", 1); - } else { - setprop("/systems/fadec/powerup", 0); - } - - if (state1 == 3) { - setprop("/systems/fadec/powered1", 1); - } else if (powerAvail and modeSel == 2) { - setprop("/systems/fadec/powered1", 1); - } else { - setprop("/systems/fadec/powered1", 0); - } - - if (state2 == 3) { - setprop("/systems/fadec/powered2", 1); - } else if (powerAvail and modeSel == 2) { - setprop("/systems/fadec/powered2", 1); - } else { - setprop("/systems/fadec/powered2", 0); - } - - var powered1 = getprop("/systems/fadec/powered1"); - var powered2 = getprop("/systems/fadec/powered2"); - - if (powered1 or getprop("/systems/fadec/powerup")) { - setprop("/systems/fadec/eng1/n1", 1); - setprop("/systems/fadec/eng1/egt", 1); - setprop("/systems/fadec/eng1/n2", 1); - setprop("/systems/fadec/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); - } - - if (powered2 or getprop("/systems/fadec/powerup")) { - setprop("/systems/fadec/eng2/n1", 1); - setprop("/systems/fadec/eng2/egt", 1); - setprop("/systems/fadec/eng2/n2", 1); - setprop("/systems/fadec/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); - } -} + + 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); + } + } else { + if (getprop("/systems/fadec/eng1-master-count") != 0) { + setprop("/systems/fadec/eng1-master-count", 0); + } + } + + if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/eng1-off-power", 1); + } else { + setprop("/systems/fadec/eng1-off-power", 0); + } + + 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); + } + } else { + if (getprop("/systems/fadec/eng2-master-count") != 0) { + setprop("/systems/fadec/eng2-master-count", 0); + } + } + + if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/eng2-off-power", 1); + } else { + setprop("/systems/fadec/eng2-off-power", 0); + } + + if (state1 == 3) { + setprop("/systems/fadec/powered1", 1); + } else if (powerAvail and modeSel == 2) { + setprop("/systems/fadec/powered1", 1); + } else { + setprop("/systems/fadec/powered1", 0); + } + + if (state2 == 3) { + setprop("/systems/fadec/powered2", 1); + } else if (powerAvail and modeSel == 2) { + setprop("/systems/fadec/powered2", 1); + } else { + setprop("/systems/fadec/powered2", 0); + } + + var powered1 = getprop("/systems/fadec/powered1"); + var powered2 = getprop("/systems/fadec/powered2"); + + 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); + } 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); + } + + 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); + } 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); + } + }, +}; diff --git a/Nasal/fadec-iae.nas b/Nasal/fadec-iae.nas index 388ef910..27464783 100644 --- a/Nasal/fadec-iae.nas +++ b/Nasal/fadec-iae.nas @@ -21,126 +21,174 @@ 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", 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 fadecLoop = func { - var ac1 = getprop("/systems/electrical/bus/ac1"); - var ac2 = getprop("/systems/electrical/bus/ac2"); - var acess = getprop("/systems/electrical/bus/ac-ess"); - var state1 = getprop("/engines/engine[0]/state"); - var state2 = getprop("/engines/engine[1]/state"); - var master1 = getprop("/controls/engines/engine[0]/cutoff-switch"); - var master2 = getprop("/controls/engines/engine[1]/cutoff-switch"); - var modeSel = getprop("/controls/engines/engine-start-switch"); - var N1Mode1_sw = getprop("/controls/fadec/n1mode1"); - var N1Mode2_sw = getprop("/controls/fadec/n1mode2"); - - if (ac1 >= 110 or ac2 >= 110 or acess >= 110) { - if (getprop("/systems/fadec/power-avail") != 1) { - setprop("/systems/fadec/powered-time", getprop("/sim/time/elapsed-sec")); - setprop("/systems/fadec/power-avail", 1); +var FADEC = { + init: func() { + setprop("/systems/fadec/powered-time", 0); + setprop("/systems/fadec/eng1-master-time", -300); + setprop("/systems/fadec/eng2-master-time", -300); + }, + loop: func() { + var ac1 = getprop("/systems/electrical/bus/ac1"); + var ac2 = getprop("/systems/electrical/bus/ac2"); + var acess = getprop("/systems/electrical/bus/ac-ess"); + var state1 = getprop("/engines/engine[0]/state"); + var state2 = getprop("/engines/engine[1]/state"); + var master1 = getprop("/controls/engines/engine[0]/cutoff-switch"); + var master2 = getprop("/controls/engines/engine[1]/cutoff-switch"); + var modeSel = getprop("/controls/engines/engine-start-switch"); + var N1Mode1_sw = getprop("/controls/fadec/n1mode1"); + var N1Mode2_sw = getprop("/controls/fadec/n1mode2"); + var elapsedSec = getprop("/sim/time/elapsed-sec"); + + 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); + } + } else { + if (getprop("/systems/fadec/power-avail") != 0) { + setprop("/systems/fadec/power-avail", 0); + } } - } else { - if (getprop("/systems/fadec/power-avail") != 0) { - setprop("/systems/fadec/power-avail", 0); + + var powerAvail = getprop("/systems/fadec/power-avail"); + + if (getprop("/systems/fadec/powered-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/powerup", 1); + } else { + setprop("/systems/fadec/powerup", 0); } - } - - var powerAvail = getprop("/systems/fadec/power-avail"); - - if (getprop("/systems/fadec/powered-time") + 300 >= getprop("/sim/time/elapsed-sec")) { - setprop("/systems/fadec/powerup", 1); - } else { - setprop("/systems/fadec/powerup", 0); - } - - if (state1 == 3) { - setprop("/systems/fadec/powered1", 1); - } else if (powerAvail and modeSel == 2) { - setprop("/systems/fadec/powered1", 1); - } else { - setprop("/systems/fadec/powered1", 0); - } - - if (state2 == 3) { - setprop("/systems/fadec/powered2", 1); - } else if (powerAvail and modeSel == 2) { - setprop("/systems/fadec/powered2", 1); - } else { - setprop("/systems/fadec/powered2", 0); - } - - if (N1Mode1_sw == 1) { - setprop("/systems/fadec/n1mode1", 1); - } else { - setprop("/systems/fadec/n1mode1", 0); - } - - if (N1Mode2_sw == 1) { - setprop("/systems/fadec/n1mode2", 1); - } else { - setprop("/systems/fadec/n1mode2", 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")) and N1Mode1 == 0) { - setprop("/systems/fadec/eng1/epr", 1); - } else { - setprop("/systems/fadec/eng1/epr", 0); - } - - if ((powered2 or getprop("/systems/fadec/powerup")) and N1Mode2 == 0) { - setprop("/systems/fadec/eng2/epr", 1); - } else { - setprop("/systems/fadec/eng2/epr", 0); - } - - if (powered1 or getprop("/systems/fadec/powerup")) { - 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")) { - 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); - } - - if (powered1 and N11 >= 3.5) { - setprop("/systems/fadec/eng1/n1", 1); - } else { - setprop("/systems/fadec/eng1/n1", 0); - } - - if (powered2 and N12 >= 3.5) { - setprop("/systems/fadec/eng2/n1", 1); - } else { - setprop("/systems/fadec/eng2/n1", 0); - } - - if (powered1 and N21 >= 3.5) { - setprop("/systems/fadec/eng1/n2", 1); - } else { - setprop("/systems/fadec/eng1/n2", 0); - } - - if (powered2 and N22 >= 3.5) { - setprop("/systems/fadec/eng2/n2", 1); - } else { - setprop("/systems/fadec/eng2/n2", 0); - } -} + + 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); + } + } else { + if (getprop("/systems/fadec/eng1-master-count") != 0) { + setprop("/systems/fadec/eng1-master-count", 0); + } + } + + if (getprop("/systems/fadec/eng1-master-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/eng1-off-power", 1); + } else { + setprop("/systems/fadec/eng1-off-power", 0); + } + + 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); + } + } else { + if (getprop("/systems/fadec/eng2-master-count") != 0) { + setprop("/systems/fadec/eng2-master-count", 0); + } + } + + if (getprop("/systems/fadec/eng2-master-time") + 300 >= elapsedSec) { + setprop("/systems/fadec/eng2-off-power", 1); + } else { + setprop("/systems/fadec/eng2-off-power", 0); + } + + if (state1 == 3) { + setprop("/systems/fadec/powered1", 1); + } else if (powerAvail and modeSel == 2) { + setprop("/systems/fadec/powered1", 1); + } else { + setprop("/systems/fadec/powered1", 0); + } + + if (state2 == 3) { + setprop("/systems/fadec/powered2", 1); + } else if (powerAvail and modeSel == 2) { + setprop("/systems/fadec/powered2", 1); + } else { + setprop("/systems/fadec/powered2", 0); + } + + if (N1Mode1_sw == 1) { + setprop("/systems/fadec/n1mode1", 1); + } else { + setprop("/systems/fadec/n1mode1", 0); + } + + if (N1Mode2_sw == 1) { + setprop("/systems/fadec/n1mode2", 1); + } else { + setprop("/systems/fadec/n1mode2", 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); + } + + if (powered1 and N11 >= 3.5) { + setprop("/systems/fadec/eng1/n1", 1); + } else { + setprop("/systems/fadec/eng1/n1", 0); + } + + if (powered2 and N12 >= 3.5) { + setprop("/systems/fadec/eng2/n1", 1); + } else { + setprop("/systems/fadec/eng2/n1", 0); + } + + if (powered1 and N21 >= 3.5) { + setprop("/systems/fadec/eng1/n2", 1); + } else { + setprop("/systems/fadec/eng1/n2", 0); + } + + if (powered2 and N22 >= 3.5) { + setprop("/systems/fadec/eng2/n2", 1); + } else { + setprop("/systems/fadec/eng2/n2", 0); + } + }, +}; diff --git a/Nasal/hydraulics.nas b/Nasal/hydraulics.nas index 05a43167..2d5319d4 100644 --- a/Nasal/hydraulics.nas +++ b/Nasal/hydraulics.nas @@ -125,7 +125,7 @@ var HYD = { setprop("/systems/hydraulic/ptu-active", 0); } - if ((rat_man_sw == 1 or getprop("/controls/electrical/switches/emer-gen") == 1) and gs > 100) { + if ((rat_man_sw == 1 or getprop("/controls/electrical/switches/emer-gen") == 1) and gs >= 100) { setprop("/controls/hydraulic/rat", 1); setprop("/controls/hydraulic/rat-deployed", 1); } else if (gs < 100) { diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 2fd9ce1d..1d1ebfc3 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -16,9 +16,6 @@ setprop("/controls/lighting/ndl-norm", 1); setprop("/controls/lighting/ndr-norm", 1); setprop("/controls/lighting/upper-norm", 1); -# Surprise -setprop("/controls/tray/surprise", 1); - # Lights setprop("/sim/model/lights/nose-lights", 0); setprop("/sim/model/lights/turnoffsw", 0); @@ -180,6 +177,7 @@ var systemsInit = func { systems.eng_init(); systems.fire_init(); systems.autobrake_init(); + fadec.FADEC.init(); fmgc.APinit(); fmgc.FMGCinit(); mcdu.MCDU_init(0); @@ -208,7 +206,7 @@ var systemsLoop = maketimer(0.1, func { systems.ADIRS.loop(); libraries.ECAM.loop(); libraries.BUTTONS.update(); - fadec.fadecLoop(); + fadec.FADEC.loop(); ecam.ECAM_controller.loop(); if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("/controls/gear/brake-parking") == 0)) { diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas index 06b469ff..281ca14f 100644 --- a/Nasal/pneumatics.nas +++ b/Nasal/pneumatics.nas @@ -200,6 +200,7 @@ var PNEU = { # Air Sources/PSI if (rpmapu >= 94.9 and bleedapu_sw and !bleedapu_fail) { setprop("/systems/pneumatic/bleedapu", 34); + setprop("/systems/apu/bleed-used", 1); } else { setprop("/systems/pneumatic/bleedapu", 0); } @@ -372,10 +373,10 @@ var PNEU = { acess = getprop("/systems/electrical/bus/ac-ess"); fanon = getprop("/systems/ventilation/avionics/fan"); - if ((dcess > 25) or (acess > 110)) { + if (dcess > 25 or acess > 110) { setprop("/systems/ventilation/avionics/fan", 1); setprop("/systems/ventilation/lavatory/extractfan", 1); - } else if ((dcess == 0) and (acess == 0)) { + } else if (dcess == 0 and acess == 0) { setprop("/systems/ventilation/avionics/fan", 0); setprop("/systems/ventilation/lavatory/extractfan", 0); } diff --git a/Systems/a320-spoiler.xml b/Systems/a320-spoiler.xml index 8bc62a68..390f1961 100644 --- a/Systems/a320-spoiler.xml +++ b/Systems/a320-spoiler.xml @@ -666,7 +666,6 @@ /systems/hydraulic/yellow-psi ge 1500 - spoilers/main-gear-and eq 0 /systems/failures/spoiler-r4 eq 0 spoilers/main-cmd gt 0 diff --git a/revision.txt b/revision.txt index 032fb5c3..4c7368f7 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4655 \ No newline at end of file +4661 \ No newline at end of file