CWS.nas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. WarningPanelUpdate = func {
  2. var engp = props.globals.getNode("/engines/engine/oil-pressure-bar").getValue() or 0;
  3. var horn = props.globals.getNode("/controls/electric/horn").getValue() or 0;
  4. var mgbp = props.globals.getNode("/rotors/gear/mgb-oil-pressure-bar").getValue() or 0;
  5. var pitot = props.globals.getNode("/controls/anti-ice/pitot-heat").getValue() or 0;
  6. var fuelp = props.globals.getNode("/controls/fuel/tank/fuellines_filled").getValue() or 0;
  7. var batt = props.globals.getNode("/systems/electrical/batt-volts").getValue() or 0;
  8. var n1 = props.globals.getNode("/engines/engine/n1-pct").getValue() or 0;
  9. var twtgrip = props.globals.getNode("/controls/engines/engine/power").getValue() or 0;
  10. var oilp = props.globals.getNode("/engines/engine/oil-pressure-bar-filter").getValue() or 0;
  11. var volts = props.globals.getNode("/systems/electrical/volts").getValue() or 0;
  12. var genload = props.globals.getNode("/systems/electrical/gen-load").getValue() or 0;
  13. var fuel = props.globals.getNode("/consumables/fuel/tank[0]/level-lbs").getValue() or 0;
  14. var starter = props.globals.getNode("/controls/engines/engine/starter").getValue() or 0;
  15. var test = getprop("/controls/electric/warningtest");
  16. ###warnings###
  17. if ((fuel <106) or test)
  18. {
  19. setprop("/instrumentation/annunciators/warning/fuel",1);
  20. } else {
  21. setprop("/instrumentation/annunciators/warning/fuel",0.0);
  22. }
  23. if ((genload<0.3) or test)
  24. {
  25. setprop("/instrumentation/annunciators/warning/gen",1);
  26. } else {
  27. setprop("/instrumentation/annunciators/warning/gen",0.0);
  28. }
  29. if ((batt < 24 ) or test)
  30. {
  31. setprop("/instrumentation/annunciators/warning/batt",1);
  32. } else {
  33. setprop("/instrumentation/annunciators/warning/batt",0.0);
  34. }
  35. if ((fuelp < 0.99) or test)
  36. {
  37. setprop("/instrumentation/annunciators/warning/fuelp",1);
  38. } else {
  39. setprop("/instrumentation/annunciators/warning/fuelp",0.0);
  40. }
  41. if ((pitot < 1) or test)
  42. {
  43. setprop("/instrumentation/annunciators/warning/pitot",1);
  44. } else {
  45. setprop("/instrumentation/annunciators/warning/pitot",0.0);
  46. }
  47. if ((horn < 1) or test)
  48. {
  49. setprop("/instrumentation/annunciators/warning/horn",1);
  50. } else {
  51. setprop("/instrumentation/annunciators/warning/horn",0.0);
  52. }
  53. ###cautions###
  54. if ((oilp <1.1) or test)
  55. {
  56. setprop("/instrumentation/annunciators/cautions/engp",1);
  57. } else {
  58. setprop("/instrumentation/annunciators/cautions/engp",0);
  59. }
  60. if ((twtgrip < 0.99) or test)
  61. {
  62. setprop("/instrumentation/annunciators/cautions/twtgrip",1);
  63. } else {
  64. setprop("/instrumentation/annunciators/cautions/twtgrip",0);
  65. }
  66. if ((mgbp < 1) or test)
  67. {
  68. setprop("/instrumentation/annunciators/cautions/mgbp",1);
  69. } else {
  70. setprop("/instrumentation/annunciators/cautions/mgbp",0);
  71. }
  72. if ((engp < 1.1) or test)
  73. {
  74. setprop("/instrumentation/annunciators/cautions/engp",1);
  75. } else {
  76. setprop("/instrumentation/annunciators/cautions/engp",0);
  77. }
  78. ###
  79. if (test)
  80. {
  81. setprop("/instrumentation/annunciators/test",1);
  82. } else {
  83. setprop("/instrumentation/annunciators/test",0);
  84. }
  85. settimer(WarningPanelUpdate, 0.1);
  86. }
  87. WarningPanelUpdate();