5G-LENA  nr-v3.0-29-g83cc959
The 5G/NR module for the ns-3 simulator
cc-bwp-helper.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 
3 // Copyright (c) 2020 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4 //
5 // SPDX-License-Identifier: GPL-2.0-only
6 
7 #ifndef CC_BWP_HELPER_H
8 #define CC_BWP_HELPER_H
9 
10 #include <ns3/propagation-loss-model.h>
11 #include <ns3/ptr.h>
12 #include <ns3/spectrum-channel.h>
13 #include <ns3/spectrum-propagation-loss-model.h>
14 
15 #include <memory>
16 #include <vector>
17 
18 namespace ns3
19 {
20 
21 /*
22  * Upper limits of the number of component carriers used for Carrier
23  * Aggregation (CA). In NR, this number depends on the CC contiguousness.
24  * Eventually, the number of CCs may also depend on the operation frequency
25  */
26 static const uint8_t MAX_CC_INTRA_BAND =
27  8;
28 static const uint8_t MAX_CC_INTER_BAND =
29  16;
31 
50 {
51  uint8_t m_bwpId{0};
52  double m_centralFrequency{0.0};
53  double m_lowerFrequency{0.0};
54  double m_higherFrequency{0.0};
55  double m_channelBandwidth{0.0};
56 
60  enum Scenario
61  {
62  RMa,
67  UMa,
82  Custom
83  } m_scenario{RMa};
84 
89  std::string GetScenario() const;
90 
91  BandwidthPartInfo() = default;
123  BandwidthPartInfo(uint8_t bwpId,
124  double centralFrequency,
125  double channelBandwidth,
126  enum Scenario scenario = BandwidthPartInfo::Custom);
127 
128  Ptr<SpectrumChannel>
130  Ptr<PropagationLossModel>
132  Ptr<PhasedArraySpectrumPropagationLossModel>
134 };
135 
140 typedef std::unique_ptr<BandwidthPartInfo> BandwidthPartInfoPtr;
145 typedef std::unique_ptr<const BandwidthPartInfo> BandwidthPartInfoConstPtr;
150 typedef std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> BandwidthPartInfoPtrVector;
151 
152 std::ostream& operator<<(std::ostream& os, const BandwidthPartInfo& item);
153 
159 {
160  uint8_t m_ccId{0};
161  double m_centralFrequency{0};
162  double m_lowerFrequency{0};
163  double m_higherFrequency{0};
164  double m_channelBandwidth{0};
165 
166  std::vector<BandwidthPartInfoPtr> m_bwp;
167 
173  bool AddBwp(BandwidthPartInfoPtr&& bwp);
174 };
175 
180 typedef std::unique_ptr<ComponentCarrierInfo> ComponentCarrierInfoPtr;
181 
182 std::ostream& operator<<(std::ostream& os, const ComponentCarrierInfo& item);
183 
192 {
193  uint8_t m_bandId{0};
194  double m_centralFrequency{0.0};
195  double m_lowerFrequency{0.0};
196  double m_higherFrequency{0.0};
197  double m_channelBandwidth{0};
198 
199  std::vector<ComponentCarrierInfoPtr> m_cc;
200 
207  bool AddCc(ComponentCarrierInfoPtr&& cc);
208 
215  BandwidthPartInfoPtr& GetBwpAt(uint32_t ccId, uint32_t bwpId) const;
216 
222 };
223 
224 std::ostream& operator<<(std::ostream& os, const OperationBandInfo& item);
225 
236 {
237  public:
252  {
260  SimpleOperationBandConf(double centralFreq = 28e9,
261  double channelBw = 400e6,
262  uint8_t numCc = 1,
263  BandwidthPartInfo::Scenario scenario = BandwidthPartInfo::RMa)
264  : m_centralFrequency(centralFreq),
265  m_channelBandwidth(channelBw),
266  m_numCc(numCc),
267  m_scenario(scenario)
268  {
269  }
270 
271  double m_centralFrequency{28e9};
272  double m_channelBandwidth{400e6};
273  uint8_t m_numCc{1};
274  uint8_t m_numBwp{1};
275  BandwidthPartInfo::Scenario m_scenario{BandwidthPartInfo::RMa};
276  };
277 
287  OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf& conf);
288 
295  const std::vector<SimpleOperationBandConf>& configuration);
296 
304  const std::vector<std::reference_wrapper<OperationBandInfo>>& operationBands);
305 
312  static void PlotNrCaBwpConfiguration(const std::vector<OperationBandInfo*>& bands,
313  const std::string& filename);
314 
321  static void PlotLteCaConfiguration(const std::vector<OperationBandInfo*>& bands,
322  const std::string& filename);
323 
324  private:
325  void InitializeCc(std::unique_ptr<ComponentCarrierInfo>& cc,
326  double ccBandwidth,
327  double lowerFreq,
328  uint8_t ccPosition,
329  uint8_t ccId) const;
330  void InitializeBwp(std::unique_ptr<BandwidthPartInfo>& bwp,
331  double bwOfBwp,
332  double lowerFreq,
333  uint8_t bwpPosition,
334  uint8_t bwpId) const;
335  std::unique_ptr<ComponentCarrierInfo> CreateCc(double ccBandwidth,
336  double lowerFreq,
337  uint8_t ccPosition,
338  uint8_t ccId,
339  uint8_t bwpNumber,
340  BandwidthPartInfo::Scenario scenario);
341 
353  static void PlotFrequencyBand(std::ofstream& outFile,
354  uint16_t index,
355  double xmin,
356  double xmax,
357  double ymin,
358  double ymax,
359  const std::string& label);
360 
361  uint8_t m_operationBandCounter{0};
362  uint8_t m_componentCarrierCounter{0};
363  uint8_t m_bandwidthPartCounter{0};
364 };
365 
366 } // namespace ns3
367 
368 #endif /* CC_BWP_HELPER_H */
Manages the correct creation of operation bands, component carriers and bandwidth parts.
OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf &conf)
Create an operation band with the CC specified.
static void PlotLteCaConfiguration(const std::vector< OperationBandInfo * > &bands, const std::string &filename)
Plots the CA/BWP configuration using GNUPLOT. There must be a valid configuration.
static void PlotNrCaBwpConfiguration(const std::vector< OperationBandInfo * > &bands, const std::string &filename)
Plots the CA/BWP configuration using GNUPLOT. There must be a valid configuration.
OperationBandInfo CreateOperationBandNonContiguousCc(const std::vector< SimpleOperationBandConf > &configuration)
Creates an operation band with non-contiguous CC.
static BandwidthPartInfoPtrVector GetAllBwps(const std::vector< std::reference_wrapper< OperationBandInfo >> &operationBands)
Get all the BWP pointers from the specified vector of operation bands.
static std::ostream & operator<<(std::ostream &os, const TrafficTypeConf &item)
operator << for TrafficTypeConf
std::unique_ptr< const BandwidthPartInfo > BandwidthPartInfoConstPtr
unique_ptr of a const BandwidthPartInfo
std::unique_ptr< BandwidthPartInfo > BandwidthPartInfoPtr
unique_ptr of BandwidthPartInfo
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
static const uint8_t MAX_CC_INTRA_BAND
. 16, 8
Definition: cc-bwp-helper.h:26
std::unique_ptr< ComponentCarrierInfo > ComponentCarrierInfoPtr
unique_ptr of ComponentCarrierInfo
static const uint8_t MAX_CC_INTER_BAND
Definition: cc-bwp-helper.h:28
Ptr< SpectrumChannel > m_channel
Channel for the Bwp. Leave it nullptr to let the helper fill it.
double m_centralFrequency
BWP central frequency.
Definition: cc-bwp-helper.h:52
double m_lowerFrequency
BWP lower frequency.
Definition: cc-bwp-helper.h:53
uint8_t m_bwpId
BWP id.
Definition: cc-bwp-helper.h:51
Ptr< PhasedArraySpectrumPropagationLossModel > m_3gppChannel
Nr Channel. Leave it nullptr to let the helper fill it.
double m_channelBandwidth
BWP bandwidth.
Definition: cc-bwp-helper.h:55
std::string GetScenario() const
Retrieve a string version of the scenario.
Ptr< PropagationLossModel > m_propagation
Propagation model. Leave it nullptr to let the helper fill it.
double m_higherFrequency
BWP higher frequency.
Definition: cc-bwp-helper.h:54
Scenario
Different types for the propagation loss model of this bandwidth part.
Definition: cc-bwp-helper.h:61
@ UMi_Buildings
UMi_StreetCanyon with buildings.
Definition: cc-bwp-helper.h:79
@ Custom
User-defined custom scenario.
Definition: cc-bwp-helper.h:82
@ UMa_LoS
UMa where all the nodes will be in Line-of-Sight.
Definition: cc-bwp-helper.h:65
@ RMa_LoS
RMa where all the nodes will be in Line-of-Sight.
Definition: cc-bwp-helper.h:63
@ InH_OfficeOpen
InH_OfficeOpen.
Definition: cc-bwp-helper.h:72
@ InH_OfficeOpen_nLoS
indoor office where all the nodes will not be in Line-of-Sight
Definition: cc-bwp-helper.h:74
@ V2V_Highway
V2V_Highway.
Definition: cc-bwp-helper.h:80
@ RMa_nLoS
RMA where all the nodes will not be in Line-of-Sight.
Definition: cc-bwp-helper.h:64
@ InH_OfficeMixed_nLoS
indoor office where all the nodes will not be in Line-of-Sight
Definition: cc-bwp-helper.h:77
@ UMa_Buildings
UMa with buildings.
Definition: cc-bwp-helper.h:78
@ InH_OfficeOpen_LoS
indoor office where all the nodes will be in Line-of-Sight
Definition: cc-bwp-helper.h:73
@ UMa_nLoS
UMa where all the nodes will not be in Line-of-Sight.
Definition: cc-bwp-helper.h:66
@ UMi_StreetCanyon_LoS
UMi_StreetCanyon where all the nodes will be in Line-of-Sight.
Definition: cc-bwp-helper.h:69
@ InH_OfficeMixed
InH_OfficeMixed.
Definition: cc-bwp-helper.h:75
@ UMi_StreetCanyon
UMi_StreetCanyon.
Definition: cc-bwp-helper.h:68
@ InH_OfficeMixed_LoS
indoor office where all the nodes will be in Line-of-Sight
Definition: cc-bwp-helper.h:76
Minimum configuration requirements for a OperationBand.
uint8_t m_numCc
Number of CC in this OpBand.
uint8_t m_numBwp
Number of BWP per CC.
SimpleOperationBandConf(double centralFreq=28e9, double channelBw=400e6, uint8_t numCc=1, BandwidthPartInfo::Scenario scenario=BandwidthPartInfo::RMa)
Default constructor.
double m_channelBandwidth
Total Bandwidth of the operation band.
BandwidthPartInfo::Scenario m_scenario
Scenario.
Component carrier configuration element.
double m_higherFrequency
BWP higher frequency.
bool AddBwp(BandwidthPartInfoPtr &&bwp)
Adds a bandwidth part configuration to the carrier.
double m_lowerFrequency
BWP lower frequency.
std::vector< BandwidthPartInfoPtr > m_bwp
Space for BWP.
double m_channelBandwidth
BWP bandwidth.
double m_centralFrequency
BWP central frequency.
Operation band information structure.
double m_channelBandwidth
Operation band bandwidth.
BandwidthPartInfoPtr & GetBwpAt(uint32_t ccId, uint32_t bwpId) const
Get the BWP at the cc/bwp specified.
std::vector< ComponentCarrierInfoPtr > m_cc
Operation band component carriers.
BandwidthPartInfoPtrVector GetBwps() const
Get the list of all the BWPs to pass to NrHelper.
bool AddCc(ComponentCarrierInfoPtr &&cc)
Adds the component carrier definition given as an input reference to the current operation band confi...
double m_lowerFrequency
Operation band lower frequency.
double m_centralFrequency
Operation band central frequency.
double m_higherFrequency
Operation band higher frequency.
uint8_t m_bandId
Operation band id.