예제 #1
0
        /// <summary>Reset the state values to those set during the initialisation</summary>
        public void Reset()
        {
            inReset = true;

            // Save present state
            SaveState();

            // reset the size of arrays - so it zeroes them
            ResizeLayerArrays(dlayer.Length);

            // reset patches
            Patch.Clear();
            soilCNPatch newPatch = new soilCNPatch(this);

            Patch.Add(newPatch);

            foreach (soilCNPatch aPatch in Patch)
            {
                aPatch.ResizeLayerArrays(dlayer.Length);
            }

            // reset C and N variables to their initial state
            oc      = OC_reset;
            NO3ppm  = no3ppm_reset;
            NH4ppm  = nh4ppm_reset;
            ureappm = ureappm_reset;

            // perform initial calculations and setup
            InitCalc();

            // reset soil temperature
            if (!use_external_st)
            {
                simpleST = new simpleSoilTemp(MetFile.Latitude, MetFile.Tav, MetFile.Amp, MetFile.MinT, MetFile.MaxT);
                Tsoil    = simpleST.SoilTemperature(Clock.Today, MetFile.MinT, MetFile.MaxT, MetFile.Radn, salb, dlayer, bd, ll15_dep, sw_dep);
            }

            // get the changes of state and publish (let other component to know)
            DeltaState();

            inReset = false;
        }