/// <summary>Harvest the crop.</summary> public void RemoveBiomass(string biomassRemoveType, RemovalFractions removalData = null) { summary.WriteMessage(this, string.Format("Biomass removed from crop " + Name + " by " + biomassRemoveType.TrimEnd('e') + "ing")); // Invoke specific defoliation events. if (biomassRemoveType == "Harvest" && Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Prune" && Pruning != null) { Pruning.Invoke(this, new EventArgs()); } if (biomassRemoveType == "LeafPluck" && LeafPlucking != null) { LeafPlucking.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Cut" && Cutting != null) { Cutting.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Graze" && Grazing != null) { Grazing.Invoke(this, new EventArgs()); } // Set up the default BiomassRemovalData values foreach (IOrgan organ in Organs) { // Get the default removal fractions OrganBiomassRemovalType biomassRemoval = null; if (removalData != null) { biomassRemoval = removalData.GetFractionsForOrgan(organ.Name); } organ.RemoveBiomass(biomassRemoveType, biomassRemoval); } // Reset the phenology if SetPhenologyStage specified. if (removalData != null && removalData.SetPhenologyStage != 0 && Phenology is Phenology phenology) { phenology.SetToStage(removalData.SetPhenologyStage); } // Reduce plant and stem population if thinning proportion specified if (removalData != null && removalData.SetThinningProportion != 0 && structure != null) { structure.DoThin(removalData.SetThinningProportion); } // Remove nodes from the main-stem if (removalData != null && removalData.NodesToRemove > 0) { structure.DoNodeRemoval(removalData.NodesToRemove); } }
public override void OnHarvest() { if (Harvesting != null) { Harvesting.Invoke(); } string Indent = " "; string Title = Indent + Clock.Today.ToString("d MMMM yyyy") + " - Harvesting " + Name + " from " + Plant.Name; double YieldDW = (Live.Wt + Dead.Wt); Console.WriteLine(""); Console.WriteLine(Title); Console.WriteLine(Indent + new string('-', Title.Length)); Console.WriteLine(Indent + Name + " Yield DWt: " + YieldDW.ToString("f2") + " (g/m^2)"); Console.WriteLine(Indent + Name + " Size: " + Size.ToString("f2") + " (g)"); Console.WriteLine(Indent + Name + " Number: " + Number.ToString("f2") + " (/m^2)"); Console.WriteLine(""); Live.Clear(); Dead.Clear(); Number = 0; _ReadyForHarvest = false; }
/// <summary>Harvest the crop.</summary> public void Harvest() { // Invoke a harvesting event. if (Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } Summary.WriteMessage(this, string.Format("A crop of " + CropType + " was harvested today.")); }
public void OnHarvest(HarvestType Harvest) { WriteHarvestReport(); // Tell the rest of the system we are about to harvest if (Harvesting != null) { Harvesting.Invoke(); } // Check some bounds if (Harvest.Remove < 0 || Harvest.Remove > 1.0) { throw new Exception("Harvest remove fraction needs to be between 0 and 1"); } if (Harvest.Height < 0 || Harvest.Height > 1000.0) { throw new Exception("Harvest height needs to be between 0 and 1000"); } // Set the population denisty if one was provided by user. if (Harvest.Plants != 0) { Population.Density = Harvest.Plants; } // Call each organ's OnHarvest. They fill a BiomassRemoved structure. We then publish a // BiomassRemoved event. BiomassRemovedType BiomassRemovedData = new BiomassRemovedType(); foreach (Organ1 Organ in Organ1s) { Organ.OnHarvest(Harvest, BiomassRemovedData); } BiomassRemovedData.crop_type = CropType; BiomassRemoved.Invoke(BiomassRemovedData); WriteBiomassRemovedReport(BiomassRemovedData); // now update new canopy covers PlantSpatial.Density = Population.Density; PlantSpatial.CanopyWidth = Leaf.width; foreach (Organ1 Organ in Organ1s) { Organ.DoCover(); } UpdateCanopy(); foreach (Organ1 Organ in Organ1s) { Organ.DoNConccentrationLimits(); } }
public override void OnHarvest() { Harvesting.Invoke(); DateTime Today = new DateTime(Clock.year, 1, 1); Today = Today.AddDays(Clock.day - 1); string Indent = " "; string Title = Indent + Today.ToString("d MMMM yyyy") + " - Harvesting " + Name + " from " + Plant.Name; double YieldDW = (Live.Wt + Dead.Wt); Console.WriteLine(""); Console.WriteLine(Title); Console.WriteLine(Indent + new string('-', Title.Length)); Console.WriteLine(Indent + Name + " Yield DWt: " + YieldDW.ToString("f2") + " (g/m^2)"); Console.WriteLine(""); Live.Clear(); Dead.Clear(); }
/// <summary>Harvest the crop.</summary> public void RemoveBiomass(string biomassRemoveType, RemovalFractions removalData = null) { // Invoke an event. if (biomassRemoveType == "Harvest" && Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } Summary.WriteMessage(this, string.Format("Biomass removed from crop " + Name + " by " + biomassRemoveType.TrimEnd('e') + "ing")); // Set up the default BiomassRemovalData values foreach (IOrgan organ in Organs) { // Get the default removal fractions OrganBiomassRemovalType biomassRemoval = null; if (removalData != null) { biomassRemoval = removalData.GetFractionsForOrgan(organ.Name); } organ.DoRemoveBiomass(biomassRemoveType, biomassRemoval); } // Reset the phenology if SetPhenologyStage specified. if (removalData != null && removalData.SetPhenologyStage != 0) { Phenology.ReSetToStage(removalData.SetPhenologyStage); } // Reduce plant and stem population if thinning proportion specified if (removalData != null && removalData.SetThinningProportion != 0) { Structure.doThin(removalData.SetThinningProportion); } // Pruning event (winter pruning, summer pruning is called as cut) reset the phenology if SetPhenologyStage specified. if (biomassRemoveType == "Prune" && Pruning != null) { Pruning.Invoke(this, new EventArgs()); } }
/// <summary>Harvest the crop.</summary> public void RemoveBiomass(string biomassRemoveType, RemovalFractions removalData = null) { // Set up the default BiomassRemovalData values RemovingBiomassArgs allData = new RemovingBiomassArgs(); allData.biomassRemoveType = biomassRemoveType; foreach (IOrgan organ in Organs) { OrganBiomassRemovalType biomassRemoved = Apsim.Get(organ as IModel, "BiomassRemovalDefaults." + biomassRemoveType) as OrganBiomassRemovalType; if (biomassRemoved == null) { throw new Exception("Cannot find biomass removal defaults: " + organ.Name + ".BiomassRemovalDefaults.Harvest"); } // Override the defaults if values were supplied as arguments. if (removalData != null) { OrganBiomassRemovalType userFractions = removalData.GetFractionsForOrgan(organ.Name); if (userFractions != null) { if (userFractions.FractionRemoved >= 0) { biomassRemoved.FractionRemoved = userFractions.FractionRemoved; } if (userFractions.FractionToResidue >= 0) { biomassRemoved.FractionToResidue = userFractions.FractionToResidue; } } } allData.removalData.Add(organ.Name, biomassRemoved); } Summary.WriteMessage(this, string.Format("Biomass removed from crop " + Name + " by " + biomassRemoveType + "ing")); // Invoke an event. if (biomassRemoveType == "Harvest" && Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } else if (RemovingBiomass != null) { RemovingBiomass.Invoke(this, allData); } // Remove the biomass foreach (IOrgan organ in Organs) { organ.DoRemoveBiomass(allData.removalData[organ.Name]); } // Reset the phenology if SetPhenologyStage specified. if (removalData != null && removalData.SetPhenologyStage != 0) { Phenology.ReSetToStage(removalData.SetPhenologyStage); } // Reduce plant and stem population if thinning proportion specified if (removalData != null && removalData.SetThinningProportion != 0) { Structure.doThin(removalData.SetThinningProportion); } }
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); } }