public void OnInitialised() { //MyPaddock.Parent.ChildPaddocks PotSWUptake = new double[ll15_dep.Length]; SWUptake = new double[ll15_dep.Length]; PotNUptake = new double[ll15_dep.Length]; NUptake = new double[ll15_dep.Length]; UnderstoryPotSWUptake = new double[ll15_dep.Length]; UnderstorySWUptake = new double[ll15_dep.Length]; UnderstoryPotNUptake = new double[ll15_dep.Length]; UnderstoryNUptake = new double[ll15_dep.Length]; for (int i = 0; i < ll15_dep.Length; i++) { RootType R = new RootType(); Roots.Add(R); Roots[i].Mass = 0.1; Roots[i].N = Roots[i].Mass * RootNConcentration.Value / 100; } for (int i = 0; i < (int)InitialFrondNumber.Value; i++) { FrondType F = new FrondType(); F.Age = ((int)InitialFrondNumber.Value - i) * FrondAppRate.Value; F.Area = SizeFunction(F.Age); F.Mass = F.Area / SpecificLeafArea.Value; F.N = F.Mass * FrondCriticalNConcentration.Value / 100.0; Fronds.Add(F); CumulativeFrondNumber += 1; } for (int i = 0; i < (int)InitialFrondNumber.Value + 60; i++) { BunchType B = new BunchType(); B.FemaleFraction = FemaleFlowerFraction.Value; Bunches.Add(B); } RootDepth = InitialRootDepth; }
private void OnSimulationCommencing(object sender, EventArgs e) { //zero public properties CumulativeFrondNumber = 0; CumulativeBunchNumber = 0; CarbonStress = 0; HarvestBunches = 0; HarvestFFB = 0; HarvestNRemoved = 0; HarvestBunchSize = 0; Age = 0; Population = 0; UnderstoryNFixation = 0; UnderstoryDltDM = 0; UnderstoryEP = 0; UnderstoryPEP = 0; UnderstoryFW = 0; StemMass = 0; StemN = 0; CropInGround = false; NUptake = new double[] { 0 }; UnderstoryNUptake = new double[] { 0 }; UnderstoryCoverGreen = 0; StemGrowth = 0; RootGrowth = 0; FrondGrowth = 0; BunchGrowth = 0; Fn = 1; FW = 1; Fvpd = 1; PEP = 0; EP = 0; RootDepth = 0; DltDM = 0; ReproductiveGrowthFraction = 0; Fronds = new List<FrondType>(); Bunches = new List<BunchType>(); Roots = new List<RootType>(); soilCrop = Soil.Crop(Name) as SoilCropOilPalm; //MyPaddock.Parent.ChildPaddocks PotSWUptake = new double[Soil.Thickness.Length]; SWUptake = new double[Soil.Thickness.Length]; PotNUptake = new double[Soil.Thickness.Length]; NUptake = new double[Soil.Thickness.Length]; UnderstoryPotSWUptake = new double[Soil.Thickness.Length]; UnderstorySWUptake = new double[Soil.Thickness.Length]; UnderstoryPotNUptake = new double[Soil.Thickness.Length]; UnderstoryNUptake = new double[Soil.Thickness.Length]; for (int i = 0; i < Soil.Thickness.Length; i++) { RootType R = new RootType(); Roots.Add(R); Roots[i].Mass = 0.1; Roots[i].N = Roots[i].Mass * RootNConcentration.Value / 100; } double FMA = FrondMaxArea.Value; double GrowthDuration = ExpandingFronds.Value * FrondAppearanceRate.Value; for (int i = 0; i < (int)InitialFrondNumber.Value; i++) { FrondType F = new FrondType(); F.Age = ((int)InitialFrondNumber.Value - i) * FrondAppearanceRate.Value; F.Area = SizeFunction(F.Age, FMA, GrowthDuration); F.Mass = F.Area / SpecificLeafArea.Value; F.N = F.Mass * FrondCriticalNConcentration.Value / 100.0; Fronds.Add(F); CumulativeFrondNumber += 1; } for (int i = 0; i < (int)InitialFrondNumber.Value + 60; i++) { BunchType B = new BunchType(); if (i>40) B.FemaleFraction = FemaleFlowerFraction.Value; else B.FemaleFraction = 0; Bunches.Add(B); } RootDepth = InitialRootDepth; }
/// <summary>Does the development.</summary> private void DoDevelopment() { Age = Age + 1.0 / 365.0; //for (int i = 0; i < Frond.Length; i++) // Frond[i].Age += 1; foreach (FrondType F in Fronds) { F.Age += DeltaT; //F.Area = SizeFunction(F.Age); } if (Fronds[Fronds.Count - 1].Age >= FrondAppearanceRate.Value) { FrondType F = new FrondType(); Fronds.Add(F); CumulativeFrondNumber += 1; BunchType B = new BunchType(); B.FemaleFraction = FemaleFlowerFraction.Value; Bunches.Add(B); } //if (Fronds[0].Age >= (40 * FrondAppRate.Value)) if (FrondNumber > Math.Round(HarvestFrondNumber.Value)) { HarvestBunches = Bunches[0].FemaleFraction; double HarvestYield = Bunches[0].Mass * Population / (1.0 - RipeBunchWaterContent.Value); HarvestFFB = HarvestYield / 100; HarvestNRemoved = Bunches[0].N * Population * 10; HarvestBunchSize = Bunches[0].Mass / (1.0 - RipeBunchWaterContent.Value) / Bunches[0].FemaleFraction; if (Harvesting != null) Harvesting.Invoke(this, new EventArgs()); // Now rezero these outputs - they can only be output non-zero on harvesting event. HarvestBunches = 0.0; HarvestYield = 0.0; HarvestFFB = 0.0; HarvestBunchSize = 0.0; HarvestNRemoved = 0.0; CumulativeBunchNumber += Bunches[0].FemaleFraction; Bunches.RemoveAt(0); BiomassRemovedType BiomassRemovedData = new BiomassRemovedType(); BiomassRemovedData.crop_type = CanopyType; BiomassRemovedData.dm_type = new string[1] { "frond" }; BiomassRemovedData.dlt_crop_dm = new float[1] { (float)(Fronds[0].Mass * Population * 10) }; BiomassRemovedData.dlt_dm_n = new float[1] { (float)(Fronds[0].N * Population * 10) }; BiomassRemovedData.dlt_dm_p = new float[1] { 0 }; BiomassRemovedData.fraction_to_residue = new float[1] { 1 }; Fronds.RemoveAt(0); BiomassRemoved.Invoke(BiomassRemovedData); } }
private void DoDevelopment() { Age = Age + 1.0 / 365.0; //for (int i = 0; i < Frond.Length; i++) // Frond[i].Age += 1; foreach (FrondType F in Fronds) { F.Age += DeltaT; //F.Area = SizeFunction(F.Age); } if (Fronds[Fronds.Count - 1].Age >= FrondAppRate.Value) { FrondType F = new FrondType(); Fronds.Add(F); CumulativeFrondNumber += 1; BunchType B = new BunchType(); B.FemaleFraction = FemaleFlowerFraction.Value; Bunches.Add(B); } //if (Fronds[0].Age >= (40 * FrondAppRate.Value)) if (FrondNumber > Math.Round(HarvestFrondNumber.Value)) { HarvestBunches = Bunches[0].FemaleFraction; HarvestYield = Bunches[0].Mass * Population / (1.0 - RipeBunchWaterContent.Value); HarvestFFB = HarvestYield / 100; HarvestNRemoved = Bunches[0].N * Population * 10; HarvestBunchSize = Bunches[0].Mass / (1.0 - RipeBunchWaterContent.Value) / Bunches[0].FemaleFraction; if (Harvesting != null) { Harvesting.Invoke(); } // Now rezero these outputs - they can only be output non-zero on harvesting event. HarvestBunches = 0.0; HarvestYield = 0.0; HarvestFFB = 0.0; HarvestBunchSize = 0.0; HarvestNRemoved = 0.0; CumulativeBunchNumber += Bunches[0].FemaleFraction; CumulativeYield += Bunches[0].Mass * Population / (1.0 - RipeBunchWaterContent.Value); Bunches.RemoveAt(0); BiomassRemovedType BiomassRemovedData = new BiomassRemovedType(); BiomassRemovedData.crop_type = Crop_Type; BiomassRemovedData.dm_type = new string[1] { "frond" }; BiomassRemovedData.dlt_crop_dm = new float[1] { (float)(Fronds[0].Mass * Population * 10) }; BiomassRemovedData.dlt_dm_n = new float[1] { (float)(Fronds[0].N * Population * 10) }; BiomassRemovedData.dlt_dm_p = new float[1] { 0 }; BiomassRemovedData.fraction_to_residue = new float[1] { 1 }; Fronds.RemoveAt(0); BiomassRemoved.Invoke(BiomassRemovedData); } }