Selaa lähdekoodia

添加索滑降和吊运部分代码,添加新版雷达模型和光电模型

liyang 6 kuukautta sitten
vanhempi
sitoutus
457a39dec5

+ 75 - 0
Models/SimulationCommon/EquationHelper.cs

@@ -7,6 +7,7 @@ using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using SJ;
 using Model;
+using MathNet.Numerics;
 
 namespace MuShiApp
 {
@@ -133,6 +134,80 @@ namespace MuShiApp
             return posibility[GetType(targetPoint.TargetType.Type)];
         }
 
+        // Pd0 = 0.5 / Pf0 = Math.Pow(10,-6) / Pf = Math.Pow(10,-6) / R0 = 23645 / sigma0 = 5000 / sigma = Editor雷达截面面积 // R 单位m 
+        public double GetRadarPossibility(double Pd0, double Pf0, double Pf, double R0, double3 aircraftPoint , TargetPoint targetPoint, double sigma, double sigma0, double visibility)
+        {
+            var distance = GetDistance(aircraftPoint.x, targetPoint.TargetPointLongitude, aircraftPoint.y, targetPoint.TargetPointLatitude);
+            double R = 1000 * distance;
+            //修正系数
+            double RadarC = 1;
+
+            //能见度单位:km
+            if (visibility >= 1)
+            {
+                RadarC = 1;
+            }
+            else if (visibility >= 0.3 && visibility < 1)
+            {
+                RadarC = 0.8;
+            }
+            else if (visibility >= 0.09 && visibility < 0.3)
+            {
+                RadarC = 0.6;
+            }
+            else
+            {
+                RadarC = 0.2;
+            }
+
+            double Possibility0 = 0;
+            double SNR = 1;
+
+            //SNR为信噪比;sigma为实际目标雷达截面积,单位:平方米;sigma0为理论目标雷达截面积,单位:平方米
+            SNR = sigma * Math.Pow(R0, 4) / (sigma0 * Math.Pow(R, 4));
+
+            Possibility0 = Math.Pow(Math.E, Math.Log(Pd0, Math.E) * Math.Log(Pf, Math.E) / (SNR * Math.Log(Pf0, Math.E) + Math.Log(Pd0, Math.E)));
+
+            double Possibility = RadarC * Possibility0;
+
+            return Possibility;
+        }
+
+        // Lt = 探测目标亮度 Editor / At = 探测目标面积 Editor / τa = 1 / Lb = 3 / A0 = 1 / D0 = 0.075 / Dstar = 3 / τo = 0.8 / Ad = 0.0073728 / Δf = 0.125 / δ = 0.5 / Pf0 = Math.Pow(10, -6);
+        public double GetInfraredDetectionProbability(double Lt, double At, double τa, double Lb, double A0, double3 aircraftPoint, TargetPoint targetPoint, double D0, double Dstar, double τo, double Ad, double Δf, double δ, double Pf0)
+        {
+            var distance = GetDistance(aircraftPoint.x, targetPoint.TargetPointLongitude, aircraftPoint.y, targetPoint.TargetPointLatitude);
+            double R = 1000 * distance;
+            //确定由Pfa确定的最小信噪比
+            double minSNR = Math.Sqrt(-2 * Math.Log(Pf0, Math.E));
+
+            // 计算信噪比
+            double a = (Lt * At * τa - Lb * A0) * Math.PI * Math.Pow(D0, 2) * Dstar * δ * τo;
+            double b = 4 * Math.Sqrt(Ad * Δf) * Math.Pow(R, 2);
+            double SNR = a / b;
+
+            // 使用 Math.NET Numerics 库计算高斯积分
+            double Pd = GaussianIntegral(SNR - minSNR);
+
+            return Pd;
+        }
+
+        public static double GaussianIntegral(double x)
+        {
+            double integral = 1;
+
+            if (x < 0)
+            {
+                integral = 0.5 - Math.Pow(Math.Sqrt(2 * Math.PI), -1) * Integrate.OnClosedInterval(t => Math.Exp(-Math.Pow(t, 2) / 2), 0, -x, 1e-2);
+            }
+            else
+            {
+                integral = 0.5 + Math.Pow(Math.Sqrt(2 * Math.PI), -1) * Integrate.OnClosedInterval(t => Math.Exp(-Math.Pow(t, 2) / 2), 0, x, 1e-2);
+            }
+
+            return integral;
+        }
+
         public int GetType(string type)
         {
             switch (type)

+ 83 - 0
SimulationServer/Entity/AircraftDY.cs

@@ -0,0 +1,83 @@
+using KYFramework;
+using Model;
+using MongoDB.Bson;
+
+namespace SimulationServer;
+
+public class AircraftDY : AircraftEntity
+{
+    public SHJTask content;
+    public SHJParameter SHJParameter;
+    public override void End()
+    {
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
+    }
+
+    public override void Start()
+    {
+        FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
+        // 吊运上升速度  吊运下降速度 Task文件读取
+        double resulttime = get_result_time_rope(SHJParameter.H, SHJParameter.person_number, SHJParameter.windspeed, SHJParameter.vis, 0.75, 1.38).time;//索滑降模型输出的索滑降时间
+        FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor, ref TurningPoints);
+        FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor), ref TurningPoints);
+        FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions);
+    }
+
+    // --接口
+    // --输入
+    // --
+    // 1)吊运高度(m)
+    //--H(double)
+    // 2)吊运人数
+    //--person_number(int)
+    // 3)风速(m/s)
+    //--windspeed(double)
+    // 4)能见度(m/)
+    // --vis(double)
+    // 5)吊运上升速度(m/s)
+    //--upspeed(double)
+    // 6)吊运下降速度(m/s)
+    //--downspeed(double)
+    // --
+    // --输出
+    // --
+    // 1)能否吊运、吊运时间
+    //--result(handling_result)
+    // --
+    //--定义handling_result类
+
+    // 吊运函数
+    public static handling_result get_result_time_rope(double H, int person_number, double windspeed, double vis, double upspeed, double downspeed)
+    {
+
+        handling_result result = new handling_result();
+
+        if (windspeed < 8 && vis > 3)
+        {
+            result.time = (person_number * H) / downspeed + (person_number * H) / upspeed;
+            result.success = true;
+        }
+        else
+        {
+            result.success = false;
+        }
+        return result;
+    }
+}
+
+public class handling_result
+{
+    public bool success { get; set; }
+    public double time { get; set; }
+}
+
+[ObjectSystem]
+public class AircraftDYAwakeSystem : AwakeSystem<AircraftDY, FlightPlanEditor, SHJTask>
+{
+    public override void Awake(AircraftDY self, FlightPlanEditor flightPlanEditor, SHJTask shjTask)
+    {
+        self.content = shjTask;
+        self.FlightPlanEditor = flightPlanEditor;
+        self.Awake();
+    }
+}

+ 53 - 8
SimulationServer/Entity/AircraftSHJ.cs

@@ -12,21 +12,66 @@ public class AircraftSHJ : AircraftEntity
     {
         TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
     }
-    
+
     public override void Start()
     {
-        FXJHGenerate.FromStartToMission(FlightPlanEditor,ref TurningPoints);//生成从起点到任务段起点的航路点
-        double resulttime = Cable_slippage.get_result_time_rope(SHJParameter.H, SHJParameter.person_number, SHJParameter.windspeed, SHJParameter.vis, SHJParameter.descendspeed).time;//索滑降模型输出的索滑降时间
-        FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor,ref TurningPoints);
-        FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor),ref TurningPoints);
-        FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,ref TurningPoints, Velocitys, FuelConsumptions);
+        FXJHGenerate.FromStartToMission(FlightPlanEditor, ref TurningPoints);//生成从起点到任务段起点的航路点
+        double resulttime = get_result_time_rope(SHJParameter.H, SHJParameter.person_number, SHJParameter.windspeed, SHJParameter.vis, SHJParameter.descendspeed).time;//索滑降模型输出的索滑降时间
+        FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor, ref TurningPoints);
+        FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor), ref TurningPoints);
+        FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, ref TurningPoints, Velocitys, FuelConsumptions);
     }
+
+    // --接口
+    // --输入
+    // --
+    // 1)索降高度(m)
+    //--H(double)
+    // 2)索降人数
+    //--person_number(int)
+    // 3)风速(m/s)
+    // --windspeed(double)
+    // 4)能见度(m/)
+    //--vis(double)
+    // 5)索降速度(m/s)
+    // --descendspeed(double)
+    // --
+    // --输出
+    // --
+    // 1)能否索降、索降时间
+    //--result(Cable_result)
+    // --
+    //--定义Cable_result类
+
+    // 绳索滑降函数
+    public Cable_result get_result_time_rope(double H, int person_number, double windspeed, double vis, double descendspeed)
+    {
+        // descendspeed < 8 m/s
+        Cable_result result = new Cable_result();
+
+        if (windspeed < 8 && vis > 3)
+        {
+            result.time = (person_number * H) / descendspeed;
+            result.success = true;
+        }
+        else
+        {
+            result.success = false;
+        }
+        return result;
+    }
+}
+
+public class Cable_result
+{
+    public bool success { get; set; }
+    public double time { get; set; }
 }
 
 [ObjectSystem]
-public class AircraftSHJAwakeSystem : AwakeSystem<AircraftSHJ,FlightPlanEditor,SHJTask>
+public class AircraftSHJAwakeSystem : AwakeSystem<AircraftSHJ, FlightPlanEditor, SHJTask>
 {
-    public override void Awake(AircraftSHJ self,FlightPlanEditor flightPlanEditor,SHJTask shjTask)
+    public override void Awake(AircraftSHJ self, FlightPlanEditor flightPlanEditor, SHJTask shjTask)
     {
         self.content = shjTask;
         self.FlightPlanEditor = flightPlanEditor;

+ 14 - 2
SimulationServer/Entity/AircraftSJ.cs

@@ -265,8 +265,20 @@ public class AircraftSJ : AircraftEntity
                     currentLocation.CurrentLat,
                     targetPoint.y);
                 Log.Info("距离:====================" + distance);
-                probability =
-                    helper.GetMushiSeaProbability(aricraftPoint, vis, waveHigh, FlightPlanEditor.targetpoint[0]);
+                if ("任务载荷" == "雷达搜索")
+                {
+                    // Pd0 = 0.5 / Pf0 = Math.Pow(10,-6) / Pf = Math.Pow(10,-6) / R0 = 23645 / sigma0 = 5000 / sigma = Editor雷达截面面积 // R 单位m 
+                    probability = helper.GetRadarPossibility(0.5, Math.Pow(10, -6), Math.Pow(10, -6), 23645, aricraftPoint, FlightPlanEditor.targetpoint[0], 0.7, 5000, vis);
+                }
+                else if ("任务载荷" == "目视搜素")
+                {
+                    probability = helper.GetMushiSeaProbability(aricraftPoint, vis, waveHigh, FlightPlanEditor.targetpoint[0]);
+                }
+                else if("任务载荷" == "光电(红外)搜索")
+                {
+                    // Lt = 探测目标亮度 Editor / At = 探测目标面积 Editor / τa = 1 / Lb = 3 / A0 = 1 / D0 = 0.075 / Dstar = 3 / τo = 0.8 / Ad = 0.0073728 / Δf = 0.125 / δ = 0.5 / Pf0 = Math.Pow(10, -6);
+                    probability = helper.GetInfraredDetectionProbability(1, 6.63, 1, 3, 1, aricraftPoint, FlightPlanEditor.targetpoint[0], 0.075, 3, 0.8, 0073728, 0.125, 0.5, Math.Pow(10, -6));
+                }
 
                 // probability = helper.getProbability(aricraftPoint, targetPoint,pb, currentLocation.CurrentCourse,
                 //     windSpeed, waveHigh, "落水人员", "海上"); // 计算发现概率,需要其他模型输入 // 计算发现概率,需要其他模型输入