From 92379a7bfc83a9698530fef3e927f9c432043967 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 10 Jun 2017 19:28:22 +0100 Subject: [PATCH] major update to pneumatics --- Models/Instruments/OHpanel/OHpanel.xml | 12 +- Nasal/libraries.nas | 1 - Nasal/pneumatics.nas | 37 ++-- Systems/libraries.xml | 237 +++++++++++++++++-------- 4 files changed, 192 insertions(+), 95 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 6b18a0c6..579778d2 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -3171,7 +3171,7 @@ false - + nasal @@ -3235,7 +3235,7 @@ false - + /systems/pressurization/ditchingpb + nasal @@ -3272,7 +3272,7 @@ - /controls/pressurization/unused-oh-btn + /systems/pressurization/ditchingpb 1 diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 09a111ce..a9f7cf05 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -161,7 +161,6 @@ setlistener("/sim/signals/fdm-initialized", func { systems.adirs_init(); systems.pneu_init(); systems.hyd_init(); - systems.press_init(); systems.fuel_init(); fmgc.APinit(); librariesLoop.start(); diff --git a/Nasal/pneumatics.nas b/Nasal/pneumatics.nas index 5276953e..cd4e96a9 100644 --- a/Nasal/pneumatics.nas +++ b/Nasal/pneumatics.nas @@ -29,10 +29,6 @@ var pneu_init = func { setprop("/systems/pneumatic/startpsir", 0); setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0); - pneu_timer.start(); -} - -var press_init = func { setprop("/FMGC/internal/dep-arpt", ""); setprop("/systems/pressurization/mode", "GN"); setprop("/systems/pressurization/vs", "0"); @@ -43,10 +39,13 @@ var press_init = func { setprop("/systems/pressurization/outflowpos", "0"); setprop("/systems/pressurization/deltap-norm", "0"); setprop("/systems/pressurization/outflowpos-norm", "0"); - var altitude = getprop("/position/altitude-ft"); + var altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); setprop("/systems/pressurization/cabinalt", altitude); setprop("/systems/pressurization/targetalt", altitude); setprop("/systems/pressurization/diff-to-target", "0"); + setprop("/systems/pressurization/ditchingpb", 0); + setprop("/systems/pressurization/targetvs", 0); + pneu_timer.start(); } ####################### @@ -157,27 +156,25 @@ var master_pneu = func { 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 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 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/deltap", cabinpsi - ambient); 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"); - } - - if (((!wowl) or (!wowr)) and (speed > 100) and (pressmode == "TO")) { + } else if (((!wowl) or (!wowr)) and (speed > 100) and (pressmode == "TO")) { setprop("/systems/pressurization/mode", "CL"); } @@ -185,9 +182,23 @@ var master_pneu = func { setprop("/systems/pressurization/vs", targetvs); } - if (cabinalt != targetalt and !wowl and !wowr) { + if (cabinalt != targetalt and !wowl and !wowr and !pause) { setprop("/systems/pressurization/cabinalt", cabinalt + vs); } + + if (ditch and auto) { + setprop("/systems/pressurization/outflowpos", "1"); + } + + if ((targetvs => 0) and (targetvs < 1000) and !ditch) { + setprop("/systems/pressurization/outflowpos", "0.75"); + } else if ((targetvs => 1000) and (targetvs < 1999) and !ditch) { + setprop("/systems/pressurization/outflowpos", "0.55"); + } else if ((targetvs => 2000) and !ditch) { + setprop("/systems/pressurization/outflowpos", "0.25"); + } else if ((targetvs < 0) and !ditch) { + setprop("/systems/pressurization/outflowpos", "1"); + } } ################### diff --git a/Systems/libraries.xml b/Systems/libraries.xml index 97e2b04a..bd21f060 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -203,29 +203,55 @@ - Target Pressurize Altitude - gain - 1 - 0.1 - - - - /instrumentation/altimeter/indicated-altitude-ft - 0 0 - 1000 500 - 50001100 - 200005200 - 300006700 - 300007900 - 405008000 -
-
- - /systems/pressurization/targetalt -
+ Target Pressurize Altitude CMD + gain + 1 + 0.1 + + + + /instrumentation/altimeter/indicated-altitude-ft + 0 0 + 1000 500 + 50001100 + 200005200 + 300006700 + 300007900 + 405008000 +
+
+ + /systems/pressurization/targetalt-cmd + - Cabin PSI + Target Pressurize Altitude + gain + 1 + 0.1 + + + + /gear/gear[1]/wow + 1 + + + /systems/pressurization/cabinalt-norm + + + + + /gear/gear[1]/wow + 1 + + + /systems/pressurization/targetalt-cmd + + /systems/pressurization/targetalt + + + + Cabin PSI target gain 1 0.1 @@ -233,20 +259,49 @@ /systems/pressurization/cabinalt-norm - -1000 16.5 - 0 14.7 - 1000 14.6 - 5000 14.4 - 20000 12.1 - 30000 11.4 - 30000 11.0 - 40500 10.9 + -1000 16.50000 + 0 14.70000 + 0 14.70000 + 1000 14.20000 + 2000 13.60000 + 3000 13.20000 + 4000 12.70000 + 5000 12.20000 + 6000 11.70000 + 7000 11.30000 + 8000 10.90000
- /systems/pressurization/cabinpsi + /systems/pressurization/cabinpsi-target
+ + VS-target + gain + 1 + 0.1 + + + + /gear/gear[1]/wow + 1 + + + /systems/pressurization/ambientpsi + + + + + /gear/gear[1]/wow + 1 + + + /systems/pressurization/cabinpsi-target + + /systems/pressurization/cabinpsi + + Ambient PSI (ICAO std) gain @@ -256,41 +311,41 @@ /instrumentation/altimeter/indicated-altitude-ft - -1000 16.5 - 0 14.7 - 1000 14.2 - 2000 13.6 - 3000 13.2 - 4000 12.7 - 5000 12.2 - 6000 11.7 - 7000 11.3 - 8000 10.9 - 9000 10.5 - 10000 10.1 - 11000 9.7 - 12000 9.3 - 13000 9.0 - 14000 8.6 - 15000 8.3 - 16000 8.0 - 17000 7.6 - 18000 7.3 - 19000 7.0 - 20000 6.8 - 22000 6.2 - 24000 5.7 - 26000 5.2 - 28000 4.7 - 30000 4.4 - 32000 4.0 - 34000 3.6 - 36000 3.3 - 38000 3.0 - 39000 2.9 - 40000 2.7 - 41000 2.6 - 42000 2.5 + -1000 16.50000 + 0 14.70000 + 1000 14.20000 + 2000 13.60000 + 3000 13.20000 + 4000 12.70000 + 5000 12.20000 + 6000 11.70000 + 7000 11.30000 + 8000 10.90000 + 9000 10.50000 + 10000 10.10000 + 11000 9.70000 + 12000 9.30000 + 13000 9.00000 + 14000 8.60000 + 15000 8.30000 + 16000 8.00000 + 17000 7.60000 + 18000 7.30000 + 19000 7.00000 + 20000 6.80000 + 22000 6.20000 + 24000 5.70000 + 26000 5.20000 + 28000 4.70000 + 30000 4.40000 + 32000 4.00000 + 34000 3.60000 + 36000 3.30000 + 38000 3.00000 + 39000 2.90000 + 40000 2.70000 + 41000 2.60000 + 42000 2.50000
@@ -314,7 +369,7 @@ /systems/pressurization/vs /systems/pressurization/vs-norm - 100 + 500
@@ -338,7 +393,7 @@ - VS-target + VS-target-cmd gain 1 0.05 @@ -346,16 +401,48 @@ /it-autoflight/internal/vert-speed-fpm - -1000-410 - 0 0 - 1000 205 - 2000 410 - 3000 615 - 4000 820 - 50001025 + -50000 -50000 + -10000 -5000 + -5000 -1230 + -4000 -1025 + -3000 -820 + -2000 -615 + -1000 -410 + 0 0 + 1000 205 + 2000 410 + 3000 615 + 4000 820 + 5000 1025
- /systems/pressurization/targetvs + /systems/pressurization/targetvs-cmd
+ + + VS-target + gain + 1 + 0.1 + + + + /gear/gear[1]/wow + 1 + + + 0 + + + + + /gear/gear[1]/wow + 1 + + + /systems/pressurization/targetvs-cmd + + /systems/pressurization/targetvs +