コード例 #1
0
UserEquipment*
NetworkManager::GetUserEquipmentByID (int idUE)
{
  std::vector<UserEquipment*>* userEquipmentContainer = GetUserEquipmentContainer ();
  std::vector<UserEquipment*>::iterator iter3;
  UserEquipment *userEquipment;
  for (iter3 = userEquipmentContainer->begin ();
      iter3 !=userEquipmentContainer->end (); iter3++)
    {
    userEquipment = *iter3;
    if (userEquipment->GetIDNetworkNode() == idUE)
      {
      return userEquipment;
      }
    }
  return false;
}
コード例 #2
0
NetworkNode*
NetworkManager::GetNetworkNodeByID (int id)
{
  std::vector<ENodeB*>* eNodeBContainer = GetENodeBContainer ();
  std::vector<ENodeB*>::iterator iter2;
  ENodeB *eNodeB;
  for (iter2 = eNodeBContainer->begin ();
      iter2 !=eNodeBContainer->end (); iter2++)
    {
    eNodeB = *iter2;
    if (eNodeB->GetIDNetworkNode() == id)
      {
      return eNodeB;
      }
    }

  std::vector<UserEquipment*>* userEquipmentContainer = GetUserEquipmentContainer ();
  std::vector<UserEquipment*>::iterator iter3;
  UserEquipment *userEquipment;
  for (iter3 = userEquipmentContainer->begin ();
      iter3 !=userEquipmentContainer->end (); iter3++)
    {
    userEquipment = *iter3;
    if (userEquipment->GetIDNetworkNode() == id)
      {
      return userEquipment;
      }
    }

  std::vector<Gateway*>* gatewayContainer = GetGatewayContainer ();
  std::vector<Gateway*>::iterator iter;
  Gateway *gateway;

  for (iter = gatewayContainer->begin ();
      iter !=gatewayContainer->end (); iter++)
    {
    gateway = *iter;
    if (gateway->GetIDNetworkNode() == id)
      {
      return gateway;
      }
    }
  return false;
}
コード例 #3
0
ファイル: Application.cpp プロジェクト: superhawk236/Lte
void
Application::Start ()
{
#ifdef TEST_START_APPLICATION
  std::cout << "Start Application: src: " << GetSource ()->GetIDNetworkNode ()
		  << " dst: " << GetDestination ()->GetIDNetworkNode () << std::endl;
#endif

  // 1 - create radio bearer
  m_radioBearer = new RadioBearer ();
  //std::cout<<"RB"<<std::endl;//memorytest
  m_radioBearer->GetRlcEntity ()->SetRlcEntityIndex (GetApplicationID ());


  if (GetSource ()->GetNodeType() == NetworkNode::TYPE_UE)
    {
	  //create an UL radio bearer between UE and targetENB
	  UserEquipment* ue = (UserEquipment*) GetSource ();
	  ue->SetNodeState (NetworkNode::STATE_ACTIVE);

#ifdef TEST_START_APPLICATION
      std::cout << "Create UL radio bearer bewtween: " << GetSource ()->GetIDNetworkNode ()
		  << " and " << ue->GetTargetNode ()->GetIDNetworkNode () << std::endl;
#endif

	  m_radioBearer->SetSource (ue);
	  m_radioBearer->SetDestination (ue->GetTargetNode ());
	  m_radioBearer->SetClassifierParameters (GetClassifierParameters ());
	  m_radioBearer->SetApplication (this);
	  m_radioBearer->SetQoSParameters (GetQoSParameters ());
    }
  else if (GetSource ()->GetNodeType() == NetworkNode::TYPE_GW
		  ||
		  GetSource ()->GetNodeType() == NetworkNode::TYPE_ENODEB
		  ||
		  GetSource ()->GetNodeType() == NetworkNode::TYPE_HOME_BASE_STATION)
    {
	  //create an DL radio bearer between targetENB and UE
	  UserEquipment* ue = (UserEquipment*) GetDestination ();
	  ue->SetNodeState (NetworkNode::STATE_ACTIVE);

#ifdef TEST_START_APPLICATION
      std::cout << "Create DL radio bearer bewtween: " << ue->GetTargetNode ()->GetIDNetworkNode ()
    		  << " and " << ue->GetIDNetworkNode ()  << std::endl;
#endif

	  m_radioBearer->SetSource (ue->GetTargetNode ());
	  m_radioBearer->SetDestination (ue);
	  m_radioBearer->SetClassifierParameters (GetClassifierParameters ());
	  m_radioBearer->SetApplication (this);
	  m_radioBearer->SetQoSParameters (GetQoSParameters ());
    }

  m_radioBearer->GetSource ()->GetProtocolStack ()->GetRrcEntity ()->AddRadioBearer (m_radioBearer);


  // 2 - create application sink
  m_applicationSink = new ApplicationSink ();
  //std::cout<<"AS"<<std::endl;//memorytest
  m_applicationSink->SetClassifierParameters (GetClassifierParameters ());
  m_applicationSink->SetSourceApplication (this);


  // 3 - create radio bearer sink
  m_bearerSink = new RadioBearerSink ();
  //std::cout<<"RBS"<<std::endl;//memorytest
  m_bearerSink->GetRlcEntity ()->SetRlcEntityIndex (GetApplicationID ());
  m_bearerSink->SetApplication (m_applicationSink);
  m_bearerSink->SetClassifierParameters (GetClassifierParameters ());
  m_bearerSink->SetQoSParameters (GetQoSParameters ());
  if (GetSource ()->GetNodeType() == NetworkNode::TYPE_UE)
    {
	  UserEquipment* ue = (UserEquipment*) GetSource ();
	  ue->SetNodeState (NetworkNode::STATE_ACTIVE);
	  m_bearerSink->SetSource (ue);
	  m_bearerSink->SetDestination (ue->GetTargetNode ());
    }
  else if (GetSource ()->GetNodeType() == NetworkNode::TYPE_GW || GetSource ()->GetNodeType() == NetworkNode::TYPE_ENODEB
		  || GetSource ()->GetNodeType() == NetworkNode::TYPE_HOME_BASE_STATION)
    {
	  UserEquipment* ue = (UserEquipment*) GetDestination ();
	  ue->SetNodeState (NetworkNode::STATE_ACTIVE);
	  m_bearerSink->SetSource (ue->GetTargetNode ());
	  m_bearerSink->SetDestination (ue);
    }


  // 4 - add in radio bearer a pointer to the radio bearer sink
  m_radioBearer->GetDestination() ->GetProtocolStack ()->GetRrcEntity ()->AddRadioBearerSink(m_bearerSink);
  m_applicationSink->SetRadioBearerSink (m_bearerSink);


  // 4 attach UE on the UL or DL channel
  if (GetSource ()->GetNodeType() == NetworkNode::TYPE_UE)
    {
	  UserEquipment* ue = (UserEquipment*) GetSource ();
/*mouan
	  LteChannel *ch = ue->GetTargetNode ()->GetPhy ()->GetUlChannel ();

	  if (!ch->IsAttached (ue))
	    {
		  ch->AddDevice (ue);
	    }
mouan end*/

	  ue->MakeActive ();
    }
  else if (GetSource ()->GetNodeType() == NetworkNode::TYPE_GW || GetSource ()->GetNodeType() == NetworkNode::TYPE_ENODEB
		  || GetSource ()->GetNodeType() == NetworkNode::TYPE_HOME_BASE_STATION)
    {
	  UserEquipment* ue = (UserEquipment*) GetDestination ();
	  LteChannel *ch = ue->GetTargetNode ()->GetPhy ()->GetDlChannel ();

	  if (!ch->IsAttached (ue))
	    {
		  ch->AddDevice (ue);
	    }

	  ue->MakeActive ();
    }

#ifdef TEST_START_APPLICATION
  std::cout << "CREATED RADIO BEARER " << m_radioBearer->GetApplication ()->GetApplicationID ()
		  << " BETWEEN "
		  << m_radioBearer->GetSource ()->GetIDNetworkNode () << " and "
		  << m_radioBearer->GetDestination () ->GetIDNetworkNode ()<< std::endl;
#endif

  DoStart ();
}
コード例 #4
0
void
NetworkManager::UpdateUserPosition (double time)
{
  std::vector<UserEquipment*> *records = GetUserEquipmentContainer ();
  std::vector<UserEquipment*>::iterator iter;
  UserEquipment *record;

#ifdef MOBILITY_DEBUG
  std::cout << "MOBILITY_DEBUG: UPDATE POSITION, "
      "number of UE = " << records->size () <<
      " time = " << time << std::endl;
#endif

  for (iter = records->begin(); iter != records->end(); iter++)
    {
      record = *iter;

#ifdef MOBILITY_DEBUG
    std::cout << "\t USER  " << record->GetIDNetworkNode ()
	              << std::endl;
#endif

      record->UpdateUserPosition (time);
      record->SetIndoorFlag( CheckIndoorUsers(record) );

#ifdef AMC_MAPPING
  std::cout << "time: " << time << "\n\t position: "
		  << record->GetMobilityModel ()->GetAbsolutePosition ()->GetCoordinateX () <<
		  " " << record->GetMobilityModel ()->GetAbsolutePosition ()->GetCoordinateY ()
		  << std::endl;
#endif
#ifdef MOBILITY_DEBUG
  std::cout << "time: " << time << "\t position: "
		  << record->GetMobilityModel ()->GetAbsolutePosition ()->GetCoordinateX () <<
		  " " << record->GetMobilityModel ()->GetAbsolutePosition ()->GetCoordinateY ()
		  << std::endl;
#endif


      if (record->GetMobilityModel ()->GetHandover () == true)
        {
    	  NetworkNode* targetNode = record->GetTargetNode ();

          if (targetNode->GetProtocolStack ()->GetRrcEntity ()->
        		  GetHandoverEntity ()->CheckHandoverNeed (record))
            {
        	  NetworkNode* newTagertNode = targetNode->GetProtocolStack ()
        			  ->GetRrcEntity ()->GetHandoverEntity ()->GetHoManager ()->m_target;

#ifdef HANDOVER_DEBUG
              std::cout << "** HO ** \t time: " << time << " user " <<  record->GetIDNetworkNode () <<
            		  " old eNB " << targetNode->GetIDNetworkNode () <<
            		  " new eNB " << newTagertNode->GetIDNetworkNode () << std::endl;
#endif
              HandoverProcedure(time, record, targetNode, newTagertNode);
            }
        }
    }

  //PrintUEsForEachCell();
}