Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 public void CalculateTotalResidue()
 {
     //TODO: Make the crop residue function more generic -- remove type condition
     if (CurrentCrop != null && CurrentCrop.GetType() == typeof(LAIVegObjectController))
     {
         TotalCropResidue  = 0;
         TotalResidueCover = 0;
         LAIVegObjectController crop = (LAIVegObjectController)CurrentCrop;
         TotalResidueCover = crop.ResidueCover;
         crop.CalculateResidue();
         int count = ChildControllers.Count;
         for (int i = 1; i < count; ++i)
         {
             int index = GetCropIndex(crop) + 1;
             if (index == count)
             {
                 index = 0;
             }
             crop = (LAIVegObjectController)ChildControllers[index];
             TotalResidueCover = Math.Min(1.0, TotalResidueCover + crop.ResidueCover * (1 - TotalResidueCover));
         }
         for (int i = 0; i < count; ++i)
         {
             TotalCropResidue += ((VegObjectController)ChildControllers[i]).ResidueAmount;
         }
     }
     else
     {
         TotalCropResidue  = ((VegObjectController)ChildControllers[0]).CropResidue;
         TotalResidueCover = ((VegObjectController)ChildControllers[0]).ResidueCover;
     }
     TotalResidueCoverPercent = TotalResidueCover * 100.0;
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="current"></param>
 /// <returns></returns>
 public double GetCropCoverIfLAIModel(double current)
 {
     if (CurrentCrop.GetType() == typeof(LAIVegObjectController))
     {
         return(CurrentCrop.crop_cover);
         //LAI Model uses cover from the end of the previous day
         //whereas Cover model predefines at the start of the day
     }
     return(current);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public double GetTotalCover()
 {
     if (CurrentCrop != null)
     {
         if (CurrentCrop.GetType() == typeof(LAIVegObjectController))
         {
             return(Math.Min(1.0, CurrentCrop.crop_cover + sim.total_residue_cover * (1 - CurrentCrop.crop_cover)));
         }
         else
         {
             return(CurrentCrop.GetTotalCover());
         }
     }
     return(0);
 }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public double GetTotalCover()
 {
     if (CurrentCrop != null)
     {
         if (CurrentCrop.GetType() == typeof(LAIVegObjectController))
         {
             return(Math.Min(1.0, CurrentCrop.CropCover + Sim.SoilController.TotalResidueCover * (1 - CurrentCrop.CropCover)));
         }
         else
         {
             return(CurrentCrop.GetTotalCover());
         }
     }
     return(0);
 }
Ejemplo n.º 5
0
 internal double GetCropCoverIfLAIModel(double current)
 {
     try
     {
         if (CurrentCrop != null)
         {
             if (CurrentCrop.GetType() == typeof(HowLeakyEngineModule_LAIVeg))
             {
                 return(CurrentCrop.CropCover);
                 //LAI Model uses cover from the end of the previous day
                 //whereas Cover model predefines at the start of the day
             }
         }
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
     return(current);
 }
Ejemplo n.º 6
0
 internal void CalculateTotalResidue()
 {
     try
     {
         //TODO: Make the crop residue function more generic -- remove type condition
         if (CurrentCrop != null && CurrentCrop.GetType() == typeof(HowLeakyEngineModule_LAIVeg))
         {
             TotalCropResidue  = 0;
             TotalResidueCover = 0;
             HowLeakyEngineModule_LAIVeg crop = (HowLeakyEngineModule_LAIVeg)CurrentCrop;
             TotalResidueCover = crop.ResidueCover;
             crop.CalculateResidue();
             int count = VegetationModules.Count;
             for (int i = 1; i < count; ++i)
             {
                 int index = GetCropIndex(crop) + 1;
                 if (index == count)
                 {
                     index = 0;
                 }
                 crop = (HowLeakyEngineModule_LAIVeg)VegetationModules[index];
                 TotalResidueCover = Math.Min(1.0, TotalResidueCover + crop.ResidueCover * (1 - TotalResidueCover));
             }
             for (int i = 0; i < count; ++i)
             {
                 TotalCropResidue += ((HowLeakyEngineModule_LAIVeg)VegetationModules[i]).ResidueAmount;
             }
         }
         else
         {
             TotalCropResidue  = VegetationModules[0].CropResidue;
             TotalResidueCover = VegetationModules[0].ResidueCover;
         }
         TotalResidueCoverPercent = TotalResidueCover * 100.0;
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
 }
Ejemplo n.º 7
0
 internal double GetTotalCover()
 {
     try
     {
         if (CurrentCrop != null)
         {
             if (CurrentCrop.GetType() == typeof(HowLeakyEngineModule_LAIVeg))
             {
                 return(Math.Min(1.0, CurrentCrop.CropCover + SoilModule.TotalResidueCover * (1 - CurrentCrop.CropCover)));
             }
             else
             {
                 return(CurrentCrop.GetTotalCover());
             }
         }
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
     return(0);
 }
Ejemplo n.º 8
0
 public bool UseLAIModel()
 {
     return(CurrentCrop.GetType() == typeof(HowLeakyEngineModule_LAIVeg));
 }
Ejemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public bool UseLAIModel()
 {
     return(CurrentCrop.GetType() == typeof(LAIVegObjectController)); //FIXME
 }