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)); }
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)); }
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)); }