From 9d94182f3030d11f7841e4046cb5f28253a57974 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 20 Apr 2022 21:22:33 +0100 Subject: [PATCH] Improve bleed / cond page efficiency -- and fix that the hot air valve still worked after failure --- .../Lower-ECAM/Lower-ECAM-bleed.nas | 649 ++++++++++-------- .../Lower-ECAM/Lower-ECAM-cond.nas | 34 +- .../Lower-ECAM/Lower-ECAM-cruise.nas | 24 +- Systems/a320-aircond.xml | 3 + 4 files changed, 382 insertions(+), 328 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas index c434b232..f9378110 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas @@ -23,281 +23,50 @@ var canvas_lowerECAMPageBleed = # init obj.update_items = [ - props.UpdateManager.FromHashList(["BleedCrossbleedCmd","BleedCrossbleed"], nil, func(val) { - if (val.BleedCrossbleedCmd != val.BleedCrossbleed) { - obj["BLEED-XFEED"].setColor(0.7333,0.3803,0); - obj["BLEED-XFEED-Cross"].setColorFill(0.7333,0.3803,0); - } else { - obj["BLEED-XFEED"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-XFEED-Cross"].setColorFill(0.0509,0.7529,0.2941); - } - - if (val.BleedCrossbleedCmd == val.BleedCrossbleed) { - if (val.BleedCrossbleedCmd) { - obj["BLEED-XFEED"].setRotation(0); + props.UpdateManager.FromHashList(["BleedCrossbleed","apuMaster","apuBleedValvePos"], 0.1, func(val) { + if (val.apuMaster) { + if (val.apuBleedValvePos >= 0.9) { + obj["BLEED-APU-CIRCLE"].setRotation(0); + obj["BLEED-APU-connectionTop"].show(); + obj["BLEED-xbleedLeft"].show(); } else { - obj["BLEED-XFEED"].setRotation(90 * D2R); + obj["BLEED-APU-CIRCLE"].setRotation(90 * D2R); + obj["BLEED-APU-connectionTop"].hide(); + if (val.BleedCrossbleed < 0.9) { + obj["BLEED-xbleedLeft"].hide(); + } else { + obj["BLEED-xbleedLeft"].show(); + } } } else { - obj["BLEED-XFEED"].setRotation(45 * D2R); - } - - if (val.BleedCrossbleed == 1) { - obj["BLEED-xbleedCenter"].show(); - obj["BLEED-xbleedRight"].show(); - } else { - obj["BLEED-xbleedCenter"].hide(); - obj["BLEED-xbleedRight"].hide(); - } - }), - props.UpdateManager.FromHashList(["BleedHPValve1","BleedHPValve1Cmd"], nil, func(val) { - if (val.BleedHPValve1Cmd == 1) { - obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); - obj["BLEED-HP-1-connection"].show(); - } else { - obj["BLEED-HP-Valve-1"].setRotation(0); - obj["BLEED-HP-1-connection"].hide(); - } - - if (val.BleedHPValve1Cmd == val.BleedHPValve1) { - obj["BLEED-HP-Valve-1"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-HP-Valve-1"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedHPValve2","BleedHPValve2Cmd"], nil, func(val) { - if (val.BleedHPValve2Cmd == 1) { - obj["BLEED-HP-Valve-2"].setRotation(90 * D2R); - obj["BLEED-HP-2-connection"].show(); - } else { - obj["BLEED-HP-Valve-2"].setRotation(0); - obj["BLEED-HP-2-connection"].hide(); - } - - if (val.BleedHPValve2Cmd == val.BleedHPValve2) { - obj["BLEED-HP-Valve-2"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-HP-Valve-2"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedPRVValve1Cmd","BleedPRVValve1"], nil, func(val) { - if (val.BleedPRVValve1 == 0) { - obj["BLEED-ENG-1"].setRotation(0); - } else { - obj["BLEED-ENG-1"].setRotation(90 * D2R); - } - - if (val.BleedPRVValve1Cmd == val.BleedPRVValve1) { - obj["BLEED-ENG-1"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-ENG-1-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-ENG-1"].setColor(0.7333,0.3803,0); - obj["BLEED-ENG-1-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedPRVValve2Cmd","BleedPRVValve2"], nil, func(val) { - if (val.BleedPRVValve2 == 0) { - obj["BLEED-ENG-2"].setRotation(0); - } else { - obj["BLEED-ENG-2"].setRotation(90 * D2R); - } - - if (val.BleedPRVValve2Cmd == val.BleedPRVValve2) { - obj["BLEED-ENG-2"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-ENG-2-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-ENG-2"].setColor(0.7333,0.3803,0); - obj["BLEED-ENG-2-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("gear1Wow", nil, func(val) { - if (val) { - obj["BLEED-GND"].show(); - } else { - obj["BLEED-GND"].hide(); - } - }), - props.UpdateManager.FromHashValue("IceWingSw", nil, func(val) { - if (val) { - obj["BLEED-Anti-Ice-Left"].show(); - obj["BLEED-Anti-Ice-Right"].show(); - } else { - obj["BLEED-Anti-Ice-Left"].hide(); - obj["BLEED-Anti-Ice-Right"].hide(); - } - }), - props.UpdateManager.FromHashValue("N2_actual_1", nil, func(val) { - if (val >= 59) { - obj["BLEED-ENG-1-label"].setColor(0.8078,0.8039,0.8078); - } else { - obj["BLEED-ENG-1-label"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("N2_actual_2", nil, func(val) { - if (val >= 59) { - obj["BLEED-ENG-2-label"].setColor(0.8078,0.8039,0.8078); - } else { - obj["BLEED-ENG-2-label"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC1Working","BleedPreCoolerPSI1"], nil, func(val) { - if (val.BleedBMC1Working) { - if (val.BleedPreCoolerPSI1 >= 98) { - obj["BLEED-Precooler-1-Inlet-Press"].setText(sprintf("%s", 98)); + if (val.BleedCrossbleed < 0.9) { + obj["BLEED-xbleedLeft"].hide(); } else { - obj["BLEED-Precooler-1-Inlet-Press"].setText(sprintf("%s", math.round(val.BleedPreCoolerPSI1,2))); + obj["BLEED-xbleedLeft"].show(); } - if (val.BleedPreCoolerPSI1 < 4 or val.BleedPreCoolerPSI1 > 57) { - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["ApuBleedNotOn","apuMaster"], 1, func(val) { + if (val.apuMaster) { + obj["BLEED-APU-LINES"].show(); + if (val.ApuBleedNotOn != 1) { + obj["BLEED-APU-CIRCLE"].setColor(0.0509,0.7529,0.2941); } else { - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-APU-CIRCLE"].setColor(0.7333,0.3803,0); } } else { - obj["BLEED-Precooler-1-Inlet-Press"].setText("XX"); - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + obj["BLEED-APU-LINES"].hide(); + obj["BLEED-APU-connectionTop"].hide(); } }), - props.UpdateManager.FromHashList(["BleedBMC2Working","BleedPreCoolerPSI2"], nil, func(val) { - if (val.BleedBMC2Working) { - if (val.BleedPreCoolerPSI2 >= 98) { - obj["BLEED-Precooler-2-Inlet-Press"].setText(sprintf("%s", 98)); - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setText(sprintf("%s", math.round(val.BleedPreCoolerPSI2,2))); - } - - if (val.BleedPreCoolerPSI2 < 4 or val.BleedPreCoolerPSI2 > 57) { - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setText("XX"); - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC1Working","BleedPreCoolerTemp1","BleedPRVValve1Cmd","BleedPreCoolerOvht1"], nil, func(val) { - if (val.BleedBMC1Working) { - if (val.BleedPreCoolerTemp1 >= 510) { - obj["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", 510)); - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(val.BleedPreCoolerTemp1, 5))); - } - - if (val.BleedPRVValve1Cmd and (val.BleedPreCoolerTemp1 < 150 or val.BleedPreCoolerOvht1)) { - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setText("XX"); - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC2Working","BleedPreCoolerTemp2","BleedPRVValve2Cmd","BleedPreCoolerOvht2"], nil, func(val) { - if (val.BleedBMC2Working) { - if (val.BleedPreCoolerTemp2 >= 510) { - obj["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", 510)); - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(val.BleedPreCoolerTemp2, 5))); - } - - if (val.BleedPRVValve2Cmd and (val.BleedPreCoolerTemp2 < 150 or val.BleedPreCoolerOvht2)) { - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setText("XX"); - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("Pack1Bypass", 1, func(val) { - obj["BLEED-Pack-1-Bypass-needle"].setRotation((val - 50) * D2R); - }), - props.UpdateManager.FromHashValue("Pack2Bypass", 1, func(val) { - obj["BLEED-Pack-2-Bypass-needle"].setRotation((val - 50) * D2R); - }), - props.UpdateManager.FromHashValue("Pack1OutTemp", 0.25, func(val) { - obj["BLEED-Pack-1-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 90) { - obj["BLEED-Pack-1-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-1-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack2OutTemp", 0.25, func(val) { - obj["BLEED-Pack-2-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 90) { - obj["BLEED-Pack-2-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-2-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack1OutletTemp", 0.25, func(val) { - obj["BLEED-Pack-1-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 230) { - obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack2OutletTemp", 0.25, func(val) { - obj["BLEED-Pack-2-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 230) { - obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack1FlowOutput", 0.5, func(val) { - obj["BLEED-Pack-1-Packflow-needle"].setRotation(val * D2R); - - }), - props.UpdateManager.FromHashValue("Pack2FlowOutput", 0.5, func(val) { - obj["BLEED-Pack-2-Packflow-needle"].setRotation(val * D2R); - }), - props.UpdateManager.FromHashList(["Pack1Switch","flowCtlValve1"], nil, func(val) { - if (val.flowCtlValve1 == 0) { - obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.7333,0.3803,0); - obj["BLEED-Pack-1-Flow-Valve"].setRotation(90 * D2R); - } else { - obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); - obj["BLEED-Pack-1-Flow-Valve"].setRotation(0); - } - - if (val.flowCtlValve1 == val.Pack1Switch) { - obj["BLEED-Pack-1-Flow-Valve"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-Pack-1-Flow-Valve"].setColor(0.7333,0.3803,0); - obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["Pack2Switch","flowCtlValve2"], nil, func(val) { - if (val.flowCtlValve2 == 0) { - obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.7333,0.3803,0); - obj["BLEED-Pack-2-Flow-Valve"].setRotation(90 * D2R); - } else { - obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); - obj["BLEED-Pack-2-Flow-Valve"].setRotation(0); - } - - if (val.flowCtlValve2 == val.Pack2Switch) { - obj["BLEED-Pack-2-Flow-Valve"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-Pack-2-Flow-Valve"].setColor(0.7333,0.3803,0); - obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["flowCtlValve1","flowCtlValve2","RamAirValve","gear1Wow"], nil, func(val) { - if (val.RamAirValve == 0) { + props.UpdateManager.FromHashList(["flowCtlValve1","flowCtlValve2","RamAirValve","gear1Wow"], 0.1, func(val) { + if (val.RamAirValve <= 0.1) { obj["BLEED-Ram-Air"].setRotation(90 * D2R); obj["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air-Cross"].setColorFill(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air-connection"].hide(); - } elsif (val.RamAirValve) { + } elsif (val.RamAirValve >= 0.9) { obj["BLEED-Ram-Air"].setRotation(0); if (val.gear1Wow) { obj["BLEED-Ram-Air"].setColor(0.7333,0.3803,0); @@ -323,8 +92,8 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Ram-Air-connection"].show(); } - if (val.flowCtlValve1 == 0 and val.flowCtlValve2 == 0) { - if (val.gear1Wow or val.RamAirValve != 1) { + if (val.flowCtlValve1 <= 0.1 and val.flowCtlValve2 <= 0.1) { + if (val.gear1Wow or val.RamAirValve < 0.9) { obj["BLEED-cond-1"].setColor(0.7333,0.3803,0); obj["BLEED-cond-2"].setColor(0.7333,0.3803,0); obj["BLEED-cond-3"].setColor(0.7333,0.3803,0); @@ -338,52 +107,262 @@ var canvas_lowerECAMPageBleed = obj["BLEED-cond-2"].setColor(0.0509,0.7529,0.2941); obj["BLEED-cond-3"].setColor(0.0509,0.7529,0.2941); } + }), + props.UpdateManager.FromHashList(["BleedCrossbleedCmd","BleedCrossbleedPositionMatch"], nil, func(val) { + if (val.BleedCrossbleedPositionMatch) { + obj["BLEED-XFEED"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-XFEED-Cross"].setColorFill(0.0509,0.7529,0.2941); + if (val.BleedCrossbleedCmd) { + obj["BLEED-XFEED"].setRotation(0); + } else { + obj["BLEED-XFEED"].setRotation(90 * D2R); + } + } else { + obj["BLEED-XFEED"].setColor(0.7333,0.3803,0); + obj["BLEED-XFEED-Cross"].setColorFill(0.7333,0.3803,0); + obj["BLEED-XFEED"].setRotation(45 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedCrossbleed", 0.1, func(val) { + if (val >= 0.9) { + obj["BLEED-xbleedCenter"].show(); + obj["BLEED-xbleedRight"].show(); + } else { + obj["BLEED-xbleedCenter"].hide(); + obj["BLEED-xbleedRight"].hide(); + } + }), + props.UpdateManager.FromHashValue("BleedHPValve1Cmd", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); + obj["BLEED-HP-1-connection"].show(); + } else { + obj["BLEED-HP-Valve-1"].setRotation(0); + obj["BLEED-HP-1-connection"].hide(); + } + }), + props.UpdateManager.FromHashValue("BleedHPValve2Cmd", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); + obj["BLEED-HP-1-connection"].show(); + } else { + obj["BLEED-HP-Valve-1"].setRotation(0); + obj["BLEED-HP-1-connection"].hide(); + } + }), + props.UpdateManager.FromHashValue("bleedHPValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setColor(0.0509,0.7529,0.2941); + } else { + obj["BLEED-HP-Valve-1"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("bleedHPValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-2"].setColor(0.0509,0.7529,0.2941); + } else { + obj["BLEED-HP-Valve-2"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerPSI1", 1, func(val) { + obj.bleedPrecoolerInlet1Pressure = sprintf("%s", math.clamp(math.round(val, 2), -99, 98)); - if (val.flowCtlValve1 == 0) { + if (val < 4 or val > 57) { + obj.bleedPrecoolerInlet1PressureOut = 1; + } else { + obj.bleedPrecoolerInlet1PressureOut = 0; + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerPSI2", 1, func(val) { + obj.bleedPrecoolerInlet2Pressure = sprintf("%s", math.clamp(math.round(val, 2), -99, 98)); + + if (val < 4 or val > 57) { + obj.bleedPrecoolerInlet2PressureOut = 1; + } else { + obj.bleedPrecoolerInlet2PressureOut = 0; + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerTemp1", 0.5, func(val) { + obj.bleedPrecoolerTemp1 = sprintf("%s", math.clamp(math.round(val, 5), -999, 510)); + }), + props.UpdateManager.FromHashValue("BleedPreCoolerTemp2", 0.5, func(val) { + obj.bleedPrecoolerTemp2 = sprintf("%s", math.clamp(math.round(val, 5), -999, 510)); + }), + props.UpdateManager.FromHashList(["BleedBMC1Working","bleedPrecoolerTemp1Lo","BleedPRVValve1Cmd","BleedPreCoolerOvht1"], nil, func(val) { + if (val.BleedBMC1Working) { + if (val.BleedPRVValve1Cmd and (val.bleedPrecoolerTemp1Lo or val.BleedPreCoolerOvht1)) { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["BleedBMC2Working","bleedPrecoolerTemp2Lo","BleedPRVValve2Cmd","BleedPreCoolerOvht2"], nil, func(val) { + if (val.BleedBMC2Working) { + if (val.BleedPRVValve2Cmd and (val.bleedPrecoolerTemp2Lo or val.BleedPreCoolerOvht2)) { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("Pack1Bypass", 1, func(val) { + obj["BLEED-Pack-1-Bypass-needle"].setRotation((val - 50) * D2R); + }), + props.UpdateManager.FromHashValue("Pack2Bypass", 1, func(val) { + obj["BLEED-Pack-2-Bypass-needle"].setRotation((val - 50) * D2R); + }), + props.UpdateManager.FromHashValue("Pack1OutTemp", 0.5, func(val) { + obj["BLEED-Pack-1-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 90) { + obj["BLEED-Pack-1-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-1-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack2OutTemp", 0.5, func(val) { + obj["BLEED-Pack-2-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 90) { + obj["BLEED-Pack-2-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-2-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack1OutletTemp", 0.5, func(val) { + obj["BLEED-Pack-1-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 230) { + obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack2OutletTemp", 0.5, func(val) { + obj["BLEED-Pack-2-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 230) { + obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack1FlowOutput", 0.5, func(val) { + obj["BLEED-Pack-1-Packflow-needle"].setRotation(val * D2R); + }), + props.UpdateManager.FromHashValue("Pack2FlowOutput", 0.5, func(val) { + obj["BLEED-Pack-2-Packflow-needle"].setRotation(val * D2R); + }), + props.UpdateManager.FromHashValue("gear1Wow", 1, func(val) { + if (val) { + obj["BLEED-GND"].show(); + } else { + obj["BLEED-GND"].hide(); + } + }), + props.UpdateManager.FromHashValue("IceWingSw", 1, func(val) { + if (val) { + obj["BLEED-Anti-Ice-Left"].show(); + obj["BLEED-Anti-Ice-Right"].show(); + } else { + obj["BLEED-Anti-Ice-Left"].hide(); + obj["BLEED-Anti-Ice-Right"].hide(); + } + }), + props.UpdateManager.FromHashValue("N2_actual_1", 0.5, func(val) { + if (val >= 59) { + obj["BLEED-ENG-1-label"].setColor(0.8078,0.8039,0.8078); + } else { + obj["BLEED-ENG-1-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("N2_actual_2", 0.5, func(val) { + if (val >= 59) { + obj["BLEED-ENG-2-label"].setColor(0.8078,0.8039,0.8078); + } else { + obj["BLEED-ENG-2-label"].setColor(0.7333,0.3803,0); + } + }), + + props.UpdateManager.FromHashValue("flowCtlValve1", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.7333,0.3803,0); + obj["BLEED-Pack-1-Flow-Valve"].setRotation(90 * D2R); obj["BLEED-Pack-1-connection"].setColor(0.7333,0.3803,0); obj["BLEED-Pack-1-connection"].setColorFill(0.7333,0.3803,0); } else { + obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); + obj["BLEED-Pack-1-Flow-Valve"].setRotation(0); obj["BLEED-Pack-1-connection"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Pack-1-connection"].setColorFill(0.0509,0.7529,0.2941); } - - if (val.flowCtlValve2 == 0) { + }), + props.UpdateManager.FromHashValue("flowCtlValve2", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.7333,0.3803,0); + obj["BLEED-Pack-2-Flow-Valve"].setRotation(90 * D2R); obj["BLEED-Pack-2-connection"].setColor(0.7333,0.3803,0); obj["BLEED-Pack-2-connection"].setColorFill(0.7333,0.3803,0); } else { + obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); + obj["BLEED-Pack-2-Flow-Valve"].setRotation(0); obj["BLEED-Pack-2-connection"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Pack-2-connection"].setColorFill(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashList(["BleedCrossbleed","apuMaster","apuBleedValvePos","ApuBleedNotOn"], nil, func(val) { - if (val.apuMaster) { - obj["BLEED-APU-LINES"].show(); - if (val.apuBleedValvePos == 1) { - obj["BLEED-APU-CIRCLE"].setRotation(0); - obj["BLEED-APU-connectionTop"].show(); - obj["BLEED-xbleedLeft"].show(); - } else { - obj["BLEED-APU-CIRCLE"].setRotation(90 * D2R); - obj["BLEED-APU-connectionTop"].hide(); - if (val.BleedCrossbleed != 1) { - obj["BLEED-xbleedLeft"].hide(); - } else { - obj["BLEED-xbleedLeft"].show(); - } - } - if (val.ApuBleedNotOn != 1) { - obj["BLEED-APU-CIRCLE"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-APU-CIRCLE"].setColor(0.7333,0.3803,0); - } + props.UpdateManager.FromHashValue("flowCtlValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-Pack-1-Flow-Valve"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); } else { - if (val.BleedCrossbleed != 1) { - obj["BLEED-xbleedLeft"].hide(); - } else { - obj["BLEED-xbleedLeft"].show(); - } - obj["BLEED-APU-LINES"].hide(); - obj["BLEED-APU-connectionTop"].hide(); + obj["BLEED-Pack-1-Flow-Valve"].setColor(0.7333,0.3803,0); + obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("flowCtlValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-Pack-2-Flow-Valve"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-Pack-2-Flow-Valve"].setColor(0.7333,0.3803,0); + obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve1", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-ENG-1"].setRotation(0); + } else { + obj["BLEED-ENG-1"].setRotation(90 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve2", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-ENG-2"].setRotation(0); + } else { + obj["BLEED-ENG-2"].setRotation(90 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-ENG-1"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-ENG-1-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-ENG-1"].setColor(0.7333,0.3803,0); + obj["BLEED-ENG-1-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-ENG-2"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-ENG-2-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-ENG-2"].setColor(0.7333,0.3803,0); + obj["BLEED-ENG-2-Cross"].setColorFill(0.7333,0.3803,0); } }), ]; @@ -481,11 +460,95 @@ var canvas_lowerECAMPageBleed = return; } + if ((notification.flowCtlValve1 >= 0.95 and notification.Pack1Switch) or (notification.flowCtlValve1 <= 0.05 and !notification.Pack1Switch)) { + notification.flowCtlValve1PositionMatch = 1; + } else { + notification.flowCtlValve1PositionMatch = 0; + } + + if ((notification.flowCtlValve2 >= 0.95 and notification.Pack2Switch) or (notification.flowCtlValve2 <= 0.05 and !notification.Pack2Switch)) { + notification.flowCtlValve2PositionMatch = 1; + } else { + notification.flowCtlValve2PositionMatch = 0; + } + + if ((notification.BleedPRVValve1 >= 0.95 and notification.BleedPRVValve1Cmd) or (notification.BleedPRVValve1 <= 0.05 and !notification.BleedPRVValve1Cmd)) { + notification.BleedPRVValve1PositionMatch = 1; + } else { + notification.BleedPRVValve1PositionMatch = 0; + } + + if ((notification.BleedPRVValve2 >= 0.95 and notification.BleedPRVValve2Cmd) or (notification.BleedPRVValve2 <= 0.05 and !notification.BleedPRVValve2Cmd)) { + notification.BleedPRVValve2PositionMatch = 1; + } else { + notification.BleedPRVValve2PositionMatch = 0; + } + + if ((notification.BleedHPValve1 >= 0.95 and notification.BleedHPValve1Cmd) or (notification.BleedHPValve1 <= 0.05 and !notification.BleedHPValve1Cmd)) { + notification.bleedHPValve1PositionMatch = 1; + } else { + notification.bleedHPValve1PositionMatch = 0; + } + + if ((notification.BleedHPValve2 >= 0.95 and notification.BleedHPValve2Cmd) or (notification.BleedHPValve2 <= 0.05 and !notification.BleedHPValve2Cmd)) { + notification.bleedHPValve2PositionMatch = 1; + } else { + notification.bleedHPValve2PositionMatch = 0; + } + + if ((notification.BleedCrossbleed >= 0.95 and notification.BleedCrossbleedCmd) or (notification.BleedCrossbleed <= 0.05 and !notification.BleedCrossbleedCmd)) { + notification.BleedCrossbleedPositionMatch = 1; + } else { + notification.BleedCrossbleedPositionMatch = 0; + } + + if (notification.BleedPreCoolerTemp1 < 150) { + notification.bleedPrecoolerTemp1Lo = 1; + } else { + notification.bleedPrecoolerTemp1Lo = 0; + } + + if (notification.BleedPreCoolerTemp2 < 150) { + notification.bleedPrecoolerTemp2Lo = 1; + } else { + notification.bleedPrecoolerTemp2Lo = 0; + } + foreach(var update_item; me.update_items) { update_item.update(notification); } + if (notification.BleedBMC1Working) { + me["BLEED-Precooler-1-Outlet-Temp"].setText(me.bleedPrecoolerTemp1); + me["BLEED-Precooler-1-Inlet-Press"].setText(me.bleedPrecoolerInlet1Pressure); + + if (me.bleedPrecoolerInlet1PressureOut) { + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } else { + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["BLEED-Precooler-1-Outlet-Temp"].setText("XX"); + me["BLEED-Precooler-1-Inlet-Press"].setText("XX"); + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } + + if (notification.BleedBMC2Working) { + me["BLEED-Precooler-2-Outlet-Temp"].setText(me.bleedPrecoolerTemp2); + me["BLEED-Precooler-2-Inlet-Press"].setText(me.bleedPrecoolerInlet2Pressure); + + if (me.bleedPrecoolerInlet2PressureOut) { + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); + } else { + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["BLEED-Precooler-2-Outlet-Temp"].setText("XX"); + me["BLEED-Precooler-2-Inlet-Press"].setText("XX"); + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); + } + me.updateBottom(notification); }, updatePower: func() { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index f68ea461..b493d2aa 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -55,23 +55,25 @@ var canvas_lowerECAMPageCond = props.UpdateManager.FromHashValue("condTrimFwd", 0.01, func(val) { obj["CONDTrimValveFWD"].setRotation(val * D2R); }), - props.UpdateManager.FromHashList(["condHotAirSwitch","condHotAirValve","condHotAirCmd"], nil, func(val) { - if (!val.condHotAirSwitch or (val.condHotAirCmd == 1 and val.condHotAirValve == 0)) { + props.UpdateManager.FromHashList(["condHotAirSwitch","condHotAirValve","condHotAirCmd"], 0.01, func(val) { + if (val.condHotAirValve <= 0.01) { obj["CONDHotAirValve"].setRotation(90 * D2R); - obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); - obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); - } elsif (val.condHotAirCmd == 0 and val.condHotAirValve == 0) { - obj["CONDHotAirValve"].setRotation(90 * D2R); - obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); - obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); - } elsif (val.condHotAirCmd == 0 and val.condHotAirValve != 0) { - obj["CONDHotAirValve"].setRotation(0); - obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); - obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + if (val.condHotAirCmd) { + obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); + obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + } else { + obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); + obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + } } else { obj["CONDHotAirValve"].setRotation(0); - obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); - obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + if (val.condHotAirCmd) { + obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); + obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); + obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + } } }), ]; @@ -108,6 +110,8 @@ var canvas_lowerECAMPageCond = obj["TAT"].setText(sprintf("%+2.0f", val)); }), ]; + obj.timer = maketimestamp(); + obj.times = []; return obj; }, getKeysBottom: func() { @@ -152,6 +156,7 @@ var canvas_lowerECAMPageCond = } }, update: func(notification) { + me.timer.stamp(); me.updatePower(); if (me.test.getVisible() == 1) { @@ -168,6 +173,7 @@ var canvas_lowerECAMPageCond = } me.updateBottom(notification); + append(me.times, me.timer.elapsedUSec()); }, updatePower: func() { if (me.name == ecam.SystemDisplayController.displayedPage.name) { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas index 4fb900c9..cf09db22 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas @@ -77,13 +77,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressDelta", 0.05, func(val) { - if (val > 31.9) { - obj["deltaPSI"].setText(sprintf("%2.1f", 31.9)); - } else if (val < -9.9) { - obj["deltaPSI"].setText(sprintf("%2.1f", -9.9)); - } else { - obj["deltaPSI"].setText(sprintf("%2.1f", val)); - } + obj["deltaPSI"].setText(sprintf("%2.1f", math.clamp(val, -9.9, 31.9))); if (val < -0.4 or val > 8.5) { obj["deltaPSI"].setColor(0.7333,0.3803,0); @@ -92,13 +86,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressVS", 25, func(val) { - if (val > 9950) { - obj["CABVS"].setText(sprintf("%4.0f", 9950)); - } else if (val < -9950) { - obj["CABVS"].setText(sprintf("%4.0f", -9950)); - } else { - obj["CABVS"].setText(sprintf("%-4.0f", math.round(val,50))); - } + obj["CABVS"].setText(sprintf("%-4.0f", math.clamp(math.round(val,50), -9950, 9950))); if (val >= 25) { obj["VS-Arrow-UP"].show(); @@ -112,13 +100,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressAlt", 25, func(val) { - if (val > 32750) { - obj["CABALT"].setText(sprintf("%5.0f", 32750)); - } else if (val < -9950) { - obj["CABALT"].setText(sprintf("%5.0f", -9950)); - } else { - obj["CABALT"].setText(sprintf("%5.0f", math.round(val,50))); - } + obj["CABALT"].setText(sprintf("%5.0f", math.clamp(math.round(val,50), -9950, 32750))); if (val > 9550) { obj["CABALT"].setColor(1,0,0); diff --git a/Systems/a320-aircond.xml b/Systems/a320-aircond.xml index 4d95eedd..34810e1a 100644 --- a/Systems/a320-aircond.xml +++ b/Systems/a320-aircond.xml @@ -545,6 +545,9 @@ + + /systems/failures/pneumatics/hot-air-valve eq 1 + /systems/electrical/bus/ac-1 ge 110 /systems/electrical/bus/ac-2 ge 110