本文整理汇总了C#中SiteCohorts类的典型用法代码示例。如果您正苦于以下问题:C# SiteCohorts类的具体用法?C# SiteCohorts怎么用?C# SiteCohorts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiteCohorts类属于命名空间,在下文中一共展示了SiteCohorts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GrowCohorts
//---------------------------------------------------------------------
/// <summary>
/// Grows all cohorts at a site for a specified number of years. The
/// dead pools at the site also decompose for the given time period.
/// </summary>
public static void GrowCohorts(SiteCohorts cohorts,
ActiveSite site,
int years,
bool isSuccessionTimestep)
{
if (cohorts == null)
return;
//CurrentYearSiteMortality = 0.0;
for (int y = 1; y <= years; ++y)
{
SpeciesData.ChangeDynamicParameters(PlugIn.ModelCore.CurrentTime + y - 1);
SiteVars.ResetAnnualValues(site);
CohortBiomass.SubYear = y - 1;
CohortBiomass.CanopyLightExtinction = 0.0;
SiteVars.PercentShade[site] = 0.0;
SiteVars.LightTrans[site] = 1.0;
SiteVars.Cohorts[site].Grow(site, (y == years && isSuccessionTimestep));
SiteVars.WoodyDebris[site].Decompose();
SiteVars.Litter[site].Decompose();
}
//SiteVars.PreviousYearMortality[site] = CurrentYearSiteMortality;
}
示例2: NoCohorts_Grow
public void NoCohorts_Grow()
{
SiteCohorts cohorts = new SiteCohorts();
mockCalculator.CountCalled = 0;
Util.Grow(cohorts, 5, activeSite, false);
Assert.AreEqual(0, mockCalculator.CountCalled);
}
示例3: Grow
//---------------------------------------------------------------------
/// <summary>
/// Grows all cohorts at a site for a number of years.
/// </summary>
public static void Grow(SiteCohorts cohorts,
int years,
ActiveSite site,
bool isSuccessionTimestep)
{
for (int y = 1; y <= years; ++y)
cohorts.Grow(site, (y == years && isSuccessionTimestep));
}
示例4: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
Dead.Pool deadWoodyPool,
Dead.Pool deadNonWoodyPool)
{
this.cohorts = cohorts;
this.deadWoodyPool = deadWoodyPool;
this.deadNonWoodyPool = deadNonWoodyPool;
}
示例5: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
Landis.Library.Biomass.Pool deadWoodyPool,
Landis.Library.Biomass.Pool deadNonWoodyPool)
{
this.cohorts = cohorts;
this.deadWoodyPool = deadWoodyPool;
this.deadNonWoodyPool = deadNonWoodyPool;
}
示例6: TestInit
public void TestInit()
{
List<ISpeciesCohorts> speciesCohortList = new List<ISpeciesCohorts>();
speciesCohortList.Add(MakeCohorts(abiebals, 30, 40, 50, 150, 170));
speciesCohortList.Add(MakeCohorts(betualle, 100, 120, 280, 300));
siteCohorts = new SiteCohorts(speciesCohortList);
deadCohorts.Clear();
}
示例7: SingleCohort
public void SingleCohort()
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 300;
cohorts.AddNewCohort(abiebals, initialBiomass);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new ushort[] { 1, initialBiomass };
Util.CheckCohorts(expectedCohorts, cohorts);
}
示例8: GrowCohorts
/// <summary>
/// Grows all cohorts at a site for a specified number of years. The
/// dead pools at the site also decompose for the given time period.
/// </summary>
public static void GrowCohorts(SiteCohorts cohorts,
ActiveSite site,
int years,
bool isSuccessionTimestep)
{
for (int y = 1; y <= years; ++y) {
cohorts.Grow(site, (y == years && isSuccessionTimestep));
Dead.Pools.Woody[site].Decompose();
Dead.Pools.NonWoody[site].Decompose();
}
}
示例9: SingleCohort
public void SingleCohort()
{
SiteCohorts cohorts = new SiteCohorts();
Assert.AreEqual(0, cohorts.TotalBiomass);
const int initialBiomass = 300;
cohorts.AddNewCohort(abiebals, initialBiomass);
Assert.AreEqual(initialBiomass, cohorts.TotalBiomass);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new int [] { 1, initialBiomass };
Util.CheckCohorts(expectedCohorts, cohorts);
}
示例10: ActualSiteBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the actual biomass at a site. The biomass is the total
/// of all the site's cohorts except young ones. The total is limited
/// to being no more than the site's maximum biomass less the previous
/// year's mortality at the site.
/// </summary>
public static double ActualSiteBiomass(SiteCohorts siteCohorts,
ActiveSite site,
out IEcoregion ecoregion)
{
int youngBiomass;
int totalBiomass = Cohorts.ComputeBiomass(siteCohorts, out youngBiomass);
double B_ACT = totalBiomass - youngBiomass;
int lastMortality = siteCohorts.PrevYearMortality;
ecoregion = Model.Core.Ecoregion[site];
B_ACT = Math.Min( B_MAX[ecoregion] - lastMortality, B_ACT);
return B_ACT;
}
示例11: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
List<PoolD> litterPool,
PoolD woodyDebrisPool,
List<PoolD> deadFRootsPool,
Pool fineRootsPool,
Pool coarseRootsPool,
Charcoal charcoalPool)
{
this.cohorts = cohorts;
this.litterPool = litterPool;
this.woodyDebrisPool = woodyDebrisPool;
this.deadFRootsPool = deadFRootsPool;
this.fineRootsPool = fineRootsPool;
this.coarseRootsPool = coarseRootsPool;
this.charcoalPool = charcoalPool;
}
示例12: SingleCohort_LongevityReached
public void SingleCohort_LongevityReached()
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 300;
cohorts.AddNewCohort(poputrem, initialBiomass);
mockCalculator.CountCalled = 0;
mockCalculator.Change = 1;
expectedSite = activeSite;
deadCohorts.Clear();
// Repeatedly grow for succession timesteps until longevity
// reached.
int time = 0;
do {
time += successionTimestep;
cohorts.Grow(successionTimestep, activeSite, true);
} while (time <= poputrem.Longevity);
expectedCohorts.Clear();
Util.CheckCohorts(expectedCohorts, cohorts);
// Calculator called L times where L is longevity. Inituitively,
// one would think since initial cohort's age is 1, it'd only take
// L-1 times to get to the max age (= L). So the calculator
// should be called L-1 times. But the combining of young cohorts
// at the first succession timestep (t_succ = 20) results in the
// calculator being called twice with cohort age = t_succ-1 (19).
// At the end of year 19, the cohort's age is 20 and the
// calculator has been called 19 times. But at the start of year
// 20, the combine-young-cohorts operation is done because it's a
// succession timestep. The combine operation takes all the young
// cohorts (age <= t_succ = 20) and replaces them with one cohort
// with age = t_succ-1 (= 19). This ensures that after the growth
// phase, the cohort's age will be t_succ (20). So the growth
// phase of year 20 calls the calculator for the 20th time with
// cohort age 19.
Assert.AreEqual(poputrem.Longevity, mockCalculator.CountCalled);
Assert.AreEqual(1, deadCohorts.Count);
ICohort deadCohort = deadCohorts[0];
Assert.AreEqual(poputrem, deadCohort.Species);
Assert.AreEqual(poputrem.Longevity, deadCohort.Age);
Assert.AreEqual(initialBiomass + (poputrem.Longevity * mockCalculator.Change),
deadCohort.Biomass);
}
示例13: ActualSiteBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the actual biomass at a site. The biomass is the total
/// of all the site's cohorts except young ones. The total is limited
/// to being no more than the site's maximum biomass less the previous
/// year's mortality at the site.
/// </summary>
public static double ActualSiteBiomass(SiteCohorts siteCohorts,
ActiveSite site)
{
IEcoregion ecoregion = Model.Core.Ecoregion[site];
if (siteCohorts == null)
return 0.0;
int youngBiomass;
int totalBiomass = Landis.Biomass.Cohorts.ComputeBiomass(siteCohorts, out youngBiomass);
double B_ACT = totalBiomass - youngBiomass;
int lastMortality = (int) SiteVars.PrevYearMortality[site]; //siteCohorts.PrevYearMortality;
B_ACT = System.Math.Min(SpeciesData.B_MAX[ecoregion] - lastMortality, B_ACT);
return B_ACT;
}
示例14: SiteConditions
public SiteConditions(ActiveSite site, ICommunity initialCommunity)
{
cohorts = new SiteCohorts();
canopy = new Canopy();
if (PlugIn.HasSiteOutput[site] == true)
{
siteoutput = new SiteOutput(site);
estoutput = new EstablishmentOutput(site);
}
this.site = site;
foreach (ISpecies spc in PlugIn.modelCore.Species)
{
deadcohortages[spc] = new List<int>();
}
uint key = ComputeKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode);
SiteConditions s = GetFromKey(key);
if (s != null) return;
// If we don't have a sorted list of age cohorts for the initial
// community, make the list
List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts))
{
sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts);
sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
}
hydrology = new Hydrology(PlugIn.modelCore.Ecoregion[site]);
forestfloor = new ForestFloor();
cohorts = new SiteCohorts();
establishment = new EstablishmentProbability(site);
if (sortedAgeCohorts.Count == 0) return;
//PlugIn.ModelCore.UI.WriteLine("Making Biomass Cohorts "+ site);
BiomassSpinUp(sortedAgeCohorts, site);
initialSites[key] = this;
return;
}
示例15: InitialBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the initial biomass for a cohort at a site.
/// </summary>
public static float[] InitialBiomass(SiteCohorts siteCohorts,
ActiveSite site, ISpecies species)
{
IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
double leafFrac = FunctionalType.Table[SpeciesData.FuncType[species]].FCFRACleaf;
double Nreduction = 0.0;
double B_ACT = SiteVars.ActualSiteBiomass(site);
double B_MAX = SpeciesData.B_MAX_Spp[species][ecoregion];//B_MAX[ecoregion]
// Initial biomass exponentially declines in response to
// competition.
double initialBiomass = 0.002 * B_MAX *
Math.Exp(-1.6 * B_ACT / B_MAX);
//Initial biomass is limited by nitrogen availability.
//initialBiomass *= SpeciesData.NLimits[species];
initialBiomass = Math.Max(initialBiomass, 1.0);
double initialLeafB = initialBiomass * leafFrac;
double initialWoodB = initialBiomass * (1.0 - leafFrac);
double[] initialB = new double[2]{initialWoodB, initialLeafB};
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}, InitialB={2:0.0}, InitBleaf={3:0.00}, InitBwood={4:0.00}. LeafFrac={5:0.0}", PlugIn.ModelCore.CurrentTime, month, initialBiomass, initialB[1], initialB[0], leafFrac);
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}, B_MAX={2:0.0}, B_ACT={3:0.00}", PlugIn.ModelCore.CurrentTime, month, B_MAX, B_ACT);
// Note: The following if statement is critical for ensuring that young cohorts
// get established properly.
if (SiteVars.MineralN[site] <= 0 || initialBiomass < 5.0)
{
initialBiomass = Math.Min(initialBiomass, 5.0);
initialB[0] = initialBiomass * (1.0 - leafFrac);
initialB[1] = initialBiomass * leafFrac;
}
Nreduction = AvailableN.CohortUptakeAvailableN(species, site, initialB);
SiteVars.MineralN[site] -= Nreduction;
float[] initialWoodLeafBiomass = new float[2]{(float) initialB[0], (float) initialB[1]};
//float[] initialWoodLeafBiomass = new float[2]{(float) initialBiomass, 0.0F};
return initialWoodLeafBiomass;
}