Exemple #1
0
        public void CalculateWaterRequirementTest()
        {
            Hydro hydroCalculator = InitHydro();

            hydroCalculator.CalculateRoundOrderArea();
            hydroCalculator.CalculateOriginalIrrigationRequirement();
            hydroCalculator.CalculateGrossIrrigationRequirement();
            hydroCalculator.CalculateWaterRequirement();
            List <double> testCase = new List <double>()
            {
                11634750, 2446292, 2714460, 2951257, 2735383, 2793779, 1465560, 379673, 62961444
            };

            for (int i = 0; i < testCase.Count; i++)
            {
                testCase[i] = testCase[i] / 0.63 / 0.8;
                Console.WriteLine(testCase[i]);
                Console.WriteLine(hydroCalculator.WaterRequirement[i]);
            }
            Assert.IsTrue(IsListEqual(hydroCalculator.WaterRequirement, testCase));
        }
Exemple #2
0
        public void CalculateUtilizableCapacityTest()
        {
            Hydro hydroCalculator = InitHydro();

            hydroCalculator.CalculateRoundOrderArea();
            hydroCalculator.CalculateOriginalIrrigationRequirement();
            hydroCalculator.CalculateGrossIrrigationRequirement();
            hydroCalculator.CalculateAverageWaterSupplyOfCanalHead();
            hydroCalculator.CalculateAverageFlow();
            hydroCalculator.CalculateWaterRequirement();
            hydroCalculator.CalculateInflowAveragePrediction();
            hydroCalculator.CalculateUtilizableCapacity();
            List <double> testCase = new List <double>()
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            for (int i = 0; i < hydroCalculator.InflowAveragePrediction.Count; i++)
            {
                double restWater = (0 == i ? 18956.8062545455 : testCase[i - 1]);
                testCase[i] = restWater + hydroCalculator.InflowAveragePrediction[i] - hydroCalculator.WaterRequirement[i];
            }
            Assert.IsTrue(IsListEqual(testCase, hydroCalculator.UtilizableCapacity));
        }