public void TakeOffReportTest()
        {
            var para = new TOParameters(
                4000.0,                // rwy length
                1000.0,                // elevation
                210.0,                 // rwy heading
                -1.8,                  // slope
                240.0,                 // wind direction
                10.0,                  // wind speed
                4.0,                   // oat
                1000.0,                // QHN
                false,                 // surface is wet?
                250.0 * 1000.0,        // weight kg
                0,                     // thrust rating
                AntiIceOption.Off,
                true,                  // packs on
                0);                    // flaps

            var report = new TOReportGenerator(perfTable, para).TakeOffReport();
            var calc   = new TOCalculator(perfTable, para);

            AssertReport(report, calc, para);
        }
Example #2
0
        public void Compute(object sender, EventArgs e)
        {
            try
            {
                var para  = new BoeingParameterValidator(elements).Validate();
                var table = (BoeingPerfTable)acPerf.Item;
                if (!CheckWeight(para))
                {
                    return;
                }
                var tempUnit      = (TemperatureUnit)elements.TempUnit.SelectedIndex;
                var tempIncrement = tempUnit == TemperatureUnit.Celsius ? 1.0 : 2.0 / 1.8;
                var report        = new TOReportGenerator(table, para).TakeOffReport(tempIncrement);

                var text = report.ToString(tempUnit, (LengthUnit)elements.lengthUnit.SelectedIndex);

                // To center the text in the richTxtBox
                elements.Result.Text = text.ShiftToRight(15);

                CalculationCompleted?.Invoke(this, EventArgs.Empty);
                elements.Result.ForeColor = Color.Black;
            }
            catch (InvalidUserInputException ex)
            {
                parentControl.ShowWarning(ex.Message);
            }
            catch (RunwayTooShortException)
            {
                parentControl.ShowWarning("Runway length is insufficient for takeoff.");
            }
            catch (PoorClimbPerformanceException)
            {
                parentControl.ShowWarning("Aircraft too heavy to meet " +
                                          "climb performance requirement.");
            }
        }