コード例 #1
0
ファイル: SoilWater.cs プロジェクト: hut104/ApsimX
        /// <summary>
        /// Sets the maximum pond.
        /// </summary>
        /// <param name="NewDepth">The new depth.</param>
        public void SetMaxPond(double NewDepth)
        {
            SoilObject.max_pond = NewDepth;

            //if the user changes max_pond after the OnSimulationCommencing event
            //you may need to change the surface either to or from a ponding surface.
            surface = surfaceFactory.GetSurface(SoilObject, Clock);
        }
コード例 #2
0
ファイル: SoilWater.cs プロジェクト: hut104/ApsimX
        private void OnSimulationCommencing(object sender, EventArgs e)
        {
            SaveModuleConstants();

            //daily inputs
            met = new MetData();
            irrig = new IrrigData();
            canopy = new CanopyData();
            surfaceCover = new SurfaceCoverData();

            //optional daily inputs
            runon = 0.0;
            interception = 0.0;
            residueinterception = 0.0;

            if (Soil.Thickness != null)
                {
                try
                    {
                    SoilObject = new SoilWaterSoil(constants, Soil);  //constructor can throw an Exception
                    surfaceFactory = new SurfaceFactory();
                    surface = surfaceFactory.GetSurface(SoilObject, Clock);  //constructor can throw an Exception (Evap class constructor too)

                //optional inputs (array)
                inflow_lat = null;
                }
                catch (Exception Ex)
                    {
                    throw new ApsimXException(this, Ex.Message);  //catch any constructor Exceptions and rethrow as an ApsimXException.
                    }
                }
            else
                {
                throw new ApsimXException(this, "SoilWater module has detected that the Soil has no layers.");
                }
        }
コード例 #3
0
ファイル: SoilWater.cs プロジェクト: hut104/ApsimX
 /// <summary>
 /// Resets this instance.
 /// </summary>
 public void Reset()
 {
     Summary.WriteMessage(this, "Resetting Soil Water Balance");
     SoilObject.ResetSoil(constants, Soil);          //reset the soil
     surface = surfaceFactory.GetSurface(SoilObject, Clock); //reset the surface
 }