FXJHGenenrate.cs 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. using SimulationCommon;
  2. namespace Model
  3. {
  4. public class FXJHGenerate
  5. {
  6. public static void FromStartToMission(FlightPlanEditor editor,ref List<TurningPoint> turningPoints) //生成从基地到任务段起点的航路点
  7. {
  8. turningPoints.Add(new TurningPoint
  9. {
  10. TurningPointName = "爬升",
  11. TurningPointLongitude = editor.originbase.BaseLongitude, //基地位置
  12. TurningPointLatitude = editor.originbase.BaseLatitude,
  13. TurningPointHeight = editor.originbase.BaseHeight,
  14. TurningPointType = "普通",
  15. //TurningPointVelocity = editor.climbsegment.ClimbVelocity;
  16. SegmentFlightFuelConsumption = 1,
  17. SegmentFlightTime = 0,
  18. RemainingFuel = 0,
  19. });
  20. // double k;
  21. double lat1, lon1; //直升机起飞后爬升到的航路点的经纬度,记为经纬度1
  22. lat1 = (editor.originbase.BaseLatitude + editor.missionpoint.MissionPointLatitude) / 2;
  23. lon1 = (editor.originbase.BaseLongitude + editor.missionpoint.MissionPointLongitude) / 2;
  24. // k = (editor.missionpoint.MissionPointLatitude - editor.originbase.BaseLatitude) /
  25. // (editor.missionpoint.MissionPointLongitude - editor.originbase.BaseLongitude);
  26. // if (editor.missionpoint.MissionPointLongitude > editor.originbase.BaseLongitude)
  27. // {
  28. // lat1 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude; //经验公式
  29. // lon1 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
  30. // }
  31. // else
  32. // {
  33. // lat1 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
  34. // lon1 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
  35. // }
  36. turningPoints.Add(new TurningPoint
  37. {
  38. TurningPointName = "平飞",
  39. TurningPointLongitude = lon1,
  40. TurningPointLatitude = lat1,
  41. TurningPointHeight = 2000,
  42. TurningPointType = "普通",
  43. SegmentFlightFuelConsumption = 2,
  44. SegmentFlightTime = 0,
  45. RemainingFuel = 0,
  46. });
  47. }
  48. //获取油耗率
  49. public static double GetClimbFuelConsumptionRate(FlightPlanEditor editor, double height)
  50. {
  51. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  52. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  53. "爬升", temp.ToString(), height.ToString(),
  54. editor.aircraftparameter.MaxTakeoffWeight.ToString());
  55. if (fuel == null)
  56. {
  57. return 1100;
  58. }
  59. return fuel.oilconsume;
  60. }
  61. public static double GetCruisingFuelConsumptionRate(FlightPlanEditor editor, double height)
  62. {
  63. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  64. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  65. "平飞远航", temp.ToString(), height.ToString(),
  66. editor.aircraftparameter.MaxTakeoffWeight.ToString());
  67. if (fuel == null)
  68. {
  69. return 600;
  70. }
  71. return fuel.oilconsume;
  72. }
  73. public static double GetEnduranceFuelConsumptionRate(FlightPlanEditor editor, double height)
  74. {
  75. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  76. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  77. "平飞久航", temp.ToString(), height.ToString(),
  78. editor.aircraftparameter.MaxTakeoffWeight.ToString());
  79. if (fuel == null)
  80. {
  81. return 600;
  82. }
  83. return fuel.oilconsume;
  84. }
  85. public static double GetDescentFuelConsumptionRate(FlightPlanEditor editor, double height)
  86. {
  87. return 2 * GetCruisingFuelConsumptionRate(editor, height) - GetClimbFuelConsumptionRate(editor, height);
  88. }
  89. public static double GetHoverFuelConsumptionRate(FlightPlanEditor editor, double height)
  90. {
  91. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  92. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  93. "悬停", temp.ToString(), height.ToString(),
  94. editor.aircraftparameter.MaxTakeoffWeight.ToString());
  95. if (fuel == null)
  96. {
  97. return 200;
  98. }
  99. return fuel.oilconsume;
  100. }
  101. //获取速度值
  102. public static double GetClimbVelocity(FlightPlanEditor editor, double height)
  103. {
  104. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  105. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  106. "爬升", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
  107. if (fuel == null)
  108. {
  109. return 60;
  110. }
  111. return fuel.speed;
  112. }
  113. public static double GetCruisingVelocity(FlightPlanEditor editor, double height)
  114. {
  115. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  116. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  117. "平飞远航", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
  118. if (fuel == null)
  119. {
  120. return 200;
  121. }
  122. return fuel.speed;
  123. }
  124. public static double GetEnduranceVelocity(FlightPlanEditor editor, double height)
  125. {
  126. double temp = Util.GetTemperature(editor.originbase.BaseLongitude, editor.originbase.BaseLatitude);
  127. Fuel fuel = Util.GetFuel(editor.aircraftparameter.AircraftID, editor.aircraftparameter.AircraftSubType,
  128. "平飞久航", temp.ToString(), height.ToString(), editor.aircraftparameter.MaxTakeoffWeight.ToString());
  129. if (fuel == null)
  130. {
  131. return 200;
  132. }
  133. return fuel.speed;
  134. }
  135. public static double GetDescentVelocity(FlightPlanEditor editor, double height)
  136. {
  137. return GetCruisingVelocity(editor, height) / 2;
  138. }
  139. public static void ZhenCha(List<double[]> SC01, FlightPlanEditor editor, ref List<TurningPoint> turningPoints) //侦查模型航路点生成
  140. {
  141. int i;
  142. for (i = 0; i < SC01.Count - 1; i++)
  143. {
  144. turningPoints.Add(new TurningPoint
  145. {
  146. TurningPointName = "平飞",
  147. TurningPointLongitude = SC01[i][0],
  148. TurningPointLatitude = SC01[i][1],
  149. TurningPointHeight = SC01[i][2],
  150. TurningPointType = "侦查",
  151. SegmentFlightFuelConsumption = 3,
  152. SegmentFlightTime = 0,
  153. RemainingFuel = 0,
  154. });
  155. }
  156. }
  157. public static void SuoHuaJiang(double resulttime, FlightPlanEditor editor,
  158. ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
  159. {
  160. turningPoints.Add(new TurningPoint
  161. {
  162. TurningPointName = "索滑降",
  163. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  164. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  165. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  166. TurningPointType = "索滑降",
  167. SegmentFlightFuelConsumption = 5,
  168. SegmentFlightTime = resulttime,
  169. RemainingFuel = 0,
  170. });
  171. turningPoints.Add(new TurningPoint
  172. {
  173. TurningPointName = "索滑降",
  174. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  175. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  176. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  177. TurningPointType = "索滑降",
  178. SegmentFlightFuelConsumption = 2,
  179. SegmentFlightTime = 0,
  180. RemainingFuel = 0,
  181. });
  182. }
  183. public static void JIJIU(double resulttime, FlightPlanEditor editor,
  184. ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
  185. {
  186. turningPoints.Add(new TurningPoint
  187. {
  188. TurningPointName = "现场急救",
  189. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  190. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  191. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  192. TurningPointType = "现场急救",
  193. SegmentFlightFuelConsumption = 5,
  194. SegmentFlightTime = resulttime,
  195. RemainingFuel = 0,
  196. });
  197. turningPoints.Add(new TurningPoint
  198. {
  199. TurningPointName = "现场急救",
  200. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  201. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  202. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  203. TurningPointType = "现场急救",
  204. SegmentFlightFuelConsumption = 2,
  205. SegmentFlightTime = 0,
  206. RemainingFuel = 0,
  207. });
  208. }
  209. public static void JIJIU1(double resulttime,MissionEndPoint hospitalPoint,
  210. ref List<TurningPoint> turningPoints) //索滑降模型航路点生成
  211. {
  212. turningPoints.Add(new TurningPoint
  213. {
  214. TurningPointName = "现场急救",
  215. TurningPointLongitude = hospitalPoint.MissionEndPointLongitude,
  216. TurningPointLatitude = hospitalPoint.MissionEndPointLatitude,
  217. TurningPointHeight = hospitalPoint.MissionEndPointHeight,
  218. TurningPointType = "现场急救",
  219. SegmentFlightFuelConsumption = 0,
  220. SegmentFlightTime = resulttime,
  221. RemainingFuel = 0,
  222. });
  223. turningPoints.Add(new TurningPoint
  224. {
  225. TurningPointName = "现场急救",
  226. TurningPointLongitude = hospitalPoint.MissionEndPointLongitude,
  227. TurningPointLatitude = hospitalPoint.MissionEndPointLatitude,
  228. TurningPointHeight = hospitalPoint.MissionEndPointHeight,
  229. TurningPointType = "现场急救",
  230. SegmentFlightFuelConsumption = 2,
  231. SegmentFlightTime = resulttime,
  232. RemainingFuel = 0,
  233. });
  234. }
  235. public static void XunHu(FlightPlanEditor editor,ref List<TurningPoint> turningPoints)
  236. {
  237. int i;
  238. for (i = 0; i < editor.airroute.Length; i++)
  239. {
  240. turningPoints.Add(new TurningPoint
  241. {
  242. TurningPointName = "平飞",
  243. TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
  244. TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
  245. TurningPointHeight = editor.airroute[i].AirRouteHeight,
  246. TurningPointType = "普通",
  247. SegmentFlightFuelConsumption = 3,
  248. SegmentFlightTime = 0,
  249. RemainingFuel = 0,
  250. });
  251. }
  252. }
  253. public static void MieHuo1(FlightPlanEditor editor,ref List<TurningPoint> turningPoints) //灭火任务从取水点到火场部分的航路点生成
  254. {
  255. turningPoints.Add(new TurningPoint
  256. {
  257. TurningPointName = "取水",
  258. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  259. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  260. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  261. TurningPointType = "取水",
  262. SegmentFlightFuelConsumption = 3,
  263. SegmentFlightTime = 120,
  264. RemainingFuel = 0,
  265. });
  266. turningPoints.Add(new TurningPoint
  267. {
  268. TurningPointName = "洒水",
  269. TurningPointLongitude = editor.firepoint[0].FirePointLongitude,
  270. TurningPointLatitude = editor.firepoint[0].FirePointLatitude,
  271. TurningPointHeight = editor.firepoint[0].FirePointHeight,
  272. TurningPointType = "巡航",
  273. SegmentFlightFuelConsumption = 3,
  274. SegmentFlightTime = 0,
  275. RemainingFuel = 0,
  276. });
  277. }
  278. public static MissionEndPoint ZhenChaMissionEndPoint(List<double[]> SC01) //侦查模型任务终点生成
  279. {
  280. MissionEndPoint missionEndPoint = new();
  281. int length = SC01.Count - 1;
  282. missionEndPoint.MissionEndPointLongitude = SC01[length][0];
  283. missionEndPoint.MissionEndPointLatitude = SC01[length][1];
  284. missionEndPoint.MissionEndPointHeight = SC01[length][2];
  285. return missionEndPoint;
  286. }
  287. public static MissionEndPoint SuoHuaJiangMissionEndPoint(FlightPlanEditor editor) //索滑降模型任务终点生成
  288. {
  289. MissionEndPoint missionEndPoint = new();
  290. missionEndPoint.MissionEndPointLongitude = editor.missionpoint.MissionPointLongitude;
  291. missionEndPoint.MissionEndPointLatitude = editor.missionpoint.MissionPointLatitude;
  292. missionEndPoint.MissionEndPointHeight = editor.missionpoint.MissionPointHeight;
  293. return missionEndPoint;
  294. }
  295. public static void JijiangMiehuo1(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
  296. {
  297. turningPoint.Add(new TurningPoint
  298. {
  299. TurningPointName = "转运",
  300. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  301. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  302. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  303. TurningPointType = "转运",
  304. SegmentFlightFuelConsumption = 2,
  305. SegmentFlightTime = 0,
  306. RemainingFuel = 0,
  307. });
  308. }
  309. public static void JijiangMiehuo(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
  310. {
  311. turningPoint.Add(new TurningPoint
  312. {
  313. TurningPointName = "转运",
  314. TurningPointLongitude = editor.originbase.BaseLongitude,
  315. TurningPointLatitude = editor.originbase.BaseLatitude,
  316. TurningPointHeight = editor.originbase.BaseHeight,
  317. TurningPointType = "转运",
  318. SegmentFlightFuelConsumption = 2,
  319. SegmentFlightTime = 0,
  320. RemainingFuel = 0,
  321. });
  322. turningPoint.Add(new TurningPoint
  323. {
  324. TurningPointName = "转运",
  325. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  326. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  327. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  328. TurningPointType = "转运",
  329. SegmentFlightFuelConsumption = 2,
  330. SegmentFlightTime = 0,
  331. RemainingFuel = 0,
  332. });
  333. }
  334. public static void KouTouKouSong(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
  335. {
  336. turningPoint.Add(new TurningPoint
  337. {
  338. TurningPointName = "转运",
  339. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  340. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  341. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  342. TurningPointType = "转运",
  343. SegmentFlightFuelConsumption = 2,
  344. SegmentFlightTime = 0,
  345. RemainingFuel = 0,
  346. });
  347. }
  348. public static void KouTouKouSong1(MissionPoint missionpoint, ref List<TurningPoint> turningPoint)
  349. {
  350. turningPoint.Add(new TurningPoint
  351. {
  352. TurningPointName = "转运",
  353. TurningPointLongitude = missionpoint.MissionPointLongitude,
  354. TurningPointLatitude = missionpoint.MissionPointLatitude,
  355. TurningPointHeight = missionpoint.MissionPointHeight,
  356. TurningPointType = "转运",
  357. SegmentFlightFuelConsumption = 2,
  358. SegmentFlightTime = 0,
  359. RemainingFuel = 0,
  360. });
  361. }
  362. public static void JijiangJiuYuan1(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
  363. {
  364. turningPoint.Add(new TurningPoint
  365. {
  366. TurningPointName = "转运",
  367. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  368. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  369. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  370. TurningPointType = "转运",
  371. SegmentFlightFuelConsumption = 2,
  372. SegmentFlightTime = 600,
  373. RemainingFuel = 0,
  374. });
  375. turningPoint.Add(new TurningPoint
  376. {
  377. TurningPointName = "转运",
  378. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  379. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  380. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  381. TurningPointType = "转运",
  382. SegmentFlightFuelConsumption = 2,
  383. SegmentFlightTime = 0,
  384. RemainingFuel = 0,
  385. });
  386. }
  387. public static void JijiangJiuYuan(FlightPlanEditor editor, ref List<TurningPoint> turningPoint)
  388. {
  389. turningPoint.Add(new TurningPoint
  390. {
  391. TurningPointName = "转运",
  392. TurningPointLongitude = editor.originbase.BaseLongitude,
  393. TurningPointLatitude = editor.originbase.BaseLatitude,
  394. TurningPointHeight = editor.originbase.BaseHeight,
  395. TurningPointType = "转运",
  396. SegmentFlightFuelConsumption = 2,
  397. SegmentFlightTime = 0,
  398. RemainingFuel = 0,
  399. });
  400. turningPoint.Add(new TurningPoint
  401. {
  402. TurningPointName = "转运",
  403. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  404. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  405. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  406. TurningPointType = "转运",
  407. SegmentFlightFuelConsumption = 2,
  408. SegmentFlightTime = 600,
  409. RemainingFuel = 0,
  410. });
  411. turningPoint.Add(new TurningPoint
  412. {
  413. TurningPointName = "转运",
  414. TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
  415. TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
  416. TurningPointHeight = editor.missionpoint.MissionPointHeight,
  417. TurningPointType = "转运",
  418. SegmentFlightFuelConsumption = 2,
  419. SegmentFlightTime = 0,
  420. RemainingFuel = 0,
  421. });
  422. }
  423. public static void ZhaoShuiJiuYuan(List<AirRoute> airRoutes, ref List<TurningPoint> turningPoint)
  424. {
  425. for (int i = 0;i < airRoutes.Count; i++)
  426. {
  427. turningPoint.Add(new TurningPoint
  428. {
  429. TurningPointName = "转运",
  430. TurningPointLongitude = airRoutes[i].AirRouteLongitude,
  431. TurningPointLatitude = airRoutes[i].AirRouteLatitude,
  432. TurningPointHeight = 1000,
  433. TurningPointType = "转运",
  434. SegmentFlightFuelConsumption = 3,
  435. SegmentFlightTime = 0,
  436. RemainingFuel = 0,
  437. });
  438. }
  439. }
  440. public static void ZhaoShuiJiuYuan1(List<AirRoute> airRoutes, ref List<TurningPoint> turningPoint)
  441. {
  442. turningPoint.Add(new TurningPoint
  443. {
  444. TurningPointName = "转运",
  445. TurningPointLongitude = airRoutes[airRoutes.Count - 1].AirRouteLongitude,
  446. TurningPointLatitude = airRoutes[airRoutes.Count - 1].AirRouteLatitude,
  447. TurningPointHeight = 1000,
  448. TurningPointType = "转运",
  449. SegmentFlightFuelConsumption = 3,
  450. SegmentFlightTime = 1800,
  451. RemainingFuel = 0,
  452. });
  453. }
  454. public static void SeaSouJiu(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
  455. {
  456. int i;
  457. for (i = 0; i < editor.airroute.Length; i++)
  458. {
  459. turningPoints.Add(new TurningPoint
  460. {
  461. TurningPointName = "巡航",
  462. TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
  463. TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
  464. TurningPointHeight = 150,
  465. TurningPointType = "普通",
  466. SegmentFlightFuelConsumption = 3,
  467. SegmentFlightTime = 0,
  468. RemainingFuel = 0,
  469. });
  470. }
  471. }
  472. public static void SeaSouJiu2(FlightPlanEditor editor, MissionPoint missionPoint, ref List<TurningPoint> turningPoints)
  473. {
  474. turningPoints.Add(new TurningPoint
  475. {
  476. TurningPointName = "巡航",
  477. TurningPointLongitude = missionPoint.MissionPointLongitude,
  478. TurningPointLatitude = missionPoint.MissionPointLatitude,
  479. TurningPointHeight = 0,
  480. TurningPointType = "普通",
  481. SegmentFlightFuelConsumption = 3,
  482. SegmentFlightTime = 0,
  483. RemainingFuel = 0,
  484. });
  485. }
  486. public static void LandSouJiu(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
  487. {
  488. int i;
  489. for (i = 0; i < editor.airroute.Length; i++)
  490. {
  491. turningPoints.Add(new TurningPoint
  492. {
  493. TurningPointName = "巡航",
  494. TurningPointLongitude = editor.airroute[i].AirRouteLongitude,
  495. TurningPointLatitude = editor.airroute[i].AirRouteLatitude,
  496. TurningPointHeight = editor.airroute[i].AirRouteHeight,
  497. TurningPointType = "普通",
  498. SegmentFlightFuelConsumption = 3,
  499. SegmentFlightTime = 0,
  500. RemainingFuel = 0,
  501. });
  502. }
  503. }
  504. public static void FromMissionToEnd(FlightPlanEditor editor, MissionEndPoint missionEndPoint, ref List<TurningPoint> turningPoints) //生成从任务段终点到基地的航路点
  505. {
  506. turningPoints.Add(new TurningPoint
  507. {
  508. TurningPointName = "平飞",
  509. TurningPointLongitude = missionEndPoint.MissionEndPointLongitude,
  510. TurningPointLatitude = missionEndPoint.MissionEndPointLatitude,
  511. TurningPointHeight = missionEndPoint.MissionEndPointHeight,
  512. TurningPointType = "普通",
  513. SegmentFlightFuelConsumption = 3,
  514. SegmentFlightTime = 0,
  515. RemainingFuel = 0,
  516. });
  517. //double k;
  518. double lat2, lon2;
  519. lat2 = (turningPoints[^1].TurningPointLatitude + editor.originbase.BaseLatitude) / 2;
  520. lon2 = (turningPoints[^1].TurningPointLongitude + editor.originbase.BaseLongitude) / 2;
  521. // k = (turningPoints[^1].TurningPointLatitude - editor.originbase.BaseLatitude) /
  522. // (turningPoints[^1].TurningPointLongitude - editor.originbase.BaseLongitude);
  523. // if (turningPoints[^1].TurningPointLongitude > editor.originbase.BaseLongitude)
  524. // {
  525. // lat2 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude;
  526. // lon2 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
  527. // }
  528. // else
  529. // {
  530. // lat2 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
  531. // lon2 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
  532. // }
  533. turningPoints.Add(new TurningPoint
  534. {
  535. TurningPointName = "降高",
  536. TurningPointLongitude = lon2,
  537. TurningPointLatitude = lat2,
  538. TurningPointHeight = 2000,
  539. TurningPointType = "普通",
  540. SegmentFlightFuelConsumption = 4,
  541. SegmentFlightTime = 0,
  542. RemainingFuel = 0,
  543. });
  544. }
  545. public static void InitializeVelocities(FlightPlanEditor editor,List<TurningPoint> turningPoints, ref double[] velocitys)
  546. {
  547. velocitys[0] = GetClimbVelocity(editor, turningPoints[0].TurningPointHeight);
  548. velocitys[1] = GetCruisingVelocity(editor, turningPoints[1].TurningPointHeight);
  549. velocitys[2] = GetEnduranceVelocity(editor, turningPoints[2].TurningPointHeight);
  550. velocitys[3] = GetDescentVelocity(editor, turningPoints[0].TurningPointHeight);
  551. }
  552. public static void InitializeFuelConsumptions(FlightPlanEditor editor, List<TurningPoint> turningPoints, ref double[] fuelConsumptions)
  553. {
  554. fuelConsumptions[0] = GetClimbFuelConsumptionRate(editor, turningPoints[0].TurningPointHeight);
  555. fuelConsumptions[1] = GetCruisingFuelConsumptionRate(editor, turningPoints[1].TurningPointHeight);
  556. fuelConsumptions[2] = GetEnduranceFuelConsumptionRate(editor, turningPoints[2].TurningPointHeight);
  557. fuelConsumptions[3] = GetDescentFuelConsumptionRate(editor, turningPoints[0].TurningPointHeight);
  558. fuelConsumptions[4] = GetHoverFuelConsumptionRate(editor, turningPoints[2].TurningPointHeight);
  559. }
  560. public static void FXJHTPDiedai(FlightPlanEditor editor,ref List<TurningPoint> turningPoints,double[] velocitys, double[] fuelConsumptions) //各航段飞行时间、油耗计算和航路点油耗迭代
  561. {
  562. int i;
  563. double DEG_TO_RAD_LOCAL = 3.1415926535897932 / 180;
  564. double[] x = new double[turningPoints.Count];
  565. double[] y = new double[turningPoints.Count];
  566. double[] z = new double[turningPoints.Count];
  567. for (i = 0; i < turningPoints.Count; i++) //LLA坐标转换为ECEF坐标
  568. {
  569. double lon = turningPoints[i].TurningPointLongitude * DEG_TO_RAD_LOCAL;
  570. double lat = turningPoints[i].TurningPointLatitude * DEG_TO_RAD_LOCAL;
  571. double hei = turningPoints[i].TurningPointHeight;
  572. double a = 6378137.0;
  573. double b = 6356752.31424518;
  574. double N = a / (Math.Sqrt(1 - ((a * a - b * b) / (a * a)) * Math.Sin(lat) * Math.Sin(lat)));
  575. x[i] = (N + hei) * Math.Cos(lat) * Math.Cos(lon);
  576. y[i] = (N + hei) * Math.Cos(lat) * Math.Sin(lon);
  577. z[i] = ((b * b * N) / (a * a) + hei) * Math.Sin(lat);
  578. }
  579. for (i = 0; i < turningPoints.Count; i++)
  580. {
  581. if (turningPoints[i].SegmentFlightTime == 0)
  582. {
  583. double distanceab;
  584. if (i != turningPoints.Count - 1)
  585. {
  586. distanceab = Math.Sqrt(Math.Pow(x[i] - x[i + 1], 2) + Math.Pow(y[i] - y[i + 1], 2) +
  587. Math.Pow(z[i] - z[i + 1], 2));
  588. }
  589. else
  590. {
  591. distanceab = Math.Sqrt(Math.Pow(x[i] - x[0], 2) + Math.Pow(y[i] - y[0], 2) +
  592. Math.Pow(z[i] - z[0], 2));
  593. }
  594. double velocity;
  595. // 根据飞行段类型选择不同的燃油消耗率计算函数
  596. switch (turningPoints[i].SegmentFlightFuelConsumption)
  597. {
  598. case 1:
  599. velocity = velocitys[0];
  600. break;
  601. case 2:
  602. velocity = velocitys[1];
  603. break;
  604. case 3:
  605. velocity = velocitys[2];
  606. break;
  607. case 4:
  608. velocity = velocitys[3];
  609. break;
  610. case 5:
  611. velocity = 0;
  612. break;
  613. default:
  614. velocity = 0;
  615. break;
  616. }
  617. // 使用计算得到的速度计算飞行时间
  618. turningPoints[i].SegmentFlightTime = CalculateSegmentFlightTime(distanceab, velocity);
  619. double CalculateSegmentFlightTime(double distance, double velocity)
  620. {
  621. return distance * 3.6 / velocity; // 根据速度计算飞行时间
  622. }
  623. }
  624. else
  625. {
  626. turningPoints[i].SegmentFlightTime = turningPoints[i].SegmentFlightTime;
  627. }
  628. }
  629. for (i = 0; i < turningPoints.Count; i++)
  630. {
  631. double remainingFuel;
  632. if (i == 0)
  633. {
  634. remainingFuel = editor.aircraftparameter.MaxFuelCapacity * 0.8;
  635. }
  636. else
  637. {
  638. remainingFuel = turningPoints[i - 1].RemainingFuel;
  639. }
  640. double fuelConsumption = 0;
  641. // 根据飞行段类型选择不同的燃油消耗率计算函数,1代表爬升,2代表平飞远航,3代表平飞久航,4代表下降,5代表悬停
  642. switch (turningPoints[i].SegmentFlightFuelConsumption)
  643. {
  644. case 1:
  645. fuelConsumption = fuelConsumptions[0];
  646. break;
  647. case 2:
  648. fuelConsumption = fuelConsumptions[1];
  649. break;
  650. case 3:
  651. fuelConsumption = fuelConsumptions[2];
  652. break;
  653. case 4:
  654. fuelConsumption = fuelConsumptions[3];
  655. break;
  656. case 5:
  657. fuelConsumption = fuelConsumptions[4];
  658. break;
  659. }
  660. remainingFuel -= fuelConsumption * turningPoints[i].SegmentFlightTime / 3600; // 更新剩余燃油
  661. if (remainingFuel < 0)
  662. {
  663. remainingFuel = 0;
  664. break;
  665. }
  666. turningPoints[i].RemainingFuel = remainingFuel;
  667. }
  668. }
  669. public static void CalculateTrueHeading(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
  670. {
  671. for (int i = 0; i < turningPoints.Count - 1; i++)
  672. {
  673. // 转换为弧度
  674. double lat1Rad = turningPoints[i].TurningPointLatitude * Math.PI / 180;
  675. double lon1Rad = turningPoints[i].TurningPointLongitude * Math.PI / 180;
  676. double lat2Rad = turningPoints[i + 1].TurningPointLatitude * Math.PI / 180;
  677. double lon2Rad = turningPoints[i + 1].TurningPointLongitude * Math.PI / 180;
  678. double deltaLon = lon2Rad - lon1Rad;
  679. double x = Math.Sin(deltaLon) * Math.Cos(lat2Rad);
  680. double y = Math.Cos(lat1Rad) * Math.Sin(lat2Rad) - Math.Sin(lat1Rad) * Math.Cos(lat2Rad) * Math.Cos(deltaLon);
  681. // 计算航向角
  682. double headingRad = Math.Atan2(x, y);
  683. // 转换为度并标准化
  684. double headingDeg = headingRad * 180 / Math.PI;
  685. headingDeg = (headingDeg + 360) % 360;
  686. turningPoints[i].HeadingAngle = headingDeg;
  687. }
  688. }
  689. /// <summary>
  690. /// 巡护用
  691. /// </summary>
  692. /// <param name="turningPoints"></param>
  693. /// <param name="editor"></param>
  694. /// <param name="nowtime"></param>
  695. /// <returns></returns>
  696. public static (CurrentLocation, bool) GetCurrentLocation(List<TurningPoint> turningPoints, FlightPlanEditor editor,
  697. double nowtime)
  698. {
  699. CurrentLocation currentLocation = new CurrentLocation();
  700. double[] timetable = new double[editor.airroute.Length + 2]; //airroute.Length表示巡护航线中有几个航路点
  701. timetable[0] = 0; //设起飞时刻为0
  702. int segmentnumber = -1;
  703. int i;
  704. for (i = 0; i < editor.airroute.Length + 1; i++)
  705. {
  706. timetable[i + 1] = timetable[i] + turningPoints[i].SegmentFlightTime;
  707. }
  708. for (i = 0; i < editor.airroute.Length + 2; i++)
  709. {
  710. if ((nowtime - timetable[i]) >= 0)
  711. {
  712. segmentnumber += 1;
  713. }
  714. else
  715. {
  716. break;
  717. }
  718. }
  719. bool isEnd = false || segmentnumber >= turningPoints.Count;
  720. currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
  721. (turningPoints[segmentnumber + 1].TurningPointLongitude -
  722. turningPoints[segmentnumber].TurningPointLongitude) *
  723. (nowtime - timetable[segmentnumber]) /
  724. turningPoints[segmentnumber].SegmentFlightTime;
  725. currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
  726. (turningPoints[segmentnumber + 1].TurningPointLatitude -
  727. turningPoints[segmentnumber].TurningPointLatitude) *
  728. (nowtime - timetable[segmentnumber]) /
  729. turningPoints[segmentnumber].SegmentFlightTime;
  730. currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
  731. (turningPoints[segmentnumber + 1].TurningPointHeight -
  732. turningPoints[segmentnumber].TurningPointHeight) *
  733. (nowtime - timetable[segmentnumber]) /
  734. turningPoints[segmentnumber].SegmentFlightTime;
  735. currentLocation.CurrentFuel = 0;
  736. currentLocation.Currentvelo = 0;
  737. currentLocation.Currentsegnum = segmentnumber + 1;
  738. currentLocation.CurrentCourse = 75;
  739. return (currentLocation, isEnd);
  740. }
  741. //改
  742. /// <summary>
  743. /// 计算当前位置
  744. /// </summary>
  745. /// <param name="FXJHTP"></param>
  746. /// <param name="FXJHTPLength"></param>
  747. /// <param name="nowtime"></param>
  748. /// <returns></returns>
  749. public static (CurrentLocation, bool) GetAllCurrentLocation(List<TurningPoint> turningPoints, double nowtime) //飞机实时位置打印
  750. {
  751. CurrentLocation currentLocation = new CurrentLocation();
  752. double[] timetable = new double[turningPoints.Count + 1];
  753. timetable[0] = 0;
  754. int segmentnumber = -1;
  755. int i;
  756. for (i = 0; i < turningPoints.Count; i++)
  757. {
  758. timetable[i + 1] = timetable[i] + turningPoints[i].SegmentFlightTime;
  759. }
  760. for (i = 0; i < turningPoints.Count + 1; i++)
  761. {
  762. if ((nowtime - timetable[i]) >= 0)
  763. {
  764. segmentnumber += 1;
  765. }
  766. else
  767. {
  768. break;
  769. }
  770. }
  771. bool isEnd = false || segmentnumber >= turningPoints.Count;
  772. currentLocation.Currentsegnum = segmentnumber;
  773. if (segmentnumber < turningPoints.Count - 1)
  774. {
  775. currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
  776. ((turningPoints[segmentnumber + 1].TurningPointLongitude -
  777. turningPoints[segmentnumber].TurningPointLongitude) /
  778. turningPoints[segmentnumber].SegmentFlightTime) *
  779. (nowtime - timetable[segmentnumber]);
  780. currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
  781. ((turningPoints[segmentnumber + 1].TurningPointLatitude -
  782. turningPoints[segmentnumber].TurningPointLatitude) /
  783. turningPoints[segmentnumber].SegmentFlightTime) *
  784. (nowtime - timetable[segmentnumber]);
  785. currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
  786. ((turningPoints[segmentnumber + 1].TurningPointHeight -
  787. turningPoints[segmentnumber].TurningPointHeight) /
  788. turningPoints[segmentnumber].SegmentFlightTime) *
  789. (nowtime - timetable[segmentnumber]);
  790. currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
  791. turningPoints[segmentnumber].SegmentFlightFuelConsumption *
  792. (nowtime - timetable[segmentnumber]);
  793. currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
  794. }
  795. else if (segmentnumber == turningPoints.Count - 1)
  796. {
  797. currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
  798. ((turningPoints[0].TurningPointLongitude -
  799. turningPoints[segmentnumber].TurningPointLongitude) /
  800. turningPoints[segmentnumber].SegmentFlightTime) *
  801. (nowtime - timetable[segmentnumber]);
  802. currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
  803. ((turningPoints[0].TurningPointLatitude -
  804. turningPoints[segmentnumber].TurningPointLatitude) /
  805. turningPoints[segmentnumber].SegmentFlightTime) *
  806. (nowtime - timetable[segmentnumber]);
  807. currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
  808. ((turningPoints[0].TurningPointHeight -
  809. turningPoints[segmentnumber].TurningPointHeight) /
  810. turningPoints[segmentnumber].SegmentFlightTime) *
  811. (nowtime - timetable[segmentnumber]);
  812. currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
  813. turningPoints[segmentnumber].SegmentFlightFuelConsumption *
  814. (nowtime - timetable[segmentnumber]);
  815. currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
  816. }
  817. else
  818. {
  819. currentLocation.CurrentLon = turningPoints[^1].TurningPointLongitude;
  820. currentLocation.CurrentLat = turningPoints[^1].TurningPointLatitude;
  821. currentLocation.CurrentHei = turningPoints[^1].TurningPointHeight;
  822. currentLocation.Currentvelo = 0;
  823. currentLocation.CurrentFuel = turningPoints[segmentnumber - 1].RemainingFuel -
  824. turningPoints[segmentnumber - 1].SegmentFlightFuelConsumption *
  825. turningPoints[segmentnumber - 1].SegmentFlightTime;
  826. currentLocation.PresentMission = turningPoints[segmentnumber - 1].TurningPointName;
  827. isEnd = true;
  828. }
  829. return (currentLocation,isEnd);
  830. }
  831. }
  832. }