25#include "ns3/boolean.h"
26#include "ns3/double.h"
29#include "ns3/string.h"
30#include "ns3/uinteger.h"
40NS_LOG_COMPONENT_DEFINE(
"SatBbFrameConf");
67 NS_LOG_FUNCTION(
this);
90 NS_LOG_FUNCTION(
this);
97 NS_LOG_FUNCTION(
this);
104 NS_LOG_FUNCTION(
this);
111 NS_LOG_FUNCTION(
this);
118 NS_LOG_FUNCTION(
this);
125 NS_LOG_FUNCTION(
this << cnoRequirement);
132 NS_LOG_FUNCTION(
this);
167 NS_LOG_FUNCTION(
this);
168 NS_FATAL_ERROR(
"Default constructor not supported!!!");
197 NS_LOG_FUNCTION(
this << symbolRate << dvbVersion);
203 NS_LOG_FUNCTION(
this);
205 Object::NotifyConstructionCompleted();
208 for (uint32_t i = 0; i < 7; ++i)
226 NS_FATAL_ERROR(
"Cannot use NORMAL_AND_SHORT_FRAMES with DVB-S2X ModCods");
240 NS_FATAL_ERROR(
"Unknown DVB version used");
247 ") is not in the list of used ModCods.");
251 std::vector<SatEnums::SatBbFrameType_t> frameTypes;
255 for (std::vector<SatEnums::SatModcod_t>::const_iterator mit =
m_modCodsUsed.begin();
262 for (std::vector<SatEnums::SatBbFrameType_t>::const_iterator fit = frameTypes.begin();
263 fit != frameTypes.end();
272 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(*mit, *fit, len, pl);
273 m_waveforms.insert(std::make_pair(std::make_pair(*mit, *fit), wf));
284 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(*mit, fit, len, pl);
285 m_waveforms.insert(std::make_pair(std::make_pair(*mit, fit), wf));
305 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(mit, fit, len, pl);
306 m_waveforms.insert(std::make_pair(std::make_pair(mit, fit), wf));
310 uint32_t payloadBitsForShortFrame = std::numeric_limits<uint32_t>::max();
311 uint32_t payloadBitsForNormalFrame = std::numeric_limits<uint32_t>::max();
314 for (waveformMap_t::const_reverse_iterator rit =
m_waveforms.rbegin();
321 if (rit->second->GetPayloadInBits() < payloadBitsForShortFrame)
323 payloadBitsForShortFrame = rit->second->GetPayloadInBits();
331 if (rit->second->GetPayloadInBits() < payloadBitsForNormalFrame)
333 payloadBitsForNormalFrame = rit->second->GetPayloadInBits();
344 "The most robust MODCOD not found for short frames, BB frame configuration error???");
351 "The most robust MODCOD not found for normal frames, BB frame configuration error???");
359 NS_FATAL_ERROR(
"The most robust MODCODs are different for short and normal frames!!!");
367 TypeId(
"ns3::SatBbFrameConf")
369 .AddAttribute(
"SymbolsPerSlot",
370 "Number of symbols per slot",
373 MakeUintegerChecker<uint32_t>())
374 .AddAttribute(
"PilotBlockInSymbols",
375 "Pilot block size in symbols",
378 MakeUintegerChecker<uint32_t>())
379 .AddAttribute(
"PilotBlockIntervalInSlots",
380 "Pilot block interval in slots",
383 MakeUintegerChecker<uint32_t>())
384 .AddAttribute(
"PlHeaderInSlots",
385 "PL header size in slots",
388 MakeUintegerChecker<uint32_t>())
389 .AddAttribute(
"DummyFrameInSlots",
390 "Dummy frame size in slots",
393 MakeUintegerChecker<uint32_t>())
394 .AddAttribute(
"TargetBLER",
395 "Block error rate target",
396 DoubleValue(0.00001),
398 MakeDoubleChecker<double>())
399 .AddAttribute(
"AcmEnabled",
403 MakeBooleanChecker())
404 .AddAttribute(
"DefaultModCod",
406 StringValue(
"QPSK_1_TO_2"),
409 .AddAttribute(
"DefaultModCodDummyFramesS2X",
410 "Default MODCOD for DVB-S2X Dummy Frames. In DVB-S2, Dummy Frames use "
412 StringValue(
"QPSK_1_TO_4"),
415 .AddAttribute(
"BbFrameHeaderInBytes",
416 "BB Frame header size in bytes",
419 MakeUintegerChecker<uint32_t>())
420 .AddAttribute(
"BbFrameHighOccupancyThreshold",
421 "BB Frame high occupancy threshold [0-1]",
424 MakeDoubleChecker<double>(0.0, 1.0))
425 .AddAttribute(
"BbFrameLowOccupancyThreshold",
426 "BB Frame low occupancy threshold [0-1]",
429 MakeDoubleChecker<double>(0.0, 1.0))
432 "Mode for selecting used BB Frames.",
440 "ShortAndNormalFrames"))
441 .AddAttribute(
"BBFramePilotsS2X",
442 "Use Pilots in DVB-S2X BB Frames.",
445 MakeBooleanChecker())
446 .AddAttribute(
"ModCodsUsed",
447 "List of DVB-S2X ModCods used. If nothing specified, all available "
458 NS_LOG_FUNCTION(
this);
464 NS_LOG_FUNCTION(
this);
473 double esnoRequirementDb =
474 linkResults->GetEsNoDb(it->second->GetModcod(), it->first.second,
m_targetBler);
488 NS_LOG_FUNCTION(
this);
499 NS_LOG_FUNCTION(
this);
503std::vector<SatEnums::SatModcod_t>
506 NS_LOG_FUNCTION(
this);
514 NS_LOG_FUNCTION(
this << modcod << frameType);
516 uint32_t dataSlots(0);
530 NS_FATAL_ERROR(
"Unsupported enum SatBbFrameType_t!");
543 NS_LOG_FUNCTION(
this << modcod << frameType);
545 uint32_t dataSlots(0);
559 NS_FATAL_ERROR(
"Unsupported enum SatBbFrameType_t!");
569 uint32_t totalSymbols = dataSymbols + pilotSymbols;
572 return Seconds(frameLength);
578 NS_LOG_FUNCTION(
this);
594 NS_FATAL_ERROR(
"Incorrect DVB version");
606 prefix =
"SAT_MODCOD_";
610 prefix =
"SAT_MODCOD_S2X_";
611 suffix = std::string(
"_") +
616 NS_FATAL_ERROR(
"Incorrect DVB version");
619 while (getline(strm, name,
' '))
631 NS_LOG_FUNCTION(
this << modcod << frameType);
632 return m_waveforms.at(std::make_pair(modcod, frameType))->GetPayloadInBits();
638 NS_LOG_FUNCTION(
this);
646 NS_LOG_FUNCTION(
this << modcod << frameType);
647 return m_waveforms.at(std::make_pair(modcod, frameType))->GetFrameDuration();
653 NS_LOG_FUNCTION(
this);
660 NS_LOG_FUNCTION(
this << frameType);
669 for (waveformMap_t::const_reverse_iterator rit =
m_waveforms.rbegin();
673 if (rit->second->GetBbFrameType() == frameType)
675 double cnoReq = rit->second->GetCNoRequirement();
679 return rit->second->GetModcod();
689 NS_LOG_FUNCTION(
this << frameType);
703 NS_FATAL_ERROR(
"Not supported frame type!!!");
706 return mostRobustModcod;
712 NS_LOG_FUNCTION(
this);
719 NS_LOG_FUNCTION(
this);
This class implements the BB Frame configurations for DVB-S2.
SatEnums::BbFrameUsageMode_t m_bbFrameUsageMode
BBFrame usage mode.
double GetSymbolRate()
Symbol rate in baud.
uint32_t m_pilotBlockInSymbols
The size of the pilot block in symbols.
void GetModCodsList()
Get the list of ModCods from their string representation.
void DumpWaveforms() const
Dump waveform details for debugging purposes.
SatBbFrameConf()
Default constructor.
uint32_t m_symbolsPerSlot
The size of the (data) slot in symbols.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
Time CalculateBbFrameDuration(SatEnums::SatModcod_t modcod, SatEnums::SatBbFrameType_t frameType) const
Calculate the BBFrame duration in Time.
double m_targetBler
Block error rate target for the waveforms.
void InitializeCNoRequirements(Ptr< SatLinkResultsFwd > linkResults)
Initialize the C/No requirements for a given BLER target.
virtual ~SatBbFrameConf()
Destructor for SatBbFrameConf.
double m_bbFrameLowOccupancyThreshold
The BB frame low occupancy threshold in range 0 - 1.
double m_bbFrameHighOccupancyThreshold
The BB frame high occupancy threshold in range 0 - 1.
std::map< uint32_t, uint32_t > m_normalFramePayloadInSlots
SatEnums::SatModcod_t m_defaultModCodDummyFramesS2X
Default MODCOD for DVB-S2X dummy Frames.
bool m_acmEnabled
Flag to indicate whether ACM is enabled or disabled.
static TypeId GetTypeId(void)
Get the type ID.
std::string m_defaultModCodStr
The string representation of default ModCod.
Time GetBbFrameDuration(SatEnums::SatModcod_t modcod, SatEnums::SatBbFrameType_t frameType) const
Get the BB frame frame duration.
std::vector< SatEnums::SatModcod_t > m_modCodsUsed
List of ModCods used.
bool m_bbFrameS2XPilots
Indicates if using pilots in BBFrames when DVB-S2X is chosen.
std::map< uint32_t, uint32_t > m_shortFramePayloadInSlots
uint32_t m_bbFrameHeaderSizeInBytes
The BB frame header size in bytes.
uint32_t m_plHeaderInSlots
The PL header size in slots.
SatEnums::SatModcod_t GetMostRobustModcod(SatEnums::SatBbFrameType_t frameType) const
Get the most robust MODCOD with a given BB frame type.
SatEnums::SatModcod_t m_mostRobustShortFrameModcod
The most robust MODCOD for short frame.
std::string m_defaultModCodDummyFramesS2XStr
String representation of default ModCod for DVB-S2X Dummy Frames.
SatEnums::DvbVersion_t GetDvbVersion()
Indicates if using DVB-S2 or DVB-S2X.
SatEnums::DvbVersion_t m_dvbVersion
Indicates if using DVB-S2 or DVB-S2X.
uint32_t m_pilotBlockIntervalInSlots
Interval of pilot block in slots.
uint32_t GetBbFramePayloadBits(SatEnums::SatModcod_t modcod, SatEnums::SatBbFrameType_t frameType) const
Get the BB frame payload in bits.
Time GetDummyBbFrameDuration() const
Get the dummy frame duration in Time.
std::vector< SatEnums::SatModcod_t > GetModCodsUsed()
Get the list of ModCods used.
SatEnums::SatModcod_t GetDefaultModCod() const
Get the default MODCOD.
uint32_t CalculateBbFramePayloadBits(SatEnums::SatModcod_t modcod, SatEnums::SatBbFrameType_t frameType) const
Calculate the BBrame higher layer payload in bits.
SatEnums::SatModcod_t GetBestModcod(double cNo, SatEnums::SatBbFrameType_t frameType) const
Get the best MODCOD with a given BB frame type.
std::string m_modCodsUsedStr
String containing all DVB-S2X ModCods used.
waveformMap_t m_waveforms
Available "waveforms", i.e.
SatEnums::SatModcod_t m_defaultModCod
Default MODCOD is used.
SatEnums::SatModcod_t GetDefaultModCodDummyFramesS2X() const
Get the default MODCOD for short DVB-S2X frames.
SatEnums::SatModcod_t m_mostRobustNormalFrameModcod
The most robust MODCOD for long frame.
double m_symbolRate
Symbol rate in baud.
uint32_t m_dummyFrameInSlots
Dummy BBFrame length in slots.
SatEnums class is for simplifying the use of enumerators in the satellite module.
static SatModcod_t GetModcodFromName(const std::string name)
static void GetAvailableBbFrameTypes(std::vector< SatBbFrameType_t > &frameTypes)
SatBbFrameType_t
BB frame type used in DVB-S2 FWD link.
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
static void GetAvailableModcodsFwdLinkS2X(std::vector< SatModcod_t > &modcods, SatEnums::BbFrameUsageMode_t type, bool pilots)
static std::string GetModcodTypeName(SatModcod_t modcod)
@ SHORT_AND_NORMAL_FRAMES
SHORT_AND_NORMAL_FRAMES.
@ SHORT_FRAMES
SHORT_FRAMES.
@ NORMAL_FRAMES
NORMAL_FRAMES.
DvbVersion_t
The scheduling algorithm used to fill the BBFrames.
static void GetAvailableModcodsFwdLink(std::vector< SatModcod_t > &modcods)
static SatEnums::SatBbFrameType_t GetFrameTypeS2X(SatEnums::SatModcod_t modcod)
static T DbToLinear(T db)
Converts decibels to linear.
static uint32_t GetModulatedBits(SatEnums::SatModcod_t modcod)
Get the modulated bits of a certain MODCOD.
static double GetCodingRate(SatEnums::SatModcod_t modcod)
Gets the coding rate of a certain MODCOD.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
const uint32_t payloadConf[7][3]
1st col = modulated bits 2nd col = payload slots per normal frame 3rnd col = payload slots per short ...