/// <summary> /// Return the removal /// </summary> /// <param name="forage"></param> /// <param name="sUnit"></param> /// <returns></returns> public GrazType.TGrazingOutputs ReturnRemoval(TForageInfo forage, string sUnit) { double fArea; double fScale; int iClass; int iSpecies; int iRipe; GrazType.TGrazingOutputs Result = new GrazType.TGrazingOutputs(); if (forage != null) { Result = forage.RemovalKG; fArea = forage.InPaddock.fArea; } else { Result = new GrazType.TGrazingOutputs(); fArea = 0.0; } if (fArea > 0.0) { if (sUnit == "kg") fScale = 1.0; else if (sUnit == "g/m^2") fScale = 0.10 / fArea; else if (sUnit == "kg/ha") fScale = 1.0 / fArea; else throw new Exception("Stock: Unit (" + sUnit + ") not recognised"); if (fScale != 1.0) { for (iClass = 1; iClass <= GrazType.DigClassNo; iClass++) Result.Herbage[iClass] = fScale * Result.Herbage[iClass]; for (iSpecies = 1; iSpecies <= GrazType.MaxPlantSpp; iSpecies++) for (iRipe = GrazType.UNRIPE; iRipe <= GrazType.RIPE; iRipe++) Result.Seed[iSpecies, iRipe] = fScale * Result.Seed[iSpecies, iRipe]; } } return Result; }
/// <summary> /// Create a stock container /// </summary> public TStockContainer() { for (int i = 0; i < 2; i++) pastIntakeRate[i] = new GrazType.TGrazingOutputs(); }