This commit is contained in:
Nicola Baldo
2011-05-20 09:29:12 +02:00
3 changed files with 134 additions and 1 deletions

View File

@@ -0,0 +1,128 @@
/* -*- 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: Jaume Nin <jnin@cttc.es>
*/
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
#include <iomanip>
#include <string>
#include <vector>
using namespace ns3;
using std::vector;
int main (int argc, char *argv[])
{
double radius = 0.0;
uint32_t nEnb = 1;
uint32_t nUe = 1;
CommandLine cmd;
cmd.AddValue ("nEnb", "Number of eNodeBs", nEnb);
cmd.AddValue ("nUe", "Number of UEs", nUe);
cmd.AddValue ("radius", "the radius of the disc where UEs are placed around an eNB", radius);
cmd.Parse (argc, argv);
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
cmd.Parse (argc, argv);
// determine the string tag that identifies this simulation run
// this tag is then appended to all filenames
IntegerValue runValue;
GlobalValue::GetValueByName ("RngRun", runValue);
// std::ostringstream tag;
/* tag << "_enbDist" << std::setw(3) << std::setfill ('0') << std::fixed << std::setprecision (0) << enbDist
<< "_radius" << std::setw(3) << std::setfill ('0') << std::fixed << std::setprecision (0) << radius
<< "_nUe" << std::setw(3) << std::setfill('0') << nUe
<< "_rngRun" << std::setw(3) << std::setfill('0') << runValue.Get () ;
*/
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
vector<NodeContainer> ueNodes;
enbNodes.Create (nEnb);
for (uint32_t i = 0; i < nEnb; i++)
{
NodeContainer ueNode;
ueNode.Create (nUe);
ueNodes.push_back(ueNode);
}
// Position of eNBs
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
MobilityHelper enbMobility;
enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
enbMobility.SetPositionAllocator (positionAlloc);
enbMobility.Install (enbNodes);
// Position of UEs attached to eN
MobilityHelper ueMobility;
ueMobility.SetPositionAllocator ("ns3::UniformDiscPositionAllocator",
"X", DoubleValue (0.0),
"Y", DoubleValue (0.0),
"rho", DoubleValue (radius));
ueMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
for (uint32_t i = 0; i < nEnb; i++)
{
ueMobility.Install (ueNodes[i]);
}
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
vector<NetDeviceContainer> ueDevs;
//NetDeviceContainer ueDevs2;
enbDevs = lena->InstallEnbDevice (enbNodes);
for (uint32_t i = 0; i < nEnb; i++)
{
NetDeviceContainer ueDev = lena->InstallUeDevice (ueNodes[i]);
ueDevs.push_back (ueDev);
lena->Attach (ueDev, enbDevs.Get (i));
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDev, bearer);
}
Simulator::Stop (Seconds (60));
//lena->EnableRlcTraces ();
Simulator::Run ();
/*GtkConfigStore config;
config.ConfigureAttributes ();*/
Simulator::Destroy ();
return 0;
}

View File

@@ -10,3 +10,6 @@ def build(bld):
obj = bld.create_ns3_program('lena-rlc-calculator',
['lte'])
obj.source = 'lena-rlc-calculator.cc'
obj = bld.create_ns3_program('execution-time-reference',
['lte'])
obj.source = 'execution-time-reference.cc'

View File

@@ -19,10 +19,12 @@
* Nicola Baldo <nbaldo@cttc.es>
*/
#include<map>
#include <map>
#include <cmath>
#include <ns3/log.h>
#include <ns3/fatal-error.h>
#include "lte-spectrum-value-helper.h"
NS_LOG_COMPONENT_DEFINE ("LteSpectrumValueHelper");