AircraftYLWPYS.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using KYFramework;
  2. using MathNet.Numerics.Distributions;
  3. using Model;
  4. using MongoDB.Bson;
  5. using SimulationCommon;
  6. using SimulationServer.Utils;
  7. namespace SimulationServer;
  8. public class AircraftYLWPYS : AircraftEntity
  9. {
  10. public YLWPYSTask taskContent;
  11. public MissionEndPoint MissionEndPoint;
  12. public bool IsOver;
  13. public bool Success;
  14. public TaskParameter taskParameter;
  15. public Dictionary<string, string> reportInfo = new Dictionary<string, string>();
  16. public List<string> load = new List<string>();
  17. public string device;
  18. public string medicine;
  19. public override void End()
  20. {
  21. TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
  22. }
  23. public override void Reset()
  24. {
  25. base.Reset();
  26. IsOver = false;
  27. Success = false;
  28. TotalTime = 0;
  29. reportInfo = new Dictionary<string, string>();
  30. device = string.Empty;
  31. medicine = string.Empty;
  32. }
  33. public override void Start()
  34. {
  35. FlightPlanEditor.missionpoint.MissionPointLatitude = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointLatitude;
  36. FlightPlanEditor.missionpoint.MissionPointLongitude = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointLongitude;
  37. FlightPlanEditor.missionpoint.MissionPointHeight = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointHeight;
  38. //Console.WriteLine("Latitude:" + FlightPlanEditor.missionpoint.MissionPointLatitude + "_" + "Longitude:" + FlightPlanEditor.missionpoint.MissionPointLongitude + "_" + "Height:" + FlightPlanEditor.missionpoint.MissionPointHeight);
  39. FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
  40. FXJHGenerate.JIJIU(5 * 60, FlightPlanEditor, ref TurningPoints);
  41. MissionEndPoint hospitalPoint = new MissionEndPoint()
  42. {
  43. MissionEndPointLongitude = FlightPlanEditor.missionpoint.MissionPointLongitude,
  44. MissionEndPointLatitude = FlightPlanEditor.missionpoint.MissionPointLatitude,
  45. MissionEndPointHeight = FlightPlanEditor.missionpoint.MissionPointHeight
  46. };
  47. FXJHGenerate.FromMissionToEnd(FlightPlanEditor, hospitalPoint, ref TurningPoints);
  48. FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions);
  49. for (int i = 0; i < TurningPoints.Count; i++) // 总飞行时间
  50. {
  51. TotalTime += TurningPoints[i].SegmentFlightTime; // 总时间 //仿真轮次1 数值1
  52. }
  53. Console.WriteLine("TotalTime:" + TotalTime);
  54. reportInfo.Add("准备时间", TaskReadyTime.ToString());
  55. double reachTime = 0;
  56. for (int i = 0; i < 2; i++)
  57. {
  58. reachTime += TurningPoints[i].SegmentFlightTime;
  59. }
  60. reportInfo.Add("到达时间", reachTime.ToString());
  61. reportInfo.Add("任务周期时间", TotalTime.ToString());
  62. reportInfo.Add("执行任务飞机型号", Name);
  63. reportInfo.Add("执行任务飞机数量", "1");
  64. reportInfo.Add("单机操作员人数", taskParameter.operatorPersonnel.ToString());
  65. reportInfo.Add("单机地面保障人数", taskParameter.groundSupportPersonnel.ToString());
  66. reportInfo.Add("单机总任务时长", TotalTime.ToString());
  67. reportInfo.Add("单机总油耗", FXJHGenerate.CalculateTotalFuelConsumption(FlightPlanEditor, TurningPoints).ToString());
  68. double zhc = 0;
  69. for (int i = 0; i < TurningPoints.Count - 1; i++)
  70. {
  71. zhc += Utils.Util.GetDistance(TurningPoints[i].TurningPointLongitude,
  72. TurningPoints[i + 1].TurningPointLongitude, TurningPoints[i].TurningPointLatitude, TurningPoints[i + 1].TurningPointLatitude);
  73. }
  74. reportInfo.Add("单机导航使用情况", zhc.ToString());
  75. for (int i = 0; i < load.Count; i++)
  76. {
  77. if (load[i].Split(":")[0].Contains("装备"))
  78. {
  79. device += load[i].Split(":")[1];
  80. if (i != load.Count - 1)
  81. {
  82. device += "\r\n";
  83. }
  84. }
  85. else if (load[i].Split(":")[0].Contains("药品"))
  86. {
  87. medicine += load[i].Split(":")[1] + "\r\n";
  88. if (i != load.Count - 1)
  89. {
  90. medicine += "\r\n";
  91. }
  92. }
  93. }
  94. if (device != null)
  95. reportInfo.Add("医疗任务设备", device);
  96. else
  97. reportInfo.Add("医疗任务设备", "");
  98. if (medicine != null)
  99. reportInfo.Add("医疗药品", medicine);
  100. else
  101. reportInfo.Add("医疗药品", "");
  102. IsOver = true;
  103. End();
  104. }
  105. public string TargetQiXiangInfoSave(string s, int hour)
  106. {
  107. string result = hour.ToString() + "-" + s;
  108. for (int i = 0; i < FlightPlanEditor.medicalTargetPoint[0].TargetQiXiangInfos.Length; i++)
  109. {
  110. }
  111. switch (s)
  112. {
  113. case "温度":
  114. break;
  115. case "湿度":
  116. break;
  117. case "能见度":
  118. break;
  119. case "风速":
  120. break;
  121. case "风向":
  122. break;
  123. case "天气":
  124. break;
  125. }
  126. return result;
  127. }
  128. }
  129. [ObjectSystem]
  130. public class AircraftYLWPYSAwakeSystem : AwakeSystem<AircraftYLWPYS, FlightPlanEditor>
  131. {
  132. public override void Awake(AircraftYLWPYS self, FlightPlanEditor flightPlanEditor)
  133. {
  134. self.FlightPlanEditor = flightPlanEditor;
  135. self.Awake();
  136. }
  137. }