SJAllTotalTaskPerformance.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using static Fire;
  2. namespace SimulationServer;
  3. public class SJAllTotalTaskPerformance
  4. {
  5. public string 识别成功率;
  6. public string 任务准备时间;
  7. public string 平均搜索时间;
  8. public string 平均救助时间;
  9. public string 总飞行时间;
  10. public string 海情覆盖率;
  11. public string 任务是否成功;
  12. public string 人员存活率;
  13. public string 环境覆盖率;
  14. }
  15. public class SJAllTotalTaskPerformanceComponent
  16. {
  17. public SJAllTotalTaskPerformance SSJAllTotalTaskPerformance = new SJAllTotalTaskPerformance();
  18. public SJAllTotalTaskPerformance LSJAllTotalTaskPerformance = new SJAllTotalTaskPerformance();
  19. public int sIndex;
  20. public int lIndex;
  21. public void FillData(List<SeaSJRescueMission> missions)
  22. {
  23. double 任务准备时间 = 0;
  24. double 平均搜索时间 = 0;
  25. double 总飞行时间 = 0;
  26. double 人员存活率 = 0;
  27. double 任务是否成功 = 0;
  28. float 识别成功率 = 0f;
  29. double aircreftCount = 0;
  30. foreach (SeaSJRescueMission mhRescueMission in missions)
  31. {
  32. //foreach (var aircraft in mhRescueMission.aircrafts)
  33. //{
  34. // if (aircraft.isseePerson)
  35. // 识别成功率 += 1f;
  36. // if (任务准备时间 < aircraft.TaskReadyTime)
  37. // 任务准备时间 = aircraft.TaskReadyTime;
  38. // 平均搜索时间 += aircraft.SearchTime;
  39. // 总飞行时间 += aircraft.TotalTime;
  40. // 人员存活率 += aircraft.Success ? 1 : 0;
  41. // aircreftCount++;
  42. //}
  43. foreach (var item in mhRescueMission.aircraftSJDatas)
  44. {
  45. 识别成功率 += float.Parse(item.Value["识别成功率"][sIndex]);
  46. if (任务准备时间 < float.Parse(item.Value["任务准备时间"][sIndex]))
  47. 任务准备时间 = float.Parse(item.Value["任务准备时间"][sIndex]);
  48. 平均搜索时间 += float.Parse(item.Value["平均搜索时间"][sIndex]);
  49. 总飞行时间 += float.Parse(item.Value["总飞行时间"][sIndex]);
  50. 人员存活率 += float.Parse(item.Value["人员存活率"][sIndex]);
  51. aircreftCount++;
  52. }
  53. }
  54. if (人员存活率 != 0)
  55. 任务是否成功 = 1;
  56. SSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / aircreftCount).ToString();
  57. SSJAllTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
  58. SSJAllTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / aircreftCount).ToString();
  59. SSJAllTotalTaskPerformance.平均救助时间 = 5.ToString();
  60. SSJAllTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString();
  61. SSJAllTotalTaskPerformance.海情覆盖率 = "0.6".ToString();//"60%"
  62. SSJAllTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
  63. SSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / aircreftCount).ToString();
  64. sIndex++;
  65. }
  66. public void FillData1(List<LandSJRescueMission> missions)
  67. {
  68. double 任务准备时间 = 0;
  69. double 平均搜索时间 = 0;
  70. double 总飞行时间 = 0;
  71. double 人员存活率 = 0;
  72. double 任务是否成功 = 0;
  73. float 识别成功率 = 0f;
  74. double aircreftCount = 0;
  75. foreach (LandSJRescueMission mhRescueMission in missions)
  76. {
  77. //foreach (var aircraft in mhRescueMission.aircrafts)
  78. //{
  79. // if (aircraft.isseePerson)
  80. // 识别成功率 += 1f;
  81. // if (任务准备时间 < aircraft.TaskReadyTime)
  82. // 任务准备时间 = aircraft.TaskReadyTime;
  83. // 平均搜索时间 += aircraft.SearchTime;
  84. // 总飞行时间 += aircraft.TotalTime;
  85. // 人员存活率 += aircraft.Success ? 1 : 0;
  86. // aircreftCount++;
  87. //}
  88. foreach (var item in mhRescueMission.aircraftSJDatas)
  89. {
  90. 识别成功率 += float.Parse(item.Value["识别成功率"][lIndex]);
  91. if (任务准备时间 < float.Parse(item.Value["任务准备时间"][lIndex]))
  92. 任务准备时间 = float.Parse(item.Value["任务准备时间"][lIndex]);
  93. 平均搜索时间 += float.Parse(item.Value["平均搜索时间"][lIndex]);
  94. 总飞行时间 += float.Parse(item.Value["总飞行时间"][lIndex]);
  95. 人员存活率 += float.Parse(item.Value["人员存活率"][lIndex]);
  96. aircreftCount++;
  97. }
  98. }
  99. if (人员存活率 != 0)
  100. 任务是否成功 = 1;
  101. LSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / aircreftCount).ToString();
  102. LSJAllTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
  103. LSJAllTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / aircreftCount).ToString();
  104. LSJAllTotalTaskPerformance.平均救助时间 = 5.ToString();
  105. LSJAllTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString();
  106. LSJAllTotalTaskPerformance.环境覆盖率 = "0.6".ToString();//"60%"
  107. LSJAllTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
  108. LSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / aircreftCount).ToString();
  109. lIndex++;
  110. }
  111. public Dictionary<string, Dictionary<string, string>> GetReport()
  112. {
  113. Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
  114. report["总任务表现"] = new Dictionary<string, string>
  115. {
  116. { "识别成功率", SSJAllTotalTaskPerformance.识别成功率.ToString() },
  117. { "任务准备时间", SSJAllTotalTaskPerformance.任务准备时间.ToString() },
  118. { "平均搜索时间", SSJAllTotalTaskPerformance.平均搜索时间.ToString() },
  119. { "平均救助时间", SSJAllTotalTaskPerformance.平均救助时间.ToString() },
  120. { "总飞行时间", SSJAllTotalTaskPerformance.总飞行时间.ToString() },
  121. { "海情覆盖率", SSJAllTotalTaskPerformance.海情覆盖率.ToString() },
  122. { "任务是否成功", SSJAllTotalTaskPerformance.任务是否成功.ToString() },
  123. { "人员存活率", SSJAllTotalTaskPerformance.人员存活率.ToString() }
  124. };
  125. return report;
  126. }
  127. public Dictionary<string, Dictionary<string, string>> GetReport1()
  128. {
  129. Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
  130. report["总任务表现"] = new Dictionary<string, string>
  131. {
  132. { "识别成功率", LSJAllTotalTaskPerformance.识别成功率.ToString() },
  133. { "任务准备时间", LSJAllTotalTaskPerformance.任务准备时间.ToString() },
  134. { "平均搜索时间", LSJAllTotalTaskPerformance.平均搜索时间.ToString() },
  135. { "平均救助时间", LSJAllTotalTaskPerformance.平均救助时间.ToString() },
  136. { "总飞行时间", LSJAllTotalTaskPerformance.总飞行时间.ToString() },
  137. { "环境覆盖率", LSJAllTotalTaskPerformance.环境覆盖率.ToString() },
  138. { "任务是否成功", LSJAllTotalTaskPerformance.任务是否成功.ToString() },
  139. { "人员存活率", LSJAllTotalTaskPerformance.人员存活率.ToString() }
  140. };
  141. return report;
  142. }
  143. }