Browse Source

略过算法完成海上搜救和陆上搜寻的输出excel功能测试

liyang 7 months ago
parent
commit
6ceea57c5e
21 changed files with 47 additions and 61 deletions
  1. 1 1
      SimulationServer/Component/SJAllTotalTaskPerformance.cs
  2. 27 24
      SimulationServer/Component/TaskComponent.cs
  3. 5 22
      SimulationServer/Entity/AircraftLandSJ.cs
  4. 3 3
      SimulationServer/Entity/AircraftSJ.cs
  5. 11 11
      SimulationServer/EventHandler/ServerStartEventHandler.cs
  6. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/搜救任务总体指标报告.xls
  7. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻任务总体指标报告.xls
  8. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务1/1-1搜救任务单机指标报告.xls
  9. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务1/1-2搜救任务单机指标报告.xls
  10. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务2/2-1搜救任务单机指标报告.xls
  11. BIN
      SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务3/2-2搜救任务单机指标报告.xls
  12. BIN
      SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/搜救任务总体指标报告.xls
  13. BIN
      SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜救任务总体指标报告.xls
  14. BIN
      SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务1/3-1搜救任务单机指标报告.xls
  15. BIN
      SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务2/3-2搜救任务单机指标报告.xls
  16. BIN
      SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务3/4-1搜救任务单机指标报告.xls
  17. BIN
      SimulationServer/bin/Debug/net7.0/SimulationCommon.dll
  18. BIN
      SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb
  19. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.dll
  20. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.exe
  21. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.pdb

+ 1 - 1
SimulationServer/Component/SJAllTotalTaskPerformance.cs

@@ -147,7 +147,7 @@ public class SJAllTotalTaskPerformanceComponent
             { "平均搜索时间", LSJAllTotalTaskPerformance.平均搜索时间.ToString() },
             { "平均救助时间", LSJAllTotalTaskPerformance.平均救助时间.ToString() },
             { "总飞行时间", LSJAllTotalTaskPerformance.总飞行时间.ToString() },
-            { "环境覆盖率", LSJAllTotalTaskPerformance.海情覆盖率.ToString() },
+            { "环境覆盖率", LSJAllTotalTaskPerformance.环境覆盖率.ToString() },
             { "任务是否成功", LSJAllTotalTaskPerformance.任务是否成功.ToString() },
             { "人员存活率", LSJAllTotalTaskPerformance.人员存活率.ToString() }
         };

+ 27 - 24
SimulationServer/Component/TaskComponent.cs

@@ -187,38 +187,41 @@ public class TaskComponentUpdateSystem : UpdateSystem<TaskComponent>
 {
     public override void Update(TaskComponent self)
     {
-        if (self.SeaSJRescueMissions.Count <= 0) return;
-
-        if (self.SeaSJRescueMissions.All(m => m.IsOver))
+        if (self.SeaSJRescueMissions.Count > 0)
         {
-            for (int i = 0; i < self.ExecutionContext; i++)
+            if (self.SeaSJRescueMissions.All(m => m.IsOver))
             {
-                self.SSJAllTotalTaskPerformance.FillData(self.SeaSJRescueMissions);
-                var report = self.SSJAllTotalTaskPerformance.GetReport();
-                if (report["总任务表现"]["任务是否成功"] == "1")
-                    self.seaSuccessCount++;
-                self.SaveSeaSJ(report);
+                for (int i = 0; i < self.ExecutionContext; i++)
+                {
+                    self.SSJAllTotalTaskPerformance.FillData(self.SeaSJRescueMissions);
+                    var report = self.SSJAllTotalTaskPerformance.GetReport();
+                    if (report["总任务表现"]["任务是否成功"] == "1")
+                        self.seaSuccessCount++;
+                    self.SaveSeaSJ(report);
+                }
+                self.SaveTotalMHSea();
+                self.ReportAllSJSea();
+                self.SeaSJRescueMissions.Clear();
             }
-            self.SaveTotalMHSea();
-            self.ReportAllSJSea();
-            self.SeaSJRescueMissions.Clear();
-        }
 
-        if (self.LandSJRescueMissions.Count <= 0) return;
+        }
 
-        if (self.LandSJRescueMissions.All(m => m.IsOver))
+        if (self.LandSJRescueMissions.Count > 0)
         {
-            for (int i = 0; i < self.ExecutionContext; i++)
+            if (self.LandSJRescueMissions.All(m => m.IsOver))
             {
-                self.SSJAllTotalTaskPerformance.FillData1(self.LandSJRescueMissions);
-                var report = self.SSJAllTotalTaskPerformance.GetReport1();
-                if (report["总任务表现"]["任务是否成功"] == "1")
-                    self.landSuccessCount++;
-                self.SaveLandSJ(report);
+                for (int i = 0; i < self.ExecutionContext; i++)
+                {
+                    self.SSJAllTotalTaskPerformance.FillData1(self.LandSJRescueMissions);
+                    var report = self.SSJAllTotalTaskPerformance.GetReport1();
+                    if (report["总任务表现"]["任务是否成功"] == "1")
+                        self.landSuccessCount++;
+                    self.SaveLandSJ(report);
+                }
+                self.SaveTotalMHLand();
+                self.ReportAllSJLand();
+                self.LandSJRescueMissions.Clear();
             }
-            self.SaveTotalMHLand();
-            self.ReportAllSJLand();
-            self.LandSJRescueMissions.Clear();
         }
     }
 }

+ 5 - 22
SimulationServer/Entity/AircraftLandSJ.cs

@@ -39,9 +39,7 @@ public class AircraftLandSJ : AircraftEntity
     {
         Velocitys = new double[5] { 220, 220, 60, 110, 0 }; // 速度
 
-        List<double[]> route = ContourSearch.ContourSearch1(SearchMissionMode.Poly, SearchMissionMode.interval,
-            SearchMissionMode.MinLength, SearchMissionMode.TrueH, SearchMissionMode.JG, ContourSearch.DemHelper());
-
+        List<double[]> route = ContourSearch.ContourSearch1(SearchMissionMode.Poly, SearchMissionMode.interval,SearchMissionMode.MinLength, SearchMissionMode.TrueH, SearchMissionMode.JG, ContourSearch.DemHelper());
 
         // route 转成 List<AirRoute>
         List<AirRoute> airRoutes = new List<AirRoute>();
@@ -57,7 +55,6 @@ public class AircraftLandSJ : AircraftEntity
 
         FlightPlanEditor.airroute = airRoutes.ToArray();
 
-
         FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints); //生成从起点到任务段起点的航路点
 
         // TODO 与王子涵确认这个方法
@@ -76,7 +73,7 @@ public class AircraftLandSJ : AircraftEntity
             double finalProbability = 1.0;
             Random random = new Random();
             int fireIndex = -1; // 记录发现火点的位置
-
+            //IsOver = true;
             do
             {
                 (currentLocation, _) =
@@ -94,32 +91,18 @@ public class AircraftLandSJ : AircraftEntity
                     targetPoint.y);
                 Log.Info("距离:====================" + distance);
 
-                //====================================================
-                Text_readNC text_ReadNC = new Text_readNC();
-                text_ReadNC.GetNCData();
-                text_ReadNC.GetWaveHighData();
-                var nCread = text_ReadNC.windNCread;
-                var wind = SeaSJ.GetWindVelocityFromAPI(nCread, currentLocation.CurrentLat, currentLocation.CurrentLon,temptime);
-
-
-                var windSpeed = Math.Sqrt(wind[0] * wind[0] + wind[1] * wind[1]);
-
-                var waveHigh = SeaSJ.GetWaveHeightFromAPI(nCread, currentLocation.CurrentLon,
-                    currentLocation.CurrentLat, temptime);
-
-                //====================================================
                 if (distance < 20)
                 {
                     //TODO 和学生对接确认, 发现概率算法
                     probability = helper.getProbability(aricraftPoint, targetPoint, currentLocation.CurrentCourse,
-                        windSpeed, waveHigh, "落水人员", "海上"); // 计算发现概率,需要其他模型输入 // 计算发现概率,需要其他模型输入
+                        10, 10, "遇险人员", "陆地"); // 计算发现概率,需要其他模型输入 // 计算发现概率,需要其他模型输入
                 }
 
 
                 //finalProbability *= (1 - probability); 
 
                 Console.WriteLine(
-                    $"上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson}");
+                    $"陆上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到遇险人员:{isseePerson}");
 
                 double randomValue = random.NextDouble(); // 生成随机数比较概率
                 if (randomValue < probability) // 1 - finalProbability
@@ -140,7 +123,7 @@ public class AircraftLandSJ : AircraftEntity
             //Console.WriteLine(
             //    $"海上任务1:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson}");
             Console.WriteLine(
-                $"上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson}");
+                $"上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到遇险人员:{isseePerson}");
 
             //finalProbability = 1 - finalProbability; 
 

+ 3 - 3
SimulationServer/Entity/AircraftSJ.cs

@@ -204,13 +204,13 @@ public class AircraftSJ : AircraftEntity
                         windSpeed, waveHigh, "落水人员", "海上"); // 计算发现概率,需要其他模型输入 // 计算发现概率,需要其他模型输入
                 }
 
-                finalProbability *= (1 - probability); //
+                //finalProbability *= (1 - probability);
 
                 Console.WriteLine(
                     $"海上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson}");
 
                 double randomValue = random.NextDouble(); // 生成随机数比较概率
-                if (randomValue < (1 - finalProbability))  // probability
+                if (randomValue < probability)  //  1 - finalProbability
                 {
                     isseePerson = true;
                     this.isseePerson = true;
@@ -229,7 +229,7 @@ public class AircraftSJ : AircraftEntity
             Console.WriteLine(
                 $"海上任务:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson},人员是否幸存:{Success}");
 
-            finalProbability = 1 - finalProbability; //
+            //finalProbability = 1 - finalProbability;
 
             if (fireIndex != -1)
             {

+ 11 - 11
SimulationServer/EventHandler/ServerStartEventHandler.cs

@@ -97,17 +97,17 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         }
         //Console.WriteLine("taskConfig.seaSouJiuTasks.Count:" + taskConfig.seaSouJiuTasks.Count);
         //创建搜救
-        //foreach (var seaSJTask in taskConfig.seaSouJiuTasks)
-        //{
-        //    //Console.WriteLine("seaSJTask.missionInformation.MissionName:" + seaSJTask.missionInformation.MissionName);
-        //    //Console.WriteLine("TargetPointId:" + seaSJTask.TargetPointId);
-        //    //Console.WriteLine("SearchPayload:" + seaSJTask.SearchPayload);
-        //    //Console.WriteLine("SearchMode:" + seaSJTask.SearchMode);
-        //    //Console.WriteLine("RadarTransmitterPower:" + seaSJTask.RadarTransmitterPower);
-        //    //Console.WriteLine("仿真次数:" + editorConfig.runCounts);
-        //    Game.EventSystem.Publish(new CreateSeaSJTask
-        //    { EditorConfig = editorConfig, SeaSJTask = seaSJTask });
-        //}
+        foreach (var seaSJTask in taskConfig.seaSouJiuTasks)
+        {
+            //Console.WriteLine("seaSJTask.missionInformation.MissionName:" + seaSJTask.missionInformation.MissionName);
+            //Console.WriteLine("TargetPointId:" + seaSJTask.TargetPointId);
+            //Console.WriteLine("SearchPayload:" + seaSJTask.SearchPayload);
+            //Console.WriteLine("SearchMode:" + seaSJTask.SearchMode);
+            //Console.WriteLine("RadarTransmitterPower:" + seaSJTask.RadarTransmitterPower);
+            //Console.WriteLine("仿真次数:" + editorConfig.runCounts);
+            Game.EventSystem.Publish(new CreateSeaSJTask
+            { EditorConfig = editorConfig, SeaSJTask = seaSJTask });
+        }
 
         foreach (var landSXTask in taskConfig.LandSouXunTasks)
         {

BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/搜救任务总体指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻任务总体指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务1/1-1搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务1/1-2搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务2/2-1搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/LSX/2024-08-26/陆上搜寻救援任务 陆上搜寻任务3/2-2搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/搜救任务总体指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜救任务总体指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务1/3-1搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务2/3-2搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/SSJ/2024-08-26/海上搜索救援任务 海上搜救任务3/4-1搜救任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.exe


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.pdb