123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- using KYFramework;
- using Model;
- using MongoDB.Bson;
- namespace SimulationServer;
- public class AircraftSHJ : AircraftEntity
- {
- public SHJTask content;
- public TaskParameter SHJParameter;
- public MissionEndPoint missionEndPoint;
- public bool IsOver;
- public bool Success;
- public double resulttime;
- 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 = missionEndPoint.MissionEndPointLatitude;
- FlightPlanEditor.missionpoint.MissionPointLongitude = missionEndPoint.MissionEndPointLongitude;
- FlightPlanEditor.missionpoint.MissionPointHeight = missionEndPoint.MissionEndPointHeight;
- int hour = Convert.ToInt32(content.missionInformation.StartTime.Split("时")[0]);
- //Console.WriteLine("hour:" + hour);
- double windSpeed = Convert.ToDouble(TargetQiXiangInfoSave("风速", hour));
- //Console.WriteLine("windSpeed:" + windSpeed);
- double vis = Convert.ToDouble(TargetQiXiangInfoSave("能见度", hour));
- //Console.WriteLine("vis:" + vis);
- FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
- resulttime = get_result_time_rope(SHJParameter.H, SHJParameter.person_number, windSpeed, vis, SHJParameter.descendspeed).time;//索滑降模型输出的索滑降时间
- Console.WriteLine("resulttime:" + resulttime);
- FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor, ref TurningPoints);
- FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor), 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();
- }
- // --接口
- // --输入
- // --
- // 1)索降高度(m)
- //--H(double)
- // 2)索降人数
- //--person_number(int)
- // 3)风速(m/s)
- // --windspeed(double)
- // 4)能见度(m/)
- //--vis(double)
- // 5)索降速度(m/s)
- // --descendspeed(double)
- // --
- // --输出
- // --
- // 1)能否索降、索降时间
- //--result(Cable_result)
- // --
- //--定义Cable_result类
- // 绳索滑降函数
- public Cable_result get_result_time_rope(double H, int person_number, double windspeed, double vis, double descendspeed)
- {
- // descendspeed < 8 m/s
- Cable_result result = new Cable_result();
- if (windspeed < 8 && vis > 3)
- {
- result.time = (person_number * H) / descendspeed;
- result.success = true;
- }
- else
- {
- result.success = false;
- }
- return result;
- }
- public string TargetQiXiangInfoSave(string s, int hour)
- {
- string result = hour.ToString() + "-" + s;
- switch (s)
- {
- case "温度":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Temperature_00_08.ToString();
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Temperature_08_19.ToString();
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Temperature_19_24.ToString();
- break;
- case "湿度":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Humidity_00_08.ToString();
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Humidity_08_19.ToString();
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Humidity_19_24.ToString();
- break;
- case "能见度":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Visibility_00_08.ToString();
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Visibility_08_19.ToString();
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Visibility_19_24.ToString();
- break;
- case "风速":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindSpeed_00_08.ToString();
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindSpeed_08_19.ToString();
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindSpeed_19_24.ToString();
- break;
- case "风向":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindDirection_00_08.ToString();
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindDirection_08_19.ToString();
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.WindDirection_19_24.ToString();
- break;
- case "天气":
- if (hour >= 0 && hour < 8)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Weather_00_08;
- else if (hour >= 8 && hour < 19)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Weather_08_19;
- else if (hour >= 19 && hour <= 24)
- result = FlightPlanEditor.targetpoint[0].TargetQiXiangInfo.Weather_19_24;
- break;
- }
- return result;
- }
- }
- public class Cable_result
- {
- public bool success { get; set; }
- public double time { get; set; }
- }
- [ObjectSystem]
- public class AircraftSHJAwakeSystem : AwakeSystem<AircraftSHJ, FlightPlanEditor>
- {
- public override void Awake(AircraftSHJ self, FlightPlanEditor flightPlanEditor)
- {
- self.FlightPlanEditor = flightPlanEditor;
- self.Awake();
- }
- }
|