Beispiel #1
0
        /// <summary>Find our children.</summary>
        public void FindChildren()
        {
            waterNode = Apsim.Child(this, typeof(Physical)) as Physical;

            Weirdo    = Apsim.Child(this, typeof(WEIRDO)) as WEIRDO;
            SoilWater = Apsim.Child(this, typeof(ISoilWater)) as ISoilWater;
            if (Weirdo == null && SoilWater == null)
            {
                throw new Exception($"{Name}: Unable to find SoilWater or WEIRDO child model");
            }
            if (Weirdo == null && waterNode == null)
            {
                throw new Exception($"{Name}: Unable to find Physical or WEIRDO child model");
            }

            SoilOrganicMatter = Apsim.Child(this, typeof(Organic)) as Organic;
            if (SoilOrganicMatter == null)
            {
                throw new Exception($"{Name}: Unable to find Organic child model");
            }

            temperatureModel = Apsim.Child(this, typeof(ISoilTemperature)) as ISoilTemperature;
            if (temperatureModel == null)
            {
                throw new Exception($"{Name}: Unable to find soil temperature child model");
            }

            Initial   = Children.Find(child => child is Sample) as Sample;
            structure = Apsim.Child(this, typeof(LayerStructure)) as LayerStructure;
        }
Beispiel #2
0
        /// <summary>Find our children.</summary>
        public void FindChildren()
        {
            waterNode = this.FindChild <Physical>();

            Weirdo    = this.FindChild <WEIRDO>();
            SoilWater = this.FindInScope <ISoilWater>();
            if (Weirdo == null && SoilWater == null)
            {
                throw new Exception($"{Name}: Unable to find SoilWater or WEIRDO child model");
            }
            if (Weirdo == null && waterNode == null)
            {
                throw new Exception($"{Name}: Unable to find Physical or WEIRDO child model");
            }

            SoilOrganicMatter = this.FindChild <Organic>();
            if (SoilOrganicMatter == null)
            {
                throw new Exception($"{Name}: Unable to find Organic child model");
            }

            temperatureModel = this.FindChild <ISoilTemperature>();
            if (temperatureModel == null)
            {
                throw new Exception($"{Name}: Unable to find soil temperature child model");
            }

            Initial   = Children.Find(child => child is Sample) as Sample;
            structure = this.FindChild <LayerStructure>();
        }
Beispiel #3
0
 /// <summary>Find our children.</summary>
 private void FindChildren()
 {
     waterNode         = Apsim.Child(this, typeof(Physical)) as Physical;
     Weirdo            = Apsim.Child(this, typeof(WEIRDO)) as WEIRDO;
     structure         = Apsim.Child(this, typeof(LayerStructure)) as LayerStructure;
     SoilWater         = Apsim.Child(this, typeof(ISoilWater)) as ISoilWater;
     SoilOrganicMatter = Apsim.Child(this, typeof(Organic)) as Organic;
     temperatureModel  = Apsim.Child(this, typeof(ISoilTemperature)) as ISoilTemperature;
     Initial           = Children.Find(child => child is Sample) as Sample;
 }