|
@@ -27,6 +27,9 @@ public class AircraftLandSJ : AircraftEntity
|
|
|
public SearchMissionPayload searchMissionPayload;
|
|
|
|
|
|
public double resulttime;
|
|
|
+
|
|
|
+ int Days;
|
|
|
+ int Hour;
|
|
|
public override void Reset()
|
|
|
{
|
|
|
base.Reset();
|
|
@@ -39,6 +42,12 @@ public class AircraftLandSJ : AircraftEntity
|
|
|
|
|
|
public override void Start()
|
|
|
{
|
|
|
+ int Year = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[0]);
|
|
|
+ int Month = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[0]);
|
|
|
+ int Day = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[1].Split("日")[0]);
|
|
|
+ Hour = Convert.ToInt32(taskContent.missionInformation.StartTime.Split("时")[0]);
|
|
|
+ Days = GetDaysInYear(Year, Month, Day);
|
|
|
+
|
|
|
Velocitys = new double[5] { 220, 220, 60, 110, 0 }; // 速度
|
|
|
|
|
|
|
|
@@ -137,10 +146,10 @@ public class AircraftLandSJ : AircraftEntity
|
|
|
//Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH"));
|
|
|
var visibility = helper.getVisibilityByDb(targetPoint.x, targetPoint.y, date); //DateTime.Now.ToString("yyyy-MM-dd HH")
|
|
|
|
|
|
- getNCData = new GetNCData();
|
|
|
- getNCData.initlatitudes = FlightPlanEditor.targetpoint[0].TargetPointLatitude;
|
|
|
- getNCData.initlongitudes = FlightPlanEditor.targetpoint[0].TargetPointLongitude;
|
|
|
- getNCData.GetData();
|
|
|
+ //getNCData = new GetNCData();
|
|
|
+ //getNCData.initlatitudes = FlightPlanEditor.targetpoint[0].TargetPointLatitude;
|
|
|
+ //getNCData.initlongitudes = FlightPlanEditor.targetpoint[0].TargetPointLongitude;
|
|
|
+ //getNCData.GetData();
|
|
|
Task.Run(() =>
|
|
|
{
|
|
|
bool isseePerson = false;
|
|
@@ -236,6 +245,48 @@ public class AircraftLandSJ : AircraftEntity
|
|
|
}
|
|
|
} while (!isseePerson && IsOver == false);
|
|
|
|
|
|
+ if (isseePerson)
|
|
|
+ {
|
|
|
+
|
|
|
+ Text_readNC text_ReadNC = new Text_readNC();
|
|
|
+ text_ReadNC.initlatitudes = FlightPlanEditor.targetpoint[0].TargetPointLatitude;
|
|
|
+ text_ReadNC.initlongitudes = FlightPlanEditor.targetpoint[0].TargetPointLongitude;
|
|
|
+ //text_ReadNC = new Text_readNC();
|
|
|
+ text_ReadNC.GetNCData();
|
|
|
+ var nCread = text_ReadNC.windNCread;
|
|
|
+ var wind = SeaSJ.GetWindVelocityFromAPI(nCread, currentLocation.CurrentLat, currentLocation.CurrentLon,
|
|
|
+ temptime, text_ReadNC.times, text_ReadNC.latitudes, text_ReadNC.longitudes, text_ReadNC.times1, text_ReadNC.latitudes1, text_ReadNC.longitudes1, Days, Hour);
|
|
|
+
|
|
|
+
|
|
|
+ double windSpeed = Math.Sqrt(wind[0] * wind[0] + wind[1] * wind[1]);
|
|
|
+
|
|
|
+ for (int i = 0; i < TurningPoints.Count - 1; i++) // 总飞行时间
|
|
|
+ {
|
|
|
+ TotalTime += TurningPoints[i].SegmentFlightTime; // 总时间
|
|
|
+ }
|
|
|
+
|
|
|
+ double time = TotalTime; //time——搜索时间,单位:秒;数据测试用
|
|
|
+
|
|
|
+ double latitude = FlightPlanEditor.targetpoint[0].TargetPointLatitude; //落水人员纬度;数据测试用
|
|
|
+ double longitude = FlightPlanEditor.targetpoint[0].TargetPointLongitude; //落水人员经度,数据测试用
|
|
|
+
|
|
|
+ double survivalTime = FlightPlanEditor.targetpoint[0].TargetType.LiveTime;//幸存时间
|
|
|
+ // SHJParameter.person_number = Eidtor里读取 SHJParameter.windspeed Nc/Editor目标气象信息读取时间先取任务初始时间
|
|
|
+ resulttime = get_result_time_rope(30, FlightPlanEditor.targetpoint[0].TargetType.Count, windSpeed, visibility, 0.75, 1.38).time; //调运时间
|
|
|
+ Console.WriteLine("resulttime:" + resulttime);
|
|
|
+ //Console.WriteLine("survivalTime:" + survivalTime);
|
|
|
+ if (survivalTime * 3600 > time)
|
|
|
+ {
|
|
|
+ Success = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Success = false;
|
|
|
+ }
|
|
|
+ Log.Info("TotalTime:" + TotalTime);
|
|
|
+ Log.Info("幸存时间:" + survivalTime);
|
|
|
+ }
|
|
|
+
|
|
|
//Console.WriteLine(
|
|
|
// $"海上任务1:{taskContent.missionInformation.MissionName} 机型: {AircraftId} 当前时间:{temptime},当前位置:{currentLocation.CurrentLon},{currentLocation.CurrentLat},{currentLocation.CurrentHei},概率:{probability},最终概率:{1 - finalProbability},是否看到落水人员:{isseePerson}");
|
|
|
Log.Info(
|
|
@@ -284,6 +335,25 @@ public class AircraftLandSJ : AircraftEntity
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ public static int GetDaysInYear(int year, int month, int day)
|
|
|
+ {
|
|
|
+ int[] daysInMonths = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
|
+ if (IsLeapYear(year))
|
|
|
+ {
|
|
|
+ daysInMonths[1] = 29;
|
|
|
+ }
|
|
|
+ int days = day;
|
|
|
+ for (int i = 0; i < month - 1; i++)
|
|
|
+ {
|
|
|
+ days += daysInMonths[i];
|
|
|
+ }
|
|
|
+ return days;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static bool IsLeapYear(int year)
|
|
|
+ {
|
|
|
+ return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
|
|
|
+ }
|
|
|
|
|
|
public override void End()
|
|
|
{
|