123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929 |
- using SimulationCommon;
- namespace Model
- {
- public class FXJHGenerate
- {
- public static void FromStartToMission(FlightPlanEditor editor,ref List<TurningPoint> turningPoints) //生成从基地到任务段起点的航路点
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "爬升",
- TurningPointLongitude = editor.originbase.BaseLongitude, //基地位置
- TurningPointLatitude = editor.originbase.BaseLatitude,
- TurningPointHeight = editor.originbase.BaseHeight,
- TurningPointType = "普通",
- //TurningPointVelocity = editor.climbsegment.ClimbVelocity;
- SegmentFlightFuelConsumption = 1,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- // double k;
- double lat1, lon1; //直升机起飞后爬升到的航路点的经纬度,记为经纬度1
- lat1 = (editor.originbase.BaseLatitude + editor.missionpoint.MissionPointLatitude) / 2;
- lon1 = (editor.originbase.BaseLongitude + editor.missionpoint.MissionPointLongitude) / 2;
-
- // k = (editor.missionpoint.MissionPointLatitude - editor.originbase.BaseLatitude) /
- // (editor.missionpoint.MissionPointLongitude - editor.originbase.BaseLongitude);
- // if (editor.missionpoint.MissionPointLongitude > editor.originbase.BaseLongitude)
- // {
- // lat1 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude; //经验公式
- // lon1 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
- // }
- // else
- // {
- // lat1 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
- // lon1 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
- // }
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "平飞",
- TurningPointLongitude = lon1,
- TurningPointLatitude = lat1,
- TurningPointHeight = 2000,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- //获取油耗率
- public static double GetClimbFuelConsumptionRate(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "爬升", temp.ToString(), height.ToString(),
- editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 1100;
- }
- return fuel.oilconsume;
- }
- public static double GetCruisingFuelConsumptionRate(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "平飞远航", temp.ToString(), height.ToString(),
- editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 600;
- }
- return fuel.oilconsume;
- }
- public static double GetEnduranceFuelConsumptionRate(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "平飞久航", temp.ToString(), height.ToString(),
- editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 600;
- }
- return fuel.oilconsume;
- }
- public static double GetDescentFuelConsumptionRate(FlightPlanEditor editor, double height)
- {
- return 2 * GetCruisingFuelConsumptionRate(editor, height) - GetClimbFuelConsumptionRate(editor, height);
- }
- public static double GetHoverFuelConsumptionRate(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "悬停", temp.ToString(), height.ToString(),
- editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 200;
- }
- return fuel.oilconsume;
- }
- //获取速度值
- public static double GetClimbVelocity(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "爬升", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 60;
- }
- return fuel.speed;
- }
- public static double GetCruisingVelocity(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "平飞远航", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 200;
- }
- return fuel.speed;
- }
- public static double GetEnduranceVelocity(FlightPlanEditor editor, double height)
- {
- double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
- Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
- "平飞久航", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
- if (fuel == null)
- {
- return 200;
- }
- return fuel.speed;
- }
- public static double GetDescentVelocity(FlightPlanEditor editor, double height)
- {
- return GetCruisingVelocity(editor, height) / 2;
- }
- public static void ZhenCha(List<double[]> SC01, FlightPlanEditor editor, ref List<TurningPoint> turningPoints) //侦查模型航路点生成
- {
- int i;
- for (i = 0; i < SC01.Count - 1; i++)
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "平飞",
- TurningPointLongitude = SC01[i][0],
- TurningPointLatitude = SC01[i][1],
- TurningPointHeight = SC01[i][2],
- TurningPointType = "侦查",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- }
- public static void SuoHuaJiang(double resulttime, FlightPlanEditor editor,
- ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "索滑降",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "索滑降",
- SegmentFlightFuelConsumption = 5,
- SegmentFlightTime = resulttime,
- RemainingFuel = 0,
- });
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "索滑降",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "索滑降",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void JIJIU(double resulttime, FlightPlanEditor editor,
- ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "现场急救",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "现场急救",
- SegmentFlightFuelConsumption = 5,
- SegmentFlightTime = resulttime,
- RemainingFuel = 0,
- });
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "现场急救",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "现场急救",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void JIJIU1(double resulttime,MissionEndPoint hospitalPoint,
- ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "现场急救",
- TurningPointLongitude = hospitalPoint.MissionEndPointLongitude,
- TurningPointLatitude = hospitalPoint.MissionEndPointLatitude,
- TurningPointHeight = hospitalPoint.MissionEndPointHeight,
- TurningPointType = "现场急救",
- SegmentFlightFuelConsumption = 0,
- SegmentFlightTime = resulttime,
- RemainingFuel = 0,
- });
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "现场急救",
- TurningPointLongitude = hospitalPoint.MissionEndPointLongitude,
- TurningPointLatitude = hospitalPoint.MissionEndPointLatitude,
- TurningPointHeight = hospitalPoint.MissionEndPointHeight,
- TurningPointType = "现场急救",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = resulttime,
- RemainingFuel = 0,
- });
- }
- public static void XunHu(FlightPlanEditor editor,ref List<TurningPoint> turningPoints)
- {
- int i;
- for (i = 0; i < editor.airroute.Length; i++)
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "平飞",
- TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
- TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
- TurningPointHeight = editor.airroute[i].AirRouteHeight,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- }
- public static void MieHuo1(FlightPlanEditor editor,ref List<TurningPoint> turningPoints) //灭火任务从取水点到火场部分的航路点生成
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "取水",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "取水",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 120,
- RemainingFuel = 0,
- });
-
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "洒水",
- TurningPointLongitude = editor.firepoint[0].FirePointLongitude,
- TurningPointLatitude = editor.firepoint[0].FirePointLatitude,
- TurningPointHeight = editor.firepoint[0].FirePointHeight,
- TurningPointType = "巡航",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static MissionEndPoint ZhenChaMissionEndPoint(List<double[]> SC01) //侦查模型任务终点生成
- {
- MissionEndPoint missionEndPoint = new();
- int length = SC01.Count - 1;
- missionEndPoint.MissionEndPointLongitude = SC01[length][0];
- missionEndPoint.MissionEndPointLatitude = SC01[length][1];
- missionEndPoint.MissionEndPointHeight = SC01[length][2];
- return missionEndPoint;
- }
- public static MissionEndPoint SuoHuaJiangMissionEndPoint(FlightPlanEditor editor) //索滑降模型任务终点生成
- {
- MissionEndPoint missionEndPoint = new();
- missionEndPoint.MissionEndPointLongitude = editor.missionpoint.MissionPointLongitude;
- missionEndPoint.MissionEndPointLatitude = editor.missionpoint.MissionPointLatitude;
- missionEndPoint.MissionEndPointHeight = editor.missionpoint.MissionPointHeight;
- return missionEndPoint;
- }
- public static void JijiangMiehuo1(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void JijiangMiehuo(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.originbase.BaseLongitude,
- TurningPointLatitude = editor.originbase.BaseLatitude,
- TurningPointHeight = editor.originbase.BaseHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
-
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void KouTouKouSong(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void KouTouKouSong1(MissionPoint missionpoint, ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = missionpoint.MissionPointLongitude,
- TurningPointLatitude = missionpoint.MissionPointLatitude,
- TurningPointHeight = missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void JijiangJiuYuan1(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 600,
- RemainingFuel = 0,
- });
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void JijiangJiuYuan(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.originbase.BaseLongitude,
- TurningPointLatitude = editor.originbase.BaseLatitude,
- TurningPointHeight = editor.originbase.BaseHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 600,
- RemainingFuel = 0,
- });
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
- TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
- TurningPointHeight = editor.missionpoint.MissionPointHeight,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 2,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- public static void ZhaoShuiJiuYuan(List<AirRoute> airRoutes, ref List<TurningPoint> turningPoint)
- {
- for (int i = 0;i < airRoutes.Count; i++)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = airRoutes[i].AirRouteLongitude,
- TurningPointLatitude = airRoutes[i].AirRouteLatitude,
- TurningPointHeight = 1000,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- }
- public static void ZhaoShuiJiuYuan1(List<AirRoute> airRoutes, ref List<TurningPoint> turningPoint)
- {
- turningPoint.Add(new TurningPoint
- {
- TurningPointName = "转运",
- TurningPointLongitude = airRoutes[airRoutes.Count - 1].AirRouteLongitude,
- TurningPointLatitude = airRoutes[airRoutes.Count - 1].AirRouteLatitude,
- TurningPointHeight = 1000,
- TurningPointType = "转运",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 1800,
- RemainingFuel = 0,
- });
- }
- public static void SeaSouJiu(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
- {
- int i;
- for (i = 0; i < editor.airroute.Length; i++)
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "巡航",
- TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
- TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
- TurningPointHeight = 150,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- }
- public static void SeaSouJiu2(FlightPlanEditor editor, MissionPoint missionPoint, ref List<TurningPoint> turningPoints)
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "巡航",
- TurningPointLongitude = missionPoint.MissionPointLongitude,
- TurningPointLatitude = missionPoint.MissionPointLatitude,
- TurningPointHeight = 0,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
-
- public static void LandSouJiu(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
- {
- int i;
- for (i = 0; i < editor.airroute.Length; i++)
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "巡航",
- TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
- TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
- TurningPointHeight = editor.airroute[i].AirRouteHeight,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
- }
- public static void FromMissionToEnd(FlightPlanEditor editor, MissionEndPoint missionEndPoint, ref List<TurningPoint> turningPoints) //生成从任务段终点到基地的航路点
- {
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "平飞",
- TurningPointLongitude = missionEndPoint.MissionEndPointLongitude,
- TurningPointLatitude = missionEndPoint.MissionEndPointLatitude,
- TurningPointHeight = missionEndPoint.MissionEndPointHeight,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 3,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
-
- //double k;
- double lat2, lon2;
- lat2 = (turningPoints[^1].TurningPointLatitude + editor.originbase.BaseLatitude) / 2;
- lon2 = (turningPoints[^1].TurningPointLongitude + editor.originbase.BaseLongitude) / 2;
- // k = (turningPoints[^1].TurningPointLatitude - editor.originbase.BaseLatitude) /
- // (turningPoints[^1].TurningPointLongitude - editor.originbase.BaseLongitude);
- // if (turningPoints[^1].TurningPointLongitude > editor.originbase.BaseLongitude)
- // {
- // lat2 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude;
- // lon2 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
- // }
- // else
- // {
- // lat2 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
- // lon2 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
- // }
- turningPoints.Add(new TurningPoint
- {
- TurningPointName = "降高",
- TurningPointLongitude = lon2,
- TurningPointLatitude = lat2,
- TurningPointHeight = 2000,
- TurningPointType = "普通",
- SegmentFlightFuelConsumption = 4,
- SegmentFlightTime = 0,
- RemainingFuel = 0,
- });
- }
-
- public static void InitializeVelocities(FlightPlanEditor editor,List<TurningPoint> turningPoints, ref double[] velocitys)
- {
- velocitys[0] = GetClimbVelocity(editor, turningPoints[0].TurningPointHeight);
- velocitys[1] = GetCruisingVelocity(editor, turningPoints[1].TurningPointHeight);
- velocitys[2] = GetEnduranceVelocity(editor, turningPoints[2].TurningPointHeight);
- velocitys[3] = GetDescentVelocity(editor, turningPoints[0].TurningPointHeight);
- }
-
-
- public static void InitializeFuelConsumptions(FlightPlanEditor editor, List<TurningPoint> turningPoints, ref double[] fuelConsumptions)
- {
- fuelConsumptions[0] = GetClimbFuelConsumptionRate(editor, turningPoints[0].TurningPointHeight);
- fuelConsumptions[1] = GetCruisingFuelConsumptionRate(editor, turningPoints[1].TurningPointHeight);
- fuelConsumptions[2] = GetEnduranceFuelConsumptionRate(editor, turningPoints[2].TurningPointHeight);
- fuelConsumptions[3] = GetDescentFuelConsumptionRate(editor, turningPoints[0].TurningPointHeight);
- fuelConsumptions[4] = GetHoverFuelConsumptionRate(editor, turningPoints[2].TurningPointHeight);
- }
- public static void FXJHTPDiedai(FlightPlanEditor editor,ref List<TurningPoint> turningPoints,double[] velocitys, double[] fuelConsumptions) //各航段飞行时间、油耗计算和航路点油耗迭代
- {
-
- int i;
- double DEG_TO_RAD_LOCAL = 3.1415926535897932 / 180;
- double[] x = new double[turningPoints.Count];
- double[] y = new double[turningPoints.Count];
- double[] z = new double[turningPoints.Count];
- for (i = 0; i < turningPoints.Count; i++) //LLA坐标转换为ECEF坐标
- {
- double lon = turningPoints[i].TurningPointLongitude * DEG_TO_RAD_LOCAL;
- double lat = turningPoints[i].TurningPointLatitude * DEG_TO_RAD_LOCAL;
- double hei = turningPoints[i].TurningPointHeight;
- double a = 6378137.0;
- double b = 6356752.31424518;
- double N = a / (Math.Sqrt(1 - ((a * a - b * b) / (a * a)) * Math.Sin(lat) * Math.Sin(lat)));
- x[i] = (N + hei) * Math.Cos(lat) * Math.Cos(lon);
- y[i] = (N + hei) * Math.Cos(lat) * Math.Sin(lon);
- z[i] = ((b * b * N) / (a * a) + hei) * Math.Sin(lat);
- }
- for (i = 0; i < turningPoints.Count; i++)
- {
- if (turningPoints[i].SegmentFlightTime == 0)
- {
- double distanceab;
- if (i != turningPoints.Count - 1)
- {
- distanceab = Math.Sqrt(Math.Pow(x[i] - x[i + 1], 2) + Math.Pow(y[i] - y[i + 1], 2) +
- Math.Pow(z[i] - z[i + 1], 2));
- }
- else
- {
- distanceab = Math.Sqrt(Math.Pow(x[i] - x[0], 2) + Math.Pow(y[i] - y[0], 2) +
- Math.Pow(z[i] - z[0], 2));
- }
- double velocity;
- // 根据飞行段类型选择不同的燃油消耗率计算函数
- switch (turningPoints[i].SegmentFlightFuelConsumption)
- {
- case 1:
- velocity = velocitys[0];
- break;
- case 2:
- velocity = velocitys[1];
- break;
- case 3:
- velocity = velocitys[2];
- break;
- case 4:
- velocity = velocitys[3];
- break;
- case 5:
- velocity = 0;
- break;
- default:
- velocity = 0;
- break;
- }
- // 使用计算得到的速度计算飞行时间
- turningPoints[i].SegmentFlightTime = CalculateSegmentFlightTime(distanceab, velocity);
- double CalculateSegmentFlightTime(double distance, double velocity)
- {
- return distance * 3.6 / velocity; // 根据速度计算飞行时间
- }
- }
- else
- {
- turningPoints[i].SegmentFlightTime = turningPoints[i].SegmentFlightTime;
- }
- }
- for (i = 0; i < turningPoints.Count; i++)
- {
- double remainingFuel;
- if (i == 0)
- {
- remainingFuel = editor.aircraftparameter.MaxFuelCapacity * 0.8;
- }
- else
- {
- remainingFuel = turningPoints[i - 1].RemainingFuel;
- }
- double fuelConsumption = 0;
- // 根据飞行段类型选择不同的燃油消耗率计算函数,1代表爬升,2代表平飞远航,3代表平飞久航,4代表下降,5代表悬停
- switch (turningPoints[i].SegmentFlightFuelConsumption)
- {
- case 1:
- fuelConsumption = fuelConsumptions[0];
- break;
- case 2:
- fuelConsumption = fuelConsumptions[1];
- break;
- case 3:
- fuelConsumption = fuelConsumptions[2];
- break;
- case 4:
- fuelConsumption = fuelConsumptions[3];
- break;
- case 5:
- fuelConsumption = fuelConsumptions[4];
- break;
- }
- remainingFuel -= fuelConsumption * turningPoints[i].SegmentFlightTime / 3600; // 更新剩余燃油
- if (remainingFuel < 0)
- {
- remainingFuel = 0;
- break;
- }
- turningPoints[i].RemainingFuel = remainingFuel;
- }
- }
- public static void CalculateTrueHeading(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
- {
- for (int i = 0; i < turningPoints.Count - 1; i++)
- {
- // 转换为弧度
- double lat1Rad = turningPoints[i].TurningPointLatitude * Math.PI / 180;
- double lon1Rad = turningPoints[i].TurningPointLongitude * Math.PI / 180;
- double lat2Rad = turningPoints[i + 1].TurningPointLatitude * Math.PI / 180;
- double lon2Rad = turningPoints[i + 1].TurningPointLongitude * Math.PI / 180;
- double deltaLon = lon2Rad - lon1Rad;
- double x = Math.Sin(deltaLon) * Math.Cos(lat2Rad);
- double y = Math.Cos(lat1Rad) * Math.Sin(lat2Rad) - Math.Sin(lat1Rad) * Math.Cos(lat2Rad) * Math.Cos(deltaLon);
- // 计算航向角
- double headingRad = Math.Atan2(x, y);
- // 转换为度并标准化
- double headingDeg = headingRad * 180 / Math.PI;
- headingDeg = (headingDeg + 360) % 360;
- turningPoints[i].HeadingAngle = headingDeg;
- }
- }
- /// <summary>
- /// 巡护用
- /// </summary>
- /// <param name="turningPoints"></param>
- /// <param name="editor"></param>
- /// <param name="nowtime"></param>
- /// <returns></returns>
- public static (CurrentLocation, bool) GetCurrentLocation(List<TurningPoint> turningPoints, FlightPlanEditor editor,
- double nowtime)
- {
- CurrentLocation currentLocation = new CurrentLocation();
- double[] timetable = new double[editor.airroute.Length + 2]; //airroute.Length表示巡护航线中有几个航路点
- timetable[0] = 0; //设起飞时刻为0
- int segmentnumber = -1;
- int i;
- for (i = 0; i < editor.airroute.Length + 1; i++)
- {
- timetable[i + 1] = timetable[i] + turningPoints[i].SegmentFlightTime;
- }
- for (i = 0; i < editor.airroute.Length + 2; i++)
- {
- if ((nowtime - timetable[i]) >= 0)
- {
- segmentnumber += 1;
- }
- else
- {
- break;
- }
- }
- bool isEnd = false || segmentnumber >= turningPoints.Count;
- currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
- (turningPoints[segmentnumber + 1].TurningPointLongitude -
- turningPoints[segmentnumber].TurningPointLongitude) *
- (nowtime - timetable[segmentnumber]) /
- turningPoints[segmentnumber].SegmentFlightTime;
- currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
- (turningPoints[segmentnumber + 1].TurningPointLatitude -
- turningPoints[segmentnumber].TurningPointLatitude) *
- (nowtime - timetable[segmentnumber]) /
- turningPoints[segmentnumber].SegmentFlightTime;
- currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
- (turningPoints[segmentnumber + 1].TurningPointHeight -
- turningPoints[segmentnumber].TurningPointHeight) *
- (nowtime - timetable[segmentnumber]) /
- turningPoints[segmentnumber].SegmentFlightTime;
- currentLocation.CurrentFuel = 0;
- currentLocation.Currentvelo = 0;
- currentLocation.Currentsegnum = segmentnumber + 1;
- currentLocation.CurrentCourse = 75;
- return (currentLocation, isEnd);
- }
- //改
- /// <summary>
- /// 计算当前位置
- /// </summary>
- /// <param name="FXJHTP"></param>
- /// <param name="FXJHTPLength"></param>
- /// <param name="nowtime"></param>
- /// <returns></returns>
- public static (CurrentLocation, bool) GetAllCurrentLocation(List<TurningPoint> turningPoints, double nowtime) //飞机实时位置打印
- {
- CurrentLocation currentLocation = new CurrentLocation();
- double[] timetable = new double[turningPoints.Count + 1];
- timetable[0] = 0;
- int segmentnumber = -1;
- int i;
- for (i = 0; i < turningPoints.Count; i++)
- {
- timetable[i + 1] = timetable[i] + turningPoints[i].SegmentFlightTime;
- }
- for (i = 0; i < turningPoints.Count + 1; i++)
- {
- if ((nowtime - timetable[i]) >= 0)
- {
- segmentnumber += 1;
- }
- else
- {
- break;
- }
- }
-
- bool isEnd = false || segmentnumber >= turningPoints.Count;
- currentLocation.Currentsegnum = segmentnumber;
- if (segmentnumber < turningPoints.Count - 1)
- {
- currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
- ((turningPoints[segmentnumber + 1].TurningPointLongitude -
- turningPoints[segmentnumber].TurningPointLongitude) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
- ((turningPoints[segmentnumber + 1].TurningPointLatitude -
- turningPoints[segmentnumber].TurningPointLatitude) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
- ((turningPoints[segmentnumber + 1].TurningPointHeight -
- turningPoints[segmentnumber].TurningPointHeight) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
- turningPoints[segmentnumber].SegmentFlightFuelConsumption *
- (nowtime - timetable[segmentnumber]);
- currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
- }
- else if (segmentnumber == turningPoints.Count - 1)
- {
- currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
- ((turningPoints[0].TurningPointLongitude -
- turningPoints[segmentnumber].TurningPointLongitude) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
- ((turningPoints[0].TurningPointLatitude -
- turningPoints[segmentnumber].TurningPointLatitude) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
- ((turningPoints[0].TurningPointHeight -
- turningPoints[segmentnumber].TurningPointHeight) /
- turningPoints[segmentnumber].SegmentFlightTime) *
- (nowtime - timetable[segmentnumber]);
- currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
- turningPoints[segmentnumber].SegmentFlightFuelConsumption *
- (nowtime - timetable[segmentnumber]);
- currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
- }
- else
- {
- currentLocation.CurrentLon = turningPoints[^1].TurningPointLongitude;
- currentLocation.CurrentLat = turningPoints[^1].TurningPointLatitude;
- currentLocation.CurrentHei = turningPoints[^1].TurningPointHeight;
- currentLocation.Currentvelo = 0;
- currentLocation.CurrentFuel = turningPoints[segmentnumber - 1].RemainingFuel -
- turningPoints[segmentnumber - 1].SegmentFlightFuelConsumption *
- turningPoints[segmentnumber - 1].SegmentFlightTime;
- currentLocation.PresentMission = turningPoints[segmentnumber - 1].TurningPointName;
-
- isEnd = true;
- }
- return (currentLocation,isEnd);
- }
- }
- }
|