コード例 #1
0
        public void ShowMotorAndPitchStage(float time)
        {
            int motorIndex                 = -1;
            int angleRateIndex             = -1;
            List <MotorInfo> motorInfo     = MotorInfo.AnalyzeMotorInfo(txtMotor.Text);
            List <AngleInfo> angleRateInfo = AngleInfo.AnalyzeAngleInfo(txtPitch.Text);

            for (int i = 0; i < motorInfo.Count; ++i)
            {
                if (motorInfo[i].timeStart <= time && motorInfo[i].timeEnd > time)
                {
                    motorIndex = i;
                    break;
                }
            }
            for (int i = 0; i < angleRateInfo.Count; ++i)
            {
                if (angleRateInfo[i].timeStart <= time && angleRateInfo[i].timeEnd > time)
                {
                    angleRateIndex = i;
                    break;
                }
            }
            if (motorIndex >= 0)
            {
                int lineStart = txtMotor.GetFirstCharIndexFromLine(motorIndex);
                if (motorIndex < motorInfo.Count - 1)
                {
                    int lineEnd = txtMotor.GetFirstCharIndexFromLine(motorIndex + 1) - Environment.NewLine.Length;
                    txtMotor.Select(lineStart, lineEnd - lineStart);
                }
                else
                {
                    txtMotor.Select(lineStart, txtMotor.Text.Length - lineStart);
                }
            }
            else
            {
                txtMotor.DeselectAll();
            }
            if (angleRateIndex >= 0)
            {
                int lineStart = txtPitch.GetFirstCharIndexFromLine(angleRateIndex);
                if (angleRateIndex < angleRateInfo.Count - 1)
                {
                    int lineEnd = txtPitch.GetFirstCharIndexFromLine(angleRateIndex + 1) - Environment.NewLine.Length;
                    txtPitch.Select(lineStart, lineEnd - lineStart);
                }
                else
                {
                    txtPitch.Select(lineStart, txtPitch.Text.Length - lineStart);
                }
            }
            else
            {
                txtPitch.DeselectAll();
            }
        }
コード例 #2
0
        private void btnSimulate_Click(object sender, EventArgs e)
        {
            List <MotorInfo> motorInfo     = MotorInfo.AnalyzeMotorInfo(txtMotor.Text);
            List <AngleInfo> angleRateInfo = AngleInfo.AnalyzeAngleInfo(txtPitch.Text);

            simulator = new Simulator(plotter, float.Parse(txtDeltaTime.Text), float.Parse(txtSubsonicDrag.Text), float.Parse(txtSupersonicDrag.Text), float.Parse(txtInducedDragFactor.Text), float.Parse(txtCLMax.Text),
                                      motorInfo, float.Parse(txtDryMass.Text), float.Parse(txtDiameter.Text), float.Parse(txtInitSpeed.Text), float.Parse(txtInitAngle.Text), float.Parse(txtInitAlt.Text),
                                      float.Parse(txtTargetSpeed.Text), float.Parse(txtTargetDistance.Text), angleRateInfo, float.Parse(txtCutoffSpeed.Text));

            plotter.Clear();
            plotter.SetCutoffSpeed(float.Parse(txtCutoffSpeed.Text));
            plotter.SetRenderScale(float.Parse(txtDisplayScale.Text));
            simulator.Simulate();
        }