private static double GetRotationSpeed(AircraftData aircraftData) { double stallSpeed = AerodynamicsHelper.CalculateStallSpeed(aircraftData.AerodynamicsData, aircraftData.TakeOffWeight * 1000, airDensity); double rotationSpeed = stallSpeed * 1.2; return(rotationSpeed); }
private bool ShouldRotate(AircraftState aircraftState) { double rotationSpeed = 1.2 * AerodynamicsHelper.CalculateStallSpeed(AerodynamicsData, GetNewton(AircraftData.TakeOffWeight), Density); return(aircraftState.TrueAirspeed >= rotationSpeed && aircraftState.PitchAngle < AircraftData.MaximumPitchAngle); }
private static IEnumerable <TestCaseData> GetInvalidDensityTestCases() { var random = new Random(21); AerodynamicsData aerodynamicsData = AerodynamicsDataTestFactory.CreateAerodynamicsData(); Angle angleOfAttack = random.NextAngle(); double liftCoefficient = random.NextDouble(); double invalidDensity = -random.NextDouble(); double velocity = random.NextDouble(); double takeOffWeight = random.NextDouble(); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateLift(aerodynamicsData, angleOfAttack, invalidDensity, velocity))) .SetName("CalculateLift - Negative")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateLift(aerodynamicsData, angleOfAttack, 0, velocity))) .SetName("CalculateLift - Zero")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateDragWithEngineFailure(aerodynamicsData, liftCoefficient, invalidDensity, velocity))) .SetName("CalculateDragWithEngineFailure - Negative")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateDragWithEngineFailure(aerodynamicsData, liftCoefficient, 0, velocity))) .SetName("CalculateDragWithEngineFailure - Zero")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateDragWithoutEngineFailure(aerodynamicsData, liftCoefficient, invalidDensity, velocity))) .SetName("CalculateDragWithoutEngineFailure - Negative")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateDragWithoutEngineFailure(aerodynamicsData, liftCoefficient, 0, velocity))) .SetName("CalculateDragWithoutEngineFailure - Zero")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateStallSpeed(aerodynamicsData, takeOffWeight, invalidDensity))) .SetName("CalculateStallSpeed - Negative")); yield return(new TestCaseData(new Action(() => AerodynamicsHelper.CalculateStallSpeed(aerodynamicsData, takeOffWeight, 0))) .SetName("CalculateStallSpeed - Zero")); }
public static void CalculateStallSpeed_WithValidParametersWithinLimits_ReturnsExpectedValues(AerodynamicsData aerodynamicsData) { // Setup const double weight = 500e3; // N // Call double stallSpeed = AerodynamicsHelper.CalculateStallSpeed(aerodynamicsData, weight, airDensity); // Assert double expectedStallSpeed = Math.Sqrt(2 * weight / (aerodynamicsData.MaximumLiftCoefficient * airDensity * aerodynamicsData.WingArea)); Assert.AreEqual(expectedStallSpeed, stallSpeed, tolerance); }
public static void CalculateStallSpeed_AerodynamicsDataNull_ThrowsArgumentNullException() { // Setup var random = new Random(21); // Call TestDelegate call = () => AerodynamicsHelper.CalculateStallSpeed(null, random.NextDouble(), random.NextDouble()); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("aerodynamicsData", exception.ParamName); }