diff --git a/AircraftConfig/fail.xml b/AircraftConfig/fail.xml index ca52e330..123163b5 100644 --- a/AircraftConfig/fail.xml +++ b/AircraftConfig/fail.xml @@ -203,6 +203,16 @@ true + + + left + /systems/failures/ventfan + + dialog-apply + + true + + diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 94110328..28a17ef5 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -1180,6 +1180,11 @@ var canvas_lowerECAM_elec = { me["BAT2a"].show(); me["BAT2off"].hide(); } + + me["BAT1volts"].setText(sprintf("%2.0f", getprop("/systems/electrical/battery1-volts"))); + me["BAT2volts"].setText(sprintf("%2.0f", getprop("/systems/electrical/battery2-volts"))); + me["BAT1amps"].setText(sprintf("%2.0f", getprop("/systems/electrical/battery1-amps"))); + me["BAT2amps"].setText(sprintf("%2.0f", getprop("/systems/electrical/battery2-amps"))); me.updateBottomStatus(); }, }; diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 71c6f0f3..aff098a3 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -17,9 +17,7 @@ select ACESSFeedBtn1F ACESSFeedBtn2O - ACPack1Btn1F ACPack1Btn2O - ACPack2Btn1F ACPack2Btn2O APUBleedBtn1F APUBleedBtn2O @@ -47,11 +45,19 @@ Eng2FireAgt2Btn1S Eng2FireAgt2Btn2D ExtPwrBtn2O - Gen1Btn1F Gen1Btn2O - Gen2Btn1F Gen2Btn2O RamAirBtn2O + + + ELAC1Btn1F + FAC1Btn1F + SECBtn1F + VentBlowBtn1F + Gen1Btn1F + Gen2Btn1F + ACPack1Btn1F + ACPack2Btn1F @@ -98,7 +104,6 @@ CFuelTank2Btn1F CFuelTank2Btn2O CrewOxyBtn2O - ELAC1Btn1F ELAC1Btn2O ELAC2Btn1F ELAC2Btn2O @@ -117,7 +122,6 @@ Eng2ManStartBtn2O EvacCommandBtn1E EvacCommandBtn2O - FAC1Btn1F FAC1Btn2O FAC2Btn1F FAC2Btn2O @@ -165,13 +169,11 @@ RFuelTank1Btn2O RFuelTank2Btn1F RFuelTank2Btn2O - SEC1Btn1F SEC1Btn2O SEC2Btn1F SEC2Btn2O SEC3Btn1F SEC3Btn2O - VentBlowBtn1F VentBlowBtn2O VentExtractBtn1F VentExtractBtn2O @@ -220,7 +222,6 @@ Gen1LineBtn1S Gen1LineBtn2O RcdrGndCtlBtn2O - VentBlowBtn1F VentBlowBtn2O VentExtractBtn1F VentExtractBtn2O @@ -248,6 +249,23 @@ + + + select + VentBlowBtn1F + + + + /systems/ventilation/ventfan-fault + 1 + + + controls/switches/annun-test + 1 + + + + select diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index 3c852c16..cd0dc3ef 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -538,7 +538,7 @@ var master_elec = func { setprop("/systems/electrical/batt2-fault", 0); } - if ((gen1_fail and gen1_sw) or (gen1_sw and stateL != 3)) { + if (getprop("systems/electrical/battery2-amps") > 120 and (gen1_fail and gen1_sw) or (gen1_sw and stateL != 3)) { setprop("/systems/electrical/gen1-fault", 1); } else { setprop("/systems/electrical/gen1-fault", 0); @@ -556,13 +556,44 @@ var master_elec = func { setprop("/systems/electrical/apugen-fault", 0); } - if ((gen2_fail and gen2_sw) or (gen2_sw and stateR != 3)) { + if (getprop("systems/electrical/battery2-amps") > 120 and (gen2_fail and gen2_sw) or (gen2_sw and stateR != 3)) { setprop("/systems/electrical/gen2-fault", 1); } else { setprop("/systems/electrical/gen2-fault", 0); } + + if (getprop("/systems/failures/sec1-fail-time") + 5 >= getprop("/sim/time/elapsed-sec")) { + setprop("/systems/failures/sec1", 1); + } else { + setprop("/systems/failures/sec1", 0); + setprop("/systems/failures/sec1-fail-time", 0); + } + + if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/failures/ventfan") == 1) { + setprop("/systems/ventilation/ventfan-fault", 0); + } else if (getprop("/systems/electrical/battery2-amps") > 120) { + setprop("/systems/ventilation/ventfan-fault", 1); + } } +setlistener("/controls/electrical/switches/battery2", func { + if (getprop("/controls/electrical/switches/battery2") == 1) { + setprop("/systems/failures/elac1", 1); + setprop("/systems/failures/sec1", 1); + setprop("/systems/failures/fac1", 1); + + setprop("/systems/failures/sec1-fail-time", getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/electrical/bus/dc-ess") >= 25 or getprop("/systems/electrical/bus/ac-ess") >= 25) { + setprop("/systems/failures/elac1", 0); + setprop("/systems/failures/sec1", 0); + setprop("/systems/failures/fac1", 0); + } else { + setprop("/systems/failures/elac1", 1); + setprop("/systems/failures/sec1", 1); + setprop("/systems/failures/fac1", 1); + } + +}); ################### # Update Function # ################### diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 8bf5971b..2e66f63d 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -27,6 +27,8 @@ var qty2 = math.round((rand() * 5 ) + 20, 0.1); setprop("/engines/engine[0]/oil-qt-actual", qty1); setprop("/engines/engine[1]/oil-qt-actual", qty2); +# Failures +setprop("/systems/failures/sec1-fail-time", 0); ########## # Lights # ########## diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas index 22f82c77..0fc14d44 100644 --- a/Nasal/pneumatics.nas +++ b/Nasal/pneumatics.nas @@ -369,13 +369,13 @@ var master_pneu = func { setprop("/systems/pneumatic/bleedapu-fault", 0); } - if ((pack1_fail and pack1_sw) or (pack1_sw and pack1 <= 5)) { + if (getprop("systems/electrical/battery2-amps") > 120 and (pack1_fail and pack1_sw) or (pack1_sw and pack1 <= 5)) { setprop("/systems/pneumatic/pack1-fault", 1); } else { setprop("/systems/pneumatic/pack1-fault", 0); } - if ((pack2_fail and pack2_sw) or (pack2_sw and pack2 <= 5)) { + if (getprop("systems/electrical/battery2-amps") > 120 and (pack2_fail and pack2_sw) or (pack2_sw and pack2 <= 5)) { setprop("/systems/pneumatic/pack2-fault", 1); } else { setprop("/systems/pneumatic/pack2-fault", 0);