Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of <see cref="DistanceCalculator"/>.
        /// </summary>
        /// <param name="normalTakeOffDynamicsCalculator">The <see cref="INormalTakeOffDynamicsCalculator"/>
        /// to calculate the aircraft dynamics without failure.</param>
        /// <param name="failureTakeOffDynamicsCalculator">The <see cref="IFailureTakeOffDynamicsCalculator"/>
        /// to calculate the aircraft dynamics after failure.</param>
        /// <param name="integrator">The <see cref="IIntegrator"/> to integrate the first order
        /// dynamic system.</param>
        /// <param name="calculationSettings">The <see cref="CalculationSettings"/>
        /// to configure the calculator.</param>
        /// <exception cref="ArgumentNullException">Thrown when:
        /// <list type="bullet">
        /// <item><paramref name="normalTakeOffDynamicsCalculator"/></item>
        /// <item><paramref name="failureTakeOffDynamicsCalculator"/></item>
        /// <item><paramref name="integrator"/></item>
        /// <item><paramref name="calculationSettings"/></item>
        /// </list>
        /// is <c>null</c>.</exception>
        public DistanceCalculator(INormalTakeOffDynamicsCalculator normalTakeOffDynamicsCalculator,
                                  IFailureTakeOffDynamicsCalculator failureTakeOffDynamicsCalculator,
                                  IIntegrator integrator,
                                  CalculationSettings calculationSettings)
        {
            if (normalTakeOffDynamicsCalculator == null)
            {
                throw new ArgumentNullException(nameof(normalTakeOffDynamicsCalculator));
            }

            if (failureTakeOffDynamicsCalculator == null)
            {
                throw new ArgumentNullException(nameof(failureTakeOffDynamicsCalculator));
            }

            if (integrator == null)
            {
                throw new ArgumentNullException(nameof(integrator));
            }

            if (calculationSettings == null)
            {
                throw new ArgumentNullException(nameof(calculationSettings));
            }

            this.normalTakeOffDynamicsCalculator  = normalTakeOffDynamicsCalculator;
            this.failureTakeOffDynamicsCalculator = failureTakeOffDynamicsCalculator;
            this.integrator          = integrator;
            this.calculationSettings = calculationSettings;
        }
Exemplo n.º 2
0
        public IDistanceCalculator CreateAbortedTakeOffDistanceCalculator(AircraftData data,
                                                                          IIntegrator integrator,
                                                                          double density,
                                                                          double gravitationalAcceleration,
                                                                          CalculationSettings calculationSettings)
        {
            INormalTakeOffDynamicsCalculator normalTakeOffDynamicsCalculator =
                takeOffDynamicsCalculatorFactory.CreateNormalTakeOffDynamics(data, density, gravitationalAcceleration);
            IFailureTakeOffDynamicsCalculator failureTakeOffDynamicsCalculator =
                takeOffDynamicsCalculatorFactory.CreateAbortedTakeOffDynamics(data, density, gravitationalAcceleration);

            return(new DistanceCalculator(normalTakeOffDynamicsCalculator, failureTakeOffDynamicsCalculator, integrator, calculationSettings));
        }
Exemplo n.º 3
0
        public void CreateNormalTakeOffDynamics_Always_ReturnsExpectedCalculator()
        {
            // Setup
            var          random       = new Random(21);
            AircraftData aircraftData = AircraftDataTestFactory.CreateRandomAircraftData();

            var factory = new TakeOffDynamicsCalculatorFactory();

            // Call
            INormalTakeOffDynamicsCalculator calculator = factory.CreateNormalTakeOffDynamics(aircraftData,
                                                                                              random.NextDouble(),
                                                                                              random.NextDouble());

            // Assert
            Assert.IsInstanceOf <NormalTakeOffDynamicsCalculator>(calculator);
        }