Example #1
0
        ///<summary>
        ///Copy constructor.
        ///</summary>
        ///<param name="runOld">The run of this universe.</param>
        ///<param name="toCopy">The universe to copy.</param>
        ///<param name="copyAll">false copy only the outputs</param>
        public Universe(Run runOld, Universe toCopy, bool copyAll)
            : base(runOld)
        {
            switchMaize                = toCopy.switchMaize;
            CurrentDate                = toCopy.CurrentDate;
            Crop_                      = (toCopy.Crop_ != null) ? new Crop(this, toCopy.Crop_, copyAll) : null;
            Soil_                      = (toCopy.Soil_ != null) ? new Soil(this, toCopy.Soil_, copyAll) : null;
            thermalTimeWrapper_        = (toCopy.thermalTimeWrapper_ != null) ? new ThermalTimeBiomaWrapper(this, toCopy.thermalTimeWrapper_, copyAll) : null;
            meteorologyWrapper_        = (toCopy.meteorologyWrapper_ != null) ? new MeteoBiomaWrapper(this, toCopy.meteorologyWrapper_, copyAll) : null;
            ShootTemperature_          = (toCopy.ShootTemperature_ != null) ? new ShootTemperature(this, toCopy.ShootTemperature_) : null;
            PrevAppliedStagesIrr       = toCopy.PrevAppliedStagesIrr;
            PrevAppliedStagesN         = toCopy.PrevAppliedStagesN;
            NFertChange                = toCopy.NFertChange;
            GrowthDay                  = toCopy.GrowthDay;
            CumMaxCanopyTempFromSowing = toCopy.CumMaxCanopyTempFromSowing;
            CumMaxAirTempFromSowing    = toCopy.CumMaxAirTempFromSowing;
            CumAirTempFromSowing       = toCopy.CumAirTempFromSowing;
            mtg_ = (toCopy.mtg_ != null) ? new csMTG.Gramene(toCopy.mtg_, copyAll) : null;

            if (copyAll)
            {
                Weather_               = toCopy.Weather_;
                IsSowDateEstimate      = toCopy.IsSowDateEstimate;
                isUnlimitedWater       = toCopy.isUnlimitedWater;
                isUnlimitedNitrogen    = toCopy.isUnlimitedNitrogen;
                isUnlimitedTemperature = toCopy.isUnlimitedTemperature;
                isInteractionsWNT      = toCopy.isInteractionsWNT;
                CurrentDate            = toCopy.CurrentDate;
            }
            NAdded = toCopy.NAdded;
        }
Example #2
0
        /// <summary>
        /// Init the universe for a new run.
        /// </summary>
        public void Init(SiteItem site, ManagementItem management)
        {
            Weather_            = new Weather(this);
            Crop_               = new Crop(this);
            Soil_               = new Soil(this);
            thermalTimeWrapper_ = new ThermalTimeBiomaWrapper(this);
            ShootTemperature_   = new ShootTemperature(this);

            meteorologyWrapper_ = new MeteoBiomaWrapper(this);

            Weather_.Init(site, management);
            CurrentDate = management.FinalSowingDate.AddDays(-1);
            Soil_.Init(Weather_.MinTemp(CurrentDate), Weather_.MaxTemp(CurrentDate), Weather_.GetMeanTemperatureBeforeSowing());
            Crop_.Init(thermalTimeWrapper_.CumulTT, CurrentDate.AddDays(1));

            CalcChangeinNFertilisation();
            GrowthDay                  = 0;
            CumAirTempFromSowing       = 0;
            CumMaxCanopyTempFromSowing = 0;
            CumMaxAirTempFromSowing    = 0;
            if (management.Species == "Maize")
            {
                switchMaize = true;
            }
            else
            {
                switchMaize = false;
            }
        }
Example #3
0
        ///<summary>
        ///Default constructor.
        ///</summary>
        ///<param name="runOld">The run of this universe.</param>
        public Universe(Run runOld) : base(runOld)
        {
            Weather_            = null;
            Crop_               = null;
            Soil_               = null;
            thermalTimeWrapper_ = null;
            meteorologyWrapper_ = null;
            ShootTemperature_   = null;

            mtg_ = new csMTG.Gramene();
            mtg_.CreateBasicWheat(0);
        }