Browse Source

修改搜索方式和搜索扫视宽度

liyang 6 months ago
parent
commit
9fc7fd088f

+ 30 - 30
Models/SimulationCommon/Rectangular_Area_Search_Function.cs

@@ -215,36 +215,36 @@ public class Rectangular_Area_Search_Function
             double[] Point2 = GetCrossPoint(line_Parallel_Base, line_Perpendicular_Base_right);
             double[] Point3 = GetCrossPoint(line_Parallel_Base, line_Perpendicular_Base_left);
 
-            List<double> temp0 = new List<double>();
-            List<double> temp1 = new List<double>();
-            List<double> temp2 = new List<double>();
-            List<double> temp3 = new List<double>();
-
-            double lat0 = Point0[0];
-            double lon0 = Point0[1];
-            double lat1 = Point1[0];
-            double lon1 = Point1[1];
-            double lat2 = Point2[0];
-            double lon2 = Point2[1];
-            double lat3 = Point3[0];
-            double lon3 = Point3[1];
-
-            temp0.Add(Math.Max(Math.Max(Math.Max(lat0, lat1), lat2), lat3));
-            temp0.Add(Math.Min(Math.Min(Math.Min(lon0, lon1), lon2), lon3));
-
-            temp1.Add(Math.Max(Math.Max(Math.Max(lat0, lat1), lat2), lat3));
-            temp1.Add(Math.Max(Math.Max(Math.Max(lon0, lon1), lon2), lon3));
-
-            temp2.Add(Math.Min(Math.Min(Math.Min(lat0, lat1), lat2), lat3));
-            temp2.Add(Math.Max(Math.Max(Math.Max(lon0, lon1), lon2), lon3));
-
-            temp3.Add(Math.Min(Math.Min(Math.Min(lat0, lat1), lat2), lat3));
-            temp3.Add(Math.Min(Math.Min(Math.Min(lon0, lon1), lon2), lon3));
-
-            Point0 = temp0.ToArray();
-            Point1 = temp1.ToArray();
-            Point2 = temp2.ToArray();
-            Point3 = temp3.ToArray();
+            //List<double> temp0 = new List<double>();
+            //List<double> temp1 = new List<double>();
+            //List<double> temp2 = new List<double>();
+            //List<double> temp3 = new List<double>();
+
+            //double lat0 = Point0[0];
+            //double lon0 = Point0[1];
+            //double lat1 = Point1[0];
+            //double lon1 = Point1[1];
+            //double lat2 = Point2[0];
+            //double lon2 = Point2[1];
+            //double lat3 = Point3[0];
+            //double lon3 = Point3[1];
+
+            //temp0.Add(Math.Max(Math.Max(Math.Max(lat0, lat1), lat2), lat3));
+            //temp0.Add(Math.Min(Math.Min(Math.Min(lon0, lon1), lon2), lon3));
+
+            //temp1.Add(Math.Max(Math.Max(Math.Max(lat0, lat1), lat2), lat3));
+            //temp1.Add(Math.Max(Math.Max(Math.Max(lon0, lon1), lon2), lon3));
+
+            //temp2.Add(Math.Min(Math.Min(Math.Min(lat0, lat1), lat2), lat3));
+            //temp2.Add(Math.Max(Math.Max(Math.Max(lon0, lon1), lon2), lon3));
+
+            //temp3.Add(Math.Min(Math.Min(Math.Min(lat0, lat1), lat2), lat3));
+            //temp3.Add(Math.Min(Math.Min(Math.Min(lon0, lon1), lon2), lon3));
+
+            //Point0 = temp0.ToArray();
+            //Point1 = temp1.ToArray();
+            //Point2 = temp2.ToArray();
+            //Point3 = temp3.ToArray();
 
             double rectangular_area = GetRectangularArea(Point0, Point1, Point2, Point3);
 

+ 4 - 4
Models/SimulationCommon/Text_readNC.cs

@@ -118,7 +118,7 @@ public class Text_readNC
             using (StreamReader reader2 = new StreamReader(response2.GetResponseStream()))
             {
                 string result2 = reader2.ReadToEnd();
-
+                //Console.WriteLine("result2:" + result2);
                 // Parse the JSON string into a JObject
                 JObject resultObject2 = JObject.Parse(result2);
 
@@ -167,7 +167,7 @@ public class Text_readNC
             using (StreamReader reader3 = new StreamReader(response3.GetResponseStream()))
             {
                 string result3 = reader3.ReadToEnd();
-
+                //Console.WriteLine("result3:" + result3);
                 // Parse the JSON string into a JObject
                 JObject resultObject3 = JObject.Parse(result3);
 
@@ -214,7 +214,7 @@ public class Text_readNC
             using (StreamReader reader4 = new StreamReader(response4.GetResponseStream()))
             {
                 string result4 = reader4.ReadToEnd();
-
+                //Console.WriteLine("result4:" + result4);
                 // Parse the JSON string into a JObject
                 JObject resultObject4 = JObject.Parse(result4);
 
@@ -265,7 +265,7 @@ public class Text_readNC
             using (StreamReader reader1 = new StreamReader(response1.GetResponseStream()))
             {
                 string result1 = reader1.ReadToEnd();
-
+                //Console.WriteLine("result1:" + result1);
                 // Parse the JSON string into a JObject
                 JObject resultObject1 = JObject.Parse(result1);
 

+ 1 - 0
Models/SimulationCommon/temp_readNC.cs

@@ -29,6 +29,7 @@ public class GetNCData
             using (StreamReader reader1 = new StreamReader(response1.GetResponseStream()))
             {
                 string result1 = reader1.ReadToEnd();
+                //Console.WriteLine("result1:" + result1);
 
                 // Parse the JSON string into a JObject
                 JObject resultObject1 = JObject.Parse(result1);

+ 13 - 6
SimulationServer/Entity/AircraftSJ.cs

@@ -101,6 +101,10 @@ public class AircraftSJ : AircraftEntity
 
         //漂移轨迹
         List<double[]> trajectory = SeaSJ.CalculateDriftTrajectory(nCread, initialPosition, dt, totalTime, text_ReadNC.times, text_ReadNC.latitudes, text_ReadNC.longitudes, text_ReadNC.times1, text_ReadNC.latitudes1, text_ReadNC.longitudes1, text_ReadNC.times2, text_ReadNC.latitudes2, text_ReadNC.longitudes2, text_ReadNC.times3, text_ReadNC.latitudes3, text_ReadNC.longitudes3, Days, Hour, text_ReadNC.initlatitudes, text_ReadNC.initlongitudes);
+        foreach ( var trajectoryItem in trajectory)
+        {
+            Console.WriteLine("trajectory:" + trajectoryItem[0] + "_" + trajectoryItem[1]);
+        }
 
         // 生成任务终点
         MissionEndPoint = new MissionEndPoint
@@ -111,6 +115,7 @@ public class AircraftSJ : AircraftEntity
         };
 
         var temp = SeaSJ.getminEnclosingRect(trajectory); // 
+
         seaArea = Rectangular_Area_Search_Function.min_area;
         // temp 转成 List<Point>
         List<Point> points = new List<Point>();
@@ -118,10 +123,10 @@ public class AircraftSJ : AircraftEntity
         {
             points.Add(new Point(item[0], item[1]));
         }
-        //foreach (var item in points)
-        //{
-        //    Console.WriteLine("item:" + item.lat + "-" + item.lon);
-        //}
+        foreach (var item in points)
+        {
+            Console.WriteLine("item:" + item.lat + "-" + item.lon);
+        }
         Point basePoint = new Point(FlightPlanEditor.originbase.BaseLatitude,
             FlightPlanEditor.originbase.BaseLongitude);
         List<Point> waypoints = new List<Point>();
@@ -217,11 +222,13 @@ public class AircraftSJ : AircraftEntity
         FlightPlanEditor.missionpoint = missionPoint;
 
         FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints); //生成从起点到任务段起点的航路点
-
         FXJHGenerate.SeaSouJiu(FlightPlanEditor, ref TurningPoints);
-
         FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions);
 
+        foreach (var item in TurningPoints)
+        {
+            Console.WriteLine("TurningPointLatitude:" + item.TurningPointLatitude + "_" + "TurningPointLongitude:" + item.TurningPointLongitude);
+        }
 
         double time = 0; // 第一次 搜寻结束
         for (int i = 0; i < TurningPoints.Count - 2; i++)

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

@@ -1,5 +1,5 @@
 {
-    "仿真次数":2,
+    "仿真次数":10,
     "想定信息": {
         "想定日期": "2024年6月4日",
         "想定时间": "00时00分00秒"

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

@@ -130,7 +130,7 @@
                         ]
                     ],
                     "环境搜索覆盖面积": 95.8,
-                    "搜索扫视宽度": 0.02
+                    "搜索扫视宽度": 0.2
                 }
             ]
         },
@@ -258,9 +258,9 @@
             ],
             "搜索方式": [
                 {
-                    "搜索方式": "扩展矩形搜索",
+                    "搜索方式": "扇形搜索", //"平行线搜索", //"扩展矩形搜索",
                     "应用飞机编号": "3-1",
-                    "搜索扫视宽度": 0.02
+                    "搜索扫视宽度": 0.2
                 }
             ]
         },
@@ -312,7 +312,7 @@
                 {
                     "搜索方式": "扇形搜索", //扩展矩形搜索
                     "应用飞机编号": "3-2",
-                    "搜索扫视宽度": 0.02
+                    "搜索扫视宽度": 0.2
                 }
             ]
         }
@@ -494,7 +494,7 @@
             ]
         }
     ],
-    "空中吊运救援任务": [  // 作为子任务,平均搜索时间为0 任务成功率 0
+    "空中吊运救援任务": [
         {
             "任务信息": {
                 "任务名称": "空中吊运救援任务1",

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