satellite-wave-form-conf.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
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: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_WAVE_FORM_CONF_H
22 #define SATELLITE_WAVE_FORM_CONF_H
23 
24 #include "satellite-enums.h"
25 
26 #include <ns3/nstime.h>
27 #include <ns3/object.h>
28 #include <ns3/ptr.h>
29 #include <ns3/simple-ref-count.h>
30 
31 #include <vector>
32 
33 namespace ns3
34 {
35 
36 class SatLinkResultsRtn;
37 
47 class SatWaveform : public SimpleRefCount<SatWaveform>
48 {
49  public:
53  SatWaveform();
54 
65  SatWaveform(uint32_t wfId,
66  uint32_t modulatedBits,
67  double codingRate,
68  SatEnums::SatModcod_t modcod,
69  uint32_t payloadBytes,
70  uint32_t lengthInSymbols,
71  uint32_t preambleLengthInSymbols);
72 
77  uint32_t GetWaveformId() const;
78 
84 
89  uint32_t GetPayloadInBytes() const;
90 
95  uint32_t GetPreambleLengthInSymbols() const;
96 
101  uint32_t GetBurstLengthInSymbols() const;
102 
108  Time GetPreambleDuration(double symbolRateInBaud) const;
109 
115  Time GetBurstDuration(double symbolRateInBaud) const;
116 
123  double GetSpectralEfficiency(double carrierBandwidthInHz, double symbolRateInBaud) const;
124 
130  double GetThroughputInBitsPerSecond(double symbolRateInBaud) const;
131 
137  double GetCNoThreshold(double symbolRateInBaud) const;
138 
144  void SetEbNoRequirement(double ebnoRequirement);
145 
152  void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const;
153 
154  private:
158  uint32_t m_waveformId;
159 
166  uint32_t m_modulatedBits;
167 
171  double m_codingRate;
172 
177 
181  uint32_t m_payloadBytes;
182 
187 
192 
198 };
199 
209 class SatWaveformConf : public Object
210 {
211  public:
215  typedef std::vector<uint32_t> BurstLengthContainer_t;
216 
220  SatWaveformConf();
221 
226  SatWaveformConf(std::string filePathName);
227 
231  virtual ~SatWaveformConf();
232 
236  static TypeId GetTypeId(void);
237 
242  virtual TypeId GetInstanceTypeId(void) const;
243 
247  inline bool IsAcmEnabled() const
248  {
249  return m_acmEnabled;
250  }
251 
257  void InitializeEbNoRequirements(Ptr<SatLinkResultsRtn> linkResults);
258 
264  Ptr<SatWaveform> GetWaveform(uint32_t wfId) const;
265 
271  SatEnums::SatModcod_t GetModCod(uint32_t wfId) const;
272 
277  uint32_t GetDefaultWaveformId() const;
278 
283  inline uint32_t GetDefaultBurstLength() const
284  {
285  return GetWaveform(m_defaultWfId)->GetBurstLengthInSymbols();
286  }
287 
293  {
295  }
296 
306  bool GetBestWaveformId(double cno,
307  double symbolRateInBaud,
308  uint32_t& wfId,
309  double& cnoThreshold,
310  uint32_t burstLength = SHORT_BURST_LENGTH) const;
311 
318  bool GetMostRobustWaveformId(uint32_t& wfId, uint32_t burstLength = SHORT_BURST_LENGTH) const;
319 
326  void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const;
327 
332  inline uint32_t GetMinWfId()
333  {
334  return m_minWfId;
335  }
336 
341  inline uint32_t GetMaxWfId()
342  {
343  return m_maxWfId;
344  }
345 
349  static const uint32_t SHORT_BURST_LENGTH = 536;
350 
354  static const uint32_t LONG_BURST_LENGTH = 1616;
355 
356  private:
361  void ReadFromFile(std::string filePathName);
362 
370  SatEnums::SatModcod_t ConvertToModCod(uint32_t modulatedBits,
371  uint32_t codingRateNumerator,
372  uint32_t codingRateDenominator) const;
373 
377  std::map<uint32_t, Ptr<SatWaveform>> m_waveforms;
378 
383  double m_targetBLER;
384 
390 
394  uint32_t m_defaultWfId;
395 
400  uint32_t m_minWfId;
401  uint32_t m_maxWfId;
402 
407 
412 };
413 
414 } // namespace ns3
415 
416 #endif // SATELLITE_WAVE_FORM_CONF_H
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
SatWaveFormBurstLength_t
Definition for different types of Capacity Request (CR) messages.
This class implements the available waveform configurations of DVB-RCS2 return link.
const BurstLengthContainer_t & GetSupportedBurstLengths() const
Get supported burst lengths.
virtual ~SatWaveformConf()
Destructor for SatWaveformConf.
bool GetMostRobustWaveformId(uint32_t &wfId, uint32_t burstLength=SHORT_BURST_LENGTH) const
Get the most robust waveform id based payload of the waveform in bytes.
uint32_t m_defaultWfId
Default waveform id.
Ptr< SatWaveform > GetWaveform(uint32_t wfId) const
Get the details of a certain waveform.
uint32_t GetMaxWfId()
Get maximum supported waveform id return Maximum waveform id.
void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const
Dump the contents of the waveform.
std::vector< uint32_t > BurstLengthContainer_t
Define BurstLengthContainer.
bool IsAcmEnabled() const
Check if ACM is enabled.
void ReadFromFile(std::string filePathName)
Read the waveform table from a file.
SatEnums::SatWaveFormBurstLength_t m_burstLength
Burst length used.
uint32_t GetMinWfId()
Get minimum supported waveform id return Minimum waveform id.
bool GetBestWaveformId(double cno, double symbolRateInBaud, uint32_t &wfId, double &cnoThreshold, uint32_t burstLength=SHORT_BURST_LENGTH) const
Get the best waveform id based on UT's C/No and C/No thresholds.
std::map< uint32_t, Ptr< SatWaveform > > m_waveforms
Container of the waveforms.
static const uint32_t LONG_BURST_LENGTH
Static variable defining long burst length.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
BurstLengthContainer_t m_supportedBurstLengthsInSymbols
Container to store supported burst lengths.
SatEnums::SatModcod_t GetModCod(uint32_t wfId) const
Get MODCOD enum corresponding to a waveform id.
void InitializeEbNoRequirements(Ptr< SatLinkResultsRtn > linkResults)
Initialize the Eb/No requirements of the waveforms based on the used return link results.
double m_targetBLER
Block error rate target for the waveforms.
bool m_acmEnabled
Flag to indicate whether ACM is enabled or disabled.
static const uint32_t SHORT_BURST_LENGTH
Static variable defining short burst length.
uint32_t GetDefaultWaveformId() const
Get default waveform id.
uint32_t GetDefaultBurstLength() const
Get default burst length.
static TypeId GetTypeId(void)
Derived from Object.
SatWaveformConf()
Default constructor, which is not to be used.
SatEnums::SatModcod_t ConvertToModCod(uint32_t modulatedBits, uint32_t codingRateNumerator, uint32_t codingRateDenominator) const
Convert modulated bits and coding rate to a MODCOD enum.
uint32_t m_minWfId
Minimum and maximum waveform ids.
This class implements the content of one individual DVB-RCS2 waveform.
void SetEbNoRequirement(double ebnoRequirement)
Set the Eb/No requirement of the waveform in linear domain based on the used link results.
SatWaveform()
Default constructor for SatWaveform.
uint32_t m_payloadBytes
Payload in bytes.
uint32_t m_lengthInSymbols
Length of the burst in symbols.
double m_codingRate
Coding rate.
double m_ebnoRequirement
Eb/No threshold calculated with a certain BLER target from the link results.
uint32_t GetWaveformId() const
Get waveform id.
double GetCNoThreshold(double symbolRateInBaud) const
Get the C/No threshold of the waveform in linear domain.
SatEnums::SatModcod_t m_modCod
MODCOD enum.
uint32_t GetBurstLengthInSymbols() const
Get burst length of the waveform in symbols.
SatEnums::SatModcod_t GetModCod() const
Get MODCOD enum.
Time GetBurstDuration(double symbolRateInBaud) const
Get/calculate the burst duration of a waveform based on symbol rate.
Time GetPreambleDuration(double symbolRateInBaud) const
Get/calculate the preamble duration of a waveform based on symbol rate.
double GetSpectralEfficiency(double carrierBandwidthInHz, double symbolRateInBaud) const
Get/calculate the spectral efficiency of a waveform.
uint32_t GetPreambleLengthInSymbols() const
Get preamble length of the waveform in symbols.
uint32_t GetPayloadInBytes() const
Get payload of a waveform in bytes.
double GetThroughputInBitsPerSecond(double symbolRateInBaud) const
Get/calculate the throughput of a waveform based on symbol rate.
void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const
Dump the contents of the waveform.
uint32_t m_waveformId
Id of this waveform.
uint32_t m_modulatedBits
Modulated bits QPSK = 2 8PSK = 3 16QAM = 4.
uint32_t m_preambleLengthInSymbols
Length of the preamble in symbols.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.