private void OnPlantSowing(object sender, SowPlant2Type Sow) { if (Sow.Plant == plant) { Clear(); //allow structure to clear leaf on sowing event, otherwise leaf will reset the culms after tthey have been initialised leaf.Clear(); if (Sow.MaxCover <= 0.0) { throw new Exception("MaxCover must exceed zero in a Sow event."); } FertileTillerNumber = Sow.BudNumber; //TotalStemPopn = MainStemPopn; if (leaf.Culms.Count == 0) { //first culm is the main culm leaf.AddCulm(new CulmParameters() { Density = Sow.Population, InitialProportion = 1, InitialAppearanceRate = initialAppearanceRate.Value(), FinalAppearanceRate = finalAppearanceRate.Value(), RemainingLeavesForFinalAppearanceRate = remainingLeavesForFinalAppearanceRate.Value(), LargestLeafSize = leaf.LargestLeafSize, A0 = leaf.A0.Value(), A1 = leaf.A1.Value(), B0 = leaf.B0.Value(), B1 = leaf.B1.Value(), AX0 = leaf.AX0.Value(), LeafNoCorrection = leafNoCorrection.Value(), LeafNoAtAppearance = 0 }); } } }
private void OnPlantSowing(object sender, SowPlant2Type data) { double SowDepth = 0; double accumDepth = 0; if (Plant != null) { SowDepth = Plant.SowingData.Depth; } if (Plant15 != null) { SowDepth = Plant15.SowingData.Depth; } bool layerfound = false; for (int layer = 0; layerfound; layer++) { accumDepth += Soil.Thickness[layer]; if (SowDepth <= accumDepth) { SowLayer = layer; layerfound = true; } } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { //Fixme, this can be deleted when arbitrator calculates uptake ????? Uptake = new double[Soil.Thickness.Length]; Depth = Plant.SowingData.Depth; double AccumulatedDepth = 0; double InitialLayers = 0; for (int layer = 0; layer < Soil.Thickness.Length; layer++) { if (AccumulatedDepth < Depth) { InitialLayers += 1; } AccumulatedDepth += Soil.SoilWater.Thickness[layer]; } for (int layer = 0; layer < Soil.Thickness.Length; layer++) { if (layer <= InitialLayers - 1) { //dirstibute root biomass evently through root depth LayerLive[layer].StructuralWt = InitialDM / InitialLayers * Plant.Population; LayerLive[layer].StructuralN = InitialDM / InitialLayers * MaxNconc * Plant.Population; } } } }
public void OnSow(SowPlant2Type Sow) { SowingData = Sow; // Go through all our children and find all organs. Organs.Clear(); foreach (object ChildObject in My.ChildrenAsObjects) { Organ Child = ChildObject as Organ; if (Child != null) { Organs.Add(Child); } } if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = CropType; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) { Sowing.Invoke(); } // tell all our children about sow foreach (Organ Child in Organs) { Child.OnSow(Sow); } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (sender == plantModel) { Clear(); } }
protected void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == parentPlant) { Clear(); } }
private void OnPlantSowing(object sender, SowPlant2Type data) { double SowDepth = 0; double accumDepth = 0; if (Plant != null) { SowDepth = Plant.SowingData.Depth; } if (Plant15 != null) { SowDepth = Plant15.SowingData.Depth; } bool layerfound = false; for (int layer = 0; layerfound; layer++) { accumDepth += Soil.Thickness[layer]; if (SowDepth <= accumDepth) { SowLayer = layer; layerfound = true; } } if (DaysFromSowingToEndPhase > 0) { summary.WriteMessage(this, "FIXED number of days from sowing to " + Name + " = " + DaysFromSowingToEndPhase); } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (DaysFromSowingToEndPhase > 0) { summary.WriteMessage(this, "FIXED number of days from sowing to " + Name + " = " + DaysFromSowingToEndPhase); } }
/// <summary> /// Write a sowing report to summary file. /// </summary> void WriteSowReport(SowPlant2Type Sow) { Console.WriteLine("Crop Sow"); Console.WriteLine(" ------------------------------------------------"); Console.WriteLine(" cultivar = " + Sow.Cultivar); Phenology.WriteSummary(); Grain.WriteCultivarInfo(); Console.WriteLine(" ------------------------------------------------\n\n"); Root.WriteSummary(); Console.WriteLine(string.Format(" Crop factor for bounding water use is set to {0,5:F1} times eo.", EOCropFactor)); Console.WriteLine(""); Console.WriteLine(" Crop Sowing Data"); Console.WriteLine(" ------------------------------------------------"); Console.WriteLine(" Sowing Depth Plants Spacing Skip Skip Cultivar"); Console.WriteLine(" Day no mm m^2 mm row plant name"); Console.WriteLine(" ------------------------------------------------"); Console.WriteLine(string.Format(" {0,7:D}{1,7:F1}{2,7:F1}{3,7:F1}{4,6:F1}{5,6:F1} {6}", new object[] { Today.DayOfYear, Sow.Depth, Sow.Population, Sow.RowSpacing, Sow.SkipRow, Sow.SkipPlant, Sow.Cultivar })); Console.WriteLine(" ------------------------------------------------\n"); }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Clear(); } }
public void OnSow(SowPlant2Type Sow) { if ((IsOverwritten == false) && (Sow.SkipPlant != 0) && (this.Name == "ExpectedYield")) { k = Convert.ToString(Sow.SkipPlant); IsOverwritten = true; } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { PlantZone.Initialise(Plant.SowingData.Depth, InitialDM.Value(), Plant.Population, MaximumNConc.Value()); InitialiseZones(); } }
public void OnSow(SowPlant2Type Sow) { SowData = Sow; if (Sow.SkipRow < 0 || Sow.SkipRow > 2) { throw new Exception("Invalid SkipRow: " + Sow.SkipRow.ToString()); } }
protected void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { MicroClimatePresent = false; Clear(); } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == parentPlant) { Clear(); ClearBiomassFlows(); } }
protected void OnPlantSowing(object sender, SowPlant2Type Sow) { if (Sow.Plant == plant) { Reset(); Number = structure.PrimaryBudNo; } }
public override void OnSow(SowPlant2Type Sow) { if (Sow.MaxCover <= 0.0) { throw new Exception("MaxCover must exceed zero in a Sow event."); } MaxCover = Sow.MaxCover; MaxNodeNo = Structure.MaximumNodeNumber; }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { PlantZone.Initialise(Plant.SowingData.Depth, initialDM.Value(), Plant.Population, maximumNConc.Value()); InitialiseZones(); needToRecalculateLiveDead = true; } }
protected void OnPlantSowing(object sender, SowPlant2Type Sow) { if (Sow.Plant == plant) { Reset(); Number = structure.PrimaryBudNo; apexGroupAge.Add(1); apexGroupSize.Add(1); } }
public void OnSow(SowPlant2Type Sow) { if (Sow.MaxCover <= 0.0) { throw new Exception("MaxCover must exceed zero in a Sow event."); } PrimaryBudNo = Sow.BudNumber; Population = Sow.Population; TotalStemPopn = Population * PrimaryBudNo; }
protected void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == parentPlant) { Clear(); Live.StructuralWt = initialWtFunction.Value(); Live.StorageWt = 0.0; Live.StructuralN = Live.StructuralWt * minimumNConc.Value(); Live.StorageN = (initialWtFunction.Value() * maximumNConc.Value()) - Live.StructuralN; } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Clear(); if (StructuralFraction != null) { _StructuralFraction = StructuralFraction.Value; } } }
private void OnPlantSowing(object sender, SowPlant2Type Sow) { if (Sow.Plant == plant) { Clear(); if (Sow.MaxCover <= 0.0) { throw new Exception("MaxCover must exceed zero in a Sow event."); } PrimaryBudNo = Sow.BudNumber; TotalStemPopn = MainStemPopn; } }
public override void OnSow(SowPlant2Type Data) { if (structure != null) //could be optional ? { structure.Population = Data.Population; } else { Population = Data.Population; } PublishNewPotentialGrowth(); PublishNewCanopyEvent(); }
public override void OnSow(SowPlant2Type Sow) { SowingInfo = Sow; if (LayerLive == null) { LayerLive = new Biomass[dlayer.Length]; LayerDead = new Biomass[dlayer.Length]; for (int i = 0; i < dlayer.Length; i++) { LayerLive[i] = new Biomass(); LayerDead[i] = new Biomass(); } } DeltaNO3 = new double[dlayer.Length]; DeltaNH4 = new double[dlayer.Length]; }
private void OnSow(SowPlant2Type Sow) { plant_status = "alive"; if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = Crop_Type; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) { Sowing.Invoke(); } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Clear(); } if (DMConversionEfficiencyFunction != null) { DMConversionEfficiency = DMConversionEfficiencyFunction.Value(); } else { DMConversionEfficiency = 1.0; } }
protected void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == parentPlant) { Clear(); ClearBiomassFlows(); Live.StructuralWt = initialWtFunction.Value(); Live.StorageWt = 0.0; if (initialNConcFunction != null) { Live.StructuralN = Live.StructuralWt * initialNConcFunction.Value(); } else { Live.StructuralN = Live.StructuralWt * minimumNConc.Value(); Live.StorageN = (initialWtFunction.Value() * maximumNConc.Value()) - Live.StructuralN; } } }
private void OnPlantSowing(object sender, SowPlant2Type data) { double SowDepth = 0; double accumDepth = 0; if (Plant != null) SowDepth = Plant.SowingData.Depth; if (Plant15 != null) SowDepth = Plant15.SowingData.Depth; bool layerfound = false; for (int layer = 0; layerfound; layer++) { accumDepth += Soil.Thickness[layer]; if (SowDepth <= accumDepth) { SowLayer = layer; layerfound = true; } } }
public void OnSow(SowPlant2Type Sow) { SowingData = Sow; plant_status = "alive"; Population = SowingData.Population; if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = Crop_Type; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) { Sowing.Invoke(); } }
public void OnSow(SowPlant2Type Sow) { if (Sow.Cultivar == "") { throw new Exception("Cultivar not specified on sow line."); } SowingData = Sow; // Go through all our children and find all organs. Organ1s.Clear(); foreach (object ChildObject in My.ChildrenAsObjects) { Organ1 Child1 = ChildObject as Organ1; if (Child1 != null) { Organ1s.Add(Child1); if (Child1 is AboveGround) { Tops.Add(Child1); } } } if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = CropType; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) { Sowing.Invoke(); } WriteSowReport(Sow); }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Clear(); if (data.MaxCover <= 0.0) throw new Exception("MaxCover must exceed zero in a Sow event."); MaxCover = data.MaxCover; FudgeToGetETDemandRight = 1.0; } }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { MicroClimatePresent = false; Clear(); if (data.MaxCover <= 0.0) throw new Exception("MaxCover must exceed zero in a Sow event."); MaxCover = data.MaxCover; } }
/// <summary>Called when [sow].</summary> /// <param name="Sow">The sow.</param> public void OnSow(SowPlant2Type Sow) { _Plants = Sow.Population; }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { PlantZone.Initialise(Plant.SowingData.Depth, InitialDM.Value, Plant.Population, MaximumNConc.Value); InitialiseZones(); } }
private new void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Clear(); if (StructuralFraction != null) _StructuralFraction = StructuralFraction.Value; } }
/// <summary>Write a sowing report to summary file.</summary> /// <param name="Sow">The sow.</param> void WriteSowReport(SowPlant2Type Sow) { StringWriter summary = new StringWriter(); summary.WriteLine("Crop sow"); summary.WriteLine(" cultivar = " + Sow.Cultivar); Phenology.WriteSummary(summary); Grain.WriteCultivarInfo(summary); Root.WriteSummary(summary); summary.WriteLine(string.Format("Crop factor for bounding water use is set to {0,5:F1} times eo.", EOCropFactor)); summary.WriteLine(""); summary.WriteLine(" Crop Sowing Data"); summary.WriteLine("------------------------------------------------"); summary.WriteLine("Sowing Depth Plants Spacing Skip Skip Cultivar"); summary.WriteLine("Day no mm m^2 mm row plant name"); summary.WriteLine("------------------------------------------------"); summary.WriteLine(string.Format("{0,7:D}{1,7:F1}{2,7:F1}{3,7:F1}{4,6:F1}{5,6:F1} {6}", new object[] {Clock.Today.DayOfYear, Sow.Depth, Sow.Population, Sow.RowSpacing, Sow.SkipRow, Sow.SkipPlant, Sow.Cultivar})); Summary.WriteMessage(this, summary.ToString()); }
private void OnPlantSowing(object sender, SowPlant2Type data) { AccumulatedThermalTime = 0; }
/// <summary>Sows the specified population.</summary> /// <param name="population">The population.</param> /// <param name="cultivar">The cultivar.</param> /// <param name="depth">The depth.</param> /// <param name="rowSpacing">The row spacing.</param> /// <param name="budNumber">Bud number not used</param> /// <param name="maxCover">Maximum cover not used</param> /// <exception cref="System.Exception">Cultivar not specified on sow line.</exception> public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1) { SowingData = new SowPlant2Type(); SowingData.Population = population; SowingData.Cultivar = cultivar; SowingData.Depth = depth; SowingData.RowSpacing = rowSpacing; if (SowingData.Cultivar == "") throw new Exception("Cultivar not specified on sow line."); // Find cultivar and apply cultivar overrides. cultivarDefinition = Cultivar.Find(Cultivars, SowingData.Cultivar); cultivarDefinition.Apply(this); if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = CropType; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) Sowing.Invoke(this, new EventArgs()); if (PlantSowing != null) PlantSowing.Invoke(this, SowingData); Population.OnSow(SowingData); WriteSowReport(SowingData); OnPrepare(null, null); // Call this because otherwise it won't get called on the sow date. }
/// <summary>Called when [end crop].</summary> public void OnEndCrop() { NewCropType Crop = new NewCropType(); Crop.crop_type = CropType; Crop.sender = Name; if (CropEnding != null) CropEnding.Invoke(Crop); if (PlantEnding != null) PlantEnding.Invoke(this, new ModelArgs() { Model = this }); // Keep track of some variables for reporting. Biomass AboveGroundBiomass = new Biomass(AboveGround); Biomass BelowGroundBiomass = new Biomass(BelowGround); // 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.OnEndCrop(BiomassRemovedData); BiomassRemovedData.crop_type = CropType; BiomassRemoved.Invoke(BiomassRemovedData); string message = string.Format("Organic matter from crop to surface organic matter:-\r\n" + " DM tops (kg/ha) = {0,10:F1}\r\n" + " DM roots (kg/ha) = {1,10:F1}\r\n" + " N tops (kg/ha) = {0,10:F2}\r\n" + " N roots (lh/ha) = {1,10:F2}", AboveGroundBiomass.Wt, BelowGroundBiomass.Wt, AboveGroundBiomass.N, BelowGroundBiomass.N); Summary.WriteMessage(this, message); cultivarDefinition.Unapply(); SowingData = null; }
private void OnSow(SowPlant2Type Sow) { plant_status = "alive"; if (NewCrop != null) { NewCropType Crop = new NewCropType(); Crop.crop_type = Crop_Type; Crop.sender = Name; NewCrop.Invoke(Crop); } if (Sowing != null) Sowing.Invoke(); }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) { Depth = Plant.SowingData.Depth; double AccumulatedDepth = 0; double InitialLayers = 0; for (int layer = 0; layer < Soil.Thickness.Length; layer++) { if (AccumulatedDepth < Depth) InitialLayers += 1; AccumulatedDepth += Soil.SoilWater.Thickness[layer]; } for (int layer = 0; layer < Soil.Thickness.Length; layer++) { if (layer <= InitialLayers - 1) { //dirstibute root biomass evently through root depth LayerLive[layer].StructuralWt = InitialDM / InitialLayers * Plant.Population; LayerLive[layer].StructuralN = InitialDM / InitialLayers * MaxNconc * Plant.Population; } } } }
/// <summary>Sows the specified cultivar.</summary> /// <param name="cultivar">The cultivar.</param> /// <param name="population">The population.</param> /// <param name="depth">The depth.</param> /// <param name="rowSpacing">The row spacing.</param> /// <param name="maxCover">The maximum cover.</param> /// <param name="budNumber">The bud number.</param> /// <exception cref="System.Exception">Cultivar not specified on sow line.</exception> public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1) { SowingData = new SowPlant2Type(); SowingData.Population = population; this.Population = population; SowingData.Depth = depth; SowingData.Cultivar = cultivar; SowingData.MaxCover = maxCover; SowingData.BudNumber = budNumber; SowingData.RowSpacing = rowSpacing; CropInGround = true; if (SowingData.Cultivar == "") throw new Exception("Cultivar not specified on sow line."); // Find cultivar and apply cultivar overrides. cultivarDefinition = Cultivar.Find(Cultivars, SowingData.Cultivar); cultivarDefinition.Apply(this); // Invoke a sowing event. if (Sowing != null) Sowing.Invoke(this, new EventArgs()); Summary.WriteMessage(this, string.Format("A crop of "+SowingData.Cultivar+" OilPalm was sown today at a population of " + population + " plants/m2 with " + budNumber + " buds per plant at a row spacing of " + rowSpacing + " and a depth of " + depth + " mm")); }
private void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) Clear(); }
private void DoActualPlantGrowth(object sender, EventArgs e) { if (SowingData != null) { // g.n_fix_pot = _fixation->Potential(biomass, swStress->swDef.fixation); double n_fix_pot = 0; // PotNFix = _fixation->NFixPot(); double PotNFix = 0; Root.DoNUptake(PotNFix); double n_fix_uptake = Arbitrator1.DoNPartition(n_fix_pot, Organ1s); // DoPPartition(); if (!DoRetranslocationBeforeNDemand) Arbitrator1.DoNRetranslocate(Grain.NDemand2, Tops); // DoPRetranslocate(); bool PlantIsDead = Population.PlantDeath(); foreach (Organ1 Organ in Organ1s) Organ.DoDetachment(); Update(); CheckBounds(); SWStress.DoPlantWaterStress(TopsSWDemand); NStress.DoPlantNStress(); if (PhenologyEventToday) { string message = Phenology.CurrentPhase.Start; if (Phenology.CurrentPhase.Start != "Germination") { double biomass = 0; double StoverWt = 0; double StoverN = 0; foreach (Organ1 Organ in Tops) { biomass += Organ.Live.Wt + Organ.Dead.Wt; if (!(Organ is Reproductive)) { StoverWt += Organ.Live.Wt + Organ.Dead.Wt; StoverN += Organ.Live.N + Organ.Dead.N; } } double StoverNConc = MathUtilities.Divide(StoverN, StoverWt, 0) * Conversions.fract2pcnt; message += "\r\n"; message += string.Format(" biomass = {0,8:F2} (g/m^2)\r\n" + " lai = {1,8:F2} (m^2/m^2)\r\n" + " stover N conc = {2,8:F2} (%)\r\n" + " extractable sw = {3,8:F2} (mm)", biomass, Leaf.LAI, StoverNConc, Root.ESWInRootZone); } Summary.WriteMessage(this, message); PhenologyEventToday = false; } //Root.UpdateWaterBalance(); if (Phenology.InPhase("ReadyForHarvesting")) { OnHarvest(new HarvestType()); OnEndCrop(); SowingData = null; } LAIMax = Math.Max(LAIMax, Leaf.LAI); } }
protected void OnPlantSowing(object sender, SowPlant2Type data) { if (data.Plant == Plant) Clear(); if (DMConversionEfficiencyFunction != null) DMConversionEfficiency = DMConversionEfficiencyFunction.Value; else DMConversionEfficiency = 1.0; }
private void OnSow(SowPlant2Type Sow) { SowingData = Sow; plant_status = "alive"; Population = SowingData.Population; if (Sowing != null) Sowing.Invoke(this, new EventArgs()); }