From 1c60b820b17b1d0a3690d098dc719972330f4943 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 12 Aug 2017 13:49:41 -0400 Subject: [PATCH] A3XX: Improve APU --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 67 ++++++++++++++++++-- Models/Instruments/Lower-ECAM/res/apu.svg | 63 +++++++++++++++--- Nasal/engines.nas | 12 ++-- 3 files changed, 120 insertions(+), 22 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 83e0ea6b..220b665e 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -11,6 +11,7 @@ var lowerECAM_eng = nil; var lowerECAM_fctl = nil; var lowerECAM_display = nil; var page = "eng"; +var oat = getprop("/environment/temperature-degc"); setprop("/systems/electrical/extra/apu-load", 0); setprop("/systems/electrical/extra/apu-volts", 0); setprop("/systems/electrical/extra/apu-hz", 0); @@ -115,11 +116,13 @@ var canvas_lowerECAM_apu = { return m; }, getKeys: func() { - return ["APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenLoad","APUGenVolt","APUGenHz","APUBleedPSI","GW","TAT","SAT"]; + return ["APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","GW","TAT","SAT","text3724","text3728","text3732"]; }, update: func() { + oat = getprop("/environment/temperature-degc"); + # Avail and Flap Open - if (getprop("/systems/apu/rpm") > 3.5 and getprop("/controls/APU/master") == 1) { + if (getprop("/systems/apu/flap") == 1) { me["APUFlapOpen"].show(); } else { me["APUFlapOpen"].hide(); @@ -130,7 +133,13 @@ var canvas_lowerECAM_apu = { } else { me["APUAvail"].hide(); } - + + if (getprop("/fdm/jsbsim/propulsion/tank[2]/contents-lbs") < 100) { + me["APUfuelLO"].show(); + } else { + me["APUfuelLO"].hide(); + } + # APU Gen if (getprop("/systems/electrical/extra/apu-volts") > 110) { me["APUGenVolt"].setColor(0,1,0); @@ -143,13 +152,43 @@ var canvas_lowerECAM_apu = { } else { me["APUGenHz"].setColor(1,0.6,0); } + + if (getprop("/controls/APU/master") == 1 or getprop("/systems/apu/rpm") >= 94.9) { + me["APUGenbox"].show(); + me["APUGenHz"].show(); + me["APUGenVolt"].show(); + me["APUGenLoad"].show(); + me["text3724"].show(); + me["text3728"].show(); + me["text3732"].show(); + } else { + me["APUGenbox"].hide(); + me["APUGenHz"].hide(); + me["APUGenVolt"].hide(); + me["APUGenLoad"].hide(); + me["text3724"].hide(); + me["text3728"].hide(); + me["text3732"].hide(); + } + + if ((getprop("/systems/apu/rpm") > 94.9) and (getprop("/controls/electrical/switches/gen-apu") == 1)) { + me["APUGenOnline"].show(); + } else { + me["APUGenOnline"].hide(); + } + + if ((getprop("/controls/APU/master") == 0) or ((getprop("/controls/APU/master") == 1) and (getprop("/controls/electrical/switches/gen-apu") == 1) and (getprop("/systems/apu/rpm") > 94.9))) { + me["APUGentext"].setColor(1,1,1); + } else if ((getprop("/controls/APU/master") == 1) and (getprop("/controls/electrical/switches/gen-apu") == 0) and (getprop("/systems/apu/rpm") < 94.9)) { + me["APUGentext"].setColor(1,0.6,0); + } me["APUGenLoad"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-load")))); me["APUGenVolt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-volts")))); me["APUGenHz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-hz")))); # APU Bleed - if (getprop("/systems/apu/rpm") >= 94.9) { + if (getprop("/controls/adirs/ir[1]/knob") != 1 and (getprop("/controls/APU/master") == 1 or getprop("/systems/pneumatic/bleedapu") > 0)) { me["APUBleedPSI"].setColor(0,1,0); me["APUBleedPSI"].setText(sprintf("%s", math.round(getprop("/systems/pneumatic/bleedapu")))); } else { @@ -157,7 +196,7 @@ var canvas_lowerECAM_apu = { me["APUBleedPSI"].setText(sprintf("%s", "XX")); } - if (getprop("/systems/pneumatic/bleedapu") > 0 and getprop("/controls/pneumatic/switches/bleedapu") == 1) { + if (getprop("/controls/pneumatic/switches/bleedapu") == 1) { me["APUBleedValve"].setRotation(90*D2R); me["APUBleedOnline"].show(); } else { @@ -166,8 +205,22 @@ var canvas_lowerECAM_apu = { } # APU N and EGT - me["APUN"].setText(sprintf("%s", math.round(getprop("/systems/apu/rpm")))); - me["APUEGT"].setText(sprintf("%s", math.round(getprop("/systems/apu/egt")))); + if (getprop("/controls/APU/master") == 1) { + me["APUN"].setColor(0,1,0); + me["APUN"].setText(sprintf("%s", math.round(getprop("/systems/apu/rpm")))); + me["APUEGT"].setColor(0,1,0); + me["APUEGT"].setText(sprintf("%s", math.round(getprop("/systems/apu/egt")))); + } else if (getprop("/systems/apu/rpm") >= 1) { + me["APUN"].setColor(0,1,0); + me["APUN"].setText(sprintf("%s", math.round(getprop("/systems/apu/rpm")))); + me["APUEGT"].setColor(0,1,0); + me["APUEGT"].setText(sprintf("%s", math.round(getprop("/systems/apu/egt")))); + } else { + me["APUN"].setColor(1,0.6,0); + me["APUN"].setText(sprintf("%s", "XX")); + me["APUEGT"].setColor(1,0.6,0); + me["APUEGT"].setText(sprintf("%s", "XX")); + } me["APUN-needle"].setRotation((getprop("/ECAM/Lower/APU-N") + 90)*D2R); me["APUEGT-needle"].setRotation((getprop("/ECAM/Lower/APU-EGT") + 90)*D2R); diff --git a/Models/Instruments/Lower-ECAM/res/apu.svg b/Models/Instruments/Lower-ECAM/res/apu.svg index cc8b99b1..bf855260 100644 --- a/Models/Instruments/Lower-ECAM/res/apu.svg +++ b/Models/Instruments/Lower-ECAM/res/apu.svg @@ -37,14 +37,14 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1030" + inkscape:window-width="1366" + inkscape:window-height="706" id="namedview371" showgrid="true" - inkscape:zoom="0.5" - inkscape:cx="840.634" - inkscape:cy="837.30899" - inkscape:window-x="1592" + inkscape:zoom="0.94" + inkscape:cx="-75.451106" + inkscape:cy="1080.5167" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2"> @@ -78,8 +78,9 @@ style="font-style:normal;font-weight:normal;font-size:34px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="196.37218" y="164.61017" - id="text3720" - sodipodi:linespacing="125%"> + id="APUGenbox" + inkscape:label="#g3460"> 34 + FUEL LO PR + + + + diff --git a/Nasal/engines.nas b/Nasal/engines.nas index c1115534..94f022b8 100644 --- a/Nasal/engines.nas +++ b/Nasal/engines.nas @@ -23,9 +23,9 @@ var n2_max = 102.1; var egt_max = 712; var n1_wm = 0; var n2_wm = 0; -var apu_max = 99.2; -var apu_egt_min = 496; -var apu_egt_max = 643; +var apu_max = 100; +var apu_egt_min = 352; +var apu_egt_max = 704; var spinup_time = 49; var start_time = 10; var egt_lightup_time = 2; @@ -311,9 +311,9 @@ var apu_egt_check = func { } var apu_egt2_check = func { - if (getprop("/systems/apu/egt") >= 643) { + if (getprop("/systems/apu/egt") >= 701) { apu_egt2_checkt.stop(); - interpolate("/systems/apu/egt", apu_egt_min, 20); + interpolate("/systems/apu/egt", apu_egt_min, 30); } } @@ -332,7 +332,7 @@ setlistener("/controls/APU/master", func { var apu_stop = func { interpolate("/systems/apu/rpm", 0, 30); - interpolate("/systems/apu/egt", 42, 30); + interpolate("/systems/apu/egt", 42, 40); } #######################