FireSimulation.cs 10.0 KB

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