1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2014 Piotr Gawlowicz 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation; 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com> 19 * 20 */ 21 22 #ifndef LTE_TEST_DOWNLINK_FR_H 23 #define LTE_TEST_DOWNLINK_FR_H 24 25 #include "ns3/test.h" 26 #include "ns3/spectrum-value.h" 27 #include <ns3/lte-rrc-sap.h> 28 29 #include "ns3/spectrum-test.h" 30 #include "ns3/lte-spectrum-value-helper.h" 31 32 using namespace ns3; 33 34 /** 35 * \ingroup lte-test 36 * \ingroup tests 37 * 38 * \brief Test the fractional frequency reuse algorithms. 39 */ 40 class LteFrequencyReuseTestSuite : public TestSuite 41 { 42 public: 43 LteFrequencyReuseTestSuite (); 44 }; 45 46 /** 47 * \ingroup lte-test 48 * \ingroup tests 49 * 50 * \brief Test frequency reuse algorithm. Test fails if the muted frequencies 51 * are being used. 52 */ 53 class LteFrTestCase : public TestCase 54 { 55 public: 56 /** 57 * Constructor 58 * 59 * \param name the reference name 60 * \param userNum the number of UE nodes 61 * \param dlBandwidth the DL bandwidth 62 * \param ulBandwidth the UL bandwidth 63 * \param availableDlRb the available DL per RB 64 * \param availableUlRb the available UL per RB 65 */ 66 LteFrTestCase (std::string name, 67 uint32_t userNum,uint16_t dlBandwidth,uint16_t ulBandwidth, 68 std::vector<bool> availableDlRb, std::vector<bool> availableUlRb); 69 virtual ~LteFrTestCase (); 70 71 /** 72 * DL data receive start function 73 * \param spectrumValue the DL data reeive spectrum value 74 */ 75 void DlDataRxStart (Ptr<const SpectrumValue> spectrumValue); 76 /** 77 * UL data receive start function 78 * \param spectrumValue the UL data reeive spectrum value 79 */ 80 void UlDataRxStart (Ptr<const SpectrumValue> spectrumValue); 81 82 protected: 83 virtual void DoRun (void); 84 85 uint32_t m_userNum; ///< the number of UE nodes 86 uint16_t m_dlBandwidth; ///< the DL bandwidth 87 uint16_t m_ulBandwidth; ///< the UL bandwidth 88 89 std::vector<bool> m_availableDlRb; ///< the available DL for each RB 90 bool m_usedMutedDlRbg; ///< used muted DL RBG? 91 92 std::vector<bool> m_availableUlRb; ///< the available UL for each RB 93 bool m_usedMutedUlRbg; ///< used muted UL RBG? 94 }; 95 96 97 /** 98 * \ingroup lte-test 99 * \ingroup tests 100 * 101 * \brief Test hard frequency reuse algorithm. Test fails if the muted 102 * frequencies are being used. 103 */ 104 class LteHardFrTestCase : public LteFrTestCase 105 { 106 public: 107 /** 108 * Constructor 109 * 110 * \param name the reference name 111 * \param userNum the number of UE nodes 112 * \param schedulerType the scheduler type 113 * \param dlBandwidth the DL bandwidth 114 * \param ulBandwidth the UL bandwidth 115 * \param dlSubBandOffset DL subband offset 116 * \param dlSubBandwidth DL subbandwidth 117 * \param ulSubBandOffset UL subband offset 118 * \param ulSubBandwidth UL subbandwidth 119 * \param availableDlRb the available DL per RB 120 * \param availableUlRb the avaialbel UL per RB 121 */ 122 LteHardFrTestCase (std::string name, uint32_t userNum, 123 std::string schedulerType, 124 uint16_t dlBandwidth, uint16_t ulBandwidth, 125 uint8_t dlSubBandOffset, uint16_t dlSubBandwidth, 126 uint8_t ulSubBandOffset, uint16_t ulSubBandwidth, 127 std::vector<bool> availableDlRb, std::vector<bool> availableUlRb); 128 virtual ~LteHardFrTestCase (); 129 130 private: 131 virtual void DoRun (void); 132 133 std::string m_schedulerType; ///< the scheduler type 134 135 uint8_t m_dlSubBandOffset; ///< the DL subband offset 136 uint8_t m_dlSubBandwidth; ///< the DL subband width 137 138 uint8_t m_ulSubBandOffset; ///< UL subband offset 139 uint8_t m_ulSubBandwidth; ///< UL subband offset 140 }; 141 142 /** 143 * \ingroup lte-test 144 * \ingroup tests 145 * 146 * \brief Test stric frequency reuse algorithm. Test fails if the muted frequencies 147 * are being used. 148 */ 149 class LteStrictFrTestCase : public LteFrTestCase 150 { 151 public: 152 /** 153 * Constructor 154 * 155 * \param name the reference name 156 * \param userNum the number of UE nodes 157 * \param schedulerType the scheduler type 158 * \param dlBandwidth the DL bandwidth 159 * \param ulBandwidth the UL bandwidth 160 * \param dlCommonSubBandwidth DL common bandwidth 161 * \param dlEdgeSubBandOffset DL edge subband offset 162 * \param dlEdgeSubBandwidth DL edge subbandwidth 163 * \param ulCommonSubBandwidth UL common subbandwidth 164 * \param ulEdgeSubBandOffset UL subband offset 165 * \param ulEdgeSubBandwidth UL subbandwidth 166 * \param availableDlRb the available DL per RB 167 * \param availableUlRb the avaialbel UL per RB 168 */ 169 LteStrictFrTestCase (std::string name, uint32_t userNum, 170 std::string schedulerType, 171 uint16_t dlBandwidth, uint16_t ulBandwidth, 172 uint16_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint16_t dlEdgeSubBandwidth, 173 uint16_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint16_t ulEdgeSubBandwidth, 174 std::vector<bool> availableDlRb, std::vector<bool> availableUlRb); 175 virtual ~LteStrictFrTestCase (); 176 177 private: 178 virtual void DoRun (void); 179 180 std::string m_schedulerType; ///< scheduler type 181 182 uint16_t m_dlCommonSubBandwidth; ///< DL common subbandwidth 183 uint8_t m_dlEdgeSubBandOffset; ///< DL edge subband offset 184 uint16_t m_dlEdgeSubBandwidth; ///< DL edge subbandwidth 185 186 uint16_t m_ulCommonSubBandwidth; ///< UL common subbandwidth 187 uint8_t m_ulEdgeSubBandOffset; ///< UL edge subband offset 188 uint16_t m_ulEdgeSubBandwidth; ///< UL edge subbandwidth 189 }; 190 191 /** 192 * \ingroup lte-test 193 * \ingroup tests 194 * 195 * \brief Test frequency reuse algorithm by teleporing UEs to different 196 * parts of area and checking if the frequency is used according to the 197 * frequency pattern for different parts of area. Test fails if the muted 198 * frequencies for a given part of area are being used by UE. 199 */ 200 class LteFrAreaTestCase : public TestCase 201 { 202 public: 203 /** 204 * Constructor 205 * 206 * \param name the reference name 207 * \param schedulerType the scheduler type 208 */ 209 LteFrAreaTestCase (std::string name, std::string schedulerType); 210 virtual ~LteFrAreaTestCase (); 211 212 /** 213 * DL data receive start function 214 * \param spectrumValue the DL receive specturm value 215 */ 216 void DlDataRxStart (Ptr<const SpectrumValue> spectrumValue); 217 /** 218 * UL data receive start function 219 * \param spectrumValue the UL receive specturm value 220 */ 221 void UlDataRxStart (Ptr<const SpectrumValue> spectrumValue); 222 223 /** 224 * Simple teleport UE function 225 * \param x the X position 226 * \param y the Y position 227 */ 228 void SimpleTeleportUe (uint32_t x, uint32_t y); 229 /** 230 * Teleport UE function 231 * \param x the X position 232 * \param y the Y position 233 * \param expectedPower the expected power 234 * \param expectedDlRb the expected DL pwr RB 235 */ 236 void TeleportUe (uint32_t x, uint32_t y, double expectedPower, std::vector<bool> expectedDlRb); 237 /** 238 * Teleport UE 2 function 239 * \param ueNode the UE node 240 * \param x the X position 241 * \param y the Y position 242 * \param expectedPower the expected power 243 * \param expectedDlRb the expected DL pwr RB 244 */ 245 void TeleportUe2 (Ptr<Node> ueNode, uint32_t x, uint32_t y, double expectedPower, 246 std::vector<bool> expectedDlRb); 247 248 /** 249 * Set DL expected values function 250 * \param expectedPower the expected power 251 * \param expectedDlRb the expected DL pwr RB 252 */ 253 void SetDlExpectedValues (double expectedPower, std::vector<bool> expectedDlRb); 254 /** 255 * Set UL expected values function 256 * \param expectedPower the expected power 257 * \param expectedDlRb the expected DL pwr RB 258 */ 259 void SetUlExpectedValues (double expectedPower, std::vector<bool> expectedDlRb); 260 261 protected: 262 virtual void DoRun (void); 263 264 std::string m_schedulerType; ///< the scheduler type 265 266 uint16_t m_dlBandwidth; ///< the DL bandwidth 267 uint16_t m_ulBandwidth; ///< the UL bandwidth 268 269 Time m_teleportTime; ///< the telport time 270 Ptr<MobilityModel> m_ueMobility; ///< the UE mobility model 271 272 double m_expectedDlPower; ///< the expected DL power 273 std::vector<bool> m_expectedDlRb; ///< the expected DL per RB 274 bool m_usedWrongDlRbg; ///< used wrong DL RBG? 275 bool m_usedWrongDlPower; ///< used wrong DL power? 276 277 double m_expectedUlPower; ///< expected UL power 278 std::vector<bool> m_expectedUlRb; ///< expected UL per RB 279 bool m_usedWrongUlRbg; ///< used wrong UL RBG? 280 bool m_usedWrongUlPower; ///< used wrong UL power? 281 282 }; 283 284 /** 285 * \ingroup lte-test 286 * \ingroup tests 287 * 288 * \brief Lte Fr Area Test Case 289 */ 290 class LteStrictFrAreaTestCase : public LteFrAreaTestCase 291 { 292 public: 293 /** 294 * Constructor 295 * 296 * \param name the reference name 297 * \param schedulerType the scheduler type 298 */ 299 LteStrictFrAreaTestCase (std::string name, std::string schedulerType); 300 virtual ~LteStrictFrAreaTestCase (); 301 302 private: 303 virtual void DoRun (void); 304 }; 305 306 /** 307 * \ingroup lte-test 308 * \ingroup tests 309 * 310 * \brief Lte Soft Fr Area Test Case 311 */ 312 class LteSoftFrAreaTestCase : public LteFrAreaTestCase 313 { 314 public: 315 /** 316 * Constructor 317 * 318 * \param name the reference name 319 * \param schedulerType the scheduler type 320 */ 321 LteSoftFrAreaTestCase (std::string name, std::string schedulerType); 322 virtual ~LteSoftFrAreaTestCase (); 323 324 private: 325 virtual void DoRun (void); 326 327 }; 328 329 /** 330 * \ingroup lte-test 331 * \ingroup tests 332 * 333 * \brief Lte Soft Ffr Area Test Case 334 */ 335 class LteSoftFfrAreaTestCase : public LteFrAreaTestCase 336 { 337 public: 338 /** 339 * Constructor 340 * 341 * \param name the reference name 342 * \param schedulerType the scheduler type 343 */ 344 LteSoftFfrAreaTestCase (std::string name, std::string schedulerType); 345 virtual ~LteSoftFfrAreaTestCase (); 346 347 private: 348 virtual void DoRun (void); 349 350 }; 351 352 /** 353 * \ingroup lte-test 354 * \ingroup tests 355 * 356 * \brief Lte Enhanced Ffr Area Test Case 357 */ 358 class LteEnhancedFfrAreaTestCase : public LteFrAreaTestCase 359 { 360 public: 361 /** 362 * Constructor 363 * 364 * \param name the reference name 365 * \param schedulerType the scheduler type 366 */ 367 LteEnhancedFfrAreaTestCase (std::string name, std::string schedulerType); 368 virtual ~LteEnhancedFfrAreaTestCase (); 369 370 private: 371 virtual void DoRun (void); 372 373 }; 374 375 /** 376 * \ingroup lte-test 377 * \ingroup tests 378 * 379 * \brief Lte Distributed Ffr Area Test Case 380 */ 381 class LteDistributedFfrAreaTestCase : public LteFrAreaTestCase 382 { 383 public: 384 /** 385 * Constructor 386 * 387 * \param name the reference name 388 * \param schedulerType the scheduler type 389 */ 390 LteDistributedFfrAreaTestCase (std::string name, std::string schedulerType); 391 virtual ~LteDistributedFfrAreaTestCase (); 392 393 private: 394 virtual void DoRun (void); 395 396 }; 397 398 #endif /* LTE_TEST_DOWNLINK_FR_H */ 399