Merge new tests of RLC entities
authorManuel Requena <manuel.requena@cttc.es>
Wed, 08 Feb 2012 17:14:58 +0100
changeset 8629 859fa94888fc
parent 8628 b86b82c76693 (current diff)
parent 8609 db24d2db55d4 (diff)
child 8630 676af6bab0d7
Merge new tests of RLC entities
--- a/src/buildings/helper/buildings-helper.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/buildings/helper/buildings-helper.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -41,27 +41,35 @@
     {
       Ptr<BuildingsMobilityModel> bmm = (*nit)->GetObject<BuildingsMobilityModel> ();
       NS_ABORT_MSG_UNLESS (0 != bmm, "node " << (*nit)->GetId () << " does not have a BuildingsMobilityModel");
-      bool found = false;
-      for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit)
-	{
-	  Vector pos = bmm->GetPosition ();
-	  if ((*bit)->IsInside (pos))
-	    {
-	      NS_LOG_LOGIC ("node " << (*nit)->GetId () << " falls inside building " << (*bit)->GetId ());
-	      NS_ABORT_MSG_UNLESS (found == false, "node already inside another building!");		
-	      found = true;
-	      uint16_t floor = (*bit)->GetFloor (pos);
-	      uint16_t roomX = (*bit)->GetRoomX (pos);
-	      uint16_t roomY = (*bit)->GetRoomY (pos);	   
-	      bmm->SetIndoor (*bit, floor, roomX, roomY);	      
-	    }		    	  
-	}
-      if (!found)
-	{
-	  NS_LOG_LOGIC ("node " << (*nit)->GetId () << " is outdoor");
-	  bmm->SetOutdoor ();
-	}
+      MakeConsistent (bmm);
     }
 }
 
+
+void
+BuildingsHelper::MakeConsistent (Ptr<BuildingsMobilityModel> bmm)
+{
+  bool found = false;
+  for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit)
+    {
+      Vector pos = bmm->GetPosition ();
+      if ((*bit)->IsInside (pos))
+        {
+          NS_LOG_LOGIC ("BuildingsMobilityModel " << bmm << " falls inside building " << (*bit)->GetId ());
+          NS_ABORT_MSG_UNLESS (found == false, " BuildingsMobilityModel already inside another building!");		
+          found = true;
+          uint16_t floor = (*bit)->GetFloor (pos);
+          uint16_t roomX = (*bit)->GetRoomX (pos);
+          uint16_t roomY = (*bit)->GetRoomY (pos);	   
+          bmm->SetIndoor (*bit, floor, roomX, roomY);	      
+        }		    	  
+    }
+  if (!found)
+    {
+      NS_LOG_LOGIC ("BuildingsMobilityModel " << bmm  << " is outdoor");
+      bmm->SetOutdoor ();
+    }
+
+}
+
 } // namespace ns3
--- a/src/buildings/helper/buildings-helper.h	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/buildings/helper/buildings-helper.h	Wed Feb 08 17:14:58 2012 +0100
@@ -25,15 +25,18 @@
 #include <ns3/attribute.h>
 #include <ns3/object-factory.h>
 #include <ns3/node-container.h>
+#include <ns3/ptr.h>
 
 
 namespace ns3 {
 
+class BuildingsMobilityModel;
 
 class BuildingsHelper
 {
 public:  
   static void MakeMobilityModelConsistent ();
+  static void MakeConsistent (Ptr<BuildingsMobilityModel> bmm);
   
 };
 
--- a/src/lte/doc/source/lte-user.rst	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/doc/source/lte-user.rst	Wed Feb 08 17:14:58 2012 +0100
@@ -498,6 +498,21 @@
 generate only one REM; if you want to generate more REMs, you need to
 create one separate instance for each REM. 
 
+Note that the REM generation is very demanding, in particular:
+
+ * the run-time memory consumption is approximately 5KB per pixel. For example,
+   a REM with a resolution of 500x500 needs about 1.25 GB of memory, and
+   a resolution of 1000x1000 needs about 5 GB (too much for a
+   regular PC at the time of this writing).
+ * if you generate a REM at the beginning of a simulation, it will
+   slow down the execution of the rest of the simulation. If you want
+   to generate a REM for a program and also use the same program to
+   get simulation result, it is recommended to add a command-line
+   switch that allows to either generate the REM or run the complete
+   simulation. For this purpose, note that there is an attribute
+   ``RadioEnvironmentMapHelper::StopWhenDone`` (default: true) that
+   will force the simulation to stop right after the REM has been generated.
+
 The REM is stored in an ASCII file in the following format:
 
  * column 1 is the x coordinate
@@ -512,6 +527,7 @@
    set xlabel "X"
    set ylabel "Y"
    set cblabel "SINR (dB)"
+   unset key
    plot "rem.out" using ($1):($2):(10*log10($4)) with image
   
 
--- a/src/lte/examples/lena-rem-sector-antenna.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/examples/lena-rem-sector-antenna.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -37,8 +37,6 @@
 int
 main (int argc, char *argv[])
 {
-  double simTime = 0.03;
-
   CommandLine cmd;
   cmd.Parse (argc, argv);
 
@@ -176,31 +174,35 @@
         }
       mobility.Install (ueNodes.at(i));
     }
-  BuildingsHelper::MakeMobilityModelConsistent ();
-
 
   // Create Devices and install them in the Nodes (eNB and UE)
   NetDeviceContainer enbDevs;
   vector < NetDeviceContainer > ueDevs;
 
+  // power setting in dBm for small cells
+  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (10.0));
   enbDevs = lteHelper->InstallEnbDevice (oneSectorNodes);
 
+
+  // power setting for three-sector macrocell
+  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (30.0));
+
   // 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 ("Beamwidth",   DoubleValue (100));
   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 ("Beamwidth",   DoubleValue (100));
   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 ("Beamwidth",   DoubleValue (100));
   lteHelper->SetEnbAntennaModelAttribute ("MaxGain",     DoubleValue (0.0));
   enbDevs.Add ( lteHelper->InstallEnbDevice (threeSectorNodes.Get (2)));
 
@@ -214,27 +216,28 @@
       lteHelper->ActivateEpsBearer (ueDev, bearer, EpcTft::Default ());
     }
 
-  Simulator::Stop (Seconds (simTime));
-  lteHelper->EnableTraces ();
+
+  BuildingsHelper::MakeMobilityModelConsistent ();
+
+  // by default, simulation will anyway stop right after the REM has been generated
+  Simulator::Stop (Seconds (0.0069));  
 
   Ptr<RadioEnvironmentMapHelper> remHelper = CreateObject<RadioEnvironmentMapHelper> ();
   remHelper->SetAttribute ("ChannelPath", StringValue ("/ChannelList/0"));
   remHelper->SetAttribute ("OutputFile", StringValue ("rem.out"));
   remHelper->SetAttribute ("XMin", DoubleValue (-2000.0));
   remHelper->SetAttribute ("XMax", DoubleValue (+2000.0));
-  remHelper->SetAttribute ("XRes", UintegerValue (100));
   remHelper->SetAttribute ("YMin", DoubleValue (-500.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 ();
 
+  lteHelper = 0;
   Simulator::Destroy ();
   return 0;
 }
--- a/src/lte/examples/lena-rem.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/examples/lena-rem.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -26,6 +26,7 @@
 #include "ns3/lte-module.h"
 #include "ns3/config-store.h"
 #include "ns3/spectrum-module.h"
+#include <ns3/buildings-helper.h>
 //#include "ns3/gtk-config-store.h"
 
 using namespace ns3;
@@ -90,10 +91,8 @@
   remHelper->SetAttribute ("OutputFile", StringValue ("rem.out"));
   remHelper->SetAttribute ("XMin", DoubleValue (-400.0));
   remHelper->SetAttribute ("XMax", DoubleValue (400.0));
-  remHelper->SetAttribute ("XRes", UintegerValue (40));
   remHelper->SetAttribute ("YMin", DoubleValue (-300.0));
   remHelper->SetAttribute ("YMax", DoubleValue (300.0));
-  remHelper->SetAttribute ("YRes", UintegerValue (30));
   remHelper->SetAttribute ("Z", DoubleValue (0.0));
   remHelper->Install ();
 
@@ -107,9 +106,10 @@
   // plot "rem.out" using ($1):($2):(10*log10($4)) with image
   
     
-
+  BuildingsHelper::MakeMobilityModelConsistent ();
 
-  Simulator::Stop (Seconds (0.020));
+ // by default, simulation will anyway stop right after the REM has been generated
+  Simulator::Stop (Seconds (0.0069));
 
   Simulator::Run ();
 
--- a/src/lte/helper/lte-stats-calculator.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/helper/lte-stats-calculator.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -1,8 +1,21 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
 /*
- * lte-stats-calculator.cpp
+ * 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;
  *
- *  Created on: Nov 4, 2011
- *      Author: jnin
+ * 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 "lte-stats-calculator.h"
--- a/src/lte/helper/lte-stats-calculator.h	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/helper/lte-stats-calculator.h	Wed Feb 08 17:14:58 2012 +0100
@@ -1,8 +1,21 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
 /*
- * lte-stats-calculator.h
+ * 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;
  *
- *  Created on: Nov 4, 2011
- *      Author: jnin
+ * 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>
  */
 
 #ifndef LTE_STATS_CALCULATOR_H_
--- a/src/lte/helper/radio-environment-map-helper.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/helper/radio-environment-map-helper.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -33,9 +33,10 @@
 #include <ns3/buildings-mobility-model.h>
 #include <ns3/simulator.h>
 #include <ns3/node.h>
+#include <ns3/buildings-helper.h>
 
 #include <fstream>
-
+#include <limits>
 
 NS_LOG_COMPONENT_DEFINE ("RadioEnvironmentMapHelper");
 
@@ -96,20 +97,24 @@
    .AddAttribute ("XRes", "The resolution (number of points) of the map along the x axis.",
                    UintegerValue (100),
                    MakeUintegerAccessor (&RadioEnvironmentMapHelper::m_xRes),
-                   MakeUintegerChecker<uint32_t> ())
+                  MakeUintegerChecker<uint32_t> (2,std::numeric_limits<uint16_t>::max ()))
     .AddAttribute ("YRes", "The resolution (number of points) of the map along the y axis.",
                    UintegerValue (100),
                    MakeUintegerAccessor (&RadioEnvironmentMapHelper::m_yRes),
-                   MakeUintegerChecker<uint32_t> ())
+                   MakeUintegerChecker<uint32_t> (2,std::numeric_limits<uint16_t>::max ()))
     .AddAttribute ("Z", "The value of the z coordinate for which the map is to be generated",
 		   DoubleValue (0.0),
                    MakeDoubleAccessor (&RadioEnvironmentMapHelper::m_z),
                    MakeDoubleChecker<double> ())
-    .AddAttribute ("ExitWhenDone", "If true, Simulator::Stop () will be called as soon as the REM has been generated",
+    .AddAttribute ("StopWhenDone", "If true, Simulator::Stop () will be called as soon as the REM has been generated",
 		   BooleanValue (true),
-                   MakeBooleanAccessor (&RadioEnvironmentMapHelper::m_exitWhenDone),
+                   MakeBooleanAccessor (&RadioEnvironmentMapHelper::m_stopWhenDone),
                    MakeBooleanChecker ())
-
+    .AddAttribute ("NoisePower",
+                   "the power of the measuring instrument noise, in Watts. Default to a kT of -174 dBm with a noise figure of 9 dB and a bandwidth of 25 LTE Resource Blocks",
+                   DoubleValue (1.4230e-10),
+                   MakeDoubleAccessor (&RadioEnvironmentMapHelper::m_noisePower),
+                   MakeDoubleChecker<double> ())
   ;
   return tid;
 }
@@ -133,22 +138,21 @@
   m_channel = match.Get (0)->GetObject<SpectrumChannel> ();
   NS_ABORT_MSG_IF (m_channel == 0, "object at " << m_channelPath << "is not of type SpectrumChannel");
 
-  double xStep = (m_xMax - m_xMin)/m_xRes;
-  double yStep = (m_yMax - m_yMin)/m_yRes;
+  double xStep = (m_xMax - m_xMin)/(m_xRes-1);
+  double yStep = (m_yMax - m_yMin)/(m_yRes-1);
+  
   
-  for (double x = m_xMin; x <= m_xMax ; x += xStep)
+  for (double x = m_xMin; x < m_xMax + 0.5*xStep; x += xStep)
     {
-      m_rem.push_back (std::list<RemPoint> ());
-      for (double y = m_yMin; y <= m_yMax ; y += yStep)
+      for (double y = m_yMin; y < m_yMax + 0.5*yStep ; y += yStep)
         {
           RemPoint p;
           p.phy = CreateObject<RemSpectrumPhy> ();
           p.bmm = CreateObject<BuildingsMobilityModel> ();
-          p.node = CreateObject<Node> ();
-          p.node->AggregateObject (p.bmm);
           p.phy->SetMobility (p.bmm);
           p.bmm->SetPosition (Vector (x, y, m_z));
-          m_rem.back ().push_back (p);
+          BuildingsHelper::MakeConsistent (p.bmm);
+          m_rem.push_back (p);
         }      
     }
   Simulator::Schedule (Seconds (0.0055), &RadioEnvironmentMapHelper::Connect, this);
@@ -160,18 +164,13 @@
 RadioEnvironmentMapHelper::Connect ()
 {
   NS_LOG_FUNCTION (this);
-  for (std::list<std::list<RemPoint> >::iterator it1 = m_rem.begin ();
-       it1 != m_rem.end ();
-       ++it1)
+  for (std::list<RemPoint>::iterator it = m_rem.begin ();
+       it != m_rem.end ();
+       ++it)
     {
-      for (std::list<RemPoint>::iterator it2 = it1->begin ();
-           it2 != it1->end ();
-           ++it2)
-        {
-          NS_LOG_LOGIC ("adding phy " << it2->phy);
-          m_channel->AddRx (it2->phy);
-        }
-    }
+      NS_LOG_LOGIC ("adding phy " << it->phy);
+      m_channel->AddRx (it->phy);
+    }    
 }
 
 void 
@@ -186,29 +185,22 @@
       return;
     }
   
-  for (std::list<std::list<RemPoint> >::iterator it1 = m_rem.begin ();
-       it1 != m_rem.end ();
-       ++it1)
+  for (std::list<RemPoint>::iterator it = m_rem.begin ();
+       it != m_rem.end ();
+       ++it)
     {
-      for (std::list<RemPoint>::iterator it2 = it1->begin ();
-           it2 != it1->end ();
-           ++it2)
-        {
-          Vector pos = it2->bmm->GetPosition ();
-          outFile << pos.x << "\t" 
-                  << pos.y << "\t" 
-                  << pos.z << "\t" 
-                  << it2->phy->GetSinr ()
-                  << std::endl;
-          it2->phy->Deactivate ();
-        }
+      Vector pos = it->bmm->GetPosition ();
+      outFile << pos.x << "\t" 
+              << pos.y << "\t" 
+              << pos.z << "\t" 
+              << it->phy->GetSinr (m_noisePower)
+              << std::endl;
+      it->phy->Deactivate ();
     }
   outFile.close ();
-  if (m_exitWhenDone)
+  if (m_stopWhenDone)
     {
       Simulator::Stop ();
-      Simulator::Destroy ();
-      exit (0);
     }
 }
 
--- a/src/lte/helper/radio-environment-map-helper.h	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/helper/radio-environment-map-helper.h	Wed Feb 08 17:14:58 2012 +0100
@@ -62,29 +62,29 @@
   struct RemPoint 
   {
     Ptr<RemSpectrumPhy> phy;
-    Ptr<Node> node;
-    Ptr<NetDevice> dev;
     Ptr<BuildingsMobilityModel> bmm;
   };
 
-  std::list<std::list<RemPoint> > m_rem;
+  std::list<RemPoint> m_rem;
 
   double m_xMin;
   double m_xMax;
-  uint32_t m_xRes;
+  uint16_t m_xRes;
 
   double m_yMin;
   double m_yMax;
-  uint32_t m_yRes;
+  uint16_t m_yRes;
   
   double m_z;
 
   std::string m_channelPath;
   std::string m_outputFile;
 
-  bool m_exitWhenDone;
+  bool m_stopWhenDone;
   
   Ptr<SpectrumChannel> m_channel;
+
+  double m_noisePower;
 };
 
 
--- a/src/lte/model/rem-spectrum-phy.cc	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/model/rem-spectrum-phy.cc	Wed Feb 08 17:14:58 2012 +0100
@@ -35,9 +35,7 @@
 NS_OBJECT_ENSURE_REGISTERED (RemSpectrumPhy);
 
 RemSpectrumPhy::RemSpectrumPhy ()
-  : m_mobility (0),
-    m_netDevice (0),
-    m_channel (0),
+  : m_mobility (0),    
     m_referenceSignalPower (0),
     m_sumPower (0),
     m_active (true)
@@ -57,8 +55,6 @@
 {
   NS_LOG_FUNCTION (this);
   m_mobility = 0;
-  m_netDevice = 0;
-  m_channel = 0;
   SpectrumPhy::DoDispose ();
 }
 
@@ -68,45 +64,18 @@
   static TypeId tid = TypeId ("ns3::RemSpectrumPhy")
     .SetParent<SpectrumPhy> ()
     .AddConstructor<RemSpectrumPhy> ()
-    .AddAttribute ("NoisePower",
-                   "the power of the measuring instrument noise, in Watts. Default to a kT of -174 dBm with a noise figure of 9 dB and a bandwidth of 25 LTE Resource Blocks",
-                   DoubleValue (1.4230e-10),
-                   MakeDoubleAccessor (&RemSpectrumPhy::m_noisePower),
-                   MakeDoubleChecker<double> ())
     ;
   return tid;
 }
 
 
 
-Ptr<NetDevice>
-RemSpectrumPhy::GetDevice ()
+void
+RemSpectrumPhy::SetChannel (Ptr<SpectrumChannel> c)
 {
-  return m_netDevice;
-}
-
-
-Ptr<MobilityModel>
-RemSpectrumPhy::GetMobility ()
-{
-  return m_mobility;
+  // this is a no-op, RemSpectrumPhy does not transmit hence it does not need a reference to the channel
 }
 
-
-Ptr<const SpectrumModel>
-RemSpectrumPhy::GetRxSpectrumModel () const
-{
-  return m_spectrumModel;
-}
-
-void
-RemSpectrumPhy::SetDevice (Ptr<NetDevice> d)
-{
-  NS_LOG_FUNCTION (this << d);
-  m_netDevice = d;
-}
-
-
 void
 RemSpectrumPhy::SetMobility (Ptr<MobilityModel> m)
 {
@@ -114,19 +83,30 @@
   m_mobility = m;
 }
 
-
 void
-RemSpectrumPhy::SetChannel (Ptr<SpectrumChannel> c)
+RemSpectrumPhy::SetDevice (Ptr<NetDevice> d)
 {
-  NS_LOG_FUNCTION (this << c);
-  m_channel = c;
+  NS_LOG_FUNCTION (this << d);
+  // this is a no-op, RemSpectrumPhy does not handle any data hence it does not support the use of a NetDevice
 }
 
-void
-RemSpectrumPhy::SetRxSpectrumModel (Ptr<SpectrumModel> m)
+Ptr<MobilityModel>
+RemSpectrumPhy::GetMobility ()
+{
+  return m_mobility;
+}
+
+Ptr<NetDevice>
+RemSpectrumPhy::GetDevice ()
 {
-  NS_LOG_FUNCTION (this << m);
-  m_spectrumModel = m;
+  return 0;
+}
+
+Ptr<const SpectrumModel>
+RemSpectrumPhy::GetRxSpectrumModel () const
+{
+  // supports any SpectrumModel
+  return 0;
 }
 
 Ptr<AntennaModel>
@@ -154,9 +134,9 @@
 }
 
 double
-RemSpectrumPhy::GetSinr ()
+RemSpectrumPhy::GetSinr (double noisePower)
 {
-  return m_referenceSignalPower / (m_sumPower + m_noisePower);
+  return m_referenceSignalPower / (m_sumPower + noisePower);
 }
 
 void
--- a/src/lte/model/rem-spectrum-phy.h	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/lte/model/rem-spectrum-phy.h	Wed Feb 08 17:14:58 2012 +0100
@@ -55,9 +55,11 @@
   RemSpectrumPhy ();
   virtual ~RemSpectrumPhy ();
 
+  // inherited from Object
+  void DoDispose ();
   static TypeId GetTypeId (void);
 
-// inherited from SpectrumPhy
+  // inherited from SpectrumPhy
   void SetChannel (Ptr<SpectrumChannel> c);
   void SetMobility (Ptr<MobilityModel> m);
   void SetDevice (Ptr<NetDevice> d);
@@ -67,19 +69,12 @@
   Ptr<AntennaModel> GetRxAntenna ();
   void StartRx (Ptr<SpectrumSignalParameters> params);
 
-
-  /** 
-   * set the SpectrumModel to be used for reception
-   * 
-   */
-  void SetRxSpectrumModel (Ptr<SpectrumModel>); 
-  
   /** 
    * 
    * 
    * \return the Signal to Noise Ratio calculated 
    */
-  double GetSinr ();
+  double GetSinr (double noisePower);
 
   /** 
    * make StartRx a no-op from now on
@@ -87,18 +82,12 @@
    */
   void Deactivate ();
 
-protected:
-  void DoDispose ();
 
 private:
   Ptr<MobilityModel> m_mobility;
-  Ptr<NetDevice> m_netDevice;
-  Ptr<SpectrumChannel> m_channel;
-  Ptr<SpectrumModel> m_spectrumModel;
 
   double m_referenceSignalPower;
   double m_sumPower;
-  double m_noisePower;  
 
   bool m_active;
 
--- a/src/network/model/packet-metadata.h	Wed Feb 08 17:14:17 2012 +0100
+++ b/src/network/model/packet-metadata.h	Wed Feb 08 17:14:58 2012 +0100
@@ -22,6 +22,7 @@
 
 #include <stdint.h>
 #include <vector>
+#include <limits>
 #include "ns3/callback.h"
 #include "ns3/assert.h"
 #include "ns3/type-id.h"
@@ -210,7 +211,7 @@
                                   uint32_t maxSize);
   struct Data {
     /* number of references to this struct Data instance. */
-    uint16_t m_count;
+    uint32_t m_count;
     /* size (in bytes) of m_data buffer below */
     uint16_t m_size;
     /* max of the m_used field over all objects which 
@@ -376,6 +377,7 @@
     m_packetUid (o.m_packetUid)
 {
   NS_ASSERT (m_data != 0);
+  NS_ASSERT (m_data->m_count < std::numeric_limits<uint32_t>::max());
   m_data->m_count++;
 }
 PacketMetadata &