A3XX: Code Cleanup, less garbage collecting nessesary = more FPS?
This commit is contained in:
parent
1121df302e
commit
9bfc9f5f11
2 changed files with 228 additions and 141 deletions
|
@ -5,41 +5,7 @@
|
||||||
# Init Vars #
|
# Init Vars #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
var hyd_init = func {
|
setlistener("/sim/signals/fdm-initialized", func {
|
||||||
setprop("/controls/hydraulic/eng1-pump", 1);
|
|
||||||
setprop("/controls/hydraulic/eng2-pump", 1);
|
|
||||||
setprop("/controls/hydraulic/elec-pump-blue", 1);
|
|
||||||
setprop("/controls/hydraulic/elec-pump-yellow", 0);
|
|
||||||
setprop("/controls/hydraulic/hand-pump-yellow", 0);
|
|
||||||
setprop("/controls/hydraulic/ptu", 1);
|
|
||||||
setprop("/controls/hydraulic/rat-man", 0);
|
|
||||||
setprop("/controls/hydraulic/rat", 0);
|
|
||||||
setprop("/controls/hydraulic/rat-deployed", 0);
|
|
||||||
setprop("/systems/hydraulic/ptu-active", 0);
|
|
||||||
setprop("/systems/hydraulic/blue-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/green-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/yellow-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/spoiler3and4-inhibit", 0);
|
|
||||||
setprop("/systems/hydraulic/spoiler-inhibit", 0);
|
|
||||||
setprop("/controls/gear/brake-parking", 0);
|
|
||||||
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/brakes/pressure-left-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/brakes/pressure-right-psi", 0);
|
|
||||||
setprop("/systems/hydraulic/brakes/askidnwssw", 1);
|
|
||||||
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/counter", 0);
|
|
||||||
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0);
|
|
||||||
hyd_timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Main Hydraulic Loop #
|
|
||||||
#######################
|
|
||||||
|
|
||||||
var master_hyd = func {
|
|
||||||
var eng1_pump_sw = getprop("/controls/hydraulic/eng1-pump");
|
var eng1_pump_sw = getprop("/controls/hydraulic/eng1-pump");
|
||||||
var eng2_pump_sw = getprop("/controls/hydraulic/eng2-pump");
|
var eng2_pump_sw = getprop("/controls/hydraulic/eng2-pump");
|
||||||
var elec_pump_blue_sw = getprop("/controls/hydraulic/elec-pump-blue");
|
var elec_pump_blue_sw = getprop("/controls/hydraulic/elec-pump-blue");
|
||||||
|
@ -67,6 +33,80 @@ var master_hyd = func {
|
||||||
var yellow_pump_elec_fail = getprop("/systems/failures/pump-yellow-elec");
|
var yellow_pump_elec_fail = getprop("/systems/failures/pump-yellow-elec");
|
||||||
var ptu_fail = getprop("/systems/failures/ptu");
|
var ptu_fail = getprop("/systems/failures/ptu");
|
||||||
var dc2 = getprop("/systems/electrical/bus/dc2");
|
var dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
var ptu_active = getprop("/systems/hydraulic/ptu-active");
|
||||||
|
var accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
|
||||||
|
var lpsi = getprop("/systems/hydraulic/brakes/pressure-left-psi");
|
||||||
|
var rpsi = getprop("/systems/hydraulic/brakes/pressure-right-psi");
|
||||||
|
var parking = getprop("/controls/gear/brake-parking");
|
||||||
|
var askidnws_sw = getprop("/systems/hydraulic/brakes/askidnwssw");
|
||||||
|
var brake_mode = getprop("/systems/hydraulic/brakes/mode");
|
||||||
|
var brake_l = getprop("/systems/hydraulic/brakes/lbrake");
|
||||||
|
var brake_r = getprop("/systems/hydraulic/brakes/rbrake");
|
||||||
|
var brake_nose = getprop("/systems/hydraulic/brakes/nose-rubber");
|
||||||
|
var counter = getprop("/systems/hydraulic/brakes/counter");
|
||||||
|
var down = getprop("/controls/gear/gear-down");
|
||||||
|
});
|
||||||
|
|
||||||
|
var hyd_init = func {
|
||||||
|
setprop("/controls/hydraulic/eng1-pump", 1);
|
||||||
|
setprop("/controls/hydraulic/eng2-pump", 1);
|
||||||
|
setprop("/controls/hydraulic/elec-pump-blue", 1);
|
||||||
|
setprop("/controls/hydraulic/elec-pump-yellow", 0);
|
||||||
|
setprop("/controls/hydraulic/hand-pump-yellow", 0);
|
||||||
|
setprop("/controls/hydraulic/ptu", 1);
|
||||||
|
setprop("/controls/hydraulic/rat-man", 0);
|
||||||
|
setprop("/controls/hydraulic/rat", 0);
|
||||||
|
setprop("/controls/hydraulic/rat-deployed", 0);
|
||||||
|
setprop("/systems/hydraulic/ptu-active", 0);
|
||||||
|
setprop("/systems/hydraulic/blue-psi", 0);
|
||||||
|
setprop("/systems/hydraulic/green-psi", 0);
|
||||||
|
setprop("/systems/hydraulic/yellow-psi", 0);
|
||||||
|
setprop("/controls/gear/brake-parking", 0);
|
||||||
|
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", 0);
|
||||||
|
setprop("/systems/hydraulic/brakes/pressure-left-psi", 0);
|
||||||
|
setprop("/systems/hydraulic/brakes/pressure-right-psi", 0);
|
||||||
|
setprop("/systems/hydraulic/brakes/askidnwssw", 1);
|
||||||
|
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/counter", 0);
|
||||||
|
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0);
|
||||||
|
hyd_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Main Hydraulic Loop #
|
||||||
|
#######################
|
||||||
|
|
||||||
|
var master_hyd = func {
|
||||||
|
eng1_pump_sw = getprop("/controls/hydraulic/eng1-pump");
|
||||||
|
eng2_pump_sw = getprop("/controls/hydraulic/eng2-pump");
|
||||||
|
elec_pump_blue_sw = getprop("/controls/hydraulic/elec-pump-blue");
|
||||||
|
elec_pump_yellow_sw = getprop("/controls/hydraulic/elec-pump-yellow");
|
||||||
|
yellow_hand_pump = getprop("/controls/hydraulic/hand-pump-yellow");
|
||||||
|
ptu_sw = getprop("/controls/hydraulic/ptu");
|
||||||
|
rat_man_sw = getprop("/controls/hydraulic/rat-man");
|
||||||
|
blue_psi = getprop("/systems/hydraulic/blue-psi");
|
||||||
|
green_psi = getprop("/systems/hydraulic/green-psi");
|
||||||
|
yellow_psi = getprop("/systems/hydraulic/yellow-psi");
|
||||||
|
rpmapu = getprop("/systems/apu/rpm");
|
||||||
|
stateL = getprop("/engines/engine[0]/state");
|
||||||
|
stateR = getprop("/engines/engine[1]/state");
|
||||||
|
dc_ess = getprop("/systems/electrical/bus/dc-ess");
|
||||||
|
psi_diff = green_psi - yellow_psi;
|
||||||
|
rat = getprop("/controls/hydraulic/rat");
|
||||||
|
ratout = getprop("/controls/hydraulic/rat-deployed");
|
||||||
|
gs = getprop("/velocities/groundspeed-kt");
|
||||||
|
blue_leak = getprop("/systems/failures/hyd-blue");
|
||||||
|
green_leak = getprop("/systems/failures/hyd-green");
|
||||||
|
yellow_leak = getprop("/systems/failures/hyd-yellow");
|
||||||
|
blue_pump_fail = getprop("/systems/failures/pump-blue");
|
||||||
|
green_pump_fail = getprop("/systems/failures/pump-green");
|
||||||
|
yellow_pump_eng_fail = getprop("/systems/failures/pump-yellow-eng");
|
||||||
|
yellow_pump_elec_fail = getprop("/systems/failures/pump-yellow-elec");
|
||||||
|
ptu_fail = getprop("/systems/failures/ptu");
|
||||||
|
dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
|
||||||
if (psi_diff > 500 or psi_diff < -500 and ptu_sw and dc2 > 28) {
|
if (psi_diff > 500 or psi_diff < -500 and ptu_sw and dc2 > 28) {
|
||||||
setprop("/systems/hydraulic/ptu-active", 1);
|
setprop("/systems/hydraulic/ptu-active", 1);
|
||||||
|
@ -81,7 +121,7 @@ var master_hyd = func {
|
||||||
setprop("/controls/hydraulic/rat", 0);
|
setprop("/controls/hydraulic/rat", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ptu_active = getprop("/systems/hydraulic/ptu-active");
|
ptu_active = getprop("/systems/hydraulic/ptu-active");
|
||||||
|
|
||||||
if ((elec_pump_blue_sw and dc_ess >= 25 and !blue_pump_fail) and (stateL == 3 or stateR == 3) and !blue_leak) {
|
if ((elec_pump_blue_sw and dc_ess >= 25 and !blue_pump_fail) and (stateL == 3 or stateR == 3) and !blue_leak) {
|
||||||
if (blue_psi < 2900) {
|
if (blue_psi < 2900) {
|
||||||
|
@ -155,36 +195,16 @@ var master_hyd = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var lelev = getprop("/systems/failures/elevator-left");
|
accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
|
||||||
var relev = getprop("/systems/failures/elevator-right");
|
lpsi = getprop("/systems/hydraulic/brakes/pressure-left-psi");
|
||||||
var flap = getprop("/controls/flight/flap-txt");
|
rpsi = getprop("/systems/hydraulic/brakes/pressure-right-psi");
|
||||||
var state1 = getprop("/systems/thrust/state1");
|
parking = getprop("/controls/gear/brake-parking");
|
||||||
var state2 = getprop("/systems/thrust/state2");
|
askidnws_sw = getprop("/systems/hydraulic/brakes/askidnwssw");
|
||||||
var alpha = getprop("/systems/thrust/alpha-floor");
|
brake_mode = getprop("/systems/hydraulic/brakes/mode");
|
||||||
var sec1 = getprop("/systems/failures/sec1");
|
brake_l = getprop("/systems/hydraulic/brakes/lbrake");
|
||||||
var sec3 = getprop("/systems/failures/sec3");
|
brake_r = getprop("/systems/hydraulic/brakes/rbrake");
|
||||||
#var aoa_prot = getprop("aoaprotection);
|
brake_nose = getprop("/systems/hydraulic/brakes/nose-rubber");
|
||||||
if (lelev or relev) {
|
counter = getprop("/systems/hydraulic/brakes/counter");
|
||||||
setprop("/systems/hydraulic/spoiler3and4-inhibit", 1);
|
|
||||||
} else {
|
|
||||||
setprop("/systems/hydraulic/spoiler3and4-inhibit", 0);
|
|
||||||
}
|
|
||||||
if ((flap == "FULL") or alpha or (sec1 and sec3) or (((state1 == "MCT") or (state1 == "TOGA")) and ((state2 == "MCT") or (state2 == "TOGA")))) {
|
|
||||||
setprop("/systems/hydraulic/spoiler-inhibit", 1);
|
|
||||||
} else {
|
|
||||||
setprop("/systems/hydraulic/spoiler-inhibit", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
|
|
||||||
var lpsi = getprop("/systems/hydraulic/brakes/pressure-left-psi");
|
|
||||||
var rpsi = getprop("/systems/hydraulic/brakes/pressure-right-psi");
|
|
||||||
var parking = getprop("/controls/gear/brake-parking");
|
|
||||||
var askidnws_sw = getprop("/systems/hydraulic/brakes/askidnwssw");
|
|
||||||
var brake_mode = getprop("/systems/hydraulic/brakes/mode");
|
|
||||||
var brake_l = getprop("/systems/hydraulic/brakes/lbrake");
|
|
||||||
var brake_r = getprop("/systems/hydraulic/brakes/rbrake");
|
|
||||||
var brake_nose = getprop("/systems/hydraulic/brakes/nose-rubber");
|
|
||||||
var counter = getprop("/systems/hydraulic/brakes/counter");
|
|
||||||
|
|
||||||
if (!parking and askidnws_sw and green_psi > 2500) {
|
if (!parking and askidnws_sw and green_psi > 2500) {
|
||||||
# set mode to on
|
# set mode to on
|
||||||
|
@ -207,7 +227,7 @@ var master_hyd = func {
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
setlistener("/controls/gear/gear-down", func {
|
setlistener("/controls/gear/gear-down", func {
|
||||||
var down = getprop("/controls/gear/gear-down");
|
down = getprop("/controls/gear/gear-down");
|
||||||
if (!down and (getprop("/gear/gear[0]/wow") or getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow"))) {
|
if (!down and (getprop("/gear/gear[0]/wow") or getprop("/gear/gear[1]/wow") or getprop("/gear/gear[2]/wow"))) {
|
||||||
setprop("/controls/gear/gear-down", 1);
|
setprop("/controls/gear/gear-down", 1);
|
||||||
}
|
}
|
||||||
|
@ -229,3 +249,5 @@ var hyd_timer = maketimer(0.2, update_hydraulic);
|
||||||
# /systems/hydraulic/brakes/accumulator-pressure-psi is equal to 0 and when /systems/hydraulic/brakes/mode is equal to 2
|
# /systems/hydraulic/brakes/accumulator-pressure-psi is equal to 0 and when /systems/hydraulic/brakes/mode is equal to 2
|
||||||
# Thanks!
|
# Thanks!
|
||||||
|
|
||||||
|
# Will do -JD
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,71 @@
|
||||||
# Init Vars #
|
# Init Vars #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
|
setlistener("/sim/signals/fdm-initialized", func {
|
||||||
|
var altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
|
var bleed1_sw = getprop("/controls/pneumatic/switches/bleed1");
|
||||||
|
var bleed2_sw = getprop("/controls/pneumatic/switches/bleed2");
|
||||||
|
var bleedapu_sw = getprop("/controls/pneumatic/switches/bleedapu");
|
||||||
|
var pack1_sw = getprop("/controls/pneumatic/switches/pack1");
|
||||||
|
var pack2_sw = getprop("/controls/pneumatic/switches/pack2");
|
||||||
|
var hot_air_sw = getprop("/controls/pneumatic/switches/hot-air");
|
||||||
|
var ram_air_sw = getprop("/controls/pneumatic/switches/ram-air");
|
||||||
|
var pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo");
|
||||||
|
var xbleed_sw = getprop("/controls/pneumatic/switches/xbleed");
|
||||||
|
var eng1_starter = getprop("/systems/pneumatic/eng1-starter");
|
||||||
|
var eng2_starter = getprop("/systems/pneumatic/eng2-starter");
|
||||||
|
var groundair = getprop("/systems/pneumatic/groundair");
|
||||||
|
var groundair_supp = getprop("/controls/pneumatic/switches/groundair");
|
||||||
|
var rpmapu = getprop("/systems/apu/rpm");
|
||||||
|
var stateL = getprop("/engines/engine[0]/state");
|
||||||
|
var stateR = getprop("/engines/engine[1]/state");
|
||||||
|
var bleedapu_fail = getprop("/systems/failures/bleed-apu");
|
||||||
|
var bleedext_fail = getprop("/systems/failures/bleed-ext");
|
||||||
|
var bleedeng1_fail = getprop("/systems/failures/bleed-eng1");
|
||||||
|
var bleedeng2_fail = getprop("/systems/failures/bleed-eng2");
|
||||||
|
var pack1_fail = getprop("/systems/failures/pack1");
|
||||||
|
var pack2_fail = getprop("/systems/failures/pack2");
|
||||||
|
var engantiice1 = getprop("/controls/deice/eng1-on");
|
||||||
|
var engantiice2 = getprop("/controls/deice/eng2-on");
|
||||||
|
var bleed1 = getprop("/systems/pneumatic/bleed1");
|
||||||
|
var bleed2 = getprop("/systems/pneumatic/bleed2");
|
||||||
|
var bleedapu = getprop("/systems/pneumatic/bleedapu");
|
||||||
|
var ground = getprop("/systems/pneumatic/groundair");
|
||||||
|
var pack1 = getprop("/systems/pneumatic/pack1");
|
||||||
|
var pack2 = getprop("/systems/pneumatic/pack2");
|
||||||
|
var pack_psi = getprop("/systems/pneumatic/pack-psi");
|
||||||
|
var start_psi = getprop("/systems/pneumatic/start-psi");
|
||||||
|
var total_psi = getprop("/systems/pneumatic/total-psi");
|
||||||
|
var phase = getprop("/FMGC/status/phase");
|
||||||
|
var pressmode = getprop("/systems/pressurization/mode");
|
||||||
|
var state1 = getprop("/systems/thrust/state1");
|
||||||
|
var state2 = getprop("/systems/thrust/state2");
|
||||||
|
var wowl = getprop("/gear/gear[1]/wow");
|
||||||
|
var wowr = getprop("/gear/gear[2]/wow");
|
||||||
|
var deltap = getprop("/systems/pressurization/deltap");
|
||||||
|
var outflow = getprop("/systems/pressurization/outflowpos");
|
||||||
|
var speed = getprop("/velocities/groundspeed-kt");
|
||||||
|
var altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
|
var airport_arr_elev_ft = getprop("autopilot/route-manager/destination/field-elevation-ft");
|
||||||
|
var vs = getprop("/systems/pressurization/vs-norm");
|
||||||
|
var manvs = getprop("/systems/pressurization/manvs-cmd");
|
||||||
|
var ditch = getprop("/systems/pressurization/ditchingpb");
|
||||||
|
var outflowpos = getprop("/systems/pressurization/outflowpos");
|
||||||
|
var cabinalt = getprop("/systems/pressurization/cabinalt");
|
||||||
|
var targetalt = getprop("/systems/pressurization/targetalt");
|
||||||
|
var targetvs = getprop("/systems/pressurization/targetvs");
|
||||||
|
var ambient = getprop("/systems/pressurization/ambientpsi");
|
||||||
|
var cabinpsi = getprop("/systems/pressurization/cabinpsi");
|
||||||
|
var pause = getprop("/sim/freeze/master");
|
||||||
|
var auto = getprop("/systems/pressurization/auto");
|
||||||
|
var dcess = getprop("/systems/electrical/bus/dc-ess");
|
||||||
|
var acess = getprop("/systems/electrical/bus/ac-ess");
|
||||||
|
var fanon = getprop("/systems/ventilation/avionics/fan");
|
||||||
|
var eng1on = getprop("/controls/deice/eng1-on");
|
||||||
|
var eng2on = getprop("/controls/deice/eng2-on");
|
||||||
|
var total_psi_calc = 0;
|
||||||
|
});
|
||||||
|
|
||||||
var pneu_init = func {
|
var pneu_init = func {
|
||||||
setprop("/controls/pneumatic/switches/bleed1", 1);
|
setprop("/controls/pneumatic/switches/bleed1", 1);
|
||||||
setprop("/controls/pneumatic/switches/bleed2", 1);
|
setprop("/controls/pneumatic/switches/bleed2", 1);
|
||||||
|
@ -29,7 +94,7 @@ var pneu_init = func {
|
||||||
setprop("/systems/pneumatic/eng1-starter", 0);
|
setprop("/systems/pneumatic/eng1-starter", 0);
|
||||||
setprop("/systems/pneumatic/eng2-starter", 0);
|
setprop("/systems/pneumatic/eng2-starter", 0);
|
||||||
setprop("/FMGC/internal/dep-arpt", "");
|
setprop("/FMGC/internal/dep-arpt", "");
|
||||||
var altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
setprop("/systems/pressurization/mode", "GN");
|
setprop("/systems/pressurization/mode", "GN");
|
||||||
setprop("/systems/pressurization/vs", "0");
|
setprop("/systems/pressurization/vs", "0");
|
||||||
setprop("/systems/pressurization/targetvs", "0");
|
setprop("/systems/pressurization/targetvs", "0");
|
||||||
|
@ -66,30 +131,30 @@ var pneu_init = func {
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
var master_pneu = func {
|
var master_pneu = func {
|
||||||
var bleed1_sw = getprop("/controls/pneumatic/switches/bleed1");
|
bleed1_sw = getprop("/controls/pneumatic/switches/bleed1");
|
||||||
var bleed2_sw = getprop("/controls/pneumatic/switches/bleed2");
|
bleed2_sw = getprop("/controls/pneumatic/switches/bleed2");
|
||||||
var bleedapu_sw = getprop("/controls/pneumatic/switches/bleedapu");
|
bleedapu_sw = getprop("/controls/pneumatic/switches/bleedapu");
|
||||||
var pack1_sw = getprop("/controls/pneumatic/switches/pack1");
|
pack1_sw = getprop("/controls/pneumatic/switches/pack1");
|
||||||
var pack2_sw = getprop("/controls/pneumatic/switches/pack2");
|
pack2_sw = getprop("/controls/pneumatic/switches/pack2");
|
||||||
var hot_air_sw = getprop("/controls/pneumatic/switches/hot-air");
|
hot_air_sw = getprop("/controls/pneumatic/switches/hot-air");
|
||||||
var ram_air_sw = getprop("/controls/pneumatic/switches/ram-air");
|
ram_air_sw = getprop("/controls/pneumatic/switches/ram-air");
|
||||||
var pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo");
|
pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo");
|
||||||
var xbleed_sw = getprop("/controls/pneumatic/switches/xbleed");
|
xbleed_sw = getprop("/controls/pneumatic/switches/xbleed");
|
||||||
var eng1_starter = getprop("/systems/pneumatic/eng1-starter");
|
eng1_starter = getprop("/systems/pneumatic/eng1-starter");
|
||||||
var eng2_starter = getprop("/systems/pneumatic/eng2-starter");
|
eng2_starter = getprop("/systems/pneumatic/eng2-starter");
|
||||||
var groundair = getprop("/systems/pneumatic/groundair");
|
groundair = getprop("/systems/pneumatic/groundair");
|
||||||
var groundair_supp = getprop("/controls/pneumatic/switches/groundair");
|
groundair_supp = getprop("/controls/pneumatic/switches/groundair");
|
||||||
var rpmapu = getprop("/systems/apu/rpm");
|
rpmapu = getprop("/systems/apu/rpm");
|
||||||
var stateL = getprop("/engines/engine[0]/state");
|
stateL = getprop("/engines/engine[0]/state");
|
||||||
var stateR = getprop("/engines/engine[1]/state");
|
stateR = getprop("/engines/engine[1]/state");
|
||||||
var bleedapu_fail = getprop("/systems/failures/bleed-apu");
|
bleedapu_fail = getprop("/systems/failures/bleed-apu");
|
||||||
var bleedext_fail = getprop("/systems/failures/bleed-ext");
|
bleedext_fail = getprop("/systems/failures/bleed-ext");
|
||||||
var bleedeng1_fail = getprop("/systems/failures/bleed-eng1");
|
bleedeng1_fail = getprop("/systems/failures/bleed-eng1");
|
||||||
var bleedeng2_fail = getprop("/systems/failures/bleed-eng2");
|
bleedeng2_fail = getprop("/systems/failures/bleed-eng2");
|
||||||
var pack1_fail = getprop("/systems/failures/pack1");
|
pack1_fail = getprop("/systems/failures/pack1");
|
||||||
var pack2_fail = getprop("/systems/failures/pack2");
|
pack2_fail = getprop("/systems/failures/pack2");
|
||||||
var engantiice1 = getprop("/controls/deice/eng1-on");
|
engantiice1 = getprop("/controls/deice/eng1-on");
|
||||||
var engantiice2 = getprop("/controls/deice/eng2-on");
|
engantiice2 = getprop("/controls/deice/eng2-on");
|
||||||
|
|
||||||
# Air Sources/PSI
|
# Air Sources/PSI
|
||||||
if (rpmapu >= 94.9 and bleedapu_sw and !bleedapu_fail) {
|
if (rpmapu >= 94.9 and bleedapu_sw and !bleedapu_fail) {
|
||||||
|
@ -110,10 +175,10 @@ var master_pneu = func {
|
||||||
setprop("/systems/pneumatic/bleed2", 0);
|
setprop("/systems/pneumatic/bleed2", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bleed1 = getprop("/systems/pneumatic/bleed1");
|
bleed1 = getprop("/systems/pneumatic/bleed1");
|
||||||
var bleed2 = getprop("/systems/pneumatic/bleed2");
|
bleed2 = getprop("/systems/pneumatic/bleed2");
|
||||||
var bleedapu = getprop("/systems/pneumatic/bleedapu");
|
bleedapu = getprop("/systems/pneumatic/bleedapu");
|
||||||
var ground = getprop("/systems/pneumatic/groundair");
|
ground = getprop("/systems/pneumatic/groundair");
|
||||||
|
|
||||||
if (stateL == 1 or stateR == 1) {
|
if (stateL == 1 or stateR == 1) {
|
||||||
setprop("/systems/pneumatic/start-psi", 18);
|
setprop("/systems/pneumatic/start-psi", 18);
|
||||||
|
@ -133,8 +198,8 @@ var master_pneu = func {
|
||||||
setprop("/systems/pneumatic/pack2", 0);
|
setprop("/systems/pneumatic/pack2", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pack1 = getprop("/systems/pneumatic/pack1");
|
pack1 = getprop("/systems/pneumatic/pack1");
|
||||||
var pack2 = getprop("/systems/pneumatic/pack2");
|
pack2 = getprop("/systems/pneumatic/pack2");
|
||||||
|
|
||||||
if (pack1_sw == 1 and pack2_sw == 1) {
|
if (pack1_sw == 1 and pack2_sw == 1) {
|
||||||
setprop("/systems/pneumatic/pack-psi", pack1 + pack2);
|
setprop("/systems/pneumatic/pack-psi", pack1 + pack2);
|
||||||
|
@ -144,13 +209,13 @@ var master_pneu = func {
|
||||||
setprop("/systems/pneumatic/pack-psi", pack1 + pack2 + 5);
|
setprop("/systems/pneumatic/pack-psi", pack1 + pack2 + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pack_psi = getprop("/systems/pneumatic/pack-psi");
|
pack_psi = getprop("/systems/pneumatic/pack-psi");
|
||||||
var start_psi = getprop("/systems/pneumatic/start-psi");
|
start_psi = getprop("/systems/pneumatic/start-psi");
|
||||||
|
|
||||||
if ((bleed1 + bleed2 + bleedapu) > 42) {
|
if ((bleed1 + bleed2 + bleedapu) > 42) {
|
||||||
setprop("/systems/pneumatic/total-psi", 42);
|
setprop("/systems/pneumatic/total-psi", 42);
|
||||||
} else {
|
} else {
|
||||||
var total_psi_calc = ((bleed1 + bleed2 + bleedapu + ground) - start_psi - pack_psi);
|
total_psi_calc = ((bleed1 + bleed2 + bleedapu + ground) - start_psi - pack_psi);
|
||||||
setprop("/systems/pneumatic/total-psi", total_psi_calc);
|
setprop("/systems/pneumatic/total-psi", total_psi_calc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,44 +257,30 @@ var master_pneu = func {
|
||||||
}, 0.5);
|
}, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
setlistener("/controls/deice/eng1-on", func {
|
total_psi = getprop("/systems/pneumatic/total-psi");
|
||||||
var eng1on = getprop("/controls/deice/eng1-on");
|
|
||||||
if (eng1on) {
|
|
||||||
flashfault1();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setlistener("/controls/deice/eng2-on", func {
|
phase = getprop("/FMGC/status/phase");
|
||||||
var eng2on = getprop("/controls/deice/eng2-on");
|
pressmode = getprop("/systems/pressurization/mode");
|
||||||
if (eng2on) {
|
state1 = getprop("/systems/thrust/state1");
|
||||||
flashfault2();
|
state2 = getprop("/systems/thrust/state2");
|
||||||
}
|
wowl = getprop("/gear/gear[1]/wow");
|
||||||
});
|
wowr = getprop("/gear/gear[2]/wow");
|
||||||
|
deltap = getprop("/systems/pressurization/deltap");
|
||||||
var total_psi = getprop("/systems/pneumatic/total-psi");
|
outflow = getprop("/systems/pressurization/outflowpos");
|
||||||
|
speed = getprop("/velocities/groundspeed-kt");
|
||||||
var phase = getprop("/FMGC/status/phase");
|
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
var pressmode = getprop("/systems/pressurization/mode");
|
airport_arr_elev_ft = getprop("autopilot/route-manager/destination/field-elevation-ft");
|
||||||
var state1 = getprop("/systems/thrust/state1");
|
vs = getprop("/systems/pressurization/vs-norm");
|
||||||
var state2 = getprop("/systems/thrust/state2");
|
manvs = getprop("/systems/pressurization/manvs-cmd");
|
||||||
var wowl = getprop("/gear/gear[1]/wow");
|
ditch = getprop("/systems/pressurization/ditchingpb");
|
||||||
var wowr = getprop("/gear/gear[2]/wow");
|
outflowpos = getprop("/systems/pressurization/outflowpos");
|
||||||
var deltap = getprop("/systems/pressurization/deltap");
|
cabinalt = getprop("/systems/pressurization/cabinalt");
|
||||||
var outflow = getprop("/systems/pressurization/outflowpos");
|
targetalt = getprop("/systems/pressurization/targetalt");
|
||||||
var speed = getprop("/velocities/groundspeed-kt");
|
targetvs = getprop("/systems/pressurization/targetvs");
|
||||||
var altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
ambient = getprop("/systems/pressurization/ambientpsi");
|
||||||
var airport_arr_elev_ft = getprop("autopilot/route-manager/destination/field-elevation-ft");
|
cabinpsi = getprop("/systems/pressurization/cabinpsi");
|
||||||
var vs = getprop("/systems/pressurization/vs-norm");
|
pause = getprop("/sim/freeze/master");
|
||||||
var manvs = getprop("/systems/pressurization/manvs-cmd");
|
auto = getprop("/systems/pressurization/auto");
|
||||||
var ditch = getprop("/systems/pressurization/ditchingpb");
|
|
||||||
var outflowpos = getprop("/systems/pressurization/outflowpos");
|
|
||||||
var cabinalt = getprop("/systems/pressurization/cabinalt");
|
|
||||||
var targetalt = getprop("/systems/pressurization/targetalt");
|
|
||||||
var targetvs = getprop("/systems/pressurization/targetvs");
|
|
||||||
var ambient = getprop("/systems/pressurization/ambientpsi");
|
|
||||||
var cabinpsi = getprop("/systems/pressurization/cabinpsi");
|
|
||||||
var pause = getprop("/sim/freeze/master");
|
|
||||||
var auto = getprop("/systems/pressurization/auto");
|
|
||||||
|
|
||||||
setprop("/systems/pressurization/diff-to-target", targetalt - cabinalt);
|
setprop("/systems/pressurization/diff-to-target", targetalt - cabinalt);
|
||||||
setprop("/systems/pressurization/deltap", cabinpsi - ambient);
|
setprop("/systems/pressurization/deltap", cabinpsi - ambient);
|
||||||
|
@ -256,9 +307,9 @@ var master_pneu = func {
|
||||||
setprop("/systems/ventilation/avionics/inletvalve", "1");
|
setprop("/systems/ventilation/avionics/inletvalve", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
var dcess = getprop("/systems/electrical/bus/dc-ess");
|
dcess = getprop("/systems/electrical/bus/dc-ess");
|
||||||
var acess = getprop("/systems/electrical/bus/ac-ess");
|
acess = getprop("/systems/electrical/bus/ac-ess");
|
||||||
var fanon = getprop("/systems/ventilation/avionics/fan");
|
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/avionics/fan", 1);
|
||||||
|
@ -269,6 +320,20 @@ var master_pneu = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setlistener("/controls/deice/eng1-on", func {
|
||||||
|
eng1on = getprop("/controls/deice/eng1-on");
|
||||||
|
if (eng1on) {
|
||||||
|
flashfault1();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setlistener("/controls/deice/eng2-on", func {
|
||||||
|
eng2on = getprop("/controls/deice/eng2-on");
|
||||||
|
if (eng2on) {
|
||||||
|
flashfault2();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Update Function #
|
# Update Function #
|
||||||
###################
|
###################
|
||||||
|
|
Reference in a new issue