diff --git a/doc/models/Makefile b/doc/models/Makefile index 5f15b3508..180c88dd3 100644 --- a/doc/models/Makefile +++ b/doc/models/Makefile @@ -36,6 +36,7 @@ SOURCES = \ $(SRC)/lte/doc/source/lte-user.rst \ $(SRC)/lte/doc/source/lte-design.rst \ $(SRC)/lte/doc/source/lte-testing.rst \ + $(SRC)/lte/doc/source/lte-profiling.rst \ $(SRC)/lte/doc/source/lte-references.rst \ $(SRC)/propagation/doc/propagation.rst \ $(SRC)/network/doc/network-overview.rst \ diff --git a/src/buildings/model/building.cc b/src/buildings/model/building.cc index f58a4a02e..5cf397e40 100644 --- a/src/buildings/model/building.cc +++ b/src/buildings/model/building.cc @@ -28,15 +28,15 @@ namespace ns3 { Building::Building (double _xMin, double _xMax, - double _yMin, double _yMax, - double _zMin, double _zMax/*, - uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/) : - m_floor (1), - m_roomX (1), - m_roomY (1), - m_buildingType (Residential), - m_externalWalls (ConcreteWithWindows) - + double _yMin, double _yMax, + double _zMin, double _zMax/*, + uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/) + : m_floor (1), + m_roomX (1), + m_roomY (1), + m_buildingType (Residential), + m_externalWalls (ConcreteWithWindows) + { m_buldingBounds = Box (_xMin, _xMax, _yMin, _yMax, _zMin, _zMax); } diff --git a/src/buildings/model/building.h b/src/buildings/model/building.h index c9f9c8b9f..7ada6f77a 100644 --- a/src/buildings/model/building.h +++ b/src/buildings/model/building.h @@ -37,15 +37,14 @@ namespace ns3 { class Building : public SimpleRefCount { public: - enum BuildingType_t - { - Residential, Office, Commercial - }; + { + Residential, Office, Commercial + }; enum ExtWallsType_t - { - Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks - }; + { + Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks + }; /** * \param _xMin x coordinates of left boundary. * \param _xMax x coordinates of right boundary. @@ -63,21 +62,21 @@ public: double _yMin, double _yMax, double _zMin, double _zMax/*, uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/); - + /** * Create a zero-sized building located at coordinates (0.0,0.0,0.0) * and with no floors and 1 room. */ Building (); - - + + /** * \param t the type of building (i.e., Residential, Office, Commercial) * * This method allows to set building type (default is Residential) */ void SetBuildingType (Building::BuildingType_t t); - + /** * \param t the type of external walls (i.e., Wood, ConcreteWithWindows, * ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss @@ -86,7 +85,7 @@ public: * This method allows to set external walls type (default is Residential) */ void SetExtWallsType (Building::ExtWallsType_t t); - + /** * \param nfloors the number of floors in the building * @@ -94,7 +93,7 @@ public: * (default is 1) */ void SetFloorsNumber (uint8_t nfloors); - + /** * \param nroomx the number of rooms in the x axis * @@ -102,7 +101,7 @@ public: * The rooms are disposed as a grid of nº of rooms in X per nº of rooms in Y */ void SetNumberRoomX (uint8_t nroomx); - + /** * \param nroomy the number of floors in the building * @@ -110,40 +109,40 @@ public: * (default is 1) */ void SetNumberRoomY (uint8_t nroomy); - - + + /** * \return the type of building * Return the type of building (i.e., Residential, Office, Commercial) */ BuildingType_t GetBuildingType (); - + /** * \return the type of external walls * Return the type of external walls (i.e., Wood, ConcreteWithWindows, * ConcreteWithoutWindows) */ ExtWallsType_t GetExtWallsType (); - + /** * \return the number of floors * Return the number of floors */ uint8_t GetNumberFloors (); - + /** * \return the number of room in x-axis * Return the number of room in x-axis */ uint8_t GetNumberRoomX (); - + /** * \return the number of room in y-axis * Return the number of room in y-axis */ uint8_t GetNumberRoomY (); - - + + private: Box m_buldingBounds; /** @@ -153,11 +152,11 @@ private: uint8_t m_floor; uint8_t m_roomX; uint8_t m_roomY; - + uint8_t m_buildingId; BuildingType_t m_buildingType; ExtWallsType_t m_externalWalls; - + }; //std::ostream &operator << (std::ostream &os, const Box &box); diff --git a/src/buildings/model/buildings-mobility-model.cc b/src/buildings/model/buildings-mobility-model.cc index 86be94b9d..0601670be 100644 --- a/src/buildings/model/buildings-mobility-model.cc +++ b/src/buildings/model/buildings-mobility-model.cc @@ -26,25 +26,25 @@ namespace ns3 { - - NS_OBJECT_ENSURE_REGISTERED (BuildingsMobilityModel); - + +NS_OBJECT_ENSURE_REGISTERED (BuildingsMobilityModel); + TypeId BuildingsMobilityModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::BuildingsMobilityModel") - .SetParent () - .SetGroupName ("Mobility") - .AddConstructor () - .AddAttribute ("Bounds", - "Bounds of the area to cruise.", - BoxValue (Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)), - MakeBoxAccessor (&BuildingsMobilityModel::m_bounds), - MakeBoxChecker ()); - - return tid; + .SetParent () + .SetGroupName ("Mobility") + .AddConstructor () + .AddAttribute ("Bounds", + "Bounds of the area to cruise.", + BoxValue (Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)), + MakeBoxAccessor (&BuildingsMobilityModel::m_bounds), + MakeBoxChecker ()); + + return tid; } - + BuildingsMobilityModel::BuildingsMobilityModel () { diff --git a/src/buildings/model/buildings-mobility-model.h b/src/buildings/model/buildings-mobility-model.h index e9d9a58c4..cb7baaedc 100644 --- a/src/buildings/model/buildings-mobility-model.h +++ b/src/buildings/model/buildings-mobility-model.h @@ -48,47 +48,47 @@ namespace ns3 { class BuildingsMobilityModel : public MobilityModel { - public: - static TypeId GetTypeId (void); - BuildingsMobilityModel (); - - bool IsIndoor (void); - bool IsOutdoor (void); - - void SetIndoor (Ptr building); - void SetOutdoor (void); - - void SetSurroudingBuilding (Ptr building); - - void SetFloorNumber (uint8_t nfloor); - void SetRoomNumberX (uint8_t nroomx); - void SetRoomNumberY (uint8_t nroomy); - - uint8_t GetFloorNumber (void); - uint8_t GetRoomNumberX (void); - uint8_t GetRoomNumberY (void); - - Ptr GetBuilding (); - - - - private: - virtual void DoDispose (void); - virtual Vector DoGetPosition (void) const; - virtual void DoSetPosition (const Vector &position); - virtual Vector DoGetVelocity (void) const; - ConstantVelocityHelper m_helper; - Box m_bounds; // bounds of the simulation field (if needed) - std::list < Ptr > m_surroudingBuildings; // buildings blocks - Ptr m_myBuilding; - bool m_indoor; - /** - * floors numbering starts from 0 (basement) - */ - uint8_t m_nFloor; - uint8_t m_roomX; - uint8_t m_roomY; - +public: + static TypeId GetTypeId (void); + BuildingsMobilityModel (); + + bool IsIndoor (void); + bool IsOutdoor (void); + + void SetIndoor (Ptr building); + void SetOutdoor (void); + + void SetSurroudingBuilding (Ptr building); + + void SetFloorNumber (uint8_t nfloor); + void SetRoomNumberX (uint8_t nroomx); + void SetRoomNumberY (uint8_t nroomy); + + uint8_t GetFloorNumber (void); + uint8_t GetRoomNumberX (void); + uint8_t GetRoomNumberY (void); + + Ptr GetBuilding (); + + + +private: + virtual void DoDispose (void); + virtual Vector DoGetPosition (void) const; + virtual void DoSetPosition (const Vector &position); + virtual Vector DoGetVelocity (void) const; + ConstantVelocityHelper m_helper; + Box m_bounds; // bounds of the simulation field (if needed) + std::list < Ptr > m_surroudingBuildings; // buildings blocks + Ptr m_myBuilding; + bool m_indoor; + /** + * floors numbering starts from 0 (basement) + */ + uint8_t m_nFloor; + uint8_t m_roomX; + uint8_t m_roomY; + }; diff --git a/src/buildings/model/buildings-propagation-loss-model.cc b/src/buildings/model/buildings-propagation-loss-model.cc index 43e7c8f42..66bf2fb5c 100644 --- a/src/buildings/model/buildings-propagation-loss-model.cc +++ b/src/buildings/model/buildings-propagation-loss-model.cc @@ -36,28 +36,28 @@ NS_LOG_COMPONENT_DEFINE ("BuildingsPropagationLossModel"); namespace ns3 { - + NS_OBJECT_ENSURE_REGISTERED (BuildingsPropagationLossModel); class BuildingsPropagationLossModel::ShadowingLoss { - public: +public: ShadowingLoss (double mean, double sigma, Ptr receiver); ~ShadowingLoss (); double GetLoss (); Ptr GetReceiver (void); - private: +private: Ptr m_receiver; NormalVariable m_randVariable; double m_shadowingValue; }; -BuildingsPropagationLossModel::ShadowingLoss::ShadowingLoss (double mean, double sigma, Ptr receiver) : - m_receiver (receiver), - m_randVariable (mean, sigma*sigma) // NormalVariable class wants mean and variance (sigma is a standard deviation) +BuildingsPropagationLossModel::ShadowingLoss::ShadowingLoss (double mean, double sigma, Ptr receiver) + : m_receiver (receiver), + m_randVariable (mean, sigma * sigma) // NormalVariable class wants mean and variance (sigma is a standard deviation) { m_shadowingValue = m_randVariable.GetValue (); NS_LOG_INFO (this << " New Shadowing: sigma " << sigma << " value " << m_shadowingValue); @@ -65,9 +65,9 @@ BuildingsPropagationLossModel::ShadowingLoss::ShadowingLoss (double mean, double BuildingsPropagationLossModel::ShadowingLoss::~ShadowingLoss () { - + } - + double BuildingsPropagationLossModel::ShadowingLoss::GetLoss () { @@ -100,94 +100,94 @@ BuildingsPropagationLossModel::GetTypeId (void) DoubleValue (2160e6), MakeDoubleAccessor (&BuildingsPropagationLossModel::SetFrequency), MakeDoubleChecker ()) - - .AddAttribute ("ShadowSigmaOutdoor", - "Standard deviation of the normal distribution used for calculate the shadowing for outdoor nodes", - DoubleValue (7.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaOutdoor), - MakeDoubleChecker ()) - - .AddAttribute ("ShadowSigmaIndoor", - "Standard deviation of the normal distribution used for calculate the shadowing for indoor nodes ", - DoubleValue (8.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaIndoor), - MakeDoubleChecker ()) - .AddAttribute ("ShadowSigmaExtWalls", - "Standard deviation of the normal distribution used for calculate the shadowing due to ext walls ", - DoubleValue (5.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaExtWalls), - MakeDoubleChecker ()) - + + .AddAttribute ("ShadowSigmaOutdoor", + "Standard deviation of the normal distribution used for calculate the shadowing for outdoor nodes", + DoubleValue (7.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaOutdoor), + MakeDoubleChecker ()) + + .AddAttribute ("ShadowSigmaIndoor", + "Standard deviation of the normal distribution used for calculate the shadowing for indoor nodes ", + DoubleValue (8.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaIndoor), + MakeDoubleChecker ()) + .AddAttribute ("ShadowSigmaExtWalls", + "Standard deviation of the normal distribution used for calculate the shadowing due to ext walls ", + DoubleValue (5.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaExtWalls), + MakeDoubleChecker ()) + .AddAttribute ("RooftopLevel", - " The height of the rooftop [m].", - DoubleValue (20.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_rooftopHeight), - MakeDoubleChecker ()) - + " The height of the rooftop [m].", + DoubleValue (20.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_rooftopHeight), + MakeDoubleChecker ()) + .AddAttribute ("Los2NlosThr", - " Threshold from LoS to NLoS in ITU 1411 [m].", - DoubleValue (200.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411NlosThreshold), - MakeDoubleChecker ()) - + " Threshold from LoS to NLoS in ITU 1411 [m].", + DoubleValue (200.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411NlosThreshold), + MakeDoubleChecker ()) + .AddAttribute ("ITU1411DistanceThr", - " Threshold for ITU 1411 [m].", - DoubleValue (2000.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411DistanceThreshold), - MakeDoubleChecker ()) + " Threshold for ITU 1411 [m].", + DoubleValue (2000.0), + MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411DistanceThreshold), + MakeDoubleChecker ()) .AddAttribute ("MinDistance", "The distance under which the propagation model refuses to give results (m) ", DoubleValue (0.5), MakeDoubleAccessor (&BuildingsPropagationLossModel::SetMinDistance, &BuildingsPropagationLossModel::GetMinDistance), MakeDoubleChecker ()) - - .AddAttribute ("Environment", - "Environment Scenario", - EnumValue (BuildingsPropagationLossModel::Urban), - MakeEnumAccessor (&BuildingsPropagationLossModel::SetEnvironment, - &BuildingsPropagationLossModel::GetEnvironment), - MakeEnumChecker (BuildingsPropagationLossModel::Urban, "Urban", - BuildingsPropagationLossModel::SubUrban, "SubUrban", - BuildingsPropagationLossModel::OpenAreas, "OpenAreas")) - .AddAttribute ("CitySize", - "Dimension of the city", - EnumValue (BuildingsPropagationLossModel::Large), - MakeEnumAccessor (&BuildingsPropagationLossModel::SetCitySize), - MakeEnumChecker (BuildingsPropagationLossModel::Small, "Small", - BuildingsPropagationLossModel::Medium, "Medium", - BuildingsPropagationLossModel::Large, "Large")); + .AddAttribute ("Environment", + "Environment Scenario", + EnumValue (BuildingsPropagationLossModel::Urban), + MakeEnumAccessor (&BuildingsPropagationLossModel::SetEnvironment, + &BuildingsPropagationLossModel::GetEnvironment), + MakeEnumChecker (BuildingsPropagationLossModel::Urban, "Urban", + BuildingsPropagationLossModel::SubUrban, "SubUrban", + BuildingsPropagationLossModel::OpenAreas, "OpenAreas")) + + .AddAttribute ("CitySize", + "Dimension of the city", + EnumValue (BuildingsPropagationLossModel::Large), + MakeEnumAccessor (&BuildingsPropagationLossModel::SetCitySize), + MakeEnumChecker (BuildingsPropagationLossModel::Small, "Small", + BuildingsPropagationLossModel::Medium, "Medium", + BuildingsPropagationLossModel::Large, "Large")); + - return tid; } -BuildingsPropagationLossModel::BuildingsPropagationLossModel () : - C (0), - m_environment (Urban), - m_citySize (Large), - m_streetsOrientation (45.0), - m_streetsWidth (20.0), - m_buildingsExtend (80.0), - m_buildingSeparation (50.0) +BuildingsPropagationLossModel::BuildingsPropagationLossModel () + : C (0), + m_environment (Urban), + m_citySize (Large), + m_streetsOrientation (45.0), + m_streetsWidth (20.0), + m_buildingsExtend (80.0), + m_buildingSeparation (50.0) { } BuildingsPropagationLossModel::~BuildingsPropagationLossModel () { for (PairsList::reverse_iterator i = m_shadowingPairs.rbegin (); i != m_shadowingPairs.rend (); i++) - { - PairsSet *ps = *i; - for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++) { - ShadowingLoss *pc = *r; - delete pc; + PairsSet *ps = *i; + for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++) + { + ShadowingLoss *pc = *r; + delete pc; + } + ps->sender = 0; + ps->receivers.clear (); + delete ps; } - ps->sender = 0; - ps->receivers.clear (); - delete ps; - } m_shadowingPairs.clear (); } @@ -278,20 +278,20 @@ BuildingsPropagationLossModel::OkumuraHata (Ptr a, PtrGetDistanceFrom (b) / 1000.0; - if (m_frequency<=1.500e9) + if (m_frequency <= 1.500e9) { // standard Okumura Hata (from wikipedia) double log_f = log10 (fmhz); - double hb = (a->GetPosition ().z>b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z< b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); double log_aHeight = 13.82 * log10 (hb); double log_bHeight = 0.0; if (m_citySize == Large) { - if (m_frequency<200) + if (m_frequency < 200) { log_bHeight = 8.29 * pow (log10 (1.54 * hm), 2) - 1.1; } @@ -302,43 +302,43 @@ BuildingsPropagationLossModel::OkumuraHata (Ptr a, PtrGetDistanceFrom (b))) << " logb " << log_bHeight); - loss = 69.55 + (26.16 * log_f) - log_aHeight + (((44.9 - (6.55 * log10(hb)) ))*log10 (dist)) - log_bHeight; + loss = 69.55 + (26.16 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight; if (m_environment == SubUrban) { - loss += - 2 * (pow(log10 (fmhz / 28), 2)) - 5.4; + loss += -2 * (pow (log10 (fmhz / 28), 2)) - 5.4; } else if (m_environment == OpenAreas) { - loss += -4.70*pow(log10(fmhz),2) + 18.33*log10(fmhz) - 40.94; + loss += -4.70 * pow (log10 (fmhz),2) + 18.33 * log10 (fmhz) - 40.94; } - + } else if (m_frequency <= 2.170e9) // max 3GPP freq EUTRA band #1 { // COST 231 Okumura model double log_f = log10 (fmhz); - double hb = (a->GetPosition ().z>b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z< b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); double log_aHeight = 13.82 * log10 (hb); double log_bHeight = 0.0; double C = 0.0; - + if (m_citySize == Large) { - log_bHeight = 3.2 * pow ((log10(11.75 * hm)),2); + log_bHeight = 3.2 * pow ((log10 (11.75 * hm)),2); C = 3; } else { - log_bHeight = 1.1*log_f - 0.7*hm - (1.56*log_f - 0.8); + log_bHeight = 1.1 * log_f - 0.7 * hm - (1.56 * log_f - 0.8); } - - loss = 46.3 + (33.9 * log_f) - log_aHeight + (((44.9 - (6.55 * log10(hb)) ))*log10 (dist)) - log_bHeight + C; + + loss = 46.3 + (33.9 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight + C; } else if (m_frequency <= 2.690e9) // max 3GPP freq EUTRA band #1 { @@ -346,9 +346,9 @@ BuildingsPropagationLossModel::OkumuraHata (Ptr a, Ptr a, PtrGetPosition ().z > 0 && b->GetPosition ().z > 0, "nodes' height must be greater then 0"); - double Lbp = fabs (20*log10 ((m_lambda*m_lambda)/(8*pi*a->GetPosition ().z*b->GetPosition ().z))); + double Lbp = fabs (20 * log10 ((m_lambda * m_lambda) / (8 * pi * a->GetPosition ().z * b->GetPosition ().z))); double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / m_lambda; // NS_LOG_INFO (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda); if (dist <= Rbp) - { - lossLow = Lbp + 20*log10(dist/Rbp); - lossUp = Lbp + 20 + 25*log10(dist/Rbp); - } + { + lossLow = Lbp + 20 * log10 (dist / Rbp); + lossUp = Lbp + 20 + 25 * log10 (dist / Rbp); + } else - { - lossLow = Lbp + 40*log10(dist/Rbp); - lossUp = Lbp + 20 + 40*log10(dist/Rbp); - } - + { + lossLow = Lbp + 40 * log10 (dist / Rbp); + lossUp = Lbp + 20 + 40 * log10 (dist / Rbp); + } + double loss = (lossUp + lossLow) / 2; - + return (loss); } @@ -402,26 +402,26 @@ BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr=0)&&(m_streetsOrientation<35)) + double fmhz = m_frequency / 1e6; + if ((m_streetsOrientation >= 0)&&(m_streetsOrientation < 35)) { - Lori = -10.0 + 0.354*m_streetsOrientation; + Lori = -10.0 + 0.354 * m_streetsOrientation; } - else if ((m_streetsOrientation>=35)&&(m_streetsOrientation<55)) + else if ((m_streetsOrientation >= 35)&&(m_streetsOrientation < 55)) { - Lori = 2.5 + 0.075*(m_streetsOrientation - 35); + Lori = 2.5 + 0.075 * (m_streetsOrientation - 35); } - else if ((m_streetsOrientation>=55)&&(m_streetsOrientation<90)) + else if ((m_streetsOrientation >= 55)&&(m_streetsOrientation < 90)) { - Lori = 2.5 + 0.075*(m_streetsOrientation - 55); + Lori = 2.5 + 0.075 * (m_streetsOrientation - 55); } else { NS_LOG_ERROR (this << " Street Orientation must be in [0,90]"); } double distance = a->GetDistanceFrom (b); - double hb = (a->GetPosition ().z>b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z< b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0"); double Dhb = hb - m_rooftopHeight; double ds = (m_lambda * distance * distance) / (Dhb * Dhb); @@ -436,60 +436,60 @@ BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr m_rooftopHeight) { - Lbsh = -18*log10(1+Dhb); + Lbsh = -18 * log10 (1 + Dhb); ka = (fmhz > 2000 ? 71.4 : 54.0); kd = 18.0; } else { Lbsh = 0; - kd = 18.0 - 15*Dhb/a->GetPosition ().z; - if (distance <500) + kd = 18.0 - 15 * Dhb / a->GetPosition ().z; + if (distance < 500) { - ka = 54.0 - 1.6*Dhb*distance/1000; + ka = 54.0 - 1.6 * Dhb * distance / 1000; } - else + else { - ka = 54.0 - 0.8*Dhb; + ka = 54.0 - 0.8 * Dhb; } } - if (fmhz>2000) + if (fmhz > 2000) { kf = -8; } - else if ((m_environment==Urban)&&(m_citySize==Large)) + else if ((m_environment == Urban)&&(m_citySize == Large)) { - kf = -4 + 0.7*(fmhz/925.0 -1); + kf = -4 + 0.7 * (fmhz / 925.0 - 1); } else { - kf = -4 + 1.5*(fmhz/925.0 -1); + kf = -4 + 1.5 * (fmhz / 925.0 - 1); } - - Lmsd = Lbsh + ka + kd*log10(distance/1000.0) + kf*log10(fmhz) -9.0*log10(m_buildingSeparation); + + Lmsd = Lbsh + ka + kd*log10 (distance / 1000.0) + kf*log10 (fmhz) - 9.0 * log10 (m_buildingSeparation); } else { - double theta = atan (Dhb/m_buildingSeparation); - double rho = sqrt(Dhb*Dhb+m_buildingSeparation*m_buildingSeparation); + double theta = atan (Dhb / m_buildingSeparation); + double rho = sqrt (Dhb * Dhb + m_buildingSeparation * m_buildingSeparation); double Qm = 0.0; - if ((hb > m_rooftopHeight -1.0) && (hb < m_rooftopHeight + 1.0)) + if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0)) { Qm = m_buildingSeparation / distance; } else if (hb > m_rooftopHeight) { - Qm = 2.35*pow(Dhb/distance*sqrt(m_buildingSeparation/m_lambda), 0.9); + Qm = 2.35 * pow (Dhb / distance * sqrt (m_buildingSeparation / m_lambda), 0.9); } else { - Qm = m_buildingSeparation/(2*pi*distance)*sqrt(m_lambda/rho)*(1/theta-(1/(2*pi+theta))); + Qm = m_buildingSeparation / (2 * pi * distance) * sqrt (m_lambda / rho) * (1 / theta - (1 / (2 * pi + theta))); } - Lmsd = -10*log10(Qm*Qm); + Lmsd = -10 * log10 (Qm * Qm); } - double Lbf = 32.4 + 20*log10(distance/1000) + 20*log10(fmhz); + double Lbf = 32.4 + 20 * log10 (distance / 1000) + 20 * log10 (fmhz); double Dhm = m_rooftopHeight - hm; - double Lrts = -8.2 -10*log10 (m_streetsWidth) + 10*log10 (fmhz) + 20*log10 (Dhm) + Lori; + double Lrts = -8.2 - 10 * log10 (m_streetsWidth) + 10 * log10 (fmhz) + 20 * log10 (Dhm) + Lori; // NS_LOG_INFO (this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd); double loss = 0.0; if (Lrts + Lmsd > 0) @@ -525,11 +525,11 @@ BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr a, Ptr aBuilding = a->GetBuilding (); if (aBuilding->GetBuildingType () == Building::Residential) - { - N = 28; - if (n>=1) - { - Lf = 4 * n; - } + { + N = 28; + if (n >= 1) + { + Lf = 4 * n; + } // NS_LOG_INFO (this << " Residential "); - } + } else if (aBuilding->GetBuildingType () == Building::Office) - { - N = 30; - if (n>=1) - { - Lf = 15 + (4 * (n-1)); - } + { + N = 30; + if (n >= 1) + { + Lf = 15 + (4 * (n - 1)); + } // NS_LOG_INFO (this << " Office "); - } + } else if (aBuilding->GetBuildingType () == Building::Commercial) - { - N = 22; - if (n>=1) - { - Lf = 6 + (3 * (n-1)); - } + { + N = 22; + if (n >= 1) + { + Lf = 6 + (3 * (n - 1)); + } // NS_LOG_INFO (this << " Commercial "); - } + } else - { - NS_LOG_ERROR (this << " Unkwnon Wall Type"); - } + { + NS_LOG_ERROR (this << " Unkwnon Wall Type"); + } NS_LOG_INFO (this << " Node " << a->GetPosition () << " <-> " << b->GetPosition ()); - double loss = 20*log10(m_frequency/1e6/*MHz*/) + N*log10(a->GetDistanceFrom (b)) + Lf - 28.0; - + double loss = 20 * log10 (m_frequency / 1e6 /*MHz*/) + N*log10 (a->GetDistanceFrom (b)) + Lf - 28.0; + return (loss); } @@ -602,8 +602,8 @@ BuildingsPropagationLossModel::BEWPL (Ptr a) const { loss = 12; } - - + + return (loss); } @@ -612,9 +612,9 @@ double BuildingsPropagationLossModel::HeightGain (Ptr node) const { double loss = 0.0; - + int nfloors = node->GetFloorNumber (); - loss = -2*(nfloors); + loss = -2 * (nfloors); return (loss); } @@ -624,37 +624,37 @@ BuildingsPropagationLossModel::HeightGain (Ptr node) con double BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr b) const { - + double distance = a->GetDistanceFrom (b); if (distance <= m_minDistance) { return 0.0; } - + // get the BuildingsMobilityModel pointers Ptr a1 = DynamicCast (a); Ptr b1 = DynamicCast (b); - + double loss = 0.0; - + if (a1->IsOutdoor ()) { if (b1->IsOutdoor ()) { if (distance > 1000) { - NS_LOG_INFO (this << a1->GetPosition ().z<GetPosition ().z<< m_rooftopHeight); + NS_LOG_INFO (this << a1->GetPosition ().z << b1->GetPosition ().z << m_rooftopHeight); if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + && (b1->GetPosition ().z < m_rooftopHeight)) { // ITU limit in distance (i.e., < 2000 for small cells) if (distance < m_itu1411DistanceThreshold) - { + { // short range communication loss = ItuR1411 (a1, b1); NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss); } - else + else { // out of bound loss = std::numeric_limits::infinity (); @@ -681,14 +681,14 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance > 1000) { if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + && (b1->GetPosition ().z < m_rooftopHeight)) { - + // ITU limit in distance (i.e., < 2000 for small cells) if (distance < m_itu1411DistanceThreshold) - { + { // short range communication - loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + BEWPL (b1) + HeightGain (a1); NS_LOG_INFO (this << " 0-I (>1000): down rooftop -> ITUR1411 : " << loss); } else @@ -701,13 +701,13 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr else { // Over the rooftop tranmission -> Okumura Hata - loss = OkumuraHata (a1, b1) + BEWPL(b1); + loss = OkumuraHata (a1, b1) + BEWPL (b1); NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss); } } else { - loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (b1); + loss = ItuR1411 (a1, b1) + BEWPL (b1) + HeightGain (b1); NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss); } } // end b1->isIndoor () @@ -719,15 +719,15 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr { if (a1->GetBuilding () == b1->GetBuilding ()) { - // nodes are in same building -> indoor communication ITU-R P.1238 - loss = ItuR1238 (a1, b1); - NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss); - + // nodes are in same building -> indoor communication ITU-R P.1238 + loss = ItuR1238 (a1, b1); + NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss); + } else { // nodes are in different buildings - loss = ItuR1411 (a1, b1) + BEWPL(a1) + BEWPL(b1); + loss = ItuR1411 (a1, b1) + BEWPL (a1) + BEWPL (b1); NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss); } } @@ -737,14 +737,14 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr if (distance > 1000) { if ((a1->GetPosition ().z < m_rooftopHeight) - && (b1->GetPosition ().z < m_rooftopHeight)) + && (b1->GetPosition ().z < m_rooftopHeight)) { - + // ITU limit in distance (i.e., < 2000 for small cells) if (distance < m_itu1411DistanceThreshold) - { + { // short range communication - loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + BEWPL (a1) + HeightGain (a1); NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss); } else @@ -757,13 +757,13 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr else { // above rooftop -> OH - loss = OkumuraHata (a1, b1) + BEWPL(a1) + HeightGain (a1); + loss = OkumuraHata (a1, b1) + BEWPL (a1) + HeightGain (a1); NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss); } } else { - loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1); + loss = ItuR1411 (a1, b1) + BEWPL (a1) + HeightGain (a1); NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss); } } // end b1->IsIndoor () @@ -785,8 +785,8 @@ BuildingsPropagationLossModel::GetLoss (Ptr a, Ptr return loss + pc->GetLoss (); } } - double sigma = EvaluateSigma (a1, b1); - ShadowingLoss *pc = new ShadowingLoss (0.0, sigma,b); + double sigma = EvaluateSigma (a1, b1); + ShadowingLoss *pc = new ShadowingLoss (0.0, sigma,b); ps->receivers.push_back (pc); return loss + pc->GetLoss (); } @@ -806,25 +806,25 @@ BuildingsPropagationLossModel::EvaluateSigma (Ptr a, Ptr const { if (a->IsOutdoor ()) - { - if (b->IsOutdoor ()) { - return (m_shadowingSigmaOutdoor); + if (b->IsOutdoor ()) + { + return (m_shadowingSigmaOutdoor); + } + else + { + double sigma = sqrt ((m_shadowingSigmaOutdoor * m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls * m_shadowingSigmaExtWalls)); + return (sigma); + } } - else - { - double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls)); - return (sigma); - } - } else - if (b->IsIndoor ()) + if (b->IsIndoor ()) { return (m_shadowingSigmaIndoor); } - else + else { - double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls)); + double sigma = sqrt ((m_shadowingSigmaOutdoor * m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls * m_shadowingSigmaExtWalls)); return (sigma); } } diff --git a/src/buildings/model/buildings-propagation-loss-model.h b/src/buildings/model/buildings-propagation-loss-model.h index 95e7c1545..292b6c67e 100644 --- a/src/buildings/model/buildings-propagation-loss-model.h +++ b/src/buildings/model/buildings-propagation-loss-model.h @@ -34,7 +34,7 @@ namespace ns3 { class ShadowingLossModel; class JakesFadingLossModel; - + /** * \ingroup propagation * @@ -69,7 +69,7 @@ public: { Urban, SubUrban, OpenAreas }; - + enum CitySize { Small, Medium, Large @@ -92,8 +92,8 @@ public: double GetLambda (void) const; double GetFrequency (void) const; // void SetLambda (double frequency, double speed); - - + + private: virtual double DoCalcRxPower (double txPowerDbm, Ptr a, Ptr b) const; double OkumuraHata (Ptr a, Ptr b) const; @@ -103,9 +103,9 @@ private: // double ItuR1411NlosStreetCanyons (Ptr a, Ptr b) const; double ItuR1238 (Ptr a, Ptr b) const; double BEWPL (Ptr a) const; - + double HeightGain (Ptr n) const; - + double C; // OH loss coefficient for the environment double N; // ITU-R P.1238: power loss coefficient double m_lambda; @@ -120,20 +120,21 @@ private: double m_streetsWidth; // in meters double m_buildingsExtend; // in meters double m_buildingSeparation; // in meters - + // the shadowing tx/rx pairs management has been inspired by the // JakesFadingLossModel developed by Federico Maguolo (see jakes-propagation-model.h/cc) class ShadowingLoss; friend class ShadowingLoss; typedef std::vector DestinationList; - struct PairsSet { + struct PairsSet + { Ptr sender; DestinationList receivers; }; typedef std::vector PairsList; double EvaluateSigma (Ptr a, Ptr b) const; - - + + double m_shadowingSigmaExtWalls; double m_shadowingSigmaOutdoor; double m_shadowingSigmaIndoor; diff --git a/src/buildings/test/buildings-pathloss-test.cc b/src/buildings/test/buildings-pathloss-test.cc index f8e07aef9..c6484b224 100644 --- a/src/buildings/test/buildings-pathloss-test.cc +++ b/src/buildings/test/buildings-pathloss-test.cc @@ -49,76 +49,76 @@ BuildingsPathlossTestSuite::BuildingsPathlossTestSuite () { LogComponentEnable ("BuildingsPathlossTest", LOG_LEVEL_ALL); - - double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101 - + + double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101 + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city")); - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city")); - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban")); - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 110.21, "loss OH OpenAreas")); - + // Test #2 COST231 Model (1500 < freq < 2000~2170 MHz) (Macro<->UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city")); - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 150.64, "COST231 Urban small city and suburban")); - + // Test #3 2.6 GHz model (Macro<->UE) - + freq = 2.620e9; // E_UTRA BAND #7 see table 5.5-1 of 36.101 - + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model")); - + // Test #4 ITU1411 LOS model (Macro<->UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 AddTestCase (new BuildingsPathlossTestCase (freq, 1, 3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS")); - + // Test #5 ITU1411 NLOS model (Macro<->UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 AddTestCase (new BuildingsPathlossTestCase (freq, 1, 4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS")); - + // Test #6 ITUP1238 (HeNB <-> UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 AddTestCase (new BuildingsPathlossTestCase (freq, 5, 6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238")); - + // Test #7 Outdoor -> Indoor OkumuraHata (Macro<->UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is as in test #2 (large city) plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB -> 148.55 + 7 = 155.55 AddTestCase (new BuildingsPathlossTestCase (freq, 1, 7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 155.55, "Okumura Hata Outdoor -> Indoor")); - + // Test #8 Outdoor -> Indoor ITU1411 (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is as in test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB -> 81.000 + 7 = 88.000 AddTestCase (new BuildingsPathlossTestCase (freq, 1, 8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor")); - + // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is similar of test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB and the height gain // (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838 AddTestCase (new BuildingsPathlossTestCase (freq, 9, 10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor")); - + // Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE) - + freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is similar as in test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB and the height gain // (2 floors x 2 dB/floor = 4) -> 180.90 + 7 - 4 = 183.90 AddTestCase (new BuildingsPathlossTestCase (freq, 9, 11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor")); - + } @@ -184,25 +184,25 @@ BuildingsPathlossTestCase::DoRun (void) Ptr mma = CreateMobilityModel (m_mobilityModelIndex1); Ptr mmb = CreateMobilityModel (m_mobilityModelIndex2); - + Ptr propagationLossModel = CreateObject (); propagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); - propagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); + propagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 / m_freq)); propagationLossModel->SetAttribute ("Environment", EnumValue (m_env)); propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city)); // cancel shadowing effect propagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); propagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); propagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); - + double loss = propagationLossModel->GetLoss (mma, mmb); NS_LOG_INFO ("Calculated loss: " << loss); NS_LOG_INFO ("Theoretical loss: " << m_lossRef); - NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !"); + NS_TEST_ASSERT_MSG_EQ_TOL (loss, m_lossRef, 0.1, "Wrong loss !"); } Ptr @@ -223,10 +223,10 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) double distance = 2000; double hm = 1; double hb = 30; - + Ptr mm1 = CreateObject (); mm1->SetPosition (Vector (0.0, 0.0, hb)); - + Ptr mm2 = CreateObject (); mm2->SetPosition (Vector (distance, 0.0, hm)); @@ -237,14 +237,14 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) distance = 900; Ptr mm4 = CreateObject (); mm4->SetPosition (Vector (distance, 0.0, hm)); - + distance = 30; double henbHeight = 10.0; Ptr mm5 = CreateObject (); mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); // this needs to be static otherwise it will look like a different building every time - static Ptr building1 = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/); + static Ptr building1 = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0 /*, 1, 1, 1*/); building1->SetBuildingType (Building::Residential); building1->SetExtWallsType (Building::ConcreteWithWindows); mm5->SetIndoor (building1); @@ -257,7 +257,7 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) Ptr mm7 = CreateObject (); mm7->SetPosition (Vector (distance, 0.0, hm)); mm7->SetIndoor (building1); - + distance = 100; Ptr mm8 = CreateObject (); mm8->SetPosition (Vector (distance, 0.0, hm)); @@ -270,7 +270,7 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) mm9->SetFloorNumber (2); Ptr mm10 = CreateObject (); mm10->SetPosition (Vector (distance, 0.0, hm)); - + distance = 500; Ptr mm11 = CreateObject (); mm11->SetPosition (Vector (distance, 0.0, hm)); @@ -292,8 +292,8 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) break; case 4: - return mm4; - break; + return mm4; + break; case 5: return mm5; @@ -322,7 +322,7 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) case 11: return mm11; break; - + default: return 0; break; diff --git a/src/buildings/test/buildings-pathloss-test.h b/src/buildings/test/buildings-pathloss-test.h index 6fcf5d3d8..306fbbfe0 100644 --- a/src/buildings/test/buildings-pathloss-test.h +++ b/src/buildings/test/buildings-pathloss-test.h @@ -54,7 +54,7 @@ private: BuildingsPropagationLossModel::Environment m_env; BuildingsPropagationLossModel::CitySize m_city; double m_lossRef; - + }; diff --git a/src/buildings/test/buildings-shadowing-test.cc b/src/buildings/test/buildings-shadowing-test.cc index 9b8c012e9..54c629df9 100644 --- a/src/buildings/test/buildings-shadowing-test.cc +++ b/src/buildings/test/buildings-shadowing-test.cc @@ -43,19 +43,19 @@ using namespace ns3; BuildingsShadowingTestSuite::BuildingsShadowingTestSuite () -: TestSuite ("buildings-shadowing-test", SYSTEM) + : TestSuite ("buildings-shadowing-test", SYSTEM) { - + LogComponentEnable ("BuildingsShadowingTest", LOG_LEVEL_ALL); - - // Test #1 Outdoor Model + + // Test #1 Outdoor Model AddTestCase (new BuildingsShadowingTestCase (1, 2, 148.86, 7.0, "Outdoor Shadowing")); - + // Test #2 Indoor model AddTestCase (new BuildingsShadowingTestCase (5, 6, 88.5724, 8.0, "Indoor Shadowing")); - + // Test #3 Indoor -> Outdoor - AddTestCase (new BuildingsShadowingTestCase (9, 10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing")); + AddTestCase (new BuildingsShadowingTestCase (9, 10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing")); } @@ -67,11 +67,11 @@ static BuildingsShadowingTestSuite buildingsShadowingTestSuite; */ BuildingsShadowingTestCase::BuildingsShadowingTestCase ( uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name) -: TestCase ("SHADOWING calculation: " + name), + : TestCase ("SHADOWING calculation: " + name), m_mobilityModelIndex1 (m1), m_mobilityModelIndex2 (m2), -m_lossRef (refValue), -m_sigmaRef (sigmaRef) + m_lossRef (refValue), + m_sigmaRef (sigmaRef) { } @@ -83,7 +83,7 @@ void BuildingsShadowingTestCase::DoRun (void) { // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); - + // LogComponentEnable ("LteEnbRrc", logLevel); // LogComponentEnable ("LteUeRrc", logLevel); // LogComponentEnable ("LteEnbMac", logLevel); @@ -102,39 +102,39 @@ BuildingsShadowingTestCase::DoRun (void) // LogComponentEnable ("LtePropagationLossModel", logLevel); // LogComponentEnable ("LossModel", logLevel); // LogComponentEnable ("ShadowingLossModel", logLevel); - // LogComponentEnable ("PenetrationLossModel", logLevel); - // LogComponentEnable ("MultipathLossModel", logLevel); - // LogComponentEnable ("PathLossModel", logLevel); - // - // LogComponentEnable ("LteNetDevice", logLevel); - // LogComponentEnable ("LteUeNetDevice", logLevel); - // LogComponentEnable ("LteEnbNetDevice", logLevel); - +// LogComponentEnable ("PenetrationLossModel", logLevel); +// LogComponentEnable ("MultipathLossModel", logLevel); +// LogComponentEnable ("PathLossModel", logLevel); +// +// LogComponentEnable ("LteNetDevice", logLevel); +// LogComponentEnable ("LteUeNetDevice", logLevel); +// LogComponentEnable ("LteEnbNetDevice", logLevel); + // LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); Ptr mma = CreateMobilityModel (m_mobilityModelIndex1); Ptr mmb = CreateMobilityModel (m_mobilityModelIndex2); - + std::vector loss; double sum = 0.0; double sumSquared = 0.0; int samples = 10000; for (int i = 0; i < samples; i++) - { - Ptr propagationLossModel = CreateObject (); - loss.push_back (propagationLossModel->GetLoss (mma, mmb) - m_lossRef); - sum += loss.at (loss.size()-1); - sumSquared += (loss.at (loss.size()-1)*loss.at (loss.size()-1)); - } - double mean = sum/samples; - double sigma = sqrt(sumSquared/samples - (mean*mean)); + { + Ptr propagationLossModel = CreateObject (); + loss.push_back (propagationLossModel->GetLoss (mma, mmb) - m_lossRef); + sum += loss.at (loss.size () - 1); + sumSquared += (loss.at (loss.size () - 1) * loss.at (loss.size () - 1)); + } + double mean = sum / samples; + double sigma = sqrt (sumSquared / samples - (mean * mean)); // test whether the distribution falls in the 99% confidence interval, as expected with a nornal distribution double ci = (2.575829303549 * sigma) / sqrt (samples); - + NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci); - - NS_TEST_ASSERT_MSG_EQ_TOL(fabs(mean), 0.0, ci, "Wrong shadowing distribution !"); + + NS_TEST_ASSERT_MSG_EQ_TOL (fabs (mean), 0.0, ci, "Wrong shadowing distribution !"); } @@ -157,16 +157,16 @@ BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index) double hb = 30; Ptr mm1 = CreateObject (); mm1->SetPosition (Vector (0.0, 0.0, hb)); - + Ptr mm2 = CreateObject (); mm2->SetPosition (Vector (distance, 0.0, hm)); - + distance = 30; double henbHeight = 10.0; Ptr mm5 = CreateObject (); mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); - static Ptr building1 = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/); + static Ptr building1 = Create (0.0, 10.0, 0.0, 10.0, 0.0, 20.0 /*, 1, 1, 1*/); building1->SetBuildingType (Building::Residential); building1->SetExtWallsType (Building::ConcreteWithWindows); mm5->SetIndoor (building1); @@ -175,7 +175,7 @@ BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index) mm6->SetIndoor (building1); mm6->SetFloorNumber (2); - + distance = 100; Ptr mm9 = CreateObject (); mm9->SetPosition (Vector (0.0, 0.0, henbHeight)); @@ -209,7 +209,7 @@ BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index) case 10: return mm10; break; - + default: return 0; break; diff --git a/src/buildings/test/buildings-shadowing-test.h b/src/buildings/test/buildings-shadowing-test.h index dbbc94483..c8c861954 100644 --- a/src/buildings/test/buildings-shadowing-test.h +++ b/src/buildings/test/buildings-shadowing-test.h @@ -35,26 +35,26 @@ using namespace ns3; */ class BuildingsShadowingTestSuite : public TestSuite { - public: - BuildingsShadowingTestSuite (); +public: + BuildingsShadowingTestSuite (); }; class BuildingsShadowingTestCase : public TestCase { - public: - BuildingsShadowingTestCase (uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name); - virtual ~BuildingsShadowingTestCase (); - - private: - virtual void DoRun (void); +public: + BuildingsShadowingTestCase (uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name); + virtual ~BuildingsShadowingTestCase (); + +private: + virtual void DoRun (void); Ptr CreateMobilityModel (uint16_t index); uint16_t m_mobilityModelIndex1; uint16_t m_mobilityModelIndex2; - double m_lossRef; // pathloss value (without shadowing) - double m_sigmaRef; - + double m_lossRef; // pathloss value (without shadowing) + double m_sigmaRef; + }; #endif /*BUILDINGS_SHADOWING_TEST_H*/ diff --git a/src/lte/doc/source/figures/fading_pedestrian.png b/src/lte/doc/source/figures/fading_pedestrian.png index e2c2582f6..ccbb720be 100644 Binary files a/src/lte/doc/source/figures/fading_pedestrian.png and b/src/lte/doc/source/figures/fading_pedestrian.png differ diff --git a/src/lte/doc/source/figures/fading_urban_3kmph.png b/src/lte/doc/source/figures/fading_urban_3kmph.png index c318a2c0d..03ad3447b 100644 Binary files a/src/lte/doc/source/figures/fading_urban_3kmph.png and b/src/lte/doc/source/figures/fading_urban_3kmph.png differ diff --git a/src/lte/doc/source/figures/fading_vehicular.png b/src/lte/doc/source/figures/fading_vehicular.png index f3242a2e9..29158ac93 100644 Binary files a/src/lte/doc/source/figures/fading_vehicular.png and b/src/lte/doc/source/figures/fading_vehicular.png differ diff --git a/src/lte/doc/source/index.rst b/src/lte/doc/source/index.rst index 7d9084000..5688cd8e6 100644 --- a/src/lte/doc/source/index.rst +++ b/src/lte/doc/source/index.rst @@ -11,4 +11,6 @@ This is the stand-alone version of the ns-3 LTE module documentation. lte-design lte-user lte-testing + lte-profiling + lte-references diff --git a/src/lte/doc/source/lte-design.rst b/src/lte/doc/source/lte-design.rst index 7d9c5d801..0dcf88b65 100644 --- a/src/lte/doc/source/lte-design.rst +++ b/src/lte/doc/source/lte-design.rst @@ -77,13 +77,10 @@ figures :ref:`fig-lte-enb-architecture` and :ref:`fig-lte-ue-architecture`, whic deal respectively with the eNB and the UE. A detailed description of the most important components are provided in the following sections. - -.. figure:: figures/lte-ue-architecture.* - :align: right - .. _fig-lte-enb-architecture: .. figure:: figures/lte-enb-architecture.* + :align: center Architecture of the LTE eNB @@ -92,6 +89,7 @@ important components are provided in the following sections. .. _fig-lte-ue-architecture: .. figure:: figures/lte-ue-architecture.* + :align: center Architecture of the LTE UE @@ -139,6 +137,7 @@ between the blocks and the SAPs defined in our implementation of the MAC Scheduler Interface. .. figure:: figures/ff-mac-saps.* + :align: center In addition to the above principles, the following design choices have been taken: @@ -165,6 +164,7 @@ The figure below shows how the MAC Scheduler Interface is used within the eNB. .. figure:: figures/ff-example.* + :align: center The User side of both the CSCHED SAP and the SCHED SAP are implemented within the eNB MAC, i.e., in the file ``lte-enb-mac.cc``. @@ -354,8 +354,7 @@ discussed in [Ofcom2.6GHz]_. -.. [4] 3GPP R1-081483 (available on - http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip ) +.. [4] 3GPP R1-081483 (available `here `_ ) Physical layer diff --git a/src/lte/doc/source/lte-profiling.rst b/src/lte/doc/source/lte-profiling.rst new file mode 100644 index 000000000..77efc4f29 --- /dev/null +++ b/src/lte/doc/source/lte-profiling.rst @@ -0,0 +1,60 @@ +.. include:: replace.txt + + ++++++++++++++++++++++++++++++++++ + Profiling Documentation ++++++++++++++++++++++++++++++++++ + + + +Execution time and memory consumption +------------------------------------- + +In order to provide an evaluation of the execution time and +memory consumption, a +reference simulation program (``examples/profiling-reference``) has been +developed. This program simulates a scenario +composed by a set of eNodeBs, and a set of UEs attached to each eNB. All eNodeBs +have the same number of attached UEs. Communications are performed both in the +dowlink and in the uplink using a saturation model (i.e., each RLC instance +always has a PDU to transmit). The UEs are all in the same position than its +eNodeB and the eNodeBs are distributed in a line, each one 140m away from the +previous one. The total simulation time is set to 60s. + +Using this simulation program, we ran a simulation campaign varying the number +of eNBs as well as the number of UEs per eNB. For each simulation, we measured +the execution time using the ``time`` shell command in linux, and the memory +consumption by looking at the information in ``/proc/\{pid\}/statm``. The +reference hardware platform is an Intel Core2 Duo E8400 3.00GHz with 512 MB of +RAM memory running a Fedora Core 10 distribution with kernel +2.6.27.5. The simulator build used in this +experiment was configured with the options ``-d optimized +--enable-static``. + +The results are reported in `fig-simulationTime`_ and `fig-memoryUsage`_. +We note that the memory usage, as expected, +primarily depends on the number of eNBs, however is in general quite low. The +execution time depends significantly on both the number of eNBs and the number +of UEs per eNB. For the case of 10 UEs per eNB, we also show that the +experimental data can be fitted quite accurately by a quadratic function. We +suggest that this behavior is due to the fact that the +interference calculations have a computational complexity which is quadratic with +respect to the number of eNBs, and which is the dominant contribution in the overall +computational load. + + +.. _fig-simulationTime: + +.. figure:: figures/simulationTime.* + :align: center + + Execution time of the reference program for a simulation duration of 60s. + + +.. _fig-memoryUsage: + +.. figure:: figures/memoryUsage.* + :align: center + + Memory usage of the reference program. + diff --git a/src/lte/doc/source/lte-references.rst b/src/lte/doc/source/lte-references.rst index 0ec380904..448e90a15 100644 --- a/src/lte/doc/source/lte-references.rst +++ b/src/lte/doc/source/lte-references.rst @@ -1,5 +1,10 @@ +.. include:: replace.txt ++++++++++++++++++++++++++++++++++ + References ++++++++++++++++++++++++++++++++++ + .. [Sesia2009] S. Sesia, I. Toufik and M. Baker, "LTE - The UMTS Long Term Evolution - from theory to practice", Wiley, 2009 @@ -36,13 +41,13 @@ .. [TS36.104] 3GPP TS 36.104 "E-UTRA Base Station (BS) radio transmission and reception" -.. [R1-081483] 3GPP R1-081483 "Conveying MCS and TB size via PDCCH" http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip +.. [R1-081483] 3GPP R1-081483 `Conveying MCS and TB size via PDCCH `_ -.. [FFAPI] FemtoForum LTE MAC Scheduler Interface Specification v1.11 http://www.femtoforum.org/femto/technical.php +.. [FFAPI] `FemtoForum LTE MAC Scheduler Interface Specification v1.11 `_ -.. [ns3tutorial] The ns-3 Tutorial http://www.nsnam.org/docs/tutorial/singlehtml/index.html +.. [ns3tutorial] `The ns-3 Tutorial `_ -.. [ns3manual] The ns-3 Manual http://www.nsnam.org/docs/manual/singlehtml/index.html +.. [ns3manual] `The ns-3 Manual `_ .. [pl26ghz] Sun Kun; Wang Ping; Li Yingze, "Path loss models for suburban scenario at 2.3GHz, 2.6GHz and 3.5GHz", in Proc. of ISAPE 2008, Kunming, China, Nov 2008. @@ -56,5 +61,5 @@ .. [cost231] "Digital Mobile Radio: COST 231 View on the Evolution Towards 3rd Generation Systems", Commission of the European Communities, L-2920, Luxembourg, 1989 -.. [mathworks] Matlab R2011b Documentation Communications System Toolbox, "Methodology for Simulating Multipath Fading Channels" http://www.mathworks.es/help/toolbox/comm/ug/a1069449399.html#bq5zk36 +.. [mathworks] Matlab R2011b Documentation Communications System Toolbox, `Methodology for Simulating Multipath Fading Channels `_ diff --git a/src/lte/doc/source/lte-user.rst b/src/lte/doc/source/lte-user.rst index 4fe7f3379..666b63e27 100644 --- a/src/lte/doc/source/lte-user.rst +++ b/src/lte/doc/source/lte-user.rst @@ -7,7 +7,7 @@ Background -********** +---------- @@ -17,7 +17,7 @@ we strongly recommend the reader to consult [ns3tutorial]_. Usage Overview -************** +-------------- The ns-3 LTE model is a software library that allows the simulation of LTE networks. The process of performing such simulations typically involves the following @@ -161,7 +161,7 @@ Now create a text file named (for example) ``input-defaults.txt`` specifying the new default values that you want to use for some attributes:: default ns3::LenaHelper::Scheduler "ns3::PfFfMacScheduler" - default ns3::LenaHelper::PropagationModel "ns3::FriisSpectrumPropagationLossModel" + default ns3::LenaHelper::PathlossModel "ns3::FriisSpectrumPropagationLossModel" default ns3::LteEnbNetDevice::UlBandwidth "25" default ns3::LteEnbNetDevice::DlBandwidth "25" default ns3::LteEnbNetDevice::DlEarfcn "100" @@ -259,75 +259,16 @@ the ns-3 attributes ``ns3::MacStatsCalculator::DlOutputFilename`` and ``ns3::MacStatsCalculator::UlOutputFilename``. -Further Reading ---------------- +Fading Trace Usage +------------------ -The directory ``src/lte/examples/`` contains some example simulation programs that -show how to simulate different LTE scenarios. - - -Performance evaluation -********************** - -Execution time and memory consumption -------------------------------------- - -In order to provide an evaluation of the execution time and -memory consumption, a -reference simulation program (``examples/profiling-reference``) has been -developed. This program simulates a scenario -composed by a set of eNodeBs, and a set of UEs attached to each eNB. All eNodeBs -have the same number of attached UEs. Communications are performed both in the -dowlink and in the uplink using a saturation model (i.e., each RLC instance -always has a PDU to transmit). The UEs are all in the same position than its -eNodeB and the eNodeBs are distributed in a line, each one 140m away from the -previous one. The total simulation time is set to 60s. - -Using this simulation program, we ran a simulation campaign varying the number -of eNBs as well as the number of UEs per eNB. For each simulation, we measured -the execution time using the ``time`` shell command in linux, and the memory -consumption by looking at the information in ``/proc/\{pid\}/statm``. The -reference hardware platform is an Intel Core2 Duo E8400 3.00GHz with 512 MB of -RAM memory running a Fedora Core 10 distribution with kernel -2.6.27.5. The simulator build used in this -experiment was configured with the options ``-d optimized ---enable-static``. - -The results are reported in `fig-simulationTime`_ and `fig-memoryUsage`_. -We note that the memory usage, as expected, -primarily depends on the number of eNBs, however is in general quite low. The -execution time depends significantly on both the number of eNBs and the number -of UEs per eNB. For the case of 10 UEs per eNB, we also show that the -experimental data can be fitted quite accurately by a quadratic function. We -suggest that this behavior is due to the fact that the -interference calculations have a computational complexity which is quadratic with -respect to the number of eNBs, and which is the dominant contribution in the overall -computational load. - - -.. _fig-simulationTime: - -.. figure:: figures/simulationTime.* - :align: center - - Execution time of the reference program for a simulation duration of 60s. - - -.. _fig-memoryUsage: - -.. figure:: figures/memoryUsage.* - :align: center - - Memory usage of the reference program. - - -Fading Trace Management -*********************** +In this section we will describe how to use fading traces within LTE simulations. Fading Traces Generation ------------------------- +************************ -Thanks to the matlab script provided with the code (``/lte/model/fading-traces/fading-trace-generator.m``) it is possible to generate traces according to specific simulation scenarios. The script already includes the typical taps configurations for three 3GPP scenarios (i.e., pedestrian, vehicular and urban as defined in Annex B.2 of [TS36.104]_); however users can introduce their specific configurations. The list of the configurable parameters is provided in the following: + +It is possible to generate fading traces by using a dedicated matlab script provided with the code (``/lte/model/fading-traces/fading-trace-generator.m``). This script already includes the typical taps configurations for three 3GPP scenarios (i.e., pedestrian, vehicular and urban as defined in Annex B.2 of [TS36.104]_); however users can also introduce their specific configurations. The list of the configurable parameters is provided in the following: * ``fc`` : the frequency in use (it affects the computation of the dopples speed). * ``v_km_h`` : the speed of the users @@ -335,29 +276,31 @@ Thanks to the matlab script provided with the code (``/lte/model/fading-traces/f * ``numRBs`` : the number of the resource block to be evaluated. * ``tag`` : the tag to be applied to the file generated. -The file generated is formatted in a matrix fashion by putting each RBs temporal fading trace samples in different rows. -It has to be noted that, the model is able to manage external fading trace (e.g., generated with dedicated simulators or obtained in experimental way) which respect the format used by the model (i.e., ASCII file with temporal fading trace of each RB distributed in rows). +The file generated contains ASCII-formatted real values organized in a matrix fashion: every row corresponds to a different RB, and every column correspond to a different temporal fading trace sample. + +It has to be noted that the ns-3 LTE module is able to work with any fading trace file that complies with the above described ASCII format. Hence, other external tools can be used to generate custom fading traces, such as for example other simulators or experimental devices. Fading Traces Usage -------------------- +******************* -The proper set of the trace parameters in the simulation is of paramount importance for the correct interpretation of the trace itself within the simulator. -The list of the parameters to be configured are: +When using a fading trace, it is of paramount importance to specify correctly the trace parameters in the simulation, so that the fading model can load and use it correcly. +The parameters to be configured are: - * ``TraceFilename`` : the name of the trace to be loaded (absolute path o relative one according to the execution point of the script). - * ``TraceLength`` : the trace duration in seconds. - * ``SamplesNum`` : the number of samples. - * ``WindowSize`` : the size of the fading sampling window in seconds. + * ``TraceFilename`` : the name of the trace to be loaded (absolute path, or relative path w.r.t. the path from where the simulation program is executed); + * ``TraceLength`` : the trace duration in seconds; + * ``SamplesNum`` : the number of samples; + * ``WindowSize`` : the size of the fading sampling window in seconds; It is important to highlight that the sampling interval of the fading trace has to me at most of 1 ms or greater and in the latter case it has to be an integer multiple of 1 ms in order to be correctly processed by the fading module. -The default configuration of the matlab script provides a trace 10 seconds long, made of 10,000 samples (i.e., 1 sample per TTI ~ 1ms) and used with a windows size of 0.5 seconds amplitude. These are also the default values of the parameters above used in the simulator; therefore their settage can be avoided in case the fading trace respects them. -In order to activate the fading module (by default not active) it has to be explicitly specified in the simulation script:: +The default configuration of the matlab script provides a trace 10 seconds long, made of 10,000 samples (i.e., 1 sample per TTI=1ms) and used with a windows size of 0.5 seconds amplitude. These are also the default values of the parameters above used in the simulator; therefore their settage can be avoided in case the fading trace respects them. + +In order to activate the fading module (which is not active by default) the following code should be included in the simulation program:: Ptr lena = CreateObject (); lena->SetFadingModel("ns3::TraceFadingLossModel"); -While, for setting the parameters:: +And for setting the parameters:: lena->SetFadingModelAttribute ("TraceFilename", StringValue ("src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad")); lena->SetFadingModelAttribute ("TraceLength", TimeValue (Seconds (10.0))); @@ -365,49 +308,55 @@ While, for setting the parameters:: lena->SetFadingModelAttribute ("WindowSize", TimeValue (Seconds (0.5))); lena->SetFadingModelAttribute ("RbNum", UintegerValue (100)); -It has to be noted that, ``TraceFilename`` does not have a default value, therefore is has to be always set for using the fading module in the simulator. The simulator provide natively three fading traces generated according to the configurations defined in in Annex B.2 of [TS36.104]_ (available in the folder ``src/lte/model/fading-traces/``); examples of such traces are reported in `fig-fadingPedestrianTrace_`, `fig-fadingVehicularTrace_` and `fig-fadingUrbanTrace_`. +It has to be noted that, ``TraceFilename`` does not have a default value, therefore is has to be always set explicitly. + +The simulator provide natively three fading traces generated according to the configurations defined in in Annex B.2 of [TS36.104]_. These traces are available in the folder ``src/lte/model/fading-traces/``). An excerpt from these traces is represented in the following figures. .. _fig-fadingPedestrianTrace: .. figure:: figures/fading_pedestrian.* :align: center + :alt: Fading trace 3 kmph - Example of the fading trace included in the simulator for a pedestrian scenario (speed of 3 kmph). + Excerpt of the fading trace included in the simulator for a pedestrian scenario (speed of 3 kmph). .. _fig-fadingVehicularTrace: .. figure:: figures/fading_vehicular.* :align: center + :alt: Fading trace 60 kmph - Example of the fading trace included in the simulator for a vehicular scenario (speed of 60 kmph). + Excerpt of the fading trace included in the simulator for a vehicular scenario (speed of 60 kmph). .. _fig-fadingUrbanTrace: .. figure:: figures/fading_urban_3kmph.* :align: center + :alt: Fading trace 3 kmph - Example of the fading trace included in the simulator for an urban scenario (speed of 3 kmph). + Excerpt of the fading trace included in the simulator for an urban scenario (speed of 3 kmph). -Building Mobility Model ------------------------ +Buildings Mobility Model +------------------------ + +We now explain by examples how to use the buildings model (in particular, the ``BuildingMobilityModel`` and the ``BuildingPropagationModel`` classes) in an ns-3 simulation program to setup an LTE simulation scenario that includes buildings and indoor nodes. -In what following, a few guidelines for the usage of the ``BuildingMobilityModel`` and the ``BuildingPropagationModel`` classes. .. highlight:: none -#. Inheritance:: +#. Header files to be included:: #include #include #include -#. Propagation model selection:: +#. Pathloss model selection:: Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::BuildingsPropagationLossModel")); #. EUTRA Band Selection @@ -416,7 +365,7 @@ The selection of the working frequency of the propagation model has to be done w lena->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100)); lena->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100)); -It is to be noted that any other configuration (i.e., with BuildingsPropagationLossModel attributes) might generates conflicts in the frequencies definition in the modules during the simulation. +It is to be noted that using other means to configure the frequency used by the propagation model (i.e., configuring the corresponding BuildingsPropagationLossModel attributes directly) might generates conflicts in the frequencies definition in the modules during the simulation, and is therefore not advised. #. Mobility model selection:: @@ -450,7 +399,7 @@ It is to be noted that any other configuration (i.e., with BuildingsPropagationL building->SetNumberRoomX (3); building->SetNumberRoomY (2); - This will instantiate a residential building with base of 10 x 20 meters and height of 10 meters with concrete with windows as external walls, three floors and a grid of rooms of 3 x 2. + This will instantiate a residential building with base of 10 x 20 meters and height of 10 meters whose external walls are of concrete with windows; the building has three floors and has an internal 3 x 2 grid of rooms of equal size. #. Building and nodes interactions:: @@ -459,12 +408,18 @@ It is to be noted that any other configuration (i.e., with BuildingsPropagationL mm->SetRoomNumberX (1); mm->SetRoomNumberY (1); - This informs node's mobility model the fact that the node is inside the building at the second floor in the corner room of the 3 x 2 grid. - It has to be noted that the simulator does not check the consistence between the node's position and the building site, which is user's responsibility. - - - - + This informs the node's mobility model that the node is located inside the building on the second floor in the corner room of the 3 x 2 grid. + It has to be noted that the simulator does not check the consistence between the node's position (x,y,z coordinates) and the building position and size. The responsibility of this consistency is completely left to the user. + + + + + +Further Reading +--------------- + +The directory ``src/lte/examples/`` contains some example simulation programs that +show how to simulate different LTE scenarios. diff --git a/src/lte/doc/source/lte.rst b/src/lte/doc/source/lte.rst index 6ef9ea77e..b01a5699f 100644 --- a/src/lte/doc/source/lte.rst +++ b/src/lte/doc/source/lte.rst @@ -8,6 +8,7 @@ lte-design lte-user lte-testing + lte-profiling lte-references diff --git a/src/lte/examples/inter-cell-interference.cc b/src/lte/examples/inter-cell-interference.cc index 643acdfa2..b161da18a 100644 --- a/src/lte/examples/inter-cell-interference.cc +++ b/src/lte/examples/inter-cell-interference.cc @@ -65,7 +65,7 @@ int main (int argc, char *argv[]) Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/examples/lena-cqi-threshold.cc b/src/lte/examples/lena-cqi-threshold.cc index a6b026328..a5f53a480 100644 --- a/src/lte/examples/lena-cqi-threshold.cc +++ b/src/lte/examples/lena-cqi-threshold.cc @@ -78,7 +78,7 @@ int main (int argc, char *argv[]) cmd.Parse (argc, argv); Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); //lena->EnableLogComponents (); // LogComponentEnable ("LtePhy", LOG_LEVEL_ALL); diff --git a/src/lte/examples/lena-extract-pathloss.cc b/src/lte/examples/lena-extract-pathloss.cc index 036f41fba..6bdee2541 100644 --- a/src/lte/examples/lena-extract-pathloss.cc +++ b/src/lte/examples/lena-extract-pathloss.cc @@ -177,7 +177,7 @@ int main (int argc, char *argv[]) // but it WON'T work if you ONLY use SpectrumPropagationLossModels such as: // ns3::FriisSpectrumPropagationLossModel // ns3::ConstantSpectrumPropagationLossModel - lena->SetAttribute ("PropagationModel", StringValue ("ns3::Cost231PropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::Cost231PropagationLossModel")); // Create Nodes: eNodeB and UE diff --git a/src/lte/examples/lena-rlc-calculator.cc b/src/lte/examples/lena-rlc-calculator.cc index e7da26d21..b47f919e0 100644 --- a/src/lte/examples/lena-rlc-calculator.cc +++ b/src/lte/examples/lena-rlc-calculator.cc @@ -24,7 +24,7 @@ #include "ns3/mobility-module.h" #include "ns3/lte-module.h" #include "ns3/config-store.h" -#include "ns3/gtk-config-store.h" +//#include "ns3/gtk-config-store.h" using namespace ns3; @@ -43,7 +43,7 @@ int main (int argc, char *argv[]) Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Enable LTE log components //lena->EnableLogComponents (); diff --git a/src/lte/examples/lena-runtime-profiler.cc b/src/lte/examples/lena-runtime-profiler.cc index e7519e5e0..b3389b83e 100644 --- a/src/lte/examples/lena-runtime-profiler.cc +++ b/src/lte/examples/lena-runtime-profiler.cc @@ -23,7 +23,7 @@ #include "ns3/mobility-module.h" #include "ns3/lte-module.h" #include "ns3/config-store.h" -#include "ns3/gtk-config-store.h" +//#include "ns3/gtk-config-store.h" #include #include @@ -69,16 +69,16 @@ main (int argc, char *argv[]) Ptr < LenaHelper > lena = CreateObject (); //lena->EnableLogComponents (); - LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); + //LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); if (nFloors == 0) { - lena->SetAttribute("PropagationModel", + lena->SetAttribute("PathlossModel", StringValue("ns3::FriisPropagationLossModel")); nEnb = nEnbPerFloor; } else { - lena->SetAttribute("PropagationModel", + lena->SetAttribute("PathlossModel", StringValue("ns3::BuildingsPropagationLossModel")); nEnb = nFloors * nEnbPerFloor; } @@ -147,12 +147,13 @@ main (int argc, char *argv[]) building->SetNumberRoomY(nRooms); mobility.SetMobilityModel("ns3::BuildingsMobilityModel"); mobility.Install (enbNodes); + uint32_t plantedEnb = 0; for (uint32_t floor = 0; floor < nFloors; floor++) { - uint32_t plantedEnb = 0; + uint32_t plantedEnbPerFloor = 0; for (uint32_t row = 0; row < nRooms; row++) { - for (uint32_t column = 0; column < nRooms && plantedEnb < nEnbPerFloor; column++, plantedEnb++) + for (uint32_t column = 0; column < nRooms && plantedEnbPerFloor < nEnbPerFloor; column++, plantedEnb++, plantedEnbPerFloor++) { Vector v (roomLength * (column + 0.5), roomLength * (row + 0.5), @@ -209,7 +210,7 @@ main (int argc, char *argv[]) Simulator::Run(); -/* GtkConfigStore config; + /*GtkConfigStore config; config.ConfigureAttributes ();*/ Simulator::Destroy(); diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 8a79f8519..257186b57 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -21,38 +21,30 @@ #include "lena-helper.h" - #include #include #include #include - #include #include #include #include #include - #include #include #include #include #include #include - #include #include - #include #include #include #include - #include - #include - #include @@ -139,8 +131,8 @@ TypeId LenaHelper::GetTypeId (void) StringValue ("ns3::PfFfMacScheduler"), MakeStringAccessor (&LenaHelper::SetSchedulerType), MakeStringChecker ()) - .AddAttribute ("PropagationModel", - "The type of propagation model to be used", + .AddAttribute ("PathlossModel", + "The type of pathloss model to be used", StringValue ("ns3::BuildingsPropagationLossModel"), MakeStringAccessor (&LenaHelper::SetPropagationModelType), MakeStringChecker ()) @@ -210,7 +202,7 @@ LenaHelper::SetPropagationModelType (std::string type) } void -LenaHelper::SetPropagationModelAttribute (std::string n, const AttributeValue &v) +LenaHelper::SetPathlossModelAttribute (std::string n, const AttributeValue &v) { NS_LOG_FUNCTION (this << n); m_dlPropagationModelFactory.Set (n, v); @@ -359,6 +351,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) Ptr LenaHelper::InstallSingleUeDevice (Ptr n) { + NS_LOG_FUNCTION (this); Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); @@ -522,6 +515,7 @@ LenaHelper::GetRlcType (EpsBearer bearer) void LenaHelper::EnableLogComponents (void) { + LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL); LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL); LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL); LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL); @@ -578,12 +572,12 @@ FindImsiFromEnbRlcPath (std::string path) // We retrieve the UeInfo associated to the C-RNTI and perform the IMSI lookup std::string ueMapPath = path.substr (0, path.find ("/RadioBearerMap")); - NS_LOG_LOGIC ("ueMapPath = " << ueMapPath); Config::MatchContainer match = Config::LookupMatches (ueMapPath); if (match.GetN () != 0) { Ptr ueInfo = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromEnbRlcPath: " << path << ", " << ueInfo->GetObject ()->GetImsi ()); return ueInfo->GetObject ()->GetImsi (); } else @@ -606,6 +600,7 @@ FindCellIdFromEnbRlcPath (std::string path) if (match.GetN () != 0) { Ptr enbNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindCellIdFromEnbRlcPath: " << path << ", " << enbNetDevice->GetObject ()->GetCellId ()); return enbNetDevice->GetObject ()->GetCellId (); } else @@ -628,6 +623,7 @@ FindImsiFromUeRlcPath (std::string path) if (match.GetN () != 0) { Ptr ueNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromUeRlcPath: " << path << ", " << ueNetDevice->GetObject ()->GetImsi ()); return ueNetDevice->GetObject ()->GetImsi (); } else @@ -644,11 +640,11 @@ FindImsiFromEnbMac (std::string path, uint16_t rnti) // /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbMac/DlScheduling std::ostringstream oss; std::string p = path.substr (0, path.find ("/LteEnbMac")); - NS_LOG_LOGIC ("p = " << p); oss << rnti; p += "/LteEnbRrc/UeMap/" + oss.str (); - NS_LOG_LOGIC ("p = " << p); - return FindImsiFromEnbRlcPath (p); + uint64_t imsi = FindImsiFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindImsiFromEnbMac: " << path << ", " << rnti << ", " << imsi); + return imsi; } uint16_t @@ -660,7 +656,9 @@ FindCellIdFromEnbMac (std::string path, uint16_t rnti) std::string p = path.substr (0, path.find ("/LteEnbMac")); oss << rnti; p += "/LteEnbRrc/UeMap/" + oss.str (); - return FindCellIdFromEnbRlcPath (p); + uint16_t cellId = FindCellIdFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindCellIdFromEnbMac: " << path << ", "<< rnti << ", " << cellId); + return cellId; } @@ -774,25 +772,27 @@ DlSchedulingCallback (Ptr macStats, { NS_LOG_FUNCTION (macStats << path); uint64_t imsi = 0; - if (macStats->ExistsImsiPath(path) == true) + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << rnti; + if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true) { - imsi = macStats->GetImsiPath (path); + imsi = macStats->GetImsiPath (pathAndRnti.str ()); } else { imsi = FindImsiFromEnbMac (path, rnti); - macStats->SetImsiPath (path, imsi); + macStats->SetImsiPath (pathAndRnti.str (), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(path) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true) { - cellId = macStats->GetCellIdPath (path); + cellId = macStats->GetCellIdPath (pathAndRnti.str ()); } else { cellId = FindCellIdFromEnbMac (path, rnti); - macStats->SetCellIdPath (path, cellId); + macStats->SetCellIdPath (pathAndRnti.str (), cellId); } macStats->DlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); @@ -830,24 +830,26 @@ UlSchedulingCallback (Ptr macStats, std::string path, NS_LOG_FUNCTION (macStats << path); uint64_t imsi = 0; - if (macStats->ExistsImsiPath(path) == true) + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << rnti; + if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true) { - imsi = macStats->GetImsiPath (path); + imsi = macStats->GetImsiPath (pathAndRnti.str ()); } else { imsi = FindImsiFromEnbMac (path, rnti); - macStats->SetImsiPath (path, imsi); + macStats->SetImsiPath (pathAndRnti.str (), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(path) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true) { - cellId = macStats->GetCellIdPath (path); + cellId = macStats->GetCellIdPath (pathAndRnti.str ()); } else { cellId = FindCellIdFromEnbMac (path, rnti); - macStats->SetCellIdPath (path, cellId); + macStats->SetCellIdPath (pathAndRnti.str (), cellId); } macStats->UlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcs, size); diff --git a/src/lte/helper/lena-helper.h b/src/lte/helper/lena-helper.h index 8e930c926..b1e4400c2 100644 --- a/src/lte/helper/lena-helper.h +++ b/src/lte/helper/lena-helper.h @@ -86,7 +86,7 @@ public: * \param n the name of the attribute * \param v the value of the attribute */ - void SetPropagationModelAttribute (std::string n, const AttributeValue &v); + void SetPathlossModelAttribute (std::string n, const AttributeValue &v); /** * diff --git a/src/lte/helper/lte-stats-calculator.cc b/src/lte/helper/lte-stats-calculator.cc index dc66cd63a..2e3bf40a6 100644 --- a/src/lte/helper/lte-stats-calculator.cc +++ b/src/lte/helper/lte-stats-calculator.cc @@ -6,9 +6,11 @@ */ #include "lte-stats-calculator.h" +#include namespace ns3 { +NS_LOG_COMPONENT_DEFINE ("LteStatsCalculator"); LteStatsCalculator::LteStatsCalculator () : m_dlOutputFilename (""), @@ -86,6 +88,7 @@ LteStatsCalculator::ExistsImsiPath (std::string path) void LteStatsCalculator::SetImsiPath (std::string path, uint64_t imsi) { + NS_LOG_FUNCTION(this << path << imsi); m_pathImsiMap[path] = imsi; } @@ -111,6 +114,7 @@ LteStatsCalculator::ExistsCellIdPath (std::string path) void LteStatsCalculator::SetCellIdPath (std::string path, uint16_t cellId) { + NS_LOG_FUNCTION(this << path << cellId); m_pathCellIdMap[path] = cellId; } diff --git a/src/lte/helper/mac-stats-calculator.cc b/src/lte/helper/mac-stats-calculator.cc index c360b70e5..8ffa0a02b 100644 --- a/src/lte/helper/mac-stats-calculator.cc +++ b/src/lte/helper/mac-stats-calculator.cc @@ -56,7 +56,7 @@ void MacStatsCalculator::DlScheduling (uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << mcsTb1 << sizeTb1 << mcsTb2 << sizeTb2); NS_LOG_INFO ("Write DL Mac Stats in " << GetDlOutputFilename ().c_str ()); std::ofstream outFile; @@ -99,7 +99,7 @@ void MacStatsCalculator::UlScheduling (uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,uint8_t mcs, uint16_t size) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << mcs << size); NS_LOG_INFO ("Write UL Mac Stats in " << GetUlOutputFilename ().c_str ()); std::ofstream outFile; diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index 4feaa2e8b..238a13463 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -383,7 +383,7 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) // --- DOWNLINK --- // Send Dl-CQI info to the scheduler FfMacSchedSapProvider::SchedDlCqiInfoReqParameters dlcqiInfoReq; - dlcqiInfoReq.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + dlcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); int cqiNum = m_dlCqiReceived.size (); if (cqiNum > MAX_CQI_LIST) @@ -397,14 +397,14 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) // Get downlink transmission opportunities FfMacSchedSapProvider::SchedDlTriggerReqParameters params; // to be filled - params.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + params.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); m_schedSapProvider->SchedDlTriggerReq (params); // --- UPLINK --- // Send UL-CQI info to the scheduler FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqiInfoReq; - ulcqiInfoReq.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + ulcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); cqiNum = m_ulCqiReceived.size (); if (cqiNum >= 1) { @@ -422,7 +422,7 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) // Send BSR reports to the scheduler FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters ulMacReq; - ulMacReq.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + ulMacReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); ulMacReq.m_macCeList.insert (ulMacReq.m_macCeList.begin (), m_ulCeReceived.begin (), m_ulCeReceived.end ()); m_ulCeReceived.erase (m_ulCeReceived.begin (), m_ulCeReceived.end ()); m_schedSapProvider->SchedUlMacCtrlInfoReq (ulMacReq); @@ -430,7 +430,7 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) // Get uplink transmission opportunities FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams; - ulparams.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + ulparams.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); std::map ::iterator it; for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++) diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index 7c5bd0f13..ab8f264f5 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -62,12 +62,22 @@ TypeId LteUeNetDevice::GetTypeId (void) PointerValue (), MakePointerAccessor (&LteUeNetDevice::m_rrc), MakePointerChecker ()) - .AddAttribute ("Imsi", + .AddAttribute ("LteUeMac", + "The MAC associated to this UeNetDevice", + PointerValue (), + MakePointerAccessor (&LteUeNetDevice::m_mac), + MakePointerChecker ()) + .AddAttribute ("LteUePhy", + "The PHY associated to this UeNetDevice", + PointerValue (), + MakePointerAccessor (&LteUeNetDevice::m_phy), + MakePointerChecker ()) +/* .AddAttribute ("Imsi", "International Mobile Subscriber Identity assigned to this UE", TypeId::ATTR_GET, UintegerValue (0), // not used because the attribute is read-only MakeUintegerAccessor (&LteUeNetDevice::m_imsi), - MakeUintegerChecker ()) + MakeUintegerChecker ())*/ ; return tid; diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 2b1d064d3..2ed93392f 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -971,25 +971,29 @@ void PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params) { NS_LOG_FUNCTION (this); - //NS_LOG_DEBUG (this << " RX UL CQI at " << params.m_sfnSf); +// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf << " delay " << (uint32_t)m_schedTtiDelay); // correlate info on UL-CQIs with previous scheduling -> calculate m_sfnSf of transmission - uint32_t frameNo = (0xFF & params.m_sfnSf) >> 4; + uint32_t frameNo = (0x3FF & (params.m_sfnSf >> 4)); uint32_t subframeNo = (0xF & params.m_sfnSf); - //NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); - if (subframeNo - m_schedTtiDelay < 0) +// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); + if (subframeNo <= m_schedTtiDelay) { frameNo--; + subframeNo = (10 + subframeNo - m_schedTtiDelay) % 11; } - subframeNo = (subframeNo - m_schedTtiDelay) % 10; - //NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo); - uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + else + { + subframeNo = (subframeNo - m_schedTtiDelay) % 11; + } + uint16_t sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); +// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf); // retrieve the allocation for this subframe std::map >::iterator itMap; std::map >::iterator itCqi; itMap = m_allocationMaps.find (sfnSf); if (itMap == m_allocationMaps.end ()) { - NS_LOG_DEBUG (this << " Does not find info on allocation"); + NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); return; } for (uint32_t i = 0; i < (*itMap).second.size (); i++) @@ -1033,7 +1037,7 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched } // remove obsolete info on allocation - m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap); + m_allocationMaps.erase (itMap); return; } diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 4f044e33c..ffd8fa127 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -321,7 +321,7 @@ RrFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::Sch { NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity); // API generated by RLC for updating RLC parameters on a LC (tx and retx queues) - std::vector::iterator it; + std::list::iterator it; bool newLc = true; for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++) { @@ -375,6 +375,12 @@ RrFfMacScheduler::GetRbgSize (int dlbandwidth) return (-1); } +bool +RrFfMacScheduler::SortRlcBufferReq (FfMacSchedSapProvider::SchedDlRlcBufferReqParameters i,FfMacSchedSapProvider::SchedDlRlcBufferReqParameters j) +{ + return (i.m_rnti::iterator it; + std::list::iterator it; + m_rlcBufferReq.sort (SortRlcBufferReq); int nflows = 0; std::map lcActivesPerRnti; std::map ::iterator itLcRnti; @@ -807,18 +814,22 @@ void RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params) { NS_LOG_FUNCTION (this); - //NS_LOG_DEBUG (this << " RX UL CQI at " << params.m_sfnSf); +// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf); // correlate info on UL-CQIs with previous scheduling -> calculate m_sfnSf of transmission - uint32_t frameNo = (0xFF & params.m_sfnSf) >> 4; + uint32_t frameNo = (0x3FF & (params.m_sfnSf >> 4)); uint32_t subframeNo = (0xF & params.m_sfnSf); //NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); - if (subframeNo - m_schedTtiDelay < 0) + if (subframeNo <= m_schedTtiDelay) { frameNo--; + subframeNo = (10 + subframeNo - m_schedTtiDelay) % 11; } - subframeNo = (subframeNo - m_schedTtiDelay) % 10; - //NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo); - uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo); + else + { + subframeNo = (subframeNo - m_schedTtiDelay) % 11; + } + uint16_t sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); +// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf); // retrieve the allocation for this subframe std::map >::iterator itMap; std::map >::iterator itCqi; @@ -867,7 +878,7 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched } // remove obsolete info on allocation - m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap); + m_allocationMaps.erase (itMap); return; } diff --git a/src/lte/model/rr-ff-mac-scheduler.h b/src/lte/model/rr-ff-mac-scheduler.h index 1d2807143..ca2d16d05 100644 --- a/src/lte/model/rr-ff-mac-scheduler.h +++ b/src/lte/model/rr-ff-mac-scheduler.h @@ -119,13 +119,15 @@ private: int GetRbgSize (int dlbandwidth); + static bool SortRlcBufferReq (FfMacSchedSapProvider::SchedDlRlcBufferReqParameters i,FfMacSchedSapProvider::SchedDlRlcBufferReqParameters j); + void RefreshDlCqiMaps(void); void RefreshUlCqiMaps(void); /* * Vectors of UE's RLC info */ - std::vector m_rlcBufferReq; + std::list m_rlcBufferReq; /* * Map of UE's DL CQI P01 received diff --git a/src/lte/test/lte-test-fading.cc b/src/lte/test/lte-test-fading.cc index cf31512e4..0eece5fb5 100644 --- a/src/lte/test/lte-test-fading.cc +++ b/src/lte/test/lte-test-fading.cc @@ -85,7 +85,7 @@ LteFadingTestSuite::LteFadingTestSuite () Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::BuildingsPropagationLossModel")); // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB) NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-interference.cc b/src/lte/test/lte-test-interference.cc index 287dbf865..cf89c3330 100644 --- a/src/lte/test/lte-test-interference.cc +++ b/src/lte/test/lte-test-interference.cc @@ -116,7 +116,7 @@ LteInterferenceTestCase::DoRun (void) // lena->EnableLogComponents (); lena->EnableMacTraces (); lena->EnableRlcTraces (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-link-adaptation.cc b/src/lte/test/lte-test-link-adaptation.cc index 6a88fba43..f28f5e5e1 100644 --- a/src/lte/test/lte-test-link-adaptation.cc +++ b/src/lte/test/lte-test-link-adaptation.cc @@ -162,9 +162,9 @@ LteLinkAdaptationTestCase::DoRun (void) // lena->EnableLogComponents (); lena->EnableMacTraces (); lena->EnableRlcTraces (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::ConstantSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::ConstantSpectrumPropagationLossModel")); NS_LOG_INFO ("SNR = " << m_snrDb << " LOSS = " << m_loss); - lena->SetPropagationModelAttribute ("Loss", DoubleValue (m_loss)); + lena->SetPathlossModelAttribute ("Loss", DoubleValue (m_loss)); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-pathloss-model.cc b/src/lte/test/lte-test-pathloss-model.cc index 40357466a..33b04563f 100644 --- a/src/lte/test/lte-test-pathloss-model.cc +++ b/src/lte/test/lte-test-pathloss-model.cc @@ -207,16 +207,16 @@ LtePathlossModelSystemTestCase::DoRun (void) // lena->EnableLogComponents (); lena->EnableMacTraces (); lena->EnableRlcTraces (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::BuildingsPropagationLossModel")); // set frequency. This is important because it changes the behavior of the pathloss model lena->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (200)); // remove shadowing component - lena->SetPropagationModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); - lena->SetPropagationModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); - lena->SetPropagationModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); + lena->SetPathlossModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); + lena->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); + lena->SetPathlossModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc index 6566f9b02..ccbba68d0 100644 --- a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc @@ -241,7 +241,7 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Create Nodes: eNodeB and UE NodeContainer enbNodes; @@ -422,7 +422,7 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void) Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc index bbf8442e9..f5467b662 100644 --- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc @@ -229,7 +229,7 @@ LenaRrFfMacSchedulerTestCase::DoRun (void) Ptr lena = CreateObject (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/test/lte-test-run-time.pl b/src/lte/test/lte-test-run-time.pl index 93ba5592c..d257c21f2 100755 --- a/src/lte/test/lte-test-run-time.pl +++ b/src/lte/test/lte-test-run-time.pl @@ -12,8 +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 ); -my @simTime = ( 1 ); +my @simTime = ( 1, 5, 10, 20, 30, 40 ); my $traceDirectory = "."; my $traceDirectory = getcwd() . "/"; diff --git a/src/lte/test/test-lte-epc-e2e-data.cc b/src/lte/test/test-lte-epc-e2e-data.cc index 2ed13a0df..60a03a285 100644 --- a/src/lte/test/test-lte-epc-e2e-data.cc +++ b/src/lte/test/test-lte-epc-e2e-data.cc @@ -105,7 +105,7 @@ LteEpcE2eDataTestCase::DoRun () Ptr epcHelper = CreateObject (); lteHelper->SetEpcHelper (epcHelper); - lteHelper->SetAttribute("PropagationModel", + lteHelper->SetAttribute("PathlossModel", StringValue("ns3::FriisPropagationLossModel")); Ptr pgw = epcHelper->GetPgwNode ();