示例#1
0
文件: Prawns.cs 项目: hol353/ApsimX
        private Feed FeedWasted(Feed ConsumedFeed)
        {
            double dm, n, de;

            dm = (1-Ki4) * ConsumedFeed.DryMatter;
            n = (1-Ki4) * ConsumedFeed.Nitrogen;
            de = (1-Ki4) * ConsumedFeed.DigestibleEnergy;

            Feed wasted = new Feed(ConsumedFeed.FeedName, dm, n, de);
            return wasted;
        }
示例#2
0
文件: Prawns.cs 项目: hol353/ApsimX
        private void OnEndOfDay(object sender, EventArgs e)
        {
            consumedFoodPP = new Food();
            intakeFoodPP = new Food();
            digestedFoodPP = new Food();

            consumedFood = new Food();
            intakeFood = new Food();
            digestedFood = new Food();
            wastedFood = new Food();

            stressStock = Stress_Stock(prawns.StockingDensity(PondWater.SurfaceArea));
            stressTemp = Stress_Temp(PondWater.PondTemp);
            stressSalinity = Stress_Salinity(PondWater.Salinity);

            double totalDMConsumedPP = PotentialDMConsumedPerPrawn(prawns, stressStock, stressTemp);
            totalDMConsumedPP = CheckEnoughFoodToConsumeToday(FoodInPond.Food, prawns, totalDMConsumedPP);

            foreach (Feed feed in FoodInPond.Food)
                {
                Feed consumedFeedPP = FeedConsumedPerPrawn(FoodInPond.Food, feed, totalDMConsumedPP);
                Feed intakeFeedPP = FeedIntakePerPrawn(consumedFeedPP);
                Feed digestedFeedPP = FeedDigestedPerPrawn(intakeFeedPP);

                consumedFoodPP.AddFeed(consumedFeedPP);
                intakeFoodPP.AddFeed(intakeFeedPP);
                digestedFoodPP.AddFeed(digestedFeedPP);
                }

            energyMaintenancePP = EnergyMaintenance(prawns, stressTemp, stressSalinity);
            weightGainPP = WeightGainPerPrawn(digestedFoodPP, energyMaintenancePP);
            nitrogenGainPP = NitrogenGainPerPrawn(weightGainPP);

            prawns.LiveWeight = prawns.LiveWeight + weightGainPP;
            prawns.NitrogenMass = prawns.NitrogenMass + nitrogenGainPP;

            deaths = Mortality(prawns, PondWater.Salinity, PondWater.N);  //TODO: PondWater.N should be PondWater.NH4
            prawns.NumberOfPrawns = Math.Max(prawns.NumberOfPrawns - deaths, 0);

            //Calculate the total outputs now we have the correct number of prawns still alive.
            foreach (Feed consumedFeedPP in consumedFoodPP)
                {
                Feed consumedFeed = FeedConsumed(prawns, consumedFeedPP);
                Feed wastedFeed = FeedWasted(consumedFeed);

                consumedFood.AddFeed(consumedFeed);
                wastedFood.AddFeed(wastedFeed);
                }

            foreach (Feed intakeFeedPP in intakeFoodPP)
                {
                Feed intakeFeed = FeedIntake(prawns, intakeFeedPP);
                intakeFood.AddFeed(intakeFeed);
                }

            foreach (Feed digestedFeedPP in digestedFoodPP)
                {
                Feed digestedFeed = FeedDigested(prawns, digestedFeedPP);
                digestedFood.AddFeed(digestedFeed);
                }

            faecesDM = intakeFood.TotalDM - digestedFood.TotalDM;
            faecesN = intakeFood.TotalN - digestedFood.TotalN;
            excretedAmmonium = Math.Max(0, digestedFood.TotalN - (nitrogenGainPP * prawns.NumberOfPrawns));  //can't be negative.

            FoodInPond.Food.RemoveFromExisting(consumedFood);

            deadPrawnsAsFeed = DeadPrawnsAsFeed(deaths, prawns);
            FoodInPond.Food.AddFeed(deadPrawnsAsFeed);
        }
示例#3
0
文件: Prawns.cs 项目: hol353/ApsimX
        private Feed FeedIntake(PrawnCohort Prawns, Feed IntakeFeedPP)
        {
            double dm, n, de;

            dm = IntakeFeedPP.DryMatter * Prawns.NumberOfPrawns * g2kg;
            n = IntakeFeedPP.Nitrogen * Prawns.NumberOfPrawns * g2kg;
            de = IntakeFeedPP.DigestibleEnergy * Prawns.NumberOfPrawns;

            Feed intake = new Feed(IntakeFeedPP.FeedName, dm, n, de);
            return intake;
        }
示例#4
0
文件: Prawns.cs 项目: hol353/ApsimX
        /// <summary>
        /// Returns the feed actually ingested by the prawn today (given the feed that was consumed by that prawn today).
        /// Prawns are messy feeders and don't intake everything that they consume. 
        /// </summary>
        /// <param name="ConsumedFeedPP">Feed that the prawn has consumed today</param>
        /// <returns>(/prawn/d)</returns>
        private Feed FeedIntakePerPrawn(Feed ConsumedFeedPP)
        {
            double dm, n, de;

            dm = Ki4 * ConsumedFeedPP.DryMatter;
            n = Ki4 * ConsumedFeedPP.Nitrogen;
            de = Ki4 * ConsumedFeedPP.DigestibleEnergy;

            Feed intake = new Feed(ConsumedFeedPP.FeedName, dm, n, de);
            return intake;
        }
示例#5
0
文件: Prawns.cs 项目: hol353/ApsimX
        private Feed FeedDigested(PrawnCohort Prawns, Feed DigestedFeedPP)
        {
            double dm, n, de;

            dm = DigestedFeedPP.DryMatter * Prawns.NumberOfPrawns * g2kg;
            n = DigestedFeedPP.Nitrogen * Prawns.NumberOfPrawns * g2kg;
            de = DigestedFeedPP.DigestibleEnergy * Prawns.NumberOfPrawns;

            Feed digested = new Feed(DigestedFeedPP.FeedName, dm, n, de);
            return digested;
        }
示例#6
0
文件: Prawns.cs 项目: hol353/ApsimX
        /// <summary>
        /// Returns the feed actually digested by the prawn today (given the feed that was ingested by that prawn today).
        /// </summary>
        /// <param name="IntakeFeedPP">Feed that the prawn has ingested today</param>
        /// <returns>(/prawn/d)</returns>
        private Feed FeedDigestedPerPrawn(Feed IntakeFeedPP)
        {
            double dm, n, de;

            double intake_de2dm = MathUtilities.Divide(IntakeFeedPP.DigestibleEnergy, IntakeFeedPP.DryMatter, 0.0);

            dm = (Ki5 + Ki6 * intake_de2dm) * IntakeFeedPP.DryMatter;
            n = (Ki7 + Ki8 * intake_de2dm) * IntakeFeedPP.Nitrogen;
            de = IntakeFeedPP.DigestibleEnergy;  //as the name suggests all of it can be digested.

            Feed digested = new Feed(IntakeFeedPP.FeedName, dm, n, de);
            return digested;
        }
示例#7
0
文件: Prawns.cs 项目: hol353/ApsimX
        /// <summary>
        /// Return the prawns that died today as a feed type to add back into the pond.
        /// </summary>
        /// <param name="Deaths">Number of prawns that died today</param>
        /// <param name="Prawns">Current Prawns that are in the pond</param>
        /// <returns>Feed to be added to the pond</returns>
        private Feed DeadPrawnsAsFeed(int Deaths, PrawnCohort Prawns)
        {
            double Kdm = 0.26; //dry matter content of prawns
            double de2dm = 16; //a reasonable guess.

            double dm, n, de;

            dm = Kdm * Deaths * (Prawns.LiveWeight * g2kg);
            n = Deaths * (Prawns.NitrogenMass * g2kg);
            de = de2dm * dm;

            Feed deadPrawnsAsFeed = new Feed("DeadPrawns", dm, n, de);
            return deadPrawnsAsFeed;
        }
示例#8
0
文件: Prawns.cs 项目: hol353/ApsimX
        /// <summary>
        /// Returns the feed that was destroyed by a single prawn in the process of feeding today.
        /// Prawns are messy feeders and don't intake everything that they consume. 
        /// </summary>
        /// <param name="FoodInPond">Food currently in the pond</param>
        /// <param name="CurrentFeed">A feed that is currently available for eating today</param>
        /// <param name="TotalDMConsumed"></param>
        /// <returns>(/prawn/d)</returns>
        private Feed FeedConsumedPerPrawn(Food FoodInPond, Feed CurrentFeed, double TotalDMConsumed)
        {
            double feedFrac = MathUtilities.Divide(CurrentFeed.DryMatter, FoodInPond.TotalDM, 0.0);
            double dm, n, de;

            dm = feedFrac * TotalDMConsumed;
            n = CurrentFeed.NperKgOfDM * dm;
            de = CurrentFeed.DEperKgOfDM * dm;

            Feed consumed = new Feed(CurrentFeed.FeedName, dm, n, de);
            return consumed;
        }
示例#9
0
文件: Prawns.cs 项目: lie112/ApsimX
        private void OnEndOfDay(object sender, EventArgs e)
        {
            consumedFoodPP = new Food();
            intakeFoodPP   = new Food();
            digestedFoodPP = new Food();

            consumedFood = new Food();
            intakeFood   = new Food();
            digestedFood = new Food();
            wastedFood   = new Food();

            stressStock    = Stress_Stock(prawns.StockingDensity(PondWater.SurfaceArea));
            stressTemp     = Stress_Temp(PondWater.PondTemp);
            stressSalinity = Stress_Salinity(PondWater.Salinity);

            double totalDMConsumedPP = PotentialDMConsumedPerPrawn(prawns, stressStock, stressTemp);

            totalDMConsumedPP = CheckEnoughFoodToConsumeToday(FoodInPond.Food, prawns, totalDMConsumedPP);


            foreach (Feed feed in FoodInPond.Food)
            {
                Feed consumedFeedPP = FeedConsumedPerPrawn(FoodInPond.Food, feed, totalDMConsumedPP);
                Feed intakeFeedPP   = FeedIntakePerPrawn(consumedFeedPP);
                Feed digestedFeedPP = FeedDigestedPerPrawn(intakeFeedPP);

                consumedFoodPP.AddFeed(consumedFeedPP);
                intakeFoodPP.AddFeed(intakeFeedPP);
                digestedFoodPP.AddFeed(digestedFeedPP);
            }


            energyMaintenancePP = EnergyMaintenance(prawns, stressTemp, stressSalinity);
            weightGainPP        = WeightGainPerPrawn(digestedFoodPP, energyMaintenancePP);
            nitrogenGainPP      = NitrogenGainPerPrawn(weightGainPP);

            prawns.LiveWeight   = prawns.LiveWeight + weightGainPP;
            prawns.NitrogenMass = prawns.NitrogenMass + nitrogenGainPP;


            deaths = Mortality(prawns, PondWater.Salinity, PondWater.N);  //TODO: PondWater.N should be PondWater.NH4
            prawns.NumberOfPrawns = Math.Max(prawns.NumberOfPrawns - deaths, 0);


            //Calculate the total outputs now we have the correct number of prawns still alive.
            foreach (Feed consumedFeedPP in consumedFoodPP)
            {
                Feed consumedFeed = FeedConsumed(prawns, consumedFeedPP);
                Feed wastedFeed   = FeedWasted(consumedFeed);

                consumedFood.AddFeed(consumedFeed);
                wastedFood.AddFeed(wastedFeed);
            }

            foreach (Feed intakeFeedPP in intakeFoodPP)
            {
                Feed intakeFeed = FeedIntake(prawns, intakeFeedPP);
                intakeFood.AddFeed(intakeFeed);
            }

            foreach (Feed digestedFeedPP in digestedFoodPP)
            {
                Feed digestedFeed = FeedDigested(prawns, digestedFeedPP);
                digestedFood.AddFeed(digestedFeed);
            }


            faecesDM         = intakeFood.TotalDM - digestedFood.TotalDM;
            faecesN          = intakeFood.TotalN - digestedFood.TotalN;
            excretedAmmonium = Math.Max(0, digestedFood.TotalN - (nitrogenGainPP * prawns.NumberOfPrawns));  //can't be negative.


            FoodInPond.Food.RemoveFromExisting(consumedFood);


            deadPrawnsAsFeed = DeadPrawnsAsFeed(deaths, prawns);
            FoodInPond.Food.AddFeed(deadPrawnsAsFeed);
        }
示例#10
0
        /// <summary>
        /// Add a Feed to the Food
        /// If it is not already present in this food then add it
        /// If it is already present then add it to the existing feed.
        /// </summary>
        /// <param name="NewFeed">The new feed to add to the food</param>
        public void AddFeed(Feed NewFeed)
        {
            NewFeed.FeedName = CleanUpFeedName(NewFeed.FeedName);
            bool alreadyInFood = IsThisFeedInFood(NewFeed.FeedName);

            if (alreadyInFood == false)
                {
                feeds.Add(NewFeed);
                }
            else
                {
                Feed existing = GetFeed(NewFeed.FeedName);
                existing.AddToExisting(NewFeed);
                }
        }
示例#11
0
        /// <summary>
        /// Remove some feed from the existing feed.
        /// If you are trying to remove more feed than exists
        /// then it will only remove whatever feed is there.
        /// </summary>
        /// <param name="RemoveThis">Amounts in this feed (to remove) should be positive values</param>
        public void RemoveFromExisting(Feed RemoveThis)
        {
            double result;

            //Dry Matter
            result = this.DryMatter - RemoveThis.DryMatter;
            this.DryMatter = Math.Max(result, 0.0);

            //Nitrogen
            result = this.Nitrogen - RemoveThis.Nitrogen;
            this.Nitrogen = Math.Max(result, 0.0);

            //Digestible Energy
            result = this.DigestibleEnergy - RemoveThis.DigestibleEnergy;
            this.DigestibleEnergy = Math.Max(result, 0.0);
        }
示例#12
0
 /// <summary>
 /// Add some feed to the existing feed.
 /// </summary>
 /// <param name="AddThis"></param>
 public void AddToExisting(Feed AddThis)
 {
     this.DryMatter = this.DryMatter + AddThis.DryMatter;
     this.Nitrogen = this.Nitrogen + AddThis.Nitrogen;
     this.DigestibleEnergy = this.DigestibleEnergy + AddThis.DigestibleEnergy;
 }
示例#13
0
 /// <summary>
 /// Add some feed to the existing feed.
 /// </summary>
 /// <param name="AddThis"></param>
 public void AddToExisting(Feed AddThis)
 {
     this.DryMatter        = this.DryMatter + AddThis.DryMatter;
     this.Nitrogen         = this.Nitrogen + AddThis.Nitrogen;
     this.DigestibleEnergy = this.DigestibleEnergy + AddThis.DigestibleEnergy;
 }