示例#1
0
        /// <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"));
        }
示例#2
0
    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);
        }
    }
示例#3
0
        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();
            }
        }
示例#4
0
    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();
        }
    }
示例#5
0
    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);
    }
示例#6
0
        /// <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"));
        }