예제 #1
0
파일: ModelTest.cs 프로젝트: OSU-MARS/iLand
        private static void VerifyMalcolmKnappClimate(Model model)
        {
            Assert.IsTrue(model.Landscape.Environment.ClimatesByName.Count == 1);
            foreach (Climate climate in model.Landscape.Environment.ClimatesByName.Values)
            {
                Phenology conifer = climate.GetPhenology(0);
                // private phenology variables read from the project file
                //   vpdMin, vpdMax, dayLengthMin, dayLengthMax, tempMintempMax
                //conifer.ChillingDaysLastYear;
                //conifer.ID;
                //conifer.LeafOnEnd;
                //conifer.LeafOnFraction;
                //conifer.LeafOnStart;
                Phenology broadleaf        = climate.GetPhenology(1);
                Phenology deciduousConifer = climate.GetPhenology(2);

                // private climate variables
                //   tableName, batchYears, temperatureShift, precipitationShift, randomSamplingEnabled, randomSamplingList, filter
                Assert.IsTrue(climate.CarbonDioxidePpm == 360.0);
                Assert.IsTrue((climate.MeanAnnualTemperature > 0.0) && (climate.MeanAnnualTemperature < 30.0));
                Assert.IsTrue(String.Equals(climate.Name, "HaneyUBC", StringComparison.OrdinalIgnoreCase));
                Assert.IsTrue(conifer.LeafType == 0);
                Assert.IsTrue(broadleaf.LeafType == 1);
                Assert.IsTrue(deciduousConifer.LeafType == 2);
                // climate.PrecipitationMonth;
                Assert.IsTrue((climate.Sun.LastDayLongerThan10_5Hours > 0) && (climate.Sun.LastDayLongerThan10_5Hours < 365));
                Assert.IsTrue((climate.Sun.LastDayLongerThan14_5Hours > 0) && (climate.Sun.LastDayLongerThan14_5Hours < 365));
                Assert.IsTrue(climate.Sun.LongestDay == 172);
                Assert.IsTrue(climate.Sun.IsNorthernHemisphere());
                // climate.TemperatureMonth;
                Assert.IsTrue((climate.TotalAnnualRadiation > 4000.0) && (climate.TotalAnnualRadiation < 5000.0));
            }
        }
예제 #2
0
    /// <summary>
    /// Do our timestep development
    /// </summary>
    public override double DoTimeStep(double PropOfDayToUse)
    {
        bool CanGerminate = !Phenology.OnDayOf("Sowing") && ESW > 0;

        if (CanGerminate)
        {
            return(0.999);
        }
        else
        {
            return(0);
        }
    }
예제 #3
0
        /** Calculate the abiotic environemnt for seedling for a given species and a given resource unit.
         * The model is closely based on the TACA approach of Nitschke and Innes (2008), Ecol. Model 210, 263-277
         * more details: http://iland-model.org/establishment#abiotic_environment
         * a model mockup in R: script_establishment.r
         */
        public void CalculateAbioticEnvironment(Project projectFile)
        {
            //DebugTimer t("est_abiotic"); t.setSilent();
            // make sure that required calculations (e.g. watercycle are already performed)
            this.mRUspecies.CalculateBiomassGrowthForYear(projectFile, fromEstablishment: true); // calculate the 3-PG module and run the water cycle (this is done only if that did not happen up to now); true: call comes from regeneration

            EstablishmentParameters establishment = mRUspecies.Species.EstablishmentParameters;
            Phenology pheno = mClimate.GetPhenology(mRUspecies.Species.PhenologyClass);

            this.TacaMinTemp   = true;           // minimum temperature threshold
            this.TacaChill     = false;          // (total) chilling requirement
            this.TacaGdd       = false;          // gdd-thresholds
            this.TacaFrostFree = false;          // frost free days in vegetation period
            this.TacaFrostDaysAfterBudBurst = 0; // frost days after bud burst

            int   doy = 0;
            float growingDegreeDays         = 0.0F;
            float growingDegreeDaysBudBurst = 0.0F;
            int   chillingDays  = pheno.ChillingDaysAfterLeafOffInPreviousYear; // chilling days of the last autumn
            int   frostFreeDays = 0;

            this.TacaFrostDaysAfterBudBurst = 0;
            bool chillRequirementSatisfied = false;
            bool budsHaveBurst             = false;
            int  veg_period_end            = pheno.LeafOnEnd;

            if (veg_period_end >= 365)
            {
                veg_period_end = mClimate.Sun.LastDayLongerThan10_5Hours;
            }
            for (int index = mClimate.CurrentJanuary1; index != mClimate.NextJanuary1; ++index, ++doy)
            {
                ClimateDay day = mClimate[index];
                // minimum temperature: if temp too low . set prob. to zero
                if (day.MinTemperature < establishment.MinTemp)
                {
                    this.TacaMinTemp = false;
                }
                // count frost free days
                if (day.MinTemperature > 0.0)
                {
                    ++frostFreeDays;
                }
                // chilling requirement, GDD, bud birst
                if (day.MeanDaytimeTemperature >= -5.0 && day.MeanDaytimeTemperature < 5.0)
                {
                    ++chillingDays;
                }
                if (chillingDays > establishment.ChillRequirement)
                {
                    chillRequirementSatisfied = true;
                }
                // GDDs above the base temperature are counted if beginning from the day where the chilling requirements are met
                // up to a fixed day ending the veg period
                if (doy <= veg_period_end)
                {
                    // accumulate growing degree days
                    if (chillRequirementSatisfied && day.MeanDaytimeTemperature > establishment.GrowingDegreeDaysBaseTemperature)
                    {
                        growingDegreeDays         += day.MeanDaytimeTemperature - establishment.GrowingDegreeDaysBaseTemperature;
                        growingDegreeDaysBudBurst += day.MeanDaytimeTemperature - establishment.GrowingDegreeDaysBaseTemperature;
                    }
                    // if day-frost occurs, the GDD counter for bud burst is reset
                    if (day.MeanDaytimeTemperature <= 0.0)
                    {
                        growingDegreeDaysBudBurst = 0.0F;
                    }
                    if (growingDegreeDaysBudBurst > establishment.GddBudBurst)
                    {
                        budsHaveBurst = true;
                    }
                    if (doy < veg_period_end && budsHaveBurst && day.MinTemperature <= 0.0)
                    {
                        ++this.TacaFrostDaysAfterBudBurst;
                    }
                }
            }
            // chilling requirement
            if (chillRequirementSatisfied)
            {
                this.TacaChill = true;
            }

            // GDD requirements
            if (growingDegreeDays > establishment.MinimumGrowingDegreeDays && growingDegreeDays < establishment.MaximumGrowingDegreeDays)
            {
                this.TacaGdd = true;
            }

            // frost free days in the vegetation period
            if (frostFreeDays > establishment.MinimumFrostFreeDays)
            {
                this.TacaFrostFree = true;
            }

            // if all requirements are met:
            if (this.TacaChill && this.TacaMinTemp && this.TacaGdd && this.TacaFrostFree)
            {
                // negative effect of frost events after bud birst
                float frostEffect = 1.0F;
                if (this.TacaFrostDaysAfterBudBurst > 0)
                {
                    frostEffect = MathF.Pow(establishment.FrostTolerance, MathF.Sqrt(this.TacaFrostDaysAfterBudBurst));
                }
                // negative effect due to water limitation on establishment [1: no effect]
                this.WaterLimitation = this.CalculateWaterLimitation(pheno.LeafOnStart, pheno.GetLeafOnDurationInDays());
                // combine drought and frost effect multiplicatively
                this.AbioticEnvironment = frostEffect * this.WaterLimitation;
            }
            else
            {
                this.AbioticEnvironment = 0.0F; // if any of the requirements is not met
            }
        }