namespace Model { public class FXJHGenerate { public static TurningPoint[] FromStartToMission(FlightPlanEditor editor, TurningPoint[] turningPoints)//生成从基地到任务段起点的航路点 { turningPoints[0].TurningPointName = "爬升"; turningPoints[0].TurningPointLongitude = editor.originbase.BaseLongitude;//基地位置 turningPoints[0].TurningPointLatitude = editor.originbase.BaseLatitude; turningPoints[0].TurningPointHeight = editor.originbase.BaseHeight; turningPoints[0].TurningPointType = "普通"; turningPoints[0].TurningPointVelocity = editor.climbsegment.ClimbVelocity; turningPoints[0].SegmentFlightFuelConsumption = 2; turningPoints[0].SegmentFlightTime = 0; turningPoints[0].RemainingFuel = 0; double k; double lat1, lon1;//直升机起飞后爬升到的航路点的经纬度,记为经纬度1 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[1].TurningPointName = "巡航"; turningPoints[1].TurningPointLongitude = lon1; turningPoints[1].TurningPointLatitude = lat1; turningPoints[1].TurningPointHeight = editor.cruisesegment.CruiseHeight; turningPoints[1].TurningPointType = "普通"; turningPoints[1].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[1].SegmentFlightFuelConsumption = 2; turningPoints[1].SegmentFlightTime = 0; turningPoints[1].RemainingFuel = 0; return turningPoints; } //改 public static double GetCruiseFuelConsumptionRate(FlightPlanEditor editor,CurrentLocation currentLocation) { switch (editor.aircraftparameter.AircraftID) { case "AC-313A": //return CruiseFuelConsumptionProvider_AC313A.GetCruiseFuelConsumption(editor.cityweather.Temperature,editor.aircraftparameter.MaxTakeoffWeight,currentLocation.CurrentHei); case "AC-352": //return CruiseFuelConsumptionProvider_AC352.GetCruiseFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); case "AG-600": //return CruiseFuelConsumptionProvider_AG600.GetCruiseFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); default: return editor.cruisesegment.CruiseFuelConsumptionRate; } } public static double GetClimbFuelConsumptionRate(FlightPlanEditor editor, CurrentLocation currentLocation) { switch (editor.aircraftparameter.AircraftID) { case "AC-313A": //return ClimbFuelConsumptionProvider_AC313A.GetClimbFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); case "AC-352": //return ClimbFuelConsumptionProvider_AC352.GetClimbFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); case "AG-600": //return ClimbFuelConsumptionProvider_AG600.GetClimbFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); default: return editor.climbsegment.ClimbFuelConsumptionRate; } } public static double GetDescentFuelConsumptionRate(FlightPlanEditor editor,CurrentLocation currentLocation) { switch (editor.aircraftparameter.AircraftID) { case "AC-313A": //return DescentFuelConsumptionProvider_AC313A.GetDescentFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); case "AC-352": //return DescentFuelConsumptionProvider_AC352.GetDescentFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); case "AG-600": //return DescentFuelConsumptionProvider_AG600.GetDescentFuelConsumption(editor.cityweather.Temperature, editor.aircraftparameter.MaxTakeoffWeight, currentLocation.CurrentHei); default: return editor.cruisesegment.CruiseFuelConsumptionRate; } } public static TurningPoint[] ZhenCha(List SC01,FlightPlanEditor editor,TurningPoint[] turningPoints)//侦查模型航路点生成 { int i; for(i=0;i SC01)//侦查模型任务终点生成 { MissionEndPoint missionEndPoint = new(); int length = SC01.Count; missionEndPoint.MissionEndPointLongitude = SC01[length - 1][0]; missionEndPoint.MissionEndPointLatitude = SC01[length - 1][1]; missionEndPoint.MissionEndPointHeight = SC01[length - 1][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 TurningPoint[] SouJiu(FlightPlanEditor editor, TurningPoint[] turningPoints,int TransportNumber) { turningPoints[2 + TransportNumber].TurningPointName = "搜救";// turningPoints[2 + TransportNumber].TurningPointLongitude = editor.missionpoint.MissionPointLongitude; turningPoints[2 + TransportNumber].TurningPointLatitude = editor.missionpoint.MissionPointLatitude; turningPoints[2 + TransportNumber].TurningPointHeight = editor.missionpoint.MissionPointHeight; turningPoints[2 + TransportNumber].TurningPointType = "转运"; turningPoints[2 + TransportNumber].TurningPointVelocity = 0; turningPoints[2 + TransportNumber].SegmentFlightFuelConsumption = 2; turningPoints[2 + TransportNumber].SegmentFlightTime = 0; turningPoints[2 + TransportNumber].RemainingFuel = 0; turningPoints[3 + TransportNumber].TurningPointName = "搜救"; turningPoints[3 + TransportNumber].TurningPointLongitude = editor.missionpoint.MissionPointLongitude; turningPoints[3 + TransportNumber].TurningPointLatitude = editor.missionpoint.MissionPointLatitude; turningPoints[3 + TransportNumber].TurningPointHeight = editor.missionpoint.MissionPointHeight; turningPoints[3 + TransportNumber].TurningPointType = "转运"; turningPoints[3 + TransportNumber].TurningPointVelocity = 0; turningPoints[3 + TransportNumber].SegmentFlightFuelConsumption = 2; turningPoints[3 + TransportNumber].SegmentFlightTime = 0; turningPoints[3 + TransportNumber].RemainingFuel = 0; return turningPoints; } public static TurningPoint[] FromMissionToEnd(FlightPlanEditor editor, MissionEndPoint missionEndPoint, TurningPoint[] turningPoints,int Length)//生成从任务段终点到基地的航路点 { turningPoints[Length].TurningPointName = "巡航"; turningPoints[Length].TurningPointLongitude = missionEndPoint.MissionEndPointLongitude; turningPoints[Length].TurningPointLatitude = missionEndPoint.MissionEndPointLatitude; turningPoints[Length].TurningPointHeight = missionEndPoint.MissionEndPointHeight; turningPoints[Length].TurningPointType = "普通"; turningPoints[Length].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[Length].SegmentFlightFuelConsumption = 2; turningPoints[Length].SegmentFlightTime = 0; turningPoints[Length].RemainingFuel = 0; double k; double lat2, lon2; k = (turningPoints[Length].TurningPointLatitude - editor.originbase.BaseLatitude) / (turningPoints[Length].TurningPointLongitude - editor.originbase.BaseLongitude); if (turningPoints[Length].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[Length+1].TurningPointName = "降高"; turningPoints[Length+1].TurningPointLongitude = lon2; turningPoints[Length+1].TurningPointLatitude = lat2; turningPoints[Length+1].TurningPointHeight = editor.cruisesegment.CruiseHeight; turningPoints[Length+1].TurningPointType = "普通"; turningPoints[Length+1].TurningPointVelocity = editor.descentsegment.DescentVelocity; turningPoints[Length+1].SegmentFlightFuelConsumption = 3; turningPoints[Length+1].SegmentFlightTime = 0; turningPoints[Length+1].RemainingFuel = 0; return turningPoints; } public static TurningPoint[] FXJHTPDiedai(FlightPlanEditor editor,TurningPoint[] turningPoints,int FXJHTPLength)//各航段飞行时间、油耗计算和航路点油耗迭代 { TurningPoint[] FXJHTP = turningPoints; int i; double DEG_TO_RAD_LOCAL = 3.1415926535897932 / 180; double[] x = new double[FXJHTPLength]; double[] y = new double[FXJHTPLength]; double[] z = new double[FXJHTPLength]; double TIME_STEP = 10; // 每10秒计算一次 for (i = 0; i < FXJHTPLength; i++)//LLA坐标转换为ECEF坐标 { double lon = FXJHTP[i].TurningPointLongitude * DEG_TO_RAD_LOCAL; double lat = FXJHTP[i].TurningPointLatitude * DEG_TO_RAD_LOCAL; double hei = FXJHTP[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 < FXJHTPLength; i++) { if (FXJHTP[i].SegmentFlightTime==0) { double distanceab; if (i != FXJHTPLength - 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)); } FXJHTP[i].SegmentFlightTime = distanceab * 3.6 / FXJHTP[i].TurningPointVelocity; } else { FXJHTP[i].SegmentFlightTime = FXJHTP[i].SegmentFlightTime; } } for (i = 0; i < FXJHTPLength; i++) { double remainingFuel; if (i == 0) { remainingFuel = editor.aircraftparameter.MaxFuelCapacity * 0.8; } else { remainingFuel = FXJHTP[i - 1].RemainingFuel; } for (double t = 0; t < FXJHTP[i].SegmentFlightTime; t += TIME_STEP) { CurrentLocation currentLocation = GetAllCurrentLocation(FXJHTP, FXJHTPLength,t); // 更新当前位置 double fuelConsumption=0; // 根据飞行段类型选择不同的燃油消耗率计算函数,1代表爬升,2代表平飞,3代表下降 switch (FXJHTP[i].SegmentFlightFuelConsumption) { case 1: fuelConsumption = GetClimbFuelConsumptionRate(editor, currentLocation); break; case 2: fuelConsumption = GetCruiseFuelConsumptionRate(editor, currentLocation); break; case 3: fuelConsumption = GetDescentFuelConsumptionRate(editor, currentLocation); break; } remainingFuel -= fuelConsumption * TIME_STEP / 3600; // 更新剩余燃油 if (remainingFuel < 0) { remainingFuel = 0; break; } } FXJHTP[i].RemainingFuel = remainingFuel; } return FXJHTP; } public static void FXJHTPPrint(TurningPoint[] FXJHTP,int FXJHTPLength)//航路点打印 { int i; for(i=0;i= 0) { segmentnumber += 1; } else { break; } } 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; } //改 public static CurrentLocation GetAllCurrentLocation(TurningPoint[] FXJHTP, int FXJHTPLength,double nowtime)//飞机实时位置打印 { CurrentLocation currentLocation = new CurrentLocation(); double[] timetable = new double[FXJHTPLength+1]; timetable[0] = 0; int segmentnumber=-1; int i; for(i=0;i=0) { segmentnumber += 1; } else { break; } } if(segmentnumber