diff --git a/Models/Instruments/MCDU1/INITB/INITB.xml b/Models/Instruments/MCDU1/INITB/INITB.xml index ea981c30..1de6b1cf 100644 --- a/Models/Instruments/MCDU1/INITB/INITB.xml +++ b/Models/Instruments/MCDU1/INITB/INITB.xml @@ -273,7 +273,7 @@ rtersv2 -0.001 - -0.035 + -0.045 0.0505 left-center @@ -344,7 +344,7 @@ ldgw -0.001 - 0.040 + 0.043 0.029 right-center @@ -434,6 +434,31 @@ 64 + + + tow + + -0.001 + 0.0405 + 0.0335 + + right-center + yz-plane + text-value + LW + false + BoeingCDU-Large.ttf + autopilot/serviceable + true + false + false + 0.0040 + + 64 + 64 + + + altntime diff --git a/Models/Instruments/MCDU2/INITB/INITB.xml b/Models/Instruments/MCDU2/INITB/INITB.xml index ea981c30..1de6b1cf 100644 --- a/Models/Instruments/MCDU2/INITB/INITB.xml +++ b/Models/Instruments/MCDU2/INITB/INITB.xml @@ -273,7 +273,7 @@ rtersv2 -0.001 - -0.035 + -0.045 0.0505 left-center @@ -344,7 +344,7 @@ ldgw -0.001 - 0.040 + 0.043 0.029 right-center @@ -434,6 +434,31 @@ 64 + + + tow + + -0.001 + 0.0405 + 0.0335 + + right-center + yz-plane + text-value + LW + false + BoeingCDU-Large.ttf + autopilot/serviceable + true + false + false + 0.0040 + + 64 + 64 + + + altntime diff --git a/Nasal/FMGC.nas b/Nasal/FMGC.nas index 18a138f2..2eb00242 100644 --- a/Nasal/FMGC.nas +++ b/Nasal/FMGC.nas @@ -83,15 +83,19 @@ var phasecheck = maketimer(0.2, func { var vertmode = getprop("/modes/pfd/fma/pitch-mode"); if ((((n1_left >= 85) and (n1_right >= 85)) or (gs > 90 )) and flaps < 4 and (mode == "SRS")) { setprop("/FMGC/status/phase", "1"); + setprop("/systems/pressurization/mode", "TO"); } if ((alt >= 3000) and (alt <= cruisefl) and (phase == "1") and (phase != "4") and (mode != "SRS")) { setprop("/FMGC/status/phase", "2"); } if ((alt >= cruisefl) and (phase == "2") and (mode != "SRS")) { - setprop("/FMGC/status/phase", "3"); # for now cruise will be level 100 or above until the MCDU is ready + setprop("/FMGC/status/phase", "3"); + setprop("/systems/pressurization/mode", "CR"); } if ((alt <= cruisefl) and (phase == "3")) { # for now it will have to be when we begin descent. setprop("/FMGC/status/phase", "4"); + setprop("/systems/pressurization/mode", "DE"); + } if (getprop("/FMGC/status/to-state") == 0 and flaps >= 4 and ((phase == "4") or (phase == "2"))) { # add man activation of approach phase in MCDU or DECEL when those things are simulated setprop("/FMGC/status/phase", "5"); @@ -114,6 +118,7 @@ var phasecheck = maketimer(0.2, func { mcdu2.MCDU_reset(); setprop("/it-autoflight/input/fd1", fd1); setprop("/it-autoflight/input/fd2", fd2); + press_init(); } }); diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index db2cd475..e988ce79 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -152,6 +152,7 @@ setlistener("/sim/signals/fdm-initialized", func { systems.adirs_init(); systems.pneu_init(); systems.hyd_init(); + systems.press_init(); itaf.ap_init(); externalconnections.start(); fmgc.FMGCinit(); diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas index aa173e4b..ccfa3af8 100644 --- a/Nasal/pneumatics.nas +++ b/Nasal/pneumatics.nas @@ -29,11 +29,93 @@ var pneu_init = func { setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0); pneu_timer.start(); + press_timer.start(); +} + +var press_init = func { + setprop("/FMGC/internal/dep-arpt", ""); + setprop("/systems/pressurization/mode", "GN"); + setprop("/systems/pressurization/vs", "0"); + setprop("/systems/pressurization/auto", 1); + setprop("/systems/pressurization/deltap", "0"); + setprop("/systems/pressurization/outflowpos", "0"); + var altitude = getprop("/position/altitude-ft"); + setprop("/systems/pressurization/cabinalt", altitude); # initially set altitude +} + +############## +# Main Loops # +############## +var master_press = func { + 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 cabinalt = getprop("/systems/pressurization/cabinalt"); + var dep_apt = getprop("autopilot/route-manager/departure/airport"); + var airport_dep_elev_ft = getprop("autopilot/route-manager/departure/field-elevation-ft"); + var altitude = getprop("/position/altitude-ft"); + var airport_arr_elev_ft = getprop("autopilot/route-manager/destination/field-elevation-ft"); + var vs = getprop("/systems/pressurization/vs"); + var outflowpos = getprop("/systems/pressurization/outflowpos"); + var cabinalt = getprop("/systems/pressurization/cabinalt"); + + # switch mode to TO + if ((pressmode == "GN") and (pressmode != "CL") and (wowl and wowr) and ((state1 == "MCT") or (state1 == "TOGA")) and ((state2 == "MCT") or (state2 == "TOGA"))) { + setprop("/systems/pressurization/mode", "TO"); + } + + # prepressurization + var pressmode = getprop("/systems/pressurization/mode"); + if (pressmode == "TO") { + if (outflowpos == "0") { + interpolate("/systems/pressurization/outflowpos", 1, 1); + } + if (vs > -500 and (outflowpos != 0.5)) { + interpolate("/systems/pressurization/vs", vs - 50, 0.1); + } + if (dep_apt != "") { + if ((cabinalt > (airport_dep_elev_ft - 1)) and (cabinalt < (airport_dep_elev_ft + 1))) { + interpolate("/systems/pressurization/cabinalt", airport_dep_elev_ft - 187, 10); + } + } else { + if ((cabinalt > (altitude - 1)) and (cabinalt < (altitude + 1))) { + interpolate("/systems/pressurization/cabinalt", altitude - 187, 10); + } + } + if (dep_apt != "") { + if (cabinalt < (airport_dep_elev_ft - 183)) { + if (vs < 0) { + interpolate("/systems/pressurization/vs", 0, 1); + } + if (outflowpos == "1") { + interpolate("/systems/pressurization/outflowpos", 0.5, 1); + } + } + } else { + if (cabinalt < (altitude - 183)) { + if (vs < 0) { + interpolate("/systems/pressurization/vs", vs + 50, 0.1); + } + if (outflowpos == "1") { + interpolate("/systems/pressurization/outflowpos", 0.5, 1); + } + } + } + } + + # switch mode to CLB + if (((!wowl) or (!wowr)) and (speed > 100) and (pressmode == "TO")) { + setprop("/systems/pressurization/mode", "CL"); + + } } -####################### -# Main Pneumatic Loop # -####################### var master_pneu = func { var bleed1_sw = getprop("/controls/pneumatic/switches/bleed1"); @@ -140,3 +222,9 @@ var update_pneumatic = func { } var pneu_timer = maketimer(0.2, update_pneumatic); + +var update_press = func { + master_press(); +} + +var press_timer = maketimer(0.1, update_press); diff --git a/README.md b/README.md index 2946a6c5..f2f833a2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # A320Family -A very advanced simulation of the Airbus A320 Family for FlightGear.
+A very advanced simulation of the Airbus A320 Family for FlightGear. Brought to you by: - Joshua Davidson (it0uchpods) @@ -9,4 +9,4 @@ Including repaints by: - Brandon Amaro (omega13a) - Suleman Siddiqui (pakistan-1) - Sven Seipp (D-SVEN) -- Various Others +- Various Others \ No newline at end of file