Пример #1
0
        private void JudegeScheduleCategory(TDSimUser user, TDSimCell tdCell, ref bool isCanSchedule, ref bool TsSchedule, BearerAndResouceRatio bestBearerContainer)
        {
            if (tdCell.HSDPARemainTSNum  > 0)
            {
                isCanSchedule = true;
                TsSchedule = true;


                user.BearerAndResouceRatio.TsNum = Math.Min(bestBearerContainer.TsNum, tdCell.HSDPATsNum);
            }
            if ((tdCell.HSDPARemainTSNum == 0) && (m_IsCDMAon == true))
            {
                isCanSchedule = true;
                TsSchedule = false;

                user.BearerAndResouceRatio.CodeNum = Math.Min(bestBearerContainer.CodeNum, tdCell.HSDPACodeNum);
            }
            else
            { }
        }
Пример #2
0
        /// <summary>
        /// 为所有候选承载分配码字数和功率
        /// </summary>
        /// <param name="tdCell"></param>
        /// <param name="user"></param>
        /// <param name="bearerToUse"></param>
        /// <param name="ts"></param>
        private BearerAndResouceRatio GetBestBearerAndAssignResource(TDSimCell tdCell, TDSimUser user,
            List<BearerAndResouceRatio> bearerToUse)
        {
            BearerAndResouceRatio bestBearerContainer = new BearerAndResouceRatio();
            double standardResouceRatio = BearerAndResouceRatio.CalculateResouceRatio(tdCell .HSDPAAssignedPower ,
               tdCell .HSDPACodeNum );
            double detector = double.MaxValue;
           
            foreach (BearerAndResouceRatio bearerContainer in bearerToUse)
            {
                int needNum = 0;
                int TotalCodeNum = tdCell.HSDPARemainTSNum * ConstantParam.RUNumInOneTimeslot;
                if (user.IsFirstServed)
                {
                    needNum = (int)Math.Ceiling(user.HSDPAArgDataSpeed / bearerContainer.Bearer.RTBS);
                }
                else
                {
                    double Data = Math.Min(user.HSDPAMaxDataSpeed, user.ApplicationDataSpeed);


                    needNum = (int)Math.Ceiling(Data / bearerContainer.Bearer.RTBS);
                }
              
                    
                needNum = Math.Min(needNum, TotalCodeNum);




                //if (needNum <= tdCell .HSDPACodeNum )
                //{
                //    if (needNum * (bearerContainer.Bearer.RTBS) < user.HSDPAMinDataSpeed)
                //    {
                //        //其实这里应该是调度失败的原因,而不是接入失败的原因

                //        user.HSDPAAccessErrorType = FailReason.HSDPANotFit;
                //        continue;
                //    }
                //    bearerContainer.CodeNum = needNum;
                //}
                //else
                //{
                //    if ((tdCell .HSDPACodeNum ) * (bearerContainer.Bearer.RTBS) < user.HSDPAMinDataSpeed)
                //    {
                //        //其实这里应该是调度失败的原因,而不是接入失败的原因
                //        user.HSDPAAccessErrorType = FailReason.HSDPANotFit;
                //        continue;
                //    }
                //    bearerContainer.CodeNum = tdCell .HSDPACodeNum ;

                bearerContainer.CodeNum = needNum;
                bearerContainer.TsNum = (int)Math .Ceiling ((double ) needNum /(double  ) ConstantParam.RUNumInOneTimeslot);
                

                //float HSDPAPower = (float)UnitTrans.mwTodBm(UnitTrans.dBmTomw(tdCell .HSDPAAssignedPower ) * tdCell.NeCell.DlTargetLoad);
                float CodePower = (float)UnitTrans.mwTodBm(UnitTrans.dBmTomw(tdCell .HSDPAPower ) / 16);
                bearerContainer.PowerAssign = (float)UnitTrans.mwTodBm(UnitTrans.dBmTomw(CodePower) * bearerContainer.CodeNum);
                bearerContainer.ResouceRatio =
                  BearerAndResouceRatio.CalculateResouceRatio(bearerContainer.PowerAssign, bearerContainer.CodeNum);

                if (bearerContainer.CodeNum <= 0)
                {
                    continue;
                }
                double distance = Math.Abs(standardResouceRatio - bearerContainer.ResouceRatio);
                if (detector > distance)
                {
                    detector = distance;
                    bestBearerContainer = bearerContainer;
                }
            }
            return bestBearerContainer;
        }
Пример #3
0
 /// <summary>
 /// 包装已经选出来的承载列表
 /// </summary>
 /// <param name="targetList">包装了已经选出来的承载列表</param>
 /// <param name="bearerList">已经选出来的承载列表</param>
 private void InitialBearerAndResouceRatioList(ref List<BearerAndResouceRatio> targetList, List<TDHSDPABearer> bearerList)
 {
     foreach (TDHSDPABearer bearer in bearerList)
     {
         BearerAndResouceRatio temp = new BearerAndResouceRatio();
         temp.Bearer = bearer;
         targetList.Add(temp);
     }
 }
Пример #4
0
        /// <summary>
        /// 为该用户找到最合适的承载,并对该用户进行调度
        /// </summary>
        /// <param name="tdCell"></param>
        /// <param name="user"></param>
        /// <param name="slotListSortByCodeResource"></param>
        private void FindBestBearAndSchedule(TDSimCell tdCell, TDSimUser user)
        {
            BearerAndResouceRatio bestBearerContainer = new BearerAndResouceRatio();

            List<BearerAndResouceRatio> bearerToUse = new List<BearerAndResouceRatio>();
            List<TimeSlot> scheduledTS = new List<TimeSlot>();

            bool isNotSchedule = true;
                if (!user.IsHSDPARetransmited)
                {

                   #region 确定用户考察的承载列表(包含功率受限等效)

                    bool isFindBear = CalcBearerList(user, ref bearerToUse, tdCell );
                    if (isFindBear == false)
                    {
                        user.FailReason = FailReason.HSDPAFailToFindBearerOut;
                    }
                    #endregion

                    // 为所有候选承载分配码字数和功率
                   bestBearerContainer = GetBestBearerAndAssignResource(tdCell, user, bearerToUse);


                   if (bestBearerContainer.Bearer == null)
                   {
                       //如果找到的承载为空,则continue,
                       //不让没找到承载的用户进入到调度阶段
                       user.FailReason = FailReason.HSDPAFailToFindBearerOut;
                   }
                   else
                   {
                       user.BearerAndResouceRatio = bestBearerContainer;
                   }

                
             

                isNotSchedule = false;
              bool   isCanSchedule = false;
              bool TsSchedule = false; 
                //重传用户
                //bestBearerContainer = BestBearerForRetransmitedUser(user, bestBearerContainer);
                //if (bestBearerContainer.Bearer == null)
                //{
                //    int i = 0;
                //}
              JudegeScheduleCategory(user, tdCell, ref isCanSchedule, ref TsSchedule, user.BearerAndResouceRatio);
                #region 根据找到的承载进行调度
                //码字没有受限
                if (isCanSchedule == false)
                {
                    user.FailReason = FailReason.HSDPAResourceRestrict;
                }
                else
                {
                    if (TsSchedule == true)
                    {
                        ScheduleInTsCategory(user, tdCell);

                    }
                    else
                    {
                        ScheduleInCodeCategory(user, tdCell);
                    }
                }

                #endregion

            }
            if (isNotSchedule)
            {
                user.FailReason = FailReason.HSDPAUnsurpported;
            }


        }