瀏覽代碼

确定服务端独立版本

zansimple 8 月之前
父節點
當前提交
4c9f5c55b2
共有 65 個文件被更改,包括 1046 次插入939 次删除
  1. 二進制
      KYFramework/bin/Debug/net7.0/KYFramework.dll
  2. 二進制
      KYFramework/bin/Debug/net7.0/KYFramework.pdb
  3. 二進制
      KYFramework/bin/Debug/net7.0/ThirdParty.dll
  4. 二進制
      KYFramework/bin/Debug/net7.0/ThirdParty.pdb
  5. 0 1
      Models/SimulationCommon/Define.cs
  6. 1 9
      Models/SimulationCommon/EditorConfig.cs
  7. 0 1
      Models/SimulationCommon/EquationHelper.cs
  8. 357 253
      Models/SimulationCommon/FXJHGenenrate.cs
  9. 0 7
      Models/SimulationCommon/FlightPlanEditor.cs
  10. 17 0
      Models/SimulationCommon/FuelDB.cs
  11. 2 0
      Models/SimulationCommon/TaskConfig.cs
  12. 72 0
      Models/SimulationCommon/Util.cs
  13. 10 10
      SimulationServer/Component/EconomicalComponent.cs
  14. 16 15
      SimulationServer/Component/StaticCapacityComponent.cs
  15. 8 1
      SimulationServer/Component/TaskComponent.cs
  16. 12 12
      SimulationServer/Component/TaskPerformanceComponent.cs
  17. 8 8
      SimulationServer/Component/TotalEconomicalComponent.cs
  18. 17 15
      SimulationServer/Component/TotalTaskPerformanceComponent.cs
  19. 7 7
      SimulationServer/Component/XHEconomicalComponent.cs
  20. 6 6
      SimulationServer/Component/XHStaticCapacityComponent.cs
  21. 6 6
      SimulationServer/Component/XHTotalTaskPerformanceComponent.cs
  22. 65 0
      SimulationServer/Entity/AircraftEntity.cs
  23. 56 73
      SimulationServer/Entity/AircraftMH.cs
  24. 26 44
      SimulationServer/Entity/AircraftMHWithPersion.cs
  25. 10 21
      SimulationServer/Entity/AircraftSHJ.cs
  26. 46 45
      SimulationServer/Entity/AircraftXH.cs
  27. 18 26
      SimulationServer/Entity/AircraftZC.cs
  28. 0 8
      SimulationServer/Entity/IAircraft.cs
  29. 76 49
      SimulationServer/Entity/MHRescueMission.cs
  30. 1 1
      SimulationServer/Entity/XHRescueMission.cs
  31. 16 0
      SimulationServer/Entity/ZCRescueMission.cs
  32. 104 106
      SimulationServer/EventHandler/ServerStartEventHandler.cs
  33. 21 5
      SimulationServer/Utils/DataTableExtensions.cs
  34. 3 0
      SimulationServer/Utils/HttpInterface.cs
  35. 7 1
      SimulationServer/Utils/Slope.cs
  36. 42 0
      SimulationServer/Utils/Util.cs
  37. 二進制
      SimulationServer/bin/Debug/net7.0/KYFramework.dll
  38. 二進制
      SimulationServer/bin/Debug/net7.0/KYFramework.pdb
  39. 2 22
      SimulationServer/bin/Debug/net7.0/Missions/editor_config.json
  40. 14 187
      SimulationServer/bin/Debug/net7.0/Missions/task_config.json
  41. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/Ka-32灭火任务单机指标报告.xls
  42. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/灭火任务总体指标报告.xls
  43. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/装备体系评估报告.xls
  44. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/Ka-32灭火任务单机指标报告.xls
  45. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/灭火任务总体指标报告.xls
  46. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/装备体系评估报告.xls
  47. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32-吊桶洒水灭火任务1-1-1灭火任务单机指标报告.xls
  48. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32-吊桶洒水灭火任务1-2-2灭火任务单机指标报告.xls
  49. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32灭火任务单机指标报告.xls
  50. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/灭火任务总体指标报告.xls
  51. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/装备体系评估报告.xls
  52. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/Ka-32-吊桶洒水灭火任务2-1-5灭火任务单机指标报告.xls
  53. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/Ka-32灭火任务单机指标报告.xls
  54. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/灭火任务总体指标报告.xls
  55. 二進制
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/装备体系评估报告.xls
  56. 二進制
      SimulationServer/bin/Debug/net7.0/SimulationCommon.dll
  57. 二進制
      SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb
  58. 二進制
      SimulationServer/bin/Debug/net7.0/SimulationServer.dll
  59. 二進制
      SimulationServer/bin/Debug/net7.0/SimulationServer.exe
  60. 二進制
      SimulationServer/bin/Debug/net7.0/SimulationServer.pdb
  61. 二進制
      SimulationServer/bin/Debug/net7.0/ThirdParty.dll
  62. 二進制
      SimulationServer/bin/Debug/net7.0/ThirdParty.pdb
  63. 二進制
      SimulationServer/bin/Debug/server.zip
  64. 二進制
      ThirdParty/bin/Debug/net7.0/ThirdParty.dll
  65. 二進制
      ThirdParty/bin/Debug/net7.0/ThirdParty.pdb

二進制
KYFramework/bin/Debug/net7.0/KYFramework.dll


二進制
KYFramework/bin/Debug/net7.0/KYFramework.pdb


二進制
KYFramework/bin/Debug/net7.0/ThirdParty.dll


二進制
KYFramework/bin/Debug/net7.0/ThirdParty.pdb


+ 0 - 1
Models/SimulationCommon/Define.cs

@@ -9,7 +9,6 @@ public class TurningPoint //类中删除了转弯半径
     public double TurningPointLatitude;
     public double TurningPointHeight;
     public string TurningPointType;
-    public double TurningPointVelocity;
     public double SegmentFlightFuelConsumption;
     public double SegmentFlightTime;
     public double RemainingFuel; //新添加了当前剩余油量

+ 1 - 9
Models/SimulationCommon/EditorConfig.cs

@@ -29,8 +29,6 @@ public struct AircraftParameter
     public double MaxTakeoffWeight;
     [JsonProperty("最大载油量")]
     public double MaxFuelCapacity;
-    [JsonProperty("起飞准备时间")]
-    public double TakeoffPreparationTime;
     [JsonProperty("最大载客数量")]
     public double MaxPassengerNumber;
     [JsonProperty("所属机场ID")]
@@ -73,7 +71,7 @@ public class DescentSegment
 public class CruiseSegment
 {
     [JsonProperty("巡航段高度")]
-    public double CruiseHeight;
+    public double CruiseHeight = 2000;
     [JsonProperty("巡航段速度")]
     public double CruiseVelocity;
     [JsonProperty("巡航段油耗率")]
@@ -94,12 +92,6 @@ public class EditorConfig
     public List<AircraftParameter>aircraftParameters = new List<AircraftParameter>();
     [JsonProperty("火点")]
     public List<FirePoint> firePoints = new List<FirePoint>();
-    [JsonProperty("爬升段")]
-    public ClimbSegment climbSegment = new ClimbSegment();
-    [JsonProperty("下降段")]
-    public DescentSegment descentSegment = new DescentSegment();
-    [JsonProperty("巡航段")]
-    public CruiseSegment cruiseSegment = new CruiseSegment();
     [JsonProperty("天气信息")]
     public CityWeather cityWeather = new CityWeather();
 }

+ 0 - 1
Models/SimulationCommon/EquationHelper.cs

@@ -108,7 +108,6 @@ namespace MuShiApp
                     m_Args = new List<string> { "city_name", "weather_date" }
                 };
                 string response = m_HttpHelper.Request(cmd, new List<string> { city_name, weather_date });
-
                 R data = JsonConvert.DeserializeObject<R>(response);
                 if (data != null && data.code == 200)
                 {

+ 357 - 253
Models/SimulationCommon/FXJHGenenrate.cs

@@ -1,25 +1,30 @@
-namespace Model
+using SimulationCommon;
+
+namespace Model
 {
     public class FXJHGenerate
     {
-        public static TurningPoint[] FromStartToMission(FlightPlanEditor editor, TurningPoint[] turningPoints)//生成从基地到任务段起点的航路点
+        public static TurningPoint[]
+            FromStartToMission(FlightPlanEditor editor, TurningPoint[] turningPoints) //生成从基地到任务段起点的航路点
         {
             turningPoints[0].TurningPointName = "爬升";
-            turningPoints[0].TurningPointLongitude = editor.originbase.BaseLongitude;//基地位置
+            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].TurningPointVelocity = editor.climbsegment.ClimbVelocity;
+            turningPoints[0].SegmentFlightFuelConsumption = 1;
             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);
+            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;//经验公式
+                lat1 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude; //经验公式
                 lon1 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
             }
             else
@@ -27,172 +32,221 @@
                 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].TurningPointHeight = 2000;
             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)
+
+        //获取油耗率
+        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)
         {
-            switch (editor.aircraftparameter.AircraftID)
+            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)
             {
-                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;
+                return 600;
             }
+
+            return fuel.oilconsume;
         }
 
-        public static double GetClimbFuelConsumptionRate(FlightPlanEditor editor, CurrentLocation currentLocation)
+        public static double GetEnduranceFuelConsumptionRate(FlightPlanEditor editor, double height)
         {
-            switch (editor.aircraftparameter.AircraftID)
+            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)
             {
-                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;
+                return 600;
             }
+
+            return fuel.oilconsume;
+        }
+
+        public static double GetDescentFuelConsumptionRate(FlightPlanEditor editor, double height)
+        {
+            return 2 * GetCruisingFuelConsumptionRate(editor, height) - GetClimbFuelConsumptionRate(editor, height);
         }
 
-        public static double GetDescentFuelConsumptionRate(FlightPlanEditor editor,CurrentLocation currentLocation)
+        public static double GetHoverFuelConsumptionRate(FlightPlanEditor editor, double height)
         {
-            switch (editor.aircraftparameter.AircraftID)
+            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)
             {
-                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;
+                return 200;
             }
+
+            return fuel.oilconsume;
         }
-        public static TurningPoint[] ZhenCha(List<double[]> SC01,FlightPlanEditor editor,TurningPoint[] turningPoints)//侦查模型航路点生成
+
+
+        //获取速度值
+
+        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 TurningPoint[]
+            ZhenCha(List<double[]> SC01, FlightPlanEditor editor, TurningPoint[] turningPoints) //侦查模型航路点生成
         {
             int i;
-            for(i=0;i<SC01.Count-1;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].SegmentFlightFuelConsumption = 3;
                 turningPoints[i + 2].SegmentFlightTime = 0;
                 turningPoints[i + 2].RemainingFuel = 0;
             }
 
             return turningPoints;
         }
-        public static TurningPoint[] SuoHuaJiang(double resulttime,FlightPlanEditor editor, TurningPoint[] 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].SegmentFlightFuelConsumption = 5;
             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;
+                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].SegmentFlightFuelConsumption = 3;
+                turningPoints[2 + i].SegmentFlightTime = 0;
+                turningPoints[2 + i].RemainingFuel = 0;
             }
 
             return turningPoints;
         }
-        public static TurningPoint[] MieHuo1(FlightPlanEditor editor, TurningPoint[] turningPoints,int PointNumberIcon)//灭火任务从取水点到火场部分的航路点生成
+
+        public static TurningPoint[]
+            MieHuo1(FlightPlanEditor editor, TurningPoint[] turningPoints, int PointNumberIcon) //灭火任务从取水点到火场部分的航路点生成
         {
-            turningPoints[2 + PointNumberIcon].TurningPointName = "灭火";//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].SegmentFlightFuelConsumption = 3;
             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].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].SegmentFlightFuelConsumption = 3;
             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)//侦查模型任务终点生成
+        public static MissionEndPoint ZhenChaMissionEndPoint(List<double[]> 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];
+            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)//索滑降模型任务终点生成
+
+        public static MissionEndPoint SuoHuaJiangMissionEndPoint(FlightPlanEditor editor) //索滑降模型任务终点生成
         {
             MissionEndPoint missionEndPoint = new();
             missionEndPoint.MissionEndPointLongitude = editor.missionpoint.MissionPointLongitude;
@@ -202,45 +256,49 @@
             return missionEndPoint;
         }
 
-        public static TurningPoint[] SouJiu(FlightPlanEditor editor, TurningPoint[] turningPoints,int TransportNumber)
+        public static TurningPoint[] JijiangMiehuo(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].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].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)//生成从任务段终点到基地的航路点
+
+
+        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].SegmentFlightFuelConsumption = 3;
             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);
+            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;
@@ -251,19 +309,41 @@
                 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;
+
+            turningPoints[Length + 1].TurningPointName = "降高";
+            turningPoints[Length + 1].TurningPointLongitude = lon2;
+            turningPoints[Length + 1].TurningPointLatitude = lat2;
+            turningPoints[Length + 1].TurningPointHeight = 2000;
+            turningPoints[Length + 1].TurningPointType = "普通";
+            turningPoints[Length + 1].SegmentFlightFuelConsumption = 4;
+            turningPoints[Length + 1].SegmentFlightTime = 0;
+            turningPoints[Length + 1].RemainingFuel = 0;
+
 
             return turningPoints;
         }
-        public static TurningPoint[] FXJHTPDiedai(FlightPlanEditor editor,TurningPoint[] turningPoints,int FXJHTPLength)//各航段飞行时间、油耗计算和航路点油耗迭代
+        
+        
+        
+        public static void InitializeVelocities(FlightPlanEditor editor, 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, 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 TurningPoint[] FXJHTPDiedai(FlightPlanEditor editor, TurningPoint[] turningPoints,
+            int FXJHTPLength, double[] velocitys, double[] fuelConsumptions) //各航段飞行时间、油耗计算和航路点油耗迭代
         {
             TurningPoint[] FXJHTP = turningPoints;
             int i;
@@ -272,9 +352,7 @@
             double[] y = new double[FXJHTPLength];
             double[] z = new double[FXJHTPLength];
 
-            double TIME_STEP = 10; // 每10秒计算一次
-
-            for (i = 0; i < FXJHTPLength; i++)//LLA坐标转换为ECEF坐标
+            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;
@@ -288,27 +366,63 @@
                 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)
+                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) );
+                        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));
+                        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 (FXJHTP[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;
+                    }
+
+                    // 使用计算得到的速度计算飞行时间
+                    FXJHTP[i].SegmentFlightTime = CalculateSegmentFlightTime(distanceab, velocity);
+
+                    double CalculateSegmentFlightTime(double distance, double velocity)
+                    {
+                        return distance * 3.6 / velocity; // 根据速度计算飞行时间
                     }
-                    FXJHTP[i].SegmentFlightTime = distanceab * 3.6 / FXJHTP[i].TurningPointVelocity;
                 }
                 else
                 {
                     FXJHTP[i].SegmentFlightTime = FXJHTP[i].SegmentFlightTime;
                 }
             }
-           
+
 
             for (i = 0; i < FXJHTPLength; i++)
             {
@@ -322,50 +436,50 @@
                     remainingFuel = FXJHTP[i - 1].RemainingFuel;
                 }
 
-                for (double t = 0; t < FXJHTP[i].SegmentFlightTime; t += TIME_STEP)
+                double fuelConsumption = 0;
+                // 根据飞行段类型选择不同的燃油消耗率计算函数,1代表爬升,2代表平飞远航,3代表平飞久航,4代表下降,5代表悬停
+                switch (FXJHTP[i].SegmentFlightFuelConsumption)
                 {
-                    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;
-                        
-                    }
+                    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 * TIME_STEP / 3600; // 更新剩余燃油
+                remainingFuel -= fuelConsumption * FXJHTP[i].SegmentFlightTime / 3600; // 更新剩余燃油
 
-                    if (remainingFuel < 0)
-                    {
-                        remainingFuel = 0;
-                        break;
-                    }
+                if (remainingFuel < 0)
+                {
+                    remainingFuel = 0;
+                    break;
                 }
+
                 FXJHTP[i].RemainingFuel = remainingFuel;
             }
 
             return FXJHTP;
         }
-        
-        public static void FXJHTPPrint(TurningPoint[] FXJHTP,int FXJHTPLength)//航路点打印
+
+        public static void FXJHTPPrint(TurningPoint[] FXJHTP, int FXJHTPLength) //航路点打印
         {
             int i;
-            for(i=0;i<FXJHTPLength;i++)
+            for (i = 0; i < FXJHTPLength; i++)
             {
-                Console.WriteLine("航路点序号: {0}", i + 1);// {0}是占位符,在字符串中插入变量的值
+                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);
@@ -373,19 +487,29 @@
                 Console.WriteLine("航路点海拔: {0}", FXJHTP[i].TurningPointHeight);
             }
         }
-        public static CurrentLocation GetCurrentLocation(TurningPoint[] turningPoints,FlightPlanEditor editor,double nowtime)
+
+        /// <summary>
+        /// 巡护用
+        /// </summary>
+        /// <param name="turningPoints"></param>
+        /// <param name="editor"></param>
+        /// <param name="nowtime"></param>
+        /// <returns></returns>
+        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
+            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++)
+            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++)
+
+            for (i = 0; i < editor.airroute.Length + 2; i++)
             {
                 if ((nowtime - timetable[i]) >= 0)
                 {
@@ -396,9 +520,22 @@
                     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.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;
@@ -406,21 +543,31 @@
 
             return currentLocation;
         }
+
         //改
-        public static CurrentLocation GetAllCurrentLocation(TurningPoint[] FXJHTP, int FXJHTPLength,double nowtime)//飞机实时位置打印
+        /// <summary>
+        /// 计算当前位置
+        /// </summary>
+        /// <param name="FXJHTP"></param>
+        /// <param name="FXJHTPLength"></param>
+        /// <param name="nowtime"></param>
+        /// <returns></returns>
+        public static CurrentLocation
+            GetAllCurrentLocation(TurningPoint[] FXJHTP, int FXJHTPLength, double nowtime) //飞机实时位置打印
         {
             CurrentLocation currentLocation = new CurrentLocation();
-            double[] timetable = new double[FXJHTPLength+1];
+            double[] timetable = new double[FXJHTPLength + 1];
             timetable[0] = 0;
-            int segmentnumber=-1;
+            int segmentnumber = -1;
             int i;
-            for(i=0;i<FXJHTPLength;i++)
+            for (i = 0; i < FXJHTPLength; i++)
             {
                 timetable[i + 1] = timetable[i] + FXJHTP[i].SegmentFlightTime;
             }
-            for(i=0;i<FXJHTPLength+1;i++)
+
+            for (i = 0; i < FXJHTPLength + 1; i++)
             {
-                if ((nowtime - timetable[i])>=0)
+                if ((nowtime - timetable[i]) >= 0)
                 {
                     segmentnumber += 1;
                 }
@@ -429,21 +576,48 @@
                     break;
                 }
             }
-            if(segmentnumber<FXJHTPLength-1)
+
+            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]);
+                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.CurrentFuel = FXJHTP[segmentnumber].RemainingFuel -
+                                              FXJHTP[segmentnumber].SegmentFlightFuelConsumption *
+                                              (nowtime - timetable[segmentnumber]);
             }
-            else if(segmentnumber == FXJHTPLength-1)
+            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]);
+                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.CurrentFuel = FXJHTP[segmentnumber].RemainingFuel -
+                                              FXJHTP[segmentnumber].SegmentFlightFuelConsumption *
+                                              (nowtime - timetable[segmentnumber]);
             }
             else
             {
@@ -451,82 +625,12 @@
                 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;
+                currentLocation.CurrentFuel = FXJHTP[segmentnumber - 1].RemainingFuel -
+                                              FXJHTP[segmentnumber - 1].SegmentFlightFuelConsumption *
+                                              FXJHTP[segmentnumber - 1].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;
+            return currentLocation;
         }
-
     }
 }

+ 0 - 7
Models/SimulationCommon/FlightPlanEditor.cs

@@ -17,13 +17,6 @@ public class FlightPlanEditor
     public MissionPoint missionpoint = new MissionPoint();
     [JsonProperty("火点")]
     public FirePoint[] firepoint = new FirePoint[1];
-    
-    [JsonProperty("爬升段")]
-    public ClimbSegment climbsegment = new ClimbSegment();
-    [JsonProperty("下降段")]
-    public DescentSegment descentsegment = new DescentSegment();
-    [JsonProperty("巡航段")]
-    public CruiseSegment cruisesegment = new CruiseSegment();
 
 }
 

+ 17 - 0
Models/SimulationCommon/FuelDB.cs

@@ -0,0 +1,17 @@
+namespace SimulationCommon;
+
+public class FuelDB
+{
+    public List<Fuel> data;
+}
+
+public class Fuel
+{
+    public double oilconsume;
+    public double speed;
+}
+
+public class Temperature
+{
+    public double value;
+}

+ 2 - 0
Models/SimulationCommon/TaskConfig.cs

@@ -16,6 +16,8 @@ public class MissionInformation
     public string StartTime;
     [JsonProperty("结束时间")]
     public string EndTime;
+    [JsonProperty("起飞准备时间")]
+    public double TakeoffPreparationTime;
     [JsonProperty("应用机型")]
     public string[] AircraftInfos;
     [JsonProperty("应用飞机编号")]

+ 72 - 0
Models/SimulationCommon/Util.cs

@@ -0,0 +1,72 @@
+using BHJD.DEMdll.Public;
+using Newtonsoft.Json;
+
+namespace SimulationCommon;
+
+public class Util
+{
+    public static string serverIp = "10.130.100.5";
+    public static string baseURl =  $"http://{serverIp}:7785//";
+    
+    public static Fuel GetFuel(string fName, string fType, string fState, string fTemperature, string fHeight, string fWeight)
+    {
+        Console.WriteLine($"fName:{fName},fType:{fType},fState:{fState},fTemperature:{fTemperature},fHeight:{fHeight},fWeight:{fWeight}");
+        IHttpHelper.HttpCmd cmd = new IHttpHelper.HttpCmd
+        {
+            m_RequestType = IHttpHelper.HttpRequestType.POST,
+            m_Addr = $"{baseURl}rescue-platform-service/api/v1/tbTables/queryOilConsumeInfo",
+        };
+        HttpHelper m_HttpHelper = new HttpHelper();
+        string json = JsonConvert.SerializeObject(new
+        {
+            fname = fName, ftype = fType, fstate = fState, ftemperature = fTemperature, fheight = fHeight,
+            fweight = fWeight
+        });
+
+        Fuel fuel = null;
+        try
+        {
+            string response = m_HttpHelper.HttpPost(cmd, json);
+            var fuelDb = JsonConvert.DeserializeObject<FuelDB>(response);
+
+            if (fuelDb.data.Count > 0)
+                fuel = fuelDb.data[0];
+            else
+            {
+                Console.WriteLine($"没有找到【{json}】对应的油耗信息");
+            }
+        }
+        catch (Exception e)
+        {
+            Console.WriteLine($"没有找到【{json}】对应的油耗信息");
+        }
+
+        return fuel;
+
+
+    }
+    
+    /// <summary>
+    /// 获取当前位置的温度
+    /// </summary>
+    /// <param name="varName"></param>
+    /// <param name="lon"></param>
+    /// <param name="lat"></param>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    public static double GetTemperature(double lon, double lat)
+    {
+        IHttpHelper.HttpCmd cmd = new IHttpHelper.HttpCmd
+        {
+            m_RequestType = IHttpHelper.HttpRequestType.GET,
+            m_Addr = $"{baseURl}rescue-platform-service/api/v1/attribute/getInfos",
+            m_Args = new List<string> { "varName","centerLon","centerLat","weather_date" }
+        };
+        
+        HttpHelper m_HttpHelper = new HttpHelper();
+        string response = m_HttpHelper.Request(cmd, new List<string> {  "t2m",lon.ToString(),lat.ToString(),"2024-01-01 12:00:00" });
+        var temp = JsonConvert.DeserializeObject<Temperature>(response);
+        Console.WriteLine(response);
+        return temp.value - 273;
+    }
+}

+ 10 - 10
SimulationServer/Component/EconomicalComponent.cs

@@ -51,16 +51,16 @@ public class EconomicalComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["经济性"] = new Dictionary<string, string>
         {
-            { "单机飞行员人数", Economical.单机飞行员人数.ToString() },
-            { "单机飞行工程师人数", Economical.单机飞行工程师人数.ToString() },
-            { "单机地面保障人数", Economical.单机地面保障人数.ToString() },
-            { "机场情况", Economical.机场情况.ToString() },
-            { "水库情况", Economical.水库情况.ToString() },
-            { "阻燃剂用量", Economical.阻燃剂用量.ToString() },
-            { "泡沫用量", Economical.泡沫用量.ToString() },
-            { "单机总油耗", Economical.单机总油耗.ToString() },
-            { "单机机场使用情况", Economical.单机机场使用情况.ToString() },
-            { "单机导航使用情况", Economical.单机导航使用情况.ToString() }
+            { "单机飞行员人数/人", Economical.单机飞行员人数.ToString() },
+            { "单机飞行工程师人数/人", Economical.单机飞行工程师人数.ToString() },
+            { "单机地面保障人数/人", Economical.单机地面保障人数.ToString() },
+            { "机场情况/-", Economical.机场情况.ToString() },
+            { "水库情况/-", Economical.水库情况.ToString() },
+            { "阻燃剂用量/-", Economical.阻燃剂用量.ToString() },
+            { "泡沫用量/-", Economical.泡沫用量.ToString() },
+            { "单机总油耗/kg", Economical.单机总油耗.ToString() },
+            { "单机机场使用情况/-", Economical.单机机场使用情况.ToString() },
+            { "单机导航使用情况/-", Economical.单机导航使用情况.ToString() }
         };
         return report;
     }

+ 16 - 15
SimulationServer/Component/StaticCapacityComponent.cs

@@ -40,13 +40,14 @@ public class StaticCapacity
 // 静态能力组件
 public class StaticCapacityComponent : Component
 {
+    public AircraftEntity aircraft;
     public StaticCapacity StaticCapacity = new StaticCapacity();
 
     public void FillData(AircraftDB db)
     {
         var aircraft = GetParent<AircraftMH>();
     
-        StaticCapacity.初次出动准备时间 = aircraft.FlightPlanEditor.aircraftparameter.TakeoffPreparationTime.ToString();
+        StaticCapacity.初次出动准备时间 = aircraft.TaskReadyTime.ToString();
         StaticCapacity.再次补给时间 = db.fjysj == null ? "0" : db.fjysj.ToString();
         StaticCapacity.任务载荷装载时间 = db.fjssj == null ? "0" : db.fjssj.ToString();;
         StaticCapacity.舱内载荷 = db.fzdnz == null ? "0" : db.fzdnz.ToString();
@@ -68,20 +69,20 @@ public class StaticCapacityComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["静态能力"] = new Dictionary<string, string>
         {
-            { "初次出动准备时间", StaticCapacity.初次出动准备时间.ToString() },
-            { "再次补给时间", StaticCapacity.再次补给时间.ToString() },
-            { "任务载荷装载时间", StaticCapacity.任务载荷装载时间.ToString() },
-            { "舱内载荷", StaticCapacity.舱内载荷.ToString() },
-            { "外吊挂载荷", StaticCapacity.外吊挂载荷.ToString() },
-            { "空投精度", StaticCapacity.空投精度.ToString() },
-            { "有效投放率", StaticCapacity.有效投放率.ToString() },
-            { "巡航飞行速度", StaticCapacity.巡航飞行速度.ToString() },
-            { "载荷飞行速度", StaticCapacity.载荷飞行速度.ToString() },
-            { "抗风等级", StaticCapacity.抗风等级.ToString() },
-            { "起降距离", StaticCapacity.起降距离.ToString() },
-            { "起降场地要求", StaticCapacity.起降场地要求.ToString() },
-            { "夜间作业能力", StaticCapacity.夜间作业能力.ToString() },
-            { "可靠性", StaticCapacity.可靠性.ToString() }
+            { "初次出动准备时间/s", StaticCapacity.初次出动准备时间.ToString() },
+            { "再次补给时间/s", StaticCapacity.再次补给时间.ToString() },
+            { "任务载荷装载时间/s", StaticCapacity.任务载荷装载时间.ToString() },
+            { "舱内载荷/kg", StaticCapacity.舱内载荷.ToString() },
+            { "外吊挂载荷/kg", StaticCapacity.外吊挂载荷.ToString() },
+            { "空投精度/-", StaticCapacity.空投精度.ToString() },
+            { "有效投放率/-", StaticCapacity.有效投放率.ToString() },
+            { "巡航飞行速度/km/h", StaticCapacity.巡航飞行速度.ToString() },
+            { "载荷飞行速度/km/h", StaticCapacity.载荷飞行速度.ToString() },
+            { "抗风等级/-", StaticCapacity.抗风等级.ToString() },
+            { "起降距离/m", StaticCapacity.起降距离.ToString() },
+            { "起降场地要求/-", StaticCapacity.起降场地要求.ToString() },
+            { "夜间作业能力/-", StaticCapacity.夜间作业能力.ToString() },
+            { "可靠性/-", StaticCapacity.可靠性.ToString() }
         };
         return report;
     }

+ 8 - 1
SimulationServer/Component/TaskComponent.cs

@@ -6,15 +6,21 @@ namespace SimulationServer;
 public class TaskComponent : Component
 {
     public static Weather Weather;
-    public static int Speed = 1000;
+    public static int Speed = 100;
     // 救援任务列表
     public List<MHRescueMission> MHRescueMissions;
     public List<XHRescueMission> XHRescueMissions;
+    public List<ZCRescueMission> ZCRescueMissions;
 
     public void Start()
     {
+        MHRescueMissions?.ForEach(r => r.Reset());
+        XHRescueMissions?.ForEach(r => r.Reset());
+        
+        
         MHRescueMissions?.ForEach(r => r.Start());
         XHRescueMissions?.ForEach(r => r.Start());
+        ZCRescueMissions?.ForEach(r => r.Start());
     }
 }
 
@@ -24,6 +30,7 @@ public class TaskComponentAwakeSystem : AwakeSystem<TaskComponent>
     public override void Awake(TaskComponent self)
     {
         self.MHRescueMissions = new List<MHRescueMission>();
+        self.ZCRescueMissions = new List<ZCRescueMission>();
         self.XHRescueMissions = new List<XHRescueMission>();
     }
 }

+ 12 - 12
SimulationServer/Component/TaskPerformanceComponent.cs

@@ -35,13 +35,13 @@ public class TaskPerformanceComponent : Component
     {
         var aircraft = GetParent<AircraftMH>();
         
-        TaskPerformance.任务准备时间 = aircraft.aircraftparameter.TakeoffPreparationTime.ToString();
+        TaskPerformance.任务准备时间 = aircraft.TaskReadyTime.ToString();
         TaskPerformance.单机入场时间 = aircraft.FirstTime.ToString("#0.00");
         TaskPerformance.单机有效任务时长 = aircraft.EffMisTime.ToString("#0.00");
-        TaskPerformance.单机总投送人数 = aircraft.aircraftparameter.MaxPassengerNumber.ToString();
+        TaskPerformance.单机总投送人数 = aircraft.FlightPlanEditor.aircraftparameter.MaxPassengerNumber.ToString();
         TaskPerformance.单机总洒水量 = ((double)db.fsslwater * aircraft.waterTimes).ToString();
         TaskPerformance.单机总灭火剂投放量 = "0";
-        TaskPerformance.单机单次投送人数 = aircraft.aircraftparameter.MaxPassengerNumber.ToString();
+        TaskPerformance.单机单次投送人数 = aircraft.FlightPlanEditor.aircraftparameter.MaxPassengerNumber.ToString();
         TaskPerformance.单机单次洒水量 = db.fsslwater.ToString();
         TaskPerformance.单机单次灭火剂投放量 = "0";
         
@@ -52,15 +52,15 @@ public class TaskPerformanceComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["任务表现"] = new Dictionary<string, string>
         {
-            { "任务准备时间", TaskPerformance.任务准备时间.ToString() },
-            { "单机入场时间", TaskPerformance.单机入场时间.ToString() },
-            { "单机有效任务时长", TaskPerformance.单机有效任务时长.ToString() },
-            { "单机总投送人数", TaskPerformance.单机总投送人数.ToString() },
-            { "单机总洒水量", TaskPerformance.单机总洒水量.ToString() },
-            { "单机总灭火剂投放量", TaskPerformance.单机总灭火剂投放量.ToString() },
-            { "单机单次投送人数", TaskPerformance.单机单次投送人数.ToString() },
-            { "单机单次洒水量", TaskPerformance.单机单次洒水量.ToString() },
-            { "单机单次灭火剂投放量", TaskPerformance.单机单次灭火剂投放量.ToString() }
+            { "任务准备时间/s", TaskPerformance.任务准备时间.ToString() },
+            { "单机入场时间/s", TaskPerformance.单机入场时间.ToString() },
+            { "单机有效任务时长/s", TaskPerformance.单机有效任务时长.ToString() },
+            { "单机总投送人数/人", TaskPerformance.单机总投送人数.ToString() },
+            { "单机总洒水量/kg", TaskPerformance.单机总洒水量.ToString() },
+            { "单机总灭火剂投放量/kg", TaskPerformance.单机总灭火剂投放量.ToString() },
+            { "单机单次投送人数/人", TaskPerformance.单机单次投送人数.ToString() },
+            { "单机单次洒水量/kg", TaskPerformance.单机单次洒水量.ToString() },
+            { "单机单次灭火剂投放量/kg", TaskPerformance.单机单次灭火剂投放量.ToString() }
         };
         return report;
     }

+ 8 - 8
SimulationServer/Component/TotalEconomicalComponent.cs

@@ -46,14 +46,14 @@ public class TotalEconomicalComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["总经济性"] = new Dictionary<string, string>
         {
-            { "火灾总面积", TotalEconomical.火灾总面积.ToString() },
-            { "火灾死亡人数", TotalEconomical.火灾死亡人数.ToString() },
-            { "火灾总受伤人数", TotalEconomical.火灾总受伤人数.ToString() },
-            { "总获救人员数量", TotalEconomical.总获救人员数量.ToString() },
-            { "火灾死亡总人数", TotalEconomical.火灾死亡总人数.ToString() },
-            { "火灾受伤总人数", TotalEconomical.火灾受伤总人数.ToString() },
-            { "总获救财产", TotalEconomical.总获救财产.ToString() },
-            { "总损失财产", TotalEconomical.总损失财产.ToString() }
+            { "火灾总面积/m2", TotalEconomical.火灾总面积.ToString() },
+            { "火灾死亡人数/人", TotalEconomical.火灾死亡人数.ToString() },
+            { "火灾总受伤人数/人", TotalEconomical.火灾总受伤人数.ToString() },
+            { "总获救人员数量/人", TotalEconomical.总获救人员数量.ToString() },
+            { "火灾死亡总人数/人", TotalEconomical.火灾死亡总人数.ToString() },
+            { "火灾受伤总人数/人", TotalEconomical.火灾受伤总人数.ToString() },
+            { "总获救财产/w", TotalEconomical.总获救财产.ToString() },
+            { "总损失财产/w", TotalEconomical.总损失财产.ToString() }
         };
         return report;
     }

+ 17 - 15
SimulationServer/Component/TotalTaskPerformanceComponent.cs

@@ -23,14 +23,9 @@ public class TotalTaskPerformanceComponent : Component
     {
         var mission = GetParent<MHRescueMission>();
 
-        double x = 18000;
-        double y1 = 0.3096 * Math.Pow(x, 0.4893);
-        double y2 = 1004.4520 * Math.Pow(x, 0.2193);
-        double y3 = 0.2312 * Math.Pow(y1, 1.1668);
-        double deadRoundedInt = Math.Round(y3);
-        double injuredRoundedInt = Math.Round(y1-y3);
+       
         
-        TotalTaskPerformance.任务响应时间 = mission.Aircrafts.First().TaskResponseTime.ToString("#0.00");
+        TotalTaskPerformance.任务响应时间 = mission.aircrafts.First().TaskResponseTime.ToString("#0.00");
         TotalTaskPerformance.总任务耗时 = mission.tn.ToString("#0.00");
         TotalTaskPerformance.任务是否成功 = mission.Success ? "成功" : "失败";
         
@@ -49,6 +44,13 @@ public class TotalTaskPerformanceComponent : Component
         
         TotalTaskPerformance.过火面积 = end.burnarea.ToString("#0.00");
         
+        double x = end.burnarea;
+        double y1 = 0.3096 * Math.Pow(x, 0.4893);
+        double y2 = 1004.4520 * Math.Pow(x, 0.2193);
+        double y3 = 0.2312 * Math.Pow(y1, 1.1668);
+        double deadRoundedInt = Math.Round(y3);
+        double injuredRoundedInt = Math.Round(y1-y3);
+        
         TotalTaskPerformance.伤亡人数 = (deadRoundedInt + injuredRoundedInt).ToString();
     }
 
@@ -57,14 +59,14 @@ public class TotalTaskPerformanceComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["总任务表现"] = new Dictionary<string, string>
         {
-            { "任务响应时间", TotalTaskPerformance.任务响应时间.ToString() },
-            { "总任务耗时", TotalTaskPerformance.总任务耗时.ToString() },
-            { "任务成功率", TotalTaskPerformance.任务是否成功.ToString() },
-            { "火场面积变化率", TotalTaskPerformance.火场面积变化率.ToString() },
-            { "蔓延速度变化率", TotalTaskPerformance.蔓延速度变化率.ToString() },
-            { "直接灭火面积", TotalTaskPerformance.直接灭火面积.ToString() },
-            { "过火面积", TotalTaskPerformance.过火面积.ToString() },
-            { "伤亡人数", TotalTaskPerformance.伤亡人数.ToString() }
+            { "任务响应时间/s", TotalTaskPerformance.任务响应时间.ToString() },
+            { "总任务耗时/s", TotalTaskPerformance.总任务耗时.ToString() },
+            { "任务成功率/-", TotalTaskPerformance.任务是否成功.ToString() },
+            { "火场面积变化率/m2/s", TotalTaskPerformance.火场面积变化率.ToString() },
+            { "蔓延速度变化率m2/s2", TotalTaskPerformance.蔓延速度变化率.ToString() },
+            { "直接灭火面积/m2", TotalTaskPerformance.直接灭火面积.ToString() },
+            { "过火面积/m2", TotalTaskPerformance.过火面积.ToString() },
+            { "伤亡人数/人", TotalTaskPerformance.伤亡人数.ToString() }
         };
        return report;
     }

+ 7 - 7
SimulationServer/Component/XHEconomicalComponent.cs

@@ -36,13 +36,13 @@ public class XHEconomicalComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["经济性"] = new Dictionary<string, string>
         {
-            { "单机飞行员人数", XhEconomical.单机飞行员人数.ToString() },
-            { "单机飞行工程师人数", XhEconomical.单机飞行工程师人数.ToString() },
-            { "单机地面保障人数", XhEconomical.单机地面保障人数.ToString() },
-            { "单机总任务时长", XhEconomical.单机总任务时长.ToString() },
-            { "单机总油耗", XhEconomical.单机总油耗.ToString() },
-            { "单机机场使用情况", XhEconomical.单机机场使用情况.ToString() },
-            { "单机导航使用情况", XhEconomical.单机导航使用情况.ToString() }
+            { "单机飞行员人数/人", XhEconomical.单机飞行员人数.ToString() },
+            { "单机飞行工程师人数/人", XhEconomical.单机飞行工程师人数.ToString() },
+            { "单机地面保障人数/人", XhEconomical.单机地面保障人数.ToString() },
+            { "单机总任务时长/s", XhEconomical.单机总任务时长.ToString() },
+            { "单机总油耗/kg", XhEconomical.单机总油耗.ToString() },
+            { "单机机场使用情况/-", XhEconomical.单机机场使用情况.ToString() },
+            { "单机导航使用情况/-", XhEconomical.单机导航使用情况.ToString() }
         };
         return report;
     }

+ 6 - 6
SimulationServer/Component/XHStaticCapacityComponent.cs

@@ -35,15 +35,15 @@ public class XHStaticCapacityComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["静态能力"] = new Dictionary<string, string>
         {
-            { "巡护速度", XhStaticCapacity.巡护速度.ToString() },
+            { "巡护速度/km/h", XhStaticCapacity.巡护速度.ToString() },
             { "巡护航程", XhStaticCapacity.巡护航程.ToString() },
             { "有效探测距离", XhStaticCapacity.有效探测距离.ToString() },
-            { "虚警概率", XhStaticCapacity.虚警概率.ToString() },
-            { "遗漏概率", XhStaticCapacity.遗漏概率.ToString() },
-            { "吊桶载人巡护能力", XhStaticCapacity.吊桶载人巡护能力.ToString() },
+            { "虚警概率/-", XhStaticCapacity.虚警概率.ToString() },
+            { "遗漏概率/-", XhStaticCapacity.遗漏概率.ToString() },
+            { "吊桶载人巡护能力/-", XhStaticCapacity.吊桶载人巡护能力.ToString() },
             { "抗风等级", XhStaticCapacity.抗风等级.ToString() },
-            { "夜间作业能力", XhStaticCapacity.夜间作业能力.ToString() },
-            { "可靠性", XhStaticCapacity.可靠性.ToString() }
+            { "夜间作业能力/-", XhStaticCapacity.夜间作业能力.ToString() },
+            { "可靠性/-", XhStaticCapacity.可靠性.ToString() }
         };
         return report;
     }

+ 6 - 6
SimulationServer/Component/XHTotalTaskPerformanceComponent.cs

@@ -40,12 +40,12 @@ public class XHTotalTaskPerformanceComponent : Component
         Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
         report["总任务表现"] = new Dictionary<string, string>
         {
-            { "总巡护耗时", XhTotalTaskPerformance.总巡护耗时.ToString() },
-            { "火情入场时间", XhTotalTaskPerformance.火情入场时间.ToString() },
-            { "昼间空间覆盖率", XhTotalTaskPerformance.昼间空间覆盖率.ToString() },
-            { "夜间空间覆盖率", XhTotalTaskPerformance.夜间空间覆盖率.ToString() },
-            { "综合虚警概率", XhTotalTaskPerformance.综合虚警概率.ToString() },
-            { "空间遗漏概率", XhTotalTaskPerformance.空间遗漏概率.ToString() }
+            { "总巡护耗时/s", XhTotalTaskPerformance.总巡护耗时.ToString() },
+            { "火情入场时间/s", XhTotalTaskPerformance.火情入场时间.ToString() },
+            { "昼间空间覆盖率/-", XhTotalTaskPerformance.昼间空间覆盖率.ToString() },
+            { "夜间空间覆盖率/-", XhTotalTaskPerformance.夜间空间覆盖率.ToString() },
+            { "综合虚警概率/-", XhTotalTaskPerformance.综合虚警概率.ToString() },
+            { "空间遗漏概率/-", XhTotalTaskPerformance.空间遗漏概率.ToString() }
         };
         return report;
     }

+ 65 - 0
SimulationServer/Entity/AircraftEntity.cs

@@ -0,0 +1,65 @@
+using KYFramework;
+using Model;
+using SimulationServer.Utils;
+
+namespace SimulationServer;
+
+public class AircraftEntity : Entity
+{
+    public string TaskName { get; set; } // 任务名称
+    public string Name { get; set; } // 飞机名称
+    public string AircraftId { get; set; } // 飞机编号
+    
+    public string AircraftIndex { get; set; } // 飞机索引
+    public string Type { get; set; } // 飞机类型
+    public AircraftDB Db { get; set; } // 飞机数据库参数
+    public FlightPlanEditor? FlightPlanEditor { get; set; } // 飞行计划编辑器
+    public string Airport { get; set; } // 飞机机场
+    public double T { get; set; } // 飞机飞到火场需要的时间
+    public double TotalFuelConsumption { get; set; } // 总燃油消耗
+    public double FirstTime { get; set; } //单机入场时间
+    public double TaskResponseTime { get; set; } // 任务响应时间
+    public double EffMisTime { get; set; } // 单机有效任务时长
+    public double TaskReadyTime { get; set; } // 任务准备时间
+    
+    public double[] Velocitys = new double[5]{220,220,220,110,0}; // 速度
+    public double[] FuelConsumptions = new double[5]{2800,2800,2800,1000,132}; // 燃油消耗
+
+    public TurningPoint[] TurningPoints { get; set; } = new TurningPoint[2000];// 航路点
+
+
+    public void Awake()
+    {
+        Db = Util.GetAircraftDefine(FlightPlanEditor.aircraftparameter.AircraftType,FlightPlanEditor.aircraftparameter.AircraftSubType,FlightPlanEditor.aircraftparameter.AircraftID);
+    }
+    
+    public virtual void Reset()
+    {
+        T = 0;
+        EffMisTime = 0;
+        FirstTime = 0;
+        TotalFuelConsumption = 0;
+        TaskResponseTime = 0;
+        TurningPoints = new TurningPoint[2000];
+        for (int i = 0; i < TurningPoints.Length; i++)
+        {
+            TurningPoints[i] = new TurningPoint();
+        }
+    }
+
+    public virtual void Start()
+    {
+        
+    }
+    
+    
+    public virtual void Update(double time)
+    {
+        
+    }
+    
+    public virtual void End()
+    {
+        
+    }
+}

+ 56 - 73
SimulationServer/Entity/AircraftMH.cs

@@ -1,99 +1,85 @@
 using KYFramework;
 using Model;
-using SimulationServer.Utils;
+using MongoDB.Bson;
 using Define = SimulationServer.Utils.Define;
 
 namespace SimulationServer;
 
-public class AircraftMH : Entity ,IAircraft
+public class AircraftMH : AircraftEntity
 {
-    public string TaskName;
-    public AircraftParameter aircraftparameter;
-    public string Name; // 飞机名称
-    public string Type = "中型直升机"; // 飞机类型
     public double SprinklerArea = 1500; // 飞机速度
     public string NextMissionId; // 下一个任务ID
-    public AircraftDB Db;
-    public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
-    
     public FireGround fireGround;
     public MHRescueMission mhRescueMission;
- 
-    public TurningPoint[] turningPoints = new TurningPoint[2000];
-    private int PointNumberIcon = 0;
-    public double T { get; set; } // 飞机开始飞到火场 需要多少时间
     private int waterInterval = 4;  // 洒水间隔
     public int waterTimes = 1; // 洒水次数
-    public double ReadyTime;
-    public double EnterTime; // 单机入场时间
-    public double EffMisTime;// 单机有效任务时长
-    public string Airport;
-    public double FirstTime = 0; // 单机入场时间
-    public double TaskResponseTime; //任务响应时间
-    public double TotalFuelConsumption;
 
+    private int PointNumberIcon = 0;
+    public Queue<double> WaterTimeQueue = new Queue<double>();
     
     //任务重置
-    public void Reset()
+    public override void Reset()
     {
-        T = 0;
-        EffMisTime = 0;
-        FirstTime = 0;
         PointNumberIcon = 0;
-   
         waterTimes = 1;
-        TotalFuelConsumption = 0;
-        TaskResponseTime = 0;
         waterInterval = 4;
-        
-        
-        turningPoints = new TurningPoint[2000];
-        for (int i = 0; i < turningPoints.Length; i++)
-        {
-            turningPoints[i] = new TurningPoint();
-        }
+        base.Reset();        
     }
     
     // 任务开始
-    public void Start()
+    public override void Start()
     {
-        turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
-        
+        TurningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,TurningPoints);//生成从起点到任务段起点的航路点
         // 计算出第一次洒水的时间
-        turningPoints = FXJHGenerate.MieHuo1(FlightPlanEditor, turningPoints, PointNumberIcon);
-            
-        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,turningPoints, PointNumberIcon*3+2);
-            
-        if (waterInterval == 4)
+        TurningPoints = FXJHGenerate.MieHuo1(FlightPlanEditor, TurningPoints, 0);
+        
+        // FXJHGenerate.InitializeVelocities(FlightPlanEditor, TurningPoints, ref Velocitys);
+        // FXJHGenerate.InitializeFuelConsumptions(FlightPlanEditor, TurningPoints,ref FuelConsumptions);
+        
+        TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,TurningPoints, PointNumberIcon*3+2, Velocitys, FuelConsumptions);
+        for (int i = 0; i < waterInterval; i++)
         {
-            for (int i = 0; i < waterInterval; i++)
-            {
-                T += turningPoints[i].SegmentFlightTime;
-            }
-                
-            TaskResponseTime = T;
+            T += TurningPoints[i].SegmentFlightTime;
         }
+        
+        TaskResponseTime = T;
         if (FirstTime == 0) FirstTime = T;
     }
 
     // 任务结束
-    public void End()
+    public override void End()
     {
-        for(int i=0;i<5;i++)
-        {
-            EnterTime += turningPoints[i].SegmentFlightTime;
-        }
+        MissionEndPoint missionEndPoint = new MissionEndPoint();
+        missionEndPoint.MissionEndPointLatitude = fireGround.FirePoint.Latitude;
+        missionEndPoint.MissionEndPointLongitude = fireGround.FirePoint.Longitude;
+        missionEndPoint.MissionEndPointHeight = fireGround.FirePoint.Altitude;
+
+        TurningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, missionEndPoint, TurningPoints,PointNumberIcon+ 3);
+
+        TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,TurningPoints, PointNumberIcon+ 3, Velocitys, FuelConsumptions);
+        
+        EffMisTime = mhRescueMission.tn - TaskResponseTime;
+        
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[PointNumberIcon + 3].RemainingFuel;
+
+        // for (int i = 0; i < 50; i++)
+        // {
+        //     Log.Info(Name + "   " + AircraftIndex  + "    " +TurningPoints[i].ToJson());
+        // }
+        
         
-        for(int i=1;i<=(PointNumberIcon/4);i++)
+        // 记录洒水时间 发送给前端洒水事件
+        for (int i = 2; i < waterTimes * 2 + 1; i+=2)
         {
-            EffMisTime += turningPoints[i * 4 + 1].SegmentFlightTime;
+            WaterTimeQueue.Enqueue(TurningPoints[i].SegmentFlightTime);
         }
-
-        TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[PointNumberIcon + 3].RemainingFuel;
+        
+        //CurrentLocation currentLocation = FXJHGenerate.GetAllCurrentLocation(TurningPoints, PointNumberIcon + 3,1);
     }
     
+    
     // 更新
-    public void Update(double time)
+    public override void Update(double time)
     {
         if (fireGround.countArea.burnarea > 0) // 灭火完成
         {
@@ -101,28 +87,29 @@ public class AircraftMH : Entity ,IAircraft
             {
                 // 开始洒水
                 fireGround.countArea = Fire.burnCalculate(Define.WIND, mhRescueMission.slope, T, fireGround.countArea.burnarea, T, mhRescueMission.tn , fireGround.countArea.burnarea);
-                var currentArea =  Fire.SprinklerArea(Type, SprinklerArea) ; // 本次有效洒水面积
+                var currentArea =  Fire.SprinklerArea(Type, SprinklerArea/2) ; // 本次有效洒水面积
               
-                // Log.Info("fireGround.countArea.burnarea: " + _fireGround.countArea.burnarea);
-                // Log.Info("currentArea: " + currentArea);
-                
                 fireGround.countArea.burnarea -= currentArea;
                 mhRescueMission.area += currentArea; // 有效洒水面积
-                //Log.Info($"任务 {TaskName }  {Name} 洒水{waterTimes} 次  本次有效洒水面积 {currentArea}  用时 {T}  area {mhRescueMission.area}  burnarea {fireGround.countArea.burnarea}");
+                Log.Info($"任务 {TaskName }  {Name} 洒水{waterTimes} 次  本次有效洒水面积 {currentArea}  用时 {T}  area {mhRescueMission.area}  burnarea {fireGround.countArea.burnarea}");
                 
                 mhRescueMission.tn = T;
+                
+                
                 PointNumberIcon += 2;
                 waterTimes++;
                 // 计算出下一次洒水的时间
-                turningPoints = FXJHGenerate.MieHuo1(FlightPlanEditor, turningPoints, PointNumberIcon);
-            
-                turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,turningPoints, PointNumberIcon + 2);
+                TurningPoints = FXJHGenerate.MieHuo1(FlightPlanEditor, TurningPoints,PointNumberIcon);
+                TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,TurningPoints, PointNumberIcon + 3, Velocitys, FuelConsumptions);
+         
                 
                 for (int i = waterInterval - 2; i < waterInterval; i++)
                 {
-                    T += turningPoints[i].SegmentFlightTime;
+                    T += TurningPoints[i].SegmentFlightTime;
                 }
-                waterInterval += 2; 
+                
+                Log.Info(Name + "   " + AircraftIndex  + "    下次洒水时间 " + T);
+                waterInterval += 2;    
             }
         }
     }
@@ -135,16 +122,12 @@ public class AircraftAwakeSystem : AwakeSystem<AircraftMH,FlightPlanEditor>
     {
         self.FlightPlanEditor = flightPlanEditor;
         // 读取数据库
-        
-        self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
-        
+        self.Awake();
         if (self.Db != null)
         {
             self.Type = self.Db?.fConcreateType.ToString();
-            self.SprinklerArea = (double)self.Db.fpsmj;
             self.SprinklerArea = (double)self.Db?.fpsmj;
         }
-        
         self.Reset();
     }
 }

+ 26 - 44
SimulationServer/Entity/AircraftMHWithPersion.cs

@@ -5,69 +5,53 @@ using Define = SimulationServer.Utils.Define;
 
 namespace SimulationServer;
 
-public class AircraftMHWithPersion : Entity ,IAircraft
+public class AircraftMHWithPersion : AircraftEntity
 {
-    public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
-    public TurningPoint[] turningPoints = new TurningPoint[2000];
     public string NextMissionId; // 下一个任务ID
     public MissionEndPoint missionEndPoint = new MissionEndPoint();
     public int GroundPersonnel;
     public int LandingPersonnel;
     public MHRescueMission mhRescueMission;
     // 频率
-    public string TaskName;
     public double Frequency = 10 * 60;
     public FireGround fireGround;
- 
-    public double T
-    {
-        get;
-        set;
-    } // 飞机开始飞到火场 需要多少时间
-    
+
     private int InterventionNumber = 0;
     private double InterventionTime;//介入时间
     private int waterTimes = 1; // 洒水次数
-    public double TotalFuelConsumption;
     
-    public void End()
+    public override void End()
     {
-        turningPoints = null;
+        
     }
 
-    public void Reset()
+    public override void Reset()
     {
-        T = 0;
         InterventionTime = 0;
-        TotalFuelConsumption = 0;
         InterventionNumber = 0;
         waterTimes = 1;
-        
-        
-        turningPoints = new TurningPoint[2000];
-        for (int i = 0; i < turningPoints.Length; i++)
-        {
-            turningPoints[i] = new TurningPoint();
-        }
-       
+        base.Reset();       
     }
-    public void Start()
+    public override void Start()
     {
-        turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
+        TurningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,TurningPoints);//生成从起点到任务段起点的航路点
         
         missionEndPoint.MissionEndPointLatitude = FlightPlanEditor.missionpoint.MissionPointLatitude;
         missionEndPoint.MissionEndPointLongitude = FlightPlanEditor.missionpoint.MissionPointLongitude;
         missionEndPoint.MissionEndPointHeight = FlightPlanEditor.missionpoint.MissionPointHeight;
         
         int TransportNumber = (int)Math.Ceiling(LandingPersonnel / FlightPlanEditor.aircraftparameter.MaxPassengerNumber);
-        
-        for (int i = 0; i < TransportNumber; i += 2)
+        int j = 0;
+        for (int i = 0; i < TransportNumber; i ++)
         {
-            turningPoints = FXJHGenerate.JijiangMiehuo(FlightPlanEditor, turningPoints, i);
+            TurningPoints = FXJHGenerate.JijiangMiehuo(FlightPlanEditor, TurningPoints, j);
+            j += 2;
         }
-
-        turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, missionEndPoint, turningPoints, 2 + TransportNumber * 2);
-        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, 4 + TransportNumber * 2);
+        // FXJHGenerate.InitializeVelocities(FlightPlanEditor, TurningPoints, ref Velocitys);
+        // FXJHGenerate.InitializeFuelConsumptions(FlightPlanEditor, TurningPoints,ref FuelConsumptions);
+        
+        TurningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, missionEndPoint, TurningPoints, 2 + TransportNumber * 2);
+        TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, TurningPoints, 4 + TransportNumber * 2, Velocitys, FuelConsumptions);
 
         double TravelSpeed=5;//行进速度,km/h
         double distance = GetDistance(FlightPlanEditor.missionpoint.MissionPointLongitude, FlightPlanEditor.firepoint[0].FirePointLongitude, FlightPlanEditor.missionpoint.MissionPointLatitude, FlightPlanEditor.firepoint[0].FirePointLatitude);
@@ -76,22 +60,22 @@ public class AircraftMHWithPersion : Entity ,IAircraft
         //Log.Info("距离:" + distance);
         
         //Log.Info($"起飞准备时间: {FlightPlanEditor.aircraftparameter.TakeoffPreparationTime}");
-        InterventionTime = FlightPlanEditor.aircraftparameter.TakeoffPreparationTime + TravelTime ;
+        InterventionTime = TaskReadyTime + TravelTime ;
         
         //Log.Info($"人走到火场的时间: {InterventionTime}");
-        
+    
         for (int i = 0;i < TransportNumber;i ++)
         {
             //Log.Info($"飞行时间{i}: {turningPoints[i].SegmentFlightTime}");
-            InterventionTime += turningPoints[i].SegmentFlightTime;
+            InterventionTime += TurningPoints[i].SegmentFlightTime;
         }
         
         //Log.Info($"介入时间 {InterventionTime}");
 
         InterventionNumber = LandingPersonnel + GroundPersonnel;
         T = InterventionTime;
-        
-        TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[TransportNumber * 2 + 3].RemainingFuel;
+    
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[TransportNumber * 2 + 3].RemainingFuel;
         T += Frequency;
         
         //Log.Info($"机降  洒水之前火场面积:" + _fireGround.countArea.burnarea);
@@ -111,24 +95,21 @@ public class AircraftMHWithPersion : Entity ,IAircraft
         return distance;
     }
     
-    public void Update(double time)
+    public override void Update(double time)
     {
         if (fireGround.countArea.burnarea > 0) // 灭火完成
         {
-            //Log.Info(T.ToString());
             if (time > T)
             {
-                //Log.Info("洒水之前火场面积:" + _fireGround.countArea.burnarea);
-                //Log.Info("时间差:" + (_rescueMission.tn - T));
                 // 开始洒水
                 fireGround.countArea = Fire.burnCalculate(Define.WIND, mhRescueMission.slope, T, fireGround.countArea.burnarea, T, mhRescueMission.tn, fireGround.countArea.burnarea);
                 var currentArea = Fire.groundPersonnelWater(InterventionNumber);
-                //Log.Info("洒水之后火场面积:" + _fireGround.countArea.burnarea);
+
                 fireGround.countArea.burnarea -= currentArea;
                 mhRescueMission.tn = T;
                 mhRescueMission.area += currentArea; // 有效洒水面积;
             
-                //Log.Info($"任务 {TaskName} 地面灭火 洒水{waterTimes} 次  本次有效洒水面积 {currentArea}   用时 {T}  area {mhRescueMission.area} burnarea {fireGround.countArea.burnarea}");
+                Log.Info($"任务 {TaskName} 地面灭火 洒水{waterTimes} 次  本次有效洒水面积 {currentArea}   用时 {T}  area {mhRescueMission.area} burnarea {fireGround.countArea.burnarea}");
                 waterTimes++;
                 
                 T +=  Frequency;//飞机开始飞到火场 需要多少时间 t
@@ -144,6 +125,7 @@ public class AircraftMHWithPersionAwakeSystem : AwakeSystem<AircraftMHWithPersio
     public override void Awake(AircraftMHWithPersion self,FlightPlanEditor flightPlanEditor)
     {
         self.FlightPlanEditor = flightPlanEditor;
+        self.Awake();
         self.Reset();
     }
 }

+ 10 - 21
SimulationServer/Entity/AircraftSHJ.cs

@@ -1,39 +1,30 @@
 using KYFramework;
 using Model;
-using MongoDB.Bson;
-using MuShiApp;
-using SimulationServer.Utils;
-using SimulationSingleServer.Utils;
 
 namespace SimulationServer;
 
-public class AircraftSHJ : Entity
+public class AircraftSHJ : AircraftEntity
 {
-    public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
-    public TurningPoint[] turningPoints = new TurningPoint[200];
-    public AircraftDB Db;
     public SHJTask content;
-    public double TotalFuelConsumption;
-
-    public void End()
+    public override void End()
     {
-        TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[5].RemainingFuel;
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[5].RemainingFuel;
     }
     
-    public void Awake()
+    public override void Start()
     {
-        for (int i = 0; i < turningPoints.Length; i++)
+        for (int i = 0; i < TurningPoints.Length; i++)
         {
-            turningPoints[i] = new TurningPoint();
+            TurningPoints[i] = new TurningPoint();
         }
         
-        turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
+        TurningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,TurningPoints);//生成从起点到任务段起点的航路点
         double resulttime = Cable_slippage.get_result_time_rope(content.H,content.personNumber,content.windspeed,content.vis,content.descendspeed).time;//索滑降模型输出的索滑降时间
-        turningPoints = FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor, turningPoints);
+        TurningPoints = FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor, TurningPoints);
         
         
-        turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor), turningPoints, 3);
-        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, 5);
+        TurningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor), TurningPoints, 3);
+        TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, TurningPoints, 5, Velocitys, FuelConsumptions);
 
     }
 }
@@ -45,8 +36,6 @@ public class AircraftSHJAwakeSystem : AwakeSystem<AircraftSHJ,FlightPlanEditor,S
     {
         self.content = shjTask;
         self.FlightPlanEditor = flightPlanEditor;
-        // 读取数据库
-       self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
         self.Awake();
     }
 }

+ 46 - 45
SimulationServer/Entity/AircraftXH.cs

@@ -11,16 +11,13 @@ namespace SimulationServer;
 public class AircraftXH : Entity
 {
     public string Name; // 飞机名称
-    public string Type; // 飞机类型
-    public double SprinklerArea; // 飞机速度
     public string NextMissionId; // 下一个任务ID
     public AircraftDB Db;
-    public Weather Weather;
     public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
     public TurningPoint[] turningPoints = new TurningPoint[200];
     public CurrentLocation currentLocation;
     public EquationHelper helper;
-    
+    public XHRescueMission mission;
     
     public double TotalTime;// 单机总效任务时长
     public double TotalFuelConsumption; 
@@ -31,9 +28,13 @@ public class AircraftXH : Entity
     private double finalProbability = 1.0;
     private bool isSeeFire = false;
     public bool isOver = false;
-
+    public double TaskReadyTime;
+    
+    public double[] Velocitys = new double[5]; // 速度
+    public double[] FuelConsumptions = new double[5]; // 燃油消耗
     public void Awake()
     {
+        turningPoints = new TurningPoint[200];
         for (int i = 0; i < turningPoints.Length; i++)
         {
             turningPoints[i] = new TurningPoint();
@@ -42,38 +43,38 @@ public class AircraftXH : Entity
         turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
         
         turningPoints = FXJHGenerate.XunHu(FlightPlanEditor, turningPoints);//生成巡航航路点
-        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, FlightPlanEditor.airroute.Length + 2);//生成从任务段终点到结束点的航路点
+        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, FlightPlanEditor.airroute.Length + 2,Velocitys,FuelConsumptions);//生成从任务段终点到结束点的航路点
         
         currentLocation = new CurrentLocation();
-        helper = new EquationHelper(HttpInterface.baseUrl);
+       
     }
     public void End()
     {
-        
         for (int i = 0; i < currentLocation.Currentsegnum + 2; i++)
         {
             TotalTime += turningPoints[i].SegmentFlightTime;
         }
-        
         TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[currentLocation.Currentsegnum + 1].RemainingFuel;
     }
     public void Update()
     {
-        // if (isOver)
-        // {
-        //     finalProbability = 1 - finalProbability;
-        //
-        //     turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, new MissionEndPoint
-        //     {
-        //         MissionEndPointLongitude = currentLocation.CurrentLon,
-        //         MissionEndPointLatitude = currentLocation.CurrentLat,
-        //         MissionEndPointHeight = currentLocation.CurrentHei
-        //     }, turningPoints, currentLocation.Currentsegnum);
-        //     
-        //     turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, currentLocation.Currentsegnum + 2);
-        //     isOver = false;
-        //     return;
-        // }
+        if (isOver)
+        {
+            finalProbability = 1 - finalProbability;
+        
+            turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, new MissionEndPoint
+            {
+                MissionEndPointLongitude = currentLocation.CurrentLon,
+                MissionEndPointLatitude = currentLocation.CurrentLat,
+                MissionEndPointHeight = currentLocation.CurrentHei
+            }, turningPoints, currentLocation.Currentsegnum);
+            
+            turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, currentLocation.Currentsegnum + 2, Velocitys, FuelConsumptions);
+            End();
+            isOver = false;
+            mission.EndMission();
+            return;
+        }
         if (!isSeeFire) // 发现火情
         {
             currentLocation = FXJHGenerate.GetCurrentLocation(turningPoints, FlightPlanEditor, temptime);
@@ -85,26 +86,26 @@ public class AircraftXH : Entity
            
             finalProbability *= (1 - probability);
             
-            // Console.WriteLine($"当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{finalProbability},是否看到火点:{isSeeFire}");
-            // var randomValue = random.NextDouble();
-            //
-            // if (randomValue < (1 - finalProbability))
-            // {
-            //     isSeeFire = true;
-            //     isOver = true;
-            //     Log.Info("发现火情");
-            // }
-            // else
-            // {
-            //     isSeeFire = false;
-            // }
-            //
-            // if (temptime >= 7200)
-            // {
-            //     isOver = true;
-            // }
-            //
-            // temptime++;
+            Console.WriteLine($"巡护任务: {Name} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{finalProbability},是否看到火点:{isSeeFire}");
+            var randomValue = random.NextDouble();
+            
+            if (randomValue < (1 - finalProbability))
+            {
+                isSeeFire = true;
+                isOver = true;
+                Log.Info("发现火情");
+            }
+            else
+            {
+                isSeeFire = false;
+            }
+            
+            if (temptime >= 7200)
+            {
+                isOver = true;
+            }
+            
+            temptime++;
         }
     }
 }
@@ -117,7 +118,7 @@ public class AircraftXHAwakeSystem : AwakeSystem<AircraftXH,FlightPlanEditor>
         self.FlightPlanEditor = planEditor;
         // 读取数据库
         self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
-        
+        self.helper = new EquationHelper(HttpInterface.baseUrl);
         self.Awake();
     }
 }

+ 18 - 26
SimulationServer/Entity/AircraftZC.cs

@@ -1,38 +1,33 @@
 using KYFramework;
 using Model;
-using MongoDB.Bson;
 using QuYuSaoMiao;
-using SimulationServer.Utils;
 
 namespace SimulationServer;
 
-public class AircraftZC : Entity
+public class AircraftZC : AircraftEntity
 {
-    public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
-    public TurningPoint[] turningPoints = new TurningPoint[200];
-    public AircraftDB Db;
+    public string missionId;
     public List<double[]> SC01;
     public ZCTask content;
-    
-    public double TotalFuelConsumption;
-
-    public void Awake()
+    public double[] Velocitys = new double[5]; // 速度
+    public double[] FuelConsumptions = new double[5]; // 燃油消耗
+    public double time;
+    public override void Start()
     {
-        for (int i = 0; i < turningPoints.Length; i++)
+        TurningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,TurningPoints);//生成从起点到任务段起点的航路点
+        SC01 = GeDianShengCheng.scanroute(content.poly,content.ScanRange,content.hSC,content.isRealHeight,content.isSurround,content.SurroundNum,GeDianShengCheng.DemHelper());//侦查模型输出的航路点位置
+        TurningPoints = FXJHGenerate.ZhenCha(SC01, FlightPlanEditor, TurningPoints);
+        TurningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.ZhenChaMissionEndPoint(SC01), TurningPoints, SC01.Count + 1);
+        TurningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, TurningPoints, SC01.Count + 3, Velocitys, FuelConsumptions);
+        
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[SC01.Count + 2].RemainingFuel;
+
+        for (int i = 0; i < SC01.Count + 3; i++)
         {
-            turningPoints[i] = new TurningPoint();
+            time += TurningPoints[i].SegmentFlightTime;
         }
+        Log.Info($"{missionId} 任务结束!总飞行时间:{time} 总油耗:{TotalFuelConsumption}");
         
-        turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
-        
-        SC01 = GeDianShengCheng.scanroute(content.poly,content.ScanRange,content.hSC,content.isRealHeight,content.isSurround,content.SurroundNum,GeDianShengCheng.DemHelper());//侦查模型输出的航路点位置
-        turningPoints = FXJHGenerate.ZhenCha(SC01, FlightPlanEditor, turningPoints);
-        turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.ZhenChaMissionEndPoint(SC01), turningPoints, SC01.Count + 1);
-        turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, SC01.Count + 3);
-    }
-    public void End()
-    {
-        TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[SC01.Count + 2].RemainingFuel;
     }
 }
 
@@ -44,9 +39,6 @@ public class AircraftZCAwakeSystem : AwakeSystem<AircraftZC,FlightPlanEditor,ZCT
     {
         self.content = zcTask;
         self.FlightPlanEditor = flightPlanEditor;
-        // 读取数据库
-        self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
-        
-        self.Awake();
+        self.missionId = zcTask.missionInformation.MissionName;
     }
 }

+ 0 - 8
SimulationServer/Entity/IAircraft.cs

@@ -1,8 +0,0 @@
-namespace SimulationServer;
-
-public interface IAircraft
-{
-    public double T { get; set; }
-
-    void Update(double time);
-}

+ 76 - 49
SimulationServer/Entity/MHRescueMission.cs

@@ -6,13 +6,16 @@ namespace SimulationServer;
 public class MHRescueMission : Entity
 {
     public string MissionId; // 任务ID
+    
     public bool Success; // 任务是否成功
-
+  
     public double SimTime;
 
     public double InitArea;
+    
+    
     private int currentExecuteCount = 1;
-    public int ExecutionContext = 3;
+    public int ExecutionContext = 0;
     
     // 火场点
     public FireGround FireGround;
@@ -23,20 +26,17 @@ public class MHRescueMission : Entity
 
     public List<string> successes = new List<string>();
     
-    // 救援飞机
-    public List<AircraftMH> Aircrafts = new List<AircraftMH>();
-    public List<AircraftMHWithPersion> AircraftWithPersions = new List<AircraftMHWithPersion>();
-    public List<AircraftSHJ> AircraftSHJs = new List<AircraftSHJ>();
+    public List<AircraftEntity> aircrafts = new List<AircraftEntity>();
 
-    public bool IsRunning;
     public Action End;
-    public List<IAircraft> aircrafts = new List<IAircraft>();
+    public bool IsRunning = false;
+
+   
     // 灭火的 单机能力
     // <机型,<sheet,<指标名,值列表>>>
    Dictionary<string,Dictionary<string,Dictionary<string,List<string>>>> singleReport =
         new Dictionary<string, Dictionary<string, Dictionary<string, List<string>>>>();
    
-    
     // 灭火的 整体能力
     Dictionary<string, Dictionary<string, List<string>>> totalReport =
         new Dictionary<string, Dictionary<string, List<string>>>();
@@ -48,21 +48,16 @@ public class MHRescueMission : Entity
     {
         SimTime = 0;
         area = 0;
-        aircrafts.Clear();
-        aircrafts.AddRange(Aircrafts);
-        aircrafts.AddRange(AircraftWithPersions);
-        FireGround.countArea = new Fire.CountArea() { burnarea = InitArea};
-        Aircrafts?.ForEach(a => a.Reset());
-        AircraftWithPersions?.ForEach(a => a.Reset());
-        
+        tn = 0;
+        FireGround.countArea.burnarea = InitArea;
+        aircrafts?.ForEach(a => a.Reset());
     }
     
     public void Start()
     {
-        IsRunning = true;
-        Aircrafts?.ForEach(a => a.Start());
-        AircraftWithPersions?.ForEach(a => a.Start());
         Log.Info($"{MissionId} 任务开始!");
+        aircrafts?.ForEach(a => a.Start());
+        IsRunning = true;
     }
     
     public void EndMission()
@@ -71,9 +66,6 @@ public class MHRescueMission : Entity
         Log.Info($"{MissionId} 任务结束!");
         // 灭火完成 任务结束
         End?.Invoke();
-        
-        // SaveMH();
-        // ReportMH();
 
         if (currentExecuteCount > ExecutionContext)
         {
@@ -90,7 +82,9 @@ public class MHRescueMission : Entity
             SaveMH();
             SaveTotalMH();
             ReportMH();
+            return;
         }
+        
         this.Reset();
         this.Start();
         currentExecuteCount++;
@@ -102,41 +96,45 @@ public class MHRescueMission : Entity
     /// </summary>
     public void SaveMH()
     {
-        foreach (AircraftMH aircraftMh in Aircrafts)
+        foreach (AircraftEntity aircraftEntity in aircrafts)
         {
             // 输出 area
-            var staticCapacity = aircraftMh.GetComponent<StaticCapacityComponent>();
-            var taskPerformance = aircraftMh.GetComponent<TaskPerformanceComponent>();
-            var economical = aircraftMh.GetComponent<EconomicalComponent>();
+            var staticCapacity = aircraftEntity.GetComponent<StaticCapacityComponent>();
+            var taskPerformance = aircraftEntity.GetComponent<TaskPerformanceComponent>();
+            var economical = aircraftEntity.GetComponent<EconomicalComponent>();
+            
+            if(staticCapacity == null || taskPerformance == null || economical == null) continue;
+            
+            staticCapacity.FillData(aircraftEntity.Db);
+            taskPerformance.FillData(aircraftEntity.Db);
             
-            staticCapacity.FillData(aircraftMh.Db);
-            taskPerformance.FillData(aircraftMh.Db);
             economical.FillData();
             
-            if (!singleReport.ContainsKey(aircraftMh.Type))
+            string key = aircraftEntity.Name + "-" + aircraftEntity.TaskName + "-" + aircraftEntity.AircraftIndex;
+            if (!singleReport.ContainsKey(key))
             {
-                singleReport[aircraftMh.Name] = new Dictionary<string, Dictionary<string, List<string>>>();
+                singleReport[key] = new Dictionary<string, Dictionary<string, List<string>>>();
             }
            
             Dictionary<string, Dictionary<string, string>> staticReport = staticCapacity.GetReport();
             foreach (var kv in staticReport)
             {
-                if(!singleReport[aircraftMh.Name].ContainsKey(kv.Key)) singleReport[aircraftMh.Name][kv.Key] = new Dictionary<string, List<string>>();
+                if(!singleReport[key].ContainsKey(kv.Key)) singleReport[key][kv.Key] = new Dictionary<string, List<string>>();
                 foreach (var kv2 in kv.Value)
                 {
-                    if (!singleReport[aircraftMh.Name][kv.Key].ContainsKey(kv2.Key)) singleReport[aircraftMh.Name][kv.Key][kv2.Key] = new List<string>();
-                    singleReport[aircraftMh.Name][kv.Key][kv2.Key].Add(kv2.Value);
+                    if (!singleReport[key][kv.Key].ContainsKey(kv2.Key)) singleReport[key][kv.Key][kv2.Key] = new List<string>();
+                    singleReport[key][kv.Key][kv2.Key].Add(kv2.Value);
                 }
             }
            
             Dictionary<string, Dictionary<string, string>> taskReport = taskPerformance.GetReport();
             foreach (var kv in taskReport)
             {
-                if(!singleReport[aircraftMh.Name].ContainsKey(kv.Key)) singleReport[aircraftMh.Name][kv.Key] = new Dictionary<string, List<string>>();
+                if(!singleReport[key].ContainsKey(kv.Key)) singleReport[key][kv.Key] = new Dictionary<string, List<string>>();
                 foreach (var kv2 in kv.Value)
                 {
-                    if (!singleReport[aircraftMh.Name][kv.Key].ContainsKey(kv2.Key)) singleReport[aircraftMh.Name][kv.Key][kv2.Key] = new List<string>();
-                    singleReport[aircraftMh.Name][kv.Key][kv2.Key].Add(kv2.Value);
+                    if (!singleReport[key][kv.Key].ContainsKey(kv2.Key)) singleReport[key][kv.Key][kv2.Key] = new List<string>();
+                    singleReport[key][kv.Key][kv2.Key].Add(kv2.Value);
                 }
             }
 
@@ -144,11 +142,11 @@ public class MHRescueMission : Entity
             
             foreach (var kv in economicalReport)
             {
-                if(!singleReport[aircraftMh.Name].ContainsKey(kv.Key)) singleReport[aircraftMh.Name][kv.Key] = new Dictionary<string, List<string>>();
+                if(!singleReport[key].ContainsKey(kv.Key)) singleReport[key][kv.Key] = new Dictionary<string, List<string>>();
                 foreach (var kv2 in kv.Value)
                 {
-                    if (!singleReport[aircraftMh.Name][kv.Key].ContainsKey(kv2.Key)) singleReport[aircraftMh.Name][kv.Key][kv2.Key] = new List<string>();
-                    singleReport[aircraftMh.Name][kv.Key][kv2.Key].Add(kv2.Value);
+                    if (!singleReport[key][kv.Key].ContainsKey(kv2.Key)) singleReport[key][kv.Key][kv2.Key] = new List<string>();
+                    singleReport[key][kv.Key][kv2.Key].Add(kv2.Value);
                 }
             }
         }
@@ -167,16 +165,11 @@ public class MHRescueMission : Entity
             {
                 if (!totalReport[kv.Key].ContainsKey(kv2.Key)) totalReport[kv.Key][kv2.Key] = new List<string>();
                 
-                if(kv2.Key == "任务成功率")
+                if(kv2.Key == "任务成功率/-")
                 {
                     successes.Add(kv2.Value);
-                    
-                    totalReport[kv.Key][kv2.Key].Add((getSuccessRate() * 100) + "%");
-                }
-                else
-                {
-                    totalReport[kv.Key][kv2.Key].Add(kv2.Value);
-                }
+                } 
+                totalReport[kv.Key][kv2.Key].Add(kv2.Value);
             }
         }
         
@@ -231,8 +224,36 @@ public class MHRescueMission : Entity
             string filePath = $"{path}/{kv.Key}灭火任务单机指标报告.xls";
             DataTableExtensions.SaveToExcel(filePath, kv.Value);
         }
+
+        foreach (KeyValuePair<string,Dictionary<string,List<string>>> keyValuePair in totalReport)
+        {
+            foreach (KeyValuePair<string,List<string>> kv in keyValuePair.Value)
+            {
+                if(kv.Key == "任务成功率/-")
+                {
+                    double successRate = getSuccessRate();
+                    kv.Value.Add((successRate * 100) + "%");
+                }
+                else
+                {
+                    List<string> values = kv.Value;
+                    double sum = 0;
+                    foreach (string value in values)
+                    {
+                        if (double.TryParse(value, out double num))
+                        {
+                            sum += num;
+                        }
+                    }
+                    double average = sum / values.Count;
+                    values.Add(average.ToString("#0.00"));
+                }
+            }
+        }
+        
+        
         string totalPath = $"{path}/{"灭火任务总体指标报告"}.xls";
-        DataTableExtensions.SaveToExcel(totalPath, totalReport);
+        DataTableExtensions.SaveToExcel(totalPath, totalReport,true);
         
         string equicPath = $"{path}/{"装备体系评估报告"}.xls";
         DataTableExtensions.SaveToExcel(equicPath, equipReport);
@@ -245,13 +266,19 @@ public class RescueMissionUpdateSystem : UpdateSystem<MHRescueMission>
     public override void Update(MHRescueMission self)
     {
         if(!self.IsRunning) return;
-        
         if (self.FireGround.countArea.burnarea <= 0)
         {
             self.Success = true;
             self.EndMission();
             return;
         }
+
+        if(self.tn >= 10 * 60 * 60)
+        {
+            self.Success = false;
+            self.EndMission();
+            return;
+        }
         
         self.aircrafts.Sort((a, b) => a.T.CompareTo(b.T));
         self.aircrafts.ForEach(a => a.Update(self.SimTime));

+ 1 - 1
SimulationServer/Entity/XHRescueMission.cs

@@ -67,7 +67,7 @@ public class XHRescueMission : Entity
             staticCapacity.FillData(aircraftXh.Db);
             economical.FillData(aircraftXh.Db);
 
-            if (!singleReport.ContainsKey(aircraftXh.Type))
+            if (!singleReport.ContainsKey(aircraftXh.Name))
             {
                 singleReport[aircraftXh.Name] = new Dictionary<string, Dictionary<string, List<string>>>();
             }

+ 16 - 0
SimulationServer/Entity/ZCRescueMission.cs

@@ -0,0 +1,16 @@
+using KYFramework;
+
+namespace SimulationServer;
+
+public class ZCRescueMission : Entity
+{
+    public string MissionId; // 任务ID
+    public bool Success; // 任务是否成功
+    public double InitArea;
+    
+    public List<AircraftZC> AircraftZCs = new List<AircraftZC>();
+    public void Start()
+    {
+       
+    }
+}

+ 104 - 106
SimulationServer/EventHandler/ServerStartEventHandler.cs

@@ -1,6 +1,7 @@
 using Cysharp.Threading.Tasks;
 using KYFramework;
 using Model;
+using MongoDB.Bson;
 using Newtonsoft.Json;
 using SimulationServer.Utils;
 using SimulationSingleServer.Utils;
@@ -17,6 +18,7 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         var taskSys = Game.Scene.GetComponent<TaskComponent>();
 
         HttpInterface.serverIp = File.ReadAllText("dbIp.txt");
+        SimulationCommon.Util.serverIp = HttpInterface.serverIp;
         // 读取任务配置文件
         string ec_path = "Missions/editor_config.json";
         string tc_path = "Missions/task_config.json";
@@ -48,8 +50,8 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         Define.TEMPERATURE = double.Parse(temp);
         var wind_temp = TaskComponent.Weather.day_wind_comp.Replace("级", "").Split('-');
         Define.WIND = double.Parse(wind_temp[0]);
-        
-        
+
+        int index = 1;
         foreach (MHTaskConfig mHTaskConfig in taskConfig.mHTaskConfigs)
         {
             MHRescueMission mission = ComponentFactory.Create<MHRescueMission>();
@@ -57,7 +59,6 @@ public class ServerStartEventHandler : AEvent<ServerStart>
             mission.AddComponent<TotalTaskPerformanceComponent>();
             mission.AddComponent<TotalEconomicalComponent>();
             mission.AddComponent<EquipmentComponent>();
-            
             taskSys.MHRescueMissions.Add(mission);
             mission.MissionId = $"灭火任务 {mHTaskConfig.TotalMHId}";
             Log.Info($"创建任务 : {mHTaskConfig.TotalMHId}");
@@ -66,7 +67,6 @@ public class ServerStartEventHandler : AEvent<ServerStart>
             FireGround fireGround = ComponentFactory.Create<FireGround>();
             mission.FireGround = fireGround;
             mission.InitArea = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].InitialArea;
-            Log.Info("初始火场面积:" + fireGround.countArea.burnarea);
             fireGround.FirePoint = new DVector { Latitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLatitude,
                 Longitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLongitude,Altitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointHeight};
             
@@ -79,31 +79,30 @@ public class ServerStartEventHandler : AEvent<ServerStart>
                 {
                     FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
                     
-                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.AircraftID == mhTask.missionInformation.AircraftInfos[i]);
+                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.Id == mhTask.missionInformation.AircraftId[i]);
                     flightPlanEditor.firepoint = new FirePoint[1];
                     flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
                     flightPlanEditor.missionpoint = mhTask.MissionPoints[0];
                     flightPlanEditor.originbase = editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                    flightPlanEditor.climbsegment = editorConfig.climbSegment;
-                    flightPlanEditor.descentsegment = editorConfig.descentSegment;
-                    flightPlanEditor.cruisesegment = editorConfig.cruiseSegment;
+          
                     flightPlanEditor.cityweather = editorConfig.cityWeather;
-                   
                     AircraftMH aircraft = ComponentFactory.Create<AircraftMH, FlightPlanEditor>( flightPlanEditor);
                     aircraft.Name = mhTask.missionInformation.AircraftInfos[i];
+                    aircraft.AircraftId = mhTask.missionInformation.AircraftId[i];
                     aircraft.NextMissionId = mhTask.NextTaskId;
                     aircraft.fireGround = fireGround;
                     aircraft.mhRescueMission = mission;
-                    mission.Aircrafts.Add(aircraft);
-                    aircraft.aircraftparameter = flightPlanEditor.aircraftparameter;
+                    aircraft.AircraftIndex = index.ToString();
+                    mission.aircrafts.Add(aircraft);
                     aircraft.Airport = flightPlanEditor.originbase.BaseName;
                     aircraft.TaskName = mhTask.missionInformation.MissionName;
                     mission.End += aircraft.End;
                     aircraft.AddComponent<StaticCapacityComponent>();
                     aircraft.AddComponent<TaskPerformanceComponent>();
                     aircraft.AddComponent<EconomicalComponent>();
-                    
+                    aircraft.TaskReadyTime = mhTask.missionInformation.TakeoffPreparationTime;
                     Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+                    index++;
                 }
             }
 
@@ -115,26 +114,28 @@ public class ServerStartEventHandler : AEvent<ServerStart>
                 {
                     FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
                     
-                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.AircraftID == dmmhTask.missionInformation.AircraftInfos[i]);
+                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.Id == dmmhTask.missionInformation.AircraftId[i]);
                     flightPlanEditor.firepoint = new FirePoint[1];
                     flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
                     flightPlanEditor.missionpoint = dmmhTask.MissionPoints[0];
                     flightPlanEditor.originbase = editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                    flightPlanEditor.climbsegment = editorConfig.climbSegment;
-                    flightPlanEditor.descentsegment = editorConfig.descentSegment;
-                    flightPlanEditor.cruisesegment = editorConfig.cruiseSegment;
                     flightPlanEditor.cityweather = editorConfig.cityWeather;
                     
                     AircraftMHWithPersion aircraftWithPerson = ComponentFactory.Create<AircraftMHWithPersion, FlightPlanEditor>( flightPlanEditor);
                     mission.End += aircraftWithPerson.End;
                     aircraftWithPerson.fireGround = fireGround;
                     aircraftWithPerson.mhRescueMission = mission;
+                    aircraftWithPerson.AircraftIndex = index.ToString();
                     aircraftWithPerson.GroundPersonnel = (int)dmmhTask.GroundPersonnel;
                     aircraftWithPerson.LandingPersonnel = (int)dmmhTask.LandingPersonnel;
                     aircraftWithPerson.NextMissionId = dmmhTask.NextTaskId;
                     aircraftWithPerson.TaskName = dmmhTask.missionInformation.MissionName;
-                    mission.AircraftWithPersions.Add(aircraftWithPerson);
+                    aircraftWithPerson.TaskReadyTime = dmmhTask.missionInformation.TakeoffPreparationTime;
+                    aircraftWithPerson.AircraftId = dmmhTask.missionInformation.AircraftId[i];
+                    
+                    mission.aircrafts.Add(aircraftWithPerson);
                     Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+                    index++;
                 }
             }
 
@@ -146,110 +147,107 @@ public class ServerStartEventHandler : AEvent<ServerStart>
                     FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
 
                     flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find(a =>
-                        a.AircraftID == shjTask.missionInformation.AircraftInfos[i]);
+                        a.Id == shjTask.missionInformation.AircraftId[i]);
                     flightPlanEditor.firepoint = new FirePoint[1];
                     flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
                     flightPlanEditor.missionpoint = shjTask.MissionPoints[0];
                     flightPlanEditor.originbase =
                         editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                    flightPlanEditor.climbsegment = editorConfig.climbSegment;
-                    flightPlanEditor.descentsegment = editorConfig.descentSegment;
-                    flightPlanEditor.cruisesegment = editorConfig.cruiseSegment;
                     flightPlanEditor.cityweather = editorConfig.cityWeather;
 
                     AircraftSHJ aircraftSHJ = ComponentFactory.Create<AircraftSHJ, FlightPlanEditor,SHJTask>( flightPlanEditor, shjTask);
                     mission.End += aircraftSHJ.End;
-                    mission.AircraftSHJs.Add(aircraftSHJ);
+                    aircraftSHJ.AircraftIndex = index.ToString();
+                    mission.aircrafts.Add(aircraftSHJ);
+                    index++;
                 }
             }
         }
 
 
-        // foreach (ZCTask zcTask in taskConfig.zCTask)
-        // {
-        //     MHRescueMission mission = ComponentFactory.Create<MHRescueMission>();
-        //     taskSys.RescueMissions.Add(mission);
-        //     //mission.MissionId = zcTask.TotalZCId;
-        //     mission.MissionId = $"侦擦任务 {zcTask.missionInformation.MissionId}";
-        //     FireGround fireGround = ComponentFactory.Create<FireGround>();
-        //     fireGround.countArea.burnarea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
-        //     fireGround.FirePoint = new DVector
-        //     {
-        //         Latitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLatitude,
-        //         Longitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLongitude,
-        //         Altitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointHeight
-        //     };
-        //     mission.InitArea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
-        //     if(zcTask.missionInformation.AircraftInfos == null) continue;
-        //     for (int i = 0; i < zcTask.missionInformation.AircraftInfos.Length; i++)
-        //     {
-        //         FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-        //
-        //         flightPlanEditor.aircraftparameter =
-        //             editorConfig.aircraftParameters.Find(
-        //                 a => a.AircraftID == zcTask.missionInformation.AircraftInfos[i]);
-        //         flightPlanEditor.firepoint = new FirePoint[1];
-        //         flightPlanEditor.firepoint[0] = editorConfig.firePoints[zcTask.FirePointId - 1];
-        //         flightPlanEditor.missionpoint = zcTask.MissionPoints[0];
-        //         flightPlanEditor.originbase =
-        //             editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-        //         flightPlanEditor.climbsegment = editorConfig.climbSegment;
-        //         flightPlanEditor.descentsegment = editorConfig.descentSegment;
-        //         flightPlanEditor.cruisesegment = editorConfig.cruiseSegment;
-        //         flightPlanEditor.cityweather = editorConfig.cityWeather;
-        //
-        //         AircraftZC aircraft = ComponentFactory.Create<AircraftZC, FlightPlanEditor,ZCTask>( flightPlanEditor, zcTask);
-        //         //aircraft.Name = zcTask.missionInformation.AircraftInfos[i];
-        //         //aircraft.NextMissionId = zcTask.NextTaskId;
-        //         mission.End += aircraft.End;
-        //         mission.AircraftZCs.Add(aircraft);
-        //     }
-        // }
+        foreach (ZCTask zcTask in taskConfig.zCTask)
+        {
+            ZCRescueMission mission = ComponentFactory.Create<ZCRescueMission>();
+            taskSys.ZCRescueMissions.Add(mission);
+            mission.MissionId = $"侦擦任务 {zcTask.missionInformation.MissionName}";
+            FireGround fireGround = ComponentFactory.Create<FireGround>();
+            fireGround.countArea.burnarea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
+            fireGround.FirePoint = new DVector
+            {
+                Latitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLatitude,
+                Longitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLongitude,
+                Altitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointHeight
+            };
+            mission.InitArea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
+            if(zcTask.missionInformation.AircraftInfos == null) continue;
+            for (int i = 0; i < zcTask.missionInformation.AircraftInfos.Length; i++)
+            {
+                FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
+        
+                flightPlanEditor.aircraftparameter =
+                    editorConfig.aircraftParameters.Find(
+                        a => a.AircraftID == zcTask.missionInformation.AircraftInfos[i]);
+                flightPlanEditor.firepoint = new FirePoint[1];
+                flightPlanEditor.firepoint[0] = editorConfig.firePoints[zcTask.FirePointId - 1];
+                flightPlanEditor.missionpoint = zcTask.MissionPoints[0];
+                flightPlanEditor.originbase =
+                    editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
+                flightPlanEditor.cityweather = editorConfig.cityWeather;
+        
+                AircraftZC aircraft = ComponentFactory.Create<AircraftZC, FlightPlanEditor,ZCTask>( flightPlanEditor, zcTask);
+                //aircraft.Name = zcTask.missionInformation.AircraftInfos[i];
+                //aircraft.NextMissionId = zcTask.NextTaskId;
+                aircraft.AircraftId = zcTask.missionInformation.AircraftId[i];
+                aircraft.TaskReadyTime = zcTask.missionInformation.TakeoffPreparationTime;
+                aircraft.AddComponent<StaticCapacityComponent>();
+                aircraft.AddComponent<TaskPerformanceComponent>();
+                aircraft.AddComponent<EconomicalComponent>();
+                mission.AircraftZCs.Add(aircraft);
+            }
+        }
 
-        // foreach (XHTask xhTask in taskConfig.xHTask)
-        // {
-        //     XHRescueMission mission = ComponentFactory.Create<XHRescueMission>();
-        //     mission.AddComponent<XHEconomicalComponent>();
-        //     mission.AddComponent<XHTotalTaskPerformanceComponent>();
-        //     mission.AddComponent<EquipmentComponent>();
-        //     
-        //     mission.MissionId = $"巡护任务 {xhTask.missionInformation.MissionId}";
-        //     taskSys.XHRescueMissions.Add(mission);
-        //     FireGround fireGround = ComponentFactory.Create<FireGround>();
-        //     mission.FireGround = fireGround;
-        //     fireGround.FirePoint = new DVector
-        //     {
-        //         Latitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLatitude,
-        //         Longitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLongitude,
-        //         Altitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointHeight
-        //     };
-        //     if(xhTask.missionInformation.AircraftInfos == null) continue;
-        //     for (int i = 0; i < xhTask.missionInformation.AircraftInfos.Length; i++)
-        //     {
-        //         
-        //         FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-        //         flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find(a =>
-        //             a.AircraftID == xhTask.missionInformation.AircraftInfos[i]);
-        //         flightPlanEditor.firepoint = new FirePoint[1];
-        //         flightPlanEditor.firepoint[0] = editorConfig.firePoints[xhTask.FirePointId - 1];
-        //         flightPlanEditor.airroute = xhTask.airroute;
-        //         //flightPlanEditor.missionpoint = xhTask.MissionPoints[0];
-        //         flightPlanEditor.originbase =
-        //             editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-        //         flightPlanEditor.climbsegment = editorConfig.climbSegment;
-        //         flightPlanEditor.descentsegment = editorConfig.descentSegment;
-        //         flightPlanEditor.cruisesegment = editorConfig.cruiseSegment;
-        //         flightPlanEditor.cityweather = editorConfig.cityWeather;
-        //
-        //         AircraftXH aircraft = ComponentFactory.Create<AircraftXH, FlightPlanEditor>( flightPlanEditor);
-        //         //aircraft.Name = zcTask.missionInformation.AircraftInfos[i];
-        //         //aircraft.NextMissionId = zcTask.NextTaskId;
-        //         mission.AircraftXHs.Add(aircraft);
-        //         mission.End += aircraft.End;
-        //         aircraft.AddComponent<XHStaticCapacityComponent>();
-        //         aircraft.AddComponent<XHEconomicalComponent>();
-        //     }
-        // }
+        foreach (XHTask xhTask in taskConfig.xHTask)
+        {
+            XHRescueMission mission = ComponentFactory.Create<XHRescueMission>();
+            mission.AddComponent<XHEconomicalComponent>();
+            mission.AddComponent<XHTotalTaskPerformanceComponent>();
+            mission.AddComponent<EquipmentComponent>();
+            
+            mission.MissionId = $"巡护任务 {xhTask.missionInformation.MissionId}";
+            taskSys.XHRescueMissions.Add(mission);
+            FireGround fireGround = ComponentFactory.Create<FireGround>();
+            mission.FireGround = fireGround;
+            fireGround.FirePoint = new DVector
+            {
+                Latitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLatitude,
+                Longitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLongitude,
+                Altitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointHeight
+            };
+            if(xhTask.missionInformation.AircraftInfos == null) continue;
+            for (int i = 0; i < xhTask.missionInformation.AircraftInfos.Length; i++)
+            {
+                
+                FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
+                flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find(a =>
+                    a.Id == xhTask.missionInformation.AircraftId[i]);
+                flightPlanEditor.firepoint = new FirePoint[1];
+                flightPlanEditor.firepoint[0] = editorConfig.firePoints[xhTask.FirePointId - 1];
+                flightPlanEditor.airroute = xhTask.airroute;
+                //flightPlanEditor.missionpoint = xhTask.MissionPoints[0];
+                flightPlanEditor.originbase =
+                    editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
+                flightPlanEditor.cityweather = editorConfig.cityWeather;
+        
+                AircraftXH aircraft = ComponentFactory.Create<AircraftXH, FlightPlanEditor>( flightPlanEditor);
+                aircraft.Name = xhTask.missionInformation.AircraftInfos[i];
+                aircraft.TaskReadyTime = xhTask.missionInformation.TakeoffPreparationTime;
+                //aircraft.NextMissionId = zcTask.NextTaskId;
+                mission.AircraftXHs.Add(aircraft);
+                mission.End += aircraft.End;
+                aircraft.AddComponent<XHStaticCapacityComponent>();
+                aircraft.AddComponent<XHEconomicalComponent>();
+            }
+        }
         taskSys.Start();
         return UniTask.CompletedTask;
     }

+ 21 - 5
SimulationServer/Utils/DataTableExtensions.cs

@@ -68,7 +68,7 @@ public static class DataTableExtensions
         return entities;
     }
 
-    public static void SaveToExcel(string path , Dictionary<string, Dictionary<string,List<string>>> report)
+    public static void SaveToExcel(string path , Dictionary<string, Dictionary<string,List<string>>> report,bool withA = false)
     {
         if(!File.Exists(path)) File.Create(path).Close();
         // 创建一个新的Excel文件
@@ -91,12 +91,28 @@ public static class DataTableExtensions
             {
                 var row = sheet.CreateRow(rowIndex);
                 row.CreateCell(0).SetCellValue(kv1.Key);
-                for (int i = 0; i < kv1.Value.Count; i++)
+                if (withA)
                 {
-                    var headerCell1 = headerRow.CreateCell(i + 1);
-                    headerCell1.SetCellValue($"数值{i+1}");
-                    row.CreateCell(i + 1).SetCellValue(kv1.Value[i]);
+                    for (int i = 0; i < kv1.Value.Count - 1; i++)
+                    {
+                        var headerCell1 = headerRow.CreateCell(i + 1);
+                        headerCell1.SetCellValue($"数值{i+1}");
+                        row.CreateCell(i + 1).SetCellValue(kv1.Value[i]);
+                    }
+                    var headerCell1End = headerRow.CreateCell(kv1.Value.Count);
+                    headerCell1End.SetCellValue($"平均值");
+                    row.CreateCell(kv1.Value.Count).SetCellValue(kv1.Value[kv1.Value.Count - 1]);
                 }
+                else
+                {
+                    for (int i = 0; i < kv1.Value.Count; i++)
+                    {
+                        var headerCell1 = headerRow.CreateCell(i + 1);
+                        headerCell1.SetCellValue($"数值{i+1}");
+                        row.CreateCell(i + 1).SetCellValue(kv1.Value[i]);
+                    }
+                }
+               
                 rowIndex++;
             }
         }

+ 3 - 0
SimulationServer/Utils/HttpInterface.cs

@@ -10,4 +10,7 @@ public class HttpInterface
     public static string weather = $"{baseUrl}rescue-platform-service/api/v1/tbMeteorology/getInfosByJHName";
     //public static string routes = $"{baseUrl}rescue-platform-service/api/v1/tbRoute/getRoutes";
     public static string slope = $"{baseUrl}rescue-platform-service/api/v1/dem/getListInfos";
+    public static string temperature = $"{baseUrl}rescue-platform-service/api/v1/attribute/getInfos";
+    //油耗
+    public static string fuel = $"{baseUrl}rescue-platform-service/api/v1/tbTables/queryOilConsumeInfo";
 }

+ 7 - 1
SimulationServer/Utils/Slope.cs

@@ -8,4 +8,10 @@ public class SlopeDb
 public class Slope
 {
     public double s1;
-}
+}
+
+public class Temperature
+{
+    public int vale;
+}
+

+ 42 - 0
SimulationServer/Utils/Util.cs

@@ -1,5 +1,7 @@
+using System.Text.Json.Nodes;
 using KYFramework;
 using Model;
+using SimulationCommon;
 using SimulationSingleServer.Utils;
 
 namespace SimulationServer.Utils;
@@ -75,4 +77,44 @@ public class Util
         
         return Math.Atan(Math.Abs(slope.average.s1)) * (180.0 / Math.PI);
     }
+    
+    /// <summary>
+    /// 获取当前位置的温度
+    /// </summary>
+    /// <param name="varName"></param>
+    /// <param name="lon"></param>
+    /// <param name="lat"></param>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    public static double GetTemperature(double lon, double lat)
+    {
+        string content = HttpManager.Get(HttpInterface.temperature ,new List<string>
+        {
+            "varName","centerLon","centerLat","weather_date"
+        }, new List<string>
+        {
+            "t2m",lon.ToString(),lat.ToString(),"2024-01-01 12:00:00"
+        });
+        
+        var temp = JsonHelper.FromJson<Temperature>(content);
+        
+        return temp.vale - 273;
+    }
+    
+    //
+    public static Fuel GetFuel(string fName, string fType, string fState, string fTemperature, string fHeight, string fWeight)
+    {
+        string content = HttpManager.Get(HttpInterface.fuel ,new List<string>
+        {
+            "fname","ftype","fstate","ftemperature","fheight","fweight"
+        }, new List<string>
+        {
+            fName,fType,fState,fTemperature,fHeight,fWeight
+        });
+        
+        var fuel = JsonHelper.FromJson<FuelDB>(content);
+        
+        return fuel.data[0];
+    }
+    
 }

二進制
SimulationServer/bin/Debug/net7.0/KYFramework.dll


二進制
SimulationServer/bin/Debug/net7.0/KYFramework.pdb


+ 2 - 22
SimulationServer/bin/Debug/net7.0/Missions/editor_config.json

@@ -23,7 +23,6 @@
       "子类型": "直升机",
       "最大起飞重量": 11000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 16.0,
       "所属机场ID": 1
     },
@@ -34,7 +33,6 @@
       "子类型": "直升机",
       "最大起飞重量": 11000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 16.0,
       "所属机场ID": 1
     },
@@ -45,7 +43,6 @@
       "子类型": "直升机",
       "最大起飞重量": 13000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 24.0,
       "所属机场ID": 1
     },
@@ -56,7 +53,6 @@
       "子类型": "直升机",
       "最大起飞重量": 13000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 24.0,
       "所属机场ID": 1
     },
@@ -67,7 +63,6 @@
       "子类型": "直升机",
       "最大起飞重量": 11000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 16.0,
       "所属机场ID": 2
     },
@@ -78,7 +73,6 @@
       "子类型": "直升机",
       "最大起飞重量": 13000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 24.0,
       "所属机场ID": 2
     },
@@ -89,7 +83,6 @@
       "子类型": "直升机",
       "最大起飞重量": 13000.0,
       "最大载油量": 8000.0,
-      "起飞准备时间": 600.0,
       "最大载客数量": 24.0,
       "所属机场ID": 2
     }
@@ -100,7 +93,7 @@
       "火点经度": 121.123,
       "火点纬度": 50.342,
       "火点海拔": 2000.0,
-      "初始火场面积": 30000.0,
+      "初始火场面积": 10000.0,
       "初始火线长度": 0.0
     },
     {
@@ -108,23 +101,10 @@
       "火点经度": 101.041,
       "火点纬度": 30.125,
       "火点海拔": 3000.0,
-      "初始火场面积": 30000.0,
+      "初始火场面积": 10000.0,
       "初始火线长度": 0.0
     }
   ],
-  "爬升段": {
-    "爬升段速度": 60.0,
-    "爬升段油耗率": 1100.0
-  },
-  "下降段": {
-    "下降段速度": 100.0,
-    "下降段油耗率": 400.0
-  },
-  "巡航段": {
-    "巡航段高度": 1600.0,
-    "巡航段速度": 200.0,
-    "巡航段油耗率": 600.0
-  },
   "天气信息": {
     "温度": 15.0
   }

+ 14 - 187
SimulationServer/bin/Debug/net7.0/Missions/task_config.json

@@ -3,14 +3,16 @@
     {
       "总灭火任务编号": 1,
       "火点ID": 1,
-      "执行次数": 10,
+      "执行次数": 1,
       "吊桶洒水灭火任务": [
         {
+         
           "任务信息": {
             "任务名称": "吊桶洒水灭火任务1-1",
             "任务ID": "DTMH1-1",
             "任务主要类型": "航空灭火",
-            "任务类型": "吊桶洒水灭火",
+            "任务类型": "吊桶洒水灭火", 
+            "起飞准备时间": 600.0,
             "开始时间": null,
             "结束时间": null,
             "应用机型": [
@@ -22,14 +24,15 @@
           },
           "取水点": [
             {
-              "任务点经度": 120.978,
-              "任务点纬度": 50.327,
+              "任务点经度": 121.999,
+              "任务点纬度": 51.399,
               "任务点海拔": 1600.0
             }
           ],
           "下一个任务ID": "DMMH1"
         },
         {
+          
           "任务信息": {
             "任务名称": "吊桶洒水灭火任务1-2",
             "任务ID": "DTMH1-2",
@@ -37,6 +40,7 @@
             "任务类型": "吊桶洒水灭火",
             "开始时间": null,
             "结束时间": null,
+            "起飞准备时间": 600.0,
             "应用机型": [
               "Ka-32"
             ],
@@ -46,8 +50,8 @@
           },
           "取水点": [
             {
-              "任务点经度": 120.978,
-              "任务点纬度": 50.327,
+              "任务点经度": 121.999,
+              "任务点纬度": 51.399,
               "任务点海拔": 1600.0
             }
           ],
@@ -56,6 +60,7 @@
       ],
       "机降灭火任务": [
         {
+         
           "任务信息": {
             "任务名称": "机降灭火1-1",
             "任务ID": "DMMH1-1",
@@ -63,6 +68,7 @@
             "任务类型": "机降灭火",
             "开始时间": null,
             "结束时间": null,
+            "起飞准备时间": 600.0,
             "应用机型": [
               "M-171"
             ],
@@ -71,7 +77,7 @@
             ]
           },
           "地面部署人数": 10.0,
-          "机降人数": 10.0,
+          "机降人数": 100.0,
           "机降点": [
             {
               "任务点经度": 121.1,
@@ -81,189 +87,10 @@
           ],
           "下一个任务ID": ""
         }
-      ],
-      "索滑降灭火任务": [
-        {
-          "任务信息": {
-            "任务名称": "索滑降灭火任务1-1",
-            "任务ID": "SHJ1-1",
-            "任务主要类型": "航空灭火",
-            "任务类型": "索滑降灭火",
-            "开始时间": null,
-            "结束时间": null,
-            "应用机型": [
-              "M-171"
-            ],
-            "应用飞机编号": [
-              "1-3"
-            ]
-          },
-          "索滑降高度": 200.0,
-          "投送人数": 180,
-          "风速": 5.0,
-          "能见度": 5.0,
-          "索滑降速度": 3.0,
-          "索滑降点": [
-            {
-              "任务点经度": 121.120,
-              "任务点纬度": 50.34,
-              "任务点海拔": 2000.0
-            }
-          ],
-          "下一个任务ID": ""
-        }
-      ]
-    },
-    {
-      "总灭火任务编号": 2,
-      "火点ID": 2,
-      "执行次数": 10,
-      "吊桶洒水灭火任务": [
-        {
-          "任务信息": {
-            "任务名称": "吊桶洒水灭火任务2-1",
-            "任务ID": "DTMH2-1",
-            "任务主要类型": "航空灭火",
-            "任务类型": "吊桶洒水灭火",
-            "开始时间": null,
-            "结束时间": null,
-            "应用机型": [
-              "Ka-32"
-            ],
-            "应用飞机编号": [
-              "2-1"
-            ]
-          },
-          "取水点": [
-            {
-              "任务点经度": 101.008,
-              "任务点纬度": 30.116,
-              "任务点海拔": 3000.0
-            }
-          ],
-          "下一个任务ID": ""
-        }
-      ],
-      "机降灭火任务": [
-        {
-          "任务信息": {
-            "任务名称": "机降灭火2-1",
-            "任务ID": "DMMH2-1",
-            "任务主要类型": "航空灭火",
-            "任务类型": "机降灭火",
-            "开始时间": null,
-            "结束时间": null,
-            "应用机型": [
-              "M-171"
-            ],
-            "应用飞机编号": [
-              "2-2"
-            ]
-          },
-          "地面部署人数": 10.0,
-          "机降人数": 10.0,
-          "机降点": [
-            {
-              "任务点经度": 101.0,
-              "任务点纬度": 30.1,
-              "任务点海拔": 3000.0
-            }
-          ],
-          "下一个任务ID": ""
-        }
-      ],
-      "索滑降灭火任务": [
-        {
-          "任务信息": {
-            "任务名称": "索滑降灭火任务2-1",
-            "任务ID": "SHJ2-1",
-            "任务主要类型": "航空灭火",
-            "任务类型": "索滑降灭火",
-            "开始时间": null,
-            "结束时间": null,
-            "应用机型": [
-              "M-171"
-            ],
-            "应用飞机编号": [
-              "2-3"
-            ]
-          },
-          "索滑降高度": 200.0,
-          "投送人数": 180,
-          "风速": 5.0,
-          "能见度": 5.0,
-          "索滑降速度": 3.0,
-          "索滑降点": [
-            {
-              "任务点经度": 101.02,
-              "任务点纬度": 30.12,
-              "任务点海拔": 3000.0
-            }
-          ],
-          "下一个任务ID": ""
-        }
       ]
     }
-  ],
-  "火场侦查任务": [
-    {
-      "任务信息": {
-        "任务名称": "火场侦查任务1",
-        "任务ID": "ZC1",
-        "任务主要类型": "航空灭火",
-        "任务类型": "火场侦查",
-        "开始时间": null,
-        "结束时间": null,
-        "应用机型": [
-          "M-171"
-        ],
-        "应用飞机编号": [
-          "1-3"
-        ]
-      },
-      "矩形侦查区域边界点": [
-        [
-          113.998,
-          39.999
-        ],
-        [
-          114.0,
-          40.0
-        ],
-        [
-          114.002,
-          40.001
-        ],
-        [
-          113.998,
-          40.001
-        ]
-      ],
-      "扫描线间距": 300.0,
-      "侦查飞行真高": 300.0,
-      "是否真实高度": true,
-      "是否环绕模式": true,
-      "环绕圈数": 1,
-      "火点ID": 1,
-      "MissionPoints": [
-        {
-          "任务点经度": 113.998,
-          "任务点纬度": 39.999,
-          "任务点海拔": 1500.0
-        }
-      ],
-      "下一个任务ID": ""
-    }
+  
   ]
 
 
-
-
-
-
-
-
-
-
-
 }

二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/Ka-32灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 2/灭火任务总体指标报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/灭火任务总体指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 2/装备体系评估报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 1/装备体系评估报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 2/Ka-32灭火任务单机指标报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/Ka-32灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 1/灭火任务总体指标报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/灭火任务总体指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 1/装备体系评估报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-12/灭火任务 2/装备体系评估报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32-吊桶洒水灭火任务1-1-1灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32-吊桶洒水灭火任务1-2-2灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/Ka-32灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/灭火任务总体指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 1/装备体系评估报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/Ka-32-吊桶洒水灭火任务2-1-5灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-06/灭火任务 1/Ka-32灭火任务单机指标报告.xls → SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/Ka-32灭火任务单机指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/灭火任务总体指标报告.xls


二進制
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-17/灭火任务 2/装备体系评估报告.xls


二進制
SimulationServer/bin/Debug/net7.0/SimulationCommon.dll


二進制
SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb


二進制
SimulationServer/bin/Debug/net7.0/SimulationServer.dll


二進制
SimulationServer/bin/Debug/net7.0/SimulationServer.exe


二進制
SimulationServer/bin/Debug/net7.0/SimulationServer.pdb


二進制
SimulationServer/bin/Debug/net7.0/ThirdParty.dll


二進制
SimulationServer/bin/Debug/net7.0/ThirdParty.pdb


二進制
SimulationServer/bin/Debug/simulationserver.zip → SimulationServer/bin/Debug/server.zip


二進制
ThirdParty/bin/Debug/net7.0/ThirdParty.dll


二進制
ThirdParty/bin/Debug/net7.0/ThirdParty.pdb