Example #1
0
        private static Tuple <double, double, double, double> TestLifeSupport(double dayLengthModifier)
        {
            var basegameSettings = new BaseGameSettings
            {
                DayLengthMultiplier = dayLengthModifier
            };

            var lifesupportSettings = new LifeSupportSettings();

            var crewedVessel = new CrewedVehicle(basegameSettings, lifesupportSettings)
            {
                NumberOfCrew = 1
            };

            var lifeSupportSystem = crewedVessel.LifeSupportSystem;

            lifeSupportSystem.ProvisionsStorage.TotalFoodStored        = 1.10;
            lifeSupportSystem.ProvisionsStorage.TotalWaterStored       = 0.73;
            lifeSupportSystem.ProvisionsStorage.TotalOxygenStored      = 111.04;
            lifeSupportSystem.ProvisionsStorage.TotalElectricityStored = 50;

            var food  = lifeSupportSystem.DaysOfFood;
            var water = lifeSupportSystem.DaysOfWater;
            var oxy   = lifeSupportSystem.DaysOfOxygen;
            var elec  = lifeSupportSystem.DaysOfElectricity;

            var eatenPerSecond       = crewedVessel.LifeSupportSystem.LifeSupportSettings.FoodPerDay / 21600;
            var foodTotalTimeSeconds = lifeSupportSystem.ProvisionsStorage.TotalFoodStored / eatenPerSecond;

            Write(foodTotalTimeSeconds);

            Write(DeltaVCalculator.CalulateDeltaV(10470, 19357, 312));

            return(new Tuple <double, double, double, double>(food, water, oxy, elec));
        }
        public void CalulateDeltaVOverloadTwo()
        {
            //Arrange
            var expected = 2648.29183066939;

            //Act
            var actual = DeltaVCalculator.CalulateDeltaV(6540, 14540, 338);

            //Assert
            Assert.AreEqual(expected, actual, 0.0000000001);
        }
        public void CalulateDeltaVStageNullException()
        {
            //Arrange
            Stage stage = null;

            //Act
            var actual = DeltaVCalculator.CalulateDeltaV(stage);

            //Assert
            Assert.Fail($"{nameof(stage.SpecificImpulse)} was null.");
        }
        public void CalulateDeltaVOverloadOne()
        {
            //Arrange
            var stage = new Stage()
            {
                SpecificImpulse = 293.0,
                DryMass         = 100,
                WetMass         = 160
            };

            var expected = 1350.48419958761;

            //Act
            var actual = DeltaVCalculator.CalulateDeltaV(stage);

            //Assert
            Assert.AreEqual(expected, actual, 0.0000000001);
        }
        public void CalulateDeltaVISPNull()
        {
            //Arrange
            var stage = new Stage()
            {
                SpecificImpulse = 0,
                DryMass         = 1271,
                WetMass         = 4159
            };

            var expected = 0;

            //Act
            var actualStage     = DeltaVCalculator.CalulateDeltaV(stage);
            var actualArguments = DeltaVCalculator.CalulateDeltaV(600, 4756, -5);

            //Assert
            Assert.AreEqual(expected, actualStage);
            Assert.AreEqual(expected, actualArguments);
        }
Example #6
0
 /// <summary>
 /// Calculates the stage's total delta-v.
 /// </summary>
 /// <returns>System.Double.</returns>
 public double CalculateDeltaV()
 {
     return(DeltaVCalculator.CalulateDeltaV(this));
 }