public void AddDisplayData(int time, double x, double y, double z, double vx, double vy, double vz, double minX, double maxX, double minY, double maxY, double minZ, double maxZ, double minVx, double maxVx, double minVy, double maxVy, double minVz, double maxVz, FallPoint fallPoint, double fallTime, double distance) { displayDataList.Add(new DisplayData { time = time, x = x, y = y, z = z, vx = vx, vy = vy, vz = vz, minX = minX, maxX = maxX, minY = minY, maxY = maxY, minZ = minZ, maxZ = maxZ, minVx = minVx, maxVx = maxVx, minVy = minVy, maxVy = maxVy, minVz = minVz, maxVz = maxVz, fallPoint = fallPoint, fallTime = fallTime, distance = distance }); }
public void InitChartPoints(FallPoint ideaPoint) { ideaPoint = Algorithm.CalcIdeaPointOfFall(); chartPoints.Series["理想落点"].Points.Add(new SeriesPoint(ideaPoint.x, ideaPoint.y)); chartPoints.Series["必炸线"].Points.Add(new SeriesPoint(-Config.GetInstance().sideLine, Config.GetInstance().forwardLine, Config.GetInstance().backwardLine)); chartPoints.Series["必炸线"].Points.Add(new SeriesPoint(Config.GetInstance().sideLine, Config.GetInstance().forwardLine, Config.GetInstance().backwardLine)); }
public void CalcResultLd(double lambda0, double x, double y, double z, double vx, double vy, double vz, ConstLaunch launchFsx, double h_end, out FallPoint fallPoint, out double fallTime, out double distance) { CalculateOutput output = calc_target_ld(lambda0, x, y, z, vx, vy, vz, launchFsx, h_end); fallPoint = new FallPoint { x = output.t_z, y = output.t_x }; distance = output.t_range; fallTime = output.flighttime; }
public void SetFallPoint(FallPoint fallPoint) { if (fallPoint != null) { chartPoints.Series["预测落点"].Points.Clear(); chartPoints.Series["预测落点"].Points.Add(new SeriesPoint(fallPoint.x, fallPoint.y)); chartPoints.Series["落点误差"].Points.Clear(); chartPoints.Series["落点误差"].Points.Add(new SeriesPoint(fallPoint.x - Config.GetInstance().pointError, fallPoint.y + Config.GetInstance().pointError, fallPoint.y - Config.GetInstance().pointError)); chartPoints.Series["落点误差"].Points.Add(new SeriesPoint(fallPoint.x + Config.GetInstance().pointError, fallPoint.y + Config.GetInstance().pointError, fallPoint.y - Config.GetInstance().pointError)); } }
public void CheckFallPoint(FallPoint fallPoint, double fallTime) { if (fallPoint.x < -Config.GetInstance().sideLine || fallPoint.x > Config.GetInstance().sideLine || fallPoint.y < Config.GetInstance().backwardLine || fallPoint.y > Config.GetInstance().forwardLine) { chartPoints.BackColor = Color.Red; } else { chartPoints.BackColor = Color.White; } }
private void CheckFallPoint(FallPoint fallPoint, double fallTime, int suit) { if (suit == 1) { if (fallPoint.x < -Config.GetInstance().sideLine || fallPoint.x > Config.GetInstance().sideLine || fallPoint.y < Config.GetInstance().backwardLine || fallPoint.y > Config.GetInstance().forwardLine) { if ((DateTime.Now - fallPointAlertTimeSuit1).TotalSeconds > 5) { ShowAlert(); alertFormSuit1.SetAlert(fallPoint, fallTime, suit); alertFormSuit1.Show(); Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_SELF_DESTRUCT, String.Format("落点超出范围:X={0},Y={1}", fallPoint.x, fallPoint.y)); fallPointAlertTimeSuit1 = DateTime.Now; } } else { alertFormSuit1.Hide(); } myChartControl1.CheckFallPoint(fallPoint, fallTime); } else { if (fallPoint.x < -Config.GetInstance().sideLine || fallPoint.x > Config.GetInstance().sideLine || fallPoint.y < Config.GetInstance().backwardLine || fallPoint.y > Config.GetInstance().forwardLine) { if ((DateTime.Now - fallPointAlertTimeSuit2).TotalSeconds > 5) { ShowAlert(); alertFormSuit2.SetAlert(fallPoint, fallTime, suit); alertFormSuit2.Show(); Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_SELF_DESTRUCT, String.Format("落点超出范围:X={0},Y={1}", fallPoint.x, fallPoint.y)); fallPointAlertTimeSuit2 = DateTime.Now; } } else { alertFormSuit2.Hide(); } myChartControl2.CheckFallPoint(fallPoint, fallTime); } }
private void AddDisplayData(int time, double x, double y, double z, double vx, double vy, double vz, double minX, double maxX, double minY, double maxY, double minZ, double maxZ, double minVx, double maxVx, double minVy, double maxVy, double minVz, double maxVz, FallPoint fallPoint, double fallTime, double distance, int suit) { if (suit == 1) { myChartControl1.AddDisplayData(time, x, y, z, vx, vy, vz, minX, maxX, minY, maxY, minZ, maxZ, minVx, maxVx, minVy, maxVy, minVz, maxVz, fallPoint, fallTime, distance); } else { myChartControl2.AddDisplayData(time, x, y, z, vx, vy, vz, minX, maxX, minY, maxY, minZ, maxZ, minVx, maxVx, minVy, maxVy, minVz, maxVz, fallPoint, fallTime, distance); } }
public void CalcResultYc(double latitude, double longitudey, double height, double speedEast, double speedNorth, double speedSky, ConstLaunch launchFsx, double h_end, out FallPoint fallPoint, out double fallTime, out double distance, out double x, out double y, out double z, out double vx, out double vy, out double vz) { CalculateOutput output = calc_target_yc(latitude, longitudey, height, speedEast, speedNorth, speedSky, launchFsx, h_end); fallPoint = new FallPoint { x = output.t_z, y = output.t_x }; distance = output.t_range; fallTime = output.flighttime; x = output.x; y = output.y; z = output.z; vx = output.vx; vy = output.vy; vz = output.vz; }
public void SetAlert(FallPoint fallPoint, double fallTime, int suit) { StringBuilder sb = new StringBuilder(); sb.Append("建议启动自毁\n"); if (fallPoint.x < -Config.GetInstance().sideLine) { sb.AppendFormat("[{0}]当前X超出左侧侧向必炸线{1:F}m\n", suit == 1 ? "弹头" : "弹体", Math.Abs(fallPoint.x + Config.GetInstance().sideLine)); } if (fallPoint.x > +Config.GetInstance().sideLine) { sb.AppendFormat("[{0}]当前X超出右侧侧向必炸线{1:F}m\n", suit == 1 ? "弹头" : "弹体", Math.Abs(fallPoint.x - Config.GetInstance().sideLine)); } if (fallPoint.y < Config.GetInstance().backwardLine) { sb.AppendFormat("[{0}]当前Y超出后向必炸线{1:F}m\n", suit == 1 ? "弹头" : "弹体", Math.Abs(Config.GetInstance().backwardLine - fallPoint.y)); } if (fallPoint.y > Config.GetInstance().forwardLine) { sb.AppendFormat("[{0}]当前Y超出前向必炸线{1:F}m\n", suit == 1 ? "弹头" : "弹体", Math.Abs(fallPoint.y - Config.GetInstance().forwardLine)); } sb.AppendFormat("[{0}]剩余落地时间:{1:F}s", suit == 1 ? "弹头" : "弹体", fallTime); AlertLabel.Text = sb.ToString(); }
private void InitChartPoints() { ideaPoint = Algorithm.CalcIdeaPointOfFall(); myChartControl1.InitChartPoints(ideaPoint); myChartControl2.InitChartPoints(ideaPoint); }
protected override void DefWndProc(ref Message m) { IntPtr ptr = m.LParam; switch (m.Msg) { case WM_RADAR_DATA: if (Config.GetInstance().source == 0) { S_OBJECT sObject = Marshal.PtrToStructure <S_OBJECT>(ptr); historyData.AddObject(sObject); FallPoint fallPoint = null; double distance = 0; double fallTime = 0; try { algorithm.CalcResultLd(Config.GetInstance().longitudeInit, sObject.X, sObject.Y, sObject.Z, sObject.VX, sObject.VY, sObject.VZ, constLaunchFsx, Config.GetInstance().placementHeight, out fallPoint, out fallTime, out distance); CheckFallPoint(fallPoint, fallTime, 1); historyData.AddFallPoint(fallPoint); } catch (Exception) { } AddDisplayData(sObject.time, sObject.X, sObject.Y, sObject.Z, sObject.VX, sObject.VY, sObject.VZ, sObject.MinX, sObject.MaxX, sObject.MinY, sObject.MaxY, sObject.MinZ, sObject.MaxZ, sObject.MinVx, sObject.MaxVx, sObject.MinVy, sObject.MaxVy, sObject.MinVz, sObject.MaxVz, fallPoint, fallTime, distance, 1); CheckPosition(sObject.X, sObject.Y, sObject.Z, sObject.MinX, sObject.MaxX, sObject.MinY, sObject.MaxY, sObject.MinZ, sObject.MaxZ, 1); CheckSpeed(sObject.VX, sObject.VY, sObject.VZ, sObject.MinVx, sObject.MaxVx, sObject.MinVy, sObject.MaxVy, sObject.MinVz, sObject.MaxVz, 1); } Marshal.FreeHGlobal(ptr); break; case WM_RADAR_DATA_COMMING: recvRaderNetworkDataTime = DateTime.Now; picRadarNetwork.Image = greenLedImage; break; case WM_TELEMETRY_DATA_COMMING: recvTelemetryNetworkDataTime = DateTime.Now; picTelemetryNetwork.Image = greenLedImage; break; case WM_T0: editT0.Enabled = btnStartT0.Enabled = false; break; case WM_YC_I: if (Config.GetInstance().source == 1) { YcMessage msg = Marshal.PtrToStructure <YcMessage>(ptr); historyData.AddObject(msg.sObject); FallPoint fallPoint = msg.fallPoint; double fallTime = msg.fallTime; double distance = msg.distance; historyData.AddFallPoint(fallPoint); AddDisplayData(msg.sObject.time, msg.sObject.X, msg.sObject.Y, msg.sObject.Z, msg.sObject.VX, msg.sObject.VY, msg.sObject.VZ, msg.sObject.MinX, msg.sObject.MaxX, msg.sObject.MinY, msg.sObject.MaxY, msg.sObject.MinZ, msg.sObject.MaxZ, msg.sObject.MinVx, msg.sObject.MaxVx, msg.sObject.MinVy, msg.sObject.MaxVy, msg.sObject.MinVz, msg.sObject.MaxVz, fallPoint, fallTime, distance, 1); CheckFallPoint(fallPoint, fallTime, 1); CheckPosition(msg.sObject.X, msg.sObject.Y, msg.sObject.Z, msg.sObject.MinX, msg.sObject.MaxX, msg.sObject.MinY, msg.sObject.MaxY, msg.sObject.MinZ, msg.sObject.MaxZ, 1); CheckSpeed(msg.sObject.VX, msg.sObject.VY, msg.sObject.VZ, msg.sObject.MinVx, msg.sObject.MaxVx, msg.sObject.MinVy, msg.sObject.MaxVy, msg.sObject.MinVz, msg.sObject.MaxVz, 1); } Marshal.FreeHGlobal(ptr); break; case WM_YC_II: if (Config.GetInstance().source == 1) { YcMessage msg = Marshal.PtrToStructure <YcMessage>(ptr); historyData.AddObject(msg.sObject); FallPoint fallPoint = msg.fallPoint; double fallTime = msg.fallTime; double distance = msg.distance; historyData.AddFallPoint(fallPoint); AddDisplayData(msg.sObject.time, msg.sObject.X, msg.sObject.Y, msg.sObject.Z, msg.sObject.VX, msg.sObject.VY, msg.sObject.VZ, msg.sObject.MinX, msg.sObject.MaxX, msg.sObject.MinY, msg.sObject.MaxY, msg.sObject.MinZ, msg.sObject.MaxZ, msg.sObject.MinVx, msg.sObject.MaxVx, msg.sObject.MinVy, msg.sObject.MaxVy, msg.sObject.MinVz, msg.sObject.MaxVz, fallPoint, fallTime, distance, 2); CheckFallPoint(fallPoint, fallTime, 2); CheckPosition(msg.sObject.X, msg.sObject.Y, msg.sObject.Z, msg.sObject.MinX, msg.sObject.MaxX, msg.sObject.MinY, msg.sObject.MaxY, msg.sObject.MinZ, msg.sObject.MaxZ, 2); CheckSpeed(msg.sObject.VX, msg.sObject.VY, msg.sObject.VZ, msg.sObject.MinVx, msg.sObject.MaxVx, msg.sObject.MinVy, msg.sObject.MaxVy, msg.sObject.MinVz, msg.sObject.MaxVz, 2); } Marshal.FreeHGlobal(ptr); break; default: base.DefWndProc(ref m); break; } }
private void LoadTestInfo() { using (DataModels.DatabaseDB db = new DataModels.DatabaseDB()) { var temp = from c in db.TestInfos where c.Id == recordId select c; DataModels.TestInfo testInfo = null; foreach (DataModels.TestInfo info in temp) { testInfo = info; } editTestName.Text = testInfo?.TestName; editOperator.Text = testInfo?.Operator; editTestDate.Text = testInfo?.Time.ToString("yyyy-MM-dd HH:mm:ss"); editComment.Text = testInfo?.Comment; String strDateFile = @".\Log\" + testInfo?.Time.ToString("yyyyMMddHHmmss") + @"\History.dat"; try { using (FileStream fs = new FileStream(strDateFile, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); historyData = (HistoryData)formatter.Deserialize(fs); } } catch (Exception ex) { XtraMessageBox.Show("读取历史数据失败:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (historyData == null || historyData.Objects == null || historyData.Objects.Count == 0) { return; } List <SeriesPoint> positionXBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMinXBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMaxXBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionYBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMinYBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMaxYBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionZBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMinZBuffer = new List <SeriesPoint>(); List <SeriesPoint> positionMaxZBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedVxBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMinVxBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMaxVxBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedVyBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMinVyBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMaxVyBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedVzBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMinVzBuffer = new List <SeriesPoint>(); List <SeriesPoint> speedMaxVzBuffer = new List <SeriesPoint>(); foreach (S_OBJECT obj in historyData.Objects) { positionXBuffer.Add(new SeriesPoint(obj.time, obj.X)); positionMinXBuffer.Add(new SeriesPoint(obj.time, obj.MinX)); positionMaxXBuffer.Add(new SeriesPoint(obj.time, obj.MaxX)); positionYBuffer.Add(new SeriesPoint(obj.time, obj.Y)); positionMinYBuffer.Add(new SeriesPoint(obj.time, obj.MinY)); positionMaxYBuffer.Add(new SeriesPoint(obj.time, obj.MaxY)); positionZBuffer.Add(new SeriesPoint(obj.time, obj.Z)); positionMinZBuffer.Add(new SeriesPoint(obj.time, obj.MinZ)); positionMaxZBuffer.Add(new SeriesPoint(obj.time, obj.MaxZ)); speedVxBuffer.Add(new SeriesPoint(obj.time, obj.VX)); speedMinVxBuffer.Add(new SeriesPoint(obj.time, obj.MinVx)); speedMaxVxBuffer.Add(new SeriesPoint(obj.time, obj.MaxVx)); speedVyBuffer.Add(new SeriesPoint(obj.time, obj.VY)); speedMinVyBuffer.Add(new SeriesPoint(obj.time, obj.MinVy)); speedMaxVyBuffer.Add(new SeriesPoint(obj.time, obj.MaxVy)); speedVzBuffer.Add(new SeriesPoint(obj.time, obj.VZ)); speedMinVzBuffer.Add(new SeriesPoint(obj.time, obj.MinVz)); speedMaxVzBuffer.Add(new SeriesPoint(obj.time, obj.MaxVz)); } chartX.BeginInit(); chartX.Series["位置X"].Points.AddRange(positionXBuffer.ToArray()); chartX.Series["位置X上限"].Points.AddRange(positionMaxXBuffer.ToArray()); chartX.Series["位置X下限"].Points.AddRange(positionMinXBuffer.ToArray()); chartX.EndInit(); chartY.BeginInit(); chartY.Series["位置Y"].Points.AddRange(positionYBuffer.ToArray()); chartY.Series["位置Y上限"].Points.AddRange(positionMaxYBuffer.ToArray()); chartY.Series["位置Y下限"].Points.AddRange(positionMinYBuffer.ToArray()); chartY.EndInit(); chartZ.BeginInit(); chartZ.Series["位置Z"].Points.AddRange(positionZBuffer.ToArray()); chartZ.Series["位置Z上限"].Points.AddRange(positionMaxZBuffer.ToArray()); chartZ.Series["位置Z下限"].Points.AddRange(positionMinZBuffer.ToArray()); chartZ.EndInit(); chartVx.BeginInit(); chartVx.Series["速度VX"].Points.AddRange(speedVxBuffer.ToArray()); chartVx.Series["速度VX上限"].Points.AddRange(speedMaxVxBuffer.ToArray()); chartVx.Series["速度VX下限"].Points.AddRange(speedMinVxBuffer.ToArray()); chartVx.EndInit(); chartVy.BeginInit(); chartVy.Series["速度VY"].Points.AddRange(speedVyBuffer.ToArray()); chartVy.Series["速度VY上限"].Points.AddRange(speedMaxVyBuffer.ToArray()); chartVy.Series["速度VY下限"].Points.AddRange(speedMinVyBuffer.ToArray()); chartVy.EndInit(); chartVz.BeginInit(); chartVz.Series["速度VZ"].Points.AddRange(speedVzBuffer.ToArray()); chartVz.Series["速度VZ上限"].Points.AddRange(speedMaxVzBuffer.ToArray()); chartVz.Series["速度VZ下限"].Points.AddRange(speedMinVzBuffer.ToArray()); chartVz.EndInit(); chartPoints.BeginInit(); FallPoint point = historyData.FallPoint; chartPoints.Series["预示落点"].Points.Clear(); chartPoints.Series["预示落点"].Points.Add(new SeriesPoint(point.x, point.y)); chartPoints.Series["落点误差"].Points.Add(new SeriesPoint(point.x - historyData.PointError, point.y + historyData.PointError, point.y - historyData.PointError)); chartPoints.Series["落点误差"].Points.Add(new SeriesPoint(point.x + historyData.PointError, point.y + historyData.PointError, point.y - historyData.PointError)); chartPoints.EndInit(); } }
public void AddFallPoint(FallPoint fallPoint) { this.fallPoint = fallPoint; }