SJAllTotalTaskPerformance.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. }
  14. public class SJAllTotalTaskPerformanceComponent
  15. {
  16. public SJAllTotalTaskPerformance SJAllTotalTaskPerformance = new SJAllTotalTaskPerformance();
  17. public int index;
  18. public void FillData(List<SeaSJRescueMission> missions)
  19. {
  20. double 任务准备时间 = 0;
  21. double 平均搜索时间 = 0;
  22. double 总飞行时间 = 0;
  23. double 人员存活率 = 0;
  24. double 任务是否成功 = 0;
  25. float 识别成功率 = 0f;
  26. double aircreftCount = 0;
  27. foreach (SeaSJRescueMission mhRescueMission in missions)
  28. {
  29. //foreach (var aircraft in mhRescueMission.aircrafts)
  30. //{
  31. // if (aircraft.isseePerson)
  32. // 识别成功率 += 1f;
  33. // if (任务准备时间 < aircraft.TaskReadyTime)
  34. // 任务准备时间 = aircraft.TaskReadyTime;
  35. // 平均搜索时间 += aircraft.SearchTime;
  36. // 总飞行时间 += aircraft.TotalTime;
  37. // 人员存活率 += aircraft.Success ? 1 : 0;
  38. // aircreftCount++;
  39. //}
  40. foreach (var item in mhRescueMission.aircraftSJDatas)
  41. {
  42. 识别成功率 += float.Parse(item.Value["识别成功率"][index]);
  43. if (任务准备时间 < float.Parse(item.Value["任务准备时间"][index]))
  44. 任务准备时间 = float.Parse(item.Value["任务准备时间"][index]);
  45. 平均搜索时间 += float.Parse(item.Value["平均搜索时间"][index]);
  46. 总飞行时间 += float.Parse(item.Value["总飞行时间"][index]);
  47. 人员存活率 += float.Parse(item.Value["人员存活率"][index]);
  48. aircreftCount++;
  49. }
  50. }
  51. if (人员存活率 != 0)
  52. 任务是否成功 = 1;
  53. SJAllTotalTaskPerformance.识别成功率 = (识别成功率 / aircreftCount).ToString();
  54. SJAllTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
  55. SJAllTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / aircreftCount).ToString();
  56. SJAllTotalTaskPerformance.平均救助时间 = 5.ToString();
  57. SJAllTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString();
  58. SJAllTotalTaskPerformance.海情覆盖率 = "0.6".ToString();//"60%"
  59. SJAllTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
  60. SJAllTotalTaskPerformance.人员存活率 = (人员存活率 / aircreftCount).ToString();
  61. index++;
  62. }
  63. public Dictionary<string, Dictionary<string, string>> GetReport()
  64. {
  65. Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
  66. report["总任务表现"] = new Dictionary<string, string>
  67. {
  68. { "识别成功率", SJAllTotalTaskPerformance.识别成功率.ToString() },
  69. { "任务准备时间", SJAllTotalTaskPerformance.任务准备时间.ToString() },
  70. { "平均搜索时间", SJAllTotalTaskPerformance.平均搜索时间.ToString() },
  71. { "平均救助时间", SJAllTotalTaskPerformance.平均救助时间.ToString() },
  72. { "总飞行时间", SJAllTotalTaskPerformance.总飞行时间.ToString() },
  73. { "海情覆盖率", SJAllTotalTaskPerformance.海情覆盖率.ToString() },
  74. { "任务是否成功", SJAllTotalTaskPerformance.任务是否成功.ToString() },
  75. { "人员存活率", SJAllTotalTaskPerformance.人员存活率.ToString() }
  76. };
  77. return report;
  78. }
  79. }