Name refactoring of example simulation scripts

This commit is contained in:
Jaume Nin
2011-11-30 11:20:49 +01:00
parent 4fbb036109
commit 325c82b206
13 changed files with 59 additions and 201 deletions

View File

@@ -25,10 +25,10 @@
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
using namespace ns3;
// position functions insipred by /examples/wireless/wifi-ap.cc
static void
SetPosition (Ptr<Node> node, Vector position)
{
@@ -79,16 +79,9 @@ int main (int argc, char *argv[])
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
// Uncomment to enable logging
//lena->EnableLogComponents ();
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes;

View File

@@ -48,13 +48,10 @@ int main (int argc, char *argv[])
//cmd.Parse (argc, argv);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Uncomment to enable logging
//lena->EnableLogComponents ();
LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
LogComponentEnable ("TraceFadingLossModel", LOG_LEVEL_ALL);
lena->SetAttribute ("FadingModel", StringValue ("ns3::TraceFadingLossModel"));
std::ifstream ifTraceFile;
@@ -97,8 +94,6 @@ int main (int argc, char *argv[])
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
//lena->SetSchedulerType ("ns3::RrFfMacScheduler");
lena->SetSchedulerType ("ns3::PfFfMacScheduler");
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);

View File

@@ -32,6 +32,11 @@
using namespace ns3;
/**
* This simulation script creates two eNodeBs and drops randomly several UEs in
* a disc around them (same number on both). The number of UEs , the radius of
* that disc and the distance between the eNodeBs can be configured.
*/
int main (int argc, char *argv[])
{
double enbDist = 100.0;

View File

@@ -127,9 +127,6 @@ UplinkGlobalPathlossDatabase::UpdatePathloss (std::string context,
}
int main (int argc, char *argv[])
{
double enbDist = 20.0;
@@ -214,8 +211,6 @@ int main (int argc, char *argv[])
ue2mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
ue2mobility.Install (ueNodes2);
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs1;

View File

@@ -23,12 +23,11 @@
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
#include <ns3/buildings-propagation-loss-model.h>
#include <iomanip>
#include <string>
#include <vector>
//#include "ns3/gtk-config-store.h"
using namespace ns3;
using std::vector;

View File

@@ -46,6 +46,7 @@ int main (int argc, char *argv[])
lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
// Enable LTE log components
//lena->EnableLogComponents ();
lena->EnableRlcTraces();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
@@ -74,13 +75,13 @@ int main (int argc, char *argv[])
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDevs, bearer, LteTft::Default ());
Simulator::Stop (Seconds (0.2));
Simulator::Stop (Seconds (2));
lena->EnableMacTraces ();
lena->EnableRlcTraces ();
double distance_temp [] = { 10000,10000,10000}; //{10000, 10000, 10000};
double distance_temp [] = { 10000,10000,10000};
std::vector<double> userDistance;
userDistance.assign (distance_temp, distance_temp + 3);
for (int i = 0; i < 3; i++)
@@ -97,7 +98,5 @@ int main (int argc, char *argv[])
Simulator::Destroy ();
// Generate RLC output
return 0;
}

View File

@@ -31,21 +31,23 @@
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
using namespace ns3;
/**
* Sample simulation script for LTE+EPC. It instantiates several eNodeB,
* attaches one UE per eNodeB starts a flow for each UE to and from a remote host.
* It also starts yet another flow between each UE pair.
*/
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("EpcFirstExample");
int
main (int argc, char *argv[])
{
uint16_t numberOfNodes = 2;
uint32_t simTime = 4;
double distance = 10.0;
uint32_t simTime = 5;
double distance = 60.0;
// Inter packet interval in ms
double interPacketInterval = 1;
// Command line arguments
CommandLine cmd;
@@ -146,8 +148,14 @@ main (int argc, char *argv[])
serverApps = ulPacketSinkHelper.Install (remoteHost);
serverApps = packetSinkHelper.Install (ueNodes.Get(u));
UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort);
dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
dlClient.SetAttribute ("MaxPackets", UintegerValue(1000000));
UdpClientHelper ulClient (remoteHostAddr, ulPort);
ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
ulClient.SetAttribute ("MaxPackets", UintegerValue(1000000));
UdpClientHelper client (ueIpIface.GetAddress (u), otherPort);
client.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
client.SetAttribute ("MaxPackets", UintegerValue(1000000));
clientApps = dlClient.Install (remoteHost);
clientApps = ulClient.Install (ueNodes.Get(u));
if (u+1 < ueNodes.GetN ())
@@ -162,9 +170,9 @@ main (int argc, char *argv[])
}
serverApps.Start (Seconds (0.01));
clientApps.Start (Seconds (0.01));
// Enable PCAP tracing
p2ph.EnablePcapAll("lena-epc-first");
lteHelper->EnableTraces ();
// Uncomment to enable PCAP tracing
//p2ph.EnablePcapAll("lena-epc-first");
Simulator::Stop(Seconds(simTime));
Simulator::Run();

View File

@@ -25,6 +25,7 @@
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
using namespace ns3;
int main (int argc, char *argv[])
@@ -41,21 +42,14 @@ int main (int argc, char *argv[])
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
// Parse again so you can override default values from the command line
cmd.Parse (argc, argv);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Uncomment to enable logging
//lena->EnableLogComponents ();
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes;
@@ -72,8 +66,9 @@ int main (int argc, char *argv[])
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
// Default scheduler is PF, uncomment to use RR
//lena->SetSchedulerType ("ns3::RrFfMacScheduler");
lena->SetSchedulerType ("ns3::PfFfMacScheduler");
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);

View File

@@ -1,135 +0,0 @@
/* -*- 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;
double enbDist = 100;
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> ();
lena->EnableLogComponents ();
// 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> ();
for (uint32_t i = 0; i < nEnb; i++)
{
positionAlloc->Add (Vector (enbDist * i, enbDist * i, 0.0));
}
MobilityHelper enbMobility;
enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
enbMobility.SetPositionAllocator (positionAlloc);
enbMobility.Install (enbNodes);
// Position of UEs attached to eNB
vector<MobilityHelper> ueMobility;
for (uint32_t i = 0; i < nEnb; i++)
{
MobilityHelper ueMob;
ueMob.SetPositionAllocator ("ns3::UniformDiscPositionAllocator",
"X", DoubleValue (enbDist * i),
"Y", DoubleValue (enbDist * i),
"rho", DoubleValue (radius));
ueMob.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
ueMobility.push_back (ueMob);
ueMobility[i].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, LteTft::Default ());
}
Simulator::Stop (Seconds (60));
//lena->EnableRlcTraces ();
Simulator::Run ();
/*GtkConfigStore config;
config.ConfigureAttributes ();*/
Simulator::Destroy ();
return 0;
}

View File

@@ -1,27 +1,31 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
obj = bld.create_ns3_program('lena-first-sim',
obj = bld.create_ns3_program('lena-cqi-threshold',
['lte'])
obj.source = 'lena-first-sim.cc'
obj = bld.create_ns3_program('inter-cell-interference',
['lte'])
obj.source = 'inter-cell-interference.cc'
obj = bld.create_ns3_program('lena-rlc-calculator',
['lte'])
obj.source = 'lena-rlc-calculator.cc'
obj.source = 'lena-cqi-threshold.cc'
obj = bld.create_ns3_program('lena-fading',
['lte'])
obj.source = 'lena-fading.cc'
obj = bld.create_ns3_program('lena-cqi-threshold',
obj = bld.create_ns3_program('lena-gtpu-tunnel',
['lte'])
obj.source = 'lena-cqi-threshold.cc'
obj = bld.create_ns3_program('lena-runtime-profiler',
obj.source = 'lena-gtpu-tunnel.cc'
obj = bld.create_ns3_program('lena-intercell-interference',
['lte'])
obj.source = 'lena-runtime-profiler.cc'
obj = bld.create_ns3_program('lena-extract-pathloss',
obj.source = 'lena-intercell-interference.cc'
obj = bld.create_ns3_program('lena-pathloss-traces',
['lte'])
obj.source = 'lena-extract-pathloss.cc'
obj = bld.create_ns3_program('lena-epc-first',
obj.source = 'lena-pathloss-traces.cc'
obj = bld.create_ns3_program('lena-profiling',
['lte'])
obj.source = 'lena-epc-first.cc'
obj.source = 'lena-profiling.cc'
obj = bld.create_ns3_program('lena-rlc-traces',
['lte'])
obj.source = 'lena-rlc-traces.cc'
obj = bld.create_ns3_program('lena-simple',
['lte'])
obj.source = 'lena-simple.cc'
obj = bld.create_ns3_program('lena-simple-epc',
['lte'])
obj.source = 'lena-simple-epc.cc'

View File

@@ -9,11 +9,11 @@
#
# See test.py for more information.
cpp_examples = [
("lena-first-sim", "True", "True"),
("inter-cell-interference", "True", "True"),
("lena-rlc-calculator", "True", "True"),
("lena-runtime-profiler", "True", "True"),
("lena-extract-pathloss", "True", "True"),
("lena-simple", "True", "True"),
("lena-intercell-interference", "True", "True"),
("lena-rlc-traces", "True", "True"),
("lena-profiling", "True", "True"),
("lena-pathloss-traces", "True", "True"),
("lena-fading", "True", "True"),
]

View File

@@ -12,7 +12,7 @@ print FILE "#sTime\tnFloors\tnEnb\tnUe\trTime\trTDev\n";
my @nUe = ( 1, 5, 10, 15, 20, 25, 30 );
my @nEnb = ( 1, 2, 4, 6, 8, 12, 14, 18, 22 );
my @nFloors = ( 0, 1 );
my @simTime = ( 1, 5, 10, 20, 30, 40 );
my @simTime = ( 1, 5);
my $traceDirectory = ".";
my $traceDirectory = getcwd() . "/";
@@ -28,7 +28,7 @@ foreach my $time (@simTime)
my $timeStats = Statistics::Descriptive::Full->new();
for ( my $iteration = 0 ; $iteration < $nIterations ; $iteration++ )
{
my $launch = "time ./waf --run \'lena-runtime-profiler --simTime=$time --nUe=$ue --nEnb=$enb --nFloors=$floor --traceDirectory=$traceDirectory\'";
my $launch = "time ./waf --run \'lena-profiling --simTime=$time --nUe=$ue --nEnb=$enb --nFloors=$floor --traceDirectory=$traceDirectory\'";
my $out, my $err;
print "$launch\n";
capture { system($launch ) } \$out, \$err;