コード例 #1
0
double
LogRuleDownlinkPacketScheduler::ComputeSchedulingMetric (RadioBearer *bearer, double spectralEfficiency, int subChannel)
{
  double metric;

  if ((bearer->GetApplication ()->GetApplicationType () == Application::APPLICATION_TYPE_INFINITE_BUFFER)
	  ||
	  (bearer->GetApplication ()->GetApplicationType () == Application::APPLICATION_TYPE_CBR))
	{
	  metric = (spectralEfficiency * 180000.)
				/
				bearer->GetAverageTransmissionRate();
	}
  else
	{
	   QoSParameters *qos = bearer->GetQoSParameters ();
	   double HOL = bearer->GetHeadOfLinePacketDelay ();
	   double targetDelay = qos->GetMaxDelay ();

	   //COMPUTE METRIC USING EXP RULE:
	   double logTerm = log (1.1 + ( (5 * HOL) / targetDelay ));
	   double weight = (spectralEfficiency * 180000.)
		  		       /
	    	           bearer->GetAverageTransmissionRate();

  	   metric = logTerm * weight;
	}

  return metric;
}
コード例 #2
0
double
MwRulePacketScheduler::ComputeSchedulingMetric (RadioBearer *bearer, double spectralEfficiency, int subChannel)
{
#ifdef SCHEDULER_DEBUG
	std::cout << "\t ComputeSchedulingMetric for flow "
			<< bearer->GetApplication ()->GetApplicationID () << std::endl;
#endif

  double metric;

  if ((bearer->GetApplication ()->GetApplicationType () == Application::APPLICATION_TYPE_INFINITE_BUFFER)
	  ||
	  (bearer->GetApplication ()->GetApplicationType () == Application::APPLICATION_TYPE_CBR))
	{
	  metric = (spectralEfficiency * 180000.)
				/
				bearer->GetAverageTransmissionRate();

#ifdef SCHEDULER_DEBUG
	std::cout << "\t\t non real time flow: metric = " << metric << std::endl;
#endif

	}
  else
	{
	  QoSParameters *qos = bearer->GetQoSParameters ();
	  double HOL = bearer->GetHeadOfLinePacketDelay ();
	  double targetDelay = qos->GetMaxDelay ();

#ifdef SCHEDULER_DEBUG
	  std::cout << "\t\t real time flow: HOL = " << HOL << ", target delay = " << targetDelay;
#endif

	  //compute sum of HOL and average spectral efficiency
//#ifdef SCHEDULER_DEBUG
//	  std::cout << "\n\t\t\t compute sum HOL for all real time flows"<< std::endl;
//#endif

	  double sumHOL = 0;
	  int nbFlows = 0;
	  FlowsToSchedule *flowsToSchedule = GetFlowsToSchedule ();
	  FlowsToSchedule::iterator iter;
	  FlowToSchedule *flow;

	  for (iter = flowsToSchedule->begin (); iter != flowsToSchedule->end (); iter++)
	    {
		  flow = (*iter);
		  if (!flow->GetBearer ()->HasPackets ())
		    {}
		  else
			{
			  if ((flow->GetBearer ()->GetApplication ()->GetApplicationType ()
					  != Application::APPLICATION_TYPE_INFINITE_BUFFER)
			   		  &&
			          (flow->GetBearer ()->GetApplication ()->GetApplicationType ()
			        		  != Application::APPLICATION_TYPE_CBR))
			    {
			      sumHOL += flow->GetBearer ()->GetHeadOfLinePacketDelay ();
			      nbFlows++;

//#ifdef SCHEDULER_DEBUG
//	              std::cout << "\t\t\t --> HOL for flow " << flow->GetBearer ()->GetApplication ()->GetApplicationID ()
//	            		  << " = " << flow->GetBearer ()->GetHeadOfLinePacketDelay ()<< std::endl;
//#endif
			    }
			  else
			    {
//#ifdef SCHEDULER_DEBUG
//	              std::cout << "\t\t\t --> non real time flow, go on! " << std::endl;
//#endif
			    }
			}
	    }


	  //COMPUTE METRIC USING EXP RULE:
	  double numerator = (6/targetDelay) * HOL;
	  double denominator = (1 + sqrt (sumHOL/nbFlows));
	  double weight = (spectralEfficiency * 180000.)
				      /
	    	          bearer->GetAverageTransmissionRate();

	  metric = (exp (numerator / denominator)) * weight;

#ifdef SCHEDULER_DEBUG
	  std::cout << " --> metric = " << metric << std::endl;
#endif
	}

  return metric;
}