hanpa

Mould risk index

Jul 30th, 2022
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. int mouldIindex (float temperature, float humidity ) {
  2. int mtab[51][4] = {
  3. {0,0,0,0}, // 0°
  4. {0,97,98,100}, // 1°
  5. {0,95,97,100}, // 2°
  6. {0,93,95,100}, // 3°
  7. {0,91,93,98}, // 4°
  8. {0,88,92,97}, // 5°
  9. {0,87,91,96}, // 6°
  10. {0,86,91,95}, // 7°
  11. {0,84,90,95}, // 8°
  12. {0,83,89,94}, // 9°
  13. {0,82,88,93}, // 10°
  14. {0,81,88,93}, // 11°
  15. {0,81,88,92}, // 12°
  16. {0,80,87,92}, // 13°
  17. {0,79,87,92}, // 14°
  18. {0,79,87,91}, // 15°
  19. {0,79,86,91}, // 16°
  20. {0,79,86,91}, // 17°
  21. {0,79,86,90}, // 18°
  22. {0,79,85,90}, // 19°
  23. {0,79,85,90}, // 20°
  24. {0,79,85,90}, // 21°
  25. {0,79,85,89}, // 22°
  26. {0,79,84,89}, // 23°
  27. {0,79,84,89}, // 24°
  28. {0,79,84,89}, // 25°
  29. {0,79,84,89}, // 26°
  30. {0,79,83,88}, // 27°
  31. {0,79,83,88}, // 28°
  32. {0,79,83,88}, // 29°
  33. {0,79,83,88}, // 30°
  34. {0,79,83,88}, // 31°
  35. {0,79,83,88}, // 32°
  36. {0,79,82,88}, // 33°
  37. {0,79,82,87}, // 34°
  38. {0,79,82,87}, // 35°
  39. {0,79,82,87}, // 36°
  40. {0,79,82,87}, // 37°
  41. {0,79,82,87}, // 38°
  42. {0,79,82,87}, // 39°
  43. {0,79,82,87}, // 40°
  44. {0,79,81,87}, // 41°
  45. {0,79,81,87}, // 42°
  46. {0,79,81,87}, // 43°
  47. {0,79,81,87}, // 44°
  48. {0,79,81,86}, // 45°
  49. {0,79,81,86}, // 46°
  50. {0,79,81,86}, // 47°
  51. {0,79,80,86}, // 48°
  52. {0,79,80,86}, // 49°
  53. {0,79,80,86} // 50°
  54. };
  55.  
  56. int mindex = 0;
  57. int rtemp = round(temperature);
  58. int rhum = round(humidity);
  59.  
  60. if ( (rtemp <= 0) || (rtemp > 50) ) {
  61. mindex = 0;
  62. } else {
  63. mindex = 3;
  64. for (int i=0; i<4; i++) {
  65. if (rhum < mtab[rtemp][i]) {
  66. mindex = i-1;
  67. break;
  68. }
  69. }
  70. }
  71. return mindex;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment