# HG changeset patch # User Marco Miozzo # Date 1370271712 -7200 # Node ID 1b36e2276e153cd01bde24968ad804686fd45729 # Parent 037ec40f351bacf5880ee6b96d38a8a5e6de23ae Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/examples/buildings-pathloss-profiler.cc --- a/src/buildings/examples/buildings-pathloss-profiler.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/examples/buildings-pathloss-profiler.cc Mon Jun 03 17:01:52 2013 +0200 @@ -25,6 +25,7 @@ #include "ns3/config-store.h" #include #include +#include #include #include @@ -64,7 +65,7 @@ NS_FATAL_ERROR ("Can't open output file"); } - Ptr mmEnb = CreateObject (); + Ptr mmEnb = CreateObject (); mmEnb->SetPosition (Vector (0.0, 0.0, hEnb)); if (enbIndoor) { @@ -72,7 +73,9 @@ building1->SetBuildingType (Building::Residential); building1->SetExtWallsType (Building::ConcreteWithWindows); } - + + Ptr buildingInfoEnb = Create (); + mmEnb->AggregateObject (buildingInfoEnb); // operation usually done by BuildingsHelper::Install BuildingsHelper::MakeConsistent (mmEnb); Ptr propagationLossModel = CreateObject (); @@ -86,8 +89,10 @@ //for (uint8_t i = 0; i < 23; i++) for (uint32_t i = 1; i < 2300; i++) { - Ptr mmUe = CreateObject (); - mmUe->SetPosition (Vector (i, 0.0, hUe)); + Ptr mmUe = CreateObject (); + mmUe->SetPosition (Vector (i, 0.0, hUe)); + Ptr buildingInfoUe = Create (); + mmEnb->AggregateObject (buildingInfoUe); // operation usually done by BuildingsHelper::Install BuildingsHelper::MakeConsistent (mmUe); double loss = propagationLossModel->GetLoss (mmEnb, mmUe); outFile << i << "\t" diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/helper/building-position-allocator.cc --- a/src/buildings/helper/building-position-allocator.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/helper/building-position-allocator.cc Mon Jun 03 17:01:52 2013 +0200 @@ -19,6 +19,7 @@ */ #include "building-position-allocator.h" #include "ns3/buildings-mobility-model.h" +#include "ns3/mobility-model.h" #include "ns3/buildings-helper.h" #include "ns3/random-variable-stream.h" #include "ns3/double.h" @@ -209,9 +210,9 @@ { Ptr mm = (*it)->GetObject (); NS_ASSERT_MSG (mm, "no mobility model aggregated to this node"); - Ptr bmm = DynamicCast (mm); - NS_ASSERT_MSG (bmm, "mobility model aggregated to this node is not a BuildingsMobilityModel"); - BuildingsHelper::MakeConsistent (bmm); + Ptr bmm = mm->GetObject (); + NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model"); + BuildingsHelper::MakeConsistent (mm); } } @@ -239,8 +240,8 @@ NS_LOG_LOGIC ("considering node " << (*m_nodeIt)->GetId ()); Ptr mm = (*m_nodeIt)->GetObject (); NS_ASSERT_MSG (mm, "no mobility model aggregated to this node"); - Ptr bmm = DynamicCast (mm); - NS_ASSERT_MSG (bmm, "mobility model aggregated to this node is not a BuildingsMobilityModel"); + Ptr bmm = mm->GetObject (); + NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model"); ++m_nodeIt; uint32_t roomx = bmm->GetRoomNumberX (); diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/helper/buildings-helper.cc --- a/src/buildings/helper/buildings-helper.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/helper/buildings-helper.cc Mon Jun 03 17:01:52 2013 +0200 @@ -33,6 +33,57 @@ namespace ns3 { + +void +BuildingsHelper::Install (NodeContainer c) +{ + for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) + { + Install (*i); + } +} + + +void +BuildingsHelper::Install (Ptr node) +{ + Ptr object = node; + Ptr model = object->GetObject (); + if (model == 0) + { + NS_ABORT_MSG_UNLESS (0 != model, "node " << node->GetId () << " does not have a MobilityModel"); + + } + Ptr buildingInfo = CreateObject (); + model->AggregateObject (buildingInfo); +} + + + +void +BuildingsHelper::Install (NodeContainer c, Ptr building) +{ + for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) + { + Install (*i, building); + } +} + + +void +BuildingsHelper::Install (Ptr node, Ptr building) +{ + Ptr object = node; + Ptr model = object->GetObject (); + if (model == 0) + { + NS_ABORT_MSG_UNLESS (0 != model, "node " << node->GetId () << " does not have a MobilityModel"); + + } + Ptr buildingInfo = CreateObject (building); + model->AggregateObject (buildingInfo); +} + void BuildingsHelper::MakeMobilityModelConsistent () { @@ -42,26 +93,27 @@ Ptr mm = (*nit)->GetObject (); if (mm != 0) { - Ptr bmm = DynamicCast (mm); - NS_ABORT_MSG_UNLESS (0 != bmm, "node " << (*nit)->GetId () << " has a MobilityModel but it is not a BuildingsMobilityModel"); - MakeConsistent (bmm); + MakeConsistent (mm); + Ptr bmm = mm->GetObject (); + NS_ABORT_MSG_UNLESS (0 != bmm, "node " << (*nit)->GetId () << " has a MobilityModel that does not have a MobilityBuildingInfo"); } } } void -BuildingsHelper::MakeConsistent (Ptr bmm) +BuildingsHelper::MakeConsistent (Ptr mm) { + Ptr bmm = mm->GetObject (); bool found = false; for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit) { NS_LOG_LOGIC ("checking building " << (*bit)->GetId () << " with boundaries " << (*bit)->GetBoundaries ()); - Vector pos = bmm->GetPosition (); + Vector pos = mm->GetPosition (); if ((*bit)->IsInside (pos)) { - NS_LOG_LOGIC ("BuildingsMobilityModel " << bmm << " pos " << bmm->GetPosition () << " falls inside building " << (*bit)->GetId ()); - NS_ABORT_MSG_UNLESS (found == false, " BuildingsMobilityModel already inside another building!"); + NS_LOG_LOGIC ("MobilityBuildingInfo " << bmm << " pos " << mm->GetPosition () << " falls inside building " << (*bit)->GetId ()); + NS_ABORT_MSG_UNLESS (found == false, " MobilityBuildingInfo already inside another building!"); found = true; uint16_t floor = (*bit)->GetFloor (pos); uint16_t roomX = (*bit)->GetRoomX (pos); @@ -71,7 +123,7 @@ } if (!found) { - NS_LOG_LOGIC ("BuildingsMobilityModel " << bmm << " pos " << bmm->GetPosition () << " is outdoor"); + NS_LOG_LOGIC ("MobilityBuildingInfo " << bmm << " pos " << mm->GetPosition () << " is outdoor"); bmm->SetOutdoor (); } diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/helper/buildings-helper.h --- a/src/buildings/helper/buildings-helper.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/helper/buildings-helper.h Mon Jun 03 17:01:52 2013 +0200 @@ -30,13 +30,18 @@ namespace ns3 { -class BuildingsMobilityModel; +class MobilityModel; +class Building; class BuildingsHelper { -public: +public: + static void Install (Ptr node); // for outdoor nodes + static void Install (NodeContainer c); // for outdoor nodes + static void Install (Ptr node, Ptr building); + static void Install (NodeContainer c, Ptr building); static void MakeMobilityModelConsistent (); - static void MakeConsistent (Ptr bmm); + static void MakeConsistent (Ptr bmm); }; diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/buildings-mobility-model.cc --- a/src/buildings/model/buildings-mobility-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/buildings-mobility-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -26,25 +26,25 @@ #include #include -NS_LOG_COMPONENT_DEFINE ("BuildingsMobilityModel"); +NS_LOG_COMPONENT_DEFINE ("MobilityBuildingInfo"); namespace ns3 { -NS_OBJECT_ENSURE_REGISTERED (BuildingsMobilityModel); +NS_OBJECT_ENSURE_REGISTERED (MobilityBuildingInfo); TypeId -BuildingsMobilityModel::GetTypeId (void) +MobilityBuildingInfo::GetTypeId (void) { - static TypeId tid = TypeId ("ns3::BuildingsMobilityModel") - .SetParent () - .SetGroupName ("Mobility") - .AddConstructor (); + static TypeId tid = TypeId ("ns3::MobilityBuildingInfo") + .SetParent () + .SetGroupName ("Building") + .AddConstructor (); return tid; } -BuildingsMobilityModel::BuildingsMobilityModel () +MobilityBuildingInfo::MobilityBuildingInfo () { NS_LOG_FUNCTION (this); m_indoor = false; @@ -53,49 +53,33 @@ m_roomY = 1; } -void -BuildingsMobilityModel::DoDispose (void) -{ - NS_LOG_FUNCTION (this); - MobilityModel::DoDispose (); -} -Vector -BuildingsMobilityModel::DoGetPosition (void) const +MobilityBuildingInfo::MobilityBuildingInfo (Ptr building) + : m_myBuilding (building) { NS_LOG_FUNCTION (this); - m_helper.Update (); - return m_helper.GetCurrentPosition (); -} -void -BuildingsMobilityModel::DoSetPosition (const Vector &position) -{ - NS_LOG_FUNCTION (this); - m_helper.SetPosition (position); -} -Vector -BuildingsMobilityModel::DoGetVelocity (void) const -{ - NS_LOG_FUNCTION (this); - return m_helper.GetVelocity (); + m_indoor = false; + m_nFloor = 1; + m_roomX = 1; + m_roomY = 1; } bool -BuildingsMobilityModel::IsIndoor (void) +MobilityBuildingInfo::IsIndoor (void) { NS_LOG_FUNCTION (this); return (m_indoor); } bool -BuildingsMobilityModel::IsOutdoor (void) +MobilityBuildingInfo::IsOutdoor (void) { NS_LOG_FUNCTION (this); return (!m_indoor); } void -BuildingsMobilityModel::SetIndoor (Ptr building, uint8_t nfloor, uint8_t nroomx, uint8_t nroomy) +MobilityBuildingInfo::SetIndoor (Ptr building, uint8_t nfloor, uint8_t nroomx, uint8_t nroomy) { NS_LOG_FUNCTION (this); m_indoor = true; @@ -104,7 +88,7 @@ m_roomX = nroomx; m_roomY = nroomy; - NS_ASSERT_MSG (building->IsInside (m_helper.GetCurrentPosition ()), "Position of the node is outside of building bounds"); + NS_ASSERT (m_roomX > 0); NS_ASSERT (m_roomX <= building->GetNRoomsX ()); NS_ASSERT (m_roomY > 0); @@ -116,28 +100,48 @@ void -BuildingsMobilityModel::SetOutdoor (void) +MobilityBuildingInfo::SetIndoor (uint8_t nfloor, uint8_t nroomx, uint8_t nroomy) +{ + NS_LOG_FUNCTION (this); + m_indoor = true; + m_nFloor = nfloor; + m_roomX = nroomx; + m_roomY = nroomy; + + NS_ASSERT_MSG (m_myBuilding, "Node does not have any building defined"); + NS_ASSERT (m_roomX > 0); + NS_ASSERT (m_roomX <= m_myBuilding->GetNRoomsX ()); + NS_ASSERT (m_roomY > 0); + NS_ASSERT (m_roomY <= m_myBuilding->GetNRoomsY ()); + NS_ASSERT (m_nFloor > 0); + NS_ASSERT (m_nFloor <= m_myBuilding->GetNFloors ()); + +} + + +void +MobilityBuildingInfo::SetOutdoor (void) { NS_LOG_FUNCTION (this); m_indoor = false; } uint8_t -BuildingsMobilityModel::GetFloorNumber (void) +MobilityBuildingInfo::GetFloorNumber (void) { NS_LOG_FUNCTION (this); return (m_nFloor); } uint8_t -BuildingsMobilityModel::GetRoomNumberX (void) +MobilityBuildingInfo::GetRoomNumberX (void) { NS_LOG_FUNCTION (this); return (m_roomX); } uint8_t -BuildingsMobilityModel::GetRoomNumberY (void) +MobilityBuildingInfo::GetRoomNumberY (void) { NS_LOG_FUNCTION (this); return (m_roomY); @@ -145,7 +149,7 @@ Ptr -BuildingsMobilityModel::GetBuilding () +MobilityBuildingInfo::GetBuilding () { NS_LOG_FUNCTION (this); return (m_myBuilding); diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/buildings-mobility-model.h --- a/src/buildings/model/buildings-mobility-model.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/buildings-mobility-model.h Mon Jun 03 17:01:52 2013 +0200 @@ -18,12 +18,12 @@ * Author: Marco Miozzo * */ -#ifndef BUILDINGS_MOBILITY_MODEL_H -#define BUILDINGS_MOBILITY_MODEL_H +#ifndef MOBILITY_BUILDING_INFO_H +#define MOBILITY_BUILDING_INFO_H -#include +#include #include #include #include @@ -37,43 +37,48 @@ /** - * \ingroup mobility - * \brief Buildings mobility model + * \ingroup buildings + * \brief mobility buildings information (to be used by mobility models) * * This model implements the managment of scenarios where users might be * either indoor (e.g., houses, offices, etc.) and outdoor. * */ -class BuildingsMobilityModel : public MobilityModel +class MobilityBuildingInfo : public Object { public: static TypeId GetTypeId (void); - BuildingsMobilityModel (); + MobilityBuildingInfo (); + + MobilityBuildingInfo (Ptr building); /** * - * \return true if the MobilityModel instance is indoor, false otherwise + * \return true if the MobilityBuildingInfo instance is indoor, false otherwise */ bool IsIndoor (void); /** * - * \return true if the MobilityModel instance is outdoor, false otherwise + * \return true if the MobilityBuildingInfo instance is outdoor, false otherwise */ bool IsOutdoor (void); /** - * Mark this MobilityModel instance as indoor + * Mark this MobilityBuildingInfo instance as indoor * - * \param building the building into which the MobilityModel instance is located - * \param nfloor the floor number 1...nFloors at which the MobilityModel instance is located - * \param nroomx the X room number 1...nRoomsX at which the MobilityModel instance is located - * \param nroomy the Y room number 1...nRoomsY at which the MobilityModel instance is located + * \param building the building into which the MobilityBuildingInfo instance is located + * \param nfloor the floor number 1...nFloors at which the MobilityBuildingInfo instance is located + * \param nroomx the X room number 1...nRoomsX at which the MobilityBuildingInfo instance is located + * \param nroomy the Y room number 1...nRoomsY at which the MobilityBuildingInfo instance is located */ void SetIndoor (Ptr building, uint8_t nfloor, uint8_t nroomx, uint8_t nroomy); + + void SetIndoor (uint8_t nfloor, uint8_t nroomx, uint8_t nroomy); + /** - * Mark this MobilityModel instance as outdoor + * Mark this MobilityBuildingInfo instance as outdoor * */ void SetOutdoor (); @@ -105,11 +110,6 @@ private: - virtual void DoDispose (void); - virtual Vector DoGetPosition (void) const; - virtual void DoSetPosition (const Vector &position); - virtual Vector DoGetVelocity (void) const; - ConstantVelocityHelper m_helper; Ptr m_myBuilding; bool m_indoor; @@ -124,4 +124,4 @@ } // namespace ns3 -#endif // BUILDINGS_MOBILITY_MODEL_H +#endif // MOBILITY_BUILDING_INFO_H diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/buildings-propagation-loss-model.cc --- a/src/buildings/model/buildings-propagation-loss-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/buildings-propagation-loss-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -100,7 +100,7 @@ } double -BuildingsPropagationLossModel::ExternalWallLoss (Ptr a) const +BuildingsPropagationLossModel::ExternalWallLoss (Ptr a) const { double loss = 0.0; Ptr aBuilding = a->GetBuilding (); @@ -124,7 +124,7 @@ } double -BuildingsPropagationLossModel::HeightLoss (Ptr node) const +BuildingsPropagationLossModel::HeightLoss (Ptr node) const { double loss = 0.0; @@ -134,7 +134,7 @@ } double -BuildingsPropagationLossModel::InternalWallsLoss (Ptr a, Ptrb) const +BuildingsPropagationLossModel::InternalWallsLoss (Ptr a, Ptrb) const { // approximate the number of internal walls with the Manhattan distance in "rooms" units double dx = std::abs (a->GetRoomNumberX () - b->GetRoomNumberX ()); @@ -148,9 +148,9 @@ BuildingsPropagationLossModel::GetShadowing (Ptr a, Ptr b) const { - Ptr a1 = DynamicCast (a); - Ptr b1 = DynamicCast (b); - NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "BuildingsPropagationLossModel only works with BuildingsMobilityModel"); + Ptr a1 = a->GetObject (); + Ptr b1 = b->GetObject (); + NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "BuildingsPropagationLossModel only works with MobilityBuildingInfo"); std::map, std::map, ShadowingLoss> >::iterator ait = m_shadowingLossMap.find (a); if (ait != m_shadowingLossMap.end ()) @@ -184,7 +184,7 @@ double -BuildingsPropagationLossModel::EvaluateSigma (Ptr a, Ptr b) +BuildingsPropagationLossModel::EvaluateSigma (Ptr a, Ptr b) const { if (a->IsOutdoor ()) diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/buildings-propagation-loss-model.h --- a/src/buildings/model/buildings-propagation-loss-model.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/buildings-propagation-loss-model.h Mon Jun 03 17:01:52 2013 +0200 @@ -48,7 +48,8 @@ * The distance-dependent component of propagation loss is deferred * to derived classes which are expected to implement the GetLoss method. * - * \warning This model works only with BuildingsMobilityModel + * \warning This model works only when MobilityBuildingInfo is aggreegated + * to the mobility model * */ @@ -70,9 +71,9 @@ virtual double DoCalcRxPower (double txPowerDbm, Ptr a, Ptr b) const; protected: - double ExternalWallLoss (Ptr a) const; - double HeightLoss (Ptr n) const; - double InternalWallsLoss (Ptr a, Ptr b) const; + double ExternalWallLoss (Ptr a) const; + double HeightLoss (Ptr n) const; + double InternalWallsLoss (Ptr a, Ptr b) const; double GetShadowing (Ptr a, Ptr b) const; @@ -92,7 +93,7 @@ }; mutable std::map, std::map, ShadowingLoss> > m_shadowingLossMap; - double EvaluateSigma (Ptr a, Ptr b) const; + double EvaluateSigma (Ptr a, Ptr b) const; double m_shadowingSigmaExtWalls; diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/hybrid-buildings-propagation-loss-model.cc --- a/src/buildings/model/hybrid-buildings-propagation-loss-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/hybrid-buildings-propagation-loss-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -146,10 +146,10 @@ double distance = a->GetDistanceFrom (b); - // get the BuildingsMobilityModel pointers - Ptr a1 = DynamicCast (a); - Ptr b1 = DynamicCast (b); - NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "HybridBuildingsPropagationLossModel only works with BuildingsMobilityModel"); + // get the MobilityBuildingInfo pointers + Ptr a1 = a->GetObject (); + Ptr b1 = b->GetObject (); + NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "HybridBuildingsPropagationLossModel only works with MobilityBuildingInfo"); double loss = 0.0; @@ -159,24 +159,24 @@ { if (distance > 1000) { - NS_LOG_INFO (this << a1->GetPosition ().z << b1->GetPosition ().z << m_rooftopHeight); - if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + NS_LOG_INFO (this << a->GetPosition ().z << b->GetPosition ().z << m_rooftopHeight); + if ((a->GetPosition ().z < m_rooftopHeight) + && (b->GetPosition ().z < m_rooftopHeight)) { - loss = ItuR1411 (a1, b1); + loss = ItuR1411 (a, b); NS_LOG_INFO (this << " 0-0 (>1000): below rooftop -> ITUR1411 : " << loss); } else { // Over the rooftop tranmission -> Okumura Hata - loss = OkumuraHata (a1, b1); + loss = OkumuraHata (a, b); NS_LOG_INFO (this << " O-O (>1000): above rooftop -> OH : " << loss); } } else { // short range outdoor communication - loss = ItuR1411 (a1, b1); + loss = ItuR1411 (a, b); NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss); } } @@ -185,21 +185,21 @@ // b indoor if (distance > 1000) { - if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + if ((a->GetPosition ().z < m_rooftopHeight) + && (b->GetPosition ().z < m_rooftopHeight)) { - loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (a1); + loss = ItuR1411 (a, b) + ExternalWallLoss (b1) + HeightLoss (b1); NS_LOG_INFO (this << " 0-I (>1000): below rooftop -> ITUR1411 : " << loss); } else { - loss = OkumuraHata (a1, b1) + ExternalWallLoss (b1); + loss = OkumuraHata (a, b) + ExternalWallLoss (b1); NS_LOG_INFO (this << " O-I (>1000): above the rooftop -> OH : " << loss); } } else { - loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (b1); + loss = ItuR1411 (a, b) + ExternalWallLoss (b1) + HeightLoss (b1); NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss); } } // end b1->isIndoor () @@ -212,14 +212,14 @@ if (a1->GetBuilding () == b1->GetBuilding ()) { // nodes are in same building -> indoor communication ITU-R P.1238 - loss = ItuR1238 (a1, b1) + InternalWallsLoss (a1, b1);; + loss = ItuR1238 (a, b) + InternalWallsLoss (a1, b1);; NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss); } else { // nodes are in different buildings - loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); + loss = ItuR1411 (a, b) + ExternalWallLoss (a1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss); } } @@ -228,22 +228,22 @@ // b is outdoor if (distance > 1000) { - if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + if ((a->GetPosition ().z < m_rooftopHeight) + && (b->GetPosition ().z < m_rooftopHeight)) { - loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); + loss = ItuR1411 (a, b) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss); } else { // above rooftop -> OH - loss = OkumuraHata (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); + loss = OkumuraHata (a, b) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss); } } else { - loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1); + loss = ItuR1411 (a, b) + ExternalWallLoss (a1) + HeightLoss (a1); NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss); } } // end b1->IsIndoor () @@ -256,7 +256,7 @@ double -HybridBuildingsPropagationLossModel::OkumuraHata (Ptr a, Ptr b) const +HybridBuildingsPropagationLossModel::OkumuraHata (Ptr a, Ptr b) const { if (m_frequency <= 2.3e9) { @@ -269,7 +269,7 @@ } double -HybridBuildingsPropagationLossModel::ItuR1411 (Ptr a, Ptr b) const +HybridBuildingsPropagationLossModel::ItuR1411 (Ptr a, Ptr b) const { if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold) { @@ -282,7 +282,7 @@ } double -HybridBuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr b) const +HybridBuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr b) const { return m_ituR1238->GetLoss (a,b); } diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/hybrid-buildings-propagation-loss-model.h --- a/src/buildings/model/hybrid-buildings-propagation-loss-model.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/hybrid-buildings-propagation-loss-model.h Mon Jun 03 17:01:52 2013 +0200 @@ -49,7 +49,7 @@ * - Building penetretation loss * - floors, etc... * - * \warning This model works only with BuildingsMobilityModel + * \warning This model works only with MobilityBuildingInfo * */ @@ -100,9 +100,9 @@ private: - double OkumuraHata (Ptr a, Ptr b) const; - double ItuR1411 (Ptr a, Ptr b) const; - double ItuR1238 (Ptr a, Ptr b) const; + double OkumuraHata (Ptr a, Ptr b) const; + double ItuR1411 (Ptr a, Ptr b) const; + double ItuR1238 (Ptr a, Ptr b) const; Ptr m_okumuraHata; Ptr m_ituR1411Los; diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/itu-r-1238-propagation-loss-model.cc --- a/src/buildings/model/itu-r-1238-propagation-loss-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/itu-r-1238-propagation-loss-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -55,9 +55,9 @@ ItuR1238PropagationLossModel::GetLoss (Ptr a1, Ptr b1) const { NS_LOG_FUNCTION (this << a1 << b1); - Ptr a = DynamicCast (a1); - Ptr b = DynamicCast (b1); - NS_ASSERT_MSG ((a != 0) && (b != 0), "ItuR1238PropagationLossModel only works with BuildingsMobilityModel"); + Ptr a = a1->GetObject (); + Ptr b = b1->GetObject (); + NS_ASSERT_MSG ((a != 0) && (b != 0), "ItuR1238PropagationLossModel only works with MobilityBuildingInfo"); NS_ASSERT_MSG (a->GetBuilding ()->GetId () == b->GetBuilding ()->GetId (), "ITU-R 1238 applies only to nodes that are in the same building"); double N = 0.0; int n = std::abs (a->GetFloorNumber () - b->GetFloorNumber ()); @@ -95,8 +95,8 @@ { NS_LOG_ERROR (this << " Unkwnon Wall Type"); } - double loss = 20 * std::log10 (m_frequency / 1e6 /*MHz*/) + N * std::log10 (a->GetDistanceFrom (b)) + Lf - 28.0; - NS_LOG_INFO (this << " Node " << a->GetPosition () << " <-> " << b->GetPosition () << " loss = " << loss << " dB"); + double loss = 20 * std::log10 (m_frequency / 1e6 /*MHz*/) + N * std::log10 (a1->GetDistanceFrom (b1)) + Lf - 28.0; + NS_LOG_INFO (this << " Node " << a1->GetPosition () << " <-> " << b1->GetPosition () << " loss = " << loss << " dB"); return loss; } diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/oh-buildings-propagation-loss-model.cc --- a/src/buildings/model/oh-buildings-propagation-loss-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/oh-buildings-propagation-loss-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -66,9 +66,9 @@ { NS_LOG_FUNCTION (this << a << b); - // get the BuildingsMobilityModel pointers - Ptr a1 = DynamicCast (a); - Ptr b1 = DynamicCast (b); + // get the MobilityBuildingInfo pointers + Ptr a1 = DynamicCast (a); + Ptr b1 = DynamicCast (b); NS_ASSERT_MSG ((a1 != 0) && (b1 != 0), "OhBuildingsPropagationLossModel only works with BuildingsMobilityModel"); double loss = 0.0; @@ -77,13 +77,13 @@ { if (b1->IsOutdoor ()) { - loss = m_okumuraHata->GetLoss (a1, b1); + loss = m_okumuraHata->GetLoss (a, b); NS_LOG_INFO (this << " O-O : " << loss); } else { // b indoor - loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (b1); + loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (b1); NS_LOG_INFO (this << " O-I : " << loss); } // end b1->isIndoor () } @@ -95,20 +95,20 @@ if (a1->GetBuilding () == b1->GetBuilding ()) { // nodes are in same building -> indoor communication ITU-R P.1238 - loss = m_okumuraHata->GetLoss (a1, b1) + InternalWallsLoss (a1, b1);; + loss = m_okumuraHata->GetLoss (a, b) + InternalWallsLoss (a1, b1);; NS_LOG_INFO (this << " I-I (same building)" << loss); } else { // nodes are in different buildings - loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); + loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " I-O-I (different buildings): " << loss); } } else { - loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (a1); + loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1); NS_LOG_INFO (this << " I-O : " << loss); } // end b1->IsIndoor () } // end a1->IsOutdoor () diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/model/oh-buildings-propagation-loss-model.h --- a/src/buildings/model/oh-buildings-propagation-loss-model.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/model/oh-buildings-propagation-loss-model.h Mon Jun 03 17:01:52 2013 +0200 @@ -33,7 +33,7 @@ * * this model combines the OkumuraHata model with the BuildingsPropagationLossModel * - * \warning This model works with BuildingsMobilityModel only + * \warning This model works with MobilityBuildingInfo only * */ class OhBuildingsPropagationLossModel : public BuildingsPropagationLossModel diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/test/building-position-allocator-test.cc --- a/src/buildings/test/building-position-allocator-test.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/test/building-position-allocator-test.cc Mon Jun 03 17:01:52 2013 +0200 @@ -24,6 +24,8 @@ #include "ns3/test.h" #include #include +#include +#include #include #include #include @@ -95,10 +97,11 @@ nodes.Create (24); MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); Ptr positionAlloc = CreateObject (); mobility.SetPositionAllocator (positionAlloc); mobility.Install (nodes); + BuildingsHelper::Install (nodes); BuildingsHelper::MakeMobilityModelConsistent (); @@ -108,14 +111,14 @@ { Ptr mm = (*it)->GetObject (); NS_ASSERT_MSG (mm, "no mobility model aggregated to this node"); - Ptr bmm = DynamicCast (mm); - NS_ASSERT_MSG (bmm, "mobility model aggregated to this node is not a BuildingsMobilityModel"); + Ptr bmm = mm->GetObject (); + NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model"); NS_TEST_ASSERT_MSG_EQ (bmm->IsIndoor (), true, "node should be indoor"); Room r (bmm->GetRoomNumberX (), bmm->GetRoomNumberY (), bmm->GetFloorNumber ()); ++(roomCounter[r]); - Vector p = bmm->GetPosition (); + Vector p = mm->GetPosition (); NS_TEST_ASSERT_MSG_GT (p.x, bmm->GetRoomNumberX (), "wrong x value"); NS_TEST_ASSERT_MSG_LT (p.x, bmm->GetRoomNumberX () + 1, "wrong x value"); NS_TEST_ASSERT_MSG_GT (p.y, bmm->GetRoomNumberY (), "wrong y value"); @@ -176,16 +179,18 @@ nodes.Create (24); MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); Ptr positionAlloc = CreateObject (); mobility.SetPositionAllocator (positionAlloc); mobility.Install (nodes); + BuildingsHelper::Install (nodes); NodeContainer copyNodes; copyNodes.Create (48); positionAlloc = CreateObject (nodes); mobility.SetPositionAllocator (positionAlloc); mobility.Install (copyNodes); + BuildingsHelper::Install (copyNodes); BuildingsHelper::MakeMobilityModelConsistent (); @@ -195,8 +200,8 @@ { Ptr mm = (*it)->GetObject (); NS_ASSERT_MSG (mm, "no mobility model aggregated to this node"); - Ptr bmm = DynamicCast (mm); - NS_ASSERT_MSG (bmm, "mobility model aggregated to this node is not a BuildingsMobilityModel"); + Ptr bmm = mm->GetObject (); + NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model"); NS_TEST_ASSERT_MSG_EQ (bmm->IsIndoor (), true, "node should be indoor"); Room r (bmm->GetRoomNumberX (), bmm->GetRoomNumberY (), bmm->GetFloorNumber ()); diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/test/buildings-helper-test.cc --- a/src/buildings/test/buildings-helper-test.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/test/buildings-helper-test.cc Mon Jun 03 17:01:52 2013 +0200 @@ -23,6 +23,7 @@ #include "ns3/log.h" #include "ns3/test.h" #include +#include #include #include #include @@ -133,13 +134,13 @@ { NS_LOG_FUNCTION (this << BuildNameString (m_pib, m_bd)); MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); NodeContainer nodes; nodes.Create (1); mobility.Install (nodes); - Ptr bmm = nodes.Get (0)->GetObject (); + Ptr bmm = nodes.Get (0)->GetObject (); bmm->SetPosition (m_pib.pos); NS_LOG_LOGIC ("create building"); @@ -148,19 +149,20 @@ b->SetNFloors (m_bd.nf); b->SetNRoomsX (m_bd.nrx); b->SetNRoomsY (m_bd.nry); - + Ptr buildingInfo = CreateObject (b); + bmm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install BuildingsHelper::MakeMobilityModelConsistent (); - NS_TEST_ASSERT_MSG_EQ (bmm->IsIndoor (), m_pib.indoor, "indoor/outdoor mismatch"); + NS_TEST_ASSERT_MSG_EQ (buildingInfo->IsIndoor (), m_pib.indoor, "indoor/outdoor mismatch"); if (m_pib.indoor) { - NS_LOG_LOGIC (" got bid=" << bmm->GetBuilding ()->GetId () << ", f=" << (uint32_t) bmm->GetFloorNumber () << ", rx=" << (uint32_t) bmm->GetRoomNumberX () << ", roomY=" << (uint32_t) bmm->GetRoomNumberY ()); + NS_LOG_LOGIC (" got bid=" << buildingInfo->GetBuilding ()->GetId () << ", f=" << (uint32_t) buildingInfo->GetFloorNumber () << ", rx=" << (uint32_t) buildingInfo->GetRoomNumberX () << ", roomY=" << (uint32_t) buildingInfo->GetRoomNumberY ()); // only one building in this test, so Id will be 0 - NS_TEST_ASSERT_MSG_EQ (bmm->GetBuilding ()->GetId (), 0, "Building ID mismatch"); - NS_TEST_ASSERT_MSG_EQ ((uint32_t) bmm->GetFloorNumber (), m_pib.fn, "floor number mismatch"); - NS_TEST_ASSERT_MSG_EQ ((uint32_t) bmm->GetRoomNumberX (), m_pib.rx, "x room number mismatch"); - NS_TEST_ASSERT_MSG_EQ ((uint32_t) bmm->GetRoomNumberY (), m_pib.ry, "y room number mismatch"); + NS_TEST_ASSERT_MSG_EQ (buildingInfo->GetBuilding ()->GetId (), 0, "Building ID mismatch"); + NS_TEST_ASSERT_MSG_EQ ((uint32_t) buildingInfo->GetFloorNumber (), m_pib.fn, "floor number mismatch"); + NS_TEST_ASSERT_MSG_EQ ((uint32_t) buildingInfo->GetRoomNumberX (), m_pib.rx, "x room number mismatch"); + NS_TEST_ASSERT_MSG_EQ ((uint32_t) buildingInfo->GetRoomNumberY (), m_pib.ry, "y room number mismatch"); } Simulator::Destroy (); diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/test/buildings-pathloss-test.cc --- a/src/buildings/test/buildings-pathloss-test.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/test/buildings-pathloss-test.cc Mon Jun 03 17:01:52 2013 +0200 @@ -28,10 +28,12 @@ #include #include #include +#include #include "buildings-pathloss-test.h" + NS_LOG_COMPONENT_DEFINE ("BuildingsPathlossTest"); namespace ns3 { @@ -201,62 +203,62 @@ double hb = 30; double henbHeight = 10.0; - Ptr mm; + Ptr mm; switch (index) { case 1: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (0.0, 0.0, hb)); break; case 2: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (2000, 0.0, hm)); break; case 3: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (100, 0.0, hm)); break; case 4: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (900, 0.0, hm)); break; case 5: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-5, 0.0, hm)); break; case 6: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-5, 30, henbHeight)); break; case 7: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-2000, 0.0, hm)); break; case 8: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-100, 0.0, hm)); break; case 9: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (0, 0.0, hm)); break; case 10: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-100, 0.0, henbHeight)); break; case 11: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-500, 0.0, henbHeight)); break; @@ -264,6 +266,8 @@ mm = 0; break; } + Ptr buildingInfo = CreateObject (); + mm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install BuildingsHelper::MakeConsistent (mm); return mm; } diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/test/buildings-pathloss-test.h --- a/src/buildings/test/buildings-pathloss-test.h Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/test/buildings-pathloss-test.h Mon Jun 03 17:01:52 2013 +0200 @@ -22,7 +22,7 @@ #define BUILDINGS_PATHLOSS_TEST_H #include -#include +// #include #include diff -r 037ec40f351b -r 1b36e2276e15 src/buildings/test/buildings-shadowing-test.cc --- a/src/buildings/test/buildings-shadowing-test.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/buildings/test/buildings-shadowing-test.cc Mon Jun 03 17:01:52 2013 +0200 @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include #include "buildings-shadowing-test.h" @@ -142,62 +145,62 @@ double hb = 30; double henbHeight = 10.0; - Ptr mm; + Ptr mm; switch (index) { case 1: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (0.0, 0.0, hb)); break; case 2: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (2000, 0.0, hm)); break; case 3: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (100, 0.0, hm)); break; case 4: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (900, 0.0, hm)); break; case 5: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-5, 0.0, hm)); break; case 6: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-5, 30, henbHeight)); break; case 7: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-2000, 0.0, hm)); break; case 8: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-100, 0.0, hm)); break; case 9: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (0, 0.0, hm)); break; case 10: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-100, 0.0, henbHeight)); break; case 11: - mm = CreateObject (); + mm = CreateObject (); mm->SetPosition (Vector (-500, 0.0, henbHeight)); break; @@ -205,6 +208,8 @@ mm = 0; break; } + Ptr buildingInfo = CreateObject (); + mm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install BuildingsHelper::MakeConsistent (mm); return mm; } diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-cqi-threshold.cc --- a/src/lte/examples/lena-cqi-threshold.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-cqi-threshold.cc Mon Jun 03 17:01:52 2013 +0200 @@ -24,6 +24,7 @@ #include "ns3/mobility-module.h" #include "ns3/lte-module.h" #include "ns3/config-store.h" +#include //#include "ns3/gtk-config-store.h" using namespace ns3; @@ -90,10 +91,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-dual-stripe.cc --- a/src/lte/examples/lena-dual-stripe.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-dual-stripe.cc Mon Jun 03 17:01:52 2013 +0200 @@ -464,7 +464,7 @@ macroUes.Create (nMacroUes); MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); Ptr lteHelper = CreateObject (); @@ -496,6 +496,7 @@ // Macro eNBs in 3-sector hex grid mobility.Install (macroEnbs); + BuildingsHelper::Install (macroEnbs); Ptr lteHexGridEnbTopologyHelper = CreateObject (); lteHexGridEnbTopologyHelper->SetLteHelper (lteHelper); lteHexGridEnbTopologyHelper->SetAttribute ("InterSiteDistance", DoubleValue (interSiteDistance)); @@ -517,6 +518,7 @@ Ptr positionAlloc = CreateObject (); mobility.SetPositionAllocator (positionAlloc); mobility.Install (homeEnbs); + BuildingsHelper::Install (homeEnbs); Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (homeEnbTxPowerDbm)); lteHelper->SetEnbAntennaModelType ("ns3::IsotropicAntennaModel"); lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (homeEnbDlEarfcn)); @@ -543,6 +545,8 @@ positionAlloc->SetAttribute ("Z", PointerValue (zVal)); mobility.SetPositionAllocator (positionAlloc); mobility.Install (macroUes); + BuildingsHelper::Install (macroUes); + NetDeviceContainer macroUeDevs = lteHelper->InstallUeDevice (macroUes); @@ -550,6 +554,7 @@ positionAlloc = CreateObject (homeEnbs); mobility.SetPositionAllocator (positionAlloc); mobility.Install (homeUes); + BuildingsHelper::Install (homeUes); NetDeviceContainer homeUeDevs = lteHelper->InstallUeDevice (homeUes); Ipv4Address remoteHostAddr; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-fading.cc --- a/src/lte/examples/lena-fading.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-fading.cc Mon Jun 03 17:01:52 2013 +0200 @@ -26,6 +26,7 @@ #include "ns3/config-store.h" #include #include +#include //#include "ns3/gtk-config-store.h" using namespace ns3; @@ -86,10 +87,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-profiling.cc --- a/src/lte/examples/lena-profiling.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-profiling.cc Mon Jun 03 17:01:52 2013 +0200 @@ -91,7 +91,7 @@ } MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); std::vector enbPosition; Ptr positionAlloc = CreateObject (); Ptr building; @@ -112,6 +112,7 @@ } mobility.SetPositionAllocator (positionAlloc); mobility.Install (enbNodes); + BuildingsHelper::Install (enbNodes); // Position of UEs attached to eNB for (uint32_t i = 0; i < nEnb; i++) @@ -129,6 +130,7 @@ mobility.SetPositionAllocator (positionAlloc); } mobility.Install (ueNodes.at(i)); + BuildingsHelper::Install (ueNodes.at(i)); } } @@ -144,6 +146,7 @@ building->SetNRoomsX (nRooms); building->SetNRoomsY (nRooms); mobility.Install (enbNodes); + BuildingsHelper::Install (enbNodes); uint32_t plantedEnb = 0; for (uint32_t floor = 0; floor < nFloors; floor++) { @@ -157,14 +160,15 @@ nodeHeight + roomHeight * floor); positionAlloc->Add (v); enbPosition.push_back (v); - Ptr mmEnb = enbNodes.Get (plantedEnb)->GetObject (); + Ptr mmEnb = enbNodes.Get (plantedEnb)->GetObject (); mmEnb->SetPosition (v); // Positioning UEs attached to eNB mobility.Install (ueNodes.at(plantedEnb)); + BuildingsHelper::Install (ueNodes.at(plantedEnb)); for (uint32_t ue = 0; ue < nUe; ue++) { - Ptr mmUe = ueNodes.at(plantedEnb).Get (ue)->GetObject (); + Ptr mmUe = ueNodes.at(plantedEnb).Get (ue)->GetObject (); Vector vUe (v.x, v.y, v.z); mmUe->SetPosition (vUe); } diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-rem-sector-antenna.cc --- a/src/lte/examples/lena-rem-sector-antenna.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-rem-sector-antenna.cc Mon Jun 03 17:01:52 2013 +0200 @@ -91,8 +91,9 @@ building->SetNFloors (1); building->SetNRoomsX (nRooms); building->SetNRoomsY (nRooms); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); + BuildingsHelper::Install (enbNodes); uint32_t plantedEnb = 0; for (uint32_t row = 0; row < nRooms; row++) { @@ -103,7 +104,7 @@ nodeHeight ); positionAlloc->Add (v); enbPosition.push_back (v); - Ptr mmEnb = enbNodes.Get (plantedEnb)->GetObject (); + Ptr mmEnb = enbNodes.Get (plantedEnb)->GetObject (); mmEnb->SetPosition (v); } } @@ -159,6 +160,7 @@ mobility.SetPositionAllocator (positionAlloc); } mobility.Install (ueNodes.at(i)); + BuildingsHelper::Install (ueNodes.at(i)); } // Create Devices and install them in the Nodes (eNB and UE) @@ -202,7 +204,6 @@ lteHelper->ActivateDataRadioBearer (ueDev, bearer); } - BuildingsHelper::MakeMobilityModelConsistent (); // by default, simulation will anyway stop right after the REM has been generated diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-rem.cc --- a/src/lte/examples/lena-rem.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-rem.cc Mon Jun 03 17:01:52 2013 +0200 @@ -61,10 +61,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/examples/lena-simple.cc --- a/src/lte/examples/lena-simple.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/examples/lena-simple.cc Mon Jun 03 17:01:52 2013 +0200 @@ -24,6 +24,7 @@ #include "ns3/mobility-module.h" #include "ns3/lte-module.h" #include "ns3/config-store.h" +#include //#include "ns3/gtk-config-store.h" using namespace ns3; @@ -58,10 +59,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/helper/radio-environment-map-helper.cc --- a/src/lte/helper/radio-environment-map-helper.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/helper/radio-environment-map-helper.cc Mon Jun 03 17:01:52 2013 +0200 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -210,9 +211,11 @@ { RemPoint p; p.phy = CreateObject (); - p.bmm = CreateObject (); + p.bmm = CreateObject (); + Ptr buildingInfo = CreateObject (); + p.bmm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install p.phy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (m_earfcn, m_bandwidth)); - p.phy->SetMobility (p.bmm); + p.phy->SetMobility (p.bmm); m_channel->AddRx (p.phy); m_rem.push_back (p); } diff -r 037ec40f351b -r 1b36e2276e15 src/lte/helper/radio-environment-map-helper.h --- a/src/lte/helper/radio-environment-map-helper.h Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/helper/radio-environment-map-helper.h Mon Jun 03 17:01:52 2013 +0200 @@ -33,7 +33,8 @@ class Node; class NetDevice; class SpectrumChannel; -class BuildingsMobilityModel; +//class BuildingsMobilityModel; +class MobilityModel; /** * Generates a 2D map of the SINR from the strongest transmitter in the downlink of an LTE FDD system. @@ -78,7 +79,7 @@ struct RemPoint { Ptr phy; - Ptr bmm; + Ptr bmm; }; std::list m_rem; diff -r 037ec40f351b -r 1b36e2276e15 src/lte/test/lte-test-harq.cc --- a/src/lte/test/lte-test-harq.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/test/lte-test-harq.cc Mon Jun 03 17:01:52 2013 +0200 @@ -48,6 +48,7 @@ #include #include #include +#include #include "lte-test-harq.h" @@ -171,10 +172,13 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // remove random shadowing component lena->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel")); @@ -205,13 +209,13 @@ enbPhy->SetAttribute ("TxPower", DoubleValue (43.0)); enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); // place the HeNB over the default rooftop level (20 mt.) - Ptr mm = enbNodes.Get (0)->GetObject (); + Ptr mm = enbNodes.Get (0)->GetObject (); mm->SetPosition (Vector (0.0, 0.0, 30.0)); // Set UEs' position and power for (int i = 0; i < m_nUser; i++) { - Ptr mm = ueNodes.Get (i)->GetObject (); + Ptr mm = ueNodes.Get (i)->GetObject (); mm->SetPosition (Vector (m_dist, 0.0, 1.0)); Ptr lteUeDev = ueDevs.Get (i)->GetObject (); Ptr uePhy = lteUeDev->GetPhy (); diff -r 037ec40f351b -r 1b36e2276e15 src/lte/test/lte-test-mimo.cc --- a/src/lte/test/lte-test-mimo.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/test/lte-test-mimo.cc Mon Jun 03 17:01:52 2013 +0200 @@ -51,6 +51,7 @@ #include #include #include +#include #include "lte-test-mimo.h" @@ -147,10 +148,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; @@ -172,11 +175,11 @@ Ptr enbPhy = lteEnbDev->GetPhy (); enbPhy->SetAttribute ("TxPower", DoubleValue (46.0)); enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); - Ptr mmenb = enbNodes.Get (0)->GetObject (); + Ptr mmenb = enbNodes.Get (0)->GetObject (); mmenb->SetPosition (Vector (0.0, 0.0, 30.0)); // Set UE's position and power - Ptr mmue = ueNodes.Get (0)->GetObject (); + Ptr mmue = ueNodes.Get (0)->GetObject (); mmue->SetPosition (Vector (m_dist, 0.0, 1.0)); Ptr lteUeDev = ueDevs.Get (0)->GetObject (); Ptr uePhy = lteUeDev->GetPhy (); diff -r 037ec40f351b -r 1b36e2276e15 src/lte/test/lte-test-pathloss-model.cc --- a/src/lte/test/lte-test-pathloss-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/test/lte-test-pathloss-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include "ns3/string.h" @@ -231,8 +232,10 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (allNodes); + BuildingsHelper::Install (allNodes); + // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; @@ -241,9 +244,9 @@ enbDevs = lteHelper->InstallEnbDevice (enbNodes); ueDevs = lteHelper->InstallUeDevice (ueNodes); - Ptr mm_enb = enbNodes.Get (0)->GetObject (); + Ptr mm_enb = enbNodes.Get (0)->GetObject (); mm_enb->SetPosition (Vector (0.0, 0.0, 30.0)); - Ptr mm_ue = ueNodes.Get (0)->GetObject (); + Ptr mm_ue = ueNodes.Get (0)->GetObject (); mm_ue->SetPosition (Vector (m_distance, 0.0, 1.0)); Ptr lteEnbDev = enbDevs.Get (0)->GetObject (); diff -r 037ec40f351b -r 1b36e2276e15 src/lte/test/lte-test-phy-error-model.cc --- a/src/lte/test/lte-test-phy-error-model.cc Tue May 28 11:53:33 2013 +0200 +++ b/src/lte/test/lte-test-phy-error-model.cc Mon Jun 03 17:01:52 2013 +0200 @@ -47,6 +47,7 @@ #include #include #include +#include #include "lte-test-phy-error-model.h" @@ -183,10 +184,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // remove random shadowing component lena->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel")); @@ -217,13 +220,13 @@ enbPhy->SetAttribute ("TxPower", DoubleValue (43.0)); enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); // place the HeNB over the default rooftop level (20 mt.) - Ptr mm = enbNodes.Get (0)->GetObject (); + Ptr mm = enbNodes.Get (0)->GetObject (); mm->SetPosition (Vector (0.0, 0.0, 30.0)); // Set UEs' position and power for (int i = 0; i < m_nUser; i++) { - Ptr mm = ueNodes.Get (i)->GetObject (); + Ptr mm = ueNodes.Get (i)->GetObject (); mm->SetPosition (Vector (m_dist, 0.0, 1.0)); Ptr lteUeDev = ueDevs.Get (i)->GetObject (); Ptr uePhy = lteUeDev->GetPhy (); @@ -368,10 +371,12 @@ // Install Mobility Model MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); + BuildingsHelper::Install (enbNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (ueNodes); + BuildingsHelper::Install (ueNodes); // remove random shadowing component lena->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel")); @@ -400,7 +405,7 @@ for (int i = 0; i < m_nEnb; i++) { // place the HeNB over the default rooftop level (20 mt.) - Ptr mm = enbNodes.Get (i)->GetObject (); + Ptr mm = enbNodes.Get (i)->GetObject (); mm->SetPosition (Vector (0.0, 0.0, 30.0)); Ptr lteEnbDev = enbDevs.Get (i)->GetObject (); Ptr enbPhy = lteEnbDev->GetPhy (); @@ -409,7 +414,7 @@ } // Set UEs' position and power - Ptr mm = ueNodes.Get (0)->GetObject (); + Ptr mm = ueNodes.Get (0)->GetObject (); mm->SetPosition (Vector (m_dist, 0.0, 1.0)); Ptr lteUeDev = ueDevs.Get (0)->GetObject (); Ptr uePhy = lteUeDev->GetPhy ();