Ejemplo n.º 1
0
        private void PrintMultiRunSummaryDate(LineData line, Run runOld, GrowthStage moment)
        {
            var lastUniverse = GetLastUniverse(runOld);

            if (lastUniverse != null)
            {
                // pm 29 April 2015: need to remove 1 day to report the growth stage on the day
                //                   they were simulated
                var momentDate = lastUniverse.Crop_.getDateOfStage(moment);

                ///<Behnam (2015.09.18)>
                ///<Comment>
                ///Previously it was required to subtract one day to report model state variables at specific
                ///growth stages, except ZC_00_Sowing and ZC_39_FlagLeafLiguleJustVisible.
                ///By this modification, the model stores the dates correctly and they need not to be changed
                ///when reporting or when retrieving their values.
                ///</Comment>

                // if (lastUniverse.Crop_.calendar[moment].HasValue && moment != GrowthStage.ZC_00_Sowing &&
                // moment != GrowthStage.ZC_39_FlagLeafLiguleJustVisible)
                // {
                // momentDate = lastUniverse.Crop_.calendar[moment].Value.AddDays(-1);
                // }

                ///</Behnam>

                line.Add(momentDate.HasValue ? momentDate.Value.ToString("yyyy-MM-dd") : "?");
            }
            else
            {
                line.Add("?");
            }
        }
Ejemplo n.º 2
0
        internal override LineData MultiRunLine(Run runOld)
        {
            var line = new LineData();

            line.Add(runOld.ManagementDef.Name)
            .Add(runOld.ParameterDef.Name)
            .Add(runOld.RunOptionDef.Name)
            .Add(runOld.SiteDef.Name)
            .Add(runOld.SoilDef.Name)
            .Add(runOld.VarietyDef.Name);

            var lastUniverse     = GetLastUniverse(runOld);
            var anthesisUniverse = GetUniverse(runOld, GrowthStage.ZC_65_Anthesis);
            var maturityUniverse = GetUniverse(runOld, GrowthStage.ZC_92_Maturity);

            if (lastUniverse != null)
            {
                DateTime?sowingDate          = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_00_Sowing);
                DateTime?emergenceDate       = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_10_Emergence);
                DateTime?anthesisDate        = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_65_Anthesis);
                DateTime?endCellDivisionDate = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_75_EndCellDivision);
                DateTime?endGrainFillDate    = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_91_EndGrainFilling);
                DateTime?maturityDate        = lastUniverse.Crop_.getDateOfStage(GrowthStage.ZC_92_Maturity);
                line
                .Add((sowingDate.HasValue) ? sowingDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add((emergenceDate.HasValue) ? emergenceDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add((anthesisDate.HasValue) ? anthesisDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add((endCellDivisionDate.HasValue) ? endCellDivisionDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add((endGrainFillDate.HasValue) ? endGrainFillDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add((maturityDate.HasValue) ? maturityDate.Value.ToString("yyyy-MM-dd") : "?")
                .Add(lastUniverse.Crop_.LeafNumber, 2)
                .Add(anthesisUniverse.Crop_.GAI, 2)
                .Add(anthesisUniverse.Crop_.OutputTotalDM, 0, 10)
                .Add(maturityUniverse.Crop_.OutputTotalDM, 0, 10)
                .Add(maturityUniverse.Crop_.GrainTotalDM, 0, 10)
                .Add(anthesisUniverse.Crop_.OutputTotalN, 0, 10)
                .Add(maturityUniverse.Crop_.OutputTotalN, 0, 10)
                .Add(maturityUniverse.Crop_.GrainTotalN, 0, 10)
                .Add(maturityUniverse.Crop_.HarvestIndexDM, 2)
                .Add(maturityUniverse.Crop_.HarvestIndexN, 2)
                .Add(maturityUniverse.Soil_.CalculateAvailableExcessN(), 2, 10)     // ???
                .Add(maturityUniverse.Soil_.SoilDeepLayer_.LostNitrogen, 2, 10)
                .Add(maturityUniverse.NuseEfficiency, 2)
                .Add(maturityUniverse.Crop_.TotalDMperGrain, 2)
                .Add(maturityUniverse.Crop_.TotalNperGrain, 2)
                .Add(maturityUniverse.Crop_.ProteinConcentration, 2)
                .Add(maturityUniverse.Crop_.GrainNumber, 0)
                .Add(maturityUniverse.Crop_.NalbGlo, 2)
                .Add(maturityUniverse.Crop_.Namp, 2)
                .Add(maturityUniverse.Crop_.Ngli, 2)
                .Add(maturityUniverse.Crop_.Nglu, 2)
                .Add(maturityUniverse.Crop_.PercentGli, 3)
                .Add(maturityUniverse.Crop_.PercentGlu, 3)
                .Add(maturityUniverse.Crop_.GliadinsToGluteins, 2);
            }
            return(line);
        }
Ejemplo n.º 3
0
        private void PrintMultiRunWarning(LineData line, Run runOld)
        {
            string Tag = CutGrainWarningExtractor(runOld);

            if (Tag != "")
            {
                line.Add("Warning on grain filling cut").Add(Tag);
            }
            else
            {
                line.Add("No Warnings").Add("No Warnings");
            }

            //Tag = PhenologyWarningExtractor(runOld);

            //if (Tag != "") line.AddNull().Add("Warning on phenology phase transitions").Add(Tag);
            //else line.AddNull().Add("No Warnings");
        }
Ejemplo n.º 4
0
        private static LineData PrintDailyHeaderLeaf12(Run runOld)
        {
            var lastUniverse = GetLastUniverse(runOld);
            var finalLeafNum = (int)((lastUniverse != null) ? lastUniverse.Crop_.LeafNumber : 0);
            var space        = 39 - finalLeafNum;

            var header = new LineData();

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space + 1);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            header.AddNull(space);
            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                header.Add(i + 1);
            }
            return(header);
        }
Ejemplo n.º 5
0
        internal override PageData MultiRunHeader()
        {
            var line = new LineData();

            line.Add(FileContainer.ManagementID)
            .Add(FileContainer.NonVarietyID)
            .Add(FileContainer.RunOptionID)
            .Add(FileContainer.SiteID)
            .Add(FileContainer.SoilID)
            .Add(FileContainer.VarietyID)
            .Add("Sowing")
            .Add("Emergence")
            .Add("Anthesis")
            .Add("End cell division")
            .Add("End grain fill")
            .Add("Maturity")
            .Add("Final leaf number")
            .Add("Anthesis GAI")
            .Add("Crop DM at anthesis, MgDM/ha")
            .Add("Total yield, MgDM/ha")
            .Add("Grain yield, MgDM/ha")
            .Add("CropN at anthesis, kgN/ha")
            .Add("CropN at maturity, kgN/ha")
            .Add("GrainN, kgN/ha")
            .Add("DM harvest index")
            .Add("N harvest index")
            .Add("AvSoilN, kgN/ha")
            .Add("N leaching, kgN/ha")
            .Add("NUE, kgDM/kgN")
            .Add("GrainDM, mgDM/grain")
            .Add("GrainN, mgN/grain")
            .Add("GPC, %")
            .Add("Grain number, grain/m2")
            .Add("AlbGlo, mgN/grain")
            .Add("Amp, mgN/grain")
            .Add("Gli, mgN/grain")
            .Add("Glu, mgN/grain")
            .Add("%Gli, % total N")
            .Add("%Glu, % total N")
            .Add("Gli/Glu");
            var page = new PageData();

            page.Add(line);
            return(page);
        }
Ejemplo n.º 6
0
        private static LineData PrintDailyLeafRow2(Universe universe, int finalLeafNum)//OK
        {
            var line   = new LineData();
            var nbLeaf = universe.Crop_.CreatedLeavesNumber;
            var space  = 38 - finalLeafNum;

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathAreaIndexForLeafLayer(i), 6);
            }

            line.AddNull(41 + space);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add((universe.Crop_.getExposedSheathTotalDMForLeafLayer(i) * 10.0), 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add((universe.Crop_.getExposedSheathTotalNForLeafLayer(i) * 10.0), 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathSpecificNForLeafLayer(i), 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathSpecificWeightForLeafLayer(i), 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathTTsinceSenForLeafLayer(i), 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathDeadDMForLeafLayer(i) * 10.0, 6);
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                line.Add(universe.Crop_.getExposedSheathLostDMForLeafLayer(i) * 10.0, 6);
            }

            return(line);
        }
Ejemplo n.º 7
0
        private static LineData PrintDailyLeafRow1(Universe universe, int finalLeafNum)//OK
        {
            var line = new LineData();

            var nbLeaf = universe.Crop_.CreatedLeavesNumber;
            var space  = 38 - finalLeafNum;

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaAreaIndexForLeafLayer(i), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space).AddNull();

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getInterNodeLengthForLeafLayer(i), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            /*var earInterNode = (universe.Crop_.Phytomers_.EarPeduncle != null) ? universe.Crop_.Phytomers_.EarPeduncle.InterNode : null;
             * if (earInterNode != null)
             * {
             *  line.Add(earInterNode.Length, 6);
             * }
             * else line.Add((0.0), 6);*/
            line.Add(universe.Crop_.getEarPeduncleInterNodeLength(), 6);

            line.Add(universe.Crop_.SumInternodesLength, 6);

            line.AddNull(space);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add((universe.Crop_.getLeafLaminaTotalDMForLeafLayer(i) * 10.0), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space).AddNull();

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add((universe.Crop_.getLeafLaminaTotalNForLeafLayer(i) * 10.0), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space).AddNull();

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaSpecificNForLeafLayer(i), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaSpecificWeightForLeafLayer(i), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }
            line.AddNull(space).AddNull();

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaTTsinceSenForLeafLayer(i), 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaDeadDMForLeafLayer(i) * 10.0, 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            line.AddNull(space + 1);

            for (var i = finalLeafNum - 1; i >= 0; --i)
            {
                if (i < nbLeaf)
                {
                    line.Add(universe.Crop_.getLeafLaminaLostDMForLeafLayer(i) * 10.0, 6);
                }
                else
                {
                    line.Add((0.0), 6);
                }
            }

            return(line);
        }
Ejemplo n.º 8
0
        public LineData MultiRunLine(Run runOld)
        {
            var line = new LineData();

            if (runOld.ManagementDef != null)
            {
                line.Add(runOld.ManagementDef.Name);
            }
            else
            {
                line.Add("?");
            }
            if (runOld.ParameterDef != null)
            {
                line.Add(runOld.ParameterDef.Name);
            }
            else
            {
                line.Add("?");
            }
            if (runOld.RunOptionDef != null)
            {
                line.Add(runOld.RunOptionDef.Name);
            }
            else
            {
                line.Add("?");
            }
            if (runOld.SiteDef != null)
            {
                line.Add(runOld.SiteDef.Name);
            }
            else
            {
                line.Add("?");
            }
            if (runOld.SoilDef != null)
            {
                line.Add(runOld.SoilDef.Name);
            }
            else
            {
                line.Add("?");
            }
            if (runOld.VarietyDef != null)
            {
                line.Add(runOld.VarietyDef.Name);
            }
            else
            {
                line.Add("?");
            }

            line.AddNull();


            PrintMultiRunSummaryDate(line, runOld, GrowthStage.ZC_00_Sowing);
            PrintMultiRunSummaryDate(line, runOld, GrowthStage.ZC_92_Maturity);

            line.AddNull();

            PrintMultiRunWarning(line, runOld);

            string Tag = CutGrainWarningExtractor(runOld);

            if (Tag == "No Warnings")
            {
                line = null;
            }

            return(line);
        }