Beispiel #1
0
        /// <summary>Calculate the potential sw uptake for today</summary>
        /// <param name="soilstate"></param>
        /// <returns>list of uptakes</returns>
        /// <exception cref="ApsimXException">Could not find root zone in Zone  + this.Parent.Name +  for SimpleTree</exception>
        public List <ZoneWaterAndN> GetWaterUptakeEstimates(SoilState soilstate)
        {
            ZoneWaterAndN MyZone = new ZoneWaterAndN(this.Parent as Zone);

            foreach (ZoneWaterAndN Z in soilstate.Zones)
            {
                if (Z.Zone.Name == this.Parent.Name)
                {
                    MyZone = Z;
                }
            }


            double[] PotSWUptake = new double[Soil.LL15.Length];
            SWUptake = new double[Soil.LL15.Length];

            SoilCrop soilCrop = Soil.Crop(this.Name) as SoilCrop;

            for (int j = 0; j < Soil.LL15mm.Length; j++)
            {
                PotSWUptake[j] = Math.Max(0.0, RootProportion(j, RootDepth) * Soil.KL(this.Name)[j] * (MyZone.Water[j] - Soil.LL15mm[j]));
            }

            double TotPotSWUptake = MathUtilities.Sum(PotSWUptake);

            for (int j = 0; j < Soil.LL15mm.Length; j++)
            {
                SWUptake[j] = PotSWUptake[j] * Math.Min(1.0, PotentialEP / TotPotSWUptake);
            }

            List <ZoneWaterAndN> Uptakes = new List <ZoneWaterAndN>();
            ZoneWaterAndN        Uptake  = new ZoneWaterAndN(this.Parent as Zone);

            Uptake.Water = SWUptake;
            Uptake.NO3N  = new double[SWUptake.Length];
            Uptake.NH4N  = new double[SWUptake.Length];
            Uptake.NH4N  = new double[SWUptake.Length];
            Uptake.PlantAvailableNO3N = new double[SWUptake.Length];
            Uptake.PlantAvailableNH4N = new double[SWUptake.Length];
            Uptakes.Add(Uptake);
            return(Uptakes);
        }