double
FemtoCellUrbanAreaChannelRealization::GetPathLoss (void)
{
	/*
	 * Path loss Models from sect. 5.2 in
	 * 3GPP TSG RAN WG4 R4-092042
	 *
	 * Alternative simplified model based on LTE-A evaluation methodology which avoids modeling any walls.
	 */

  double distance;
  double minimumCouplingLoss = 45; //[dB] - see 3GPP TSG RAN WG4 #42bis (R4-070456)
  double floorPenetration = 0.0;
  //18.3 n ((n+2)/(n+1)-0.46)

  if (GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_UE
		  && ( GetDestinationNode ()->GetNodeType () == NetworkNode::TYPE_ENODEB || GetDestinationNode ()->GetNodeType () == NetworkNode::TYPE_HOME_BASE_STATION) )
    {
	  UserEquipment* ue = (UserEquipment*) GetSourceNode ();
	  ENodeB* enb = (ENodeB*) GetDestinationNode ();

	  if( enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() > 0
			  && ue->IsIndoor()
			     && enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() != ue->GetCell()->GetCellCenterPosition()->GetCoordinateZ())
	  {
		  int n = (int) abs( enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() - ue->GetCell()->GetCellCenterPosition()->GetCoordinateZ() );
		  floorPenetration = 18.3 * pow( n, ((n+2)/(n+1)-0.46));
	  }

	  distance =  ue->GetMobilityModel ()->GetAbsolutePosition ()->GetDistance (enb->GetMobilityModel ()->GetAbsolutePosition ());
    }

  else if (GetDestinationNode ()->GetNodeType () == NetworkNode::TYPE_UE
		  && ( GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_ENODEB || GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_HOME_BASE_STATION) )
  {
	  UserEquipment* ue = (UserEquipment*) GetDestinationNode ();
	  ENodeB* enb = (ENodeB*) GetSourceNode ();

	  if( enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() > 0
			  && ue->IsIndoor()
			  && enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() != ue->GetCell()->GetCellCenterPosition()->GetCoordinateZ())
	  {
		  int n = (int) abs( enb->GetCell()->GetCellCenterPosition()->GetCoordinateZ() - ue->GetCell()->GetCellCenterPosition()->GetCoordinateZ() );
		  floorPenetration = 18.3 * pow( n, ((n+2)/(n+1)-0.46));
	  }

	  distance =  ue->GetMobilityModel ()->GetAbsolutePosition ()->GetDistance (enb->GetMobilityModel ()->GetAbsolutePosition ());
  }




  m_pathLoss = max( minimumCouplingLoss, 127 + ( 30 * log10 (distance * 0.001) ) + floorPenetration);


  return m_pathLoss;
}
double
MacroCellUrbanAreaChannelRealization::GetPathLoss (void)
{
  /*
   * According to  ---  insert standard 3gpp ---
   * the Path Loss Model For Urban Environment is
   * L = I + 37.6log10(R)
   * R, in kilometers, is the distance between two nodes
   * I = 128.1 at 2GHz
   */
  double distance;
  double externalWallAttenuation = 20; //[dB]

  NetworkNode* src = GetSourceNode ();
  NetworkNode* dst = GetDestinationNode ();

  distance = src->GetMobilityModel ()->GetAbsolutePosition ()->GetDistance (
		  dst->GetMobilityModel ()->GetAbsolutePosition ());

  /*
  if (GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_UE
		  && GetDestinationNode ()->GetNodeType () == NetworkNode::TYPE_ENODEB)
    {
	  UserEquipment* ue = (UserEquipment*) GetSourceNode ();
	  ENodeB* enb = (ENodeB*) GetDestinationNode ();

	  distance =  ue->GetMobilityModel ()->GetAbsolutePosition ()->GetDistance (enb->GetMobilityModel ()->GetAbsolutePosition ());
    }

  else if (GetDestinationNode ()->GetNodeType () == NetworkNode::TYPE_UE
		  && GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_ENODEB)
    {
	  UserEquipment* ue = (UserEquipment*) GetDestinationNode ();
	  ENodeB* enb = (ENodeB*) GetSourceNode ();

	  distance =  ue->GetMobilityModel ()->GetAbsolutePosition ()->GetDistance (enb->GetMobilityModel ()->GetAbsolutePosition ());
    }
  */

  m_pathLoss = 128.1 + (37.6 * log10 (distance * 0.001));

  UserEquipment* ue;
  if (GetSourceNode ()->GetNodeType () == NetworkNode::TYPE_UE)
    {
	  ue = (UserEquipment*) GetSourceNode ();
    }
  else
   {
	  ue = (UserEquipment*) GetDestinationNode ();
   }

  if ( ue->IsIndoor() )
  {
	  m_pathLoss = m_pathLoss + externalWallAttenuation;
  }


  return m_pathLoss;
}
예제 #3
0
Packet*
RadioBearer::CreatePacket (int bytes)
{
  Packet *p = new Packet ();

  p->SetID(Simulator::Init()->GetUID ());
  p->SetTimeStamp(Simulator::Init()->Now ());

  UDPHeader *udp = new UDPHeader (GetClassifierParameters ()->GetSourcePort(),
		                          GetClassifierParameters ()->GetDestinationPort ());
  p->AddUDPHeader(udp);

  IPHeader *ip = new IPHeader (GetClassifierParameters ()->GetSourceID (),
                               GetClassifierParameters ()->GetDestinationID());
  p->AddIPHeader(ip);

  PDCPHeader *pdcp = new PDCPHeader ();
  p->AddPDCPHeader (pdcp);

  RLCHeader *rlc = new RLCHeader ();
  p->AddRLCHeader(rlc);

  PacketTAGs *tags = new PacketTAGs ();
  tags->SetApplicationType(PacketTAGs::APPLICATION_TYPE_INFINITE_BUFFER);
  p->SetPacketTags(tags);

  if (_APP_TRACING_)
    {
	  /*
	   * Trace format:
	   *
	   * TX   APPLICATION_TYPE   BEARER_ID  SIZE   SRC_ID   DST_ID   TIME
	   */
	  UserEquipment* ue = (UserEquipment*) GetApplication ()->GetDestination ();
	   std::cout << "TX";
	   switch (p->GetPacketTags ()->GetApplicationType ())
	     {
	       case Application::APPLICATION_TYPE_VOIP:
	         {
	     	  std::cout << " VOIP";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_TRACE_BASED:
	         {
	           std::cout << " VIDEO";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_CBR:
	         {
	     	  std::cout << " CBR";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_INFINITE_BUFFER:
	         {
	     	  std::cout << " INF_BUF";
	     	  break;
	         }
	       default:
	         {
	     	  std::cout << " UNDEFINED";
	     	  break;
	         }
	     }

	   if (bytes > 1490) bytes = 1490;
	   else bytes = bytes - 13;

       std::cout << " ID " << p->GetID ()
	 		    << " B " << GetRlcEntity ()->GetRlcEntityIndex ()
	 			<< " SIZE " << bytes
	 			<< " SRC " << GetSource ()->GetIDNetworkNode ()
	 			<< " DST " << GetDestination ()->GetIDNetworkNode ()
	 			<< " T " << Simulator::Init()->Now()
	 			<< " " << ue->IsIndoor () << std::endl;
    }

  return p;
}