示例#1
0
        protected override double CalculateAerodynamicDragForce(AircraftState state)
        {
            double liftCoefficient = AerodynamicsHelper.CalculateLiftCoefficient(AerodynamicsData,
                                                                                 CalculateAngleOfAttack(state));

            return(AerodynamicsHelper.CalculateDragWithEngineFailure(AerodynamicsData,
                                                                     liftCoefficient,
                                                                     Density,
                                                                     state.TrueAirspeed));
        }
示例#2
0
        public void CalculateLiftCoefficient_AerodynamicsDataNull_ThrowsArgumentNullException()
        {
            // Setup
            var random = new Random(21);

            // Call
            TestDelegate call = () => AerodynamicsHelper.CalculateLiftCoefficient(null, random.NextAngle());

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("aerodynamicsData", exception.ParamName);
        }
示例#3
0
        public static void CalculateLiftCoefficient_WithAerodynamicsData_ReturnsExpectedLiftCoefficient(AerodynamicsData aerodynamicsData)
        {
            // Setup
            var   random        = new Random(21);
            Angle angleOfAttack = random.NextAngle();

            // Call
            double liftCoefficient = AerodynamicsHelper.CalculateLiftCoefficient(aerodynamicsData,
                                                                                 angleOfAttack);

            // Assert
            double expectedLiftCoefficient = CalculateExpectedLiftCoefficient(aerodynamicsData, angleOfAttack);

            Assert.AreEqual(expectedLiftCoefficient, liftCoefficient, tolerance);
        }
示例#4
0
        public static void CalculateLiftCoefficient_WithInvalidAngleOfAttack_ThrowsInvalidCalculationException(AerodynamicsData aerodynamicsData,
                                                                                                               Angle invalidAngleOfAttack,
                                                                                                               string expectedExceptionMessage)
        {
            // Setup
            var random = new Random(21);

            // Call
            TestDelegate call = () => AerodynamicsHelper.CalculateLiftCoefficient(aerodynamicsData,
                                                                                  invalidAngleOfAttack);

            // Assert
            var exception = Assert.Throws <InvalidCalculationException>(call);

            Assert.AreEqual(expectedExceptionMessage, exception.Message);
        }
示例#5
0
            public static void Calculate_WithAircraftStateHeightSmallerThanThresholdAndLiftSmallerThanTakeOffWeight_ReturnsExpectedTrueAirspeedRate(AircraftData aircraftData)
            {
                // Setup
                const int    nrOfFailedEngines = 1;
                const double airspeed          = 10.0;
                const double threshold         = 0.01;

                var random        = new Random(21);
                var aircraftState = new AircraftState(aircraftData.MaximumPitchAngle,
                                                      random.NextAngle(),
                                                      airspeed,
                                                      threshold - random.NextDouble(),
                                                      random.NextDouble());

                Angle angleOfAttack = aircraftState.PitchAngle - aircraftState.FlightPathAngle;

                // Precondition
                double lift = AerodynamicsHelper.CalculateLift(aircraftData.AerodynamicsData,
                                                               angleOfAttack,
                                                               airDensity,
                                                               airspeed);
                double takeOffWeightNewton = aircraftData.TakeOffWeight * 1000; // N

                Assert.IsTrue(lift < takeOffWeightNewton);

                var calculator = new ContinuedTakeOffDynamicsCalculator(aircraftData, nrOfFailedEngines, airDensity, gravitationalAcceleration);

                // Call
                AircraftAccelerations accelerations = calculator.Calculate(aircraftState);

                // Assert
                double liftCoefficient = AerodynamicsHelper.CalculateLiftCoefficient(aircraftData.AerodynamicsData, angleOfAttack);
                double normalForce     = takeOffWeightNewton - lift;
                double dragForce       = AerodynamicsHelper.CalculateDragWithEngineFailure(aircraftData.AerodynamicsData,
                                                                                           liftCoefficient,
                                                                                           airDensity,
                                                                                           airspeed) + normalForce * aircraftData.RollingResistanceCoefficient;

                double thrustForce = (aircraftData.NrOfEngines - nrOfFailedEngines) * aircraftData.MaximumThrustPerEngine * 1000;
                double horizontalWeightComponent = takeOffWeightNewton * Math.Sin(aircraftState.FlightPathAngle.Radians);
                double expectedAcceleration      = (gravitationalAcceleration * (thrustForce - dragForce - horizontalWeightComponent))
                                                   / takeOffWeightNewton;

                Assert.AreEqual(expectedAcceleration, accelerations.TrueAirSpeedRate, tolerance);
            }