--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/examples/lena-rem-sector-antenna.cc Tue Jan 17 13:50:04 2012 +0100
@@ -0,0 +1,240 @@
+/* -*- 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/buildings-propagation-loss-model.h>
+#include <ns3/buildings-helper.h>
+#include <ns3/radio-environment-map-helper.h>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include "ns3/gtk-config-store.h"
+
+using namespace ns3;
+using std::vector;
+
+int
+main (int argc, char *argv[])
+{
+ double simTime = 0.03;
+
+ CommandLine cmd;
+ cmd.Parse (argc, argv);
+
+ ConfigStore inputConfig;
+ inputConfig.ConfigureDefaults ();
+
+ cmd.Parse (argc, argv);
+
+ // Geometry of the scenario (in meters)
+ // Assume squared building
+ double nodeHeight = 1.5;
+ double roomHeight = 3;
+ double roomLength = 500;
+ uint32_t nRooms = 2;
+ // Create one eNodeB per room + one 3 sector eNodeB (i.e. 3 eNodeB) + one regular eNodeB
+ uint32_t nEnb = nRooms*nRooms + 4;
+ uint32_t nUe = 1;
+
+ Ptr < LteHelper > lteHelper = CreateObject<LteHelper> ();
+ //lteHelper->EnableLogComponents ();
+ lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::BuildingsPropagationLossModel"));
+
+ // Create Nodes: eNodeB and UE
+ NodeContainer enbNodes;
+ NodeContainer oneSectorNodes;
+ NodeContainer threeSectorNodes;
+ vector < NodeContainer > ueNodes;
+
+ oneSectorNodes.Create (nEnb-3);
+ threeSectorNodes.Create (3);
+
+ enbNodes.Add (oneSectorNodes);
+ enbNodes.Add (threeSectorNodes);
+
+ for (uint32_t i = 0; i < nEnb; i++)
+ {
+ NodeContainer ueNode;
+ ueNode.Create (nUe);
+ ueNodes.push_back (ueNode);
+ }
+
+ MobilityHelper mobility;
+ vector<Vector> enbPosition;
+ Ptr < ListPositionAllocator > positionAlloc = CreateObject<ListPositionAllocator> ();
+ Ptr < Building > building;
+ building = Create<Building> (0.0, nRooms * roomLength,
+ 0.0, nRooms * roomLength,
+ 0.0, roomHeight);
+ building->SetBuildingType (Building::Residential);
+ building->SetExtWallsType (Building::ConcreteWithWindows);
+ building->SetNFloors (0);
+ building->SetNRoomsX (nRooms);
+ building->SetNRoomsY (nRooms);
+ mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
+ mobility.Install (enbNodes);
+ uint32_t plantedEnb = 0;
+ for (uint32_t row = 0; row < nRooms; row++)
+ {
+ for (uint32_t column = 0; column < nRooms; column++, plantedEnb++)
+ {
+ Vector v (roomLength * (column + 0.5),
+ roomLength * (row + 0.5),
+ nodeHeight );
+ positionAlloc->Add (v);
+ enbPosition.push_back (v);
+ Ptr<BuildingsMobilityModel> mmEnb = enbNodes.Get (plantedEnb)->GetObject<BuildingsMobilityModel> ();
+ mmEnb->SetPosition (v);
+ mmEnb->SetIndoor (building);
+ mmEnb->SetFloorNumber (0);
+ mmEnb->SetRoomNumberX (row);
+ mmEnb->SetRoomNumberY (column);
+
+ // Positioning UEs attached to eNB
+ mobility.Install (ueNodes[plantedEnb]);
+ for (uint32_t ue = 0; ue < nUe; ue++)
+ {
+ Ptr<BuildingsMobilityModel> mmUe = ueNodes[plantedEnb].Get (ue)->GetObject<BuildingsMobilityModel> ();
+ Vector vUe (v.x, v.y, v.z);
+ mmUe->SetPosition (vUe);
+ mmUe->SetIndoor (building);
+ mmUe->SetFloorNumber (0);
+ mmUe->SetRoomNumberX (row);
+ mmUe->SetRoomNumberY (column);
+ }
+ }
+ }
+
+ // Add a 1-sector site
+ Vector v (500, 3000, nodeHeight);
+ positionAlloc->Add (v);
+ enbPosition.push_back (v);
+ mobility.Install (ueNodes[plantedEnb]);
+ plantedEnb++;
+
+ // Add the 3-sector site
+ for (uint32_t index = 0; index < 3; index++, plantedEnb++)
+ {
+ Vector v (500, 2000, nodeHeight);
+ positionAlloc->Add (v);
+ enbPosition.push_back (v);
+ mobility.Install (ueNodes[plantedEnb]);
+ }
+
+
+ mobility.SetPositionAllocator (positionAlloc);
+ mobility.Install (enbNodes);
+
+ // Position of UEs attached to eNB
+ for (uint32_t i = 0; i < nEnb; i++)
+ {
+ UniformVariable posX (enbPosition[i].x - roomLength * 0,
+ enbPosition[i].x + roomLength * 0);
+ UniformVariable posY (enbPosition[i].y - roomLength * 0,
+ enbPosition[i].y + roomLength * 0);
+ positionAlloc = CreateObject<ListPositionAllocator> ();
+ for (uint32_t j = 0; j < nUe; j++)
+ {
+ if ( i == nEnb - 3 )
+ {
+ positionAlloc->Add (Vector (enbPosition[i].x + 10, enbPosition[i].y, nodeHeight));
+ }
+ else if ( i == nEnb - 2 )
+ {
+ positionAlloc->Add (Vector (enbPosition[i].x - sqrt (10), enbPosition[i].y + sqrt (10), nodeHeight));
+ }
+ else if ( i == nEnb - 1 )
+ {
+ positionAlloc->Add (Vector (enbPosition[i].x - sqrt (10), enbPosition[i].y - sqrt (10), nodeHeight));
+ }
+ else
+ {
+ positionAlloc->Add (Vector (posX.GetValue (), posY.GetValue (), nodeHeight));
+ }
+ mobility.SetPositionAllocator (positionAlloc);
+ }
+ mobility.Install (ueNodes[i]);
+ }
+ BuildingsHelper::MakeMobilityModelConsistent ();
+
+
+ // Create Devices and install them in the Nodes (eNB and UE)
+ NetDeviceContainer enbDevs;
+ vector < NetDeviceContainer > ueDevs;
+
+ enbDevs = lteHelper->InstallEnbDevice (oneSectorNodes);
+
+ // Beam width is made quite narrow so sectors can be noticed in the REM
+ lteHelper->SetEnbAntennaModelType ("ns3::CosineAntennaModel");
+ lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (0));
+ lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (20));
+ lteHelper->SetEnbAntennaModelAttribute ("MaxGain", DoubleValue (0.0));
+ enbDevs.Add ( lteHelper->InstallEnbDevice (threeSectorNodes.Get (0)));
+
+ lteHelper->SetEnbAntennaModelType ("ns3::CosineAntennaModel");
+ lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (360/3));
+ lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (20));
+ lteHelper->SetEnbAntennaModelAttribute ("MaxGain", DoubleValue (0.0));
+ enbDevs.Add ( lteHelper->InstallEnbDevice (threeSectorNodes.Get (1)));
+
+ lteHelper->SetEnbAntennaModelType ("ns3::CosineAntennaModel");
+ lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (2*360/3));
+ lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (20));
+ lteHelper->SetEnbAntennaModelAttribute ("MaxGain", DoubleValue (0.0));
+ enbDevs.Add ( lteHelper->InstallEnbDevice (threeSectorNodes.Get (2)));
+
+ for (uint32_t i = 0; i < nEnb; i++)
+ {
+ NetDeviceContainer ueDev = lteHelper->InstallUeDevice (ueNodes[i]);
+ ueDevs.push_back (ueDev);
+ lteHelper->Attach (ueDev, enbDevs.Get (i));
+ enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
+ EpsBearer bearer (q);
+ lteHelper->ActivateEpsBearer (ueDev, bearer, EpcTft::Default ());
+ }
+
+ Simulator::Stop (Seconds (simTime));
+ lteHelper->EnableTraces ();
+
+ Ptr<RadioEnvironmentMapHelper> remHelper = CreateObject<RadioEnvironmentMapHelper> ();
+ remHelper->SetAttribute ("ChannelPath", StringValue ("/ChannelList/0"));
+ remHelper->SetAttribute ("OutputFile", StringValue ("rem.out"));
+ remHelper->SetAttribute ("XMin", DoubleValue (-200.0));
+ remHelper->SetAttribute ("XMax", DoubleValue (1200.0));
+ remHelper->SetAttribute ("XRes", UintegerValue (100));
+ remHelper->SetAttribute ("YMin", DoubleValue (-300.0));
+ remHelper->SetAttribute ("YMax", DoubleValue (+3500.0));
+ remHelper->SetAttribute ("YRes", UintegerValue (100));
+ remHelper->SetAttribute ("Z", DoubleValue (1.5));
+ remHelper->Install ();
+ // Recall the buildings helper to place the REM nodes in its position
+ BuildingsHelper::MakeMobilityModelConsistent ();
+ Simulator::Run ();
+
+ GtkConfigStore config;
+ config.ConfigureAttributes ();
+
+ Simulator::Destroy ();
+ return 0;
+}
--- a/src/lte/examples/wscript Mon Jan 16 23:12:01 2012 +0100
+++ b/src/lte/examples/wscript Tue Jan 17 13:50:04 2012 +0100
@@ -1,6 +1,9 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
+ obj = bld.create_ns3_program('lena-rem-sector-antenna',
+ ['lte'])
+ obj.source = 'lena-rem-sector-antenna.cc'
obj = bld.create_ns3_program('lena-cqi-threshold',
['lte'])
obj.source = 'lena-cqi-threshold.cc'