示例#1
0
    public void OnEndCrop()
    {
        NewCropType Crop = new NewCropType();

        Crop.crop_type = CropType;
        Crop.sender    = Name;
        if (CropEnding != null)
        {
            CropEnding.Invoke(Crop);
        }

        // 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);

        Console.WriteLine("    Organic matter from crop:-      Tops to surface residue      Roots to soil FOM");
        Console.WriteLine(string.Format("                      DM (kg/ha) = {0,21:F1}{1,24:F1}",
                                        AboveGroundBiomass.Wt, BelowGroundBiomass.Wt));
        Console.WriteLine(string.Format("                      N  (kg/ha) = {0,22:F2}{1,24:F2}",
                                        AboveGroundBiomass.N, BelowGroundBiomass.N));
        //Console.WriteLine(string.Format("                      P  (kg/ha) = {0,22:F2}{1,24:F2}",
        //                                AboveGroundBiomass.P, BelowGroundBiomass.P));
    }