cad_page.nas 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # ==============================================================================
  2. # Original Boeing 747-400 pfd by Gijs de Rooy
  3. # Modified for 737-800 by Michael Soitanen
  4. # Modified for EC145 by litzi
  5. # ==============================================================================
  6. # blinking caution bars in case of low N1, or low fuel
  7. # just a guess, unknown which conditions in RL trigger the
  8. # caution indication
  9. if (!contains(adc, "blink")) {
  10. var CBARS = props.globals.getNode("instrumentation/efis/cad/cautionbars", 1);
  11. var cbartimer = maketimer(0.75, func CBARS.setValue(!CBARS.getValue()) );
  12. cbartimer.start();
  13. adc["blink"] = Sensor.new({ prop: CBARS.getPath() });
  14. }
  15. var p=nil;
  16. if (contains(adc,"rotorb") == 0) {
  17. # add some more sensors in air data computer, for engine and fuel system
  18. foreach (var e; [1,2]) {
  19. adc["start"~e] = Sensor.new({prop: "/engines/engine["~(e-1)~"]/starter"});
  20. adc["engfuel"~e] = Sensor.new({prop: "/engines/engine["~(e-1)~"]/out-of-fuel"});
  21. adc["bustie"~e] = Sensor.new({prop: "/controls/electric/engine["~(e-1)~"]/bus-tie"});
  22. adc["primepump"~e] = Sensor.new({prop: "/controls/fuel/tank["~e~"]/prime-pump"});
  23. adc["generator"~e] = Sensor.new({prop: "/controls/electric/engine["~(e-1)~"]/generator"});
  24. adc["tgrip"~e] = Sensor.new({prop: "/controls/engines/engine["~(e-1)~"]/twist-grip"} );
  25. }
  26. adc["battsw"] = Sensor.new({prop: "/controls/electric/battery-switch"});
  27. adc["fpumpfwd"] = Sensor.new({prop: "/controls/switches/fuel/transfer-pump[0]"});
  28. adc["fpumpaft"] = Sensor.new({prop: "/controls/switches/fuel/transfer-pump[1]"});
  29. adc["rotorb"] = Sensor.new({prop: "/controls/rotor/brake"});
  30. }
  31. page_setup["cad"] = func (i) {
  32. p = mfd[i].add_page("cad", HELIONIXPATH~"svg/cad.svg");
  33. # fuel indicators
  34. # ============================
  35. p.add_trans("fuelTotal", "y-scale", {sensor: adc.tank0 });
  36. p.add_trans("fuelL", "y-scale", {sensor: adc.tank1 });
  37. p.add_trans("fuelR", "y-scale", {sensor: adc.tank2 });
  38. p.add_text("fuelNum", {sensor: adc.tank0lbs, scale: LB2KG, format: "%3.0f" });
  39. p.add_text("fuelNum1", {sensor: adc.tank1lbs, scale: LB2KG, format: "%3.0f" });
  40. p.add_text("fuelNum2", {sensor: adc.tank2lbs, scale: LB2KG, format: "%3.0f" });
  41. p.add_text("fuelFlowL", {sensor: adc.ff_1, scale: LB2KG, format: "%3.0f" });
  42. p.add_text("fuelFlowR", {sensor: adc.ff_2, scale: LB2KG, format: "%3.0f" });
  43. #Fuel endurance time
  44. p.add_text("enduH", {sensor: adc.endurance, scale: 1/3600, "trunc":1, format: "%1i" });
  45. p.add_text("enduMin", {sensor: adc.endurance, scale: 1/60, "mod":3600, format: "%2i" });
  46. #Messages Engines
  47. foreach (var e; [1,2]) {
  48. p.add_cond("msg"~e~"_engfail",{sensor: adc["n1_"~e], lessthan: 60});
  49. p.add_cond("msg"~e~"_engidle",{sensor: adc["n1_"~e], between: [60,70]});
  50. p.add_cond("msg"~e~"_starter",{sensor: adc["start"~e], greaterthan: 0.01 });
  51. p.add_cond("msg"~e~"_fuelpress",{sensor: adc["engfuel"~e] });
  52. p.add_cond("msg"~e~"_engoilp",{sensor: adc["oil_p"~e], lessthan: 1.5 });
  53. p.add_cond("msg"~e~"_bustieopn",{sensor: adc["bustie"~e], notequal: 1 });
  54. p.add_cond("msg"~e~"_primepump",{sensor: adc["primepump"~e] });
  55. p.add_cond("msg"~e~"_gendiscon",{sensor: adc["generator"~e], notequal: 1 });
  56. # indicate twist grip only if starter is off
  57. # couple to any periodic sensor on this page
  58. p.add_directTV("msg"~e~"_twistgrip", adc.blink, func(o,c) {o.setVisible( (adc["tgrip"~c].val<10) and (adc["start"~c].val<0.01) ) }, v=e);
  59. p.add_directTV("cautionbars"~e, adc.blink, func(o,c) { o.setVisible ( adc.blink.val and
  60. ( (adc["n1_"~c].val < 60) or
  61. (adc["oil_p"~c].val<1.5) or
  62. (adc["engfuel"~c].val==1) or
  63. (adc["tgrip"~c].val<10)
  64. )
  65. );
  66. }, v=e);
  67. }
  68. p.add_directTV("cautionbars", adc.blink, func(o,c) {o.setVisible( adc.blink.val and
  69. (
  70. (adc.tank1lbs.val*LB2KG < 24) or
  71. (adc.tank2lbs.val*LB2KG < 24) or
  72. ( (adc["fpumpaft"].val==0) and (adc["fpumpfwd"].val==0) )
  73. )
  74. );
  75. }
  76. );
  77. p.add_cond("msg_battdisch", {sensor: adc["batteryload"], greaterthan: 0.01 });
  78. p.add_cond("msg_battdiscon", {sensor: adc["battsw"], notequal: 1 });
  79. p.add_cond("msg_fpumpaft", {sensor: adc["fpumpaft"], notequal: 1 });
  80. p.add_cond("msg_fpumpfwd", {sensor: adc["fpumpfwd"], notequal: 1 });
  81. p.add_cond("msg_fuel", {sensor: adc.add({ function: func () {return (adc.tank1lbs.val*LB2KG) < 24 or (adc.tank2lbs.val*LB2KG) < 24; } }) });
  82. p.add_cond("msg_rotorbrake", {sensor: adc["rotorb"], notequal: 0 });
  83. p.add_cond("msg_doors", {sensor: adc.add({ function: func () {
  84. return getprop("/sim/model/bk117/door-positions/leftBackDoor/position-norm") or
  85. getprop("/sim/model/bk117/door-positions/leftFrontDoor/position-norm") or
  86. getprop("/sim/model/bk117/door-positions/rightBackDoor/position-norm") or
  87. getprop("/sim/model/bk117/door-positions/rightFrontDoor/position-norm") or
  88. getprop("/sim/model/bk117/door-positions/rightRearDoor/position-norm") or
  89. getprop("/sim/model/bk117/door-positions/leftRearDoor/position-norm");
  90. }
  91. })
  92. });
  93. }; # func