/// <summary>Sow the crop with the specified parameters.</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> /// <param name="rowConfig">SkipRow configuration.</param> public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1, double rowConfig = 1) { SowingDate = Clock.Today; SowingData = new SowPlant2Type(); SowingData.Plant = this; SowingData.Population = population; SowingData.Depth = depth; SowingData.Cultivar = cultivar; SowingData.MaxCover = maxCover; SowingData.BudNumber = budNumber; SowingData.RowSpacing = rowSpacing; SowingData.SkipRow = rowConfig; this.Population = population; // Find cultivar and apply cultivar overrides. cultivarDefinition = PMF.Cultivar.Find(Cultivars, SowingData.Cultivar); cultivarDefinition.Apply(this); // Invoke an AboutToSow event. if (Sowing != null) { Sowing.Invoke(this, new EventArgs()); } // Invoke a sowing event. if (PlantSowing != null) { PlantSowing.Invoke(this, SowingData); } Summary.WriteMessage(this, string.Format("A crop of " + CropType + " (cultivar = " + cultivar + ") 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")); }
/// <summary>Sow the crop with the specified parameters.</summary> /// <param name="cultivar">The cultivar.</param> /// <param name="population">The population.</param> /// <param name="depth">The depth mm.</param> /// <param name="rowSpacing">The row spacing mm.</param> /// <param name="maxCover">The maximum cover.</param> /// <param name="budNumber">The bud number.</param> /// <param name="rowConfig">SkipRow configuration.</param> public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1, double rowConfig = 0) { SowingDate = clock.Today; SowingData = new SowingParameters(); SowingData.Plant = this; SowingData.Population = population; SowingData.Depth = depth; SowingData.Cultivar = cultivar; SowingData.MaxCover = maxCover; SowingData.BudNumber = budNumber; SowingData.RowSpacing = rowSpacing; SowingData.SkipType = rowConfig; if (rowConfig == 0) { // No skip row SowingData.SkipPlant = 1.0; SowingData.SkipRow = 0.0; } if (rowConfig == 1) { // Alternate rows (plant 1 – skip 1) SowingData.SkipPlant = 1.0; SowingData.SkipRow = 1.0; } if (rowConfig == 2) { // Planting two rows and skipping one row (plant 2 – skip 1) SowingData.SkipPlant = 2.0; SowingData.SkipRow = 1.0; } if (rowConfig == 3) { // Alternate pairs of rows (plant 2 – skip 2) SowingData.SkipPlant = 2.0; SowingData.SkipRow = 2.0; } // Adjusting number of plant per meter in each row SowingData.SkipDensityScale = 1.0 + SowingData.SkipRow / SowingData.SkipPlant; IsAlive = true; this.Population = population; // Find cultivar and apply cultivar overrides. Cultivar cultivarDefinition = FindAllDescendants <Cultivar>().FirstOrDefault(c => c.IsKnownAs(SowingData.Cultivar)); if (cultivarDefinition == null) { throw new ApsimXException(this, $"Cannot find a cultivar definition for '{SowingData.Cultivar}'"); } cultivarDefinition.Apply(this); // Invoke an AboutToSow event. if (Sowing != null) { Sowing.Invoke(this, new EventArgs()); } // Invoke a sowing event. if (PlantSowing != null) { PlantSowing.Invoke(this, SowingData); } summary.WriteMessage(this, string.Format("A crop of " + PlantType + " (cultivar = " + cultivar + ") 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")); }