AircraftYLWPYS.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 = 2; i < 4; 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("单机总油耗", "60"); // ?
  68. reportInfo.Add("单机导航使用情况", "1000"); //飞行总距离 ?
  69. for (int i = 0; i < load.Count; i++)
  70. {
  71. if (load[i].Split(":")[0].Contains("装备"))
  72. {
  73. device += load[i].Split(":")[1];
  74. if (i != load.Count - 1)
  75. {
  76. device += "\r\n";
  77. }
  78. }
  79. else if (load[i].Split(":")[0].Contains("药品"))
  80. {
  81. medicine += load[i].Split(":")[1] + "\r\n";
  82. if (i != load.Count - 1)
  83. {
  84. medicine += "\r\n";
  85. }
  86. }
  87. }
  88. if (device != null)
  89. reportInfo.Add("医疗任务设备", device);
  90. else
  91. reportInfo.Add("医疗任务设备", "");
  92. if (medicine != null)
  93. reportInfo.Add("医疗药品", medicine);
  94. else
  95. reportInfo.Add("医疗药品", "");
  96. IsOver = true;
  97. End();
  98. }
  99. public string TargetQiXiangInfoSave(string s, int hour)
  100. {
  101. string result = hour.ToString() + "-" + s;
  102. for (int i = 0; i < FlightPlanEditor.medicalTargetPoint[0].TargetQiXiangInfos.Length; i++)
  103. {
  104. }
  105. switch (s)
  106. {
  107. case "温度":
  108. break;
  109. case "湿度":
  110. break;
  111. case "能见度":
  112. break;
  113. case "风速":
  114. break;
  115. case "风向":
  116. break;
  117. case "天气":
  118. break;
  119. }
  120. return result;
  121. }
  122. }
  123. [ObjectSystem]
  124. public class AircraftYLWPYSAwakeSystem : AwakeSystem<AircraftYLWPYS, FlightPlanEditor>
  125. {
  126. public override void Awake(AircraftYLWPYS self, FlightPlanEditor flightPlanEditor)
  127. {
  128. self.FlightPlanEditor = flightPlanEditor;
  129. self.Awake();
  130. }
  131. }