AircraftYLWPYS.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 override void End()
  17. {
  18. TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
  19. }
  20. public override void Reset()
  21. {
  22. base.Reset();
  23. IsOver = false;
  24. Success = false;
  25. TotalTime = 0;
  26. reportInfo = new Dictionary<string, string>();
  27. }
  28. public override void Start()
  29. {
  30. FlightPlanEditor.missionpoint.MissionPointLatitude = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointLatitude;
  31. FlightPlanEditor.missionpoint.MissionPointLongitude = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointLongitude;
  32. FlightPlanEditor.missionpoint.MissionPointHeight = FlightPlanEditor.medicalSuppliesInfo[0].TargetPointHeight;
  33. Console.WriteLine("Latitude:" + FlightPlanEditor.missionpoint.MissionPointLatitude + "_" + "Longitude:" + FlightPlanEditor.missionpoint.MissionPointLongitude + "_" + "Height:" + FlightPlanEditor.missionpoint.MissionPointHeight);
  34. FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
  35. FXJHGenerate.JIJIU(5 * 60, FlightPlanEditor, ref TurningPoints);
  36. MissionEndPoint hospitalPoint = new MissionEndPoint()
  37. {
  38. MissionEndPointLongitude = FlightPlanEditor.missionpoint.MissionPointLongitude,
  39. MissionEndPointLatitude = FlightPlanEditor.missionpoint.MissionPointLatitude,
  40. MissionEndPointHeight = FlightPlanEditor.missionpoint.MissionPointHeight
  41. };
  42. FXJHGenerate.FromMissionToEnd(FlightPlanEditor, hospitalPoint, ref TurningPoints);
  43. FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions);
  44. for (int i = 0; i < TurningPoints.Count; i++) // 总飞行时间
  45. {
  46. TotalTime += TurningPoints[i].SegmentFlightTime; // 总时间 //仿真轮次1 数值1
  47. }
  48. Console.WriteLine("TotalTime:" + TotalTime);
  49. reportInfo.Add("准备时间", TaskReadyTime.ToString());
  50. double reachTime = 0;
  51. for (int i = 2; i < 4; i++)
  52. {
  53. reachTime += TurningPoints[i].SegmentFlightTime;
  54. }
  55. reportInfo.Add("到达时间", TaskReadyTime.ToString());
  56. reportInfo.Add("任务周期时间", TotalTime.ToString());
  57. reportInfo.Add("执行任务飞机型号", Name);
  58. reportInfo.Add("执行任务飞机数量", "1");
  59. reportInfo.Add("单机操作员人数", taskParameter.operatorPersonnel.ToString());
  60. reportInfo.Add("单机地面保障人数", taskParameter.groundSupportPersonnel.ToString());
  61. reportInfo.Add("单机总任务时长", TotalTime.ToString());
  62. IsOver = true;
  63. End();
  64. }
  65. public string TargetQiXiangInfoSave(string s, int hour)
  66. {
  67. string result = hour.ToString() + "-" + s;
  68. for (int i = 0; i < FlightPlanEditor.medicalTargetPoint[0].TargetQiXiangInfos.Length; i++)
  69. {
  70. }
  71. switch (s)
  72. {
  73. case "温度":
  74. break;
  75. case "湿度":
  76. break;
  77. case "能见度":
  78. break;
  79. case "风速":
  80. break;
  81. case "风向":
  82. break;
  83. case "天气":
  84. break;
  85. }
  86. return result;
  87. }
  88. }
  89. [ObjectSystem]
  90. public class AircraftYLWPYSAwakeSystem : AwakeSystem<AircraftYLWPYS, FlightPlanEditor>
  91. {
  92. public override void Awake(AircraftYLWPYS self, FlightPlanEditor flightPlanEditor)
  93. {
  94. self.FlightPlanEditor = flightPlanEditor;
  95. self.Awake();
  96. }
  97. }