Browse Source

解决冲突

zansimple 5 days ago
parent
commit
8b9136bffc

+ 33 - 0
Models/SimulationCommon/FXJHGenenrate.cs

@@ -521,7 +521,40 @@ namespace Model
                 RemainingFuel = 0,
             });
         }
+        
+        public static double CalculateTotalFuelConsumption(FlightPlanEditor editor, List<TurningPoint> turningPoints)
+        {
+            double initialFuel = editor.aircraftparameter.MaxFuelCapacity; // 起始燃油量
+            double totalFuelConsumption = 0; // 总燃油消耗量
+            double totalRefuelAmount = 0; // 总加油量
+
+            for (int i = 0; i < turningPoints.Count; i++)
+            {
+                //// 更新飞行过程中的燃油消耗
+                //if (i ==0)
+                //{
+                //    double segmentFuelConsumed = initialFuel - turningPoints[i].RemainingFuel;
+                //}
+                //else
+                //{
+                //    double segmentFuelConsumed = (turningPoints[i - 1].RemainingFuel - turningPoints[i].RemainingFuel);
+                //    totalFuelConsumption += segmentFuelConsumed;
+                //}
+
+                // 如果当前航路点是加油点,更新燃油并记录加油量
+                if (turningPoints[i].TurningPointType == "加油")
+                {
+                    double refuelAmount = editor.aircraftparameter.MaxFuelCapacity - turningPoints[i - 2].RemainingFuel;
+                    totalRefuelAmount += refuelAmount;
+                }
+            }
+
+            // 最终燃油消耗 = 初始燃油 + 总加油量 - 最终剩余燃油
+            double finalFuel = turningPoints.Last().RemainingFuel;
+            totalFuelConsumption = (initialFuel + totalRefuelAmount) - finalFuel;
 
+            return totalFuelConsumption;
+        }
         public static void LandSouJiu(FlightPlanEditor editor, ref List<TurningPoint> turningPoints)
         {
             int i;

+ 5 - 5
SimulationServer/Component/JYComponent.cs

@@ -377,7 +377,7 @@ public class JYComponentUpdateSystem : UpdateSystem<JYComponent>
 
                 foreach (var item in self.LandSJRescueMissions)
                 {
-                    foreach (var item1 in item.aircraftSJDatas)
+                    foreach (var item1 in item.totalReport)
                     {
                         识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
                         人员数量 += float.Parse(item1.Value["人员数量"][i]);
@@ -409,7 +409,7 @@ public class JYComponentUpdateSystem : UpdateSystem<JYComponent>
 
                 foreach (var item in self.KZDYMissions)
                 {
-                    foreach (var item1 in item.aircraftSJDatas)
+                    foreach (var item1 in item.totalReport)
                     {
                         识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
                         人员数量 += float.Parse(item1.Value["人员数量"][i]);
@@ -439,7 +439,7 @@ public class JYComponentUpdateSystem : UpdateSystem<JYComponent>
 
                 foreach (var item in self.KTKSMissions)
                 {
-                    foreach (var item1 in item.aircraftSJDatas)
+                    foreach (var item1 in item.totalReport)
                     {
                         识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
                         人员数量 += float.Parse(item1.Value["人员数量"][i]);
@@ -469,7 +469,7 @@ public class JYComponentUpdateSystem : UpdateSystem<JYComponent>
 
                 foreach (var item in self.ZSJYMissions)
                 {
-                    foreach (var item1 in item.aircraftSJDatas)
+                    foreach (var item1 in item.totalReport)
                     {
                         识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
                         人员数量 += float.Parse(item1.Value["人员数量"][i]);
@@ -500,7 +500,7 @@ public class JYComponentUpdateSystem : UpdateSystem<JYComponent>
 
                 foreach (var item in self.JJJYMissions)
                 {
-                    foreach (var item1 in item.aircraftSJDatas)
+                    foreach (var item1 in item.totalReport)
                     {
                         识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
                         人员数量 += float.Parse(item1.Value["人员数量"][i]);

+ 1 - 1
SimulationServer/Component/SJAllTotalTaskPerformance.cs

@@ -101,7 +101,7 @@ public class SJAllTotalTaskPerformanceComponent
             //    人员存活率 += aircraft.Success ? 1 : 0;
             //    aircreftCount++;
             //}
-            foreach (var item in mhRescueMission.aircraftSJDatas)
+            foreach (var item in mhRescueMission.totalReport)
             {
                 识别成功率 += float.Parse(item.Value["识别成功率"][lIndex]);
                 人员数量 += float.Parse(item.Value["人员数量"][sIndex]);