diff --git a/A320-main.xml b/A320-main.xml index 4812ad96..fa90bb91 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1115,7 +1115,6 @@ 0 - 0 0 0 diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 54b93e3f..f555d7b1 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -91,6 +91,8 @@ setprop("/systems/acconfig/out-of-date", 0); setprop("/systems/acconfig/mismatch-code", "0x000"); setprop("/systems/acconfig/mismatch-reason", "XX"); setprop("/systems/acconfig/options/keyboard-mode", 0); +# TODO Revert default weight-kgs to 1, when fully implemented +setprop("/systems/acconfig/options/weight-kgs", 0); setprop("/systems/acconfig/options/adirs-skip", 0); setprop("/systems/acconfig/options/welcome-skip", 0); setprop("/systems/acconfig/options/no-rendering-warn", 0); @@ -220,6 +222,7 @@ var renderingSettings = { var readSettings = func { io.read_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode")); + setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs")); setprop("/controls/adirs/skip", getprop("/systems/acconfig/options/adirs-skip")); setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route")); setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip")); @@ -228,6 +231,7 @@ var readSettings = func { var writeSettings = func { setprop("/systems/acconfig/options/keyboard-mode", getprop("/options/system/keyboard-mode")); + setprop("/systems/acconfig/options/weight-kgs", getprop("/options/system/weight-kgs")); setprop("/systems/acconfig/options/adirs-skip", getprop("/controls/adirs/skip")); setprop("/systems/acconfig/options/autopush/show-route", getprop("/sim/model/autopush/route/show")); setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip")); @@ -481,6 +485,7 @@ var taxi_b = func { setprop("/controls/lighting/taxi-light-switch", 0.5); setprop("/controls/switches/landing-lights-l", 0.5); setprop("/controls/switches/landing-lights-r", 0.5); + setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/pressure-sea-level-inhg")); settimer(taxi_c, 2); } var taxi_c = func { diff --git a/AircraftConfig/main.xml b/AircraftConfig/main.xml index cfd34c7e..84620273 100644 --- a/AircraftConfig/main.xml +++ b/AircraftConfig/main.xml @@ -386,6 +386,27 @@ true + + + left diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 0380b215..bc316ee1 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -38,7 +38,11 @@ var tr2_a = 0; var essTramps = 0; var essTrvolts = 0; +# Conversion factor pounds to kilogram +LBS2KGS = 0.4535924; + # Fetch Nodes +var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1); var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); @@ -572,9 +576,15 @@ var canvas_lowerECAM_base = { me["TAT"].setColor(0.7333,0.3803,0); } - me["GW"].setText(sprintf("%s", math.round(gw.getValue()))); me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue())); + if (acconfig_weight_kgs.getValue() == 1) { + me["GW"].setText(sprintf("%s", math.round(gw.getValue() * LBS2KGS))); + me["GW-weight-unit"].setText("KG"); + } else { + me["GW"].setText(sprintf("%s", math.round(gw.getValue()))); + me["GW-weight-unit"].setText("LBS"); + } }, }; @@ -586,7 +596,7 @@ var canvas_lowerECAM_apu = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO", + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO", "text3724","text3728","text3732"]; }, update: func() { @@ -707,7 +717,7 @@ var canvas_lowerECAM_bleed = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU", "BLEED-HP-Valve-1", + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU", "BLEED-HP-Valve-1", "BLEED-ENG-1", "BLEED-HP-Valve-2", "BLEED-ENG-2", "BLEED-Precooler-1-Inlet-Press", "BLEED-Precooler-1-Outlet-Temp", "BLEED-Precooler-2-Inlet-Press", "BLEED-Precooler-2-Outlet-Temp", "BLEED-ENG-1-label", "BLEED-ENG-2-label", "BLEED-GND", "BLEED-Pack-1-Flow-Valve", "BLEED-Pack-2-Flow-Valve", "BLEED-Pack-1-Out-Temp", @@ -980,7 +990,7 @@ var canvas_lowerECAM_cond = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm"]; + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit"]; }, update: func() { @@ -996,17 +1006,24 @@ var canvas_lowerECAM_crz = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP"]; + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; }, update: func() { me["Oil1"].setText(sprintf("%2.1f", oil_qt1_actual.getValue())); me["Oil2"].setText(sprintf("%2.1f", oil_qt2_actual.getValue())); - # Fuel Used - me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); - me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); - me["FUsed"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue(), 10) + math.round(fuel_used_lbs2.getValue(), 10)))); + if (acconfig_weight_kgs.getValue() == 1) { + me["Fused-weight-unit"].setText("KG"); + me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); + me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); + me["FUsed"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10) + math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)))); + } else { + me["Fused-weight-unit"].setText("LBS"); + me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); + me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); + me["FUsed"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue(), 10) + math.round(fuel_used_lbs2.getValue(), 10)))); + } me.updateBottomStatus(); }, @@ -1020,7 +1037,7 @@ var canvas_lowerECAM_door = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", + return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", "Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1", "AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine", "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"]; @@ -1165,7 +1182,7 @@ var canvas_lowerECAM_elec = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", "ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-group","EmergenVolt","EmergenHz", "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","Emergen-Label","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", "ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz", @@ -1831,7 +1848,7 @@ var canvas_lowerECAM_eng = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2"]; + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; }, update: func() { # Oil Quantity @@ -1867,8 +1884,15 @@ var canvas_lowerECAM_eng = { me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R); # Fuel Used - me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); - me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); + if (acconfig_weight_kgs.getValue() == 1) { + me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); + me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); + me["Fused-weight-unit"].setText("KG"); + } else { + me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); + me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); + me["Fused-weight-unit"].setText("LBS"); + } me.updateBottomStatus(); }, @@ -1882,7 +1906,7 @@ var canvas_lowerECAM_fctl = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", + return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", "elevRyellow","rudderyellow","PTyellow","rudder","spdbrkblue","spdbrkgreen","spdbrkyellow","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex", "spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf", "spoiler5Lf","ailLscale","ailRscale","path4249","path4249-3","path4249-3-6-7","path4249-3-6-7-5","path4249-3-6"]; @@ -2268,13 +2292,15 @@ var canvas_lowerECAM_fuel = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", + return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", "FUEL-Right-Transfer","FUEL-Left-Outer-Inacc","FUEL-Left-Inner-Inacc","FUEL-Center-Inacc","FUEL-Right-Inner-Inacc","FUEL-Right-Outer-Inacc","FUEL-Left-Outer-quantity","FUEL-Left-Inner-quantity","FUEL-Center-quantity","FUEL-Right-Inner-quantity", "FUEL-Right-Outer-quantity","FUEL-On-Board","FUEL-Flow-per-min","FUEL-APU-arrow","FUEL-APU-label","FUEL-used-1","FUEL-used-both","FUEL-used-2","FUEL-ENG-Master-1","FUEL-ENG-Master-2","FUEL-XFEED","FUEL-XFEED-pipes","FUEL-Left-Outer-temp", "FUEL-Left-Inner-temp","FUEL-Right-Inner-temp","FUEL-Right-Outer-temp","FUEL-Pump-Left-1-Closed","FUEL-Pump-Left-1-Open","FUEL-Pump-Left-2-Closed","FUEL-Pump-Left-2-Open","FUEL-Pump-Center-1-Open","FUEL-Pump-Center-1-Closed","FUEL-Pump-Center-2-Closed", - "FUEL-Pump-Center-2-Open","FUEL-Pump-Right-1-Closed","FUEL-Pump-Right-1-Open","FUEL-Pump-Right-2-Closed","FUEL-Pump-Right-2-Open","FUEL-ENG-1-label","FUEL-ENG-2-label","FUEL-ENG-1-pipe","FUEL-ENG-2-pipe","ENG1idFFlow","ENG2idFFlow","FUEL-used-1","FUEL-used-2","FUEL-used-both"]; + "FUEL-Pump-Center-2-Open","FUEL-Pump-Right-1-Closed","FUEL-Pump-Right-1-Open","FUEL-Pump-Right-2-Closed","FUEL-Pump-Right-2-Open","FUEL-ENG-1-label","FUEL-ENG-2-label","FUEL-ENG-1-pipe","FUEL-ENG-2-pipe","ENG1idFFlow","ENG2idFFlow","FUEL-used-1","FUEL-used-2","FUEL-used-both", + "Fused-weight-unit","FFlow-weight-unit","FOB-weight-unit"]; }, update: func() { + _weight_kgs = acconfig_weight_kgs.getValue(); # if (getprop("engines/engine[0]/n1-actual") < getprop("/controls/engines/idle-limit")) { if (eng1_n1.getValue() <= 18.8) { @@ -2295,11 +2321,28 @@ var canvas_lowerECAM_fuel = { } # TODO add FOB half-boxed amber if some fuel is blocked - me["FUEL-On-Board"].setText(sprintf("%s", math.round(total_fuel_lbs.getValue(), 10))); + if (_weight_kgs == 1) + { + me["FUEL-On-Board"].setText(sprintf("%s", math.round(total_fuel_lbs.getValue() * LBS2KGS, 10))); + me["FOB-weight-unit"].setText("KG"); + } else { + me["FUEL-On-Board"].setText(sprintf("%s", math.round(total_fuel_lbs.getValue(), 10))); + me["FOB-weight-unit"].setText("LBS"); + } + + if (_weight_kgs == 1) { + me["FFlow-weight-unit"].setText("KG/MIN"); + } else { + me["FFlow-weight-unit"].setText("LBS/MIN"); + } if (fadec1.getValue() == 1 and fadec2.getValue() == 1) { me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941); - me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round((fuel_flow1.getValue() + fuel_flow2.getValue()) / 60, 10))); + if (_weight_kgs == 1) { + me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round(((fuel_flow1.getValue() + fuel_flow2.getValue()) * LBS2KGS) / 60, 10))); + } else { + me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round((fuel_flow1.getValue() + fuel_flow2.getValue()) / 60, 10))); + } } else { me["FUEL-Flow-per-min"].setColor(0.7333,0.3803,0); me["FUEL-Flow-per-min"].setText("XX"); @@ -2424,9 +2467,17 @@ var canvas_lowerECAM_fuel = { } # Fuel Used - me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); - me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); - me["FUEL-used-both"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue(), 10) + math.round(fuel_used_lbs2.getValue(), 10)))); + if (_weight_kgs == 1) { + me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); + me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); + me["FUEL-used-both"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10) + math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)))); + me["Fused-weight-unit"].setText("KG"); + } else { + me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); + me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); + me["FUEL-used-both"].setText(sprintf("%s", (math.round(fuel_used_lbs1.getValue(), 10) + math.round(fuel_used_lbs2.getValue(), 10)))); + me["Fused-weight-unit"].setText("LBS"); + } # Fuel Temp me["FUEL-Left-Outer-temp"].setText(sprintf("%s", math.round(fuel_left_outer_temp.getValue()))); @@ -2436,11 +2487,19 @@ var canvas_lowerECAM_fuel = { # Fuel Quantity # TODO add LO indication - me["FUEL-Left-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftOuter.getValue(), 10))); - me["FUEL-Left-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftInner.getValue(), 10))); - me["FUEL-Center-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.center.getValue(), 10))); - me["FUEL-Right-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightInner.getValue(), 10))); - me["FUEL-Right-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightOuter.getValue(), 10))); + if (_weight_kgs == 1) { + me["FUEL-Left-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftOuter.getValue() * LBS2KGS, 10))); + me["FUEL-Left-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftInner.getValue() * LBS2KGS, 10))); + me["FUEL-Center-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.center.getValue() * LBS2KGS, 10))); + me["FUEL-Right-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightInner.getValue() * LBS2KGS, 10))); + me["FUEL-Right-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightOuter.getValue() * LBS2KGS, 10))); + } else { + me["FUEL-Left-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftOuter.getValue(), 10))); + me["FUEL-Left-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.leftInner.getValue(), 10))); + me["FUEL-Center-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.center.getValue(), 10))); + me["FUEL-Right-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightInner.getValue(), 10))); + me["FUEL-Right-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightOuter.getValue(), 10))); + } if (systems.FUEL.Valves.transfer1.getValue() == 0) { me["FUEL-Left-Transfer"].hide(); @@ -2491,7 +2550,7 @@ var canvas_lowerECAM_press = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; }, update: func() { me["PRESS-Cab-VS"].setText(sprintf("%4.0f", press_vs_norm.getValue())); @@ -2510,7 +2569,7 @@ var canvas_lowerECAM_status = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm"]; + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit"]; }, update: func() { @@ -2526,7 +2585,7 @@ var canvas_lowerECAM_hyd = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", "PTU-Auto-or-off","RAT-label","RAT-stowed","RAT-not-stowed","ELEC-Yellow-off","ELEC-Yellow-on","ELEC-Yellow-label","ELEC-OVTH-Yellow","ELEC-Blue-label","ELEC-OVHT-Blue","ELEC-OVHT-Yellow","Pump-Green-label","Pump-Yellow-label","Pump-Green", "Pump-LOPR-Green","Pump-Green-off","Pump-Green-on","Pump-Yellow","Pump-LOPR-Yellow","Pump-Yellow-off","Pump-Yellow-on","Pump-Blue", "Pump-Blue-off","Pump-Blue-on","Fire-Valve-Green","Fire-Valve-Yellow","LO-AIR-PRESS-Green", "LO-AIR-PRESS-Yellow","LO-AIR-PRESS-Blue","OVHT-Green","OVHT-Blue","OVHT-Yellow","Quantity-Indicator-Green","Quantity-Indicator-Blue","Quantity-Indicator-Yellow","Green-label","Blue-label","Yellow-label"]; @@ -2795,7 +2854,7 @@ var canvas_lowerECAM_wheel = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR","autobrk","autobrkind","NWS","NWSrect","normbrk-rect","altnbrk","normbrkhyd","spoiler1Rex","spoiler1Rrt","spoiler2Rex", + return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR","autobrk","autobrkind","NWS","NWSrect","normbrk-rect","altnbrk","normbrkhyd","spoiler1Rex","spoiler1Rrt","spoiler2Rex", "spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex","spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf", "spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf","spoiler5Lf","ALTNbrk","altnbrkhyd","altnbrk-rect","antiskidtext","brakearrow","accupress_text","accuonlyarrow","accuonly","braketemp1","normbrkhyd", "braketemp2","braketemp3","braketemp4","toparc1","toparc2","toparc3","toparc4","leftuplock","noseuplock","rightuplock","Triangle-Left1","Triangle-Left2","Triangle-Nose1","Triangle-Nose2","Triangle-Right1","Triangle-Right2","BSCUrect1","BSCUrect2","BSCU1","BSCU2"]; diff --git a/Models/Instruments/Lower-ECAM/res/apu.svg b/Models/Instruments/Lower-ECAM/res/apu.svg index a50735c0..18068192 100644 --- a/Models/Instruments/Lower-ECAM/res/apu.svg +++ b/Models/Instruments/Lower-ECAM/res/apu.svg @@ -105,7 +105,7 @@ style="font-style:normal;font-weight:normal;line-height:0%;font-family:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="940.17981" y="939.82428" - id="text6234" + id="GW-weight-unit" sodipodi:linespacing="0%">400     % 1.0 means overheated brakes, - # anything below <= 1.0 means energy absorbed by brakes is OK. - #m.ScalingDivisor= 700000*450.0; + new : func() + { + var m = { parents : [BrakeSystem]}; + # deceleration caused by brakes alone (knots/s2) + m.BrakeDecel = 1.0; # kt/s^2 + # Higher value means quicker cooling + m.CoolingFactor = 0.000125; + # Scaling divisor. Use this to scale the energy output. + # Manually tune this value: a total energy output + # at "/gear/brake-thermal-energy" > 1.0 means overheated brakes, + # anything below <= 1.0 means energy absorbed by brakes is OK. + #m.ScalingDivisor= 700000*450.0; - m.ScalingDivisor = 0.000000006; - - m.LSmokeActive = 0; - m.LSmokeToggle = 0; - m.RSmokeActive = 0; - m.RSmokeToggle = 0; -# m.LnCoolFactor = math.ln(1-m.CoolingFactor); + m.ScalingDivisor = 0.000000006; + + m.LSmokeActive = 0; + m.LSmokeToggle = 0; + m.RSmokeActive = 0; + m.RSmokeToggle = 0; +# m.LnCoolFactor = math.ln(1-m.CoolingFactor); - m.reset(); + m.reset(); - return m; - }, + return m; + }, - reset : func() - { - # Initial thermal energy - setprop("gear/gear[1]/Lbrake-thermal-energy",0.0); - setprop("gear/gear[2]/Rbrake-thermal-energy",0.0); + reset : func() + { + # Initial thermal energy + setprop("gear/gear[1]/Lbrake-thermal-energy",0.0); + setprop("gear/gear[2]/Rbrake-thermal-energy",0.0); - setprop("controls/gear/brake-fans",0); - setprop("gear/gear[1]/Lbrake-smoke",0); - setprop("gear/gear[2]/Rbrake-smoke",0); - setprop("gear/gear[1]/L-Thrust",0); - setprop("gear/gear[2]/R-Thrust",0); + setprop("controls/gear/brake-fans",0); + setprop("gear/gear[1]/Lbrake-smoke",0); + setprop("gear/gear[2]/Rbrake-smoke",0); + setprop("gear/gear[1]/L-Thrust",0); + setprop("gear/gear[2]/R-Thrust",0); #Introducing a random error on temp sensors (max 5°C) - setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5))); - setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5))); - setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5))); - setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5))); + setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5)) - 2.5); + setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5)) - 2.5); + setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5)) - 2.5); + setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5)) - 2.5); - var atemp = getprop("environment/temperature-degc") or 0; - var vmach = getprop("velocities/mach") or 0; - var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); - var tatdegf = 32+(1.8 * tatdegc); + var atemp = getprop("environment/temperature-degc") or 0; + var vmach = getprop("velocities/mach") or 0; + var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat"); - setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")); - setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")); - setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")); - setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")); - setprop("gear/gear[1]/L1brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L1brake-temp-degc"))); - setprop("gear/gear[1]/L2brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[1]/L2brake-temp-degc"))); - setprop("gear/gear[2]/R3brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[2]/R3brake-temp-degc"))); - setprop("gear/gear[2]/R4brake-temp-degf",tatdegf+32+(1.8 * getprop("gear/gear[2]/R4brake-temp-degc"))); + setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")); + setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")); + setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")); + setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")); - setprop("sim/animation/fire-services",0); - me.LastSimTime = 0.0; - }, + setprop("sim/animation/fire-services",0); + me.LastSimTime = 0.0; + }, - # update brake energy - update : func() - { - var CurrentTime = getprop("sim/time/elapsed-sec"); - var dt = CurrentTime - me.LastSimTime; - var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); - var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); + # update brake energy + update : func() + { + var CurrentTime = getprop("sim/time/elapsed-sec"); + var dt = CurrentTime - me.LastSimTime; + var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); + var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm"); - var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); - var atemp = getprop("environment/temperature-degc") or 0; - var vmach = getprop("velocities/mach") or 0; - var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); - var tatdegf = 32+(1.8 * tatdegc); - setprop("environment/total-air-temperature-degc", tatdegc); - setprop("environment/total-air-temperature-degf", tatdegf); + var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); + var atemp = getprop("environment/temperature-degc") or 0; + var vmach = getprop("velocities/mach") or 0; + var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); var L_thrust_lb = getprop("engines/engine[0]/thrust_lb"); var R_thrust_lb = getprop("engines/engine[1]/thrust_lb"); - if (dt<1.0) - { - var OnGround = getprop("gear/gear[1]/wow"); + if (dt<1.0) + { + var OnGround = getprop("gear/gear[1]/wow"); #cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001) var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); - if (getprop("controls/gear/brake-fans")) - { - #increase CoolingRatio if Brake Fans are active - LCoolingRatio = LCoolingRatio * 3; - RCoolingRatio = RCoolingRatio * 3; + if (getprop("controls/gear/brake-fans")) + { + #increase CoolingRatio if Brake Fans are active + LCoolingRatio = LCoolingRatio * 3; + RCoolingRatio = RCoolingRatio * 3; } if (getprop("gear/gear[1]/position-norm")) { - #increase CoolingRatio if gear down according to airspeed - LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt"); + #increase CoolingRatio if gear down according to airspeed + LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt"); } else { - #Reduced CoolingRatio if gear up + #Reduced CoolingRatio if gear up LCoolingRatio = LCoolingRatio * 0.1; } if (getprop("gear/gear[2]/position-norm")) { - #increase CoolingRatio if gear down according to airspeed - RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt"); + #increase CoolingRatio if gear down according to airspeed + RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt"); } else { - #Reduced CoolingRatio if gear up + #Reduced CoolingRatio if gear up RCoolingRatio = RCoolingRatio * 0.1; } if (LBrakeLevel>0) - { - #Reduced CoolingRatio if Brakes used - LCoolingRatio = LCoolingRatio * 0.1 * LBrakeLevel; + { + #Reduced CoolingRatio if Brakes used + LCoolingRatio = LCoolingRatio * 0.1 * LBrakeLevel; } if (RBrakeLevel>0) - { - #Reduced CoolingRatio if Brakes used - RCoolingRatio = RCoolingRatio * 0.1 * RBrakeLevel; + { + #Reduced CoolingRatio if Brakes used + RCoolingRatio = RCoolingRatio * 0.1 * RBrakeLevel; } - + var LnCoolFactor = math.ln(1-LCoolingRatio); var RnCoolFactor = math.ln(1-RCoolingRatio); - L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb")); - if (L_thrust_lb < 1) - { - L_thrust_lb = 1 - } - L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.000000001; + L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb")); + if (L_thrust_lb < 1) + { + L_thrust_lb = 1 + } + L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.0000000002; - R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb")); - if (R_thrust_lb < 1) - { - R_thrust_lb = 1 - } - R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.000000001; + R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb")); + if (R_thrust_lb < 1) + { + R_thrust_lb = 1 + } + R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.0000000002; if (OnGround) { - var V1 = getprop("velocities/groundspeed-kt"); - var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor); + var V1 = getprop("velocities/groundspeed-kt"); + var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor); - # absorb some kinetic energy: - # dE= 1/2 * m * V1^2 - 1/2 * m * V2^2) + # absorb some kinetic energy: + # dE= 1/2 * m * V1^2 - 1/2 * m * V2^2) var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel; - var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; + var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; #TODO - Adjust ThermalEnergy according to differential braking #LBrakeLevel-RBrakeLevel @@ -189,8 +181,8 @@ var BrakeSystem = LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); } else { #LThermalEnergy += L_Thrust; - # cooling effect: reduce thermal energy by (LnCoolFactor) * dt - LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); } } else { if (!getprop("controls/gear/brake-parking")) @@ -198,27 +190,27 @@ var BrakeSystem = if (LBrakeLevel>0) { if (V2_L>0) - { - #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; - # cooling effect: reduce thermal energy by (LnCoolFactor) * dt - LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); - } else { - #LThermalEnergy += math.abs(L_Thrust); - # cooling effect: reduce thermal energy by (LnCoolFactor) * dt - LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); - } + { + #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + } else { + #LThermalEnergy += math.abs(L_Thrust); + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + } } else { # cooling effect: reduce thermal energy by (LnCoolFactor) * dt LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); } } else { #LThermalEnergy += math.abs(L_Thrust); - # cooling effect: reduce thermal energy by (LnCoolFactor) * dt - LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); + # cooling effect: reduce thermal energy by (LnCoolFactor) * dt + LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); } } - RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); + RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); if (getprop("services/chocks/right")) { if (!getprop("controls/gear/brake-parking")) @@ -227,8 +219,8 @@ var BrakeSystem = RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); } else { #RThermalEnergy += math.abs(R_Thrust); - # cooling effect: reduce thermal energy by (RnCoolFactor) * dt - RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); } } else { if (!getprop("controls/gear/brake-parking")) @@ -236,29 +228,29 @@ var BrakeSystem = if (RBrakeLevel>0) { if (V2_R>0) - { - #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; - # cooling effect: reduce thermal energy by (RnCoolFactor) * dt - RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); - } else { - #RThermalEnergy += math.abs(R_Thrust); - # cooling effect: reduce thermal energy by (RnCoolFactor) * dt - RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); - } + { + #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + } else { + #RThermalEnergy += math.abs(R_Thrust); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + } } else { # cooling effect: reduce thermal energy by (RnCoolFactor) * dt RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); } } else { #RThermalEnergy += math.abs(R_Thrust); - # cooling effect: reduce thermal energy by (RnCoolFactor) * dt - RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); + # cooling effect: reduce thermal energy by (RnCoolFactor) * dt + RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); } } } else { - LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); - RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); + LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); + RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); } if (LThermalEnergy < 0) { @@ -276,120 +268,116 @@ var BrakeSystem = setprop("gear/gear[1]/L-Thrust",L_Thrust); setprop("gear/gear[2]/R-Thrust",R_Thrust); - setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy); - setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy); + setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy); + setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy); - #Calculating Brakes temperature - setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L1error-temp-degc")))); - setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc")))); - setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc")))); - setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc")))); - setprop("gear/gear[1]/L1brake-temp-degf",(32 + (1.8 * getprop("gear/gear[1]/L1brake-temp-degc")))); - setprop("gear/gear[1]/L2brake-temp-degf",(32 + (1.8 * getprop("gear/gear[1]/L2brake-temp-degc")))); - setprop("gear/gear[2]/R3brake-temp-degf",(32 + (1.8 * getprop("gear/gear[2]/R3brake-temp-degc")))); - setprop("gear/gear[2]/R4brake-temp-degf",(32 + (1.8 * getprop("gear/gear[2]/R4brake-temp-degc")))); - - if ((LThermalEnergy>1)and(!me.LSmokeActive)) - { - # start smoke processing - me.LSmokeActive = 1; - settimer(func { BrakeSys.Lsmoke(); },0); - } - if ((RThermalEnergy>1)and(!me.RSmokeActive)) - { - # start smoke processing - me.RSmokeActive = 1; - settimer(func { BrakeSys.Rsmoke(); },0); - } - } - - me.LastSimTime = CurrentTime; - # 5 updates per second are good enough - settimer(func { BrakeSys.update(); },0.2); - }, + #Calculating Brakes temperature + setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L1error-temp-degc")))); + setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc")))); + setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc")))); + setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc")))); + + if ((LThermalEnergy>1)and(!me.LSmokeActive)) + { + # start smoke processing + me.LSmokeActive = 1; + settimer(func { BrakeSys.Lsmoke(); },0); + } + if ((RThermalEnergy>1)and(!me.RSmokeActive)) + { + # start smoke processing + me.RSmokeActive = 1; + settimer(func { BrakeSys.Rsmoke(); },0); + } + } + + me.LastSimTime = CurrentTime; + # 5 updates per second are good enough + settimer(func { BrakeSys.update(); },0.2); + }, - # smoke processing - Lsmoke : func() - { - if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1)) - { - # make density of smoke effect depend on energy level - var LSmokeDelay=0; - var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); - if (LThermalEnergy < 1.5) - LSmokeDelay=(1.5-LThermalEnergy); - # No smoke when gear retracted - var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5); - # toggle smoke to interpolate different densities - if (LSmokeDelay>0.05) - { - me.LSmokeToggle = !me.LSmokeToggle; - if (!me.LSmokeToggle) - LSmokeValue = 0; - else - LSmokeDelay = 0; - } - setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue); - settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay); - } - else - { - # stop smoke processing - setprop("gear/gear[1]/Lbrake-smoke",0); - setprop("sim/animation/fire-services",0); - me.LSmokeActive = 0; - } - if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) - setprop("sim/animation/fire-services",1); - else - setprop("sim/animation/fire-services",0); - }, + # smoke processing + Lsmoke : func() + { + if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1)) + { + # make density of smoke effect depend on energy level + var LSmokeDelay=0; + var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); + if (LThermalEnergy < 1.5) + LSmokeDelay=(1.5-LThermalEnergy); + # No smoke when gear retracted + var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5); + # toggle smoke to interpolate different densities + if (LSmokeDelay>0.05) + { + me.LSmokeToggle = !me.LSmokeToggle; + if (!me.LSmokeToggle) + LSmokeValue = 0; + else + LSmokeDelay = 0; + } + setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue); + settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay); + } + else + { + # stop smoke processing + setprop("gear/gear[1]/Lbrake-smoke",0); + setprop("sim/animation/fire-services",0); + me.LSmokeActive = 0; + } + if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) + setprop("sim/animation/fire-services",1); + else + setprop("sim/animation/fire-services",0); + }, - # smoke processing - Rsmoke : func() - { - if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1)) - { - # make density of smoke effect depend on energy level - var RSmokeDelay=0; - var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); - if (RThermalEnergy < 1.5) - RSmokeDelay=(1.5-RThermalEnergy); - # No smoke when gear retracted - var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5); - # toggle smoke to interpolate different densities - if (RSmokeDelay>0.05) - { - me.RSmokeToggle = !me.RSmokeToggle; - if (!me.RSmokeToggle) - RSmokeValue = 0; - else - RSmokeDelay = 0; - } - setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue); - settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay); - } - else - { - # stop smoke processing - setprop("gear/gear[2]/Rbrake-smoke",0); - me.RSmokeActive = 0; - } - if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) - setprop("sim/animation/fire-services",1); - else - setprop("sim/animation/fire-services",0); - }, + # smoke processing + Rsmoke : func() + { + if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1)) + { + # make density of smoke effect depend on energy level + var RSmokeDelay=0; + var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); + if (RThermalEnergy < 1.5) + RSmokeDelay=(1.5-RThermalEnergy); + # No smoke when gear retracted + var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5); + # toggle smoke to interpolate different densities + if (RSmokeDelay>0.05) + { + me.RSmokeToggle = !me.RSmokeToggle; + if (!me.RSmokeToggle) + RSmokeValue = 0; + else + RSmokeDelay = 0; + } + setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue); + settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay); + } + else + { + # stop smoke processing + setprop("gear/gear[2]/Rbrake-smoke",0); + me.RSmokeActive = 0; + } + if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) + setprop("sim/animation/fire-services",1); + else + setprop("sim/animation/fire-services",0); + }, }; var BrakeSys = BrakeSystem.new(); setlistener("sim/signals/fdm-initialized", - # executed on _every_ FDM reset (but not installing new listeners) - func(idle) { BrakeSys.reset(); }, - 0,0); + # executed on _every_ FDM reset (but not installing new listeners) + func(idle) { BrakeSys.reset(); }, + 0,0); settimer(func() - { - BrakeSys.update(); - }, 5); + { + BrakeSys.update(); + }, 5); diff --git a/gui/dialogs/refuel.nas b/gui/dialogs/refuel.nas index e1b9c3c2..33501513 100644 --- a/gui/dialogs/refuel.nas +++ b/gui/dialogs/refuel.nas @@ -5,6 +5,9 @@ # Distribute under the terms of GPLv2. +# Conversion factor pounds to kilogram +LBS2KGS = 0.4535924; + if (pts.Sim.aero.getValue() == "A320-200-CFM") { max_fuel = 42.8; } elsif (pts.Sim.aero.getValue() == "A320-200-IAE" or pts.Sim.aero.getValue() == "A320-100-CFM") { @@ -14,6 +17,7 @@ if (pts.Sim.aero.getValue() == "A320-200-CFM") { } # Get nodes +var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var valve_l_guard = props.globals.getNode("/controls/fuel/refuel/valve-l-guard", 1); var valve_c_guard = props.globals.getNode("/controls/fuel/refuel/valve-c-guard", 1); var valve_r_guard = props.globals.getNode("/controls/fuel/refuel/valve-r-guard", 1); @@ -135,6 +139,9 @@ var refuelClass = { me._END_ind = me._svg.getElementById("END-ind"); + me._Fuel_unit_1 = me._svg.getElementById("Fuel-unit-1"); + me._Fuel_unit_2 = me._svg.getElementById("Fuel-unit-2"); + # Load current panel state # Guards if (valve_l_guard.getValue() == 1) { @@ -481,6 +488,13 @@ var refuelClass = { me._timer.start(); }, _timerf: func() { + if (acconfig_weight_kgs.getValue() == 1) { + me._Fuel_unit_1.setText("KG"); + me._Fuel_unit_2.setText("KG"); + } else { + me._Fuel_unit_1.setText("LBS"); + me._Fuel_unit_2.setText("LBS"); + } # Check power # TODO cut off power when turned on with BATT POWER switch: # The electrical supply is automatically cut off: @@ -493,11 +507,21 @@ var refuelClass = { me._FQI_C.show(); me._FQI_R.show(); - me._fuelPreselectAmount = amount.getValue(); - me._fuelLeftAmount = (systems.FUEL.Quantity.leftOuter.getValue() + systems.FUEL.Quantity.leftInner.getValue()) / 1000; - me._fuelCenterAmount = systems.FUEL.Quantity.center.getValue() / 1000; - me._fuelRightAmount = (systems.FUEL.Quantity.rightOuter.getValue() + systems.FUEL.Quantity.rightInner.getValue()) / 1000; - me._fuelTotalAmount = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000; + if (acconfig_weight_kgs.getValue() == 1) { + me._fuelPreselectAmount = amount.getValue() * LBS2KGS; + me._fuelLeftAmount = ((systems.FUEL.Quantity.leftOuter.getValue() + systems.FUEL.Quantity.leftInner.getValue()) / 1000) * LBS2KGS; + me._fuelCenterAmount = (systems.FUEL.Quantity.center.getValue() / 1000) * LBS2KGS; + me._fuelRightAmount = ((systems.FUEL.Quantity.rightOuter.getValue() + systems.FUEL.Quantity.rightInner.getValue()) / 1000) * LBS2KGS; + me._fuelTotalAmount = (pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000) * LBS2KGS; + var actual_fuel = pts.Consumables.Fuel.totalFuelLbs.getValue() * LBS2KGS; + } else { + me._fuelPreselectAmount = amount.getValue(); + me._fuelLeftAmount = (systems.FUEL.Quantity.leftOuter.getValue() + systems.FUEL.Quantity.leftInner.getValue()) / 1000; + me._fuelCenterAmount = systems.FUEL.Quantity.center.getValue() / 1000; + me._fuelRightAmount = (systems.FUEL.Quantity.rightOuter.getValue() + systems.FUEL.Quantity.rightInner.getValue()) / 1000; + me._fuelTotalAmount = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000; + var actual_fuel = pts.Consumables.Fuel.totalFuelLbs.getValue(); + } if (me._fuelPreselectAmount >= 10.0) { me._FQI_pre.setText(sprintf("%2.1f", me._fuelPreselectAmount)); @@ -524,9 +548,9 @@ var refuelClass = { } if (me._fuelTotalAmount >= 10.0) { - me._FQI_actual.setText(sprintf("%2.1f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000)); + me._FQI_actual.setText(sprintf("%2.1f", actual_fuel / 1000)); } else { - me._FQI_actual.setText(sprintf("%2.2f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000)); + me._FQI_actual.setText(sprintf("%2.2f", actual_fuel / 1000)); } # HI LVL indicator color: #0184f6