/// <summary>Constructor</summary> /// <param name="Plant">The parant plant</param> /// <param name="Root">The parent root organ</param> /// <param name="soil">The soil in the zone.</param> /// <param name="depth">Root depth (mm)</param> /// <param name="initialDM">Initial dry matter</param> /// <param name="population">plant population</param> /// <param name="maxNConc">maximum n concentration</param> /// <param name="rfv">Root front velocity</param> /// <param name="mrd">Maximum root depth</param> /// <param name="remobCost">Remobilisation cost</param> public ZoneState(Plant Plant, Root Root, Soil soil, double depth, BiomassDemand initialDM, double population, double maxNConc, IFunction rfv, IFunction mrd, IFunction remobCost) { this.Soil = soil; this.plant = Plant; this.root = Root; this.rootFrontVelocity = rfv; this.maximumRootDepth = mrd; this.remobilisationCost = remobCost; Physical = soil.FindChild <IPhysical>(); WaterBalance = soil.FindChild <ISoilWater>(); IsWeirdoPresent = soil.FindChild("Weirdo") != null; Clear(); Zone zone = soil.FindAncestor <Zone>(); if (zone == null) { throw new Exception("Soil " + soil + " is not in a zone."); } NO3 = zone.FindInScope <ISolute>("NO3"); NH4 = zone.FindInScope <ISolute>("NH4"); Name = zone.Name; Initialise(depth, initialDM, population, maxNConc); }
/// <summary>Initialise the zone.</summary> /// <param name="depth">Root depth (mm)</param> /// <param name="initialDM">Initial dry matter</param> /// <param name="population">plant population</param> /// <param name="maxNConc">maximum n concentration</param> public void Initialise(double depth, BiomassDemand initialDM, double population, double maxNConc) { Depth = depth; RootFront = depth; //distribute root biomass evenly through root depth double[] fromLayer = new double[1] { depth }; double[] fromStructural = new double[1] { initialDM.Structural.Value() }; double[] toStructural = Layers.MapMass(fromStructural, fromLayer, Physical.Thickness); double[] fromMetabolic = new double[1] { initialDM.Metabolic.Value() }; double[] toMetabolic = Layers.MapMass(fromMetabolic, fromLayer, Physical.Thickness); double[] fromStorage = new double[1] { initialDM.Storage.Value() }; double[] toStorage = Layers.MapMass(fromStorage, fromLayer, Physical.Thickness); for (int layer = 0; layer < Physical.Thickness.Length; layer++) { LayerLive[layer].StructuralWt = toStructural[layer] * population; LayerLive[layer].MetabolicWt = toMetabolic[layer] * population; LayerLive[layer].StorageWt = toStorage[layer] * population; LayerLive[layer].StructuralN = LayerLive[layer].StructuralWt * maxNConc; LLModifier[layer] = 1; } if (plant.SowingData != null) { if (plant.SowingData.SkipType == 0) { LeftDist = plant.SowingData.RowSpacing * 0.5; RightDist = plant.SowingData.RowSpacing * 0.5; } if (plant.SowingData.SkipType == 1) { LeftDist = plant.SowingData.RowSpacing * 1.0; RightDist = plant.SowingData.RowSpacing * 1.0; } if (plant.SowingData.SkipType == 2) { LeftDist = plant.SowingData.RowSpacing * 1.0; RightDist = plant.SowingData.RowSpacing * 0.5; } if (plant.SowingData.SkipType == 3) { LeftDist = plant.SowingData.RowSpacing * 1.5; RightDist = plant.SowingData.RowSpacing * 0.5; } } root.RootShape.CalcRootProportionInLayers(this); }
/// <summary>Constructor</summary> /// <param name="Plant">The parant plant</param> /// <param name="Root">The parent root organ</param> /// <param name="soil">The soil in the zone.</param> /// <param name="depth">Root depth (mm)</param> /// <param name="initialDM">Initial dry matter</param> /// <param name="population">plant population</param> /// <param name="maxNConc">maximum n concentration</param> /// <param name="rfv">Root front velocity</param> /// <param name="mrd">Maximum root depth</param> /// <param name="remobCost">Remobilisation cost</param> public ZoneState(Plant Plant, Root Root, Soil soil, double depth, BiomassDemand initialDM, double population, double maxNConc, IFunction rfv, IFunction mrd, IFunction remobCost) { this.soil = soil; this.plant = Plant; this.root = Root; this.rootFrontVelocity = rfv; this.maximumRootDepth = mrd; this.remobilisationCost = remobCost; Clear(); Zone zone = Apsim.Parent(soil, typeof(Zone)) as Zone; if (zone == null) { throw new Exception("Soil " + soil + " is not in a zone."); } NO3 = Apsim.Find(zone, "NO3") as ISolute; NH4 = Apsim.Find(zone, "NH4") as ISolute; Name = zone.Name; Initialise(depth, initialDM, population, maxNConc); }