123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- using KYFramework;
- using Model;
- using SimulationServer.Utils;
- using Define = SimulationServer.Utils.Define;
- namespace SimulationServer;
- public class AircraftJJ : AircraftEntity
- {
- public string NextMissionId; // 下一个任务ID
- public MissionEndPoint missionEndPoint = new MissionEndPoint();
- public int LandingPersonnel; //personCount
- public MHRescueMission mhRescueMission;
- public int landingPoint = 0; // 任务文件获取
- public JJJYTask taskContent;
- public TaskParameter taskParameter;
- public RescueDemandInfo rescueDemandInfo;
- public bool IsOver;
- public bool Success;
- public override void End()
- {
- TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
- }
- public override void Reset()
- {
- base.Reset();
- IsOver = false;
- Success = false;
- TotalTime = 0;
- }
- public override void Start()
- {
- FlightPlanEditor.missionpoint.MissionPointLatitude = rescueDemandInfo.TargetPointLatitude;
- FlightPlanEditor.missionpoint.MissionPointLongitude = rescueDemandInfo.TargetPointLongitude;
- FlightPlanEditor.missionpoint.MissionPointHeight = rescueDemandInfo.TargetPointHeight;
- missionEndPoint.MissionEndPointLatitude = FlightPlanEditor.missionpoint.MissionPointLatitude;
- missionEndPoint.MissionEndPointLongitude = FlightPlanEditor.missionpoint.MissionPointLongitude;
- missionEndPoint.MissionEndPointHeight = FlightPlanEditor.missionpoint.MissionPointHeight;
- FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
- int TransportNumber = (int)Math.Ceiling(taskParameter.LandingPersonnel / FlightPlanEditor.aircraftparameter.MaxPassengerNumber);
- int j = 0;
- for (int i = 0; i < TransportNumber; i++)
- {
- if (i == 0)
- {
- FXJHGenerate.JijiangJiuYuan1(FlightPlanEditor, ref TurningPoints);
- }
- else
- {
- FXJHGenerate.JijiangJiuYuan(FlightPlanEditor, ref TurningPoints);
- j += 2;
- }
- }
- // FXJHGenerate.InitializeVelocities(FlightPlanEditor, TurningPoints, ref Velocitys);
- // FXJHGenerate.InitializeFuelConsumptions(FlightPlanEditor, TurningPoints,ref FuelConsumptions);
- FXJHGenerate.FromMissionToEnd(FlightPlanEditor, missionEndPoint, ref TurningPoints);
- FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions); // 更新了 计算油耗的方法
- for (int i = 0; i < TurningPoints.Count; i++) // 总飞行时间
- {
- TotalTime += TurningPoints[i].SegmentFlightTime; // 总时间 //仿真轮次1 数值1
- //Console.WriteLine("TotalTime:" + TotalTime);
- }
- Console.WriteLine("TotalTime:" + TotalTime);
- IsOver = true;
- //Success = true; //需要判断
- End();
- }
- //private double GetDistance(double lon1, double lon2, double lat1, double lat2)
- //{
- // double R = 6371; // 地球的半径(公里)
- // double dLat = (lat2 - lat1) * Math.PI / 180.0;
- // double dLon = (lon2 - lon1) * Math.PI / 180.0;
- // double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
- // Math.Cos(lat1 * Math.PI / 180.0) * Math.Cos(lat2 * Math.PI / 180.0) *
- // Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
- // double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
- // double distance = R * c;
- // return distance;
- //}
- public override void Update(double time)
- {
- }
- }
- [ObjectSystem]
- public class AircraftJJAwakeSystem : AwakeSystem<AircraftJJ, FlightPlanEditor>
- {
- public override void Awake(AircraftJJ self, FlightPlanEditor flightPlanEditor)
- {
- self.FlightPlanEditor = flightPlanEditor;
- self.Awake();
- }
- }
|