Пример #1
0
    public override void DoWaterUptake(double Amount)
    {
        // Send the delta water back to SoilWat that we're going to uptake.
        WaterChangedType WaterUptake = new WaterChangedType();

        WaterUptake.DeltaWater = new double[SWSupply.Length];
        double Supply       = MathUtility.Sum(SWSupply);
        double FractionUsed = 1;

        if (Supply > 0)
        {
            FractionUsed = Amount / Supply;
        }

        for (int layer = 0; layer <= SWSupply.Length - 1; layer++)
        {
            WaterUptake.DeltaWater[layer] = -SWSupply[layer] * FractionUsed;
        }

        Uptake = WaterUptake.DeltaWater;
        if (WaterChanged != null)
        {
            WaterChanged.Invoke(WaterUptake);
        }
    }
Пример #2
0
        /// <summary>Does the water uptake.</summary>
        /// <param name="Amount">The amount.</param>
        public override void DoWaterUptake(double[] Amount)
        {
            // Send the delta water back to SoilWat that we're going to uptake.
            WaterChangedType WaterUptake = new WaterChangedType();

            WaterUptake.DeltaWater = MathUtilities.Multiply_Value(Amount, -1.0);

            Uptake = WaterUptake.DeltaWater;
            if (WaterChanged != null)
            {
                WaterChanged.Invoke(WaterUptake);
            }
        }
Пример #3
0
 private void Update()
 {
     if (GetCanUseRoom)
     {
         if (_time <= 0)
         {
             _waterCount += 2;
             _time        = _period;
             WaterChanged?.Invoke(_waterCount);
         }
         else
         {
             _time -= Time.deltaTime;
         }
     }
 }
Пример #4
0
    /// <summary>
    /// Update the water and N balance.
    /// </summary>
    private void UpdateWaterAndNBalance()
    {
        NitrogenChangedType NitrogenUptake = new NitrogenChangedType();

        NitrogenUptake.Sender     = "Plant";
        NitrogenUptake.SenderType = "Plant";
        NitrogenUptake.DeltaNO3   = MathUtility.Multiply_Value(dlt_no3gsm, Conversions.gm2kg / Conversions.sm2ha);
        NitrogenUptake.DeltaNH4   = MathUtility.Multiply_Value(dlt_nh4gsm, Conversions.gm2kg / Conversions.sm2ha);
        Util.Debug("Root.NitrogenUptake.DeltaNO3=%f", MathUtility.Sum(NitrogenUptake.DeltaNO3));
        Util.Debug("Root.NitrogenUptake.DeltaNH4=%f", MathUtility.Sum(NitrogenUptake.DeltaNH4));
        NitrogenChanged.Invoke(NitrogenUptake);

        // Send back delta water and nitrogen back to APSIM.
        if (!SwimIsPresent)
        {
            WaterChangedType WaterUptake = new WaterChangedType();
            WaterUptake.DeltaWater = dlt_sw_dep;
            Util.Debug("Root.WaterUptake=%f", MathUtility.Sum(WaterUptake.DeltaWater));
            WaterChanged.Invoke(WaterUptake);
        }
    }
Пример #5
0
 public void Drink(float countDrinkingWater)
 {
     _waterCount -= countDrinkingWater;
     WaterChanged?.Invoke(_waterCount);
 }
Пример #6
0
 private void Start()
 {
     WaterChanged?.Invoke(_waterCount);
 }