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<double[]> SC01,FlightPlanEditor editor,TurningPoint[] turningPoints)//侦查模型航路点生成 { int i; for(i=0;i<SC01.Count-1;i++) { turningPoints[i + 2].TurningPointName = "巡航"; turningPoints[i + 2].TurningPointLongitude = SC01[i][0]; turningPoints[i + 2].TurningPointLatitude = SC01[i][1]; turningPoints[i + 2].TurningPointHeight = SC01[i][2]; turningPoints[i + 2].TurningPointType = "侦查"; turningPoints[i + 2].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[i + 2].SegmentFlightFuelConsumption = 2; turningPoints[i + 2].SegmentFlightTime = 0; turningPoints[i + 2].RemainingFuel = 0; } return turningPoints; } public static TurningPoint[] SuoHuaJiang(double resulttime,FlightPlanEditor editor, TurningPoint[] turningPoints)//索滑降模型航路点生成 { turningPoints[2].TurningPointName = "索滑降"; turningPoints[2].TurningPointLongitude = editor.missionpoint.MissionPointLongitude; turningPoints[2].TurningPointLatitude = editor.missionpoint.MissionPointLatitude; turningPoints[2].TurningPointHeight = editor.missionpoint.MissionPointHeight; turningPoints[2].TurningPointType = "索滑降"; turningPoints[2].TurningPointVelocity = 0; turningPoints[2].SegmentFlightFuelConsumption = 1; turningPoints[2].SegmentFlightTime = resulttime; turningPoints[2].RemainingFuel = 0; return turningPoints; } public static TurningPoint[] XunHu(FlightPlanEditor editor, TurningPoint[] turningPoints) { int i; for (i = 0; i < editor.airroute.Length; i++) { turningPoints[2+i].TurningPointName = "巡航"; turningPoints[2+i].TurningPointLongitude = editor.airroute[i].AirRouteLongitude; turningPoints[2+i].TurningPointLatitude = editor.airroute[i].AirRouteLatitude; turningPoints[2+i].TurningPointHeight = editor.airroute[i].AirRouteHeight; turningPoints[2+i].TurningPointType = "普通"; turningPoints[2+i].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[2+i].SegmentFlightFuelConsumption = 2; turningPoints[2+i].SegmentFlightTime = 0; turningPoints[2+i].RemainingFuel = 0; } return turningPoints; } public static TurningPoint[] MieHuo1(FlightPlanEditor editor, TurningPoint[] turningPoints,int PointNumberIcon)//灭火任务从取水点到火场部分的航路点生成 { turningPoints[2 + PointNumberIcon].TurningPointName = "灭火";//PointNumberIcon:洒水的次数 turningPoints[2 + PointNumberIcon].TurningPointLongitude = editor.missionpoint.MissionPointLongitude; turningPoints[2 + PointNumberIcon].TurningPointLatitude = editor.missionpoint.MissionPointLatitude; turningPoints[2 + PointNumberIcon].TurningPointHeight = editor.missionpoint.MissionPointHeight; turningPoints[2 + PointNumberIcon].TurningPointType = "取水"; turningPoints[2 + PointNumberIcon].TurningPointVelocity = 0; turningPoints[2 + PointNumberIcon].SegmentFlightFuelConsumption = 1; turningPoints[2 + PointNumberIcon].SegmentFlightTime = 120; turningPoints[2 + PointNumberIcon].RemainingFuel = 0; //从取水点飞到火点 // turningPoints[3 + PointNumberIcon].TurningPointName = "灭火"; // turningPoints[3 + PointNumberIcon].TurningPointLongitude = editor.missionpoint.MissionPointLongitude; // turningPoints[3 + PointNumberIcon].TurningPointLatitude = editor.missionpoint.MissionPointLatitude; // turningPoints[3 + PointNumberIcon].TurningPointHeight = editor.missionpoint.MissionPointHeight; // turningPoints[3 + PointNumberIcon].TurningPointType = "巡航"; // turningPoints[3 + PointNumberIcon].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; // turningPoints[3 + PointNumberIcon].SegmentFlightFuelConsumption = 2; // turningPoints[3 + PointNumberIcon].SegmentFlightTime = 0; // turningPoints[3 + PointNumberIcon].RemainingFuel = 0; //从火点飞到灭火模型返回的精确地洒水点 turningPoints[3 + PointNumberIcon].TurningPointName = "灭火"; turningPoints[3 + PointNumberIcon].TurningPointLongitude = editor.firepoint[0].FirePointLongitude; turningPoints[3 + PointNumberIcon].TurningPointLatitude = editor.firepoint[0].FirePointLatitude; turningPoints[3 + PointNumberIcon].TurningPointHeight = editor.firepoint[0].FirePointHeight; turningPoints[3 + PointNumberIcon].TurningPointType = "巡航"; turningPoints[3 + PointNumberIcon].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[3 + PointNumberIcon].SegmentFlightFuelConsumption = 2; turningPoints[3 + PointNumberIcon].SegmentFlightTime = 0; turningPoints[3 + PointNumberIcon].RemainingFuel = 0; return turningPoints; } public static TurningPoint[] MieHuo2(FlightPlanEditor editor, TurningPoint[] turningPoints,int PointNumberIcon,double sashuilon,double sashuilat, double sashuihei)//灭火任务洒水部分航路点生成 { turningPoints[PointNumberIcon + 5].TurningPointName = "灭火"; turningPoints[PointNumberIcon + 5].TurningPointLongitude = sashuilon; turningPoints[PointNumberIcon + 5].TurningPointLatitude = sashuilat; turningPoints[PointNumberIcon + 5].TurningPointHeight = sashuihei; turningPoints[PointNumberIcon + 5].TurningPointType = "洒水"; turningPoints[PointNumberIcon + 5].TurningPointVelocity = editor.cruisesegment.CruiseVelocity; turningPoints[PointNumberIcon + 5].SegmentFlightFuelConsumption = 2; turningPoints[PointNumberIcon + 5].SegmentFlightTime = 0; turningPoints[PointNumberIcon + 5].RemainingFuel = 0; return turningPoints; } public static MissionEndPoint ZhenChaMissionEndPoint(List<double[]> SC01)//侦查模型任务终点生成 { MissionEndPoint missionEndPoint = new(); int length = SC01.Count; 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 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<FXJHTPLength;i++) { Console.WriteLine("航路点序号: {0}", i + 1);// {0}是占位符,在字符串中插入变量的值 Console.WriteLine("航路点名称: {0}", FXJHTP[i].TurningPointName); Console.WriteLine("航路点类型: {0}", FXJHTP[i].TurningPointType); Console.WriteLine("航路点速度: {0}", FXJHTP[i].TurningPointVelocity); Console.WriteLine("航路点时间: {0}", FXJHTP[i].SegmentFlightTime); Console.WriteLine("航路点油耗: {0}", FXJHTP[i].SegmentFlightFuelConsumption); Console.WriteLine("航路点经度: {0}", FXJHTP[i].TurningPointLongitude); Console.WriteLine("航路点纬度: {0}", FXJHTP[i].TurningPointLatitude); Console.WriteLine("航路点海拔: {0}", FXJHTP[i].TurningPointHeight); } } public static CurrentLocation GetCurrentLocation(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; } } 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<FXJHTPLength;i++) { timetable[i + 1] = timetable[i] + FXJHTP[i].SegmentFlightTime; } for(i=0;i<FXJHTPLength+1;i++) { if ((nowtime - timetable[i])>=0) { segmentnumber += 1; } else { break; } } if(segmentnumber<FXJHTPLength-1) { currentLocation.CurrentLon = FXJHTP[segmentnumber].TurningPointLongitude+((FXJHTP[segmentnumber + 1].TurningPointLongitude - FXJHTP[segmentnumber].TurningPointLongitude) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.CurrentLat = FXJHTP[segmentnumber].TurningPointLatitude+((FXJHTP[segmentnumber + 1].TurningPointLatitude - FXJHTP[segmentnumber].TurningPointLatitude) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.CurrentHei = FXJHTP[segmentnumber].TurningPointHeight+((FXJHTP[segmentnumber + 1].TurningPointHeight - FXJHTP[segmentnumber].TurningPointHeight) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.Currentvelo = FXJHTP[segmentnumber].TurningPointVelocity; currentLocation.CurrentFuel = FXJHTP[segmentnumber].RemainingFuel - FXJHTP[segmentnumber].SegmentFlightFuelConsumption* (nowtime - timetable[segmentnumber]); } else if(segmentnumber == FXJHTPLength-1) { currentLocation.CurrentLon = FXJHTP[segmentnumber].TurningPointLongitude+((FXJHTP[0].TurningPointLongitude - FXJHTP[segmentnumber].TurningPointLongitude) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.CurrentLat = FXJHTP[segmentnumber].TurningPointLatitude+((FXJHTP[0].TurningPointLatitude - FXJHTP[segmentnumber].TurningPointLatitude) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.CurrentHei = FXJHTP[segmentnumber].TurningPointHeight+((FXJHTP[0].TurningPointHeight - FXJHTP[segmentnumber].TurningPointHeight) / FXJHTP[segmentnumber].SegmentFlightTime) * (nowtime - timetable[segmentnumber]); currentLocation.Currentvelo = FXJHTP[segmentnumber].TurningPointVelocity; currentLocation.CurrentFuel = FXJHTP[segmentnumber].RemainingFuel - FXJHTP[segmentnumber].SegmentFlightFuelConsumption * (nowtime - timetable[segmentnumber]); } else { currentLocation.CurrentLon = FXJHTP[0].TurningPointLongitude; currentLocation.CurrentLat = FXJHTP[0].TurningPointLatitude; currentLocation.CurrentHei = FXJHTP[0].TurningPointHeight; currentLocation.Currentvelo = 0; currentLocation.CurrentFuel = FXJHTP[segmentnumber-1].RemainingFuel - FXJHTP[segmentnumber-1].SegmentFlightFuelConsumption * FXJHTP[segmentnumber-1].SegmentFlightTime; } // Console.WriteLine("当前经度: {0}", currentLocation.CurrentLon); // Console.WriteLine("当前纬度: {0}", currentLocation.CurrentLat); // Console.WriteLine("当前海拔: {0}", currentLocation.CurrentHei); // Console.WriteLine("当前速度: {0}", currentLocation.Currentvelo); // Console.WriteLine("当前剩余油量: {0}", currentLocation.CurrentFuel); return currentLocation; } public static double GetTime(TurningPoint[] turningPoints,int start,int end) { double time = 0; int i; double DEG_TO_RAD_LOCAL = 3.1415926535897932 / 180; double[] x = new double[end - start + 1]; double[] y = new double[end - start + 1]; double[] z = new double[end - start + 1]; for (i = start; i < end+1; i++) { 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-start] = (N + hei) * Math.Cos(lat) * Math.Cos(lon); y[i-start] = (N + hei) * Math.Cos(lat) * Math.Sin(lon); z[i-start] = ((b * b * N) / (a * a) + hei) * Math.Sin(lat); } for (i = 0; i < end - start; i++) { if (turningPoints[i+start].SegmentFlightTime == 0) { double distanceab; distanceab = Math.Sqrt((x[i] - x[i + 1]) * (x[i] - x[i + 1]) + (y[i] - y[i + 1]) * (y[i] - y[i + 1]) + (z[i] - z[i + 1]) * (z[i] - z[i + 1])); turningPoints[i+start].SegmentFlightTime = distanceab * 3.6 / turningPoints[i+start].TurningPointVelocity; } else { turningPoints[i+start].SegmentFlightTime = turningPoints[i+start].SegmentFlightTime; } } for(i=0;i<end-start;i++) { time += turningPoints[i+start].SegmentFlightTime; } return time; } public static TurningPoint[] JijiangMiehuo(FlightPlanEditor editor, TurningPoint[] turningPoints, int TransportNumber) { turningPoints[2 + TransportNumber].TurningPointName = "地面灭火";// turningPoints[2 + TransportNumber].TurningPointLongitude = editor.originbase.BaseLongitude; turningPoints[2 + TransportNumber].TurningPointLatitude = editor.originbase.BaseLatitude; turningPoints[2 + TransportNumber].TurningPointHeight = editor.originbase.BaseHeight; 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; } } }