vmd_screen (1).nas 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. vmd_display = canvas.new({
  7. "name": "VMD",
  8. "size": [1024, 1024],
  9. "view": [1050, 1000],
  10. "mipmapping": 1
  11. });
  12. var group = vmd_display.createGroup();
  13. vmd_canvas = canvas_MFD.new(group, helionixpath ~ "svg/vmd.svg");
  14. var DMEFACTOR = 0.0005399;
  15. var ALTFACTOR = (651-464)/400;
  16. var FPS2FPM = 60;
  17. var SHIFT_THRES = 0.5;
  18. var ROT_THRES = 0.1;
  19. # fuel indicators
  20. # and rotor and eng rmp
  21. # ============================
  22. vmd_canvas.add_trans("fuelTotal", "y-scale", {"sensor": adc.tank0 });
  23. vmd_canvas.add_trans("fuelL", "y-scale", {"sensor": adc.tank1 });
  24. vmd_canvas.add_trans("fuelR", "y-scale", {"sensor": adc.tank2 });
  25. vmd_canvas.add_text("fuelNum", {"sensor": adc.tank0lbs, "scale": LB2KG, "format": "%3.0f" });
  26. vmd_canvas.add_text("fuelNum1", {"sensor": adc.tank1lbs, "scale": LB2KG, "format": "%3.0f" });
  27. vmd_canvas.add_text("fuelNum2", {"sensor": adc.tank2lbs, "scale": LB2KG, "format": "%3.0f" });
  28. vmd_canvas.add_text("fuelFlowL", {"sensor": adc.ff_1, "scale": LB2KG, "format": "%3.0f" });
  29. vmd_canvas.add_text("fuelFlowR", {"sensor": adc.ff_2, "scale": LB2KG, "format": "%3.0f" });
  30. vmd_canvas.add_text("Text2", {"sensor": adc.grossweight, "scale": LB2KG, "format": "%4.0f Kg" });
  31. #Fuel endurance time
  32. vmd_canvas.add_text("enduH", {"sensor": adc.endurance, "scale": 1/3600, "trunc":1, "format": "%1i h" });
  33. vmd_canvas.add_text("enduMin", {"sensor": adc.endurance, "scale": 1/60, "mod":3600, "format": "%2i min" });
  34. #Engine Idle and Fail
  35. vmd_canvas.add_cond("failL", {"function": func {return (adc.n1_1.get() or 0) < 50;}, "disable_listener": SLOW });
  36. vmd_canvas.add_cond("idleL", {"function": func {return (adc.n1_1.get() or 0) > 50 and (adc.n1_1.get() or 0) < 65;}, "disable_listener": SLOW });
  37. vmd_canvas.add_cond("failR", {"function": func {return (adc.n1_2.get() or 0) < 50;}, "disable_listener": SLOW });
  38. vmd_canvas.add_cond("idleR", {"function": func {return (adc.n1_2.get() or 0) > 50 and (adc.n1_2.get() or 0) < 65;}, "disable_listener": SLOW });
  39. vmd_canvas.copy_element("gauge_0","_1",[450,0]);
  40. vmd_canvas.copy_element("gauge_0","_2",[130,45]);
  41. vmd_canvas.copy_element("gauge_0","_3",[305,45]);
  42. # Engines TOT Gauges
  43. make_Gauge (
  44. adc.tot_1,
  45. id="",
  46. _min=100,
  47. _max=900,
  48. name="TOT",
  49. );
  50. make_Gauge (
  51. adc.tot_2,
  52. id="_1",
  53. _min=100,
  54. _max=900,
  55. name="TOT",
  56. );
  57. # Engine 1 N1 Gauge
  58. make_Gauge (
  59. adc.n1_1,
  60. id="_2",
  61. _min=75,
  62. _max=115,
  63. name="N1",
  64. );
  65. # Engine 2 N1 Gauge
  66. make_Gauge (
  67. adc.n1_2,
  68. id="_3",
  69. _min=75,
  70. _max=115,
  71. name="N1",
  72. );
  73. vmd_canvas.copy_element("TGauge_0","_1",[190,0]);
  74. # Engine 1 TRQ Gauge
  75. make_TGauge (
  76. adc.trq_1,
  77. id="",
  78. _min=0,
  79. _max=125,
  80. name="TRQ",
  81. );
  82. make_TGauge (
  83. adc.trq_2,
  84. id="_1",
  85. _min=0,
  86. _max=125,
  87. name="TRQ",
  88. );
  89. # look-up-table nr_lut is defined in airdata
  90. vmd_canvas.add_trans("NRgaugeNeedle", "rotation", {"function": func {return adc.nr_lut.get( (adc.nr.get() or 0) )} });
  91. vmd_canvas.add_trans("n2_1Needle", "rotation", {"function": func {return adc.nr_lut.get( adc.n2_1.get() )} });
  92. vmd_canvas.add_trans("n2_2Needle", "rotation", {"function": func {return adc.nr_lut.get( adc.n2_2.get() )} });
  93. vmd_canvas.add_cond("NRgaugeCover1", {"function": func {return (adc.nr.get() or 0) < 80;} });
  94. vmd_canvas.add_cond("NRgaugeCover2", {"function": func {return (adc.nr.get() or 0) > 85;} });
  95. vmd_canvas.copy_element("LinGauge_0","_1",[150,0]);
  96. vmd_canvas.copy_element("LinGauge_0","_2",[305,0]);
  97. make_LinGauge (
  98. adc.oil_t1,
  99. adc.oil_p1,
  100. id="",
  101. _min1=-40,
  102. _max1=140,
  103. fmt1="%3.0f",
  104. unit1="°C",
  105. _min2=0,
  106. _max2=8.0,
  107. fmt2="%3.1f",
  108. unit2="BAR",
  109. name="ENG OIL",
  110. l1=0,
  111. h1=100,
  112. l2=1.7,
  113. h2=5
  114. );
  115. make_LinGauge (
  116. adc.oil_t2,
  117. adc.oil_p2,
  118. id="_1",
  119. _min1=-40,
  120. _max1=140,
  121. fmt1="%3.0f",
  122. unit1="°C",
  123. _min2=0,
  124. _max2=8.0,
  125. fmt2="%3.1f",
  126. unit2="BAR",
  127. name="ENG OIL",
  128. l1=0,
  129. h1=100,
  130. l2=1.7,
  131. h2=5
  132. );
  133. make_LinGauge (
  134. nil,
  135. adc.mgb_p,
  136. id="_2",
  137. _min1=0,
  138. _max1=8,
  139. fmt1="",
  140. unit1="",
  141. _min2=0,
  142. _max2=10,
  143. fmt2="%3.1f",
  144. unit2="BAR",
  145. name="MGB OIL",
  146. l1=nil,
  147. h1=nil,
  148. l2=1.7,
  149. h2=5
  150. );
  151. vmd_canvas.copy_element("numeral","_1",[450,0]);
  152. vmd_canvas.copy_element("numeral","_2",[130,45]);
  153. vmd_canvas.copy_element("numeral","_3",[305,45]);
  154. make_numeral (
  155. adc.tot_1,
  156. id="",
  157. dec=0,
  158. unit=" °C",
  159. _amber=845,
  160. _red=900
  161. );
  162. make_numeral (
  163. adc.tot_2,
  164. id="_1",
  165. dec=0,
  166. unit=" °C",
  167. _amber=845,
  168. _red=900
  169. );
  170. make_numeral (
  171. adc.n1_1,
  172. id="_2",
  173. dec=1,
  174. unit=" %%",
  175. _amber=95,
  176. _red=104
  177. );
  178. make_numeral (
  179. adc.n1_2,
  180. id="_3",
  181. dec=1,
  182. unit=" %%",
  183. _amber=95,
  184. _red=104
  185. );
  186. vmd_canvas.copy_element("numeral","_4",[140,-80]);
  187. vmd_canvas.copy_element("numeral","_5",[140+190,-80]);
  188. make_numeral (
  189. adc.trq_1,
  190. id="_4",
  191. dec=1,
  192. unit=" %%",
  193. _amber=74,
  194. _red=95
  195. );
  196. make_numeral (
  197. adc.trq_2,
  198. id="_5",
  199. dec=1,
  200. unit=" %%",
  201. _amber=74,
  202. _red=95
  203. );
  204. vmd_canvas.copy_element("numeral","_6",[461-81,609-183]);
  205. make_numeral (
  206. adc.nr,
  207. id="_6",
  208. dec=1,
  209. unit=""
  210. );
  211. vmd_canvas.copy_element("numeral","_7",[461-81-70,609-183+107]);
  212. vmd_canvas.copy_element("numeral","_8",[461-81+50,609-183+107]);
  213. make_numeral (
  214. adc.n2_1,
  215. id="_7",
  216. dec=1,
  217. unit=" %%",
  218. _amber=-96,
  219. _red=-85
  220. );
  221. make_numeral (
  222. adc.n2_2,
  223. id="_8",
  224. dec=1,
  225. unit=" %%",
  226. _amber=-96,
  227. _red=-85
  228. );
  229. vmd_canvas.newMFD();