diff --git a/src/lte/examples/execution-time-reference.cc b/src/lte/examples/execution-time-reference.cc new file mode 100644 index 000000000..21f143e4d --- /dev/null +++ b/src/lte/examples/execution-time-reference.cc @@ -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 + */ + + +#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 +#include +#include + +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 lena = CreateObject (); + + // Create Nodes: eNodeB and UE + NodeContainer enbNodes; + vector 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 positionAlloc = CreateObject (); + 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 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; +} diff --git a/src/lte/examples/wscript b/src/lte/examples/wscript index ac89e1b17..d73403add 100644 --- a/src/lte/examples/wscript +++ b/src/lte/examples/wscript @@ -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' diff --git a/src/lte/model/lte-spectrum-value-helper.cc b/src/lte/model/lte-spectrum-value-helper.cc index 7e2b3b8da..94bf65320 100644 --- a/src/lte/model/lte-spectrum-value-helper.cc +++ b/src/lte/model/lte-spectrum-value-helper.cc @@ -19,10 +19,12 @@ * Nicola Baldo */ -#include +#include #include #include +#include + #include "lte-spectrum-value-helper.h" NS_LOG_COMPONENT_DEFINE ("LteSpectrumValueHelper");