Example #1
0
        private string postCalculate(Rocket rocket)
        {
            StringBuilder errors = new StringBuilder();

            foreach (Stage stage in rocket.StageList)
            {
                double previousWetMass = 0;
                if (stage.ID >= 1)
                {
                    previousWetMass = rocket.StageList.Find(s => s.ID == stage.ID - 1).WetMass;
                }
                if (WetMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckWetMassGreaterThanPreviousStageWetMass(stage, previousWetMass));
                }
                if (WetMassCell.Visible && DryMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckDryMassGreaterThanPreviousStageWetMass(stage, previousWetMass));
                }
                if (DryMassCell.Visible && !WetMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckDryMassGreaterThanPreviousStageDryMass(stage, previousWetMass));
                }
            }
            return(errors.ToString());
        }
Example #2
0
        private string preCalculate(Rocket rocket)
        {
            StringBuilder errors = new StringBuilder();

            foreach (Stage stage in rocket.StageList)
            {
                if (WetMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckWetMassPositive(stage));
                }
                if (DryMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckDryMassPositive(stage));
                }
                if (IspCell.Visible && IspCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckIspPositive(stage));
                }
                if (DeltaVCell.Visible && DeltaVCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckDeltaVPositive(stage));
                }
                if (ThrustCell.Visible && ThrustCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckThrustPositive(stage));
                }
                if (MinTWRCell.Visible && MinTWRCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckMinTWRPositive(stage));
                }
                if (MaxTWRCell.Visible && MaxTWRCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckMaxTWRPositive(stage));
                }
                if (WetMassCell.Visible && DryMassCell.Visible)
                {
                    errors.Append(CalculationErrors.CheckWetMassGreaterThanDryMass(stage));
                }
                if (MinTWRCell.Visible && MinTWRCell.Enabled && MaxTWRCell.Visible && MaxTWRCell.Enabled)
                {
                    errors.Append(CalculationErrors.CheckMinTWRLessThanMaxTWR(stage));
                }
            }
            return(errors.ToString());
        }