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 <map>
32 #include <stdint.h>
33 #include <string>
34 #include <vector>
35 
36 namespace ns3
37 {
38 
39 class SatLinkResultsRtn;
40 
50 class SatWaveform : public SimpleRefCount<SatWaveform>
51 {
52  public:
56  SatWaveform();
57 
68  SatWaveform(uint32_t wfId,
69  uint32_t modulatedBits,
70  double codingRate,
71  SatEnums::SatModcod_t modcod,
72  uint32_t payloadBytes,
73  uint32_t lengthInSymbols,
74  uint32_t preambleLengthInSymbols);
75 
80  uint32_t GetWaveformId() const;
81 
87 
92  uint32_t GetPayloadInBytes() const;
93 
98  uint32_t GetPreambleLengthInSymbols() const;
99 
104  uint32_t GetBurstLengthInSymbols() const;
105 
111  Time GetPreambleDuration(double symbolRateInBaud) const;
112 
118  Time GetBurstDuration(double symbolRateInBaud) const;
119 
126  double GetSpectralEfficiency(double carrierBandwidthInHz, double symbolRateInBaud) const;
127 
133  double GetThroughputInBitsPerSecond(double symbolRateInBaud) const;
134 
140  double GetCNoThreshold(double symbolRateInBaud) const;
141 
147  void SetEbNoRequirement(double ebnoRequirement);
148 
155  void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const;
156 
157  private:
161  uint32_t m_waveformId;
162 
169  uint32_t m_modulatedBits;
170 
174  double m_codingRate;
175 
180 
184  uint32_t m_payloadBytes;
185 
190 
195 
201 };
202 
212 class SatWaveformConf : public Object
213 {
214  public:
218  typedef std::vector<uint32_t> BurstLengthContainer_t;
219 
223  SatWaveformConf();
224 
229  SatWaveformConf(std::string directoryPathName);
230 
234  virtual ~SatWaveformConf();
235 
239  static TypeId GetTypeId(void);
240 
245  virtual TypeId GetInstanceTypeId(void) const;
246 
250  inline bool IsAcmEnabled() const
251  {
252  return m_acmEnabled;
253  }
254 
260  void InitializeEbNoRequirements(Ptr<SatLinkResultsRtn> linkResults);
261 
267  Ptr<SatWaveform> GetWaveform(uint32_t wfId) const;
268 
274  SatEnums::SatModcod_t GetModCod(uint32_t wfId) const;
275 
280  uint32_t GetDefaultWaveformId() const;
281 
286  inline uint32_t GetDefaultBurstLength() const
287  {
288  return GetWaveform(m_defaultWfId)->GetBurstLengthInSymbols();
289  }
290 
296  {
298  }
299 
309  bool GetBestWaveformId(double cno,
310  double symbolRateInBaud,
311  uint32_t& wfId,
312  double& cnoThreshold,
313  uint32_t burstLength = SHORT_BURST_LENGTH) const;
314 
321  bool GetMostRobustWaveformId(uint32_t& wfId, uint32_t burstLength = SHORT_BURST_LENGTH) const;
322 
329  void Dump(double carrierBandwidthInHz, double symbolRateInBaud) const;
330 
335  inline uint32_t GetMinWfId()
336  {
337  return m_minWfId;
338  }
339 
344  inline uint32_t GetMaxWfId()
345  {
346  return m_maxWfId;
347  }
348 
352  static const uint32_t SHORT_BURST_LENGTH = 536;
353 
357  static const uint32_t LONG_BURST_LENGTH = 1616;
358 
359  private:
364  void ReadFromFileDefaultWaveform(std::string filePathName);
365 
370  void ReadFromFile(std::string filePathName);
371 
379  SatEnums::SatModcod_t ConvertToModCod(uint32_t modulatedBits,
380  uint32_t codingRateNumerator,
381  uint32_t codingRateDenominator) const;
382 
386  std::map<uint32_t, Ptr<SatWaveform>> m_waveforms;
387 
392  double m_targetBLER;
393 
399 
403  uint32_t m_defaultWfId;
404 
409  uint32_t m_minWfId;
410  uint32_t m_maxWfId;
411 
416 
421 };
422 
423 } // namespace ns3
424 
425 #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.
void ReadFromFileDefaultWaveform(std::string filePathName)
Read the default waveform ID from a file.
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.