FireSimulation.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //仿真时间单独计时
  2. public class Fire
  3. {
  4. public class Aircraft
  5. {
  6. public string f_model { get; set; } //机型
  7. public string f_type { get; set; } //飞机种类
  8. public int f_pswaterw { get; set; } //喷洒宽度
  9. public int f_pswaterl { get; set; } //长度
  10. public double f_psmj { get; set; } //喷洒面积
  11. }
  12. //随机数X:0到1
  13. public static double GenerateRandomNumber()
  14. {
  15. Random random = new Random();
  16. double randomNumber = random.NextDouble();
  17. return randomNumber;
  18. }
  19. //小型直升机洒水概率(IP*POS)
  20. public static double SAirProbability(double sigma = 1)
  21. {
  22. double x = GenerateRandomNumber();
  23. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  24. double POS = 0.72 + 0.01 * Math.Exp(exponent);
  25. double result = POS * 1;
  26. return POS;
  27. }
  28. //中型直升机洒水概率
  29. public static double MAirProbability(double sigma = 1)
  30. {
  31. double x = GenerateRandomNumber();
  32. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  33. double POS = 0.8 + 0.1 * Math.Exp(exponent);
  34. double result = POS * 0.93;
  35. return POS;
  36. }
  37. //大型直升机
  38. public static double LAirProbability(double sigma = 1)
  39. {
  40. double x = GenerateRandomNumber();
  41. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  42. double POS = 0.62 + 0.2 * Math.Exp(exponent);
  43. double result = POS * 0.87;
  44. return POS;
  45. }
  46. //多引擎水陆两栖飞机
  47. public static double MultiAirProbability(double sigma = 1)
  48. {
  49. double x = GenerateRandomNumber();
  50. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  51. double POS = 0.72 + 0.16 * Math.Exp(exponent);
  52. double result = POS * 1;
  53. return POS;
  54. }
  55. //单引擎水陆两栖飞机
  56. public static double AmAirProbability(double sigma = 1)
  57. {
  58. double x = GenerateRandomNumber();
  59. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  60. double POS = 0.88 + 0.02 * Math.Exp(exponent);
  61. double result = POS * 1;
  62. return POS;
  63. }
  64. //单引擎灭火飞机
  65. public static double SEAirProbability(double sigma = 1)
  66. {
  67. double x = GenerateRandomNumber();
  68. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  69. double POS = 0.53 + 0.27 * Math.Exp(exponent);
  70. double result = POS * 0.8;
  71. return POS;
  72. }
  73. //大型灭火飞机
  74. public static double LFAirProbability(double sigma = 1)
  75. {
  76. double x = GenerateRandomNumber();
  77. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  78. double POS = 0.53 + 0.27 * Math.Exp(exponent);
  79. double result = POS * 0.74;
  80. return POS;
  81. }
  82. //超大型灭火飞机
  83. public static double ULFAirProbability(double sigma = 1)
  84. {
  85. double x = GenerateRandomNumber();
  86. double exponent = -Math.Pow(x, 2) / (2 * Math.Pow(sigma, 2));
  87. double POS = 0.53 + 0.27 * Math.Exp(exponent);
  88. double result = POS * 0.76;
  89. return POS;
  90. }
  91. //飞机有效洒水面积,sigma一般等于1
  92. public static double SprinklerArea(string type, double sprinklerArea,double sigma = 1)
  93. {
  94. double _sprinklerArea = 0;
  95. switch (type)
  96. {
  97. case "大型直升机":
  98. double probability1 = LAirProbability(sigma)* AirdropAccuracy.GetIpForType(type);
  99. _sprinklerArea = sprinklerArea * probability1;
  100. break;
  101. case "中型直升机":
  102. double probability2 = MAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  103. _sprinklerArea = sprinklerArea * probability2;
  104. break;
  105. case "小型直升机":
  106. double probability3 = SAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  107. _sprinklerArea = sprinklerArea * probability3;
  108. break;
  109. case "多引擎水陆两栖飞机":
  110. double probability4 = MultiAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  111. _sprinklerArea = sprinklerArea * probability4;
  112. break;
  113. case "单引擎水陆两栖飞机":
  114. double probability5 = AmAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  115. _sprinklerArea = sprinklerArea * probability5;
  116. break;
  117. case "单引擎灭火飞机":
  118. double probability6 = SEAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  119. _sprinklerArea = sprinklerArea * probability6;
  120. break;
  121. case "大型灭火飞机":
  122. double probability7 = LFAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  123. _sprinklerArea = sprinklerArea * probability7;
  124. break;
  125. case "超大型灭火飞机":
  126. double probability8 = ULFAirProbability(sigma) * AirdropAccuracy.GetIpForType(type);
  127. _sprinklerArea = sprinklerArea * probability8;
  128. break;
  129. default:
  130. break;
  131. }
  132. return _sprinklerArea;
  133. }
  134. //地面人员灭火有效面积
  135. //任务开始后,每一批次人员相当于一架飞机,每半小时灭火面积相当于一次洒水面积
  136. //地面部署人员、机降人员到达时间、介入人数(王子涵传入)
  137. public static double groundPersonnelWater(int num)
  138. {
  139. // 灭火火线长度
  140. double PL;
  141. // 10分钟洒水火线长度
  142. PL = 0.16 * num * 55;
  143. // 10分钟灭火面积
  144. double result = PL * 5;
  145. return result;
  146. }
  147. public class CountArea
  148. {
  149. public double burncount { get; set; } //火焰蔓延网格数
  150. public double burnarea { get; set; } //火焰蔓延面积
  151. }
  152. //输入初始火场面积,计算已蔓延时间
  153. public static double InitialburnTime(double wind, double slope, double InitialArea)
  154. {
  155. double count = InitialArea / 400;
  156. double time = -((-24.889674335 * slope + 3.646092538 * Math.Pow(slope, 2) - 0.088770151 * Math.Pow(slope, 3) - 0.000209294
  157. * Math.Pow(wind, 4) + 0.000048718 * Math.Pow(wind, 3) * slope + 0.000071368 * Math.Pow(wind, 2)
  158. * Math.Pow(slope, 2) - 0.000004081 * wind * Math.Pow(slope, 3) + 0.000693082 * Math.Pow(slope, 4) + 14 - count) *60)/ 0.833706211;
  159. return time;
  160. }
  161. /// <summary>
  162. /// 火焰蔓延计算方法,第一次洒水前是仿真时间
  163. /// </summary>
  164. /// <param name="wind">风速</param>
  165. /// <param name="slope">坡度</param>
  166. /// <param name="time">飞机仿真时间/s</param>
  167. /// <param name="burnarea">上一次洒水后的面积</param>
  168. /// <param name="tn">本次洒水时间</param>
  169. /// <param name="tn_1">上一次洒水时间</param>
  170. /// <param name="InitialArea">初始输入火场面积</param>
  171. /// <returns></returns>
  172. //
  173. public static CountArea burnCalculate(double wind, double slope, double time, double burnarea, double tn, double tn_1, double InitialArea)
  174. {
  175. double x = GenerateRandomNumber();
  176. if (wind > 12) wind = 12;
  177. if(slope > 10) slope = 10*x;
  178. if(burnarea == 0)
  179. {
  180. if (InitialArea > 0) time = InitialburnTime(wind, slope, InitialArea) + time;
  181. }
  182. else
  183. {
  184. //上一次洒水后面积计算得到的时间,加上两次洒水间隔
  185. time = InitialburnTime(wind, slope, burnarea) + (tn - tn_1);
  186. }
  187. double count = -24.889674335 * slope + 3.646092538 * Math.Pow(slope, 2) - 0.088770151 * Math.Pow(slope, 3)
  188. - 0.000209294 * Math.Pow(wind, 4) + 0.000048718 * Math.Pow(wind, 3) * slope + 0.000071368 * Math.Pow(wind, 2) * Math.Pow(slope, 2)
  189. - 0.000004081 * wind * Math.Pow(slope, 3) + 0.000693082 * Math.Pow(slope, 4) + 0.0138951 * time + 14;
  190. double area = count * 400;
  191. return new CountArea { burncount = count, burnarea = area };
  192. }
  193. /// <summary>
  194. /// 过火面积计算输出公式
  195. /// </summary>
  196. /// <param name="wind">风速</param>
  197. /// <param name="slope">坡度</param>
  198. /// <param name="time">任务耗时</param>
  199. /// <param name="InitialArea">初始输入火场面积</param>
  200. /// <returns></returns>
  201. public static CountArea burnedCalculate(double wind, double slope, double time, double InitialArea)
  202. {
  203. double x = GenerateRandomNumber();
  204. if (wind > 14) wind = 14;
  205. if (slope > 30) slope = 30*x;
  206. if (InitialArea > 0) time += InitialburnTime(wind, slope, InitialArea);
  207. double count = -0.001177737 * wind + 0.030355707 * slope - 0.215432836 * Math.Pow(wind, 2)+ 2.581114293 * wind * slope - 0.492540312 * Math.Pow(wind, 3)
  208. + 0.332922535 * Math.Pow(wind, 2) * slope- 0.062450523 * wind * Math.Pow(slope, 2) - 0.007056557 * Math.Pow(slope, 2)+ 0.6554745 * time ;
  209. double area = count * 400;
  210. return new CountArea { burncount = count, burnarea = area };
  211. }
  212. }