예제 #1
0
        //窗体加载时初始化
        private void Form_Main_Load(object sender, EventArgs e)
        {
            int curveWidth = this.panel_mainCurve.Width;
            int curveHeight = this.panel_mainCurve.Height;

            //初始化自定义数据
            eh = new ExcelHelper();
            ca = new CAircraft();
            cen = new CAtmosphere();
            stopReason = "还未完成程序计算";
            //SetAllTimerInterval(DEVMODEINTER);

            ucHT = new Controllers.UserControlHT(curveWidth, curveHeight);
            ucMT = new Controllers.UserControlMT(curveWidth, curveHeight);
            ucHL = new Controllers.UserControlHL(curveWidth,curveHeight);
            ucHM = new Controllers.UserControlHM(curveWidth, curveHeight);

            FlightProfileLatterUnable();

            //控制按钮初始化
            this.btn_stop.Enabled = false;
            this.btn_pause.Enabled = false;
            this.btn_continue.Enabled = false;

            realT = 0;

            //飞机姿态初始
            ucPW = new UserControlPlaneWpf();
            this.elementHost_planeState.Child = ucPW;

            //设置初始参数标志
            gasSign = false;
            engineSign = false;
            paraSign = false;
            rocketSign = false;

            //文件保存路径的前缀
            fileSavePathPre = Application.StartupPath+"\\DataSave";
            if (!Directory.Exists(fileSavePathPre))
            {
                Directory.CreateDirectory(fileSavePathPre);
            }
            fileSavePath = fileSavePathPre;
            DataSavePah = fileSavePathPre;
            CurveSavePath = fileSavePathPre;

            //火箭初始化
            rocketPerT = 5000;
            rocketI = 300;
            rockNum = 0;
        }
예제 #2
0
        //计算模式计算
        private void CalModeRun(double tTime, double qhTime)
        {
            //计算大气参数
            this.cen = new CAtmosphere();

            bool state0 = true;//滑行阶段
            bool state1 = false;//飞行阶段

            while (state0)
            {
                //计算大气参数
                cen.Ae_qc = PlaneCal.CalQc(cen.Ae_rou, ca.A_V);

                //读入发动机数据
                double t, qh;
                if (eh.CalZs(ca.A_engine1, ca.A_H, ca.A_Ma, out t, out qh))
                {
                    ca.A_T = t * ca.A_engNum * tTime;
                    qh = qh * qhTime;

                    //更新数据
                    UpdateFaceControl();
                    Application.DoEvents();

                    //读取CY和CD
                    double CY, CD;
                    if (eh.CalZs(ca.A_gasCharac, ca.A_Ma, ca.A_alpha, out CD, out CY))
                    {
                        double G = PlaneCal.CalG(ca.A_m);
                        double Y = PlaneCal.CalY(cen.Ae_qc, ca.A_S, CY);
                        double D = PlaneCal.CalD(cen.Ae_qc, ca.A_S, CD) + ca.A_f * (G - Y);
                        double Fx = PlaneCal.CalFx(ca.A_T, 0, 0, D, Y);
                        double ax = PlaneCal.Calax(Fx, ca.A_m);
                        double vx1 = ca.A_V;
                        ca.A_V = PlaneCal.CalVx2(vx1, ax, DETT);
                        ca.A_Ma = ca.A_V / cen.Ae_a;
                        cen.Ae_qc = PlaneCal.CalQc(cen.Ae_rou, ca.A_V);
                        double detL = PlaneCal.CalDetL(vx1, DETT, ax);
                        double detM = PlaneCal.CalDetM(qh, DETT, t, ca.A_engNum);
                        ca.A_m -= detM;
                        ca.A_l += detL;
                        realT += DETT;

                        if (ca.A_l > ONEDISMAX)
                        {
                            state0 = false;

                            if (1 == tTime)
                            {
                                //改为全加力状态
                                InitCaPara(0, 0, 0, 0, 0, 0, ca.A_initM, FVALUE);
                                ClearCtolExtTBData();
                                realT = 0;
                                UpdateTBoxDataInfo("地面滑行阶段(全加力状态)" + Environment.NewLine);

                                //MessageBox.Show("改为全加力状态");
                                CalModeRun(TTIMES, QHTIMES);
                            }
                            else
                            {
                                stopReason = "起飞失败!全加力状态下滑行距离超过1000米";
                                AfterCalFail();
                            }
                            break;

                        }
                        else if (ca.A_V >= ONESPEEDLEVEL)
                        {
                            //MessageBox.Show("更改仰角");

                            ca.A_alpha = ONEALPHAMAX;
                            //cen.Ae_qc = PlaneCal.CalQc(cen.Ae_rou, ca.A_V);

                            //读入发动机数据
                            if (eh.CalZs(ca.A_engine1, 0, ca.A_Ma, out t, out qh))
                            {
                                ca.A_T = t * ca.A_engNum * tTime;
                                qh = qh * qhTime;

                                //更新数据
                                UpdateFaceControl();
                                Application.DoEvents();

                                //读取CY和CD
                                double Fz;
                                if (eh.CalZs(ca.A_gasCharac, ca.A_Ma, ca.A_alpha, out CD, out CY))
                                {
                                    G = PlaneCal.CalG(ca.A_m);
                                    Y = PlaneCal.CalY(cen.Ae_qc, ca.A_S, CY);
                                    Fz = PlaneCal.CalFz(ca.A_T, ca.A_alpha, 0, 0, Y, G);
                                    //UpdateTBoxDataInfo("===Fz:" + Fz + Environment.NewLine);
                                    if (Fz > 0)
                                    {
                                        //进入下一阶段
                                        state0 = false;
                                        state1 = true;
                                        //MessageBox.Show("进入飞行阶段");
                                        break;
                                    }
                                    else
                                    {
                                        //计算运动过程
                                        D = PlaneCal.CalD(cen.Ae_qc, ca.A_S, CD) + ca.A_f * (-1 * Fz);
                                        Fx = PlaneCal.CalFx(ca.A_T, ca.A_alpha, ca.A_sigma, D, Y);
                                        ax = PlaneCal.Calax(Fx, ca.A_m);
                                        vx1 = PlaneCal.CalVx1(ca.A_V, ca.A_sigma);
                                        ca.A_V = PlaneCal.CalVx2(vx1, ax, DETT);
                                        ca.A_Ma = ca.A_V / cen.Ae_a;
                                        cen.Ae_qc = PlaneCal.CalQc(cen.Ae_rou, ca.A_V);
                                        detL = PlaneCal.CalDetL(vx1, DETT, ax);
                                        detM = PlaneCal.CalDetM(qh, DETT, t, ca.A_engNum);
                                        ca.A_m -= detM;
                                        ca.A_l += detL;
                                        realT += DETT;

                                        if (ca.A_l > ONEDISMAX)
                                        {
                                            state0 = false;

                                            if (1 == tTime)
                                            {
                                                //改为全加力状态
                                                InitCaPara(0, 0, 0, 0, 0, 0, ca.A_initM, FVALUE);
                                                ClearCtolExtTBData();
                                                realT = 0;
                                                UpdateTBoxDataInfo("地面滑行阶段(全加力状态)" + Environment.NewLine);

                                                //MessageBox.Show("改为全加力状态");
                                                CalModeRun(TTIMES, QHTIMES);
                                            }
                                            else
                                            {
                                                stopReason = "起飞失败!全加力状态下滑行距离超过1000米";
                                                AfterCalFail();
                                            }
                                            break;

                                        }
                                        else
                                        {
                                            if (eh.CalZs(ca.A_engine1, 0, ca.A_Ma, out t, out qh))
                                            {
                                                ca.A_T = t * ca.A_engNum * tTime;
                                                qh = qh * qhTime;
                                                if (eh.CalZs(ca.A_gasCharac, ca.A_Ma, ca.A_alpha, out CD, out CY))
                                                {
                                                    Y = PlaneCal.CalY(cen.Ae_qc, ca.A_S, CY);
                                                    G = PlaneCal.CalG(ca.A_m);
                                                    Fz = PlaneCal.CalFz(ca.A_T, ca.A_alpha, 0, 0, Y, G);
                                                }
                                            }

                                            //UpdateTBoxDataInfo("===Fz:" + Fz + Environment.NewLine);
                                            if (Fz > 0)
                                            {
                                                //进入下一阶段
                                                state0 = false;
                                                state1 = true;
                                                //MessageBox.Show("进入飞行阶段");
                                                break;
                                            }
                                            else
                                            {
                                                ca.A_alpha = 0;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    stopReason = "气动力特性数据越界";
                                    AfterCalFail();
                                    break;
                                }

                            }
                            else
                            {
                                stopReason = "发动机数据越界";
                                AfterCalFail();
                                break;
                            }

                        }
                    }
                    else
                    {
                        stopReason = "气动力特性数据越界";
                        AfterCalFail();
                        break;
                    }

                }
                else
                {
                    stopReason = "发动机数据越界";
                    AfterCalFail();
                    break;
                }
            }

            if (state1)
            {
                ca.A_f = 0;
                CalModeAngleOpt();
            }
        }