Example #1
0
        /// <summary>Perform grazing</summary>
        /// <param name="amountDMToRemove">The amount of biomas to remove (kg/ha).</param>
        public void Graze(double amountDMToRemove)
        {
            GrazingInterval = DaysSinceGraze;  // i.e. yesterday's value
            DaysSinceGraze  = 0;

            RemoveDMFromPlants(amountDMToRemove);

            AddUrineToSoil();

            AddDungToSurface();

            // Calculate post-grazed dry matter.
            PostGrazeDM = forages.Sum(forage => forage.AboveGround.Wt);

            // Calculate proportions of each species to the total biomass.
            for (int i = 0; i < forages.Count; i++)
            {
                var proportionToTotalDM = MathUtilities.Divide(forages[i].AboveGround.Wt, PostGrazeDM, 0);
                ProportionOfTotalDM[i] = proportionToTotalDM;
            }

            if (Verbose)
            {
                summary.WriteMessage(this, string.Format("Grazed {0:0.0} kgDM/ha, N content {1:0.0} kgN/ha, ME {2:0.0} MJME/ha", GrazedDM, GrazedN, GrazedME));
            }

            // Invoke grazed event.
            Grazed?.Invoke(this, new EventArgs());
        }
Example #2
0
        /// <summary>Perform grazing</summary>
        /// <param name="amountDMToRemove">The amount of biomas to remove (kg/ha).</param>
        public void Graze(double amountDMToRemove)
        {
            GrazingInterval = DaysSinceGraze;  // i.e. yesterday's value
            DaysSinceGraze  = 0;

            RemoveDMFromPlants(amountDMToRemove);

            AddUrineToSoil();

            AddDungToSurface();

            // Calculate post-grazed dry matter.
            PostGrazeDM = 0.0;
            foreach (var forage in allForages)
            {
                PostGrazeDM += forage.Material.Sum(m => m.Total.Wt);
            }

            // Calculate proportions of each species to the total biomass.
            for (int i = 0; i < allForages.Count; i++)
            {
                var proportionToTotalDM = MathUtilities.Divide(allForages[i].Material.Sum(m => m.Total.Wt), PostGrazeDM, 0);
                ProportionOfTotalDM[i] = proportionToTotalDM;
            }

            summary.WriteMessage(this, string.Format("Grazed {0:0.0} kgDM/ha, N content {1:0.0} kgN/ha, ME {2:0.0} MJME/ha", GrazedDM, GrazedN, GrazedME));

            // Reduce plant population if necessary.
            if (FractionPopulationDecline > 0)
            {
                foreach (var forage in allForages)
                {
                    if ((forage as IModel) is IHasPopulationReducer populationReducer)
                    {
                        populationReducer.ReducePopulation(populationReducer.Population * (1.0 - FractionPopulationDecline));
                    }
                    else
                    {
                        throw new Exception($"Model {forage.Name} is unable to reduce its population due to grazing. Not implemented.");
                    }
                }
            }

            // Convert PostGrazeDM to kg/ha
            PostGrazeDM *= 10;

            // Invoke grazed event.
            Grazed?.Invoke(this, new EventArgs());
        }
        /// <summary>Perform grazing</summary>
        /// <param name="amountDMToRemove">The amount of biomas to remove (kg/ha).</param>
        public void Graze(double amountDMToRemove)
        {
            GrazingInterval = DaysSinceGraze;  // i.e. yesterday's value
            DaysSinceGraze  = 0;


            RemoveDMFromPlants(amountDMToRemove);

            AddUrineToSoil();

            AddDungToSurface();

            if (Verbose)
            {
                summary.WriteMessage(this, string.Format("Grazed {0:0.0} kgDM/ha, N content {1:0.0} kgN/ha, ME {2:0.0} MJME/ha", GrazedDM, GrazedN, GrazedME));
            }

            // Invoke grazed event.
            Grazed?.Invoke(this, new EventArgs());
        }
Example #4
0
        /// <summary>Perform grazing</summary>
        /// <param name="amountDMToRemove">The amount of biomas to remove (kg/ha).</param>
        public void Graze(double amountDMToRemove)
        {
            GrazingInterval = DaysSinceGraze;  // i.e. yesterday's value
            DaysSinceGraze  = 0;

            RemoveDMFromPlants(amountDMToRemove);

            AddUrineToSoil();

            AddDungToSurface();

            // Calculate post-grazed dry matter.
            PostGrazeDM = forages.Sum(forage => forage.AboveGround.Wt);

            // Calculate proportions of each species to the total biomass.
            for (int i = 0; i < forages.Count; i++)
            {
                var proportionToTotalDM = MathUtilities.Divide(forages[i].AboveGround.Wt, PostGrazeDM, 0);
                ProportionOfTotalDM[i] = proportionToTotalDM;
            }

            summary.WriteMessage(this, string.Format("Grazed {0:0.0} kgDM/ha, N content {1:0.0} kgN/ha, ME {2:0.0} MJME/ha", GrazedDM, GrazedN, GrazedME));

            // Reduce plant population if necessary.
            if (FractionPopulationDecline > 0)
            {
                foreach (var forage in forages)
                {
                    forage.ReducePopulation(forage.Population * (1.0 - FractionPopulationDecline));
                }
            }

            // Convert PostGrazeDM to kg/ha
            PostGrazeDM *= 10;

            // Invoke grazed event.
            Grazed?.Invoke(this, new EventArgs());
        }