コード例 #1
0
        public void CalculateAverageWaterSupplyOfCanalHeadTest()
        {
            Hydro hydroCalculator = InitHydro();

            hydroCalculator.CalculateRoundOrderArea();
            hydroCalculator.CalculateOriginalIrrigationRequirement();
            hydroCalculator.CalculateGrossIrrigationRequirement();
            hydroCalculator.CalculateAverageWaterSupplyOfCanalHead();
            List <double> testCase = new List <double>()
            {
                11634750, 2446292, 2714460, 2951257, 2735383, 2793779, 1465560, 379673, 62961444
            };
            List <double> roundDays = new List <double>()
            {
                21, 17, 21, 19, 18, 15, 19, 18, 55
            };

            for (int i = 0; i < testCase.Count; i++)
            {
                testCase[i] = testCase[i] / 0.63 / roundDays[i] / 8.64;
                Console.WriteLine(testCase[i]);
                Console.WriteLine(hydroCalculator.AverageWaterSupplyOfCanalHead[i]);
            }
            Assert.IsTrue(IsListEqual(hydroCalculator.AverageWaterSupplyOfCanalHead, testCase));
        }
コード例 #2
0
        public void CalculateOriginalIrrigationRequirementTest()
        {
            Hydro hydroCalculator = InitHydro();

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

            for (int i = 0; i < hydroCalculator.OriginalIrrigationRequirement.Count; i++)
            {
                Console.WriteLine(hydroCalculator.OriginalIrrigationRequirement[i]);
                Console.WriteLine(testCase[i]);
            }
            Assert.IsTrue(IsListEqual(hydroCalculator.OriginalIrrigationRequirement, testCase));
        }
コード例 #3
0
        public void CalculateGrossIrrigationRequirementTest()
        {
            Hydro hydroCalculator = InitHydro();

            hydroCalculator.CalculateRoundOrderArea();
            hydroCalculator.CalculateOriginalIrrigationRequirement();
            hydroCalculator.CalculateGrossIrrigationRequirement();
            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] /= 0.63;
            }
            Assert.IsTrue(IsListEqual(hydroCalculator.GrossIrrigationRequirement, testCase));
        }
コード例 #4
0
        public void CalculateRoundOrderAreaTest()
        {
            Hydro hydroCalculator = InitHydro();

            hydroCalculator.CalculateRoundOrderArea();
            //List<int> testCase = new List<int>() { 19964, 525, 14032, 13833, 2274, 16887, 312, 2023, 651, 1733, 1194, 2572, 6594, 5858, 10759, 11765};
            List <int> testCase = new List <int>()
            {
                77565, 33058, 39340, 41567, 37471, 39349, 20355, 5201, 345942
            };

            for (int i = 0; i < hydroCalculator.RoundOrderArea.Count; i++)
            {
                Console.WriteLine(hydroCalculator.RoundOrderArea[i]);
                Console.WriteLine(testCase[i]);
            }
            Assert.IsTrue(IsListEqual(hydroCalculator.RoundOrderArea, testCase));
        }
コード例 #5
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));
        }