1
0

convert.nas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. #############################################################################
  2. #### Helijah 08-2020 ####
  3. #### 03-2021 ####
  4. #### Quelques propriétés utiles ####
  5. #############################################################################
  6. var convert = func {
  7. ###########################################################################
  8. var rpm0 = getprop("/engines/engine[0]/rpm");
  9. if ( ! rpm0 ) {
  10. rpm0 = 0;
  11. }
  12. var cht0 = getprop("/engines/engine[0]/cht-degC");
  13. if ( ! cht0 ) {
  14. cht0 = 0;
  15. }
  16. var egt0 = getprop("/engines/engine[0]/egt-degC");
  17. if ( ! egt0 ) {
  18. egt0 = 0;
  19. }
  20. var mp0 = getprop("/engines/engine[0]/mp-osi");
  21. if (! mp0 ) {
  22. mp0 = 0;
  23. }
  24. var run0 = getprop("/engines/engine[0]/running");
  25. if (! run0 ) {
  26. run0 = 0;
  27. }
  28. var flow0 = getprop("/engines/engine[0]/fuel-flow-gph");
  29. if ( ! flow0 ) {
  30. flow0 = 0;
  31. }
  32. var oilt0 = getprop("/engines/engine[0]/oil-temperature");
  33. if ( ! oilt0 ) {
  34. oilt0 = 0;
  35. }
  36. ###########################################################################
  37. var rpm1 = getprop("/engines/engine[1]/rpm");
  38. if ( ! rpm1 ) {
  39. rpm1 = 0;
  40. }
  41. var cht1 = getprop("/engines/engine[1]/cht-degC");
  42. if ( ! cht1 ) {
  43. cht1 = 0;
  44. }
  45. var egt1 = getprop("/engines/engine[1]/egt-degC");
  46. if ( ! egt1 ) {
  47. egt1 = 0;
  48. }
  49. var mp1 = getprop("/engines/engine[1]/mp-osi");
  50. if (! mp1 ) {
  51. mp1 = 0;
  52. }
  53. var run1 = getprop("/engines/engine[1]/running");
  54. if (! run1 ) {
  55. run1 = 0;
  56. }
  57. var flow1 = getprop("/engines/engine[1]/fuel-flow-gph");
  58. if ( ! flow1 ) {
  59. flow1 = 0;
  60. }
  61. var oilt1 = getprop("/engines/engine[1]/oil-temperature");
  62. if ( ! oilt1 ) {
  63. oilt1 = 0;
  64. }
  65. ###########################################################################
  66. var rpm2 = getprop("/engines/engine[2]/rpm");
  67. if ( ! rpm2 ) {
  68. rpm2 = 0;
  69. }
  70. var cht2 = getprop("/engines/engine[2]/cht-degC");
  71. if ( ! cht2 ) {
  72. cht2 = 0;
  73. }
  74. var egt2 = getprop("/engines/engine[2]/egt-degC");
  75. if ( ! egt2 ) {
  76. egt2 = 0;
  77. }
  78. var mp2 = getprop("/engines/engine[2]/mp-osi");
  79. if (! mp2 ) {
  80. mp2 = 0;
  81. }
  82. var run2 = getprop("/engines/engine[2]/running");
  83. if (! run2 ) {
  84. run2 = 0;
  85. }
  86. var flow2 = getprop("/engines/engine[2]/fuel-flow-gph");
  87. if ( ! flow2 ) {
  88. flow2 = 0;
  89. }
  90. var oilt2 = getprop("/engines/engine[2]/oil-temperature");
  91. if ( ! oilt2 ) {
  92. oilt2 = 0;
  93. }
  94. ###########################################################################
  95. var rpm3 = getprop("/engines/engine[3]/rpm");
  96. if ( ! rpm3 ) {
  97. rpm3 = 0;
  98. }
  99. var cht3 = getprop("/engines/engine[3]/cht-degC");
  100. if ( ! cht3 ) {
  101. cht3 = 0;
  102. }
  103. var egt3 = getprop("/engines/engine[3]/egt-degC");
  104. if ( ! egt3 ) {
  105. egt3 = 0;
  106. }
  107. var mp3 = getprop("/engines/engine[3]/mp-osi");
  108. if (! mp3 ) {
  109. mp3 = 0;
  110. }
  111. var run3 = getprop("/engines/engine[3]/running");
  112. if (! run3 ) {
  113. run3 = 0;
  114. }
  115. var flow3 = getprop("/engines/engine[3]/fuel-flow-gph");
  116. if ( ! flow3 ) {
  117. flow3 = 0;
  118. }
  119. var oilt3 = getprop("/engines/engine[3]/oil-temperature");
  120. if ( ! oilt3 ) {
  121. oilt3 = 0;
  122. }
  123. ###########################################################################
  124. var rpm4 = getprop("/engines/engine[4]/rpm");
  125. if ( ! rpm4 ) {
  126. rpm4 = 0;
  127. }
  128. var cht4 = getprop("/engines/engine[4]/cht-degC");
  129. if ( ! cht4 ) {
  130. cht4 = 0;
  131. }
  132. var egt4 = getprop("/engines/engine[4]/egt-degC");
  133. if ( ! egt4 ) {
  134. egt4 = 0;
  135. }
  136. var mp4 = getprop("/engines/engine[4]/mp-osi");
  137. if (! mp4 ) {
  138. mp4 = 0;
  139. }
  140. var run4 = getprop("/engines/engine[4]/running");
  141. if (! run4 ) {
  142. run4 = 0;
  143. }
  144. var flow4 = getprop("/engines/engine[4]/fuel-flow-gph");
  145. if ( ! flow4 ) {
  146. flow4 = 0;
  147. }
  148. var oilt4 = getprop("/engines/engine[4]/oil-temperature");
  149. if ( ! oilt4 ) {
  150. oilt4 = 0;
  151. }
  152. ###########################################################################
  153. var rpm5 = getprop("/engines/engine[5]/rpm");
  154. if ( ! rpm5 ) {
  155. rpm5 = 0;
  156. }
  157. var cht5 = getprop("/engines/engine[5]/cht-degC");
  158. if ( ! cht5 ) {
  159. cht5 = 0;
  160. }
  161. var egt5 = getprop("/engines/engine[5]/egt-degC");
  162. if ( ! egt5 ) {
  163. egt5 = 0;
  164. }
  165. var mp5 = getprop("/engines/engine[5]/mp-osi");
  166. if (! mp5 ) {
  167. mp5 = 0;
  168. }
  169. var run5 = getprop("/engines/engine[5]/running");
  170. if (! run5 ) {
  171. run5 = 0;
  172. }
  173. var flow5 = getprop("/engines/engine[5]/fuel-flow-gph");
  174. if ( ! flow5 ) {
  175. flow5 = 0;
  176. }
  177. var oilt5 = getprop("/engines/engine[5]/oil-temperature");
  178. if ( ! oilt5 ) {
  179. oilt5 = 0;
  180. }
  181. ###########################################################################
  182. var oat = getprop("/environment/temperature-degc");
  183. if ( ! oat ) {
  184. oat = 0;
  185. }
  186. var ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
  187. if ( ! ias ) {
  188. ias = 0;
  189. }
  190. var mb0 = getprop("/engines/engine[0]/torque-ftlb");
  191. if ( ! mb0 ) {
  192. mb0 = 0;
  193. }
  194. var mb1 = getprop("/engines/engine[1]/torque-ftlb");
  195. if ( ! mb1 ) {
  196. mb1 = 0;
  197. }
  198. var mb2 = getprop("/engines/engine[2]/torque-ftlb");
  199. if ( ! mb2 ) {
  200. mb2 = 0;
  201. }
  202. var mb3 = getprop("/engines/engine[3]/torque-ftlb");
  203. if ( ! mb3 ) {
  204. mb3 = 0;
  205. }
  206. var mb4 = getprop("/engines/engine[4]/torque-ftlb");
  207. if ( ! mb4 ) {
  208. mb4 = 0;
  209. }
  210. var mb5 = getprop("/engines/engine[5]/torque-ftlb");
  211. if ( ! mb5 ) {
  212. mb5 = 0;
  213. }
  214. var fuel_pres0 = 0.0;
  215. var oil_pres0 = 0.0;
  216. var fuel_pres1 = 0.0;
  217. var oil_pres1 = 0.0;
  218. var fuel_pres2 = 0.0;
  219. var oil_pres2 = 0.0;
  220. var fuel_pres3 = 0.0;
  221. var oil_pres3 = 0.0;
  222. var fuel_pres4 = 0.0;
  223. var oil_pres4 = 0.0;
  224. var fuel_pres5 = 0.0;
  225. var oil_pres5 = 0.0;
  226. ###########################################################################
  227. if ( mp0 < 10) {
  228. mp0 = 10;
  229. }
  230. if ( mp1 < 10) {
  231. mp1 = 10;
  232. }
  233. if ( mp2 < 10) {
  234. mp2 = 10;
  235. }
  236. if ( mp3 < 10) {
  237. mp3 = 10;
  238. }
  239. if ( mp4 < 10) {
  240. mp4 = 10;
  241. }
  242. if ( mp5 < 10) {
  243. mp5 = 10;
  244. }
  245. #Engine 0
  246. if (run0) {
  247. cht0 = cht0 + (mp0 * 8 + oat - ias/3 - cht0) / 250;
  248. egt0 = egt0 + ((mp0 * 30 + cht0 * 2) * mp0 / (flow0 * 2 + 1) - egt0) / 100;
  249. oilt0 = oilt0 +(rpm0 / 25 + oat - oilt0) / 250;
  250. } else {
  251. if ( ! cht0 ) {
  252. cht0 = oat;
  253. }
  254. if ( ! egt0 ) {
  255. egt0 = oat;
  256. }
  257. if ( ! oilt0 ) {
  258. oilt0 = oat;
  259. }
  260. cht0 = cht0 + (oat - cht0)/100;
  261. egt0 = egt0 + (oat - egt0)/100;
  262. oilt0 = oilt0 + (oat - oilt0)/100;
  263. }
  264. #Engine 1
  265. if (run1) {
  266. cht1 = cht1 + (mp1 * 8 + oat - ias/3 - cht1) / 250;
  267. egt1 = egt1 + ((mp1 * 30 + cht1 * 2) * mp1 / (flow1 * 2 + 1) - egt1) / 100;
  268. oilt1 = oilt1 +(rpm1 / 25 + oat - oilt1) / 250;
  269. } else {
  270. if ( ! cht1 ) {
  271. cht1 = oat;
  272. }
  273. if ( ! egt1 ) {
  274. egt1 = oat;
  275. }
  276. if ( ! oilt1 ) {
  277. oilt1 = oat;
  278. }
  279. cht1 = cht1 + (oat - cht1)/100;
  280. egt1 = egt1 + (oat - egt1)/100;
  281. oilt1 = oilt1 + (oat - oilt1)/100;
  282. }
  283. #Engine 2
  284. if (run2) {
  285. cht2 = cht2 + (mp2 * 8 + oat - ias/3 - cht2) / 250;
  286. egt2 = egt2 + ((mp2 * 30 + cht2 * 2) * mp2 / (flow2 * 2 + 1) - egt2) / 100;
  287. oilt2 = oilt2 +(rpm2 / 25 + oat - oilt2) / 250;
  288. } else {
  289. if ( ! cht2 ) {
  290. cht2 = oat;
  291. }
  292. if ( ! egt2 ) {
  293. egt2 = oat;
  294. }
  295. if ( ! oilt2 ) {
  296. oilt2 = oat;
  297. }
  298. cht2 = cht2 + (oat - cht2)/100;
  299. egt2 = egt2 + (oat - egt2)/100;
  300. oilt2 = oilt2 + (oat - oilt2)/100;
  301. }
  302. #Engine 3
  303. if (run3) {
  304. cht3 = cht3 + (mp3 * 8 + oat - ias/3 - cht3) / 250;
  305. egt3 = egt3 + ((mp3 * 30 + cht3 * 2) * mp3 / (flow3 * 2 + 1) - egt3) / 100;
  306. oilt3 = oilt3 +(rpm3 / 25 + oat - oilt3) / 250;
  307. } else {
  308. if ( ! cht3 ) {
  309. cht3 = oat;
  310. }
  311. if ( ! egt3 ) {
  312. egt3 = oat;
  313. }
  314. if ( ! oilt3 ) {
  315. oilt3 = oat;
  316. }
  317. cht3 = cht3 + (oat - cht3)/100;
  318. egt3 = egt3 + (oat - egt3)/100;
  319. oilt3 = oilt3 + (oat - oilt3)/100;
  320. }
  321. #Engine 4
  322. if (run4) {
  323. cht4 = cht4 + (mp4 * 8 + oat - ias/3 - cht4) / 250;
  324. egt4 = egt4 + ((mp4 * 30 + cht4 * 2) * mp4 / (flow4 * 2 + 1) - egt4) / 100;
  325. oilt4 = oilt4 +(rpm4 / 25 + oat - oilt4) / 250;
  326. } else {
  327. if ( ! cht4 ) {
  328. cht4 = oat;
  329. }
  330. if ( ! egt4 ) {
  331. egt4 = oat;
  332. }
  333. if ( ! oilt4 ) {
  334. oilt4 = oat;
  335. }
  336. cht4 = cht4 + (oat - cht4)/100;
  337. egt4 = egt4 + (oat - egt4)/100;
  338. oilt4 = oilt4 + (oat - oilt4)/100;
  339. }
  340. #Engine 5
  341. if (run5) {
  342. cht5 = cht5 + (mp5 * 8 + oat - ias/3 - cht5) / 250;
  343. egt5 = egt5 + ((mp5 * 30 + cht5 * 2) * mp5 / (flow5 * 2 + 1) - egt5) / 100;
  344. oilt5 = oilt5 +(rpm5 / 25 + oat - oilt5) / 250;
  345. } else {
  346. if ( ! cht5 ) {
  347. cht5 = oat;
  348. }
  349. if ( ! egt5 ) {
  350. egt5 = oat;
  351. }
  352. if ( ! oilt5 ) {
  353. oilt5 = oat;
  354. }
  355. cht5 = cht5 + (oat - cht5)/100;
  356. egt5 = egt5 + (oat - egt5)/100;
  357. oilt5 = oilt5 + (oat - oilt5)/100;
  358. }
  359. #Engine 0
  360. if (rpm0 > 100.0) {
  361. fuel_pres0 = rpm0 / 100;
  362. oil_pres0 = rpm0 / 25;
  363. }
  364. #Engine 1
  365. if (rpm1 > 100.0) {
  366. fuel_pres1 = rpm1 / 100;
  367. oil_pres1 = rpm1 / 25;
  368. }
  369. #Engine 2
  370. if (rpm2 > 100.0) {
  371. fuel_pres2 = rpm2 / 100;
  372. oil_pres2 = rpm2 / 25;
  373. }
  374. #Engine 3
  375. if (rpm3 > 100.0) {
  376. fuel_pres3 = rpm3 / 100;
  377. oil_pres3 = rpm3 / 25;
  378. }
  379. #Engine 4
  380. if (rpm4 > 100.0) {
  381. fuel_pres4 = rpm4 / 100;
  382. oil_pres4 = rpm4 / 25;
  383. }
  384. #Engine 5
  385. if (rpm5 > 100.0) {
  386. fuel_pres5 = rpm5 / 100;
  387. oil_pres5 = rpm5 / 25;
  388. }
  389. setprop("/engines/engine[0]/oil-pressure-psi", oil_pres0);
  390. setprop("/engines/engine[0]/fuel-pressure-psi", fuel_pres0);
  391. setprop("/engines/engine[1]/oil-pressure-psi", oil_pres1);
  392. setprop("/engines/engine[1]/fuel-pressure-psi", fuel_pres1);
  393. setprop("/engines/engine[2]/oil-pressure-psi", oil_pres2);
  394. setprop("/engines/engine[2]/fuel-pressure-psi", fuel_pres2);
  395. setprop("/engines/engine[3]/oil-pressure-psi", oil_pres3);
  396. setprop("/engines/engine[3]/fuel-pressure-psi", fuel_pres3);
  397. setprop("/engines/engine[4]/oil-pressure-psi", oil_pres3);
  398. setprop("/engines/engine[4]/fuel-pressure-psi", fuel_pres3);
  399. setprop("/engines/engine[5]/oil-pressure-psi", oil_pres3);
  400. setprop("/engines/engine[5]/fuel-pressure-psi", fuel_pres3);
  401. setprop("/engines/engine[0]/cht-degC", cht0);
  402. setprop("/engines/engine[0]/oil-temperature", oilt0);
  403. setprop("/engines/engine[0]/egt-degC", egt0);
  404. setprop("/engines/engine[0]/egt-degf-calc", egt0 * 9/5 + 32);
  405. setprop("/engines/engine[1]/cht-degC", cht1);
  406. setprop("/engines/engine[1]/oil-temperature", oilt1);
  407. setprop("/engines/engine[1]/egt-degC", egt1);
  408. setprop("/engines/engine[1]/egt-degf-calc", egt1 * 9/5 + 32);
  409. setprop("/engines/engine[2]/cht-degC", cht2);
  410. setprop("/engines/engine[2]/oil-temperature", oilt2);
  411. setprop("/engines/engine[2]/egt-degC", egt2);
  412. setprop("/engines/engine[2]/egt-degf-calc", egt2 * 9/5 + 32);
  413. setprop("/engines/engine[3]/cht-degC", cht3);
  414. setprop("/engines/engine[3]/oil-temperature", oilt3);
  415. setprop("/engines/engine[3]/egt-degC", egt3);
  416. setprop("/engines/engine[3]/egt-degf-calc", egt3 * 9/5 + 32);
  417. setprop("/engines/engine[4]/cht-degC", cht4);
  418. setprop("/engines/engine[4]/oil-temperature", oilt4);
  419. setprop("/engines/engine[4]/egt-degC", egt4);
  420. setprop("/engines/engine[4]/egt-degf-calc", egt4 * 9/5 + 32);
  421. setprop("/engines/engine[5]/cht-degC", cht5);
  422. setprop("/engines/engine[5]/oil-temperature", oilt5);
  423. setprop("/engines/engine[5]/egt-degC", egt5);
  424. setprop("/engines/engine[5]/egt-degf-calc", egt5 * 9/5 + 32);
  425. setprop("/systems/electrical/amp", (rpm0 + rpm1 + rpm2 + rpm3 + rpm4 + rpm5) / 100 );
  426. ##################################################
  427. # Torque -> Pourcent by Helijah : Max 4094 -> 100%
  428. ##################################################
  429. var torqpourcent = mb0 * 0.0244259892526;
  430. setprop("/engines/engine[0]/torque-pourcent", torqpourcent);
  431. var smb = sprintf("%03.f", torqpourcent);
  432. setprop("/engines/engine[0]/Torque/unit100", chr(smb[0]));
  433. setprop("/engines/engine[0]/Torque/unit10", chr(smb[1]));
  434. setprop("/engines/engine[0]/Torque/unit1", chr(smb[2]));
  435. torqpourcent = mb1 * 0.0244259892526;
  436. setprop("/engines/engine[1]/torque-pourcent", torqpourcent);
  437. smb = sprintf("%03.f", torqpourcent);
  438. setprop("/engines/engine[1]/Torque/unit100", chr(smb[0]));
  439. setprop("/engines/engine[1]/Torque/unit10", chr(smb[1]));
  440. setprop("/engines/engine[1]/Torque/unit1", chr(smb[2]));
  441. torqpourcent = mb2 * 0.0244259892526;
  442. setprop("/engines/engine[2]/torque-pourcent", torqpourcent);
  443. smb = sprintf("%03.f", torqpourcent);
  444. setprop("/engines/engine[2]/Torque/unit100", chr(smb[0]));
  445. setprop("/engines/engine[2]/Torque/unit10", chr(smb[1]));
  446. setprop("/engines/engine[2]/Torque/unit1", chr(smb[2]));
  447. torqpourcent = mb3 * 0.0244259892526;
  448. setprop("/engines/engine[3]/torque-pourcent", torqpourcent);
  449. smb = sprintf("%03.f", torqpourcent);
  450. setprop("/engines/engine[3]/Torque/unit100", chr(smb[0]));
  451. setprop("/engines/engine[3]/Torque/unit10", chr(smb[1]));
  452. setprop("/engines/engine[3]/Torque/unit1", chr(smb[2]));
  453. torqpourcent = mb4 * 0.0244259892526;
  454. setprop("/engines/engine[4]/torque-pourcent", torqpourcent);
  455. smb = sprintf("%03.f", torqpourcent);
  456. setprop("/engines/engine[4]/Torque/unit100", chr(smb[0]));
  457. setprop("/engines/engine[4]/Torque/unit10", chr(smb[1]));
  458. setprop("/engines/engine[4]/Torque/unit1", chr(smb[2]));
  459. torqpourcent = mb5 * 0.0244259892526;
  460. setprop("/engines/engine[5]/torque-pourcent", torqpourcent);
  461. smb = sprintf("%03.f", torqpourcent);
  462. setprop("/engines/engine[5]/Torque/unit100", chr(smb[0]));
  463. setprop("/engines/engine[5]/Torque/unit10", chr(smb[1]));
  464. setprop("/engines/engine[5]/Torque/unit1", chr(smb[2]));
  465. ##################################################
  466. setprop("/engines/engine[0]/egt-degC", convertTemp(getprop("/engines/engine[0]/egt-degf")));
  467. setprop("/engines/engine[0]/oil-temperature-degC", convertTemp(getprop("/engines/engine[0]/oil-temperature-degf")));
  468. setprop("/engines/engine[1]/egt-degC", convertTemp(getprop("/engines/engine[1]/egt-degf")));
  469. setprop("/engines/engine[1]/oil-temperature-degC", convertTemp(getprop("/engines/engine[1]/oil-temperature-degf")));
  470. setprop("/engines/engine[2]/egt-degC", convertTemp(getprop("/engines/engine[2]/egt-degf")));
  471. setprop("/engines/engine[2]/oil-temperature-degC", convertTemp(getprop("/engines/engine[2]/oil-temperature-degf")));
  472. setprop("/engines/engine[3]/egt-degC", convertTemp(getprop("/engines/engine[3]/egt-degf")));
  473. setprop("/engines/engine[3]/oil-temperature-degC", convertTemp(getprop("/engines/engine[3]/oil-temperature-degf")));
  474. setprop("/engines/engine[4]/egt-degC", convertTemp(getprop("/engines/engine[4]/egt-degf")));
  475. setprop("/engines/engine[4]/oil-temperature-degC", convertTemp(getprop("/engines/engine[4]/oil-temperature-degf")));
  476. setprop("/engines/engine[5]/egt-degC", convertTemp(getprop("/engines/engine[5]/egt-degf")));
  477. setprop("/engines/engine[5]/oil-temperature-degC", convertTemp(getprop("/engines/engine[5]/oil-temperature-degf")));
  478. setprop("/engines/engine[0]/itt-norm", getprop("/engines/engine[0]/cht-degC") / 100);
  479. setprop("/engines/engine[1]/itt-norm", getprop("/engines/engine[1]/cht-degC") / 100);
  480. setprop("/engines/engine[2]/itt-norm", getprop("/engines/engine[2]/cht-degC") / 100);
  481. setprop("/engines/engine[3]/itt-norm", getprop("/engines/engine[3]/cht-degC") / 100);
  482. setprop("/engines/engine[4]/itt-norm", getprop("/engines/engine[4]/cht-degC") / 100);
  483. setprop("/engines/engine[5]/itt-norm", getprop("/engines/engine[5]/cht-degC") / 100);
  484. }
  485. var convertTemp = func(degF) {
  486. var degC = 0;
  487. if ( degF != nil ) {
  488. #print(degF);
  489. degC = (degF - 32) * 5/9;
  490. }
  491. return degC;
  492. }
  493. ### Main loop ###
  494. var update_convert = func {
  495. convert();
  496. settimer(update_convert, 0);
  497. }
  498. setlistener("/sim/signals/fdm-initialized", update_convert);