Example #1
0
 internal int GetCropIndex(_CustomHowLeakyEngine_VegModule module)
 {
     try
     {
         return(VegetationModules.IndexOf(module));
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
     //return 0;
 }
Example #2
0
 public void CheckApplicationBasedOnDAS(_CustomHowLeakyEngine_VegModule crop)
 {
     try
     {
         if (ApplicationIndex == 0 && crop.DaysSincePlanting >= InputModel.TriggerDaysFirst)
         {
             ProductRateApplied = InputModel.ProductRate;
             ++ApplicationIndex;
         }
         else if (ApplicationIndex > 0 && crop.DaysSincePlanting >= InputModel.TriggerDaysFirst + InputModel.TriggerDaysSubsequent * ApplicationIndex)
         {
             ProductRateApplied = InputModel.SubsequentProductRate;
             ++ApplicationIndex;
         }
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
 }
Example #3
0
 public bool CanPlantCrop(_CustomHowLeakyEngine_VegModule crop)
 {
     // Here are a few notes to try and get your head around the logic here.
     // First of all check to see if we leave left sufficient gap between this new
     // rotation and the previous rotation of this crop.
     // Case 1:
     // First test to see if this is the CurrentCrop.
     // If so, then make sure that we HAVENT exceeded max rotation count. Then we must
     // see if actually meet the planting criteria. If any of these fail, then return
     // "false" so that we can test another crop. Otherwise return "true" to tell the
     // sim to replant the CurrentCrop
     // Case 2:
     // If this is NOT the CurrentCrop - we had better first check that the CurrentCrop
     // is still expected to be in rotation. Then check to see that the sowing criteria
     // has been met. Return "true" if all good, otherwise return "false" so we can test
     // another crop. If we run out of crops, then the CurrentCrop stays in fallow.
     try
     {
         if (crop.IsSequenceCorrect() && crop.DoesCropMeetSowingCriteria())
         {
             if (crop == CurrentCrop)
             {
                 return(crop.IsCropUnderMaxContinuousRotations());
             }
             else if (CurrentCrop.HasCropHadSufficientContinuousRotations())
             {
                 return(crop.HasCropBeenAbsentForSufficientYears(TodaysDate));
             }
         }
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
     return(false);
 }