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; }
private CalculateOutput calc_target_yc(double latitude, double longitudey, double height, double speedEast, double speedNorth, double speedSky, ConstLaunch launchFsx, double h_end) { MWArray mwNavNow = new MWNumericArray(1, 6, new double[] { latitude, longitudey, height, speedEast, speedNorth, speedSky }); MWArray[] argsOut = matlab.calc_target_yc(8, mwNavNow, new MWNumericArray(launchFsx.R0), new MWNumericArray(launchFsx.R0_f), new MWNumericArray(launchFsx.xyz_e0), new MWNumericArray(launchFsx.C_e2f), new MWNumericArray(launchFsx.C_fe2), new MWNumericArray(launchFsx.we_f), new MWNumericArray(h_end)); return(new CalculateOutput { t_x = ((double[, ])(argsOut[2].ToArray()))[0, 0], t_y = ((double[, ])(argsOut[3].ToArray()))[0, 0], t_z = ((double[, ])(argsOut[6].ToArray()))[0, 0], t_range = ((double[, ])(argsOut[5].ToArray()))[0, 0], flighttime = ((double[, ])(argsOut[7].ToArray()))[0, 0], x = ((double[, ])(argsOut[0].ToArray()))[0, 0], y = ((double[, ])(argsOut[0].ToArray()))[0, 1], z = ((double[, ])(argsOut[0].ToArray()))[0, 2], vx = ((double[, ])(argsOut[1].ToArray()))[0, 0], vy = ((double[, ])(argsOut[1].ToArray()))[1, 0], vz = ((double[, ])(argsOut[1].ToArray()))[2, 0] }); }
private void btnStart_Click(object sender, EventArgs e) { TestInfoForm testInfoForm = new TestInfoForm(); if (testInfoForm.ShowDialog() != DialogResult.OK) { return; } TestInfo.GetInstance().New(); testInfoForm.GetTestInfo(out TestInfo.GetInstance().strTestName, out TestInfo.GetInstance().strOperator, out TestInfo.GetInstance().strComment); Logger.GetInstance().NewFile(); String errMsg; if (!Config.GetInstance().LoadConfigFile(out errMsg)) { Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_ERROR, "加载配置文件失败," + errMsg); XtraMessageBox.Show("加载配置文件失败," + errMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MAX_CHART_POINTS = Config.GetInstance().maxPointCount; myChartControl1.SetMaxChartPoint(MAX_CHART_POINTS); myChartControl2.SetMaxChartPoint(MAX_CHART_POINTS); Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_INFO, "加载配置文件成功"); try { udpRadarClient = new UdpClient(Config.GetInstance().radarPort); udpRadarClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 1024 * 1024 * 200); udpRadarClient.JoinMulticastGroup(IPAddress.Parse(Config.GetInstance().strRadarMultiCastIpAddr)); udpTelemetryClient = new UdpClient(Config.GetInstance().telemetryPort); udpTelemetryClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 1024 * 1024 * 200); udpTelemetryClient.JoinMulticastGroup(IPAddress.Parse(Config.GetInstance().strTelemetryMultiCastIpAddr)); dataParser.Start(); dataLogger.Start(); Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_INFO, "加入组播组成功"); } catch (Exception ex) { Logger.GetInstance().Log(Logger.LOG_LEVEL.LOG_ERROR, "加入组播组失败," + ex.Message); XtraMessageBox.Show("加入组播组失败," + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); udpRadarClient?.Close(); udpTelemetryClient?.Close(); dataParser.Stop(); dataLogger.Stop(); return; } ClearAllChart(); InitChartPoints(); btnSetting.Enabled = false; btnStop.Enabled = true; btnStart.Enabled = false; if (Config.GetInstance().source == 0) { editT0.Enabled = true; btnStartT0.Enabled = true; TabPageBody.PageVisible = false; } else { editT0.Enabled = false; btnStartT0.Enabled = false; TabPageBody.PageVisible = true; } alertFormSuit1.SetMode(1, Config.GetInstance().source); alertFormSuit2.SetMode(2, Config.GetInstance().source); constLaunchFsx = algorithm.calc_const_launch_fsx( Config.GetInstance().latitudeInit, Config.GetInstance().longitudeInit, Config.GetInstance().heightInit, Config.GetInstance().azimuthInit); myChartControl1.StartTimer(); myChartControl2.StartTimer(); udpRadarClient.BeginReceive(EndRadarUdpReceive, null); udpTelemetryClient.BeginReceive(EndTelemetryUdpReceive, null); netWorkTimer.Start(); }
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; }
private CalculateOutput calc_target_ld(double lambda0, double x, double y, double z, double vx, double vy, double vz, ConstLaunch launchFsx, double h_end) { MWArray mwLambda0 = new MWNumericArray(1, 1, new double[] { lambda0 / 180 * Math.PI }); MWArray mwNavNow = new MWNumericArray(1, 6, new double[] { x, y, z, vx, vy, vz }); MWArray[] argsOut = matlab.calc_target_ld(6, mwLambda0, mwNavNow, new MWNumericArray(launchFsx.R0), new MWNumericArray(launchFsx.R0_f), new MWNumericArray(launchFsx.C_e2f), new MWNumericArray(launchFsx.C_fe2), new MWNumericArray(launchFsx.we_f), new MWNumericArray(launchFsx.xyz_e0), new MWNumericArray(h_end)); return(new CalculateOutput { t_x = ((double[, ])(argsOut[0].ToArray()))[0, 0], t_y = ((double[, ])(argsOut[1].ToArray()))[0, 0], t_z = ((double[, ])(argsOut[4].ToArray()))[0, 0], t_range = ((double[, ])(argsOut[3].ToArray()))[0, 0], flighttime = ((double[, ])(argsOut[5].ToArray()))[0, 0] }); }