25 #include <ns3/boolean.h>
26 #include <ns3/double.h>
29 #include <ns3/string.h>
30 #include <ns3/uinteger.h>
40 NS_LOG_COMPONENT_DEFINE(
"SatBbFrameConf");
61 : m_modcod(
SatEnums::SAT_MODCOD_QPSK_1_TO_2),
63 m_frameDuration(Seconds(0.0)),
67 NS_LOG_FUNCTION(
this);
81 m_frameDuration(frameDur),
82 m_payloadBits(payloadBits),
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);
142 : m_symbolRate(100000000.0),
143 m_symbolsPerSlot(90),
144 m_pilotBlockInSymbols(0),
145 m_pilotBlockIntervalInSlots(36),
146 m_plHeaderInSlots(1),
147 m_dummyFrameInSlots(36),
148 m_bbFrameHeaderSizeInBytes(10),
149 m_bbFrameHighOccupancyThreshold(0.9),
150 m_bbFrameLowOccupancyThreshold(0.5),
151 m_targetBler(0.00001),
153 m_defaultModCodDummyFramesS2X(
SatEnums::SAT_NONVALID_MODCOD),
154 m_defaultModCodDummyFramesS2XStr(
"QPSK_1_TO_4"),
155 m_defaultModCod(
SatEnums::SAT_NONVALID_MODCOD),
156 m_defaultModCodStr(
"QPSK_1_TO_2"),
157 m_shortFramePayloadInSlots(),
158 m_normalFramePayloadInSlots(),
160 m_bbFrameUsageMode(
SatEnums::NORMAL_FRAMES),
161 m_mostRobustShortFrameModcod(
SatEnums::SAT_NONVALID_MODCOD),
162 m_mostRobustNormalFrameModcod(
SatEnums::SAT_NONVALID_MODCOD),
164 m_bbFrameS2XPilots(true),
167 NS_LOG_FUNCTION(
this);
168 NS_FATAL_ERROR(
"Default constructor not supported!!!");
172 : m_symbolRate(symbolRate),
173 m_symbolsPerSlot(90),
174 m_pilotBlockInSymbols(0),
175 m_pilotBlockIntervalInSlots(36),
176 m_plHeaderInSlots(1),
177 m_dummyFrameInSlots(36),
178 m_bbFrameHeaderSizeInBytes(10),
179 m_bbFrameHighOccupancyThreshold(0.9),
180 m_bbFrameLowOccupancyThreshold(0.5),
181 m_targetBler(0.00001),
183 m_defaultModCodDummyFramesS2X(
SatEnums::SAT_NONVALID_MODCOD),
184 m_defaultModCodDummyFramesS2XStr(
"QPSK_1_TO_4"),
185 m_defaultModCod(
SatEnums::SAT_NONVALID_MODCOD),
186 m_defaultModCodStr(
"QPSK_1_TO_2"),
187 m_shortFramePayloadInSlots(),
188 m_normalFramePayloadInSlots(),
190 m_bbFrameUsageMode(
SatEnums::NORMAL_FRAMES),
191 m_mostRobustShortFrameModcod(
SatEnums::SAT_NONVALID_MODCOD),
192 m_mostRobustNormalFrameModcod(
SatEnums::SAT_NONVALID_MODCOD),
193 m_dvbVersion(dvbVersion),
194 m_bbFrameS2XPilots(true),
197 ObjectBase::ConstructSelf(AttributeConstructionList());
200 for (uint32_t i = 0; i < 7; ++i)
218 NS_FATAL_ERROR(
"Cannot use NORMAL_AND_SHORT_FRAMES with DVB-S2X ModCods");
232 NS_FATAL_ERROR(
"Unknown DVB version used");
239 ") is not in the list of used ModCods.");
243 std::vector<SatEnums::SatBbFrameType_t> frameTypes;
247 for (std::vector<SatEnums::SatModcod_t>::const_iterator mit =
m_modCodsUsed.begin();
254 for (std::vector<SatEnums::SatBbFrameType_t>::const_iterator fit = frameTypes.begin();
255 fit != frameTypes.end();
264 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(*mit, *fit, len, pl);
265 m_waveforms.insert(std::make_pair(std::make_pair(*mit, *fit), wf));
276 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(*mit, fit, len, pl);
277 m_waveforms.insert(std::make_pair(std::make_pair(*mit, fit), wf));
297 Ptr<SatDvbS2Waveform> wf = Create<SatDvbS2Waveform>(mit, fit, len, pl);
298 m_waveforms.insert(std::make_pair(std::make_pair(mit, fit), wf));
302 uint32_t payloadBitsForShortFrame = std::numeric_limits<uint32_t>::max();
303 uint32_t payloadBitsForNormalFrame = std::numeric_limits<uint32_t>::max();
306 for (waveformMap_t::const_reverse_iterator rit =
m_waveforms.rbegin();
313 if (rit->second->GetPayloadInBits() < payloadBitsForShortFrame)
315 payloadBitsForShortFrame = rit->second->GetPayloadInBits();
323 if (rit->second->GetPayloadInBits() < payloadBitsForNormalFrame)
325 payloadBitsForNormalFrame = rit->second->GetPayloadInBits();
336 "The most robust MODCOD not found for short frames, BB frame configuration error???");
343 "The most robust MODCOD not found for normal frames, BB frame configuration error???");
351 NS_FATAL_ERROR(
"The most robust MODCODs are different for short and normal frames!!!");
359 TypeId(
"ns3::SatBbFrameConf")
361 .AddAttribute(
"SymbolsPerSlot",
362 "Number of symbols per slot",
365 MakeUintegerChecker<uint32_t>())
366 .AddAttribute(
"PilotBlockInSymbols",
367 "Pilot block size in symbols",
370 MakeUintegerChecker<uint32_t>())
371 .AddAttribute(
"PilotBlockIntervalInSlots",
372 "Pilot block interval in slots",
375 MakeUintegerChecker<uint32_t>())
376 .AddAttribute(
"PlHeaderInSlots",
377 "PL header size in slots",
380 MakeUintegerChecker<uint32_t>())
381 .AddAttribute(
"DummyFrameInSlots",
382 "Dummy frame size in slots",
385 MakeUintegerChecker<uint32_t>())
386 .AddAttribute(
"TargetBLER",
387 "Block error rate target",
388 DoubleValue(0.00001),
390 MakeDoubleChecker<double>())
391 .AddAttribute(
"AcmEnabled",
395 MakeBooleanChecker())
396 .AddAttribute(
"DefaultModCod",
398 StringValue(
"QPSK_1_TO_2"),
401 .AddAttribute(
"DefaultModCodDummyFramesS2X",
402 "Default MODCOD for DVB-S2X Dummy Frames. In DVB-S2, Dummy Frames use "
404 StringValue(
"QPSK_1_TO_4"),
407 .AddAttribute(
"BbFrameHeaderInBytes",
408 "BB Frame header size in bytes",
411 MakeUintegerChecker<uint32_t>())
412 .AddAttribute(
"BbFrameHighOccupancyThreshold",
413 "BB Frame high occupancy threshold [0-1]",
416 MakeDoubleChecker<double>(0.0, 1.0))
417 .AddAttribute(
"BbFrameLowOccupancyThreshold",
418 "BB Frame low occupancy threshold [0-1]",
421 MakeDoubleChecker<double>(0.0, 1.0))
424 "Mode for selecting used BB Frames.",
432 "ShortAndNormalFrames"))
433 .AddAttribute(
"BBFramePilotsS2X",
434 "Use Pilots in DVB-S2X BB Frames.",
437 MakeBooleanChecker())
438 .AddAttribute(
"ModCodsUsed",
439 "List of DVB-S2X ModCods used. If nothing specified, all available "
444 .AddConstructor<SatBbFrameConf>();
456 NS_LOG_FUNCTION(
this);
462 NS_LOG_FUNCTION(
this);
471 double esnoRequirementDb =
472 linkResults->GetEsNoDb(it->second->GetModcod(), it->first.second,
m_targetBler);
486 NS_LOG_FUNCTION(
this);
497 NS_LOG_FUNCTION(
this);
501 std::vector<SatEnums::SatModcod_t>
504 NS_LOG_FUNCTION(
this);
512 NS_LOG_FUNCTION(
this << modcod << frameType);
514 uint32_t dataSlots(0);
528 NS_FATAL_ERROR(
"Unsupported enum SatBbFrameType_t!");
541 NS_LOG_FUNCTION(
this << modcod << frameType);
543 uint32_t dataSlots(0);
557 NS_FATAL_ERROR(
"Unsupported enum SatBbFrameType_t!");
567 uint32_t totalSymbols = dataSymbols + pilotSymbols;
570 return Seconds(frameLength);
576 NS_LOG_FUNCTION(
this);
592 NS_FATAL_ERROR(
"Incorrect DVB version");
604 prefix =
"SAT_MODCOD_";
608 prefix =
"SAT_MODCOD_S2X_";
609 suffix = std::string(
"_") +
614 NS_FATAL_ERROR(
"Incorrect DVB version");
617 while (getline(strm, name,
' '))
629 NS_LOG_FUNCTION(
this << modcod << frameType);
630 return m_waveforms.at(std::make_pair(modcod, frameType))->GetPayloadInBits();
636 NS_LOG_FUNCTION(
this);
644 NS_LOG_FUNCTION(
this << modcod << frameType);
645 return m_waveforms.at(std::make_pair(modcod, frameType))->GetFrameDuration();
651 NS_LOG_FUNCTION(
this);
658 NS_LOG_FUNCTION(
this << frameType);
667 for (waveformMap_t::const_reverse_iterator rit =
m_waveforms.rbegin();
671 if (rit->second->GetBbFrameType() == frameType)
673 double cnoReq = rit->second->GetCNoRequirement();
677 return rit->second->GetModcod();
687 NS_LOG_FUNCTION(
this << frameType);
701 NS_FATAL_ERROR(
"Not supported frame type!!!");
704 return mostRobustModcod;
710 NS_LOG_FUNCTION(
this);
717 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.
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.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
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 ...