コード例 #1
0
ファイル: stock_intf.cs プロジェクト: hol353/ApsimX
        /// <summary>
        /// Draft the animals to the paddocks selected in the initialisation OR
        /// draft them to any paddock.
        /// </summary>
        /// <param name="curEnt"></param>
        /// <param name="area"></param>
        protected void DraftToOpenPaddocks(TEnterpriseInfo curEnt, double area)
        {
            int p;
            List<string> exclPaddocks;

            exclPaddocks = new List<string>();
            for (p = 1; p <= Paddocks.Count() - 1; p++)
            {
                if (!curEnt.getStockedPad(p))  //if paddock not stocked then
                    exclPaddocks.Add(Paddocks.byIndex(p).sName);
            }
            //if no paddocks selected to be stocked then just draft anywhere
            if ((area > 0) && ((Paddocks.Count() - 1) == exclPaddocks.Count()))
                exclPaddocks.Clear();
            Draft(exclPaddocks);                   //moves animals in stocked paddocks by animal priority
        }
コード例 #2
0
ファイル: stock_intf.cs プロジェクト: hol353/ApsimX
        /// <summary>
        /// Calculate the area that is permitted to be stocked for the given enterprise.
        /// </summary>
        /// <param name="curEnt"></param>
        /// <returns></returns>
        protected double calcStockArea(TEnterpriseInfo curEnt)
        {
            int Idx;
            TPaddockInfo PaddInfo;

            double result = 0;
            for (Idx = 0; Idx <= Paddocks.Count() - 1; Idx++)
            {
                PaddInfo = Paddocks.byIndex(Idx);
                if ((Idx < curEnt.StockedPaddocks) && (PaddInfo.iPaddID >= 0) && (curEnt.getStockedPad(Idx)))
                    result = result + PaddInfo.fArea;
            }
            //if no area from chosen paddocks then assume it was given as a composite value
            if (result == 0)
                result = curEnt.GrazedArea;
            return result;
        }