예제 #1
0
            public static void Calculate_WithAircraftStateHeightSmallerThanThresholdAndLiftSmallerThanTakeOffWeight_ReturnsExpectedTrueAirspeedRate(AircraftData aircraftData)
            {
                // Setup
                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 AbortedTakeOffDynamicsCalculator(aircraftData, 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.BrakingResistanceCoefficient;

                const double thrustForce = 0;
                double       horizontalWeightComponent = takeOffWeightNewton * Math.Sin(aircraftState.FlightPathAngle.Radians);
                double       expectedAcceleration      = (gravitationalAcceleration * (thrustForce - dragForce - horizontalWeightComponent))
                                                         / takeOffWeightNewton;

                Assert.AreEqual(expectedAcceleration, accelerations.TrueAirSpeedRate, tolerance);
            }
예제 #2
0
        public static void Calculate_Always_ReturnsExpectedZeroPitchRate()
        {
            // Setup
            var          random        = new Random(21);
            AircraftData aircraftData  = AircraftDataTestFactory.CreateRandomAircraftData();
            Angle        angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(aircraftData.AerodynamicsData);
            var          aircraftState = new AircraftState(angleOfAttack,
                                                           new Angle(),
                                                           random.NextDouble(),
                                                           random.NextDouble(),
                                                           random.NextDouble());

            var calculator = new AbortedTakeOffDynamicsCalculator(aircraftData, random.NextDouble(), random.NextDouble());

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

            // Assert
            Assert.Zero(accelerations.PitchRate.Radians);
        }