70 lines
2.0 KiB
C++
70 lines
2.0 KiB
C++
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
|
/*
|
|
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation;
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* Author: Manuel Requena <manuel.requena@cttc.es>
|
|
* Nicola Baldo <nbaldo@cttc.es>
|
|
*/
|
|
|
|
|
|
#include "ns3/core-module.h"
|
|
#include "ns3/network-module.h"
|
|
#include "ns3/mobility-module.h"
|
|
#include "ns3/lte-module.h"
|
|
|
|
using namespace ns3;
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
LenaHelper lena;
|
|
|
|
lena.EnableLogComponents ();
|
|
|
|
// Create Nodes: eNodeB and UE
|
|
NodeContainer enbNodes;
|
|
NodeContainer ueNodes;
|
|
enbNodes.Create (1);
|
|
ueNodes.Create (1);
|
|
|
|
// Install Mobility Model
|
|
MobilityHelper mobility;
|
|
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
|
mobility.Install (enbNodes);
|
|
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
|
mobility.Install (ueNodes);
|
|
|
|
// Create Devices and install them in the Nodes (eNB and UE)
|
|
NetDeviceContainer enbDevs;
|
|
NetDeviceContainer ueDevs;
|
|
enbDevs = lena.InstallEnbDevice (enbNodes);
|
|
ueDevs = lena.InstallUeDevice (ueNodes);
|
|
|
|
// Attach a UE to a eNB
|
|
lena.Attach (ueDevs, enbDevs.Get (0));
|
|
|
|
// Activate an EPS bearer
|
|
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
|
EpsBearer bearer (q);
|
|
lena.ActivateEpsBearer (ueDevs, bearer);
|
|
|
|
|
|
Simulator::Stop (Seconds (0.004));
|
|
|
|
Simulator::Run ();
|
|
Simulator::Destroy ();
|
|
return 0;
|
|
}
|