Beispiel #1
0
        /// <summary>
        /// Scale the grazing inputs
        /// </summary>
        /// <param name="Inputs"></param>
        /// <param name="fScale"></param>
        /// <returns></returns>
        static public TGrazingInputs scaleGrazingInputs(TGrazingInputs Inputs, double fScale)
        {
            int iClass;
            int iSpecies;
            int iRipe;

            TGrazingInputs Result = new TGrazingInputs(Inputs);

            if (fScale != 1.0)
            {
                for (iClass = 1; iClass <= DigClassNo; iClass++)
                {
                    Result.Herbage[iClass].Biomass = fScale * Inputs.Herbage[iClass].Biomass;
                }

                Result.TotalGreen = fScale * Inputs.TotalGreen;
                Result.TotalDead  = fScale * Inputs.TotalDead;

                for (iSpecies = 1; iSpecies <= MaxPlantSpp; iSpecies++)
                {
                    for (iRipe = UNRIPE; iRipe <= RIPE; iRipe++)
                    {
                        Result.Seeds[iSpecies, iRipe].Biomass = fScale * Inputs.Seeds[iSpecies, iRipe].Biomass;
                    }
                }
            }
            return(Result);
        }
Beispiel #2
0
 /// <summary>
 /// Zero the grazing inputs
 /// </summary>
 /// <param name="Inputs"></param>
 static public void zeroGrazingInputs(ref TGrazingInputs Inputs)
 {
     Inputs.Herbage      = new IntakeRecord[DigClassNo + 1];
     Inputs.TotalGreen   = 0;
     Inputs.TotalDead    = 0;
     Inputs.LegumePropn  = 0;
     Inputs.Seeds        = new IntakeRecord[MaxPlantSpp + 1, RIPE + 1];
     Inputs.SeedClass    = new int[MaxPlantSpp + 1, RIPE + 1];
     Inputs.SelectFactor = 0;
     Inputs.LegumeTrop   = 0;
 }
Beispiel #3
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="src"></param>
 public TGrazingInputs(TGrazingInputs src)
 {
     Array.Copy(src.Herbage, this.Herbage, src.Herbage.Length);
     TotalGreen       = src.TotalGreen;
     TotalDead        = src.TotalDead;
     this.LegumePropn = src.LegumePropn;
     Array.Copy(src.Seeds, Seeds, src.Seeds.Length);
     Array.Copy(src.SeedClass, SeedClass, src.SeedClass.Length);
     SelectFactor = src.SelectFactor;
     LegumeTrop   = src.LegumeTrop;
 }
Beispiel #4
0
        /// <summary>
        /// Add grazing inputs to total inputs
        /// </summary>
        /// <param name="iPopn"></param>
        /// <param name="partInputs"></param>
        /// <param name="totalInputs"></param>
        static public void addGrazingInputs(int iPopn, TGrazingInputs partInputs, ref TGrazingInputs totalInputs)
        {
            int iClass;
            // IntakeRecord intakeRec;
            {
                for (iClass = 1; iClass <= DigClassNo; iClass++)
                {
                    IntakeRecord intake = totalInputs.Herbage[iClass];

                    intake.HeightRatio = fWeightAverage(intake.HeightRatio,
                                                        intake.Biomass,
                                                        partInputs.Herbage[iClass].HeightRatio,
                                                        partInputs.Herbage[iClass].Biomass);
                    intake.Degradability = fWeightAverage(intake.Degradability,
                                                          intake.Biomass * intake.CrudeProtein,
                                                          partInputs.Herbage[iClass].Degradability,
                                                          partInputs.Herbage[iClass].Biomass
                                                          * partInputs.Herbage[iClass].CrudeProtein);
                    intake.Digestibility = fWeightAverage(intake.Digestibility,
                                                          intake.Biomass,
                                                          partInputs.Herbage[iClass].Digestibility,
                                                          partInputs.Herbage[iClass].Biomass);
                    intake.CrudeProtein = fWeightAverage(intake.CrudeProtein,
                                                         intake.Biomass,
                                                         partInputs.Herbage[iClass].CrudeProtein,
                                                         partInputs.Herbage[iClass].Biomass);
                    intake.PhosContent = fWeightAverage(intake.PhosContent,
                                                        intake.Biomass,
                                                        partInputs.Herbage[iClass].PhosContent,
                                                        partInputs.Herbage[iClass].Biomass);
                    intake.SulfContent = fWeightAverage(intake.SulfContent,
                                                        intake.Biomass,
                                                        partInputs.Herbage[iClass].SulfContent,
                                                        partInputs.Herbage[iClass].Biomass);
                    intake.AshAlkalinity = fWeightAverage(intake.AshAlkalinity,
                                                          intake.Biomass,
                                                          partInputs.Herbage[iClass].AshAlkalinity,
                                                          partInputs.Herbage[iClass].Biomass);
                    intake.Biomass = intake.Biomass + partInputs.Herbage[iClass].Biomass;
                    totalInputs.Herbage[iClass] = intake;
                }
                totalInputs.LegumePropn = fWeightAverage(totalInputs.LegumePropn,
                                                         totalInputs.TotalGreen + totalInputs.TotalDead,
                                                         partInputs.LegumePropn,
                                                         partInputs.TotalGreen + partInputs.TotalDead);
                totalInputs.SelectFactor = fWeightAverage(totalInputs.SelectFactor,
                                                          totalInputs.TotalGreen + totalInputs.TotalDead,
                                                          partInputs.SelectFactor,
                                                          partInputs.TotalGreen + partInputs.TotalDead);
                totalInputs.TotalGreen = totalInputs.TotalGreen + partInputs.TotalGreen;
                totalInputs.TotalDead  = totalInputs.TotalDead + partInputs.TotalDead;
                for (int i = 0; i <= 2; i++)
                {
                    totalInputs.Seeds[iPopn, i]     = partInputs.Seeds[1, i];
                    totalInputs.SeedClass[iPopn, i] = partInputs.SeedClass[1, i];
                }
                totalInputs.LegumeTrop = fWeightAverage(totalInputs.LegumeTrop,
                                                        totalInputs.TotalGreen + totalInputs.TotalDead,
                                                        partInputs.LegumeTrop,
                                                        partInputs.TotalGreen + partInputs.TotalDead);
            }
        }