From 8acd730efe7253399e9c120badb80d10f7c5fe02 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Tue, 25 Jul 2017 00:09:58 -0400 Subject: [PATCH] A3XX: Move FAULT Logic to nasal in ELEC, HYD, PNEU --- Models/Instruments/OHpanel/OHpanel.xml | 174 +++++-------------------- Nasal/electrical.nas | 52 ++++++++ Nasal/hydraulics.nas | 38 +++++- Nasal/pneumatics.nas | 79 +++++++++-- 4 files changed, 186 insertions(+), 157 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 36073442..84065524 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -1557,82 +1557,6 @@ - - - Cargo Smoke Test @@ -1690,7 +1614,7 @@ - systems/failures/pump-green + systems/pneumatic/eng1-pump-fault 1 @@ -1801,7 +1725,7 @@ - systems/failures/pump-blue + systems/pneumatic/elec-pump-b-fault 1 @@ -1874,7 +1798,7 @@ - systems/failures/ptu + systems/pneumatic/ptu-fault 1 @@ -1947,7 +1871,7 @@ - systems/failures/pump-yellow-eng + systems/pneumatic/eng2-pump-fault 1 @@ -2020,7 +1944,7 @@ - systems/failures/pump-yellow-elec + systems/pneumatic/elec-pump-y-fault 1 @@ -2614,7 +2538,7 @@ - systems/failures/elec-galley + systems/electrical/galley-fault 1 @@ -2675,7 +2599,7 @@ - systems/failures/elec-batt1 + systems/electrical/batt1-fault 1 @@ -2736,7 +2660,7 @@ - systems/failures/elec-batt2 + systems/electrical/batt2-fault 1 @@ -2802,10 +2726,10 @@ IDG1Btn1F - - systems/unused/unused-oh - 150 - + + systems/electrical/idg1-fault + 1 + controls/switches/annun-test 1 @@ -2862,7 +2786,7 @@ - systems/failures/elec-gen1 + systems/electrical/gen1-fault 1 @@ -2870,16 +2794,6 @@ 1 - - - controls/electrical/switches/gen1 - 1 - - - engines/engine[0]/state - 3 - - controls/switches/annun-test 1 @@ -2944,7 +2858,7 @@ - systems/failures/elec-ac-ess + systems/electrical/ac-ess-feed-fault 1 @@ -3024,7 +2938,7 @@ - systems/failures/elec-genapu + systems/electrical/apugen-fault 1 @@ -3245,7 +3159,7 @@ - systems/failures/elec-gen2 + systems/electrical/gen2-fault 1 @@ -3253,16 +3167,6 @@ 1 - - - controls/electrical/switches/gen2 - 1 - - - engines/engine[1]/state - 3 - - controls/switches/annun-test 1 @@ -3642,7 +3546,7 @@ - systems/failures/pack1 + systems/pneumatic/pack1-fault 1 @@ -3650,16 +3554,6 @@ 1 - - - controls/pneumatic/switches/pack1 - 1 - - - systems/pneumatic/pack1 - 5 - - controls/switches/annun-test 1 @@ -3725,12 +3619,12 @@ - systems/failures/bleed-eng1 + systems/pneumatic/bleed1-fault 1 controls/pneumatic/switches/bleed1 - 0 + 1 @@ -3806,7 +3700,7 @@ - systems/failures/bleed-apu + systems/pneumatic/bleedapu-fault 1 @@ -3879,7 +3773,7 @@ - systems/failures/bleed-eng2 + systems/pneumatic/bleed2-fault 1 @@ -3949,10 +3843,16 @@ HotAirBtn1F - - systems/unused/unused-oh - 150 - + + + systems/pneumatic/hotair-fault + 1 + + + controls/pneumatic/switches/hot-air + 1 + + controls/switches/annun-test 1 @@ -4026,7 +3926,7 @@ - systems/failures/pack2 + systems/pneumatic/pack2-fault 1 @@ -4034,16 +3934,6 @@ 1 - - - controls/pneumatic/switches/pack2 - 1 - - - systems/pneumatic/pack2 - 5 - - controls/switches/annun-test 1 diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index 6367072d..53be5356 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -104,6 +104,15 @@ var elec_init = func { setprop("/systems/electrical/gen-apu", 0); setprop("/systems/electrical/gen-ext", 0); setprop("/systems/electrical/on", 0); + setprop("/systems/electrical/galley-fault", 0); + setprop("/systems/electrical/idg1-fault", 0); + setprop("/systems/electrical/gen1-fault", 0); + setprop("/systems/electrical/apugen-fault", 0); + setprop("/systems/electrical/batt1-fault", 0); + setprop("/systems/electrical/batt2-fault", 0); + setprop("/systems/electrical/ac-ess-feed-fault", 0); + setprop("/systems/electrical/gen1-fault", 0); + setprop("/systems/electrical/idg1-fault", 0); setprop("/controls/electrical/xtie/xtieL", 0); setprop("/controls/electrical/xtie/xtieR", 0); # Below are standard FG Electrical stuff to keep things working when the plane is powered @@ -512,6 +521,49 @@ var master_elec = func { setprop("/systems/electrical/outputs/transponder", dc_volt_std); setprop("/systems/electrical/outputs/turn-coordinator", dc_volt_std); } + + # Fault lights + if (gallery_fail and galley_sw) { + setprop("/systems/electrical/galley-fault", 1); + } else { + setprop("/systems/electrical/galley-fault", 0); + } + + if (batt1_fail and battery1_sw) { + setprop("/systems/electrical/batt1-fault", 1); + } else { + setprop("/systems/electrical/batt1-fault", 0); + } + + if (batt2_fail and battery2_sw) { + setprop("/systems/electrical/batt2-fault", 1); + } else { + setprop("/systems/electrical/batt2-fault", 0); + } + + if ((gen1_fail and gen1_sw) or (gen1_sw and stateL != 3)) { + setprop("/systems/electrical/gen1-fault", 1); + } else { + setprop("/systems/electrical/gen1-fault", 0); + } + + if (ac_ess_fail and ac_ess_feed_sw) { + setprop("/systems/electrical/ac-ess-feed-fault", 1); + } else { + setprop("/systems/electrical/ac-ess-feed-fault", 0); + } + + if (genapu_fail and gen_apu_sw) { + setprop("/systems/electrical/apugen-fault", 1); + } else { + setprop("/systems/electrical/apugen-fault", 0); + } + + if ((gen2_fail and gen2_sw) or (gen2_sw and stateR != 3)) { + setprop("/systems/electrical/gen2-fault", 1); + } else { + setprop("/systems/electrical/gen2-fault", 0); + } } ################### diff --git a/Nasal/hydraulics.nas b/Nasal/hydraulics.nas index c44413cd..703a8392 100644 --- a/Nasal/hydraulics.nas +++ b/Nasal/hydraulics.nas @@ -73,9 +73,14 @@ var hyd_init = func { setprop("/systems/hydraulic/brakes/mode", 0); setprop("/systems/hydraulic/brakes/lbrake", 0); setprop("/systems/hydraulic/brakes/rbrake", 0); - setprop("/systems/hydraulic/brakes/nose-rubber", 0); # this stops the nose from spinning when you raise the gear + setprop("/systems/hydraulic/brakes/nose-rubber", 0); # This stops the nose from spinning when you raise the gear setprop("/systems/hydraulic/brakes/counter", 0); setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0); + setprop("/systems/hydraulic/eng1-pump-fault", 0); + setprop("/systems/hydraulic/eng2-pump-fault", 0); + setprop("/systems/hydraulic/elec-pump-b-fault", 0); + setprop("/systems/hydraulic/elec-pump-y-fault", 0); + setprop("/systems/hydraulic/ptu-fault", 0); hyd_timer.start(); } @@ -224,6 +229,37 @@ var master_hyd = func { if (brake_mode == 2 and yellow_psi > 2500 and accum < 700) { setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", accum + 50); } + + # Fault lights + if (green_pump_fail and eng1_pump_sw) { + setprop("/systems/pneumatic/eng1-pump-fault", 1); + } else { + setprop("/systems/pneumatic/eng1-pump-fault", 0); + } + + if (blue_pump_fail and elec_pump_blue_sw) { + setprop("/systems/pneumatic/elec-pump-b-fault", 1); + } else { + setprop("/systems/pneumatic/elec-pump-b-fault", 0); + } + + if (ptu_fail and ptu_sw) { + setprop("/systems/pneumatic/ptu-fault", 1); + } else { + setprop("/systems/pneumatic/ptu-fault", 0); + } + + if (yellow_pump_eng_fail and eng2_pump_sw) { + setprop("/systems/pneumatic/eng2-pump-fault", 1); + } else { + setprop("/systems/pneumatic/eng2-pump-fault", 0); + } + + if (yellow_pump_elec_fail and elec_pump_yellow_sw) { + setprop("/systems/pneumatic/elec-pump-y-fault", 1); + } else { + setprop("/systems/pneumatic/elec-pump-y-fault", 0); + } } ####################### diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas index c8f245ff..53764cce 100644 --- a/Nasal/pneumatics.nas +++ b/Nasal/pneumatics.nas @@ -97,6 +97,12 @@ var pneu_init = func { setprop("/systems/pneumatic/startpsir", 0); setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0); + setprop("/systems/pneumatic/bleed1-fault", 0); + setprop("/systems/pneumatic/bleed2-fault", 0); + setprop("/systems/pneumatic/bleedapu-fault", 0); + setprop("/systems/pneumatic/hotair-fault", 0); + setprop("/systems/pneumatic/pack1-fault", 0); + setprop("/systems/pneumatic/pack2-fault", 0); setprop("/FMGC/internal/dep-arpt", ""); altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); setprop("/systems/pressurization/mode", "GN"); @@ -247,20 +253,6 @@ var master_pneu = func { setprop("/controls/deice/rengine", 1); } - var flashfault1 = func { - setprop("/controls/deice/eng1-fault", 1); - settimer(func { - setprop("/controls/deice/eng1-fault", 0); - }, 0.5); - } - - var flashfault2 = func { - setprop("/controls/deice/eng2-fault", 1); - settimer(func { - setprop("/controls/deice/eng2-fault", 0); - }, 0.5); - } - total_psi = getprop("/systems/pneumatic/total-psi"); phase = getprop("/FMGC/status/phase"); @@ -322,8 +314,53 @@ var master_pneu = func { setprop("/systems/ventilation/avionics/fan", 0); setprop("/systems/ventilation/lavatory/extractfan", 0); } + + # Fault lights + if (bleedeng1_fail and bleed1_sw) { + setprop("/systems/pneumatic/bleed1-fault", 1); + } else { + setprop("/systems/pneumatic/bleed1-fault", 0); + } + + if (bleedeng2_fail and bleed2_sw) { + setprop("/systems/pneumatic/bleed2-fault", 1); + } else { + setprop("/systems/pneumatic/bleed2-fault", 0); + } + + if (bleedapu_fail and bleedapu_sw) { + setprop("/systems/pneumatic/bleedapu-fault", 1); + } else { + setprop("/systems/pneumatic/bleedapu-fault", 0); + } + + if ((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)) { + setprop("/systems/pneumatic/pack2-fault", 1); + } else { + setprop("/systems/pneumatic/pack2-fault", 0); + } } +setlistener("/controls/pneumatic/switches/pack1", func { + pack1_sw = getprop("/controls/pneumatic/switches/pack1"); + if (pack1_sw) { + setprop("/systems/pneumatic/pack1-fault", 1); + } +}); + +setlistener("/controls/pneumatic/switches/pack2", func { + pack2_sw = getprop("/controls/pneumatic/switches/pack2"); + if (pack2_sw) { + setprop("/systems/pneumatic/pack2-fault", 1); + } +}); + setlistener("/controls/deice/eng1-on", func { eng1on = getprop("/controls/deice/eng1-on"); if (eng1on) { @@ -338,6 +375,20 @@ setlistener("/controls/deice/eng2-on", func { } }); +var flashfault1 = func { + setprop("/controls/deice/eng1-fault", 1); + settimer(func { + setprop("/controls/deice/eng1-fault", 0); + }, 0.5); +} + +var flashfault2 = func { + setprop("/controls/deice/eng2-fault", 1); + settimer(func { + setprop("/controls/deice/eng2-fault", 0); + }, 0.5); +} + ################### # Update Function # ###################